Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

minikomi

🍕
I like pizza
  • Tokyo, Japan
View GitHub Profile
@minikomi
minikomi / gist.go
Created June 3, 2012 02:48
Golang script for creating anonymous gists with github API
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
@minikomi
minikomi / filebuffer.go
Created June 9, 2012 10:27
Read file to buffered bytes buffer in chunks.
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"os"
)
@minikomi
minikomi / allstop.go
Created June 11, 2012 11:04 — forked from kylelemons/allstop.go
Using "close" to stop multiple goroutines
package main
import (
"fmt"
"sync"
)
func main() {
wg := new(sync.WaitGroup)
stop := make(chan bool)
@minikomi
minikomi / pascal.go
Created June 11, 2012 11:05 — forked from aschobel/pascal.go
Pascal's triangle using channels and goroutines
package main
import "fmt"
func worker(row int, input chan int, output chan int, done chan int) {
display := ""
previous := 0
for i := 0; i < row+1; i++ {
read := <-input
display += fmt.Sprintf("%d ", read)
package mapreduce
func MapReduce(mapper func(interface{}, chan interface{}),
reducer func(chan interface{}, chan interface{}),
input chan interface{},
pool_size int) interface{}
{
reduce_input := make(chan interface{});
reduce_output := make(chan interface{});
worker_output := make(chan chan interface{}, pool_size);
@minikomi
minikomi / server.go
Created June 13, 2012 08:33
random go from golang
package main
import (
"fmt"
"net/http"
)
func broadcaster(in chan chan string, out chan chan string, listen chan string) {
chans := map[chan string]bool{}
for {
@minikomi
minikomi / update.md
Created June 29, 2012 06:21 — forked from anonymous/gist:3014636
Pen type a

Project Update #27: The Storm

For backers only, Posted by cw&t

👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯 👯

Hi backers!

First, for those of you still waiting for your pen(s), we're still on schedule. The schedule was posted a few updates ago (update #22). The 3 remaining batches are shipped from our manufacturer in China on :

  • July 7th (480 pens)
@minikomi
minikomi / earthquake.sh
Last active October 9, 2015 05:27
Visualize Japanese earthquake activity with spark.
curl -s http://www.jma.go.jp/jp/quake/quake_local_index.html | grep M | sed "s/.*nowrap>M\(.*\)<\/td><td\ no.*/\1/" |
sed 's/1/1/g; s/2/2/g; s/3/3/g; s/4/4/g; s/5/5/g; s/6/6/g; s/7/7/g; s/8/8/g; s/9/9/g; s/0/0/g; s/./\./g' |
spark
@minikomi
minikomi / index.html
Created August 27, 2012 01:01 — forked from bunkat/index.html
Simple Scatter Chart Example
<!DOCTYPE html>
<html>
<head>
<title>The d3 test</title>
<style>
.chart {
shape-rendering: crispEdges;
}
.main text {
@minikomi
minikomi / goserv.go
Created September 2, 2012 02:59
Simple static server in go
package main
import (
"flag"
"log"
"net/http"
"os"
)