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: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."
require 'mail'
load 'mrbananagrabber.rb'
module Mail
def self.to_hash
puts "ok"
end
end
x = Mail.new STDIN.read
function log_me(data){
console.log(data);
}
jQuery.ajax({url: "http://api.tumblr.com/v2/blog/scipsy.tumblr.com/info?api_key={YOUR-KEY}&jsonp=log_me", dataType: "jsonp"});
@codingjester
codingjester / oauth
Created October 12, 2011 00:11
Follow/Unfollow example OAuth for Tumblr API
#!/usr/bin/env python
import oauth2 as oauth
import urlparse
import urllib
consumer_key = '<your-key-here>'
consumer_secret = '<your-secret-key-here>'
request_token_url = 'http://www.tumblr.com/oauth/request_token'