Skip to content

Instantly share code, notes, and snippets.

View kisom's full-sized avatar

Kyle Isom kisom

View GitHub Profile
@kisom
kisom / example.txt
Created July 31, 2012 18:57
Python command line utility to determine whether a site supports HSTS.
<monalisa: ~> $ has_hsts.py duckduckgo.com google.com search.google.com conformal.com yahoo.com lobste.rs news.ycombinator.com reddit.com
[+] checking whether duckduckgo.com supports HSTS... no
[+] checking whether google.com supports HSTS... no
[+] checking whether search.google.com supports HSTS... no
[+] checking whether conformal.com supports HSTS... yes
[+] checking whether yahoo.com supports HSTS... no
[+] checking whether lobste.rs supports HSTS... yes
[+] checking whether news.ycombinator.com supports HSTS... no
[+] checking whether reddit.com supports HSTS... doesn't have SSL working properly (hostname 'reddit.com' doesn't match either of 'a248.e.akamai.net', '*.akamaihd.net', '*.akamaihd-staging.net')
@kisom
kisom / plaintext.sh
Created August 2, 2012 06:02
Strip out extraneous information from a file to a plain text file (i.e. script(1) output)
#!/bin/sh
# -r is lunix only
cat $1 | sed -E "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | col -b
@kisom
kisom / Makefile
Created August 6, 2012 19:17
Go commandline utility to determine whether a site supports HSTS.
TARGET := does_hsts
PREFIX ?= /usr/local
all: $(TARGET)
$(TARGET): $(TARGET).go
go build -o $(TARGET)
clean:
rm $(TARGET)
@kisom
kisom / gist:3522220
Created August 30, 2012 04:07
The Yeelong: A Review

I'm sure many other people have reviewed the Lemote Yeelong 8089 netbook. I picked up mine for a specific use-case and for the most part, it does a decent enough job satisfying that use case. However, unless you're at an RMS level of free software dogmatism, you would probably be better served by an x86-based netbook. I use it for hacking in C on the bus, especially when working on code that is meant to run on OpenBSD systems. It is quite slow, making it sometimes painful to do much more than gvim (which can take a second or longer to pull up on screen)

Mine is configured with 1G of RAM and a 160G hard drive (I haven't looked at changing out any of the stock hardware), and runs OpenBSD 5.0/mipsel. For the most part, the hardware runs very well. The major exception is the wireless card; when I tried using it on an open access point, it worked fine. It struggled, and typically failed, to connect to my WPA2'd access point. I had a USB ral0 wireless adaptor lying around, and I just use that when I need wireless

@kisom
kisom / Makefile.am
Created November 20, 2012 21:13
C / automake test stubs for unit testing
SUBDIRS = tests
TESTS = tests/stub_test
@kisom
kisom / pre-comment
Created November 27, 2012 17:17
go pre-commit hook
#!/bin/sh
go fmt && go build && exit 0
exit 1
@kisom
kisom / timestamp.go
Last active December 16, 2015 15:29
It appears time.Now().UTC().Unix() still returns a local timestamp. If this doesn't work, I'm not sure how to get a UTC timestamp.
package main
import "fmt"
import "time"
func main() {
local, _ := time.Now().Zone()
fmt.Println("Local timezone:", local)
fmt.Println("UNIX local timestamp:", time.Now().Unix())
fmt.Println("UNIX UTC timestamp:", time.Now().UTC().Unix())
@kisom
kisom / mydaemon
Created April 28, 2013 06:10
Sample Upstart and sysvinit script for Go daemons.
#! /bin/sh
### BEGIN INIT INFO
# Provides: mydaemon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mydaemon does stuff
# Description: this is an actual executable script, and should be saved in
# /etc/init.d/mydaemon.
@kisom
kisom / go.benchmarks.txt
Created April 30, 2013 14:05
Go Benchmarks for the Beaglebone/Black
PASS
ok archive/tar 0.087s
*** Test killed: ran too long (10m0s).
FAIL archive/zip 600.056s
PASS
BenchmarkReaderCopyOptimal 20000 100551 ns/op
BenchmarkReaderCopyUnoptimal 10000 273210 ns/op
BenchmarkReaderCopyNoWriteTo 5000 334045 ns/op
BenchmarkWriterCopyOptimal 10000 282170 ns/op
BenchmarkWriterCopyUnoptimal 10000 272459 ns/op
@kisom
kisom / onp.go
Created June 16, 2013 17:08
scripts to fetch OpenNICProject nameservers, suitable for putting in resolv.conf.
package main
import (
"fmt"
"github.com/PuerkitoBio/goquery"
"os"
"regexp"
"strings"
)