Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am steventen on github.
  • I am steventen (https://keybase.io/steventen) on keybase.
  • I have a public key ASB0u_TtaHreT7kF64LKFIC9URCirBbcUQkv0rcVmcEtxQo

To claim this, I am signing this object:

func GetCompany(db *sql.DB, key string) (Company, int) {
var company_id int
var api_key string
err := db.QueryRow("select id, api from companies where api = ? limit 1", key).Scan(&company_id, &api_key)
switch {
case err == sql.ErrNoRows:
return Company{}, 0
case err != nil:
fmt.Println(err)
return Company{}, -1
@steventen
steventen / request_log
Created November 21, 2014 19:18
Get request info
proxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
logger.Printf("Request: %s | IP: %s", req.URL, req.RemoteAddr)
return req, nil
})
@steventen
steventen / install_ruby.sh
Last active December 13, 2015 22:09
install ruby rails, and mysql on ubuntu 12.04
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libyaml-dev libpcre3-dev
apt-get -y install curl git-core python-software-properties
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p362.tar.gz
tar -xvzf ruby-1.9.3-p362.tar.gz
cd ruby-1.9.3-p362/
./configure --prefix=/usr/local
make