Skip to content

Instantly share code, notes, and snippets.

'''Routines for manipulating the Dock'''
import os
import subprocess
from Foundation import NSURL
from Foundation import CFPreferencesAppSynchronize
from Foundation import CFPreferencesCopyAppValue
from Foundation import CFPreferencesSetAppValue
@trusktr
trusktr / DefaultKeyBinding.dict
Last active January 24, 2026 00:20
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@albertbori
albertbori / Installation.md
Last active December 26, 2025 23:19
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@seansu4you87
seansu4you87 / geektools-multi-monitor.md
Last active January 4, 2025 22:04
GeekTools Multi Monitor Reposition

Geektools with Varying Monitor Setups

While I love my Geeklets, I had a pretty hard time to set them up consistently across varying monitor setups (home, work, on the go,...). The bad news first: There is no built in mechanism (as of 01/2013) to take care of this problem. Still there are good news: With some minor tinkering, you can automagically position your Geeklets across multiple setups.

The initial step is to add your Geeklets - you can totally ignore the positioning for the moment.

Which Geeklets Am I Running?

@dannysmith
dannysmith / osx_setup.sh
Last active September 3, 2025 19:21
Sensible defaults for New Mac
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@ccstone
ccstone / Desktop_Sweeper.applescript
Last active January 5, 2025 00:27
An Applescript to sweep your desktop.Creates a dated folder inside ~/Documents/Sweep Desktop/ with newly swept items.Items may be grouped using their file extension (examples provided in the script).Items may be excluded by name, and items labeled with green, gray, or red are automatically excluded.
------------------------------------------------------------------------------------------------
# 2015/10/03 10:42
# NOTE: El Capitan breaks the whose clauses in this.
# They still work but take 30+ seconds instead of 3-4.
# I will update this with ASObjC when I get the chance.
------------------------------------------------------------------------------------------------
# Auth: Christopher Stone <[email protected]>
# dCre: 2012-09-30 : 16:51
# dMod: 2013-06-20 : 10:35
# Appl: Finder