Skip to content

Instantly share code, notes, and snippets.

@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')
@srgrn
srgrn / jira_test.js
Created November 4, 2013 06:14
a simple gist for testing how to work with jira rest api
https://docs.atlassian.com/jira/REST/latest/
var files = [],
tickets =[];
var finishrun = false;
var request = require('request');
while(!finishrun){
var result;
request('https://jira.atlassian.com/rest/api/2/search/',function (error, response, body) {
if (!error && response.statusCode == 200) {
@srgrn
srgrn / vagrant.log
Created December 17, 2013 20:14
a log of the output from vagrant up
INFO global: Vagrant version: 1.4.0
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/commands/box/plugin.rb
INFO manager: Registered plugin: box command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/commands/destroy/plugin.rb
INFO manager: Registered plugin: destroy command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/commands/halt/plugin.rb
INFO manager: Registered plugin: halt command
DEBUG global: Loading core plugin: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/commands/help/plugin.rb
# 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
}
@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 / 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 / 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 / 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 / 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