Skip to content

Instantly share code, notes, and snippets.

@husobee
husobee / main.go
Created December 22, 2015 02:16
simple golang http middleware chaining example
package main
import (
"fmt"
"net/http"
"time"
"golang.org/x/net/context"
"github.com/husobee/backdrop"
@husobee
husobee / scanval.go
Last active December 16, 2022 18:44
scanner valuer example
package main
import (
"database/sql"
"database/sql/driver"
"errors"
"fmt"
_ "github.com/mattn/go-sqlite3"
)
@husobee
husobee / gist:9ff87a6f27e9abb4a3bc
Created March 3, 2015 20:33
Example of Mocking in Golang, and Monkey Patch
package main
import "fmt"
type Something struct {}
func (s Something) Test() bool {
return false
}
type SomethingInterface interface {
@husobee
husobee / main.go
Created December 9, 2015 13:15
bcrypt concurrency
package main
import (
"flag"
"fmt"
"time"
"golang.org/x/crypto/bcrypt"
)
@husobee
husobee / .tmux.conf
Created January 30, 2015 19:44
my tmux.conf for weemux
set-option -g status-utf8 on
set -g status-interval 1
set -g status-justify left # center align window list
set -g status-left-length 75
set -g status-right-length 150
set -g status-fg white
set -g status-bg black
set -g status-attr bright
@husobee
husobee / .vimrc
Last active December 25, 2021 00:40
my vimrc
" My .vimrc, it is pretty golang specific
colorscheme elflord
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=$GOROOT/misc/vim
" vundle plugins
@husobee
husobee / keyadd.sh
Created January 26, 2017 13:30
using passwordstore with ssh-add
#!/bin/bash
PASS_NAME=$1
KEY_FILENAME=$2
# start ssh-agent
eval `ssh-agent -s`
# decrypt the rsa private key, using the password from the `pass` command by means of a named pipe
openssl rsa -inform PEM -passin file:<(pass show ${PASS_NAME}) -in ${KEY_FILENAME} -text | ssh-add -
@husobee
husobee / progress.sh
Last active February 24, 2021 23:21
fun beginnings of a bash progress bar
#!/bin/bash
function progress {
cattail='='
cat1=' ,------, '
cat2=' | /\_/\ '
cat3=' |__( ^ .^) '
cat4=' "" "" '
echo;echo;echo;echo;echo;echo
@husobee
husobee / client_tls_info.go
Last active December 14, 2020 17:52
discovery of tls in go, and the handshake process
package main
import (
"crypto/tls"
"encoding/json"
"fmt"
"log"
"net"
"net/http"
)
@husobee
husobee / validation-main.go
Created January 8, 2016 20:07
input validation sanely
package main
import (
"encoding/json"
"errors"
"net/http"
"github.com/asaskevich/govalidator"
)