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 remote_volume | |
{ | |
local user="$1" | |
local host="$2" | |
local vol="$3" | |
ssh "$user"@"$host" 'osascript -e "set volume output volume '"$vol"'"' | |
} |
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
# clear dns cache | |
alias cleardns='sudo dscacheutil -flushcache' |
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 strlen | |
{ | |
local string="$1" | |
local size=${#string} | |
echo $size | |
} |
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
<?php | |
class NNReflectionMethod extends ReflectionMethod | |
{ | |
static public function closure($object, $method) | |
{ | |
if(!is_object($object)) { | |
throw new InvalidArgumentException('$object must be an object'); | |
} | |
$oRm = new ReflectionMethod($object, $method); |
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 | |
alias reboot='sudo reboot && exit' | |
alias shutdown='sudo shutdown -h now && exit' |
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
alias thisdir='basename "$(pwd)"' |
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 | |
# Locate files relative to current working directory | |
# Potentially faster than find for deep directories | |
function rlocate | |
{ | |
locate "$1" | grep "$(pwd)" | |
} |
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
//-------------------------------------------------------------------- | |
// http://solutionoptimist.com/2013/12/27/javascript-promise-chains-2/ | |
//-------------------------------------------------------------------- | |
//-------------------------------------------------------------------- | |
// Pretend calls to a service | |
//-------------------------------------------------------------------- | |
function getDeparture() { | |
return new Promise((resolve) => { | |
setTimeout(function() { |
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 | |
# http://disq.us/p/1k1ww01 | |
cert_path=$1 # eg /etc/letsencrypt/live/example.com/cert.pem | |
key_path=$2 # eg /etc/letsencrypt/live/example.com/privkey.pem | |
certbot revoke --cert-path "$1" --key-path "$2" |
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 | |
php -d xdebug.remote_autostart=1 -d xdebug.remote_host=$(echo $SSH_CLIENT | sed 's/ .*//') path-to-php-script.php |