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 / gist:1753095
Created Feb 6, 2012
Building GnuTLS on Mac OS X
View gist:1753095

Preparing the Build Environment

cd ~/Desktop
mkdir wget-build
cd wget-build

Building & Installing GMP 5.0.2


Keybase proof

I hereby claim:

  • I am morgant on github.
  • I am morgant ( on keybase.
  • I have a public key ASBYIZBmTq0sdXPwOvb5jluT37dE3napZNsnO5rRq12i1Ao

To claim this, I am signing this object:

morgant /
Last active Jul 11, 2018 — forked from kirkegaard/
pipe a mysql dump through gzip and send it over ssh
# 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 / compress_and_encrypt-no_exposed_password.txt
Last active Jul 10, 2018
Compress & Encrypt to Disk Using OpenSSL in Bash Without Exposing Password
View compress_and_encrypt-no_exposed_password.txt
# This is the simplest and cleanest way I've come up with for securely compressing (gzip, in this example) & encrypting data to disk with OpenSSL from a bash script without exposing the password to inspection of process or environment variable using `ps` and the likes. Naturally, `cat` is just used as an example so the data can come from anywhere. If the compressed data is to be sent via email instead of written to disk, don't use '-out' and use '-a' to base64 encode the compressed data.
# References:
cat "$file" | gzip -c | openssl enc -e -salt -aes-256-cbc -pass fd:3 -out "$file.gz.enc" 3<<<"$password"
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.toString().match(/function ([^\(]+)/));
return (!f && 'not a function') || (s && s[1] || 'anonymous');
function currentFnName() {
try {
return getFnName(arguments.caller);
} catch(e) {
morgant / mirror_homepage.mac.com_sites_instructions.txt
Created Jun 18, 2012
Notes/instructions for how I've been mirroring sites to
View mirror_homepage.mac.com_sites_instructions.txt
Mirroring sites to
1) Use `wget` to pull down a copy of the site. If pulling down a single file & all its prerequisites, use the following:
/usr/local/bin/wget -p --mirror -k -t 30 -w 5 -e robots=off -o$(date +%Y-%m-%d-%H%M).log "" &
Alternatively, if pulling down an entire directory, use the following (Note: _make sure_ you include the trailing slash on the directory name!):
/usr/local/bin/wget --mirror -k -t 30 -w 5 -e robots=off -o$(date +%Y-%m-%d-%H%M).log "" &
morgant / NewtFns.c
Created Jul 25, 2012
NewtonScript Perform() for NEWT/0
View NewtFns.c
/** Send a message to a method in a frame by name with an array of parameters
* @param rcvr [in] レシーバ
* @param frame [in] Frame
* @param message [in] Message
* @param params [in] Parameters
* @return Return value
newtRef NsPerform(newtRefArg rcvr, newtRefArg frame, newtRefArg message, newtRefArg params)
View gist:1571340
# get the Mac OS X version
version_major=$(sw_vers -productVersion | cut -d . -f 2)
#version_minor=$(sw_vers -productVersion | cut -d . -f 3)
# 10.7.x now has no 32-bit only version of Perl included, so we
# need to set Perl's prefer-32-Bit default
if [ $version_major -eq 7 ]; then
morgant / mime2mdwn
Created Apr 18, 2011
Convert MIME format wiki export (developed for PhpWiki exports) to Markdown
View mime2mdwn
# mime2mdwn - Convert MIME format wiki export (developed for PhpWiki exports) to Markdown
# globals
# the actual heavy lifting
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
$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){
You can’t perform that action at this time.