Skip to content

Instantly share code, notes, and snippets.

View johngian's full-sized avatar

John Giannelos johngian

View GitHub Profile
@johngian
johngian / dijkstra.cpp
Created February 14, 2012 00:03
Dijkstra in C++ using STL
#define MAX 999999999
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
class compare
@johngian
johngian / 8bit.py
Created February 21, 2012 17:36
8-bit.fm XML playlist parsing
import os
import urllib2
from xml.dom.minidom import parseString
file = urllib2.urlopen('http://dl.dropbox.com/u/1065469/8bitmusic/-playlist.xml')
data = file.read()
dom = parseString(data)
@johngian
johngian / regexpassgen.py
Last active August 29, 2015 13:56
Password generator from regular expression.
# Dependencies: pip install exrex
# Run: python ./regexpassgen.py --output <filename> <regex>
import argparse
import exrex
if __name__=='__main__':
parser = argparse.ArgumentParser()
parser.add_argument('regex', type=str, help='Password generator regex.')
@johngian
johngian / git-checkout-pr.py
Created April 11, 2014 13:10
git-checkout in github PR
#!/usr/bin/python
import requests
import traceback
import sys
from git import Repo
from optparse import OptionParser

Keybase proof

I hereby claim:

  • I am johngian on github.
  • I am nemo (https://keybase.io/nemo) on keybase.
  • I have a public key whose fingerprint is 1DE4 2D81 CAE1 E521 AA56 1D3B C64E 269E 1DC1 0848

To claim this, I am signing this object:

# Command: curl -X POST -H "Content-Type: application/json" http://<master>:8080/v2/apps [email protected]
{
"container": {
"type": "DOCKER",
"docker": {
"image": "libmesos/ubuntu"
}
},
"id": "ubuntu",
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Launches a cluster to facilitate as HA Mesos cluster",
"Parameters": {
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type": "String"
}
},
#!/usr/bin/env python
import click
import os
import requests
import tempfile
from itertools import izip, repeat
from multiprocessing import Pool
{
"id": "foobar",
"instances": 1,
"cpus": 0.2,
"mem": 128,
"container": {
"type": "DOCKER",
"docker": {
"network": "HOST",
"image": "foo/bar",
### Keybase proof
I hereby claim:
* I am johngian on github.
* I am nemo (https://keybase.io/nemo) on keybase.
* I have a public key ASCM6UldFk760y5-_tMl2Z8GlCbJ_mhtdJqOLglL4h_G5Ao
To claim this, I am signing this object: