Skip to content

Instantly share code, notes, and snippets.

View mustpax's full-sized avatar

Mustafa "Moose" Paksoy mustpax

View GitHub Profile
@mustpax
mustpax / cdto.sh
Created March 9, 2010 22:36
Find file, cd to parent directory
function cdto {
local targetfile;
local searchdir;
if [ -z "$2" ]; then
searchdir=.
targetfile=$1
else
searchdir=$1
targetfile=$2
fi;
@mustpax
mustpax / Makefile
Created June 30, 2011 05:02
Skeleton Makefile
# Basic compilation rules for some common file formats
TARGETS = # Actual files here
.coffee.js :
coffee -c $<
.SUFFIXES: .js .coffee
SRC=$(wildcard *.c)
OBJS=$(SRC:.c=.o)
@mustpax
mustpax / gist:1142545
Created August 12, 2011 17:45
TextWrangler Diff with Git
git config --global --add "difftool.twdiff.cmd" 'twdiff --wait "$LOCAL" "$REMOTE"'
git config --global diff.tool twdiff
@mustpax
mustpax / spiral.py
Created August 30, 2011 20:50
Spiraling two dimensional array iterator
#!/usr/bin/env python
'''I saw an Erlang solution to this problem, thought I'd give it a shot in Python.
http://erlangquicktips.heroku.com/2010/01/06/following-a-spiral/
'''
def spiral(l):
'''Take a list of lists that is assumed to be in row major order.
Return a list generated by iterating through the elements of the structure
in a spiral that moves closer to the center as you move clockwise.
@mustpax
mustpax / tumblr.html
Created September 4, 2011 06:51
Modified Tumblr Theme
<!DOCTYPE>
<!-- Designed by Peter Vidani
Found at http://www.tumblr.com/theme/467
-->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="generator" content="TextMate http://macromates.com/">
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.basic.DefaultOAuthConsumer;
import oauth.signpost.exception.OAuthCommunicationException;
@mustpax
mustpax / Makefile
Created September 14, 2012 00:48
coffee makefile
# Basic compilation rules for CoffeScript
run: script.js
node script.js
clean:
rm script.js
.coffee.js :
coffee -c $<
@mustpax
mustpax / graph-it-with-graphite
Created July 31, 2013 01:07
Graphite metric expressions for lightning talk
aws.cloudwatch.api.us-east-1b.HTTPCode_Backend_2XX.count
aws.cloudwatch.api.*.HTTPCode_Backend_2XX.count
sumSeries(aws.cloudwatch.api.*.HTTPCode_Backend_2XX.count)
timeShift(sumSeries(aws.cloudwatch.api.*.HTTPCode_Backend_2XX.count), '-1w')
diffSeries(timeShift(sumSeries(aws.cloudwatch.api.*.HTTPCode_Backend_2XX.count), '-1w'), sumSeries(aws.cloudwatch.api.*.HTTPCode_Backend_2XX.count))
[
{
"name":"Pavel",
"surname":"Gherghel",
"gender":"male",
"region":"Romania"
},
{
"name":"Ludmila",
"surname":"Găină",
const _ = require("underscore");
const fs = require("fs");
// convert hex to base64
function challenge1(hex) {
return Buffer.from(hex, "hex").toString("base64");
}
// xor two hex encoded strings, return hex
function challenge2(hex1, hex2) {