Skip to content

Instantly share code, notes, and snippets.

View shouichi's full-sized avatar

Shouichi Kamiya shouichi

  • Tokyo
  • 14:25 (UTC +09:00)
View GitHub Profile
package main
import (
"fmt"
kafka "github.com/Shopify/sarama"
zmq "github.com/pebbe/zmq4"
"os"
"os/signal"
"time"
)
// This services listens on log queue and saves log to database.
package main
import (
"log"
"time"
)
func main() {
jobChannel := make(chan (int))
package main
import (
"database/sql"
"flag"
"log"
"time"
_ "github.com/lib/pq"
)
. . 62: func read(db *sql.DB) {
. 4 63: rows, err := db.Query("SELECT name FROM users")
. . 64: if err != nil {
. . 65: log.Fatal(err)
. . 66: }
. . 67: defer rows.Close()
. . 68:
. . 69: users := []user{}
. 20 70: for rows.Next() {
. 3 71: user := user{}
This file has been truncated, but you can view the full file.
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
# -----------------------------
# 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"
)