Skip to content

Instantly share code, notes, and snippets.

View tobynet's full-sized avatar

tobynet tobynet

  • Toyama, Japan
View GitHub Profile
#! /usr/bin/ruby
# -*- coding: utf-8 -*-
# マルコフ連鎖をしてみるやつ
$KCODE = 'UTF8'
# Array::choiseを追加
class Array
def choise
self[rand(self.size)]
@fuba
fuba / exthtml.pl
Created December 26, 2008 09:14
exthtml.pl extracts contents specified by an xpath from web pages. Cookbook in Japanese: http://fuba.jottit.com/exthtml
#!/usr/bin/perl
use strict;
use warnings;
use Encode;
use Getopt::Long;
use URI;
use LWP::UserAgent;
use HTTP::Cookies::Guess;
sub capture_thumbnails {
my %opt = @_;
my $file = $opt{file} or die;
my $offset = $opt{offset} || 0;
my @stats = stat($file);
my $deflength = 60 * ($stats[7]/120000000);
my $un_reset = $opt{un_reset};
@ktakayama
ktakayama / DenyRakutenNews.user.js
Last active April 7, 2024 04:58
楽天のメルマガチェックを自動解除するGreaseonkeyスクリプト
// ==UserScript==
// @name Deny Rakuten News
// @namespace http://espion.just-size.jp/archives/05/136155838.html
// @description Deny Rakuten News
// @include https://*.step.rakuten.co.jp/*
// @include https://*.travel.rakuten.co.jp/rsv/RsvInput.do*
// @include https://my.rental.rakuten.co.jp/action/my/*
// @include https://delivery.rakuten.co.jp/*?module=Default&action=OrderStep*
// @include https://auction.item.rms.rakuten.co.jp/*
// @include https://my.checkout.rakuten.co.jp/myc/purchase/Confirm
@toreriklinnerud
toreriklinnerud / autospork.rb
Created October 14, 2009 22:08
Start spork before autospec if not already running
#!/usr/bin/env ruby
`ps | grep /spork$ | grep -v grep`
if $?.success?
exec('autospec')
else
IO.popen('(spork&) 2>&1') do |messages|
puts(message = messages.gets) until message =~ /ready/
exec('autospec')
@eban
eban / ruby-1.8.7-p248-cygwin-1.7.1.patch
Created December 25, 2009 10:44
ruby-1.8.7-p248 cygwin 1.7.1 quick hack
--- eval.c.orig 2009-12-21 17:11:42.000000000 +0900
+++ eval.c 2009-12-24 19:18:21.671875000 +0900
@@ -210,3 +210,3 @@
# ifdef __CYGWIN__
-int _setjmp(), _longjmp();
+int _setjmp(); void _longjmp();
# endif
--- gc.c.orig 2009-12-24 17:28:08.000000000 +0900
+++ gc.c 2009-12-24 19:18:17.875000000 +0900
@@ -42,3 +42,3 @@
@tily
tily / input.txt
Created January 7, 2010 14:14
make text stammer
文字を読みながら、そこに表現されてある音響が、いつまでも耳にこびりついて、離れないことがあるだらう。オセロオであつたか、ほかの芝居であつたか、しらべてみれば、すぐ判るが、いまは、もの憂く、とにかくシエクスピア劇のひとつであることは間違ひない、とだけ言つて置いて、その芝居の人殺しのシイン、寝室でひそかに女をしめ殺して、ヒロオも、われも、瞬時、ほつと重くるしい溜息。額の油汗拭はむと、ぴくとわが硬直の指うごかした折、とん、とん、部屋の外から誰やら、ドアをノツクする。ヒロオは、恐怖のあまり飛びあがつた。ノツクは、無心に、つづけられる。とん、とん、とん、とん、ヒロオは、その場で気が狂つたか、どうか、私はその後の筋書を忘れてしまつた。
@koki-h
koki-h / pony_sample.rb
Created March 30, 2010 13:26
pony_sample. A good wrapper of Net/SNMP + TMail
#ponyを使ってgmail経由でメールを送信
#pony : http://github.com/benprew/pony
#メールクライアントの設定-GMailヘルプ : http://mail.google.com/support/bin/answer.py?hl=jp&answer=13287
require 'rubygems'
require 'pony'
Pony.mail(:to => 'XXX@XXXX.com',
:body => "あああああああああああ", #bodyもsubjectも日本語OK(windows/cygwin)
:subject => "テストとととととt",
:charset => "utf8", #つけないと警告が出る
@tily
tily / example.txt
Created April 10, 2010 16:27
convert text to japanese cafe name
マイクロソフト
COFFEE「舞黒想風人」
インターネット
歌声喫茶「伊多音都」
さむい
談話室「再夢伊」
はらへった
@njvitto
njvitto / deploy.rake
Created April 11, 2010 16:56 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]