Skip to content

Instantly share code, notes, and snippets.

@timtutt
timtutt / daemon.py
Last active December 3, 2018 02:32 — forked from josephernest/daemon.py
Daemon for Python
# From "A simple unix/linux daemon in Python" by Sander Marechal
# See http://stackoverflow.com/a/473702/1422096
#
# Modified to add quit() that allows to run some code before closing the daemon
# See http://stackoverflow.com/a/40423758/1422096
#
# Joseph Ernest, 2016/11/12
import sys, os, time, atexit
from signal import signal, SIGTERM
searchkit.addResultsListener((results) => {
currentQuery = searchkit.currentSearchRequest.query
delete currentQuery['aggs'];
});
@timtutt
timtutt / keybase.md
Created April 7, 2017 20:17
Keybase verification

Keybase proof

I hereby claim:

  • I am timtutt on github.
  • I am timtutt (https://keybase.io/timtutt) on keybase.
  • I have a public key ASD1szU4lPBbCmoHbhWbQOxByEgV4CI00Nu45ZyvrOVJqgo

To claim this, I am signing this object:

## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
@timtutt
timtutt / docker-machine-creation.sh
Created October 16, 2015 02:43
Customizing a docker machine for mac
docker-machine create --driver virtualbox --virtualbox-cpu-count 2 --virtualbox-memory "4096" --virtualbox-disk-size "10000" dockerinwild
@timtutt
timtutt / bootstrap-wizard-html5-validation.js
Created July 31, 2015 13:50
bootstrap-wizard: Force HTML5 validation between steps (core in onNext and onFinish settings)
$('#bootstrap-wizard').bootstrapWizard({
'tabClass': 'nav nav-pills',
'nextSelector': '.btn-next',
'previousSelector': '.btn-previous',
'finishSelector' : '.btn-finish',
onInit : function(tab, navigation,index){
//check number of tabs and fill the entire row
var $total = navigation.find('li').length;
$width = 100/$total;
@timtutt
timtutt / EMR_CLUSTER_PLUS_HIVE
Created May 21, 2015 02:10
Launch EMR Cluster with Bootstrap Actions and Hive Queries
aws emr create-cluster --applications Name=Hive Name=Pig Name=Hue --ami-version 3.7.0 --instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m3.2xlarge InstanceGroupType=CORE,InstanceCount=15,InstanceType=m3.xlarge --bootstrap-actions Path=s3://[bucket]/scripts/bootstrap/bootstrap-actions.sh --log-uri s3://[bucket]/hadoop-logs --service-role EMR_DefaultRole --ec2-attributes KeyName=KEY_NAME,InstanceProfile=EMR_EC2_DefaultRole --termination-protected --name "CLUSTER_NAME" --steps Type=HIVE,Name='SOME_HIVE_ACTIONS',ActionOnFailure=CANCEL_AND_WAIT,Args=[-f,s3://[bucket]/scripts/hive/hive_script.sql]