Skip to content

Instantly share code, notes, and snippets.

View manboubird's full-sized avatar

Toshiaki Toyama manboubird

View GitHub Profile
import com.twitter.scalding._
import cascading.pipe.Pipe
import spray.json.JsonWriter
import org.apache.hadoop.io.BytesWritable
case class Sequins[V](p : String)(implicit writer: JsonWriter[V])
extends FixedPathSource(p)
with WritableSequenceFileScheme
with TypedSink[(String, V)] {
@manboubird
manboubird / README.md
Last active August 29, 2015 14:13 — forked from mbostock/.block

From Wikipedia:

Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Use the menu in the top-left to change the frame of reference, fixing the specified gear in-place.

/**
* To get started:
* git clone https://github.com/twitter/algebird
* cd algebird
* ./sbt algebird-core/console
*/
/**
* Let's get some data. Here is Alice in Wonderland, line by line
*/
@manboubird
manboubird / dic
Last active August 29, 2015 14:14
function is_command_exists() {
if hash $1 2>/dev/null; then echo 0;
else echo 1; fi
}
if [ $(is_command_exists w3m) -eq 0 -a $(is_command_exists rlwrap) -eq 0 -a $(is_command_exists peco) -eq 0 ];then
function dic-rlwrap {
HISTORY=$HOME/.dic_history
rlwrap -H $HISTORY bash -c '
function is_command_exists() {
if hash $1 2>/dev/null; then echo 0;
// http://en.wikipedia.org/wiki/Decorator_pattern
trait Coffee {
def cost:Double
def ingredients: String
}
class SimpleCoffee extends Coffee {
override def cost = 1
override def ingredients = "Coffee"
import com.twitter.algebird.{Aggregator, Semigroup}
import com.twitter.scalding._
import scala.util.Random
/**
* This job is a tutorial of sorts for scalding's Execution[T] abstraction.
* It is a simple implementation of Lloyd's algorithm for k-means on 2D data.
*
* http://en.wikipedia.org/wiki/K-means_clustering
  1. General Background and Overview
#!/bin/bash
# PLUGINS=で始まってる行をコメントアウトしたり追加したりして、
# 好きなプラグインをインストールできるよ。
# まぁ、普通は、JenkinsのWeb UIから「プラグインの管理」でインストールすればいいと思う。
# 同じ環境を何個も作りたい場合はこのスクリプトをどうぞ。
PLUGINS=()
# Jenkin Build Pipeline Plugin
@manboubird
manboubird / gist:c4068eee91449cfcafaa
Last active August 29, 2015 14:25 — forked from wardbekker/gist:964146
Naive parallel import of Compressed MYSQL dump file
# Split MYSQL dump file
zcat dump.sql.gz | awk '/DROP TABLE IF EXISTS/{n++}{print >"out" n ".sql" }'
# Parallel import using GNU Parallel http://www.gnu.org/software/parallel/
ls -rS *.sql | parallel --joblog joblog.txt mysql -uXXX -pYYY db_name "<"
@manboubird
manboubird / Drakefile
Last active August 29, 2015 14:25
Drake 1.0.0 include&method bug
%include vars.drake
echo_method()
echo "test"