Skip to content

Instantly share code, notes, and snippets.

View btbytes's full-sized avatar
🐎
🏈

Pradeep Gowda btbytes

🐎
🏈
View GitHub Profile
# Full credit to: http://jeffmiller.github.com/2011/01/10/ssh-host-color
#!/bin/bash
#
# ssh into a machine and automatically set the background
# color of Mac OS X Terminal depending on the hostname.
#
# Installation:
# 1. Save this script to /some/bin/ssh-host-color
# 2. chmod 755 /some/bin/ssh-host-color
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
$ cat bootstrap.sh
#!/bin/sh
cat <<EOF > requirements.txt
whisper==0.9.7
carbon==0.9.7
graphite-web==0.9.7c
gunicorn
EOF
def parse_payload(data):
assert data, "Invalid data to parse, it's empty."
length, extra = data.split(':', 1)
length = int(length)
payload, extra = extra[:length], extra[length:]
assert extra, "No payload type: %r, %r" % (payload, extra)
payload_type, remain = extra[0], extra[1:]
assert len(payload) == length, "Data is wrong length %d vs %d" % (length, len(payload))
@btbytes
btbytes / Makefile
Created June 26, 2011 16:50 — forked from tskrynnyk/Makefile
Pandoc makefile
%.html: %.md style.css Makefile
pandoc -c style.css -s -f markdown -t html --standalone -o $@ $<
%.odt: %.md Makefile
pandoc --standalone -f markdown -t odt -o $@ $<
%.pdf: %.md %.odt
markdown2pdf -f markdown -o $@ $<
all: doc.html doc.odt doc.pdf
@btbytes
btbytes / benchbulk.sh
Created July 4, 2011 20:31 — forked from jchris/benchbulk.sh
benchmarking CouchDB bulk inserts in bash
#!/bin/bash
# usage: time benchbulk.sh dbname
# it takes about 30 seconds to run on my old MacBook
BULKSIZE=1000
DOCSIZE=100
INSERTS=10
ROUNDS=10
DBURL="http://localhost:5984/$1"
@btbytes
btbytes / about.md
Created August 9, 2011 15:53 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@btbytes
btbytes / hello.lua
Created August 11, 2011 01:25 — forked from randrews/hello.lua
Embedding Lua in C
-- Pack this into an object file with ld: ld -r -b binary -o hello.o hello.lua
print "Hello, World!"
@btbytes
btbytes / mkd2pdf
Created September 8, 2011 17:42 — forked from alexwall/mkd2pdf
takes template with -t option and searches in a custom templates dir
#!/bin/bash
# Autor: Alex Wall
# Licence: GPLv3
# pandoc (markdown2pdf) needs an path to a template
# this script searches for a template in a custom folder (TEMPLATE_DIR)
# you can pass any other option (e.g. xetex), it will be passed to markdown2pdf
# the default custom pandoc template (latex.template) in ~/.pandoc/templates
TEMPLATE="latex.template"