Skip to content

Instantly share code, notes, and snippets.

View walkerh's full-sized avatar

Walker Hale IV walkerh

  • Baylor College of Medicine, HGSC
  • Houston, TX
View GitHub Profile
@sbamin
sbamin / how-to-gdc-client-install-rhel6.md
Created February 7, 2018 20:11
Install NCI gdc-client on RHEL 6 to download GDC data

gdc-client on RHEL/CentOS 6

Linux 2.6.32-431.23.3.el6.x86_64

## Using conda 4.3.33

## remove unstable conda env
conda env remove --name rvlabpy2
@TooTallNate
TooTallNate / pbedit.sh
Created March 18, 2016 18:29
`pbedit` command: Edit the clipboard in your $EDITOR
# Edit the clipboard in your $EDITOR
# Add this to your `.bashrc` file
function pbedit () {
local tmpfile=`mktemp`
pbpaste > $tmpfile
$EDITOR $tmpfile
pbcopy < $tmpfile
rm -f $tmpmfile
}
export -f pbedit
@clehner
clehner / github-pull-request
Created January 21, 2016 03:25
Attach a pull request to an existing issue on GitHub
#!/bin/sh
# http://stackoverflow.com/questions/4528869/how-do-you-attach-a-new-pull-request-to-an-existing-issue-on-github
if [ $# -lt 4 ]; then
echo "Usage: ${0##*/} [issue_num] [username/repo] [base_branch] [head_username:branch]" >&2
exit 1
fi
user="$(pass github.com|awk '/^username:/{print $2}')"
issue=$1
@simonw
simonw / gist:7000493
Created October 15, 2013 23:53
How to use custom Python JSON serializers and deserializers to automatically roundtrip complex types.
import json, datetime
class RoundTripEncoder(json.JSONEncoder):
DATE_FORMAT = "%Y-%m-%d"
TIME_FORMAT = "%H:%M:%S"
def default(self, obj):
if isinstance(obj, datetime.datetime):
return {
"_type": "datetime",
"value": obj.strftime("%s %s" % (
@mangecoeur
mangecoeur / a-conda-workon-tool.md
Last active February 9, 2021 14:53
A "virtualenv activate" for Anaconda environments

A "virtualenv activate" for Anaconda environments

I've been using the Anaconda python package from continuum.io recently and found it to be a good way to get all the complex compiled libs you need for a scientific python environment. Even better, their conda tool lets you create environments much like virtualenv, but without having to re-compile stuff like numpy, which gets old very very quickly with virtualenv and can be a nightmare to get correctly set up on OSX.

The only thing missing was an easy way to switch environments - their docs suggest running python executables from the install folder, which I find a bit of a pain. Coincidentally I came across this article - Virtualenv's bin/activate is Doing It Wrong - which desribes a simple way to launch a sub-shell with certain environment variables set. Now simple was the key word for me since my bash-fu isn't very strong, but I managed to come up with the script below. Put this in a text file called conda-work

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh