Skip to content

Instantly share code, notes, and snippets.

View manboubird's full-sized avatar

Toshiaki Toyama manboubird

View GitHub Profile
@w01fe
w01fe / graphviz.clj
Created February 15, 2013 06:12
Graphviz for Graphs
;; Copyright Jason Wolfe and Prismatic, 2013.
;; Licensed under the EPL, same license as Clojure
(use 'plumbing.core)
(require '[clojure.java.shell :as shell]
'[clojure.string :as str])
(import '[java.util HashSet] '[java.io File])
(defn double-quote [s] (str "\"" s "\""))
@MLnick
MLnick / StreamingHLL.scala
Last active January 24, 2024 19:39
Spark Streaming meets Algebird's HyperLogLog Monoid
import spark.streaming.StreamingContext._
import spark.streaming.{Seconds, StreamingContext}
import spark.SparkContext._
import spark.storage.StorageLevel
import spark.streaming.examples.twitter.TwitterInputDStream
import com.twitter.algebird.HyperLogLog._
import com.twitter.algebird._
/**
* Example of using HyperLogLog monoid from Twitter's Algebird together with Spark Streaming's
@krishnanraman
krishnanraman / USPopulation
Last active June 13, 2017 03:47
Goal: Find THE FASTEST GROWING COUNTY IN THE UNITED STATES over the 1969-2011 timeframe.
Goal: Process the 12 million plus records
from: http://seer.cancer.gov/popdata/download.html
using: a Scala API atop Cascading, aka SCALDING ( Inventors: Avi Bryant, Oscar Boykin, Argyris )
to find:
THE FASTEST GROWING COUNTY IN THE UNITED STATES over the 1969-2011 timeframe.
-----------------------------------------------------------------------------
RESULTS: Scroll to the very bottom.
First, the scalding source...
---
@mklabs
mklabs / Gruntfile.js
Last active December 10, 2015 17:38
A simple example of using yeoman on an express app
module.exports = function(grunt) {
function noop() {}
grunt.initConfig({
watch: {
reload: {
files: ['public/**', 'views/**'],
tasks: 'reload'
}
@sevennineteen
sevennineteen / example.json
Created December 28, 2012 18:16
Example using Jinja2 to populate a JSON payload template
{ "path": "/content/geometrixx/my-first-jinja-page",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:Page" }],
"nodes": [
{ "path": "jcr:content",
"properties": [
{ "name": "jcr:primaryType",
"value": "cq:PageContent"},
@Foredoomed
Foredoomed / Leiningen.sublime-build
Created November 18, 2012 04:31
Leiningen.sublime-build
# Copy the following and place it a file called Leiningen.sublime-build in the Sublime user packages folder (~/.config/sublime-text-2/Packages/User on Linux).
# Select this as the build system for the project using Tools/Build System/Leiningen.
# You can then bring up the Sublime Command Palette (ctrl+shift+P on Windows/Linux) and issue any of the commands # (build, documentation, clean, run, test, etc). By default, build is bound to ctrl+b and run to ctrl+shift+b.
{
"cmd": ["lein", "compile", ":all"],
"working_dir": "$project_path",
"variants": [
{ "cmd": ["lein", "marg", "-m", "-d", "docs"],
@davemo
davemo / api.proxy.server.js
Created November 6, 2012 21:56
A simple express.js server with a proxy that intercepts all requests with /api/ and proxies them to localhost:3000
var express = require('express'),
httpProxy = require('http-proxy'),
app = express();
var proxy = new httpProxy.RoutingProxy();
function apiProxy(host, port) {
return function(req, res, next) {
if(req.url.match(new RegExp('^\/api\/'))) {
proxy.proxyRequest(req, res, {host: host, port: port});
@paxan
paxan / gist:3901864
Last active October 11, 2015 18:37
A Common Crawl Experiment (moved to https://github.com/paxan/ccooo)
@maiha
maiha / gist:3877900
Created October 12, 2012 08:03
awesome_print
##################################################
### Before
irb(main):001:0> Song.limit(2)
Song Load (0.2ms) SELECT "songs".* FROM "songs" LIMIT 2
=> [#<Song id: 5, key: "55197", name: "CONTRADICTION", singer: "ももいろクローバーZ", lyric: "前田たかひろ", music: "大隅知宇", body: "飼い馴らせない欲望を\n恥じるのなら\n�...", created_at: "2012-09-19 22:08:16", updated_at: "2012-09-19 22:29:21">, #<Song id: 6, key: "57767", name: "サンタさん", singer: "ももいろクローバーZ", lyric: "前山田健一", music: "前山田健一", body: " ランランラン…\n\nせーの!\nメリークリ�...", created_at: "2012-09-19 22:08:16", updated_at: "2012-09-19 22:29:21">]
##################################################
### Install
@sasaki-shigeo
sasaki-shigeo / gist:3727810
Created September 15, 2012 13:18
Conversion from/to Numeric Type in Scala (Scala における数値型の変換)
import math._
1L // Long型の 1
1:Long // Long型の 1
127:Byte // Byte型の 127
32767:Short // Short型の 32767
(1+2).toLong // Long型への変換
(2+3) toLong // Long型への変換