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
#!/bin/ksh | |
# Help message | |
usage() { | |
echo "Usage: $0 [-s screen] [-l] [-h]" | |
echo " -s screen Select screen number (0, 1, 2, etc.)" | |
echo " -l List available screens" | |
echo " -h Show this help message" | |
exit 1 | |
} |
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
maxUnsigned = 0x1FFFFFFF | |
bitsInUnsigned = int(29) | |
seventyFivePercent = int(22) | |
twelvePercent = int(4) | |
highBits = 0x1E000000 | |
lowBits = 0x01FFFFFF | |
def generateRegCode(userName): | |
reg = "" | |
sn = "" |
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
export default { | |
get(page) { | |
return this.all().find(p => p.page == page) | |
}, | |
all() { | |
return [ | |
{ | |
page: 'signup', | |
title: 'Sign up', | |
subtitle: 'Please enter your name, email and set a password.', |
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
# dump to another server | |
mysqldump -u MYSQL_USERNAME -p YOUR_DATABASE | gzip -c | ssh USERNAME@YOUR_TO_HOST 'cat > ~/dump.sql.gz' | |
# dump from another server | |
ssh USERNAME@YOUR_TO_HOST 'mysqldump -u MYSQL_USERNAME -pPASSWORD YOUR_DATABASE | gzip -c' > ~/dump.sql.gz |
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
function getFnName(fn) { | |
var f = typeof fn == 'function'; | |
var s = f && ((fn.name && ['', fn.name]) || fn.toString().match(/function ([^\(]+)/)); | |
return (!f && 'not a function') || (s && s[1] || 'anonymous'); | |
} | |
function currentFnName() { | |
try { | |
return getFnName(arguments.caller); | |
} catch(e) { |
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
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
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
<?php | |
$currencyCache = array(); | |
/** | |
* Looks for unquoted keys in a json string and fixes them ie: {a:"b"} => {"a":"b"} | |
* @param string $string A json string that is suspect | |
* @return string A valid json string | |
*/ | |
function fix_json($string){ |
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
#!/usr/bin/perl -w | |
# | |
# clipcat - Concatenate and print Text Clippings. | |
# | |
# v0.1 2010-11-18 - David Kendal <https://gist.github.com/705623> | |
# Initial version. Used with permission. | |
# v0.2 2010-12-08 - Morgan Aldridge <[email protected]> | |
# Now concatenates multiple text clippings. Usage instructions. | |
# |