Skip to content

Instantly share code, notes, and snippets.

View ywindish's full-sized avatar
🐈

Yamako ywindish

🐈
View GitHub Profile
@ywindish
ywindish / getwikis.php
Created July 9, 2015 05:01
Backlog Wiki をバックアップする
<?php
/**
* Backlog Wikiをローカルにバックアップします
* 要PHP5.3以降
* usage: php getwikis.php
* ref: https://github.com/atomita/backlog-v2
* todo: ファイル周りのエラー処理がないので誰か直してください..
*/
require "vendor/autoload.php";
use \atomita\Backlog;
@ywindish
ywindish / const.pl
Last active June 16, 2016 02:17
正規表現にuse constantした定数を埋め込む ref: http://qiita.com/ywindish/items/6fc5bb951ad587820728
use constant TEST_HOGE => "hogehoge";
if ('hogehoge fugafuga'=~ /${\(TEST_HOGE)}/) {
print "matched!";
}
@ywindish
ywindish / file0.txt
Created July 1, 2015 08:24
MySQLのSELECT結果をCSVで保存する ref: http://qiita.com/ywindish/items/af1d95654ab6cd44c10d
mysql -uuser_name db_name -p -B < sample.sql | sed -e 's/\t/,/g' > sample.csv
@ywindish
ywindish / gist:4eae6401721b0faff338
Last active August 29, 2015 14:07
ブロードキャストアドレスを得る
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();
@ywindish
ywindish / gist:72b7f8844c6402ea206f
Created September 29, 2014 05:39
PHPのトレイト
<?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(); }
@ywindish
ywindish / dajarebot.scala
Created September 22, 2014 07:53
DajarebotのScala版
/*
Scala勉強中
同じディレクトリに以下を置きます
twitter4j-core-x.x.x.jar
twitter4j.properties
dajare.txt
以下で実行します
$ scala -cp .;twitter4j-core-x.x.x.jar dajarebot.scala
@ywindish
ywindish / gist:4950838
Last active April 28, 2016 14:25
perl one-liner: Markdown text to HTML
# one-liner
# Markdown document to HTML from Text::Markdown
#
# perl -MText::Markdown=markdown -e "$txt='';while(<>){$txt.=$_};print markdown($txt);" < test.txt
#
@ywindish
ywindish / gist:3736082
Created September 17, 2012 07:52
Nintendo Code Puzzle: 1
# Solv: http://cp1.nintendo.co.jp/
x = 1
while true
if (x ** 17) % 3569 == 915
break
end
x = x + 1
end
puts x #=> 2012
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>
@ywindish
ywindish / gist:3167392
Created July 24, 2012 01:37
標準入力から与えられたIPアドレスのリストを逆引きして出力する
# 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) {