Skip to content

Instantly share code, notes, and snippets.

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

Atsuo Fukaya fukayatsu

🏠
Working from home
View GitHub Profile
#################### helpers
def _gem(gem_info)
if gem_info.is_a? String
gem gem_info
elsif gem_info.is_a? Array
gem *gem_info
end
end
@fukayatsu
fukayatsu / gist:6963242
Created October 13, 2013 14:57
[WIP]ニュースを右から左に流すやつ
require 'user_stream'
require 'curses'
require 'thread'
require 'pry'
class Text
def initialize(x, body)
@x = x
@body = body
end

Untitled Slide 🍣

Welcome to Glide. 🍣

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

🍣

@fukayatsu
fukayatsu / merge_sort-crossing.rb
Created September 3, 2013 06:51
某クロッシング問題をmerge sortで解いてみた: ( https://codeiq.jp/ace/yuki_hiroshi/q432 )
#!/usr/env/ruby -v
require 'benchmark'
measure = Benchmark.measure {
@crossing_count = 0
def merge(a, b)
sorted = []
until (a.empty? || b.empty?)
if a.first < b.first
@fukayatsu
fukayatsu / redis-crossing.rb
Last active December 22, 2015 04:58
某クロッシング問題をredisで解いてみた: ( https://codeiq.jp/ace/yuki_hiroshi/q432 )
#!/usr/env/ruby -v
require 'benchmark'
measure = Benchmark.measure {
require 'redis'
redis = Redis.new
redis.del :ray
INPUT = 'crossing.txt'
# usage:
# $ git bisect start HEAD [past good commit]
# $ git bisect run ruby ab_bisect.rb
require 'systemu'
systemu 'bundle'
systemu 'bundle exec rails s -d'
sleep 5
passphrase: 'kagitter' # (required) passphrase to encrypt your tweet.
prefix: '@null' # (optional) add prefix to your tweet
suffix: '#kagitter' # (optional) add suffix to your tweet
<html>
<head>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
</head>
<body>
<script>
var word = "なんやかんや";
var encrypted = CryptoJS.AES.encrypt(word, "pass phrase").toString();
var decrypted = CryptoJS.AES.decrypt(encrypted, "pass phrase").toString(CryptoJS.enc.Utf8);
console.log(word == decrypted);
require 'zipruby'
require 'fileutils'
ROOT_DIR = File.expand_path(File.dirname(__FILE__))
Dir::glob("#{ROOT_DIR}/*.zip") do |zip_file|
folder_name = nil
Zip::Archive.open(zip_file) do |archive|
puts "extract: #{zip_file}"
(define (cube n) (* n n n))
(define t 0.1)
(define (x k)
(define (pre l) (x (- l 1)))
(if (= k 0)
2
(- (pre k)
(* t (-
(* 4 (cube (pre k)))
(* 8 (pre k)))))))