Skip to content

Instantly share code, notes, and snippets.

Morgan Aldridge morgant

Block or report user

Report or block morgant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@morgant
morgant / dumpoverssh.sh
Last active Jul 11, 2018 — forked from kirkegaard/dumpoverssh.sh
pipe a mysql dump through gzip and send it over ssh
View dumpoverssh.sh
# 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
@morgant
morgant / js-get-fn-name.js
Last active Jun 14, 2018 — forked from dfkaye/js-get-fn-name.js
get a javascript function name
View js-get-fn-name.js
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) {
View bash.generate.random.alphanumeric.string.sh
#!/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
@morgant
morgant / google_convert_currency.php
Created Feb 26, 2011 — forked from SeanJA/google_convert_currency.php
Caching currency conversion using Google Calculator.
View google_convert_currency.php
<?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){
@morgant
morgant / clipcat
Created Dec 8, 2010 — forked from dpk/clipcat
My updates to David Kendall's original, and now part of tools-osx (https://github.com/morgant/tools-osx).
View clipcat
#!/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 <morgant@makkintosshu.com>
# Now concatenates multiple text clippings. Usage instructions.
#
You can’t perform that action at this time.