Skip to content

Instantly share code, notes, and snippets.

View rossdylan's full-sized avatar

Ross Delinger rossdylan

View GitHub Profile
@rossdylan
rossdylan / chunking.go
Created April 24, 2014 22:10
Silly way of generating all combinations of all permutations
package cluster
import (
"math/big"
"strings"
)
// Defines a chunk of search space
// Used to tell worker processes what to work on
type Chunk struct {
@rossdylan
rossdylan / curry.py
Created February 19, 2014 01:13
better implict function currying in python
from functools import partial
from inspect import getargspec
class Curryable(object):
"""
A decorator that implements implicit function currying in python
What this means is if you call a function with only part of its required
parameters, it will return a function that takes the remaining paramters
"""
def __init__(self, numArgs=-1):
@rossdylan
rossdylan / bogo.template
Last active January 1, 2016 19:29
Check to see if Harlan's fucking bogosort from hell is still running. I probably didn't need to use gorilla/mux but who the hell cares.
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<title>Is Harlan's BogoSort Running?</title>
<style> h1 { font-size: 100px; } </style>
@rossdylan
rossdylan / sslcheck.go
Last active December 27, 2015 15:19
check some servers ssl certs
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"net"
"net/smtp"
@rossdylan
rossdylan / cshsay.go
Created October 29, 2013 20:42
Annoy your friends!
package main
import "github.com/thoj/go-ircevent"
import "os"
import "os/exec"
import "strings"
import "fmt"
func CowSay(msg string) {
new_msg := strings.Replace(msg, "#", "hashtag ", -1)
@rossdylan
rossdylan / scccam.py
Created October 12, 2013 21:32
Pull images from public traffic cameras owned by the city of santa clara.
import requests
import json
import pprint
import xml.etree.ElementTree as ET
import argparse
from fabulous import image
from StringIO import StringIO
def find_intersections(lines):
@rossdylan
rossdylan / scrolling.html
Created October 2, 2013 21:29
scrolling barchart with chart.js
<!doctype html>
<html>
<head>
<script src="Chart.js"></script>
</head>
<body>
<canvas id="canvas" height="450" width="1000"></canvas>
<script>
var data = {
labels: ["","","","","","","","","","","","","","","","","","","",""],
@rossdylan
rossdylan / 3sync.go
Created August 27, 2013 02:17
attempting to sync files to s3 using golang and goamz
package main
import (
"crypto/md5"
"flag"
"fmt"
"io"
"launchpad.net/goamz/aws"
"launchpad.net/goamz/s3"
"os"
@rossdylan
rossdylan / stdin-wrap.sh
Created July 18, 2013 23:43
force a command that doesn't take input from stdin to take input from stdin
#!/bin/bash
cmd=$@
while read -r; do
echo "$($cmd $REPLY)"
done
@rossdylan
rossdylan / onelinepyramid.py
Created May 20, 2013 19:24
oh dear lord, pyramid hello world example in one line
herp = (lambda clist: __import__('wsgiref.simple_server').simple_server.make_server('0.0.0.0', 8080, clist[-1].make_wsgi_app()).serve_forever())((lambda config: [config.add_route('hello', '/hello/{name}'), config.add_view(lambda request: __import__('pyramid.response').response.Response('Hello {0}'.format(request.matchdict['name'])), route_name="hello"), config])((lambda: __import__('pyramid.config').config.Configurator())()))