Skip to content

Instantly share code, notes, and snippets.


Samuel Tardieu samueltardieu

View GitHub Profile
samueltardieu /
Created Aug 25, 2015
Delayed unsubscription operator for RxJava (done in the computation scheduler)
public static class DelayedUnsubscription<T> implements Operator<T, T> {
final private long time;
final private TimeUnit unit;
public DelayedUnsubscription(final long time, final TimeUnit unit) {
this.time = time;
this.unit = unit;
samueltardieu / receiving_diode_IR.c
Last active Aug 29, 2015
Receiving IR diodes example
View receiving_diode_IR.c
#include "receiving_diode_IR.h"
#include "timings_IR.h"
static void emptyTimerCbI(GPTDriver * gptp)
(void) gptp;
static GPTConfig gpt5cfg = {
samueltardieu /
Created Apr 8, 2015
How to include a board from anywhere
# List of all the board related files.
BOARDSRC = ${BOARDINC}/board.c \
# Required include directories
BOARDINC := $(shell readlink -f $(dir $(lastword $(MAKEFILE_LIST))))

Keybase proof

I hereby claim:

  • I am samueltardieu on github.
  • I am samueltardieu ( on keybase.
  • I have a public key whose fingerprint is 1D36 D924 8B33 DCAB 7BA5 BA44 7A30 BCF4 42B8 F7C2

To claim this, I am signing this object:

samueltardieu / gist:7946839
Created Dec 13, 2013
Freebox Companion pour Android
View gist:7946839
D/FbxCompMain( 7542): launching activity for 'Téléchargements'
I/ActivityManager(  850): START u0 { (has extras)} from pid 7542
D/FbxDownloadListActivity( 7542): called onCreate
D/FbxDownloadListActivity( 7542): tab selected
D/FbxDownloadListFragment( 7542): called onCreate
D/FbxDownloadListActivity( 7542): called onStart
D/FbxDownloadListActivity( 7542): called onResume
D/FbxHttpClientTask( 7542): got 403, application/json; charset=utf-8 on
D/FbxHttpClientTask( 7542): called doInBackground on:
samueltardieu / Factor.hs
Created Jun 23, 2013
Demo Factor basis for the non-classical paradigms and language course
View Factor.hs
module Factor where
import Control.Monad.State
-- We can put integer literals or quotations on the stack
data Stackable = IntLiteral Int
| FQuotation (Factor ())
-- Shortcut name
type Stack = [Stackable]
samueltardieu / Test.scala
Created Jun 17, 2013
Scala seems to always prefer value over call by name: `foo(true)` returns "foo1" and is not ambiguous. Why?
View Test.scala
object Test {
def foo(t: Boolean) = "foo1"
def foo(t: => Boolean) = "foo2"
samueltardieu /
Last active Dec 16, 2015
Add comments, and create already locked semaphores in order to reduce further contention opportunities.
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
public class LockMap<Key> {
private final ConcurrentHashMap<Key, Semaphore> map = new ConcurrentHashMap<Key, Semaphore>();
public void lock(final Key key) throws InterruptedException {
Semaphore sem = map.get(key);
while (true) {
View shorten.hs
shortenUrl :: String -> String
shortenUrl url = case splitFileName url of
(dir, "index.html") | isLocal dir -> dir
_ -> url
where isLocal uri = isPrefixOf rootUrl uri || not (isInfixOf "://" uri)
samueltardieu / challenge.c
Created Mar 11, 2013
Le communication challenge fait en cours ce matin. Et il fonctionne :)
View challenge.c
#include "ch.h"
#include "hal.h"
#include "lcd.h"
#define SCORED_QUIZZ 1
#define TEST_QUIZZ 2
// Define this as TEST_QUIZZ or SCORED_QUIZZ