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 / 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']
}
});
@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 / 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 / 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 / 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 / AnacondaSympy
Last active August 29, 2015 14:22
Anaconda build for sympy
This is a placeholder to set the gistName
@srgrn
srgrn / general_azure_uploader.py
Created November 1, 2015 09:08
Simple script to upload files to azure
""" uploads files to azure and reports to dashboard """
import sys
import argparse
import os
from azure.storage import BlobService
import logging
LOG_LEVEL = 'WARNING'
@srgrn
srgrn / getting_user_email.py
Last active December 5, 2015 00:59
example of how to get user email from google apis
from bottle import route, request, redirect, view
from apiclient import discovery
# from apiclient import errors
from oauth2client import client
import httplib2
import json
import os
CLIENT_ID = 'YOURCLIENTID.apps.googleusercontent.com'
@srgrn
srgrn / spiral.js
Created October 26, 2013 15:48
solution to Spiral using javascript took me long time to solve even after figuring out the required algorithm.
#!/usr/bin/env node
/**
* Module dependencies.
*/
var program = require('commander');
program
.version('0.0.1')