Skip to content

Instantly share code, notes, and snippets.

View shouichi's full-sized avatar

Shouichi Kamiya shouichi

View GitHub Profile
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
package main
import (
"database/sql"
"flag"
"log"
"os"
"runtime/pprof"
"time"
source "https://rubygems.org"
gem "rspec"
// This packages provides Rabin-Karp string search.
package robin_karp
const prime = 1456667
// Find tries to find string s in t and returns the index of the first index
// of t where s found. Returns -1 when not found. It implements Rabin-Karp
// algorithm.
func Find(s, t string) int {
ls := len(s)
// Calculates Pi using Monte Carlo. See http://montepie.herokuapp.com/
package main
import (
"fmt"
"math"
"math/rand"
"time"
)
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"golang.org/x/text/encoding/japanese"
package com.trlln.bbb.stream
import java.text.SimpleDateFormat
import java.util.Date
import com.amazonaws.auth.EnvironmentVariableCredentialsProvider
import com.amazonaws.services.lambda.runtime.Context
import com.amazonaws.services.lambda.runtime.events.KinesisEvent
import com.amazonaws.services.lambda.runtime.events.KinesisEvent.KinesisEventRecord
import com.google.protobuf.InvalidProtocolBufferException
class CreateBookmarks < ActiveRecord::Migration
def up
execute <<-SQL
CREATE SEQUENCE bookmarks_id_seq;
CREATE FUNCTION next_bookmark_id(OUT result bigint) AS $$
DECLARE
epoch bigint := 1420070400000;
seq_id bigint;
now bigint;
-- MySQL port of "Sharding & IDs at Instagram"
-- http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram
CREATE TABLE account_id_seq (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
stub CHAR(1) NOT NULL,
UNIQUE KEY stub (stub)
);
INSERT INTO account_id_seq (stub) VALUES ('a');
@shouichi
shouichi / pksha.md
Last active December 25, 2015 07:00

Finatra + MySQL + Protobufのススメ

神谷翔一

東大情報科学科出身のエンジニア

主にbackendを書く事が多い

今日伝えたい事

  1. MySQLの少し変わった使い方
  2. Finatra便利