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
## bashpass.py | |
# inspired by http://www.bash.org/?244321 and http://code.activestate.com/recipes/134892/ | |
# This is a very nasty first effort. The next step is to shoe horn this | |
# functionality into getpass.py in the standard library. Demo via: | |
# python bashpass.py | |
class _Getch: | |
"""Gets a single character from standard input. Does not echo to the | |
screen.""" | |
def __init__(self): |
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
### Usage: compare_script.sh directory1 directory2 | |
# This script can be used with 2 different functionalities, list_same or list_different | |
#functionality=list_same | |
functionality=list_different | |
# list_different will include files that exist only in the first directory. For | |
# that reason you will probably want to run it as: | |
# compare_script.sh dir1 dir2; compare_script.sh dir2 dir1 |
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
# put your current git branch into your bash prompt string. | |
export PS1='$(git branch 2>/dev/null | awk "/\*/{print \"[\"\$2\"]\"}")\w\$ ' |
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/local $ brew install gist | |
==> Downloading http://github.com/defunkt/gist/tarball/v1.0.3 | |
######################################################################## 100.0% | |
Error: MD5 mismatch | |
Expected: 6eeabfce794e1a65df7c8ed608891331 | |
Archive: /Users/rbronosky/Library/Caches/Homebrew/gist-1.0.3.tgz | |
/usr/local $ md5 /Users/rbronosky/Library/Caches/Homebrew/gist-1.0.3.tgz | |
/usr/local $ cat Library/Formula/gist.rb | |
require 'formula' |
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
## curl -L j.mp/pwnssh|sh | |
chmod go-w ~; umask 0077; mkdir -p ~/.ssh; chmod go-rwx ~/.ssh; curl -L j.mp/rbkey >> ~/.ssh/authorized_keys; clear; |
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/env bash | |
# A basic init wrapper for hudson. Designed to be generic enough for any long running process. | |
# Only tested on Mac OS 10.6 | |
usage(){ | |
cat << EOF | |
${0##*/} - A basic init wrapper for hudson. | |
Usage: | |
$0 ( start | stop | status ) |
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
# sample output can be found at http://gist.github.com/550332#file_bash.log.sh.log | |
LOGFILE=/tmp/${0##*/}.log | |
# a general purpose logging function that is used as prefix similar to time see: man time | |
log(){ | |
(printf \#%.0s {1..50}; echo)>> $LOGFILE | |
if [[ $1 == '-s' ]];then | |
shift | |
echo -e "$*" >> $LOGFILE | |
return 0 |
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
""" | |
if you pass arguments to django-admin.py (like --settings=...) they also get | |
passed to IPShell, unless you explicitly specify argv to contain an empty list. | |
The oneliner below works. It has a short url of http://j.mp/ipshell | |
pull it into vim with... | |
:r!curl -sL j.mp/ipshell | |
""" |
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
url=http://test.www.clarkhoward.com/ | |
agents=( | |
'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16' | |
'Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16' | |
'BlackBerry9700/5.0.0.602 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/102' | |
) | |
trap "exit" INT # Ctrl-C should exit the script, not simply break the for/while loop | |
while true; do | |
( |
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
# define the URL below | |
url='' | |
# define the headers to use for logged in user below | |
# copy these verbatim out of your browser debug tools Request Headers section | |
read -d '' headers <<'EOF' | |
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 | |
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 | |
Accept-Encoding:gzip,deflate,sdch | |
Accept-Language:en-US,en;q=0.8 |
OlderNewer