Skip to content

Instantly share code, notes, and snippets.

View dentearl's full-sized avatar

Dent Earl dentearl

View GitHub Profile
@dentearl
dentearl / run_tmux.sh
Last active January 2, 2016 18:19
Script to provide a simple interface to tmux, a la run_screen
#!/bin/bash
# adapted from run_screen, from the Bash Cookbook, 1st ed. May 2007
# Albing, Vossen and Newham
# adapted by dent earl, dent earl at gmail
##############################
# Sanity check
if [ "$TERM" == "screen" ]; then
printf "%b" "According to '\$TERM' we're using screen right now. \nAborting.\n"
exit 1
@dentearl
dentearl / imgurURLs.py
Created December 22, 2012 02:19
A script to return valid imgur urls to subreddit posted images. Has a cache mode to ensure no repeated images.
#!/usr/bin/env python
"""
imgurURLs.py,
21 December 2012
dent earl, dent.earl (a) gmail com
a script to return valid imgur urls to subreddit posted images
based in large part on a script from Tankor Smash:
http://blog.tankorsmash.com/?p=266
"""
from argparse import ArgumentParser
@dentearl
dentearl / gstatus.py
Created December 22, 2012 02:16
script to programmatically change your gchat status. Can take input via positional arguments and standard in.
#!/usr/bin/env python
"""
gstatus.py,
21 December 2012
dent earl, dent.earl (a) gmail com
a script to programmatically change your gchat status.
based in large part on a script from CyberShadow:
http://blog.thecybershadow.net/2010/05/08/setting-shared-google-talk-gmail-status-programmatically/
"""
from argparse import ArgumentParser
@dentearl
dentearl / com.whatever.s3upload.plist
Created November 24, 2012 01:31
python and launchd script to create a MacOSX s3 based dropbox
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.whatever.s3upload</string>
<key>ProgramArguments</key>
<array>
@dentearl
dentearl / haiku.py
Created August 23, 2012 21:31 — forked from hasenj/haiku.py
Heroku-ish name generator, Python
from random import choice
def heroku(hex=False):
# modified by @dentearl https://gist.github.com/3442096
# who forked from @hasenj https://gist.github.com/3205543
# who forked from: @afriggeri https://gist.github.com/1266756
# example output:
# 'golden-horizon-2076'
adjs = ['afternoon', 'aged', 'ancient', 'autumn', 'billowing',
'bitter', 'black', 'blue', 'bold', 'broken',
'calm', 'caring', 'cold', 'cool', 'crimson',
@dentearl
dentearl / gist:3278446
Last active May 8, 2020 17:53
bash loop to run tons of jobs but limit the background to a certain smaller number at a time. change the -gt 0 to be -gt _n_ to limit the number of background jobs to _n_
# primate version
for f in ../packagePrimates/analysis/comparatorWrapper-primates.*/; do
for c in A B C D; do
##########
# This block holds the background process count in check
while [ $(jobs | wc -l) -gt 0 ]; do
sleep 2;
done;
##########
for partner in simChimp simGorilla simOrang; do