Skip to content

Instantly share code, notes, and snippets.

@dentearl
dentearl / run_tmux.sh
Last active Jan 2, 2016
Script to provide a simple interface to tmux, a la run_screen
View run_tmux.sh
#!/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 Dec 22, 2012
A script to return valid imgur urls to subreddit posted images. Has a cache mode to ensure no repeated images.
View imgurURLs.py
#!/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 Dec 22, 2012
script to programmatically change your gchat status. Can take input via positional arguments and standard in.
View gstatus.py
#!/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 Nov 24, 2012
python and launchd script to create a MacOSX s3 based dropbox
View com.whatever.s3upload.plist
<?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 Aug 23, 2012 — forked from hasenj/haiku.py
Heroku-ish name generator, Python
View haiku.py
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
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_
View gist:3278446
# 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