Skip to content

Instantly share code, notes, and snippets.

View timtadh's full-sized avatar
🔥
it's a trap!

Tim Henderson timtadh

🔥
it's a trap!
View GitHub Profile
@timtadh
timtadh / queue.sh
Last active March 12, 2023 07:44
BASH Job Queue. This is a example of how to make a job queue in GNU Bash. It may not work for other shells as it relies on the bash built in `read`. You will need to see the man pages for your shell to determine if this will work for you.
#!/usr/bin/env bash
rep() {
i=$1
data=$2
## run the replicate ....
}
# make the files
START=$(mktemp -t start-XXXX) ## signals the workers are starting

Keybase proof

I hereby claim:

  • I am timtadh on github.
  • I am tadh (https://keybase.io/tadh) on keybase.
  • I have a public key whose fingerprint is 3116 0263 CF1F 3E14 E6B0 6223 A319 F5FF AEA1 C3D9

To claim this, I am signing this object:

@timtadh
timtadh / .gitignore
Last active November 19, 2015 18:31
mmap-test
*swp
*swo
*.o
mmtest
package cwru.kxh337.arrowc.il;
import java.util.Map;
import java.util.LinkedHashMap;
import com.google.gson.Gson;
public class IntValue extends Value {
int value = 0;
@timtadh
timtadh / upsert.py
Created December 5, 2013 19:14
How to compile an INSERT ... ON DUPLICATE KEY UPDATE with SQL Alchemy with support for a bulk insert.
#!/usr/bin/env python
# Copyright (c) 2012, Tim Henderson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# backup-trello
description "regular background program processing daemon"
start on (local-filesystems and net-device-up IFACE!=lo)
setuid hendersont
setgid hendersont
env HOME=/home/hendersont
export HOME
#!/usr/bin/env python
import sys
import random
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from hbase import Hbase
from hbase.ttypes import *
from datetime import datetime
@timtadh
timtadh / .gitignore
Created August 15, 2012 21:36
Validate Json
*.pyc
*.swp
env
@timtadh
timtadh / stevepipes.rst
Created December 1, 2011 20:10 — forked from irskep/newpipes.rst
Pipes3k

Commands defined and referenced by [ID]: "command in quotes"

After definition, commands may be referenced by ID

Connections defined by reference => reference [=> reference ...]

Expressions are separated by ;

  • file1.txt: one
  • file2.txt: two
@timtadh
timtadh / newegg.py
Created November 7, 2011 12:10
How to extract all of the items (name, price) from Newegg.
import itertools
import requests, lxml, lxml.html
import json
# 7603 Hard Drives
# 7611 RAM
# 6642 random store
def newegg_stores_req():
r = requests.api.get('http://www.ows.newegg.com/Stores.egg/Menus')
return [store['StoreID'] for store in json.loads(r.content)]