Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#control flows
#br inside block -> forward jump
#br inside loop -> backward jump
#if
ret = nil
catch(:a) do
/Users/atsushi/prog/rutie/examples/rutie_ruby_example% bundle exec rake test
bundle install
Using rake 10.5.0
Using ansi 1.5.0
Using builder 3.2.3
Using bundler 2.0.2
Using minitest 5.11.3
Using ruby-progressbar 1.10.1
Using minitest-reporters 1.3.6
Using color_pound_spec_reporter 0.0.9
@edvakf
edvakf / test.php
Last active June 30, 2017 01:43
collision rate of base64 of md5 split at 7th letter
#!php -d memory_limit=10G test.php
<?php
$a = [];
$total = 0;
$collision = 0;
for ($i = 0; $i < 100000000; $i++) {
$total += 1;
for ($j = 0; $j < 2; $j++) {
@edvakf
edvakf / log.txt
Created September 1, 2016 18:05
nvidia-docker run --rm --cap-add=SYS_PTRACE --security-opt seccomp:unconfined -it waifu2x strace th waifu2x.lua --help
This file has been truncated, but you can view the full file.
execve("/root/torch/install/bin/th", ["th", "waifu2x.lua", "--help"], [/* 14 vars */]) = 0
brk(0) = 0x7fb106960000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb105f57000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/root/torch/install/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/root/torch/install/lib/tls/x86_64", 0x7ffc979386c0) = -1 ENOENT (No such file or directory)
open("/root/torch/install/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/root/torch/install/lib/tls", 0x7ffc979386c0) = -1 ENOENT (No such file or directory)
open("/root/torch/install/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
@edvakf
edvakf / 社内ISUCON事前ハンズオン.md
Last active April 30, 2023 13:12
ピクシブで新卒エンジニア全員向けに「インフラ研修」として次の内容のハンズオン講義を行いました。ちょうど2時間で終わる内容になっています。新卒達にはこの直後に社内ISUCONに挑んでもらいました。

AWSにインスタンスを立ててみよう

  • 質問:AWSにEC2インスタンスを立てたことがある人?
    • AWSのアカウント持ってない人はこの機会に取得してみよう
    • クレカがない人は言ってください
  • AWSにログインしてみよう https://portal.aws.amazon.com/
    • 東京リージョンに変更してみよう
  • Debian Jessieのインスタンスを起動してみよう
    • Rubyビルド済みインスタンスを用意しました
  • サイドバーのAMIから、検索欄に ami-53021a3d と書いて「パブリックイメージ」を選択
# bashを起動するときに読み込まれる設定ファイル
PATH=$PATH:$HOME/local/bin
Host handson
User admin
Port 22
IdentityFile インスタンスを作るときにダウンロードしたpemファイル
HostName パブリックIPアドレス
ServerAliveInterval 300
# /etc/nginx/nginx.conf
http {
# http://www.xmisao.com/2014/05/09/fluentd-elasticsearch-nginx-log.html
log_format ltsv 'time:$time_iso8601\t'
'remote_addr:$remote_addr\t'
'request_method:$request_method\t'
'request_length:$request_length\t'
'request_uri:$request_uri\t'
'https:$https\t'
@edvakf
edvakf / php.conf
Last active April 28, 2016 02:07
nginx conf
# /etc/nginx/sites-enabled/php.conf
server {
listen 80;
server_name php.aws;
root /var/www/html;
location / {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# sudo vi /etc/systemd/system/rack-test.service
[Unit]
Description=rack-test
After=syslog.target
[Service]
User=admin
Group=admin
WorkingDirectory=/home/admin/rack-test
Environment=PATH=/usr/local/bin:/usr/bin:/bin:/home/admin/local/bin