-
-
Save lsdr/490937 to your computer and use it in GitHub Desktop.
stuff I keep on ~/bin
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 | |
# Font: http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/ | |
if [ ! -t 0 ]; then | |
file=/dev/stdin | |
elif [ -f $1 ]; then | |
file=$1 | |
else | |
echo "Usage: $0 code.c" | |
echo "or e.g. head code.c|$0" | |
exit 1 | |
fi | |
pygmentize -f terminal -g $file | cat -n |
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/sh | |
# vim: ft=sh | |
CONFIGFILE=/Users/lsdr/Code/es/etc/elasticsearch.yml | |
es_pid() { | |
ps -ef | grep -i elasticsearch | grep -e 'org\.elasticsearch\.bootstrap\.ElasticSearch' | awk '{print $2}' | |
} | |
usage() { | |
cat >&1 <<CAT | |
Usage: es_start <start|stop|restart> | |
CAT | |
exit 1 | |
} | |
es_start() { | |
if [ -f $CONFIGFILE ]; then | |
elasticsearch -D es.config=$CONFIGFILE | |
echo "Elasticsearch running with PID $(es_pid)" | |
echo "tail -f /usr/local/var/log/elasticsearch/buffalo.log" | |
else | |
echo "Ouch! Couldn't find $CONFIGFILE, stopping!" | |
exit 1 | |
fi | |
} | |
es_stop() { | |
echo "Stopping elasticsearch" | |
kill -15 $(es_pid) | |
echo "done!" | |
} | |
es_restart() { | |
echo "Restarting elasticsearch" | |
es_stop | |
sleep 5 | |
es_start | |
} | |
case "$1" in | |
'start') es_start | |
;; | |
'stop') es_stop | |
;; | |
'restart') es_restart | |
;; | |
*) usage | |
;; | |
esac | |
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
ssh-keygen -E md5 -lf $1 |
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/sh | |
ls -lt $1 | grep -i $2 | awk '{print $9" ("$7"."$6")"}' | column -t |
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/sh | |
pip list --format=columns | sed 1,2d | awk '{print $1}' | xargs pip install -U |
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
#!/usr/bin/env ruby | |
LT = %w(B C D F G H J K L M N O P Q R S T V X Y W Z) | |
def gen(t); t % [LT.fetch(rand(LT.size)), LT.fetch(rand(LT.size))]; end | |
puts gen("%suiz %socha") | |
# vim: ft=ruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment