Skip to content

Instantly share code, notes, and snippets.

@hirochachacha
hirochachacha / post-merge
Created October 4, 2011 08:04
git-hook script for vimproc
#!/bin/sh --
set -e
echo ""
echo "START POST-MERGE HOOK"
echo ""
HOOK_DIR=`dirname $0` #git_hooks directory
PROC_DIR="$HOOK_DIR/../.." #vimproc directory
@hirochachacha
hirochachacha / openid_oauth_hybrid.py
Created October 23, 2011 18:00
example of hybrid auth
!/usr/bin/env python
#coding: utf-8
from flask import Flask, session, request, redirect
from openid.extensions import oauth as openid_oauth
from openid.consumer.consumer import Consumer
from urlparse import urlparse, urlunparse
@hirochachacha
hirochachacha / gist:1628362
Created January 17, 2012 19:33
ansi_buffer - quickrun.vim custom outputter
let ansi_buffer = quickrun#outputter#buffer#new()
function! ansi_buffer.init(session)
call call(quickrun#outputter#buffer#new().init, [a:session], self)
endfunction
function! ansi_buffer.finish(session)
AnsiEsc
call call(quickrun#outputter#buffer#new().finish, [a:session], self)
endfunction
@hirochachacha
hirochachacha / gist:1628404
Created January 17, 2012 19:41
rspec by quickrun.vim with ansi_buffer
let g:quickrun_config['rspec/bundle'] = {
\ 'type': 'rspec/bundle',
\ 'command': 'rspec',
\ 'outputter': 'ansi_buffer',
\ 'exec': 'bundle exec %c --color --tty %s'
\}
let g:quickrun_config['rspec/normal'] = {
\ 'type': 'rspec/normal',
\ 'command': 'rspec',
\ 'outputter': 'ansi_buffer',
@hirochachacha
hirochachacha / gist:1638799
Created January 19, 2012 08:40
よく忘れるfirefox sqlite vaccum
for i in *.sqlite; do sqlite3 $i vacuum; sqlite3 $i reindex; done
@hirochachacha
hirochachacha / pycco_view
Created January 19, 2012 13:27
pycco on the fly
#!/bin/bash --
set -e
TEMP_DIR="/tmp/pycco-$$"
PYTHON_DIR=$(python -c "import $1; import os; print(os.path.dirname($1.__file__))")
trap "rm -rf $TEMP_DIR" EXIT
mkdir $TEMP_DIR
find $PYTHON_DIR -name '*.py' -type f | xargs pycco -d $TEMP_DIR
sleep 1 && python -c "import webbrowser; webbrowser.open('http://localhost:8000/')" &
@hirochachacha
hirochachacha / rocco_view
Created January 19, 2012 14:37
rocco on the fly
#!/bin/bash --
set -e
TEMP_DIR="/tmp/rocco-$$"
GEM_DIR=$(ruby -e "print Gem::Specification.find_by_name(\"$1\").full_gem_path")
trap "rm -rf $TEMP_DIR" EXIT
mkdir $TEMP_DIR
cd $GEM_DIR/lib && find . -name '*.rb' -type f | xargs rocco -o $TEMP_DIR
cd $TEMP_DIR
@hirochachacha
hirochachacha / make.stderr
Created July 10, 2012 06:32
stdout of Vico's make Tue Jul 10 15:28:11 JST 2012
converting help/basics.md with title 'Editing Basics'
Can't open perl script "/Users/hiro/bin/Markdown.pl": No such file or directory
converting help/change.md with title 'Changing text'
Can't open perl script "/Users/hiro/bin/Markdown.pl": No such file or directory
converting help/change_indent.md with title 'Changing indentation'
Can't open perl script "/Users/hiro/bin/Markdown.pl": No such file or directory
converting help/delete.md with title 'Deleting text'
Can't open perl script "/Users/hiro/bin/Markdown.pl": No such file or directory
converting help/dot.md with title 'Repeating the last change'
Can't open perl script "/Users/hiro/bin/Markdown.pl": No such file or directory
[mysqld]
# basic settings
port = 3306
socket=/var/lib/mysql/mysql.sock
skip-locking
default-storage-engine=InnoDB
default-time-zone=utc
user=mysql
character-set-server=utf8
package app
import (
"encoding/base64"
"net/http"
)
func Basic(username, password string) http.Handler {
credential := base64.StdEncoding.EncodeToString([]byte(username + ":" + password))
return &basicHandler{credential}