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
<?php | |
/** | |
* Backlog Wikiをローカルにバックアップします | |
* 要PHP5.3以降 | |
* usage: php getwikis.php | |
* ref: https://github.com/atomita/backlog-v2 | |
* todo: ファイル周りのエラー処理がないので誰か直してください.. | |
*/ | |
require "vendor/autoload.php"; | |
use \atomita\Backlog; |
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
use constant TEST_HOGE => "hogehoge"; | |
if ('hogehoge fugafuga'=~ /${\(TEST_HOGE)}/) { | |
print "matched!"; | |
} |
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
mysql -uuser_name db_name -p -B < sample.sql | sed -e 's/\t/,/g' > sample.csv |
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
import java.net.InetAddress; | |
import java.net.InterfaceAddress; | |
import java.net.NetworkInterface; | |
import java.net.SocketException; | |
import java.util.Enumeration; | |
public class BroadcastAddressTest { | |
public static void main(String[] args) throws SocketException { | |
BroadcastAddressTest client = new BroadcastAddressTest(); |
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
<?php | |
// http://php.net/manual/ja/language.oop5.traits.php | |
trait Kanikama { | |
function eat_kani() { print "eat kanikama"; } | |
} | |
class Salad { | |
use Kanikama; | |
public function eat() { $this->eat_kani(); } |
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
/* | |
Scala勉強中 | |
同じディレクトリに以下を置きます | |
twitter4j-core-x.x.x.jar | |
twitter4j.properties | |
dajare.txt | |
以下で実行します | |
$ scala -cp .;twitter4j-core-x.x.x.jar dajarebot.scala |
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
# one-liner | |
# Markdown document to HTML from Text::Markdown | |
# | |
# perl -MText::Markdown=markdown -e "$txt='';while(<>){$txt.=$_};print markdown($txt);" < test.txt | |
# |
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
# Solv: http://cp1.nintendo.co.jp/ | |
x = 1 | |
while true | |
if (x ** 17) % 3569 == 915 | |
break | |
end | |
x = x + 1 | |
end | |
puts x #=> 2012 |
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
package jp.windish.utils; | |
/** | |
* Dice rolling class. | |
* <pre> | |
* Dice d1 = new Dice(); // 2d6 (default) | |
* Dice d3 = new Dice(100); // d100 | |
* Dice d2 = new Dice(2, 8); // 2d8 | |
* System.out.println(d1.roll()); //=> 1 to 6 at random | |
* </pre> |
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
# DNS PTR record lookup | |
# 標準入力から与えられたIPアドレスのリストを逆引きして出力する | |
use strict; | |
use Net::DNS; | |
my $resolver = Net::DNS::Resolver->new(); | |
while (<>) { | |
chomp; | |
my $ipaddress = $_; | |
my $query = $resolver->search($ipaddress, 'PTR'); | |
unless ($query) { |