Skip to content

Instantly share code, notes, and snippets.

View kisom's full-sized avatar

Kyle Isom kisom

View GitHub Profile
@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 / pre-comment
Created November 27, 2012 17:17
go pre-commit hook
#!/bin/sh
go fmt && go build && exit 0
exit 1
@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 / 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
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 / 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 / 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 / gist:3140167
Created July 19, 2012 01:28
Undefined symbol errors in Lisp

The other day, I got a strange error while writing a macro (actually, deftest from Peter Seibel's Practical Common Lisp. My defmacro looked like this:

(defmacro deftest (name parameters &body body)
  `(defun ,name ,parameters
     (let ((*test-name* ,name))
       ,@body)))

At first glance, it looks fine. So, I defined a few tests with it (check is another macro for reporting test results):

#!/bin/sh
# cd code && find . -type d -maxdepth 1 -exec repo-status '{}' \;
if [ ! -z "$1" ]; then
CWD="$(pwd)"
cd $1
fi
if [ -d .git ]; then
if git status -uno --porcelain | grep "^[[:space:]]M[[:space:]]" >/dev/null ; then
@kisom
kisom / clj-deploy.sh
Created June 30, 2012 03:27
Simple deployments for clojure projects.
#!/bin/sh
# simple deploy script for Clojure projects.
# very rough
echo "[+] generating standalone jar."
lein uberjar
target="user@example.net"
jarfile="$(ls -1 *standalone*)"
timestamp=$(date +'%s')