Skip to content

Instantly share code, notes, and snippets.

@csinchok
csinchok / tabname.sh
Created December 4, 2014 15:31
Name ur tabs
function tabname {
if [ -z "$1" ];
then
TABNAME="${PWD##*/}";
else
TABNAME="$1";
fi
printf "\e]1;$TABNAME\a"
}
@csinchok
csinchok / pillow.py
Created October 27, 2014 21:10
Pillow experiments
import sys
import math
from PIL import Image, ImageDraw
def get_line(center, angle, length):
y_diff = math.sin(angle) * length / 3
x_diff = math.cos(angle) * length / 3
start = (center[0] + x_diff, center[1] + y_diff)
#!/bin/sh
wget -O /tmp/onion-devel.sql.bz2 http://192.168.1.26/onion/onion.sql.bz2
export PGPASSWORD=testonion
psql -d postgres -h 127.0.0.1 -U onion -c "DROP DATABASE onion"
psql -d postgres -h 127.0.0.1 -U onion -c "CREATE DATABASE onion"
bunzip2 /tmp/onion-devel.sql.bz2
@csinchok
csinchok / zylch.py
Created October 13, 2014 15:42
zylch.py
def application(env, start_response):
start_response("200 OK", [("Content-Type", "text/html")])
return """<!doctype html>
<html>
<title>Welcome to zylch!</title>
<body>
</body>
</html>"""
@csinchok
csinchok / clear_logstash_data.sh
Created October 2, 2014 19:15
Clear kibana indices older than 20 days
#!/bin/bash
curl http://127.0.0.1:9200/_aliases 2>/dev/null | \
python -c "import json;import sys;sys.stdout.write('\n'.join([key for key in json.load(sys.stdin).keys() if key.startswith('logstash')]))" | \
sort -r | tail -n +20 | xargs -L 1 -I {} curl -XDELETE http://127.0.0.1:9200/{}/
@csinchok
csinchok / .profile
Created September 8, 2014 21:56
Just a cool script
function throwaway {
THROWAWAY_DIR=$(mktemp -d -t virtualenv);
cd $THROWAWAY_DIR;
virtualenv .;
source bin/activate;
trap "rm -r $THROWAWAY_DIR" EXIT
}
export -f throwaway
<html><head><meta http-equiv="refresh" content="0; URL='http://73972.api-04.com/serve?action=click&amp;publisher_id=73972&amp;site_id=54804&amp;offer_id=289864&amp;ref_id=206773_53b70cee9990b_14070422&amp;mac_address=&amp;odin=&amp;ios_ifa=&amp;sub_publisher=206773&amp;sub_site=106933&amp;sub_campaign=2156&amp;sub_adgroup=5683&amp;sub_ad='"></head><body></body></html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Encoding...</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #333;

MBOs

Quarterly

  1. Piece together a server monitoring tool.
  2. Build a new, ansible-driven deploy process.
  3. Open-source and properly version all of our shared code.

Yearly

@csinchok
csinchok / bash_profile
Last active July 8, 2022 17:29
Make a disposable python virtualenv
function throwaway {
THROWAWAY_DIR=$(mktemp -d -t virtualenv);
cd $THROWAWAY_DIR;
virtualenv .;
source bin/activate;
trap "rm -r $THROWAWAY_DIR" EXIT
}
export -f throwaway