mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 12:15:29 +00:00
feat: add scripts to backup/restore everything
This commit is contained in:
48
bin/gource-gravatars
Executable file
48
bin/gource-gravatars
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/perl
|
||||
# Fetch Gravatars
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use LWP::Simple;
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
my $size = 90;
|
||||
my $output_dir = '.git/avatar';
|
||||
|
||||
die("no .git/ directory found in current path\n") unless -d '.git';
|
||||
|
||||
mkdir($output_dir) unless -d $output_dir;
|
||||
|
||||
open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");
|
||||
|
||||
my %processed_authors;
|
||||
|
||||
while(<GITLOG>) {
|
||||
chomp;
|
||||
my($email, $author) = split(/\|/, $_);
|
||||
|
||||
next if $processed_authors{$author}++;
|
||||
|
||||
my $author_image_file = $output_dir . '/' . $author . '.png';
|
||||
|
||||
#skip images we have
|
||||
next if -e $author_image_file;
|
||||
|
||||
#try and fetch image
|
||||
|
||||
my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&size=".$size;
|
||||
|
||||
warn "fetching image for '$author' $email ($grav_url)...\n";
|
||||
|
||||
my $rc = getstore($grav_url, $author_image_file);
|
||||
|
||||
sleep(1);
|
||||
|
||||
if($rc != 200) {
|
||||
unlink($author_image_file);
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
close GITLOG;
|
||||
11
bin/gpg-keys-backup
Executable file
11
bin/gpg-keys-backup
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Export public keys
|
||||
gpg --export --armor > ~/.dotfiles/private/gpg/public_keys.asc
|
||||
|
||||
# Export private keys
|
||||
gpg --export-secret-keys --armor > ~/.dotfiles/private/gpg/private_keys.asc
|
||||
|
||||
# Export trust database
|
||||
gpg --export-ownertrust > ~/.dotfiles/private/gpg/ownertrust.txt
|
||||
|
||||
10
bin/gpg-keys-restore
Executable file
10
bin/gpg-keys-restore
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Export public keys
|
||||
gpg --import ~/.dotfiles/private/gpg/public_keys.asc
|
||||
|
||||
# Export private keys
|
||||
gpg --import ~/.dotfiles/private/gpg/private_keys.asc
|
||||
|
||||
# Export trust database
|
||||
gpg --import-ownertrust ~/.dotfiles/private/gpg/ownertrust.txt
|
||||
4
bin/launchagents-backup
Executable file
4
bin/launchagents-backup
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
# AltTab
|
||||
cp ~/Library/LaunchAgents/com.lwouis.alt-tab-macos.plist ~/.dotfiles/private/launch-agents/
|
||||
4
bin/launchagents-restore
Executable file
4
bin/launchagents-restore
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
# AltTab
|
||||
cp ~/.dotfiles/private/launch-agents/com.lwouis.alt-tab-macos.plist ~/Library/LaunchAgents/
|
||||
218
bin/macos-settings
Executable file
218
bin/macos-settings
Executable file
@@ -0,0 +1,218 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Close any open System Preferences panes, to prevent them from overriding
|
||||
# settings we’re about to change
|
||||
osascript -e 'tell application "System Preferences" to quit'
|
||||
|
||||
# Ask for the administrator password upfront
|
||||
sudo -v
|
||||
|
||||
# Keep-alive: update existing `sudo` time stamp until `macos.sh` has finished
|
||||
while true; do
|
||||
sudo -n true
|
||||
sleep 60
|
||||
kill -0 "$$" || exit
|
||||
done 2>/dev/null &
|
||||
|
||||
# Set Dark Mode
|
||||
defaults write -g AppleInterfaceStyle Dark
|
||||
|
||||
# Set sidebar icon size
|
||||
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 3
|
||||
|
||||
# Expand save panel by default
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
|
||||
|
||||
# Expand print panel by default
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
|
||||
|
||||
# Disable the “Are you sure you want to open this application?” dialog
|
||||
defaults write com.apple.LaunchServices LSQuarantine -bool false
|
||||
|
||||
# Disable automatic capitalization as it’s annoying when typing code
|
||||
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
|
||||
|
||||
# Disable smart dashes as they’re annoying when typing code
|
||||
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
||||
|
||||
# Disable automatic period substitution as it’s annoying when typing code
|
||||
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
|
||||
|
||||
# Disable smart quotes as they’re annoying when typing code
|
||||
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
|
||||
|
||||
# Disable auto-correct
|
||||
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
|
||||
|
||||
# Reduce Motion
|
||||
defaults write com.apple.universalaccess reduceMotion -bool true
|
||||
|
||||
# Menu Bar Size
|
||||
defaults write NSGlobalDomain NSTitleBarSize 22
|
||||
|
||||
# Set a blazingly fast keyboard repeat rate
|
||||
defaults write NSGlobalDomain KeyRepeat -int 1
|
||||
defaults write NSGlobalDomain InitialKeyRepeat -int 10
|
||||
|
||||
# Set language and text formats
|
||||
defaults write NSGlobalDomain AppleLanguages -array "en-DE" "de-DE" "ja-DE"
|
||||
defaults write NSGlobalDomain AppleLocale -string "en_DE@currency=EUR"
|
||||
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
|
||||
|
||||
# Save screenshots to Dropbox
|
||||
defaults write com.apple.screencapture location -string "${HOME}/Dropbox/Bilder/Screenshots"
|
||||
|
||||
# Set Desktop as the default location for new Finder windows
|
||||
# For other paths, use `PfLo` and `file:///full/path/here/`
|
||||
defaults write com.apple.finder NewWindowTarget -string "PfLo"
|
||||
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Downloads/"
|
||||
|
||||
# Show/hide icons for hard drives, servers, and removable media on the desktop
|
||||
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
|
||||
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
|
||||
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
|
||||
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
|
||||
|
||||
# Finder: show all filename extensions
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# Finder: show status bar
|
||||
defaults write com.apple.finder ShowStatusBar -bool true
|
||||
|
||||
# Finder: show path bar
|
||||
defaults write com.apple.finder ShowPathbar -bool true
|
||||
|
||||
# Keep folders on top when sorting by name
|
||||
defaults write com.apple.finder _FXSortFoldersFirst -bool true
|
||||
|
||||
# When performing a search, search the current folder by default
|
||||
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
|
||||
|
||||
# Disable the warning when changing a file extension
|
||||
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
|
||||
|
||||
# Enable spring loading for directories
|
||||
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
|
||||
|
||||
# Remove the spring loading delay for directories
|
||||
defaults write NSGlobalDomain com.apple.springing.delay -float 0.5
|
||||
|
||||
# Avoid creating .DS_Store files on network or USB volumes
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
|
||||
|
||||
# Disable disk image verification
|
||||
defaults write com.apple.frameworks.diskimages skip-verify -bool true
|
||||
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
|
||||
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
|
||||
|
||||
# Automatically open a new Finder window when a volume is mounted
|
||||
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
|
||||
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
|
||||
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
|
||||
|
||||
# Show the ~/Library folder
|
||||
chflags nohidden ~/Library
|
||||
|
||||
# Show the /Volumes folder
|
||||
sudo chflags nohidden /Volumes
|
||||
|
||||
# Icon Settings
|
||||
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:iconSize 44" ~/Library/Preferences/com.apple.finder.plist
|
||||
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:gridSpacing 60" ~/Library/Preferences/com.apple.finder.plist
|
||||
|
||||
# Set the icon size of Dock items to 36 pixels
|
||||
defaults write com.apple.dock tilesize -int 36
|
||||
|
||||
# Change minimize/maximize window effect
|
||||
defaults write com.apple.dock mineffect -string "scale"
|
||||
|
||||
# Minimize windows into their application’s icon
|
||||
defaults write com.apple.dock minimize-to-application -bool true
|
||||
|
||||
# Disable spring loading for all Dock items
|
||||
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool false
|
||||
|
||||
# Hide indicator lights for open applications in the Dock
|
||||
defaults write com.apple.dock show-process-indicators -bool false
|
||||
|
||||
# Don’t animate opening applications from the Dock
|
||||
defaults write com.apple.dock launchanim -bool false
|
||||
|
||||
# Speed up Mission Control animations
|
||||
defaults write com.apple.dock expose-animation-duration -float 0.1
|
||||
|
||||
# Don’t automatically rearrange Spaces based on most recent use
|
||||
defaults write com.apple.dock mru-spaces -bool false
|
||||
|
||||
# Remove the auto-hiding Dock delay
|
||||
defaults write com.apple.dock autohide-delay -float 0
|
||||
|
||||
# Remove the animation when hiding/showing the Dock
|
||||
defaults write com.apple.dock autohide-time-modifier -float 0
|
||||
|
||||
# Automatically hide and show the Dock
|
||||
defaults write com.apple.dock autohide -bool true
|
||||
|
||||
# Make Dock icons of hidden applications translucent
|
||||
defaults write com.apple.dock showhidden -bool true
|
||||
|
||||
# Don’t show recent applications in Dock
|
||||
defaults write com.apple.dock show-recents -bool false
|
||||
|
||||
# Remove all persistent apps and others from the Dock
|
||||
# defaults delete com.apple.dock persistent-apps
|
||||
# defaults delete com.apple.dock persistent-others
|
||||
|
||||
# Hot corner: top left → None
|
||||
defaults write com.apple.dock wvous-tl-corner -int 0
|
||||
defaults write com.apple.dock wvous-tl-modifier -int 0
|
||||
|
||||
# Hot corner: top right → Notification Center
|
||||
defaults write com.apple.dock wvous-tr-corner -int 12
|
||||
defaults write com.apple.dock wvous-tr-modifier -int 0
|
||||
|
||||
# Hot corner: bottom left → Desktop
|
||||
defaults write com.apple.dock wvous-bl-corner -int 4
|
||||
defaults write com.apple.dock wvous-bl-modifier -int 0
|
||||
|
||||
# Hot corner: bottom right → Put display to sleep
|
||||
defaults write com.apple.dock wvous-bl-corner -int 10
|
||||
defaults write com.apple.dock wvous-bl-modifier -int 0
|
||||
|
||||
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
|
||||
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
|
||||
|
||||
# Tracking speed: (default is 1.5 in GUI)
|
||||
defaults read -g com.apple.trackpad.scaling
|
||||
|
||||
# Tracking speed: maximum 5.0
|
||||
defaults write -g com.apple.trackpad.scaling 5.0
|
||||
|
||||
# Trackpad: enable tap to click for this user and for the login screen
|
||||
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
|
||||
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
|
||||
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
|
||||
|
||||
# Mouse Tracking speed: (default is 3 in GUI)
|
||||
defaults read -g com.apple.mouse.scaling
|
||||
|
||||
# Mouse Tracking speed: maximum 5.0
|
||||
defaults write -g com.apple.mouse.scaling 5.0
|
||||
|
||||
# Trackpad: map bottom right corner to right-click
|
||||
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
|
||||
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
|
||||
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
|
||||
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true
|
||||
|
||||
for app in "Dock" \
|
||||
"Finder" \
|
||||
"Messages" \
|
||||
"SystemUIServer"; do
|
||||
killall "${app}" &>/dev/null
|
||||
done
|
||||
|
||||
echo "Done. Note that some of these changes require a logout/restart to take effect."
|
||||
49
bin/preferences-backup
Executable file
49
bin/preferences-backup
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Export all Keyboard Shortcuts
|
||||
defaults export com.apple.symbolichotkeys ~/.dotfiles/private/preferences/keyboard_shortcuts.plist
|
||||
defaults export com.apple.universalaccess ~/.dotfiles/private/preferences/universal_access_shortcuts.plist
|
||||
|
||||
# Export all Dock settings
|
||||
defaults export com.apple.dock ~/.dotfiles/private/preferences/dock.plist
|
||||
|
||||
# Save the Stable Diffusion Settings file
|
||||
cp ~/Code/AI/stable-diffusion-webui/webui-macos-env.sh ~/.dotfiles/private/preferences/webui-macos-env.sh
|
||||
|
||||
# Affinity
|
||||
cp ~/Library/Preferences/com.seriflabs.affinitydesigner2.plist ~/.dotfiles/private/preferences/
|
||||
cp ~/Library/Preferences/com.seriflabs.affinityphoto2.plist ~/.dotfiles/private/preferences/
|
||||
cp ~/Library/Preferences/com.seriflabs.affinitypublisher2.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Alfred
|
||||
cp ~/Library/Preferences/com.runningwithcrayons.Alfred.plist ~/.dotfiles/private/preferences/
|
||||
cp ~/Library/Preferences/com.runningwithcrayons.Alfred-Preferences.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# AltTab
|
||||
cp ~/Library/Preferences/com.lwouis.alt-tab-macos.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Anki
|
||||
cp ~/Library/Preferences/net.ankiweb.dtop.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Arc
|
||||
cp ~/Library/Preferences/company.thebrowser.Browser.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Bartender
|
||||
cp -R ~/Library/Application\ Support/Bartender/Bartender.BartenderPreferences ~/.dotfiles/private/preferences/
|
||||
cp ~/Library/Preferences/com.surteesstudios.Bartender.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# BibDesk
|
||||
cp -R ~/Library/Application\ Support/BibDesk/ ~/.dotfiles/private/preferences/BibDesk/
|
||||
cp ~/Library/Preferences/edu.ucsd.cs.mmccrack.bibdesk.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Brave
|
||||
cp ~/Library/Preferences/com.brave.Browser.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# CleanShot X
|
||||
cp ~/Library/Preferences/pl.maketheweb.cleanshotx.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Itsycal
|
||||
cp ~/Library/Preferences/com.mowglii.itsycalApp.plist ~/.dotfiles/private/preferences/
|
||||
|
||||
# Raycast
|
||||
cp ~/Library/Preferences/com.raycast.macos.plist ~/.dotfiles/private/preferences/
|
||||
53
bin/preferences-restore
Executable file
53
bin/preferences-restore
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Import all Keyboard Shortcuts
|
||||
defaults import com.apple.symbolichotkeys ~/.dotfiles/private/preferences/keyboard_shortcuts.plist
|
||||
defaults import com.apple.universalaccess ~/.dotfiles/private/preferences/universal_access_shortcuts.plist
|
||||
|
||||
# Remove default Dock and import all Dock settings
|
||||
defaults delete com.apple.dock persistent-apps
|
||||
defaults delete com.apple.dock persistent-others
|
||||
defaults import com.apple.dock ~/.dotfiles/private/preferences/dock.plist
|
||||
|
||||
echo "Please log out and back in to apply the changes."
|
||||
|
||||
# Restore the Stable Diffusion Settings file
|
||||
cp ~/.dotfiles/private/preferences/webui-macos-env.sh ~/Code/AI/stable-diffusion-webui/webui-macos-env.sh
|
||||
|
||||
# Affinity
|
||||
cp ~/.dotfiles/private/preferences/com.seriflabs.affinitydesigner2.plist ~/Library/Preferences/
|
||||
cp ~/.dotfiles/private/preferences/com.seriflabs.affinityphoto2.plist ~/Library/Preferences/
|
||||
cp ~/.dotfiles/private/preferences/com.seriflabs.affinitypublisher2.plist ~/Library/Preferences/
|
||||
|
||||
# Alfred
|
||||
cp ~/.dotfiles/private/preferences/com.runningwithcrayons.Alfred.plist ~/Library/Preferences/
|
||||
cp ~/.dotfiles/private/preferences/com.runningwithcrayons.Alfred-Preferences.plist ~/Library/Preferences/
|
||||
|
||||
# AltTab
|
||||
cp ~/.dotfiles/private/preferences/com.lwouis.alt-tab-macos.plist ~/Library/Preferences/
|
||||
|
||||
# Anki
|
||||
cp ~/.dotfiles/private/preferences/net.ankiweb.dtop.plist ~/Library/Preferences/
|
||||
|
||||
# Arc
|
||||
cp ~/.dotfiles/private/preferences/company.thebrowser.Browser.plist ~/Library/Preferences/
|
||||
|
||||
# Bartender
|
||||
cp -R ~/.dotfiles/private/preferences/Bartender.BartenderPreferences ~/Library/Application\ Support/Bartender/
|
||||
cp ~/.dotfiles/private/preferences/com.surteesstudios.Bartender.plist ~/Library/Preferences/
|
||||
|
||||
# BibDesk
|
||||
cp -R ~/.dotfiles/private/preferences/BibDesk/ ~/Library/Application\ Support/
|
||||
cp ~/.dotfiles/private/preferences/edu.ucsd.cs.mmccrack.bibdesk.plist ~/Library/Preferences/
|
||||
|
||||
# Brave
|
||||
cp ~/.dotfiles/private/preferences/com.brave.Browser.plist ~/Library/Preferences/
|
||||
|
||||
# CleanShot X
|
||||
cp ~/.dotfiles/private/preferences/pl.maketheweb.cleanshotx.plist ~/Library/Preferences/
|
||||
|
||||
# Itsycal
|
||||
cp ~/.dotfiles/private/preferences/com.mowglii.itsycalApp.plist ~/Library/Preferences/
|
||||
|
||||
# Raycast
|
||||
cp ~/.dotfiles/private/preferences/com.raycast.macos.plist ~/Library/Preferences/
|
||||
11
bin/screenshot
Executable file
11
bin/screenshot
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Create a set of screenshots from a URL
|
||||
# Usage: screenshot <url>
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo 1>&2 Usage: screenshot \<url\> \(parameters\)
|
||||
exit 127
|
||||
fi
|
||||
|
||||
pageres 375x667 768x1024 1280x800 $*
|
||||
2
private
2
private
Submodule private updated: 6fbaa7e152...ed884f4165
Reference in New Issue
Block a user