This file contains hidden or 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
<!-- Add the following lines to theme's html code right before </head> --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script> | |
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script> | |
<!-- | |
Usage: just add <div class="gist">[gist URL]</div> | |
Example: <div class="gist">https://gist.github.com/1395926</div> | |
--> |
This file contains hidden or 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
#!/bin/bash | |
# NOTE: GID 20 is staff group -- see more with: dscl . list groups gid | |
DEFAULT_GID=20 | |
DEFAULT_GROUP=staff | |
DEFAULT_SHELL=/bin/bash | |
DEFAULT_HOME_BASE=/Users | |
_DEBUG_ON="" |
This file contains hidden or 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
# | |
# Paste this into a new "Run Script" Build Phase (as described here: http://stackoverflow.com/a/15483906/974381) | |
# | |
# Tip: drag-and-drop your new Run Script to run before the "Compile Sources" Phase! | |
# | |
# Source: http://stackoverflow.com/a/15483906/974381 | |
# | |
# How to get version numbers in code? | |
# NSString *buildString = infoDictionary[(NSString*)kCFBundleVersionKey]; | |
# NSString *versionString = infoDictionary[@"CFBundleShortVersionString"]; |
This file contains hidden or 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
# | |
# requires 'pwgen', can be installed with brew | |
# | |
# add this to your .bash_profile, .profile or .bashrc for quick terminal access | |
# input: the length of the password | |
# usage example: gensecpsw 16 | |
# example result: XjQ%uWQ.&7-T4@`( | |
# | |
gensecpsw() { | |
printf '%s' $(pwgen -B -c -s -n -y $1 1) |pbcopy; echo "Has been copied to clipboard" |
This file contains hidden or 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
#!/bin/bash | |
function getCurrentUnixTimestamp { | |
printf %s $(date +%s) | |
} | |
echo " (i) Generating current timestamp..." | |
current_unix_timestamp=$(getCurrentUnixTimestamp) | |
echo " Timestamp: $current_unix_timestamp" | |
echo " (i) Done" |
This file contains hidden or 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
function generate_color_from_text(text) { | |
var redRandom = 0; | |
var greenRandom = 0; | |
var blueRandom = 0; | |
for (var i = 0; i < text.length; i++) { | |
var charCode = text.charCodeAt(i); | |
redRandom += charCode; | |
greenRandom += charCode+1; | |
blueRandom += charCode+4; |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Create a symlink to python as python2: | |
# logentries agent/script tries to use python2 instead of python - on OS X there's no python2 | |
# | |
sudo ln -s /usr/bin/python /usr/bin/python2 |
This file contains hidden or 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
#!/bin/bash | |
function print_and_do_command { | |
echo "-> $ $@" | |
$@ | |
} | |
function print_and_do_command_exit_on_error { | |
print_and_do_command $@ |
This file contains hidden or 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
#!/bin/bash | |
# | |
# Prints the given command, then executes it | |
# Example: print_and_do_command echo 'hi' | |
# | |
function print_and_do_command { | |
echo " -> $ $@" | |
$@ | |
} |
This file contains hidden or 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
#!/bin/bash | |
echo "${HOME}" | |
echo | |
echo "---" | |
echo " Env:" | |
env |
OlderNewer