Skip to content

Instantly share code, notes, and snippets.

Taiki Ono taiki45

Block or report user

Report or block taiki45

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@taiki45
taiki45 / envoy-hot-restart-version-format.md
Last active Dec 20, 2018
Current (around v1.8.0) format of Envoy's hot restart version output
View envoy-hot-restart-version-format.md
10.200.16384.127.options=capacity=16384, num_slots=8209 hash=228984379728933363 size=2654312
${version}.${size_of_shared_memory}.${max_num_stats}.${max_name_length}.options=${options} hash=${hash_signature}, size=${hash_table_size?}
  • version: SharedMemory::VERSION which Envoy developers bump when breaking changes of shared memory/RPC were happened.
  • size_of_shared_memory: sizeof(SharedMemory)
View install-opencv-with-python.md

大抵のパッケージマネージャーでは opencv を with-python みたいな感じでインストールすると python 用の .so ファイルを吐くように opencv をビルドしてくれる。 我々がやる必要があるのはこの .so を普段使いの python の site-packages/ 以下に配置するすることだ。

homebrew の場合 (python 3.6):

brew install python3
brew install homebrew/science/opencv3 --with-python3 --with-ffmpeg --without-python
# .so ファイルはここにできる
ls `brew --prefix opencv3`/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so
View .diff
diff --git a/lib/airbrake/rails/active_job.rb b/lib/airbrake/rails/active_job.rb
index d732093..330ebbc 100644
--- a/lib/airbrake/rails/active_job.rb
+++ b/lib/airbrake/rails/active_job.rb
@@ -16,7 +16,7 @@ module Airbrake
notice[:context][:component] = 'active_job'
notice[:context][:action] = self.class.name
- notice[:params] = serialize
+ notice[:params] = as_json
View Gemfile
# A sample Gemfile
source 'https://rubygems.org'
gem 'zipkin-tracer', path: '~/.ghq/github.com/twitter/zipkin/zipkin-gems/zipkin-tracer'
gem 'sinatra'
gem 'thin'
gem 'faraday'
gem 'pry'
gem 'faraday-zipkin', github: 'taiki45/faraday-zipkin', branch: 'zipkin-tracer-compatible'
View runList.hs
import Data.Char
ex0 :: GenericIO ()
ex0 = do
mapM_ putCh "Hello, Haskeller! Please input a character:"
ch <- getCh
mapM_ putCh "The ordinal of the character is:"
mapM_ putCh (show (ord ch))
mapM_ putCh ".\n Thank you!\n"
data Free f a = Pure a
@taiki45
taiki45 / ParserCombinator.hs
Last active Aug 29, 2015
http://d.hatena.ne.jp/tanakh/20040731 を読んでパーサを Applicative instance にしてみたでし
View ParserCombinator.hs
module ParserCombinator
( Parser
, parse
, satisfy
, char
, digit
, natural
, token
, oneOf
, listOf
View root.hs
import Control.Monad
-- 0 means 'go right', 1 means 'go up'
-- so, [0, 0, 1, 1, 1] means go right right up up up.
expects :: [[Int]]
expects = do ns <- sequence $ replicate 5 [0..1]
guard $ sum ns == 3
guard $ checkInRight ns
return ns
@taiki45
taiki45 / list.hs
Created Feb 25, 2014
非決定計算で便利なリストモナドの性質
View list.hs
expects = do n1 <- [0..1]
n2 <- [0..1]
n3 <- [0..1]
n4 <- [0..1]
n5 <- [0..1]
return [n1, n2, n3, n4, n5]
expects' = sequence $ replicate 5 [0..1]
-- expects == expects' = True
@taiki45
taiki45 / nondeterministic_computation.hs
Created Feb 1, 2014
リストモナドで非決定計算はすはす
View nondeterministic_computation.hs
-- ・3辺の長さはすべて整数
-- ・周囲の長さは24に等しい
-- ・各辺の長さは10以下である
-- を満たす直角三角形を探す
import Control.Monad
import Data.Char
a = do x <- [1..10]
y <- [1..10]
z <- [1..10]
@taiki45
taiki45 / myList.hs
Created Jan 9, 2014
Haskell のリストを実装してみたでし…! モナドにもしてみたでし…!
View myList.hs
{-# LANGUAGE InstanceSigs #-}
import Data.Monoid
import Control.Monad
-- :<>: means Empty
infixr 5 :+:
data Lt a = (:<>:) | a :+: Lt a
instance Show a => Show (Lt a) where
show (:<>:) = "[]"
show a = "[" ++ foldShow a ++ "]"
You can’t perform that action at this time.