Skip to content

Instantly share code, notes, and snippets.

Avatar
💩
俺ら生きてて良いすかお偉いさ〜ん?

Shouichi Kamiya shouichi

💩
俺ら生きてて良いすかお偉いさ〜ん?
View GitHub Profile
View deps.go
// Prints dependent packages (including test ones) of the given package.
// $ deps github.com/foo/bar/baz
// net
// net/http
// net/http/httptrace
// net/http/httputil
// net/http/internal
// net/textproto
// net/url
// os
View pksha.md

Finatra + MySQL + Protobufのススメ

神谷翔一

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

主にbackendを書く事が多い

今日伝えたい事

  1. MySQLの少し変わった使い方
  2. Finatra便利
View create_accounts.sql
-- 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');
View 20151007094937_create_bookmarks.rb
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;
View MissionHistoryAnalyzer.scala
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
View sjis.go
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"golang.org/x/text/encoding/japanese"
View monte_pi.go
// Calculates Pi using Monte Carlo. See http://montepie.herokuapp.com/
package main
import (
"fmt"
"math"
"math/rand"
"time"
)
View robin_karp.go
// 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)
View Gemfile
source "https://rubygems.org"
gem "rspec"
View main.go
package main
import (
"database/sql"
"flag"
"log"
"os"
"runtime/pprof"
"time"
You can’t perform that action at this time.