Skip to content

Instantly share code, notes, and snippets.

View mumoshu's full-sized avatar
🏠
Working from home

Yusuke Kuoka mumoshu

🏠
Working from home
View GitHub Profile
@overplumbum
overplumbum / gist:2965503
Created June 21, 2012 12:34
Per Process Group memory usage
ps auxw | awk '{ g[$11 " " $12] += $6 } END { for (i in g) { print g[i] "\t" i }}' | sort -bgr
@crockpotveggies
crockpotveggies / BrowserSocket.scala
Created September 20, 2012 17:32 — forked from minosiants/gist:3163791
Akka MessageBus with WebSockets access wrapped in Actors
/**
* actor wrapping access for browser socket
*/
class BrowserSocket(
val s: WebSocketConnection,
val userId: Long,
val teamId: Long
) extends Actor {
@non
non / gist:4064198
Created November 13, 2012 05:47
Add map + flatMap to Function1-3 with no overhead
object RichF {
implicit class RichF1[A, Z](val f: A => Z) extends AnyVal {
def map[Y](g: Z => Y): A => Y =
(a: A) => g(f(a))
def flatMap[Y](g: Z => A => Y): A => Y =
(a: A) => g(f(a))(a)
}
implicit class RichF2[A, B, Z](val f: (A, B) => Z) extends AnyVal {
def map[Y](g: Z => Y): (A, B) => Y =
@tkawachi
tkawachi / fluentd
Created November 27, 2012 08:55 — forked from higebu/fluentd
/etc/init.d/fluentd
#!/bin/bash
PID_FILE=/var/run/fluentd.pid
CONF_FILE=/etc/fluent/fluent.conf
LOG_FILE=/var/log/fluent/fluent.log
DEFAULT_RVM_PATH=/usr/local/rvm
JEMALLOC=jemalloc.sh
F_USER=fluentd
F_GROUP=fluentd
@zerosum
zerosum / Euler0009.scala
Last active December 11, 2015 09:09
Project Euler: Problem 9
object Euler0009 {
private val max = 1000
def main(args: Array[String]): Unit = {
println(
buildTriplets(1, 2, Nil).filter(_.isPitagolyan).map(_.product)
)
}
@ymasory
ymasory / build.sbt
Last active December 12, 2015 07:18
Dealing with SIP-18 (language imports) in the presence of cross-compilation in build.sbt
scalaVersion := "2.10.0"
// Let's support all "modern" Scala versions.
crossScalaVersions := Seq(
"2.9.3-RC1",
"2.9.2",
"2.9.1", "2.9.1-1",
"2.9.0", "2.9.0-1",
"2.8.0", "2.8.1", "2.8.2"
)
class ClusterMetricsElasticScaleListener extends Actor with ActorLogging {
val selfAddress = Cluster(context.system).selfAddress
override def preStart(): Unit =
Cluster(context.system).subscribe(self, classOf[ClusterMetricsChanged])
override def postStop(): Unit =
Cluster(context.system).unsubscribe(self)
def receive = {
import scala.language.postfixOps
import scala.concurrent._
import scala.concurrent.duration._
import akka.pattern.pipe
import akka.actor._
import akka.cluster.routing._
/**
* Concept and some code lifted from
* https://github.com/jsuereth/intro-to-fp, thanks Josh!
@gseitz
gseitz / build.scala
Created February 19, 2013 22:52
SBT task for running all main classes
import sbt._
import Keys._
import Build.data
object build extends Build {
lazy val runAll = TaskKey[Unit]("run-all")
lazy val standardSettings = Seq(
runAllIn(Compile)
)
using System;
using System.Collections.Generic;
namespace Utils
{
public class UnknownTypeException : Exception
{
}
public class TypeRegistry