Skip to content

Instantly share code, notes, and snippets.

# set enviroment
sudo chown `id -u` /etc/environment
cat <<EOT > /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
EOT
@srgrn
srgrn / AnacondaSympy
Last active August 29, 2015 14:22
Anaconda build for sympy
This is a placeholder to set the gistName
@srgrn
srgrn / gist:8cfdf1c4ad2642925e54
Created May 14, 2015 02:08
docker-machine-set-env-on-cmd
1. open cmd
2. ensure your env is up
`docker-machine ls`
3. run `set DOCKERENV='your env name'`
4. run the following command ` echo @echo off > %TEMP%\%DOCKERENV%.bat && ( docker-machine.exe env %DOCKERENV% | sed 's/export/set/'
| sed 's,\\\\\\\\,\\\\,g' | sed 's,#,rem,g') >> %TEMP%\%DOCKERENV%.bat && %TEMP%\%DOCKERENV%.bat %% del
%TEMP%\%DOCKERENV%.bat`
@srgrn
srgrn / create_team_hockeyapp
Last active August 29, 2015 14:15
create a team in hockeyapp using python
import sys
import requests
import os
import cookielib
from lxml import html
EMAIL = "USEREMAIL"
PASSWORD = "PASSWORD"
URL = "https://rink.hockeyapp.net/users/sign_in"
# Start a session so we can have persistant cookies
@srgrn
srgrn / autopart.sh
Last active November 3, 2017 07:22 — forked from trentmswanson/autopart.sh
#!/bin/bash
# An set of disks to ignore from partitioning and formatting
BLACKLIST="/dev/sda|/dev/sdb"
# Base directory to hold the data* files
DATA_BASE="/media"
usage() {
echo "Usage: $(basename $0) <new disk>"
}
@srgrn
srgrn / prov_explorer.py
Created January 14, 2015 13:42
a simple script to get details from provisioning profiles on mac
import optparse
import os
import plistlib
import sys
import traceback
PLIST_START = '<?xml'
PLIST_END = '</plist>'
def parse_provisioning(fn):
fn = os.path.expanduser(fn)
@srgrn
srgrn / humble.py
Created May 18, 2014 05:12
comparing steam games with unclaimed humble bundle keys
import requests
from bs4 import BeautifulSoup
import getpass
import steamapi # from https://github.com/smiley/steamapi
import sys
import re
username = raw_input('Humble Bundle Username:')
password = getpass.getpass('Humble Bundle Password:')
steamUserName = raw_input('Steam User Name:')
@srgrn
srgrn / svn2git_fsdiff.py
Last active August 29, 2015 13:56
python script to convert from svn commits to a git repo -in the case where git svn simply doesn't work
import subprocess
import re
import os
import sys
import tempfile
import shutil
# if you change this array you need to change the function that gets the mapping as well
OWNERS = { 'svnusername': 'firstname.lastname@company.com',
}
@srgrn
srgrn / Gruntfile.js
Created February 1, 2014 19:34
Using grunt to run python koans on change
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
files: ['./koans/*.py'],
tasks: ['pythonrun']
}
});
# bourne shell functions below take 1 argument, the file_to_hash.
# prints hex digest on stdout
md5() {
perl -MDigest::MD5=md5_hex -le'print md5_hex(<> or die)' "$1"
# ruby -rdigest/md5 -e"puts Digest::MD5.file'/dev/null'"
# python -sBc "import hashlib;print hashlib.md5(open('$1','rb').read()).hexdigest()"
# md5 "$1"|cut -d' ' -f4 # mac/bsd
# md5sum "$1"|cut -d' ' -f1 # linux
}