Skip to content

Instantly share code, notes, and snippets.

View yanbe's full-sized avatar

yanbe

View GitHub Profile
@yanbe
yanbe / .emacs
Created November 22, 2008 07:08
My .emacs file
(if window-system
(progn
(set-background-color "Black")
(set-foreground-color "LightGray")
(set-cursor-color "Gray")
(set-frame-parameter nil 'alpha 80)))
(setenv "PATH"
(concat "/usr/local/flex3sdk/bin:"
"/usr/local/bin:"
# An example of bootstrapping remote echo client via SSH connection
import socket
import subprocess
import sys
host = '192.168.1.20'
SSH_CLIENT = sys.platform=='win32' and 'plink' or 'ssh'
REMOTE_CODE = '''"import os, socket, sys
@yanbe
yanbe / youtube.py.patch
Created April 24, 2009 05:23
patch for Totem YouTube plugin that enables HD movies a.k.a &fmt=22.
--- youtube.py.orig 2009-04-24 12:40:50.861929605 +0900
+++ youtube.py 2009-04-25 02:35:27.190928256 +0900
@@ -3,6 +3,7 @@
gobject.threads_init()
import gdata.service
import urllib
+import urllib2
import httplib
import atom
import threading
@yanbe
yanbe / fillrect.c
Created June 16, 2009 06:29
From given size of area and rect, examine maximum number of rects can be contained in the area, and print its pattern.
/* From given size of area and rect, examine maximum number of rects can be
contained in the area, and print its pattern.
( answer for a programming question at http://q.hatena.ne.jp/1245118420 )
*/
#include <stdlib.h>
#include <stdio.h>
int do_num_contain_rect(int aw, int ah, int w, int h)
{
if (w>aw || h>ah) return 0;
@yanbe
yanbe / python-chmhelp.el
Created July 1, 2009 09:31
CHM file support for python-mode on Emacs
;; CHM file support for Python help
;; Prerequisites: hhh.exe http://saitou155.catfood.jp/hhh.htm
;; TODO: support Mac and Linux
(require 'python-mode)
(defcustom py-chmhelp-path "/Python26/Doc/python262.chm"
"path for Python CHM help file"
:type 'string
:group 'python)
@yanbe
yanbe / A 200 lines Twitter client in Python featuring ballon notification on GNOME
Created July 28, 2009 06:51
A 200 lines Twitter client in Python featuring ballon notification on GNOME
#!/usr/bin/env python
# Your account information
username=""
password=""
# screen_resolution is used for balloon positioning
screen_resolution=1024,768
# Minimum update_interval under Twitter API restriction is 60*60/70=51.4
update_interval=52
# Balloon will disapear after notify_timeout seconds
@yanbe
yanbe / userstreams.go
Created July 20, 2010 10:43
Reads ChirpUserStreams continuously, format chunks, then put them into standard output.
/*
userstreams.go: Reads ChirpUserStreams continuously, format tjem, then put them
into standard output. For detail, read:http://apiwiki.twitter.com/ChirpUserStreams .
Author: Yusuke Yanbe (y.yanbe@gmail.com)
*/
package main
import (
@yanbe
yanbe / ac-python-complete.el
Created September 25, 2010 23:51
Source definition of Auto Complete Mode for Python module contents.
(defun ac-python-candidates ()
(python-find-imports)
(car (read-from-string
(python-send-receive
(format "emacs.complete(%S,%s)"
(python-partial-symbol)
python-imports)))))
(ac-define-source python
'((candidates . ac-python-candidates)
@yanbe
yanbe / gist:673924
Created November 12, 2010 09:47
Skype 5 for MacのDebug consoleで表示中のチャットの内容をTumblrのチャット形式(sender: body)に変換
var s=jQuery.makeArray($('img + a')), b=jQuery.makeArray($('.body')), lines=new Array(); for(var i=0; i<s.length; i++) {lines.push([s[i].innerText,': ',b[i].innerText].join(''))} console.log(lines.join('\n'));
@yanbe
yanbe / gist:718643
Created November 28, 2010 06:00
Easiest way to get text from malformed HTML
$ wget -q -O /dev/stdout example.com | w3m -dump -T text/html > formatted.txt