Skip to content

Instantly share code, notes, and snippets.

@lsdr
Last active April 22, 2019 12:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsdr/490937 to your computer and use it in GitHub Desktop.
Save lsdr/490937 to your computer and use it in GitHub Desktop.
stuff I keep on ~/bin
#!/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
#!/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
ssh-keygen -E md5 -lf $1
#!/bin/sh
ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)
# ctags -R --languages=erlang --exclude=.git --exclude=log
# ctags -R --languages=vim --exclude=.git --exclude=log
#!/bin/sh
ls -lt $1 | grep -i $2 | awk '{print $9" ("$7"."$6")"}' | column -t
#!/bin/sh
pip list --format=columns | sed 1,2d | awk '{print $1}' | xargs pip install -U
#!/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