Skip to content

Instantly share code, notes, and snippets.

import webbrowser
import tweepy
"""
Query the user for their consumer key/secret
then attempt to fetch a valid access token.
"""
class CacooOAuthHandler(tweepy.OAuthHandler):
def _get_oauth_url(self, endpoint, secure=False):
from random import getrandbits
from time import time
import hmac, hashlib
import sys
import urllib
import urllib2
import urlparse
# build parameters to post
consumer_key = 'your <consumer_key>'
@sinsoku
sinsoku / git_wrapper.sh
Created April 18, 2012 18:42
git wrapper for msysgit v1.7.10
#!/bin/sh
cmd="git"
tmp_file="$TEMP/gitcmd.sh"
nkf -w << EOF > $tmp_file
#!/bin/sh
$cmd $*
EOF
chmod +x $tmp_file
@sinsoku
sinsoku / gist:2837601
Created May 30, 2012 16:55
git-qsave
#!/bin/sh
if [ -n "`git diff`" ]
then
git stash save --keep-index
git stash apply --index
fi
@sinsoku
sinsoku / base.rb
Created August 16, 2012 14:38
gruff patch for ruby 1.9.3
# config/initializers/gruff/base.rb
module Gruff
class Base
def label_with_ruby193(value)
if @marker_count.to_f == 0
label = value.to_i.to_s
parts = label.split('.')
parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{THOUSAND_SEPARATOR}")
parts.join('.')
@sinsoku
sinsoku / git-rm_origin_branches
Created August 28, 2012 11:34
delete origin feature branches
#/bin/sh
tags=`git branch -r | grep "origin/feature" | sed -e "s/ origin\///g"`
if [ -n "${tags}" ]; then
for t in "${tags}"
do
echo git push --delete origin ${t}
git push --delete origin ${t}
done
else
# -*- coding: utf-8 -*-
import json
import os
import subprocess
import time
import urllib2
devnull = open(os.devnull, 'w')
blink1_tool_path = './blink1-tool'
jenkins_url = 'https://buildhive.cloudbees.com/view/All/job/jenkinsci/'
module RESTful
extend ActiveSupport::Concern
def resource_name
@resource_name ||= controller_name.singularize
end
def model_class
@model_class ||= resource_name.camelize.constantize
end
for n in `seq 10000`; do git checkout -b br$n master; echo $RANDOM > $RANDOM$RANDOM$RANDOM$RANDOM; git add .; git commit -m"$RANDOM"; done; git checkout master; brs="`git branch | grep -v master`"; git merge $brs; git branch -D $brs; git rm *; git commit -m"del"
@sinsoku
sinsoku / sample.rb
Last active December 29, 2015 17:49
class Sample
class << self
def run
puts "hello, #{gets}"
puts "hello, #{gets}"
end
end
end
if __FILE__ == $0