Skip to content

Instantly share code, notes, and snippets.

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

nicerobot nicerobot

🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎
View GitHub Profile
@nicerobot
nicerobot / meta-text
Last active September 28, 2015 23:28
Meta-text for rich plain-text.
! priority.
^ calendar | relatives.
# tags.
@ contact.
[ mood.
= location.
~ duration estimate.
* repeating.
/ link.
@nicerobot
nicerobot / uninstall-mono.sh
Created December 24, 2011 01:47
This script removes Mono from an OS X System.
#!/bin/sh -x
[ "${SUDO_USER}" -a `id -u` -eq 0 ] || {
\sudo ${0}
\rm -f ${0}
exit $?
}
\rm -r /Library/Frameworks/Mono.framework
\rm -r /Library/Receipts/MonoFramework-*
for dir in /usr/bin /usr/share/man/man1 /usr/share/man/man3 /usr/share/man/man5; do
@nicerobot
nicerobot / randomness.sh
Created December 29, 2011 21:16
Mac OS X / iOS UInt32 randomness
#!/bin/bash
# Just:
# curl -kOs https://raw.github.com/gist/1536232/randomness.sh; chmod +x randomness.sh; ./randomness.sh
# I know, it seems pointless but it's just a simple example of how to:
# 1. Compile against a Framework on Mac OS.
# 2. Mix sources.
# 3. Determine if a script is sourced or executed directly.
sourced() { [ 'bash' == $0 ] || [ ${BASH_SOURCE[0]} != $0 ]; }
(
@nicerobot
nicerobot / sourced.sh
Created December 29, 2011 21:20
Is a bash script sourced or executed directly?
sourced() { [ 'bash' == "${0:-i}" ] || [ "${BASH_SOURCE[0]}" != "${0:-i}" ]; }
# Example:
# sourced && return 0 || exit 0
# For some reason, this function needs to be defined in the same context in which it's used.
@nicerobot
nicerobot / nodepy.sh
Created December 31, 2011 05:47
Simple comparison of Java vs Node.js vs Pythons
#!/bin/bash
# Run using:
# curl -Lks https://raw.github.com/gist/1543040/nodepy.sh | sh
# Increase the iterations using:
# curl -Lks https://raw.github.com/gist/1543040/nodepy.sh | it=100000000 sh
it=${it:-10000000}
echo it=${it} $0
trap 'rm -f pi{,2,3}.{py,java,class,js}' 0
@nicerobot
nicerobot / tmbundles.sh
Created January 2, 2012 04:54
The TextMate Bundles I use, a script install/update them, and a LaunchAgent plist to keep them updated (for TextMate 1.0)
#!/bin/sh
# To run using my bundles (https://raw.github.com/gist/1549404/tmbundles.txt):
# curl -ks https://raw.github.com/gist/1549404/tmbundles.sh | sh
# To use bundles listed in another gist:
# curl -ks https://raw.github.com/gist/1549404/tmbundles.sh | FILE=1549404/tmbundles.txt sh
# Just replace "1549404/tmbundles.txt" with another bundle list
(
cd ~/Library/Application\ Support/TextMate/Bundles || exit $?
@nicerobot
nicerobot / vac.m
Created January 2, 2012 14:21
Variadic function and NSComparator example
/*
curl -kOs https://raw.github.com/gist/1550857/vac.m && cc -framework Cocoa -o vac vac.m && ./vac
For http://stackoverflow.com/questions/8693810/objective-c-possible-shorter-if-notation
Variadic function and NSComparator example.
*/
#import <Cocoa/Cocoa.h>
#import <stdarg.h>
#import <stdio.h>
// This is just a simple object equality comparator.
@nicerobot
nicerobot / dock-spacer.sh
Created January 11, 2012 00:08
Add a space to the Mac OS X Dock. It can be used multiple times for multiple spacers.
#!/bin/sh
# curl -ks https://gist.github.com/raw/1592071/dock-spacer.sh | sh
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
@nicerobot
nicerobot / .gitconfig._install.md
Created January 11, 2012 00:14
Things i add to my .gitconfig

run:

curl -sLk https://gist.github.com/raw/1592103/.gitconfig._run | sh -s --

It doesn't add anything if a section already exists.

@nicerobot
nicerobot / pkgutil-expand.sh
Created January 16, 2012 18:58
Expand .pkg installers without installing
#!/bin/sh
# curl -ks https://raw.github.com/gist/1622342/pkgutil-expand.sh | sh -s *.pkg
for i in $(ls ${*:-*.pkg}); do pkgutil --expand ${i} $(basename ${i} .pkg); done