Skip to content

Instantly share code, notes, and snippets.

View usami's full-sized avatar

Yu Usami usami

View GitHub Profile
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
This is a script to organize your iTunes Music Library.
It moves all directories in the src directory to the destination directory (normally, the Automatically add to iTunes directory).
When they are put in the Automatically add to iTunes directory, iTunes adds them to the library automatically.
"""
import os, sys, shutil
@usami
usami / contestapplet.conf
Created March 2, 2012 23:47
TopCoder ContestApplet Preferences File
#TopCoder ContestApplet Preferences File
#Wed Mar 30 21:59:01 JST 2011
com.topcoder.client.contestApplet.common.LocalPreferences.menufont=Arial
com.topcoder.client.contestApplet.common.LocalPreferences.menufontsize=12
com.topcoder.client.contestApplet.common.LocalPreferences.commonclasspath=/Users/yusmi/Dropbox/dev/tc_env/
com.topcoder.client.contestApplet.common.LocalPreferences.chatpanelback=-16777216
com.topcoder.client.contestApplet.common.LocalPreferences.chatfindhighlight=-8355712
com.topcoder.client.contestApplet.common.LocalPreferences.chatfindback=-16776961
com.topcoder.client.contestApplet.common.LocalPreferences.chatfont=Monospaced
com.topcoder.client.contestApplet.common.LocalPreferences.chatfontsize=12
#!/usr/bin/env python
from stemming.porter2 import stem
from math import sqrt
class Docsim:
def __init__(self):
self.x = {}
self.y = {}
self.xlen = 0
@usami
usami / pocket_download.sh
Created March 16, 2013 01:38
Download all entries in your Pocket (http://getpocket.com).
#!/bin/sh
# before running this script, run the following command
# wget --save-cookies cookies.txt --post-data 'feed_id=****ID****&password=****PASS****' http://getpocket.com/login_process/
i=1
while [ $i -le 60 ]
do
wget --load-cookies cookies.txt -p http://getpocket.com/unread/$i
(( i++ ))
git reset --soft HEAD~1
@usami
usami / .gitconfig
Created June 20, 2013 18:28
Delete untracked files
[alias]
rmu = !git status --untracked-files --short | cut -d ' ' -f 2 | xargs rm -f
#/bin/sh
cd ~
wget http://mirrors.sonic.net/apache/cassandra/2.0.0/apache-cassandra-2.0.0-bin.tar.gz
tar xvfz apache-cassandra-2.0.0-bin.tar.gz
cd apache-cassandra-2.0.0
sudo mkdir -p /var/lib/cassandra/data /var/lib/cassandra/commitlog /var/lib/cassandra/saved_caches
sudo mkdir -p /var/log/cassandra
sudo chmod -R a+w /var/lib/cassandra
#! /usr/bin/python
import sys
if (len(sys.argv) > 1):
num=int(sys.argv[1])
else:
num=int(raw_input("How many nodes are in your cluster? "))
for i in range(0, num):
print 'token %d: %d' % (i, (i*(2**127)/num))
### Keybase proof
I hereby claim:
* I am usami on github.
* I am yusmi (https://keybase.io/yusmi) on keybase.
* I have a public key whose fingerprint is C101 0869 F35A 7D44 49C5 8444 F509 1D37 73B1 7FE6
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am usami on github.
  • I am yusmi (https://keybase.io/yusmi) on keybase.
  • I have a public key ASBGfEaU5gQBXRfCfNrmWxrMS67f-cXRptMvV6moWjgY5Ao

To claim this, I am signing this object: