Skip to content

Instantly share code, notes, and snippets.

# Remove point in time backups from timemachine
# First mount timemachine volume (for example open Time Machine.app)
sudo tmutil delete /Volumes/Time Machine Backups/Backups.backupdb/$(MACHINE_NAME)/$(DATE)
# If you have your backups stored in a sparsebundle you can reclaim the freed space with this:
sudo hdiutil compact $(DISK_IMAGE_PATH)
# Use this if you are on battery and receive a odd warning from the command above ;)
sudo hdiutil compact $(DISK_IMAGE_PATH) -batteryallowed
@benzimmer
benzimmer / docker.sh
Created August 25, 2015 09:02
Docker oneliners
# Show memory usage of all docker containers
$ for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do docker ps | grep $line | awk '{printf $NF" "}' && echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB ; done
# Remove non-running Docker containers
$ docker rm `(docker ps -q && docker ps -qa) | sort | uniq -u`
@benzimmer
benzimmer / orphan-branch.sh
Created July 17, 2015 06:11
Create git orphan branch
git checkout --orphan newbranch
git rm -rf .
<do work>
git add your files
git commit -m 'Initial commit'
@benzimmer
benzimmer / responsive-video-embed.css
Created June 23, 2015 08:55
Responsive Video iframe embedding
.video-wrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.video-wrapper iframe {
position: absolute;
top: 0;
@benzimmer
benzimmer / gist:6c8b5df3b0c6798e33bf
Created March 15, 2015 07:39
Attach to a tmux session that runs on an older version
$ tmux attach
protocol version mismatch (client 7, server 6)
$ pgrep tmux
3429
$ /proc/3429/exe attach
### Keybase proof
I hereby claim:
* I am benzimmer on github.
* I am benzimmer (https://keybase.io/benzimmer) on keybase.
* I have a public key whose fingerprint is 633B 78E8 76FB 1CBF B7A3 6388 796D FEFF D4D2 519C
To claim this, I am signing this object:
@benzimmer
benzimmer / gist:7600048
Last active December 29, 2015 02:19
Ruby beginners workshop

Infopark&Friends Ruby Beginners Workshop

$> irb

Alles ist ein Objekt

Um in Ruby Dinge zu tun versetzt man sich in die Lage eines Objektes. Um herauszufinden welches Objekt man gerade ist benutzt man self

self