Skip to content

Instantly share code, notes, and snippets.

View tomsteele's full-sized avatar
🤔

Tom Steele tomsteele

🤔
View GitHub Profile
@tomsteele
tomsteele / santa.js
Created December 8, 2014 05:36
santa.js
var Cylon = require('cylon');
var EventEmitter = require('events').EventEmitter;
var Hapi = require('hapi');
var bot = new EventEmitter();
var on = false;
Cylon.robot({
connections: {
arduino: {
@tomsteele
tomsteele / handwarmer.go
Created November 17, 2014 15:55
handwarmer.go
package main
import (
"runtime"
)
func main() {
n := runtime.NumCPU()
runtime.GOMAXPROCS(n)
@tomsteele
tomsteele / expired.go
Created December 31, 2013 20:27
Prints "NotAfter" field of a certificate for each host in tls.txt
package main
import (
"bufio"
"crypto/tls"
"time"
"net"
"fmt"
"os"
)
@tomsteele
tomsteele / psbat2vba.rb
Last active December 21, 2015 07:59
Converts bat file into compatible VBA string.
#!/usr/bin/env ruby
content = File.open(ARGV[0]).read
# sub escaped double quote for single quote
content.gsub!(/\\\"/, "'")
# sub double quote for decimal double quote
content.gsub!(/\"/, '" & Chr(34) & "')
# add cmd.exe for execution
content = '"cmd.exe /C ' + content
# split every 200 chars and then rejoin with newline and string continuation
@tomsteele
tomsteele / 401.py
Created June 13, 2013 06:08
Simple python script to look for 401s using requests. Explained for educational audiences.
import sys
import requests
# define an array to hold our hosts
hosts = []
# open the file as the variable f
# this will close the file as soon we're done
with open(sys.argv[1]) as f:
# this is called a list comprehension. it's neat way to loop over
@tomsteele
tomsteele / example.py
Created April 10, 2013 08:50
Gevent example with gethostbyname
#!/usr/bin/env python
import sys
import gevent
from gevent import socket
# lazy global variable for storing results
results = []
# greenlet worker
def worker(name):
@tomsteele
tomsteele / simple proxy
Created March 8, 2013 18:19
simple https to http proxy. useful for meteor projects with force-ssl
var fs = require('fs');
var https = require('https');
var httpProxy = require('http-proxy');
if (!process.env.PROXY_TO_HOST) {
throw new Error('Must set environment variable PROXY_TO_HOST with destination address');
}
if (!process.env.PROXY_TO_PORT) {
throw new Error('Must set environment variable PROXY_TO_PORT with destination port');