Skip to content

Instantly share code, notes, and snippets.

View huitseeker's full-sized avatar

François Garillot huitseeker

View GitHub Profile
#include <iostream>
#include <type_traits>
#include <string>
// primality test
template<int N, int M>
struct divides
{
enum { value = ((N%M) == 0) || divides<N, M-1>::value };
@jasonreich
jasonreich / Jigger.agda
Created December 12, 2010 19:14
A variant on Conor McBride's trick
-- Forked from http://personal.cis.strath.ac.uk/~conor/fooling/Jigger.agda
module Jigger where
data Nat : Set where
zero : Nat
suc : Nat -> Nat
_+_ : Nat -> Nat -> Nat
zero + n = n
suc m + n = suc (m + n)
#!/bin/zsh
# Copyleft 2010 paradoxxxzero All wrongs reserved
# With contribution from James Ahlborn
# https://gist.github.com/752727
# Fork of https://gist.github.com/586698 by nicoulaj / dingram / roylzuo ...
# From http://www.zsh.org/mla/users/2010/msg00692.html
# Token types styles.
# See http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#SEC135
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ymasory
ymasory / bay-scala-jobs
Last active February 18, 2020 20:48
Companies hiring Scala developers in the Bay Area.
Companies hiring Scala developers in the Bay Area.
Created in response to a thread on scala-base.
My favorites:
- CloudPhysics
- Wordnik
Unbiased list:
- 10Gen
- Audax Health
@paulp
paulp / The Signs of Soundness
Last active June 17, 2021 06:48
The Signs of Soundness
Hello scala, my old friend
I've come to take you home again
Because a feature slowly creeping
left me plagued with doubts and weeping
and the version that was tagged in the repo
just has to go
it lacks the signs of soundness
On sleepless nights I hacked alone
applying ant and other tools of stone
@a2ikm
a2ikm / lsyncd.conf.lua
Last active September 7, 2020 11:06
lsyncd + s3
s3sync = {
maxProcesses = 1,
onStartup = "aws s3 sync ^source ^target",
onCreate = "[ -f ^source^pathname ] && aws s3 cp ^source^pathname ^target^pathname || true",
onModify = "[ -f ^source^pathname ] && aws s3 cp ^source^pathname ^target^pathname || true",
onDelete = "[ -f ^source^pathname ] && aws s3 rm ^target^pathname || true",
onMove = "aws s3 mv ^target^o.pathname ^target^d.pathname",
}
sync {
@a2ikm
a2ikm / README.md
Last active February 3, 2017 19:52
lsyncdとserfでS3を介してファイルを同期するようなやつ

lsyncdとserfでS3を介してファイルを同期するようなやつ

master側の/path/to/shared以下でファイルの変更が検知されたら、lsyncdがS3に同期をかけ、そののちserfクラスタにupdateイベントを発行する。 それを受け取ったslave側がS3からファイルを持ってくる。

Requirements

  • lsyncd
  • serf
package net.atos.sparti.pub
import java.io.PrintStream
import java.net.Socket
import org.apache.commons.pool2.impl.{DefaultPooledObject, GenericObjectPool}
import org.apache.commons.pool2.{ObjectPool, PooledObject, BasePooledObjectFactory}
import org.apache.spark.streaming.dstream.DStream
class PooledSocketStreamPublisher[T](host: String, port: Int)
@paulp
paulp / global.sbt
Last active October 16, 2018 19:09
continuous compilation of the sbt build
// These lines go in ~/.sbt/0.13/global.sbt
watchSources ++= (
(baseDirectory.value * "*.sbt").get
++ (baseDirectory.value / "project" * "*.scala").get
++ (baseDirectory.value / "project" * "*.sbt").get
)
addCommandAlias("rtu", "; reload ; test:update")
addCommandAlias("rtc", "; reload ; test:compile")
addCommandAlias("ru", "; reload ; update")