Skip to content

Instantly share code, notes, and snippets.

@PierreMage
PierreMage / .aliases
Last active June 2, 2020 17:53
bare dotfiles
#!/bin/bash
#https://github.com/mathiasbynens/dotfiles/blob/master/.aliases
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~"
alias -- -="cd -"
@PierreMage
PierreMage / SessionsStatsJob.scala
Last active February 22, 2016 16:34
Testing Scalding type-safe API
class SessionsStatsJob(args: Args) extends Job(args) {
import ExternalOperations._
import SessionsStatsJob._
val maxIdleTimeInMillis = args.getOrElse("maxIdleTimeInMillis", "100").toInt
val input = args("input")
val output = args("output")
val events = TypedPipe.from(TypedCsv[(Int, Int, String, String)](input))
@PierreMage
PierreMage / Thaasophobia.scala
Last active February 10, 2016 23:45
Handling an actor's idleness in Akka
package akka.actor
import scala.concurrent.duration._
/**
* <p>Thaasophobia is a fear of being idle, sitting.
* <p>WARNING: A thaasophobic actor with default behaviour could stop before
* concurrent operations complete:
* <ul>
* <li>Don't use future callbacks inside the actor
@PierreMage
PierreMage / Dockerfile
Created September 14, 2015 09:20
boot2docker-jmxremote-example
FROM java:8
COPY Main.java /
RUN javac Main.java
@PierreMage
PierreMage / PowerShell-profile.ps1
Last active October 1, 2022 00:33
Make your Windows command line better with doskey
# http://technet.microsoft.com/en-us/library/ee692685.aspx
# F7 = history
# Alt+F7 = history -c
# F8 = Ctrl+R
Set-Location C:
# Easier navigation
Set-Alias o start
function oo {start .}
@PierreMage
PierreMage / findRecentLargeFiles.sh
Last active September 28, 2015 11:18
Unix snippets
# http://www.r00tb0x.com/content/find-recent-large-files-unix
find . -type f -mtime -2 -exec ls -ltrh "{}" ";"
@PierreMage
PierreMage / Factorial.java
Last active September 27, 2015 23:48
Java snippets
import static java.lang.Math.*;
//TODO: use BigInteger instead of long
public class Factorial {
public long recursiveFactorial(long n) {
if (n == 0) {
return 1;
}
return n * recursiveFactorial(n - 1);