Skip to content

Instantly share code, notes, and snippets.

View codingjester's full-sized avatar
🙊
Focusing

codingjester

🙊
Focusing
View GitHub Profile
@codingjester
codingjester / globby.rb
Created April 2, 2014 15:42
Example File globbing for the path you want
def job_files(path=".")
Dir.glob("#{path}/**/*").select { |path| File.file?(path) }
end
puts job_files("ok")
.johnny .cant .touch .this {
align: left;
}
@codingjester
codingjester / awesome.sh
Created August 22, 2014 14:22
Awk one-liner for grabbing haproxy requests (using httplog) longer than 1 second.
# You can change 1000 to whatever you want
awk '{n=split($8, b,"/"); if(b[n] >= 1000) print}' your_haproxy_log.log
@codingjester
codingjester / app.go
Created September 1, 2014 00:48
Simple Hello World Golang Web Application
package main
import (
"net/http"
"github.com/gorilla/mux"
)
func main() {
r := mux.NewRouter()
@codingjester
codingjester / app.go
Created September 1, 2014 00:59
Building on Hello World. Lets add a Database connection to MySQL
package main
import (
"database/sql" // Needs the mysql driver so we can connect to the DB.
"net/http"
"log"
_ "github.com/go-sql-driver/mysql" // Importing mysql driver for its side-effects, no implicit use
"github.com/gorilla/mux"
)
@codingjester
codingjester / app.go
Created September 1, 2014 01:15
Well, Now we're getting complicated. Hardcoded values for a database are kinda useless right? Lets load some JSON configs.
var config *Configuration // A global we'll reuse for the application
// Defining the structure of the JSON as we'll expect it
type Configuration struct {
Port int // Port the app is served on
Db_Type string
Db_Username string
Db_Password string
Db_Host string
DB string
@codingjester
codingjester / delete_merged_branches.sh
Last active August 29, 2015 14:09
Deleting merged branches
git branch --merged | grep -v "master" | xargs git branch -d
@codingjester
codingjester / hello.py
Created December 19, 2014 21:55
oh spit.
print "Hello World."