Skip to content

Instantly share code, notes, and snippets.

View kuboon's full-sized avatar
🏠
Working from home

Ohkubo KOHEI kuboon

🏠
Working from home
View GitHub Profile
@kuboon
kuboon / dispatch.rb.cgi
Last active October 31, 2016 09:41
run Rails app as DRb server and access it from CGI process
#!ruby
require 'drb/drb'
require 'logger'
require "rack"
require 'rack/rewindable_input'
module Dispatch
RAILS_ENV = 'staging'
DRUBY_URI = "druby://localhost:13141"
LOCKFILE = "../tmp/pids/dispatch.pid"
@kuboon
kuboon / application_helper.rb
Created July 26, 2012 08:15
glyph icon helper for twitter-bootstrap with Rails
module ApplicationHelper
# ==== Examples
# glyph(:share_alt)
# # => <i class="icon-share-alt"></i>
# glyph(:lock, :white)
# # => <i class="icon-lock icon-white"></i>
def glyph(*names)
content_tag :i, nil, class: names.map{|name| "icon-#{name.to_s.gsub('_','-')}" }
end

Keybase proof

I hereby claim:

  • I am kuboon on github.
  • I am kuboon (https://keybase.io/kuboon) on keybase.
  • I have a public key ASCbNuTLzZAuy_vOaGq6vLnF2LjZ4xGSUjC-so2U8gV3swo

To claim this, I am signing this object:

Huge *n1 = huge_from_long(12);
Huge *n2 = huge_from_long(3);
Huge *result;
result = huge_add(n1, n2);
printf("%d", huge_as_long(result)); // 15
huge_free(result);
result = huge_sub(n1, n2);
require 'prime'
# backport ruby 2.4
class Array
def sum(identity = 0, &block)
if block_given?
map(&block).sum(identity)
else
inject { |sum, element| sum + element } || identity
end
Set-ExecutionPolicy AllSigned
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y googlechrome firefox
choco install -y dropbox itunes
choco install -y cryptomator
choco install -y atom sublimetext3 velocity typora
choco install -y sysinternals procexp treesizefree
choco install -y chocolateygui
choco install -y resilio-sync-home slack
require "set"
N=32
srand ARGV[0]&.to_i
class P < Array
def self.rand
new(N.times.to_a.shuffle)
end
def *(o)
N=32
BYTE = false
x0=[0]*N
x1=[0]*N
x2=[0]*N
a=[0]*N
N=32
BYTE = false
x0=[0]*N
x1=[0]*N
x2=[0]*N
a=[0]*N
import random
import struct
N=32
def rp(a) :
a=list(range(0,32))
x=0
for i in range(0,N-2) :