Skip to content

Instantly share code, notes, and snippets.

View nojima's full-sized avatar
o_O

Yusuke Nojima nojima

o_O
View GitHub Profile
@nojima
nojima / Makefile
Last active June 18, 2017 23:37
BPF を使ったサンプルになる予定。
bpf-sample: bpf-sample.c
gcc -Wall -Wextra -o bpf-sample bpf-sample.c
@nojima
nojima / Main.java
Created June 14, 2017 15:30
JNA を使って Java から getrusage() を呼び出すサンプル
package com.ynojima.utilization;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

IPsec with ip command

ip コマンドを使った IPsec 通信の設定方法を説明する。 以下で紹介する方法は

  • 事前に何らかの方法で鍵を共有する必要がある
  • リピート攻撃を防ぐために鍵を定期的に更新するための仕組みが必要となる

という問題があるため、真面目な用途に使う場合はちゃんと IKE とかを使ったほうがよいと思う。

#include <chrono>
#include <cstdint>
#include <iostream>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <msgpack.hpp>
#include "test_msgpack.h"
#include "test.pb.h"
static const size_t MSGPACK_OUTPUT_BUFFER_RESERVE_SIZE = 271319041;

protobuf 3 メモ

ビルド

C++ 用のアーカイブを落としてくる。

./configure
make -j $(nproc)
mkdir deb
#!/usr/bin/python [18/651]
'''
Pretty printer of LTSV.
How to use:
$ alias ltsvless='LESSOPEN="||=/path/to/ltsvpipe %s" less'
$ ltsvless /path/to/something.ltsv
'''
@nojima
nojima / nginx_before_send.patch
Last active February 18, 2016 12:36
This patch adds "before_send" to proxy_next_upstream directive. When "before_send" is specified, a request is passed to next upstream if an error or a timeout has occurred before sending the first byte of the request.
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index a869e74..78b5305 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -220,6 +220,7 @@ static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = {
{ ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 },
{ ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
{ ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING },
+ { ngx_string("before_send"), NGX_HTTP_UPSTREAM_FT_BEFORE_SEND },
{ ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },

nginx-ssl-scache-sync-module

nginx-ssl-scache-sync-module は nginx の SSL セッションキャッシュを異なるホスト上の nginx と共有するためのパッチです。

利用するときは nginx をビルドする際に patch -p0 で適用してください。

ディレクティブ

ssl_session_cache_peers

Building Microservices 第6章 Deployment

A Brief Introduction to Continuous Integration

TODO

Mapping Continuous Integration to Microservices

ソースコードレポジトリと CI ビルドの粒度をどうするか?

kubernets を触ってみた

ハマったところ

  • Arch だと Python のバージョンが 3 なので gcloud が動かない。
    • sudo pacman -S python
    • export CLOUDSDK_PYTHON=/usr/bin/python2
  • GCE にアクセスするときに nojima ユーザでアクセスすると gcloud が動かない。
    • パーミッションの問題。
    • ubuntu ユーザでアクセスする。