Skip to content

Instantly share code, notes, and snippets.

View genki's full-sized avatar

Genki Takiuchi genki

View GitHub Profile
@ykst
ykst / local_ssl.md
Last active April 20, 2023 09:13
LANのIPアドレスに対してSANを適用して真正なSSL証明書を作成する手順

LANのIPアドレスに対してSANを適用して真正なSSL証明書を作成する手順

概要

テスト用に自己証明書を用いてローカルhttpsサーバーを立てるなどの際に、クライアントから危険な接続として扱われないように証明書を設定をする方法について説明する。 通常ホストの真正性を確認するためにはドメイン名を使用するが、環境の都合上ローカルにDNSを立てるのが難しい場合がある。クライアントへの介入が難しい場合は/etc/hostによる書き換えも出来ない。 そこで、x509.v3のsubjectAltName拡張を用いてIPをホスト名の代わりに使用し、任意のIPアドレスに立てたサーバーを真正なものとして扱えるようにする。

手順

  • openssl設定ファイルの指定(任意)
@hayajo
hayajo / README.md
Last active March 20, 2019 05:05
Docker単体でコンテナに固定IPを設定する(--privilege)

Docker単体でコンテナに固定IPを設定する

pipeworkweaveを利用せずにコンテナに固定IPを設定するには、docker run--privilegedオプションを指定し、コンテナ内でIPを設定する方法がある。

$ HOST1=$(docker run --privileged -t -d ubuntu /bin/bash)
$ docker exec $HOST1 ip addr add 192.168.0.10/24 dev eth0

$ HOST2=$(docker run --privileged -t -d ubuntu /bin/bash)
$ docker exec $HOST2 ip addr add 192.168.0.11/24 dev eth0
@tcnksm
tcnksm / docker_cheat.md
Last active August 5, 2021 03:59 — forked from wsargent/docker_cheat.md
Docker 虎の巻

Docker 虎の巻

何故Dockerを使うべきか

Why Should I Care (For Developers)

"Dockerが面白いのはシンプルな環境に隔離性と再現性をもたらしてくれることだ.ランタイムの環境を一度作れば、パッケージにして別のマシンでも再利用することできる.さらに,すべてはホスト内の隔離された環境で行われる(VMのように).最も素晴らしい点は,シンプルかつ高速であることだ."

@peterc
peterc / dnsd.rb
Created December 2, 2011 23:47
Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@wtaysom
wtaysom / where_is.rb
Created September 23, 2011 08:57
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@senorprogrammer
senorprogrammer / range_intersection.rb
Created July 1, 2011 12:07
Range intersections in Ruby
#!/usr/bin/env ruby
# From my blog post at http://www.postal-code.com/binarycode/2009/06/06/better-range-intersection-in-ruby/
class Range
def intersection(other)
raise ArgumentError, 'value must be a Range' unless other.kind_of?(Range)
my_min, my_max = first, exclude_end? ? max : last
other_min, other_max = other.first, other.exclude_end? ? other.max : other.last
module Joshiryoku where
infix 1 >_< ^_^ ・_・
infix 2 (_) [_]
infix 3 o_o ∩_∩ ☜_☞
data Mouse : Set where
O : Mouse
- : Mouse
ω : Mouse