Skip to content

Instantly share code, notes, and snippets.

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

Shouichi Kamiya shouichi

💩
俺ら生きてて良いすかお偉いさ〜ん?
View GitHub Profile
View broker.go
package main
import (
"fmt"
kafka "github.com/Shopify/sarama"
zmq "github.com/pebbe/zmq4"
"os"
"os/signal"
"time"
)
View main.go
// This services listens on log queue and saves log to database.
package main
import (
"log"
"time"
)
func main() {
jobChannel := make(chan (int))
View -
. . 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{}
View postgresql.conf
# -----------------------------
# 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
View benchmark.sql
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;
View main.go
package main
import (
"database/sql"
"flag"
"log"
"time"
_ "github.com/lib/pq"
)
View main.go
package main
import (
"database/sql"
"flag"
"log"
"os"
"runtime/pprof"
"time"
View Gemfile
source "https://rubygems.org"
gem "rspec"
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 monte_pi.go
// Calculates Pi using Monte Carlo. See http://montepie.herokuapp.com/
package main
import (
"fmt"
"math"
"math/rand"
"time"
)