Skip to content

Instantly share code, notes, and snippets.

View shouichi's full-sized avatar

Shouichi Kamiya shouichi

  • Tokyo
  • 20:17 (UTC +09:00)
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
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;
. . 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{}
package main
import (
"database/sql"
"flag"
"log"
"time"
_ "github.com/lib/pq"
)
// 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 (
"fmt"
kafka "github.com/Shopify/sarama"
zmq "github.com/pebbe/zmq4"
"os"
"os/signal"
"time"
)
Vagrant.configure('2') do |config|
config.vm.box = 'ubuntu.13.10'
config.vm.box_url = 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box'
[3000, 3080, 3333, 4000, 8000, 8080].each do |port|
config.vm.network :forwarded_port, guest: port, host: port
end
config.ssh.forward_agent = true
if [ -z $SSH_AUTH_SOCK ];
then
eval `ssh-agent` > /dev/null
ssh-add ~/.ssh/id_rsa 2&> /dev/null
fi
#!/usr/bin/env ruby
def reverse(n, reversing = 0)
if n == 0
reversing
else
reverse(n / 10, n % 10 + reversing * 10)
end
end
#!/usr/bin/env ruby
def fibgen
prev, curr = 0, 1
lambda do
temp = prev
prev = curr
curr += temp
temp
end