Skip to content

Instantly share code, notes, and snippets.

View znz's full-sized avatar

Kazuhiro NISHIYAMA znz

View GitHub Profile
@znz
znz / Dockerfile
Last active April 1, 2019 09:56
ruby 2.1.2 with libressl
FROM ubuntu:14.04
ADD sources.list /etc/apt/sources.list
RUN apt-get update
RUN apt-get -y install wget autoconf bison build-essential libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev
RUN cd /usr/local/src && wget -N http://ftp.jaist.ac.jp/pub/OpenBSD/LibreSSL/libressl-2.0.3.tar.gz && tar xvf libressl-2.0.3.tar.gz
RUN cd /usr/local/src/libressl-2.0.3 && ./configure && make check && make install
RUN /sbin/ldconfig
RUN cd /usr/local/src && wget -N http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz && tar xvf ruby-2.1.2.tar.gz
RUN cd /usr/local/src/ruby-2.1.2 && ./configure --disable-install-doc && make install
# -*- coding: utf-8 -*-
# env_ltsv_each.rb
# https://gist.github.com/znz/849166c048a2117c341d
# copyright (c) 2014 Kazuhiro NISHIYAMA
# This software is released under the MIT License.
# http://opensource.org/licenses/MIT
require 'ostruct'
def env_ltsv_each(prefix, start: 0, encoding: Encoding::UTF_8, scrub: false)
block_given? or return enum_for(__method__)
@znz
znz / rspec-boolean.txt
Created June 13, 2014 04:27
rspec で be(false) と eq(false) の違い
% cat spec/falsey_spec.rb
describe do
it do
expect(true).to be(false)
end
it do
expect(true).to eq(false)
end
end
% bundle exec rspec -v
@znz
znz / Gemfile
Last active August 29, 2015 13:57
Ruby/Rails勉強会@関西 60th #rubykansai のプレゼン用に作成した正規表現(ごく一部)の動作をステップ表示するアプリ
source "https://rubygems.org"
ruby "2.1.1"
gem "sinatra"
@znz
znz / result.txt
Created January 21, 2014 00:45
ssl.peer_cert after ssl.close
% rbenv each -v ruby /tmp/s.rb
===[1.8.7-debian]=======================================================
OpenSSL::X509::Certificate
OpenSSL::X509::Certificate
===[1.8.7-p357]=========================================================
/tmp/s.rb:4:in `require': no such file to load -- openssl (LoadError)
from /tmp/s.rb:4
===[1.8.7-p358]=========================================================
@znz
znz / README.md
Last active January 3, 2016 05:59
RD から Markdown への変換 (作りかけ)

RD から Markdown への変換 (作りかけ)

  • https://github.com/uwabami/rdtool を git clone して
  • lib/rd/rd2markdown-lib.rb に置いて
  • RUBYOPT=-Ilib rd2 -r rd/rd2html-lib doc/rd-draft.rd.ja で動作確認

ライセンス

  • RDtool に取り込んでもらえるよう RDtool と同じものにする
@znz
znz / Gemfile
Created January 12, 2014 14:59
cross origin example (see http://qa.atmarkit.co.jp/q/3432 )
source "https://rubygems.org"
gem "rack"
@znz
znz / HelloOSX-report.txt
Created December 28, 2013 10:24
RubyMotion 2.17 のアプリが MacBookPro6,2 で起動しない
Process: HelloOSX [17807]
Path: /tmp/*/HelloOSX.app/Contents/MacOS/HelloOSX
Identifier: com.yourcompany.HelloOSX
Version: 1.0 (1.0)
Code Type: X86-64 (Native)
Parent Process: launchd [263]
Responsible: HelloOSX [17807]
User ID: 501
Date/Time: 2013-12-27 14:11:51.360 +0900
@znz
znz / emacs-inline.patch.diff
Last active January 1, 2016 12:09
http://blog.n-z.jp/blog/2013-11-13-killall-distnoted-periodically.html のコメントのパッチを試す (`brew edit emacs` で以下の emacs.rb.diff のように変更して `brew reinstall emacs`)
diff --git a/emacs-inline.patch.sfjp b/emacs-inline.patch.gist
index 52f2052..d67ad1d 100644
--- a/emacs-inline.patch.sfjp
+++ b/emacs-inline.patch.gist
@@ -1015,7 +1015,7 @@ diff -r -N -p ../emacs-24.3.org/src/nsterm.m src/nsterm.m
name: nil object: nil]; */
+ [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
+ selector: @selector (changeInputMethod:)
-+ name: @"AppleSelectedInputSourcesChangedNotification" object: nil];
++ name: @"AppleSelectedInputSourcesChangedNotification" object: nil suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
@znz
znz / README.md
Created November 13, 2013 08:59
Mavericks の distnoted がひどいので定期的に killall する

Mavericks の distnoted がひどいので定期的に killall する。

~/Library/LaunchAgents/local.killall.distnoted.plist に置いて launchctl load ~/Library/LaunchAgents/local.killall.distnoted.plist で反映する。

設定を変更したときは