Skip to content

Instantly share code, notes, and snippets.

@hitode909
hitode909 / a.pl
Created June 18, 2014 03:26
smartmatch最悪
use experimental 'smartmatch';
use Test::More tests => 5;
sub in_tripartite_pact {
my ($country) = @_;
return $country ~~ ['Japan', 'Germany', 'Italy'];
}
ok in_tripartite_pact('Japan'), 'Japan signed the pact.';
@hitode909
hitode909 / encode.pl
Created June 11, 2014 09:52
encode_utf8しまくるやつ
use strict;
use warnings;
use Encode qw(encode_utf8);
use Time::HiRes qw/usleep/;
my ($value) = @ARGV;
while(1) {
print "$value\n";
usleep 100000;
@hitode909
hitode909 / chou.txt
Last active August 29, 2015 14:01
長で終わる単語のリスト Wikipediaの見出し語リストから生成
FRB議長
JUNK2 陣内智則のひとり番長
KuRaRe編集長
NATO事務総長
NHK会長
QT延長
SS上級曹長
SS伍長
SS曹長
SS特務曹長
@hitode909
hitode909 / hamuo
Created May 14, 2014 10:27
はむお
#!/usr/bin/env ruby
puts "🐹 < #{ ARGV.empty? ? ARGF.read : ARGV.join(' ') }"
@hitode909
hitode909 / mosikasite.pl
Created May 13, 2014 10:11
メソッドが呼ばれたときに同名のフィールドがあったらもしかしてって言いながら死ぬやつ
package Mosikasite {
sub new {
my ($class) = @_;
bless {}, $class;
}
sub AUTOLOAD {
my ($self) = @_;
my $method = (split '::', $AUTOLOAD)[-1];
@hitode909
hitode909 / commit-dates-for-word-of-repository.rb
Created January 4, 2014 09:31
リポジトリ内で指定した単語が書かれた時期を調べる
require 'shellwords'
class AnnotateLine
attr_reader :content, :meta
def initialize
@meta = {}
@content = nil
end
def add_line line
@hitode909
hitode909 / wifi_to_internet.rb
Created November 25, 2013 00:13
接続中のWiFiのSSIDからインターネットにチェックインするやつ
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
# 接続中のWiFiのSSIDからインターネットにチェックインするやつ
ssid = `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I`.split(/\n/).find{|line| line =~ /\bSSID/ }.scan(/SSID: (.+)$/).flatten.first
system "open 'http://t.heinter.net/#{ ssid }'"
@hitode909
hitode909 / ssid.rb
Created November 24, 2013 23:57
接続中のWiFiのSSIDを表示するやつ
#! /usr/bin/env ruby
puts `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I`.split(/\n/).find{|line| line =~ /\bSSID/ }.scan(/SSID: (.+)$/).flatten.first
package main
import "fmt"
func Cbrt(x complex128) func() complex128 {
z := complex128(1)
return func() complex128 {
z=z-(z*z*z-x)/(3*z*z)
return z
}
@hitode909
hitode909 / 43.go
Created November 20, 2013 11:41
package main
import "fmt"
func mynumber() map[string]func(int) int {
sum := 0
result := make(map[string]func(int)int)
result["add"] = func(x int) int {
sum += x
return sum