Skip to content

Instantly share code, notes, and snippets.

@whym
whym / keylogger.py
Created May 16, 2010 10:09
A simple key logger with xlib and python. Use with gist:402589
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This script is an modification of the script below.
#
#
# examples/record_demo.py -- demonstrate record extension
#
@whym
whym / count.sh
Created May 16, 2010 02:25
counting script for pipes; try "dmesg | count '^\[\s*(\d+)' 10"
ruby -e'scale=(ARGV[1]||50).to_i; a=STDIN.map{|x| x[Regexp.new(ARGV[0]), 1]}; h=Hash.new{|h_,k| h_[k]=[0,h_.length]}; a.each{|x| h[x]=[h[x][0]+1,h[x][1]]}; puts h.keys.sort_by{|x| h[x][1]}.map{|x| sprintf %q!%s %7d %s!, x, h[x][0], %q{*}*(h[x][0]/scale)}'
@whym
whym / java-sun-com.css
Created April 30, 2010 01:20
css for API docs on java.sun.com
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain(java.sun.com) {
body {
font-family: "Arial", sans-serif;
}
p, dd, table {
max-width: 55em;
}
p {
@whym
whym / twitter-screenname-check.rb
Created April 4, 2010 06:28
check the availability of twitter screen names
#! /usr/bin/env ruby
require 'rubygems'
require 'json'
require 'open-uri'
require 'optparse'
OPT = Struct.
new(:auto, :wait).
new(false, 0.3)
@whym
whym / love_on_tumblr.user.js
Created February 28, 2010 04:44 — forked from taizooo/love_on_tumblr.user.js
Type "Shiflt + L" to Like/Unlike & Fav/Unfav on Tumblr Dashboard. Click the label "raw" below to install.
// ==UserScript==
// @name love on tumblr
// @namespace http://www.tumblr.com/
// @description love current post on tumblr dsbd with 'Shift + l'key. if won't work, pray on tumblr!
// @include http://www.tumblr.com/dashboard*
// @include http://www.tumblr.com/show/*
// @include http://www.tumblr.com/tagged/*
// @version 0.0.2
// ==/UserScript==
var now = new Date();
var last_nyd = new Date(now.getFullYear(), 0, 1);
var next_nyd = new Date(now.getFullYear() + 1, 0, 1);
var rate = (now - last_nyd) / (next_nyd - last_nyd);
var beginning_of_today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
var one_day = 1000 * 60 * 60 * 24;
var pdate = new Date(beginning_of_today.getTime() + rate * one_day);
var hours = pdate.getHours();
var ampm = hours > 12 ? "PM" : "AM";
hours = hours > 12 ? hours - 12 : hours;
@whym
whym / ldrize.user.js
Created December 19, 2009 14:03
'all-link' mod of LDRize
// ==UserScript==
// @name LDRize
// @namespace http://white.s151.xrea.com/
// @description j,k,v,p,o,:,f,? + l,s,i
// @include http://*
// @include https://*
// @include file:///*
// ==/UserScript==
const SCRIPT_VERSION = "2009.12.05_mod_by_whym"
@whym
whym / remaining_time.sh
Created December 2, 2009 02:56
calculate the difference between the given time in the argument and the current time
ruby -rtime -e'd=(Time.parse(ARGV.join(%q{ }))-Time.now).to_i; sign=d/d.abs<0?%q{-}:%q{}; d=d.abs; s,m,h=[60,60].map{|x| r=d%x; d=(d-r)/x; r}+[d]; puts sprintf %q!%s%d:%02d:%02d!, sign,h,m,s' # "2010-01-15T23:59 EST"
#!python
# -*- encoding: utf-8 -*-
# DNS log converter from Microsoft DNS to namebench
# INPUT:
# 20091029 11:49:01 848 PACKET 02728D00 UDP Rcv 133.11.34.152 053d Q [0001 D NOERROR] A (6)images(8)slashdot(2)jp(0)
# OUTPUT:
# domain://images.slashdot.jp
// ==UserScript==
// @name Google Search - Add direct links
// @namespace http://github.com/whym
// @include http://www.google.tld/search?*
// @version 0.01
// @description Add direct links in Google search result
// ==/UserScript==
// based on http://userscripts.org/scripts/show/57679 by blooo