Skip to content

Instantly share code, notes, and snippets.

View jesusaurus's full-sized avatar

Joni Harker jesusaurus

  • Earth
View GitHub Profile
include:
- java
elasticsearch:
pkg:
- installed
- sources:
- elasticsearch: http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.deb
service.running:
- require:
@jesusaurus
jesusaurus / logstash_index_cleaner.py
Created January 29, 2013 00:09
Python script to clean logstash entries from elasticsearch
#!/usr/bin/env python
#
# Shamelessly stolen from https://logstash.jira.com/secure/attachment/12610/logstash_index_cleaner.py
#
# Deletes all indices with a datestamp older than "days-to-keep" for daily
# if you have hourly indices, it will delete all of those older than "hours-to-keep"
#
# This script presumes an index is named typically, e.g. logstash-YYYY.MM.DD
# It will work with any name-YYYY.MM.DD or name-YYYY.MM.DD.HH type sequence
#
#!/usr/bin/env zsh
#
# Works best with blinking text; the last heart will blink
# when you have less than 25% of your battery life remaining.
FULL="$(cat /sys/class/power_supply/BAT0/charge_full)"
NOW="$(cat /sys/class/power_supply/BAT0/charge_now)"
BATTERY=$(echo "scale=25;$NOW/$FULL" | bc)
if [[ $BATTERY -lt .25 ]]; then
@jesusaurus
jesusaurus / github.sh
Created July 11, 2012 07:03
A script to hook a push to github from another repo being pushed to
#!/bin/bash
# Author: Jonathan Harker <jesusaur@cat.pdx.edu>
REPO=GitHubUser/GitHubRepo.git
KEY="/full/path/to/github.key"
case "$1" in
# Use case 1:
# Call 'github.sh all' in post-receive hook
@jesusaurus
jesusaurus / scientific.patch
Created April 20, 2012 01:29
Patch for Scientific Python's setup.py
--- setup.py 2012-02-03 13:15:50.000000000 -0800
+++ setup.py 2012-02-03 13:15:50.000000000 -0800
@@ -44,9 +44,8 @@
arrayobject_h_include = [os.path.join(sys.prefix,
"Lib/site-packages/numpy/core/include")]
else:
- arrayobject_h_include = [os.path.join(sys.prefix,
- "lib/python%s.%s/site-packages/numpy/core/include"
- % sys.version_info [:2])]
+ import numpy.distutils.misc_util
@jesusaurus
jesusaurus / gist:2315182
Created April 5, 2012 23:48
Meta git hook
#!/bin/bash
# run all the execuable scripts in the corresponding hook.d directory
# e.g. if this is the update hook, run all scripts in update.d/
while read oldrev newrev ref
do
for file in `find ./$0.d/ -type f`
do
if [ -x $file ]
@jesusaurus
jesusaurus / escctrlcaps.pke
Created March 21, 2012 22:14 — forked from hunner/escctrlcaps.pke
caps->ctrl->esc->caps
clear Lock
clear Control
keycode 9 = Caps_Lock NoSymbol Caps_Lock NoSymbol Caps_Lock
keycode 37 = Escape NoSymbol Escape NoSymbol Escape
keycode 66 = Control_L NoSymbol Control_L NoSymbol Control_L
keycode 135 = Multi_key Multi_key Multi_key Multi_key
add Lock = Caps_Lock
add Control = Control_L Control_R