-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
local result="" | |||
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')" | |||
# └─ default (when `--mathlib` is used) is 20 | |||
# | |||
if [[ "$result" == *.* ]]; then | |||
# improve the output for decimal numbers | |||
printf "$result" | | |||
sed -e 's/^\./0./' `# add "0" for cases like ".5"` \ | |||
-e 's/^-\./-0./' `# add "0" for cases like "-.5"`\ | |||
-e 's/0*$//;s/\.$//' # remove trailing zeros | |||
else | |||
printf "$result" | |||
fi | |||
printf "\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
dig +nocmd "$1" any +multiline +noall +answer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
if du -b /dev/null > /dev/null 2>&1; then | |||
local arg=-sbh | |||
else | |||
local arg=-sh | |||
fi | |||
if [[ -n "$@" ]]; then | |||
du $arg -- "$@" | |||
else | |||
du $arg .[^.]* * | |||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
mkdir -p "$@" && cd "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,5 @@ | |||
local port="${1:-8000}" | |||
sleep 1 && open "http://localhost:${port}/" & | |||
# Set the default Content-Type to `text/plain` instead of `application/octet-stream` | |||
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) | |||
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
# Make sure we’re using the latest Homebrew | |||
update | |||
|
|||
# Upgrade any already-installed formulae | |||
upgrade | |||
|
|||
# Install GNU core utilities (those that come with OS X are outdated) | |||
install coreutils | |||
|
|||
# Install GRC for coloring | |||
install grc | |||
|
|||
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed | |||
#install findutils | |||
|
|||
# Install wget with IRI support | |||
#install wget --enable-iri | |||
|
|||
# Install more recent versions of some OS X tools | |||
install vim --override-system-vi | |||
|
|||
# Install other useful binaries | |||
install ack | |||
install git | |||
install ngrep | |||
#install node | |||
install rename | |||
install tree | |||
|
|||
# Remove outdated versions from the cellar | |||
cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1 +1,54 @@ | |||
# Quick-open iOS Simulator | |||
alias ios="open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app" | alias ios="open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app" | ||
|
|||
# Clean up LaunchServices to remove duplicates in the “Open With” menu | |||
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" | |||
|
|||
# Flush Directory Service cache | |||
alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder" | |||
|
|||
# Empty the Trash on all mounted volumes and the main HDD | |||
# Also, clear Apple’s System Logs to improve shell startup speed | |||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" | |||
|
|||
# Show/hide hidden files in Finder | |||
alias showhf="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" | |||
alias hidehf="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" | |||
|
|||
# Hide/show all desktop icons (useful when presenting) | |||
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" | |||
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" | |||
|
|||
# Spotlight | |||
alias spotoff="sudo mdutil -a -i off" | |||
alias spoton="sudo mdutil -a -i on" | |||
|
|||
# One of @janmoesen’s ProTip™s | |||
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do | |||
alias "$method"="lwp-request -m '$method'" | |||
done | |||
|
|||
# PlistBuddy alias, because sometimes `defaults` just doesn’t cut it | |||
alias plistbuddy="/usr/libexec/PlistBuddy" | |||
|
|||
# Ring the terminal bell, and put a badge on Terminal.app’s Dock icon | |||
# (useful when executing time-consuming commands) | |||
alias badge="tput bel" | |||
|
|||
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/ | |||
alias stfu="osascript -e 'set volume output muted true'" | |||
alias pumpitup="osascript -e 'set volume 7'" | |||
alias hax="growlnotify -a 'Activity Monitor' 'System error' -m 'WTF R U DOIN'" | |||
|
|||
# Kill all the tabs in Chrome to free up memory | |||
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description | |||
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill" | |||
|
|||
# Lock the screen (when going AFK) | |||
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" | |||
|
|||
# OS X has no `md5sum`, so use `md5` as a fallback | |||
command -v md5sum > /dev/null || alias md5sum="md5" | |||
|
|||
# OS X has no `sha1sum`, so use `shasum` as a fallback | |||
command -v sha1sum > /dev/null || alias sha1sum="shasum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters