Skip to content

Instantly share code, notes, and snippets.

View vkgtaro's full-sized avatar
😃

Taro Komatsu vkgtaro

😃
View GitHub Profile
@vkgtaro
vkgtaro / .zshrc
Last active August 29, 2015 14:08
#-----------------------------------------------
# screen の下のラインに打ったコマンドを表示
#-----------------------------------------------
if [ "$TERM" = "screen" ]; then
chpwd () { echo -n "^[_`dirs`^[\\" }
preexec() {
# see [zsh-workers:13180]
# http://www.zsh.org/mla/workers/2000/msg03993.html
emulate -L zsh
local -a cmd; cmd=(${(z)2})
@vkgtaro
vkgtaro / curried.go
Last active August 29, 2015 14:08
curried
package main
import "fmt"
func div (x float32) func(float32) float32 {
return func(y float32) float32 { return x / y }
}
func main () {
use strict;
use warnings;
my $array_ref = [1, 2];
my $array_ref_string = scalar $array_ref;
$array_ref_string =~ s{\A ARRAY\( (\w+) \) \z}{$1}xms;
warn $array_ref_string;
warn join(',', $array_ref);
@vkgtaro
vkgtaro / file0.py
Created February 1, 2014 13:39
python で redmine の更新を hipchat へ流す ref: http://qiita.com/vkgtaro/items/dc776a6b907cafed57ff
# -*- coding: utf-8 -*-
from datetime import datetime
from fcache.cache import FileCache
import feedparser
from hypchat import HypChat
import hashlib
import os
import pytz
import time
class Email(models.Model):
email = models.EmailField(max_length=75, help_text="メールアドレス")
is_primary = models.BooleanField(help_text="メインかどうか")
created_at = models.DateTimeField(auto_now_add=True, help_text="作成日")
updated_at = models.DateTimeField(auto_now=True, help_text="編集日")
def __unicode__(self):
primary = u" (メイン)" if self.is_primary else ""
return "%s%s" % (self.email, primary)
var matoryosika = function () {
if ( jQuery('#hoge_search_result_196').length ) {
jQuery('.hoge_search_result_content').each(function () {
jQuery(this).html((jQuery(this).html().replace(/  - /g,'')));
})
}
}
setInterval("matoryosika()", 300);
# -*- coding: utf-8 -*-
require 'rubygems'
require 'net/dns'
# :nameservers に指定したのは、AWS Route53 で example.com のゾーン作った時に
# 自動で割り当てられたネームサーバ
resolver = Net::DNS::Resolver.new(:nameservers => "205.251.192.100")
# もちろん、example.com は僕の所有ドメインじゃないので、
# 今回テストするにあたって適当に登録した
@vkgtaro
vkgtaro / ssh.rb
Last active December 12, 2015 09:29
/Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:68:in `block in load': invalid byte sequence in US-ASCII (ArgumentError)
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:67:in `foreach'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:67:in `load'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:50:in `block in for'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:50:in `each'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:50:in `inject'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh/config.rb:50:in `for'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh.rb:221:in `configuration_for'
from /Users/vkgtaro/.rvm/gems/ruby-1.9.3-p374/gems/net-ssh-2.6.5/lib/net/ssh.rb:166:in `start'
from ssh.rb:5:in `<main>'
{
"run_list": [
"recipe[pylon]"
],
"pylon": {
"unit": "observer"
}
}
{
"run_list": [
"recipe[pylon]"
],
"override_attributes": {
"pylon": {
"unit": "observer"
},
}
}