Skip to content

Instantly share code, notes, and snippets.

@edvakf
edvakf / main.go
Created September 26, 2014 12:20
gob serialize
package main
import (
"bytes"
"database/sql"
"encoding/gob"
"log"
Radix "github.com/fzzy/radix/extra/pool"
)
# 10.2s user time, 210ms system time, 41.18M rss, 233.52M vsz
# Current date: Tue Sep 23 08:18:18 2014
# Hostname: ip-172-31-16-67
# Files: /var/lib/mysql/ip-172-31-16-67-slow.log
# Overall: 43.92k total, 45 unique, 422.35 QPS, 1.68x concurrency ________
# Time range: 2014-09-23 08:15:33 to 08:17:17
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 174s 3us 609ms 4ms 38ms 15ms 84us
<?php
class BloomFilter
{
const BYTE = 8;
private $filter;
private $filter_length;
private $bit_num;
private $hash_num;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env ruby
# coding: utf-8
require 'set'
module GeoLite2_Country
class IPv4Block < Struct.new(:start_ip,
:mask_length,
:geoname_id)
def self.from_line(line)
open System.Collections.Generic
let limit = 100000
let divisor = 1000000
let memo = new Dictionary<int,int> ()
let rec partitions = fun (n, m) ->
if (n >= limit || m >= limit) then 0
elif (n = 0) then 1

gitlab bot を使って
コードレビューを
ラクにする話

自己紹介

  • 名前:高山
  • twitter:@edvakf
  • お仕事:
  • pixivのGrowthに関する開発
@edvakf
edvakf / gist:8434738
Created January 15, 2014 11:39
PHP5.5で想定通りに動かなくなったコード
/**
* 想定する文字列(UCS2)かどうか
* (parse_strした結果に適用される)
*/
private static function isValidString($str)
{
if (mb_strlen($str, 'UTF-8') > self::MAX_DETAIL_CHAR_LENGTH) {
return false;
}
$ucs2 = mb_convert_encoding($str, 'UCS-2', 'UTF-8');
@edvakf
edvakf / PRML.R
Created November 26, 2013 13:29
PRML p152-p154
# PRML p152-p154
library(ggplot2)
library(MASS)
# a0 and a1 are parameters to predict
a0 <- -0.3
a1 <- 0.5
f <- function(x) {a0 + a1 * x}
@edvakf
edvakf / nginx.conf
Last active December 27, 2015 14:29
isuconで使えそうなnginxのログ形式
log_format ltsv
"time:$time_iso8601"
"\treq_time:$request_time"
"\tapp_time:$upstream_response_time"
"\tres_size:$bytes_sent"
"\tstatus:$status"
"\tmethod:$request_method"
"\tpath:$request_uri"
"\thost:$remote_addr"
"\tua:$http_user_agent"