Skip to content

Instantly share code, notes, and snippets.

View hsbt's full-sized avatar
🏠
Working from home

Hiroshi SHIBATA hsbt

🏠
Working from home
View GitHub Profile
@somebox
somebox / convert_trac.rb
Created October 10, 2010 20:31
Convert Trac Wiki to Markdown
#!/usr/bin/env ruby
# Convert Trac DB Wiki pages to Markdown source files
# This script is based on http://github.com/seven1m/trac_wiki_to_github which
# converted all pages from a Trac DB to GitHub Wiki format (as Textile).
#
# I made two changes:
# - uses MarkDown format instead
# - uses the sqllite3-ruby gem which does not need Ruby 1.9
@ursm
ursm / kclean
Created October 22, 2010 01:33
kclean
#!/bin/bash
for path in /usr/src/linux-*; do
version=${path#*/linux-}
if qfile $path > /dev/null; then
echo "$version: skip"
else
echo "$version: removing"
cmd="rm -rf $path /lib/modules/$version /boot/*-$version /boot/*-$version.old"
@tenderlove
tenderlove / 3-0-6-release.markdown
Created April 5, 2011 23:15
Rails 3.0.6 release

[ANN] Rails 3.0.6 has been released (now with more bugfixes™)!

Hi everybody! Rails 3.0.6 has been released!

Let's get the serious business out of the way first:

Rails 3.0.6 contains an important security fix! Please upgrade!

Rails versions 3.0.x prior to 3.0.6 contain an XSS vulnerability. The vulnerability manifests itself via the auto_link method. The auto_link

@amatsuda
amatsuda / gist:942211
Last active September 25, 2015 15:18
KeyRemap4MacBookで右Shiftとか右Cmdを単発で叩いたらアンスコにするやつ
<?xml version="1.0"?>
<root>
<list>
<item>
<name>Handy Underscore</name>
<list>
<item>
<name>Command_R to Command_R</name>
<appendix>(+ When you type Command_R only, send Underscore)</appendix>
<identifier>remap.commandR2commandR_underscore</identifier>
Index: hiki/util.rb
===================================================================
--- hiki/util.rb (revision 1101)
+++ hiki/util.rb (working copy)
@@ -61,7 +61,7 @@
# # => "%27Stop%21%27+said+Fred"
def escape(string)
string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
- '%' + $1.unpack('H2' * $1.size).join('%').upcase
+ '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
@knu
knu / iTerm2-rich-text-copy.patch
Created July 5, 2011 04:37
Make iTerm2's copy also save the selected region in rich text format.
From 9fbd75b0ba43d2e37aae4ed1b48752baa1908cd3 Mon Sep 17 00:00:00 2001
From: Akinori MUSHA <[email protected]>
Date: Tue, 5 Jul 2011 11:00:32 +0900
Subject: [PATCH] Make copy() also save the selected text in rich text format.
---
Headers/iTerm/PTYTextView.h | 2 +
PTYTextView.m | 161 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 159 insertions(+), 4 deletions(-)
@ogawa
ogawa / homebrew-emacs-23.3b.diff
Created July 22, 2011 16:40
emacs.rb with emacs-inline and fullscreen patches.
diff --git a/Library/Formula/emacs.rb b/Library/Formula/emacs.rb
index 856a34a..20654fd 100644
--- a/Library/Formula/emacs.rb
+++ b/Library/Formula/emacs.rb
@@ -28,6 +28,7 @@ class Emacs < Formula
def patches
p = []
+ p0 = []
@arirusso
arirusso / img_convert.rb
Created September 30, 2011 16:44
convert html img tags to rails image_tag calls
#!/usr/bin/env ruby
require "nokogiri"
# opens every file in the given dir tree and converts any html img tags to rails image_tag calls
#
# example usage:
# ruby convert.rb ~/my_rails_app/app/views
#
# ***be careful and backup before using this***
#
@sgk
sgk / trac2down.py
Created October 14, 2011 09:35
Trac Wiki to Markdown converter
#!/usr/bin/python
# vim:set fileencoding=utf-8 sw=2 ai:
import sqlite3
import datetime
import re
SQL = '''
select
name, version, time, author, text
@akiinyo
akiinyo / FizzBuzz
Created October 27, 2011 13:14
素直にかくとこうなる。
range = 1..100
range.each do |num|
if (num%3 == 0 && num%5 == 0)
p 'FizzBuzz'
elsif (num%3 == 0)
p 'Fizz'
elsif (num%5 == 0)
p 'Buzz'
else
p num