Skip to content

Instantly share code, notes, and snippets.

View nicerobot's full-sized avatar
🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎

nicerobot nicerobot

🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎
View GitHub Profile
@nicerobot
nicerobot / make-timemachine-bundle
Created May 23, 2011 02:50
Create a Time Machine sparse bundle
View make-timemachine-bundle
hdiutil create \
-size 200G \
-fs HFS+J \
-volname "Time Machine" \
${HOSTNAME%%.*}_$(/sbin/ifconfig en0 | grep ether | awk '{print $2}' | tr -d ':').sparsebundle
@nicerobot
nicerobot / make-sxt-tmbundle
Created June 10, 2011 18:16
Install Struxt TextMate Bundle
View make-sxt-tmbundle
mkdir -p ~/"Library/Application Support/TextMate/Bundles/"
cd ~/"Library/Application Support/TextMate/Bundles/"
git clone git://github.com/nicerobot/struxt.tmbundle "struxt.tmbundle"
osascript -e 'tell app "TextMate" to reload bundles'
@nicerobot
nicerobot / dock-orientation.sh
Last active September 27, 2015 01:57
Pin Mac OS X Dock to the bottom-left of the screen and disable "mirror" effect, making it translucence.
View dock-orientation.sh
# curl -ks https://gist.github.com/nicerobot/1193218/raw/dock-orientation.sh | sh
defaults write com.apple.dock orientation left
defaults write com.apple.dock pinning end
defaults write com.apple.dock hide-mirror -bool true
killall Dock
@nicerobot
nicerobot / pitime.sh
Created November 15, 2011 21:33
time how long it takes to print Pi to 5000 places
View pitime.sh
time echo "scale=5000; 4*a(1)" | bc -l -q
@nicerobot
nicerobot / jstatd.sh
Created November 18, 2011 00:01
Run jstatd w/o error 'access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)'
View jstatd.sh
#!/bin/sh
policy=${HOME}/.jstatd.all.policy
[ -r ${policy} ] || cat >${policy} <<'POLICY'
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
POLICY
jstatd -J-Djava.security.policy=${policy} &
@nicerobot
nicerobot / .screenrc
Created December 7, 2011 12:59
.screenrc with "tabs" using hardstatus and caption options
View .screenrc
# look and feel
caption always "%{= bb}%{+b w}%h %=%{=b rw} %l %{= db} ${USER}@%H %{= dg}%c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
# skip the startup message
startup_message off
# go to home dir
chdir
@nicerobot
nicerobot / chrome-cookies.sh
Created December 7, 2011 16:59
Convert Google Chrome sqlite Cookies into cookies.txt. Useful for utilities like curl.
View chrome-cookies.sh
sqlite3 -separator ' ' ${COOKIES:-Cookies} \
'select host_key, "TRUE", path, "FALSE", expires_utc, name, value from cookies'
@nicerobot
nicerobot / gist:1484713
Last active March 23, 2018 22:58
Abbreviating PROMPT_COMMAND with ${HOME} to ~ replacement using perl
View gist:1484713
#!/bin/bash
PROMPT_COMMAND='PS1X=$(perl -p -e "s|^${HOME}|~|;s|([^/])[^/]*/|$""1/|g" <<<${PWD})'
PS1='\j \u@\h:${PS1X}  '
# http://unix.stackexchange.com/a/26860/6128
@nicerobot
nicerobot / gist:1484716
Created December 16, 2011 06:01
Abbreviating PROMPT_COMMAND with ${HOME} to ~ replacement pure bash
View gist:1484716
#!/bin/bash
export PROMPT_COMMAND='PS1X=$(p="${PWD#${HOME}}"; [ "${PWD}" != "${p}" ] && printf "~";IFS=/; for q in ${p:1}; do printf /${q:0:1}; done; printf "${q:1}")'
export PS1='\j \u@\h:${PS1X} $ '
# http://unix.stackexchange.com/a/26860/6128