Skip to content

Instantly share code, notes, and snippets.

View kaorimatz's full-sized avatar

Satoshi Matsumoto kaorimatz

View GitHub Profile
@kaorimatz
kaorimatz / tags-java.sh
Created July 10, 2012 18:01
Generate a cross reference for the maven project
#!/bin/sh
CSCOPE_OUT_DIR=$HOME/.cscope
CTAGS_OUT_DIR=$HOME/.tags
NAMEFILE=/tmp/java.files
if [ $# != 1 ]; then
echo "usega: $0 project_dir"
exit 1
fi;
@kaorimatz
kaorimatz / gnome-keyring-select-all.py
Created August 3, 2012 06:09
List all keyring items
#!/bin/env python
def main():
import gnomekeyring
for keyring in gnomekeyring.list_keyring_names_sync():
for id in gnomekeyring.list_item_ids_sync(keyring):
item = gnomekeyring.item_get_info_sync(keyring, id)
print 'display name: ' + item.get_display_name()
print 'secret: ' + item.get_secret()
print 'attributes: '
@kaorimatz
kaorimatz / gnome-terminal-dump-profile.py
Created August 8, 2012 07:15
Dumping gnome-terminal's profile settings
#!/bin/env python
def main(name):
import gconf
import pickle
client = gconf.Client()
for p in client.all_dirs('/apps/gnome-terminal/profiles'):
visible_name = client.get_value('%s/visible_name' % p)
print name
@kaorimatz
kaorimatz / vcs_branch.sh
Created August 8, 2012 08:31
Show the branch name of the vcs
function vcs_branch {
local format
if [[ $# -lt 1 ]]; then
format="%s"
else
format=$1
fi
local branch=`_branch`
if [[ -n $branch ]]; then
printf $format $branch
@kaorimatz
kaorimatz / Vagrantfile
Created November 18, 2012 13:18
Configuration of redis master/slave replication
Vagrant::Config.run do |config|
config.vm.define :master do |master_config|
master_config.vm.box = "precise64"
master_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
master_config.vm.network :hostonly, "192.168.33.10"
master_config.vm.provision :chef_solo do |chef|
chef.add_recipe "redisio::install"
chef.add_recipe "redisio::enable"
chef.json = {
@kaorimatz
kaorimatz / GmailAdsBlocker.user.js
Created November 18, 2012 13:29
A userscript for hiding ads at gmail.
// ==UserScript==
// @name Gmail Ads Blocker
// @namespace org.kaorimatz
// @include http*://mail.google.com/*
// @version 0.0.1
// ==/UserScript==
// right ads
GM_addStyle(".Bu { display:none; }");
GM_addStyle(".Bu:first-child { display:block; }");
@kaorimatz
kaorimatz / eclipse-bash-completion.sh
Created November 18, 2012 13:34
An bash completion specification for eclipse
function _eclipse {
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=()
if (($COMP_CWORD == 1)); then
local i
eclipse_home=$SOFTWARE/eclipse
COMPREPLY=( $( compgen -W '$( ls -d $eclipse_home-* )' $eclipse_home-$cur ) )
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
COMPREPLY[i]=${COMPREPLY[i]#$eclipse_home-}
@kaorimatz
kaorimatz / mozilla-css-extensions-color-value.html
Created December 8, 2012 18:39
Display the actual colour of css keywords defined by Mozilla css extensions.
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>MOZ CSS COLOR LIST</title>
<style type="text/css">
#container {
width: 980px;
margin: 10px auto;
}
@kaorimatz
kaorimatz / amount_of_work.py
Created December 18, 2012 15:26
Display the number of lines that you have changed.
#!/usr/bin/python2.7
from mercurial import patch, scmutil, ui, hg
from datetime import datetime
from time import gmtime
from itertools import groupby
def changedline(ui, repo, ctx1, ctx2):
added, removed = 0, 0
diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node()))
@kaorimatz
kaorimatz / Rakefile
Created January 3, 2013 14:00
Generate bookmarklets.
JS = FileList['*.js']
JS.each do |js|
task "#{js}" do
sh "perl -pe 's/(^\\s+|\\s+$)//g' < #{js} | xclip -i"
end
end