This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gcd() { | |
local m=$1 n=$2 tmp r | |
((m < n)) && tmp=$m m=$n n=$tmp | |
while (((r = m % n) > 0)); do | |
m=$n n=$r | |
done | |
echo $n | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use HTTP::Daemon; | |
use Getopt::Long; | |
use Linux::Inotify2; | |
use File::Slurp; | |
my $DEFAULT_PORT = 4000; | |
my $POLLING_PATH = '/polling'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ruby-1.9.2-p136/ruby.c 2010-12-23 19:49:13.000000000 +0900 | |
+++ ruby-1.9.2-p136.filter/ruby.c 2011-01-15 19:18:26.878913570 +0900 | |
@@ -1618,7 +1618,16 @@ | |
return (VALUE)rb_parser_compile_string(parser, fname, f, line_start); | |
} | |
rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-")); | |
- tree = rb_parser_compile_file(parser, fname, f, line_start); | |
+ { | |
+ VALUE source_filter = rb_intern("source_filter"); | |
+ if (rb_respond_to(rb_mKernel, source_filter)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *replace-count-base* 0) | |
(defvar *replace-count-format* "%d") | |
(defadvice query-replace-compile-replacement | |
(after replace-count-format) | |
"Change \\# format of (query-)replace-regexp" | |
(when (consp ad-return-value) | |
(let ((oldexp '(number-to-string replace-count)) | |
(newexp '(format *replace-count-format* | |
(+ replace-count *replace-count-base*) ))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
use File::Spec::Functions; | |
use Gtk2::Notify -init, 'Bijo Linux Notify'; | |
sub notify_send { | |
my ($title, $icon) = @_; | |
Gtk2::Notify->new($title, '', $icon)->show; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
preexec() { | |
_preexec_cmd=$1 | |
} | |
precmd() { | |
(bijo-linux-notify "$_preexec_cmd" &) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plugin for earthquake.gem | |
Earthquake.init do | |
command :line do | |
puts '-' * (ENV['COLUMNS'].to_i - 1) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-4.2の新機能について、bash-4.1のリリースからの変更を簡単に説明します。完全な説明は、いつものとおりマニュアルページ (doc/bash.1) で読めます。 | |
1. bashの新機能 | |
a. 実行権限があり#!で始まらないシェルスクリプトにおいて、`exec -a foo'で$0に`foo'が設定されるようになりました。 | |
b. コマンド置換やシェル関数によるサブシェルや、サブシェル中の組み込みコマンドは、新しくトラップを設定しなければ、トラップ文字列を再設定しないようになりました。これにより、$(trap)が呼び出し元のトラップを表示することと、新しいトラップが設定されるまでトラップ文字列が残ることを認めます。 | |
c. `trap -p'はシェルの起動時に無視するよう設定されて性質を変更できないシグナルを表示するようになりました。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun visual-sleep-sort (lst) | |
(save-window-excursion | |
(let (r) | |
(with-temp-buffer | |
(switch-to-buffer (current-buffer)) | |
(dolist (i lst) | |
(princ (format "%s%d\n" (make-string i ?\ ) i) (current-buffer)) ) | |
(while (> (buffer-size) 0) | |
(beginning-of-buffer) | |
(while (not (eobp)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'nokogiri' | |
SOURCE = 'http://httpd.apache.org/docs/2.2/mod/quickreference.html' | |
DEST = 'apache.dict' | |
list = [] | |
open(SOURCE) do |io| |