Skip to content

Instantly share code, notes, and snippets.

View bokuo-okubo's full-sized avatar
🏠
Working from home

Yohei Okubo bokuo-okubo

🏠
Working from home
  • eva
  • Tokyo / Shizuoka
View GitHub Profile
def wepkey2ascii(key)
key.to_s.scan(/../).map { |s| s.hex.chr }.join
end
#=> "01fc91ab8b648"
@bokuo-okubo
bokuo-okubo / 0_reuse_code.js
Created March 22, 2016 01:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#! /bin/sh
exec ruby -S -x "$0" "$@"
#! ruby
def main
if $*.length == 0
ymd = [Time.now.year, Time.now.month].map &:to_i
mon = MonthView.new ymd[0], ymd[1]
print sprintf("%-6d",Time.now.year)
puts mon.view
# coding: utf-8
def func(n, m, N):
def state(cnt, acc):
if N == cnt:
return acc
else:
return state(cnt + 1, (1 - 1/n - 1/m) * acc + 1/m)
return state(0, 1)
@bokuo-okubo
bokuo-okubo / initialize.sh
Last active December 13, 2016 08:51
create rails env
#!/bin/bash
sudo apt-get update -y
# Install the rbenv and Ruby dependencies with apt-get:
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs
class InvalidSemanticVersionError < StandardError; end
class SemanticVersion
def initialize(sem_str)
raise InvalidSemanticVersionError unless _valid_schema? sem_str
@version_ary = sem_str.split('.').freeze
end
def version_ary
require 'date'
require 'pathname'
ARTICLE_PATH = 'source/contents/articles/'
STUB_START_DATE = '2018-01-01'
namespace :stub do
@article_path = Pathname.pwd + Pathname.new(ARTICLE_PATH)
@bokuo-okubo
bokuo-okubo / README.md
Last active October 23, 2017 13:26
HammerSpoonConfig

my hammerspoon confing

subscribe non default features

/github subscribe {user}/{repo} reviews comments branches commits:all