Skip to content

Instantly share code, notes, and snippets.

@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"
View misspell_test.sh
#!/bin/bash
# run https://github.com/client9/misspell linter
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=`dirname "$SCRIPT"`
# get to repo root
cd $SCRIPTPATH/../../..
WRITE=""
while [ "$1" != "" ]; do
PARAM=${1%%=*}
View svg_abs_to_rel.py
from decimal import Decimal
from xml.dom import minidom
import sys
import os
import re
import simplejson as json
import string
import tornado.options
import logging
@jehiah
jehiah / git-branch-status
Last active Dec 20, 2020
show git ahead/behind info for branches
View git-branch-status
moved to github --> https://github.com/bill-auger/git-branch-status/
@jehiah
jehiah / iphone_messages_dump.py
Last active Sep 28, 2020
Script to dump out messages to csv from an iPhone Backup sqlite file
View iphone_messages_dump.py
# Copyright Jehiah Czebotar 2013
# http://jehiah.cz/
import tornado.options
import glob
import os
import sqlite3
import logging
import datetime
import csv
@jehiah
jehiah / simulate_memcached.py
Created Aug 20, 2011
test script to simulate a partially reachable memcached instance
View simulate_memcached.py
#!/bin/env python
"""
This is a test script to simulate a memcached instance on a server
that has gone south and is accepting connections, but generally not
responding.
The goal of this script is to help test/develop correct client
side settings for timeouts/failure scenarios
@jehiah
jehiah / nsq_testing.go
Last active Jun 30, 2020
NSQ Producer testing abstraction
View nsq_testing.go
package nsqutils
import (
"sync"
"time"
nsq "github.com/nsqio/go-nsq"
)
// Producer is an interface that nsq.Producer fulfills
@jehiah
jehiah / README.md
Created Jun 4, 2020
BigTable ApplyReadModifyWrite load script
View README.md

Performance metrics for cloud.google.com/go/bigtable v1.1.0 vs v1.3.0 which show a stall at 2k ops/sec. tested from n1-highcpu-8 against a 6 node bigtable cluster.

$ for VERSION in v1.1.0 v1.3.0; do git reset --hard; go get cloud.google.com/go/bigtable@${VERSION}; go get cloud.google.com/go@v0.57.0; go build; go list -m all | egrep 'cloud.google.com/go|google.golang.org'; for C in 10 25 50 75 100 125; do ./run_bt_load.sh --concurrency=$C --duration=30s 2>&1 | grep -- '- finished'; done; done
HEAD is now at 4299de614e bigtable v1.1.0 - reproduce breaking performance
go: downloading google.golang.org/genproto v0.0.0-20200603110839-e855014d5736
go: downloading github.com/golang/protobuf v1.4.1
go: downloading google.golang.org/api v0.26.0
go: downloading google.golang.org/protobuf v1.24.0
go: downloading google.golang.org/appengine v1.6.6
@jehiah
jehiah / tcp_throttle.sh
Created Apr 23, 2020
tcp_throttle uses packet shaping to add delay to specific packets
View tcp_throttle.sh
#!/bin/bash
# this uses packet shaping to add delay to specific packets.
# for more informatino about "netem" the network emulation module
# see http://www.linuxfoundation.org/collaborate/workgroups/networking/netem
# or http://lartc.org/howto/index.html section 9 and 12
# please add more options to this script as needed.
function usage() {
echo "USAGE: $(basename $0) --interface=<ethX> (--dport=<PORT> | --host=<IP>) --delay=<DELAY_SPEC> --start"
@jehiah
jehiah / corona_virus_daily_change.sh
Created Apr 4, 2020
Generate CSV of daily deltas from nychealth/coronavirus-data
View corona_virus_daily_change.sh
#!/bin/zsh
#####
# This script provides a delta history of all updates to case-hosp-death.csv
# based on the AS_OF from summary.csv
# https://github.com/nychealth/coronavirus-data/blob/master/case-hosp-death.csv
# https://github.com/nychealth/coronavirus-data/blob/master/summary.csv
#
# By: Jehiah Czebotar