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
<?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
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
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
perl -e 'while(<index.html*>) { ($new = $_) =~ s/index\.html\?(.*)$/$1/; rename $_, $new }' |
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
# http://codepad.org/Ee48yTys | |
use Benchmark; | |
$t0 = new Benchmark; | |
for (1..1000000) {} | |
$t1 = new Benchmark; | |
$td = timediff($t1, $t0); | |
print "the code took:",timestr($td),"\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
# http://codepad.org/utbefxEC | |
use List::Util qw(shuffle); | |
print join ',', shuffle(1..40); | |
#-> 31,4,39,27,40,5,2,14,9,29,8,37,20,17,30,24,15,33,36,10,18,32,28,11,6,21,12,25,35,34,19,7,26,1,38,23,3,13,22,16 |
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
# | |
# 配列の要素数、配列の添え字最大値を求めるには | |
# http://codepad.org/SrwvXijK | |
# | |
use strict; | |
my @hoge = (1,2,3); | |
my $fuga = [1,2,3]; | |
print scalar @hoge, $#hoge; | |
print scalar @{$fuga}, $#$fuga; |
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) { |
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> |
OlderNewer