Skip to content

Instantly share code, notes, and snippets.

View ta1kt0me's full-sized avatar
🐢
slow

ta1kt0me

🐢
slow
View GitHub Profile
user system total real
Forwardable 0.170000 0.000000 0.170000 ( 0.167711)
Send 0.110000 0.000000 0.110000 ( 0.106545)
Simple call 0.070000 0.000000 0.070000 ( 0.070068)
@yuroyoro
yuroyoro / Uber-migrated-pg-to-mysql.md
Created July 27, 2016 06:28
UberのPostgresqlからNoSQL on MySQLへの移行を読んでざっくりまとめた

Why Uber Engineering Switched from Postgres to MySQL - Uber Engineering Blog のまとめ

Posgresqlだと

  • pgは追記型なので少しの更新でも多くのdiskへのwriteがおきる
  • カラムを一つ更新しただけで多くのindexの書き換えが起こる
  • よって、replicationはWALを送るので更新が多いとWALが大量に送られる
  • repcliationでは物理的なdiskの変更を送る
  • DC間でレプリするときつい
  • bugがあってreplica間でMVCCの不整合が起きる
@sinsoku
sinsoku / unhighlignter.js
Last active December 24, 2020 02:44
WIP Pull Request Unhighlignter for GitHub が使えなくなったので、 Tampermonkey の UserScript で再実装した
// ==UserScript==
// @name WIP Pull Request Unhighlignter
// @author sinsoku
// @version 0.4
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
@taise
taise / eratosthenes_sieve.rb
Last active April 3, 2016 02:33
Rubyの組み込みPrimeで実装されているエラトステネスのふるいの解説 https://github.com/ruby/ruby/blob/3e92b635fb5422207b7bbdc924e292e51e21f040/lib/prime.rb#L422
=begin
## エラトステネスのふるい とは
エラトステネスのふるいは、x^(1/2) 以下の素数が既知のとき、
x^(1/2) 以上 x 以下の素数を決定するには、x 以下の整数で
x^(1/2) 以下の素数の倍数を全て取り除けばよいというものです
## なぜ組み込みのエラトステネスのふるい は早いのか
@ksss
ksss / lib.rb
Created August 12, 2015 22:06
File scope method
class OpenClass
module InternalMethods
refine OpenClass do
def foo
:foo
end
end
end
using InternalMethods
def bar
@bpierre
bpierre / README.md
Last active February 15, 2024 18:40
Switch To Vim For Good

Switch To Vim For Good

NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good

This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.

My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.

Original gist with comments: https://gist.github.com/bpierre/0a0025d348b6001394e0

@keitaj
keitaj / ar_innodb_row_format.rb
Created March 7, 2015 01:21
utf8mb4で動かすために必要。create_tableメソッドで'ROW_FORMAT=DYNAMIC'がデフォルトで指定されるようにしておく。http://qiita.com/kamipo/items/101aaf8159cf1470d823
ActiveSupport.on_load :active_record do
module ActiveRecord::ConnectionAdapters
class AbstractMysqlAdapter
def create_table_with_innodb_row_format(table_name, options = {})
table_options = options.merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC')
create_table_without_innodb_row_format(table_name, table_options) do |td|
yield td if block_given?
end
end
alias_method_chain :create_table, :innodb_row_format
@sunaot
sunaot / designing_class.md
Last active August 16, 2018 04:40
役割を閉じ込めてそれを名前で表現する (レビューコメントから)
  • 入力フォーマット
  • 登録処理の中でのデータモデル
  • 出力フォーマット

が分離していて、それがコード上の構造で表現されているのがよいと思います。 分離すると、どこかで結合しないといけないのでマッピングが発生します。 そこは互いのインターフェイスをどう解釈するかという表現なので明示的になっているほうがよいと思います。


@summerwind
summerwind / client.js
Last active August 29, 2015 14:08
Sample code for HTTP/2 Conference
var net = require('net'),
hpack = require('./hpack');
var FRAME_HEADER_LEN = 9;
function createSettingsFrame(ack) {
var flag = ack ? 0x1 : 0x0;
var frameHeader = new Buffer(FRAME_HEADER_LEN);
frameHeader.writeUInt32BE(0x0, 0);
@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のように).最も素晴らしい点は,シンプルかつ高速であることだ."