Skip to content

Instantly share code, notes, and snippets.

View lozturner's full-sized avatar
💭
I may be slow to respond.

TriggerT lozturner

💭
I may be slow to respond.
View GitHub Profile
cd 'HKCU:\Control Panel\Desktop'
$val = Get-ItemProperty -Path . -Name "LogPixels"
if($val.LogPixels -ne 96)
{
Write-Host 'Change to 100% / 96 dpi'
Set-ItemProperty -Path . -Name LogPixels -Value 96
} else {
Write-Host 'Change to 150% / 144 dpi'
Set-ItemProperty -Path . -Name LogPixels -Value 144
}

New Computer Setup

Last tested using Mac OS X 10.8 Mountain Lion

Before Wiping Original Install

  • Backup .ssh folder to avoid having to regenerate codes for services such as Heroku and Github.
macOS user interface
1. Disable animations when opening and closing windows.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
2. Disable animations when opening a Quick Look window.
defaults write -g QLPanelAnimationDuration -float 0
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of tab group 1 of window 1
end tell
quit application "System Preferences"
Scripting Key Remapping
Keys can be remapped via the command-line tool hidutil. For example, use the hidutil command-line tool to remap the 'A' key to the 'B' key as shown in Listing 1. The map array consists of two key/value pairs that contain the source (HIDKeyboardModifierMappingSrc) and destination (HIDKeyboardModifierMappingDstKey) of the key remapping. The keys take a hexadecimal value that consists of 0x700000000 or’d with the desired keyboard usage value (see Table 1 for usage values).
Listing 1 Remapping keys in a script
$ hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000004,"HIDKeyboardModifierMappingDst":0x700000005},{"HIDKeyboardModifierMappingSrc":0x700000005,"HIDKeyboardModifierMappingDst":0x700000004}]}'
)
A script can check the key remapping state by using the hidutil command-line tool as shown in Listing 2. A null result indicates that there are no key remappings active.
Listing 2 Checking Key Remapping state
Note that all of these search operators are used in Spotlight in the following syntax format “operator:specific” always separated by a semi-colon. If you’re having troubles with results coming back, check your syntax to make sure you have typed things correctly.
kind:application
kind:applications
kind:app
kind:contact
kind:contacts
kind:folder
kind:folders
kind:image
@lozturner
lozturner / curl-install.sh
Created May 31, 2017 19:40 — forked from kossoy/curl-install.sh
install curl
sudo apt-get install curl
@lozturner
lozturner / macosx-contextmenu-automator-stripmetadata.md
Created May 31, 2017 19:22 — forked from christopheranderton/macosx-contextmenu-automator-stripmetadata.md
Add a ”Strip Metdata” Service to your context menu (Right-Click Menu) in macOS/Mac OS X. This Service uses ExifTool and Tag (both via Homebrew) or xattr.

1. What you need

  • macOS/Mac OS X (tested only on El Capitan, but should work on Sierra and older versions)
  • Xcode Command Line Tools / Xcode
  • Homebrew (http://brew.sh/)
  • Tag (via Homebrew)
  • ExifTool (via Homebrew)

2. Installing Homebrew, Tag and ExifTool

@lozturner
lozturner / mac.md
Created May 31, 2017 19:22 — forked from lornajane/mac.md
Keyboard Only OS X

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
-------------------------------------------------------------------------------------------
REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2016/05/25 15:01
-------------------------------------------------------------------------------------------
NOTES
-------------------------------------------------------------------------------------------
AppleScript is a rather peculiar scripting language to learn.