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 | |
alias reboot='sudo reboot && exit' | |
alias shutdown='sudo shutdown -h now && exit' |
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 | |
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 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 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 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 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
# Short of learning how to actually configure OSX, here's a hacky way to use | |
# GNU manpages for programs that are GNU ones, and fallback to OSX manpages otherwise | |
alias man='_() { echo $1; man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1 1>/dev/null 2>&1; if [ "$?" -eq 0 ]; then man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1; else man $1; fi }; _' |
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
_lse_filter='~|#.*#' | |
alias lse='_() { ls -1 $1 | egrep -v $_lse_filter; }; _' |
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
# update locate database, linux style | |
alias updatedb='sudo /usr/libexec/locate.updatedb' | |
# mdfind is the locate equivalent on OSX, | |
# so this is probly more useful for you | |
alias locate='mdfind -name' |
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 | |
# ----------------------------------------------------------------------------------- | |
# pem2pkcs12.sh | |
# (c) Nathan Nobbe 2014 | |
# [email protected] | |
# http://quickshiftin.com | |
# | |
# Use this script to convert a set of apache ssl certificates to a format suitable | |
# for Jetty. | |
# |
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 | |
# ----------------------------------------------------------------------------------- | |
# jetty-hash-pass.sh | |
# (c) Nathan Nobbe 2014 | |
# [email protected] | |
# http://quickshiftin.com | |
# | |
# See the Password Issues section of the below link | |
# http://docs.codehaus.org/display/JETTY/How+to+configure+SSL#HowtoconfigureSSL-step3 | |
# |