Skip to content

Instantly share code, notes, and snippets.

Jehiah Czebotar jehiah

Block or report user

Report or block jehiah

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jehiah
jehiah / simple_args_parsing.sh
Created Mar 4, 2011
a simple way to parse shell script arguments
View simple_args_parsing.sh
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@jehiah
jehiah / get_latest_chromium.sh
Created Feb 18, 2011
script to download the latest chromium build nightly
View get_latest_chromium.sh
#!/bin/sh
## this is a quick and dirty script to automagically install the latest chromium build on OSX 10.5
## you can set this up as a nightly cron job, or run manually from the command line
# USAGE:
# save script to your home directory aka /Users/$USER/
# open up a command prompt (aka /Applications/Utilities/Terminal)
# run manually from the command line whenever you want the most recent chromium build
# $ sh get_latest_chromium.sh
# start it as a nightly task (runs at 1am or edit the plist below)
@jehiah
jehiah / pizza.py
Last active Jan 13, 2019
Calculate the ratio of ingredients needed for the perfect quantity of pizza dough
View pizza.py
#!/usr/bin/env python
# Calculate the ratio of ingredients needed for the perfect quantity of pizza dough
#
# $ pizza.py --target-oz=49
# target: 49.00oz 1389gram
# flour: 800 grams (400 x 2)
# water: 520 grams
# salt: 16 grams
# sugar: 12 grams
@jehiah
jehiah / lru_cache.c
Created Apr 3, 2011
a LRU cache in C using uthash
View lru_cache.c
#include <string.h>
#include <uthash.h>
// this is an example of how to do a LRU cache in C using uthash
// http://uthash.sourceforge.net/
// by Jehiah Czebotar 2011 - jehiah@gmail.com
// this code is in the public domain http://unlicense.org/
#define MAX_CACHE_SIZE 100000
@jehiah
jehiah / update_github_hipchat_hook.py
Created Jan 15, 2013
This is a script that updates hipchat hooks on a github repository to only have a small set of actions they trigger based on (ie: push, issues).
View update_github_hipchat_hook.py
#!/usr/bin/env python
"""
This is a script that updates hipchat hooks on github repository to only have a small set of actions they trigger based on.
created by Jehiah Czebotar 2013
Usage:
update_github_hipchat_hook.py --repo=jehiah/json2csv --access_token={{...}}
"""
@jehiah
jehiah / git-branch-status
Last active Aug 20, 2018
show git ahead/behind info for branches
View git-branch-status
moved to github --> https://github.com/bill-auger/git-branch-status/
@jehiah
jehiah / wait_run_in_parallel.sh
Created Jul 22, 2011
run bash commands in parallel
View wait_run_in_parallel.sh
# This is a simple way to run multiple things in parallel in a bash
# script without making things too complicated
# it's modeled after (and uses) the bash `wait` command
# TIP: to do more complicated steps in parallel put them in a function
function wait_run_in_parallel()
{
local number_to_run_concurrently=$1
if [ `jobs -np | wc -l` -gt $number_to_run_concurrently ]; then
wait `jobs -np | head -1` # wait for the oldest one to finish
@jehiah
jehiah / over.py
Created May 9, 2018
Script to filter output from `uniq -c` to only items that appear more than `--frequency=n` times.
View over.py
#!/bitly/local/bin/python
import tornado.options
import logging
import sys
if __name__ == "__main__":
tornado.options.define("frequency", type=int)
tornado.options.parse_command_line()
for line in sys.stdin:
@jehiah
jehiah / notify.sh
Created Jan 19, 2014
email notify at system boot time
View notify.sh
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: notify email address on system boot.
# *************************************************
# Installing:
# 1) save as /etc/rc.d/init.d/notify
# 2) set the desired email address in "MAILADD" variable
# 3) chmod a+w /etc/rc.d/init.d/notify
View tornado_custom_errorhandler.py
import os
import httplib
import tornado.web
class ErrorHandler(tornado.web.RequestHandler):
"""Generates an error response with status_code for all requests."""
def __init__(self, application, request, status_code):
tornado.web.RequestHandler.__init__(self, application, request)
self.set_status(status_code)
You can’t perform that action at this time.