Skip to content

Instantly share code, notes, and snippets.

View manboubird's full-sized avatar

Toshiaki Toyama manboubird

View GitHub Profile
@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;
/**
* 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 / 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.

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)] {
#!/bin/bash
set -o pipefail # Trace errors through pipes
set -o errtrace # Trace ERR through 'time command'
error() {
JOB="$0" # job name
LASTLINE="$1" # line of error occurrence
LASTERR="$2" # error code
echo "ERROR in ${JOB}:line ${LASTLINE} - exit code ${LASTERR}"
@manboubird
manboubird / config.yml
Last active August 29, 2015 14:12 — forked from pkuczynski/LICENSE
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
@manboubird
manboubird / tmux.md
Last active August 29, 2015 14:12 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

// transcribed from an Apache Spark 1.0 spark-shell session
// using data from http://chriswhong.com/open-data/foil_nyc_taxi/
// and the QTree algorithm for approximate quantiles over large datasets
// each of the distanceRange and minutesRange calculations below takes about 15 minutes on my four-core SSD-based Macbook Pro
import com.twitter.algebird._
import com.twitter.algebird.Operators._
implicit val qtSemigroupD = new QTreeSemigroup[Double](6)
val in = sc.textFile("trip_data") // a directory containing all the trip_data*.csv files downloaded from the above link
; http://nathanmarz.com/blog/introducing-cascalog-a-clojure-based-query-language-for-hado.html
;
; Run with method executing a script:
; drake -w cascalog.drake %playground
;
; Run with code eval:
; drake -w cascalog.drake %playground.eval
;
CASCALOG_JAR:=$[HOME]/local/bin/cascalog-standalone.jar