Skip to content

Instantly share code, notes, and snippets.

View sthorne's full-sized avatar

Sean Thorne sthorne

View GitHub Profile
@sthorne
sthorne / config
Created February 19, 2017 19:36
ssh client config to selectively use ssh keys
Host hostname.example.com
IdentityFile ~/.ssh/id_rsa
Host *
IdentityFile ~/.ssh/id_dev
@sthorne
sthorne / dev-sync.plist
Last active February 19, 2017 19:38
Mac OS X launchd plist to sync directory when files added/edited
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>dev-sync</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/rsync</string>
<string>-aq</string>
@sthorne
sthorne / timecheck.go
Created June 3, 2016 19:43
Validating Time in String
package main
import (
"fmt"
"time"
)
func main() {
@sthorne
sthorne / tls-check.go
Created June 3, 2016 19:41
Fetch an HTTPS Asset from Specific IP and Skipping DNS lookup
package main
import (
"crypto/tls"
"log"
"net/http"
)
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia \
--volume /Volumes/UNTITLED\ 1 \
--applicationpath /Applications/Install\ OS\ X\ Yosemite.app
@sthorne
sthorne / gist:e9f0284d074d0383b029
Created June 3, 2015 17:14
String to Byte Slice
import (
"fmt"
"bytes"
)
func main() {
s := bytes.NewBufferString("hello world").Bytes()
fmt.Printf("%#v", s)
}
@sthorne
sthorne / gist:6f7090c529182ce91948
Created February 28, 2015 22:29
Cross Compile Go
# This must be run from GOROOT
cd /usr/local/go/src
# Options
# darwin_386
# darwin_amd64
# freebsd_386
# freebsd_amd64
# linux_386
# linux_amd64
@sthorne
sthorne / gist:db368c3c57b94aab5756
Created February 26, 2015 17:38
Go - Time Duration
package main
import "fmt"
import "time"
func main() {
t := time.Now()
time.Sleep(10 * time.Millisecond)
@sthorne
sthorne / gist:7de70dc5cd871ce2f48f
Created February 24, 2015 19:45
Install Java on CentOS 6
mkdir /usr/java
cp jre-7u51-linux-x64.rpm /usr/java/jre-7u51-linux-x64.rpm
cd /usr/java
rpm -ivh jre-7u51-linux-x64.rpm
alternatives --config java
java -version
@sthorne
sthorne / gist:5c977840f4bc2f25ad2e
Created February 24, 2015 19:42
Enable TLS in Postfix
postconf -e 'smtp_tls_security_level = may’
postconf -e 'smtp_tls_loglevel = 1’
postconf -e 'smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt’
service postfix restart