Skip to content

Instantly share code, notes, and snippets.

View niku's full-sized avatar
💭
🍖

KITAMURA Daisuke niku

💭
🍖
View GitHub Profile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hideo"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network "forwarded_port", guest: 8080, host: 18080
config.vm.provision "shell", inline: <<__EOS__
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
@niku
niku / convert-cp932-invalid-to-utf8.txt
Last active April 15, 2019 00:28
Unicode から cp932 に変換できない文字を知る 注意: gist には CP932 の文字コードではファイルを置けなかったので ここにある convert-cp932-valid-to-cp932.txt の文字コードは誤っている(UTF-8になっている)
¢
£
¬
require 'json'
obj = {
foo: 'bar',
hoge: [
'fuga',
{
one: 1,
two: 2
}
since: 07-30
favorite_count top 10
35 , 10-04 20:53 , 【札幌】北海道教育大・MF上原、来季加入へ http://t.co/2fhQcutl5E , https://twitter.com/consadole/status/386096635412885505
30 , 10-04 06:23 , 【札幌】前寛之、トップ昇格!クラブ初の兄弟選手誕生 http://t.co/ROr9qa89bS , https://twitter.com/consadole/status/385877695218720769
23 , 11-27 14:08 , 愛媛FC 石井 謙伍 選手 加入決定のお知らせ http://t.co/srSIiWH6Pp , https://twitter.com/consadole/status/405563675055902720
16 , 10-07 18:38 , 上原 拓郎 選手(北海道教育大学岩見沢校/コンサドーレ札幌ユース・U-18出身) 2014年シーズン 新加入内定のお知らせ http://t.co/a2m8MioHkZ , https://twitter.com/consadole/status/387149831061262336
14 , 10-05 06:23 , 【札幌】岩見沢教育大・MF上原獲得「育った札幌で」 http://t.co/jb5JLD1aaO , https://twitter.com/consadole/status/386240084896268288
13 , 08-13 11:23 , 札幌上里、J1完全移籍の打診断り残留へ http://t.co/aUN6DTUiuF , https://twitter.com/consadole/status/367109014775021568
13 , 11-24 19:53 , コンサドーレファミリーの皆様へ http://t.co/MoXkwsmjpo , https://twitter.com/consadole/status/404563324886454272
11 , 09-25 18:53 , 上里一将 選手からサポーターの皆様へ http://t.co/zd1K5zT3G5 , https://twitter.com/co
@niku
niku / chatwork-api.json
Last active December 29, 2015 16:49
machine readable chatwork-api generator
{
"endpoints": [
{
"name": "/me",
"description": "自分自身の情報にアクセスできます。",
"apis": [
{
"verb": "GET",
"path": "/me",
"implemented": true,
@niku
niku / chain.exs
Last active December 27, 2015 09:09
# from
# http://pragprog.com/book/elixir/programming-elixir
# 14 Process Overhead
defmodule Chain do
def counter(next_pid) do
# Chain.counter は,何か数値が送られてきたらその数値に1を加えて次のプロセスを呼びだす
# 数値がsendで送られてくるまでは単に待ちつづける
receive do # 3つのプロセスとも,プロセスにむけて数値がsendで送られてくるまでここで止まる
@niku
niku / flickr_exif.rb
Last active December 18, 2015 01:49 — forked from miio/flickr_exif.rb
require 'flickraw'
require 'exifr'
class ConnectionAdapter
def connection
FlickRaw.api_key = ""
FlickRaw.shared_secret = ""
flickr.access_token = ""
flickr.access_secret = ""
flickr
echo 'install_package "ruby-2.0.0-p0" "http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz#50d307c4dc9297ae59952527be4e755d"' > /usr/local/Cellar/ruby-build/HEAD/share/ruby-build/ruby-2.0.0-p0
CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv install 2.0.0-p0
#!/usr/bin/env ruby
require 'rufus/scheduler'
require 'eventmachine'
require 'pebbles-productivity10x-switch_hosts'
switch_hosts = Pebbles::Productivity10x::SwitchHosts.new
if((Time.parse('09:00')..Time.parse('12:00')).cover?(Time.now)) ||
(Time.parse('13:00')..Time.parse('18:00')).cover?(Time.now)
switch_hosts.deny
@niku
niku / fizzBuzz.hs
Created June 27, 2012 16:37
はじめてのHaskellプログラム - FizzBuzz
fizzBuzz :: Int -> String
fizzBuzz n
| isFizzBuzz n = "FizzBuzz"
| isFizz n = "Fizz"
| isBuzz n = "Buzz"
| otherwise = show n
where isFizz n = (n `mod` 3 == 0)
isBuzz n = (n `mod` 5 == 0)
isFizzBuzz n = isFizz n && isBuzz n