Skip to content

Instantly share code, notes, and snippets.

%_builddir ~/rpms/BUILD
%_smp_mflags -j4
%dist centos5
%_topdir ~/rpms
%debug_package %{nil}
%optflags x86_64 -O2 -fomit-frame-pointer -pipe
@tatsuru
tatsuru / ssh.rb
Created September 26, 2012 07:55
Net::SSH.start(
ip_address, "wtatsuru"
) do |session|
session.open_channel do |channel|
channel.request_pty do |ch, success|
raise "pty" unless success
end
channel.exec("sync") do |ch, success|
ch.on_data do |c, data| puts data end
end
@tatsuru
tatsuru / dante.conf
Created August 11, 2012 12:00
dante.conf
resolveprotocol: fake
route {
from: 0.0.0.0/0 to: 0.0.0.0/0 via: 127.0.0.1 port = 1080
protocol: tcp udp
proxyprotocol: socks_v5 socks_v4
method: none
}
@tatsuru
tatsuru / gist:3296314
Created August 8, 2012 16:18 — forked from onishi/gist:1630307
Media queries for Hatena Group
@media screen and (max-device-width: 480px) {
* {
font-size: 48px;
line-height: 64px;
word-break: break-all;
}
table#banner, div#simple-header, div.sidebar, div.caption {
display:none
}
img.hatena-star-comment-button, img.hatena-star-add-button, img.hatena-star-star {
@tatsuru
tatsuru / glog.pl
Created June 2, 2012 21:37
weechat global log plugin
# Weechat plugin
use strict;
use warnings;
my %options = (
buffer => "glog",
logger => "",
exclude => "",
);
@tatsuru
tatsuru / shift.c
Created November 30, 2011 14:08
cyclic shift
gcc -O3 -S shift.c
@tatsuru
tatsuru / count_tumblr.rb
Created August 29, 2011 00:48
count tumblr posts/day
#!/usr/bin/env ruby
require 'tumblife'
require 'yaml'
if ARGV.length < 2
puts "Usage: count_tumblr.rb blogname outfile [limit]"
exit 0
end
@tatsuru
tatsuru / split_gif.rb
Created July 20, 2011 05:42
Generate divided gif animation for Thumblr
#!/usr/bin/env ruby
require 'rubygems'
require 'RMagick'
def split(src, n)
width = src.columns
height = src.rows
crop_list = []
@tatsuru
tatsuru / dot.notify_tumblr.yaml
Created July 17, 2011 01:33
Tumblr Desktop Notification with libnotify
cache:
directory: /home/tatsuru/.tumblr-cache
max: 1000
dashboard:
limit: 10
check_interval: 30
notify_timeout: 30
text_length: 100