Skip to content

Instantly share code, notes, and snippets.

View sthorne's full-sized avatar

Sean Thorne sthorne

View GitHub Profile
@sthorne
sthorne / gist:63e3d6e657ab7d660bf0
Created February 24, 2015 14:45
Shell SSH Tunnel
ssh ssh-host -p 322 -L local-host:443:remote-host:443 -N
@sthorne
sthorne / gist:d66c3f35fb65198af165
Created February 24, 2015 14:43
Shell Encrypt / Decrypt a File
openssl enc -aes-256-cbc -salt -in ugh.txt -out ugh.out
openssl enc -d -aes-256-cbc -in ugh.out
@sthorne
sthorne / gist:bbfbbf251b96b027b5da
Last active February 28, 2016 22:19
OpenSSL Connect to Server
# Regular Old HTTPS
openssl s_client -connect my-host:443 -state -debug
# HTTPS w/ SNI
openssl s_client -connect my-host:443 -state -debug -servername my-host
@sthorne
sthorne / gist:bb9b233c57ec501dd84c
Created February 24, 2015 14:40
Mac OS X AppleScript Command Line Notification
osascript -e 'display notification "That just happened" with title "Shake and Bake"'
@sthorne
sthorne / gist:cc324985b225e862bc95
Last active August 29, 2015 14:16
IPTables - Disable Tracking for DNS requests
## If IPTables conntrack is enabled and lots of connections are sucking up resources this can alleviate the problem
## This example is specific to DNS
/sbin/iptables -t raw -I OUTPUT -p udp --sport 53 -j NOTRACK
/sbin/iptables -t raw -I PREROUTING -p udp --dport 53 -j NOTRACK
@sthorne
sthorne / gist:68b2f08faab1e170d650
Created February 22, 2015 00:32
Go - Determine if Timezone is valid
import "fmt"
import "time"
_, e := time.LoadLocation("America/Denver")
if e != nil {
fmt.Println("Timezone is not valid")
return
}
@sthorne
sthorne / gist:9894c6394f042b6e736e
Created February 20, 2015 23:12
Objective-C Pretty Function and Line Logging
NSLog(@"%s [Line %d] %@", __PRETTY_FUNCTION__, __LINE__, data);
@sthorne
sthorne / gist:bd4a14e2b92ddc7d6848
Created February 20, 2015 23:08
Go - Check if File Exists
import "os"
func FileExists(File string) bool {
_, e := os.Stat(File)
if os.IsNotExist(e) {
return false
}
@sthorne
sthorne / gist:a42870b0a5ee5f1f28b1
Created February 20, 2015 23:05
Go - SHA256 File
package main
import (
"fmt"
"io/ioutil"
"encoding/hex"
"crypto/sha256"
)
@sthorne
sthorne / gist:d0fa9da8388d275ac635
Last active August 29, 2015 14:15
Go - MD5 File
package main
import (
"fmt"
"io/ioutil"
"crypto/md5"
"encoding/hex"
)