Skip to content

Instantly share code, notes, and snippets.

View masuidrive's full-sized avatar

Yuichiro MASUI masuidrive

View GitHub Profile
/*
http://la.ma.la/blog/diary_200601201204.htm
*/
if(location.search=="?autoreload") {
var __autoreload_last_contents = new Array();
setInterval(function(){
var check = function(path) {
var onload = function() {
(__autoreload_last_contents[path] && req.responseText != __autoreload_last_contents[path]) && location.reload(true);
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
module Log2IRC
include EventMachine::Protocols::LineText2
attr_reader :channels
class Message
attr_reader :line, :pattern, :match
# Rails on GitHub
export APP=hogehoge
mkdir $APP
cd $APP
git init
rails $APP
git add log tmp
touch tmp/.gitignore log/.gitignore
echo "log/*.log" > .gitignore
require 'kconv'
require 'iconv'
require 'nkf'
require 'test/unit'
class GuessEncoding < Test::Unit::TestCase
def setup
@euc = "うまく表示してね!".kconv(Kconv::EUC, Kconv::SJIS)
end
require 'kconv'
require 'iconv'
require 'nkf'
require 'test/unit'
class GuessEncoding < Test::Unit::TestCase
def setup
# EUC-JP encoded うまく表示してね!
@euc = "¥345¥341¥254¥345¥242¥300¥345¥341¥276¥352¥241¥243¥245¥243¥356¥246¥245¥263¥345¥341¥316¥345¥242¥250¥345¥341¥245¥345¥376¥276"
end
#!/bin/sh
# /etc/pm/sleep.d/00zbright
COMMAND=/usr/local/bin/zbright
SAVED_FILE=/tmp/zbright.tmp
case "${1}" in
suspend|hibernate)
$COMMAND | /usr/bin/gawk '{print $2}' > $SAVED_FILE
;;
#!/usr/bin/env bash
#
# syntax:
# 'sudo zbright +N' increments screen brightness by N percent (N=0-100)
# 'sudo zbright -N' decrements screen brightness by N percent
# 'sudo zbright N' sets screen brightness to N percent
# 'sudo zbright' w/o any args reports current brightness
#
# note: must be run as sudo
#
--
-- expire record and memcached record
--
require('Memcached') -- http://luamemcached.luaforge.net/
-- http://mixi.jp/view_bbs.pl?id=33263045&comm_id=3528783 #20
connect_memcache()
function expire()
local args = {}
require 'rbconfig'
ruby_path = File.join(Config::CONFIG["bindir"],
Config::CONFIG["RUBY_INSTALL_NAME"]+
Config::CONFIG["EXEEXT"])
/*
* Take screen capture on AS2
*/
ExternalInterface.addCallback("take_snap", null,
function():Void {
var width:Number = Stage.width;
var height:Number = Stage.height;
var snap:BitmapData = new BitmapData(width, height);