This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn to-scala-list [& vals] | |
(reduce | |
#(.apply scala.collection.immutable.$colon$colon$/MODULE$ %2 %1) | |
(scala.collection.immutable.Nil$/MODULE$) | |
(map to-jmhc-tile vals))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns euler-clj.core | |
:use [clojure.test]) | |
;; problem 1 | |
(with-test | |
(defn multiple-of-3-and-5 | |
"Find the sum of all the multiple of 3 and 5 below `limit`" | |
[limit] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [revenu 50000 | |
tranches [ [0 6011 0.] [6011 11991 0.055] [11991 26631 0.14] [26631 71397 0.3] [71397 151200 0.41]]] | |
(reduce | |
(fn [total [tmin tmax coeff]] | |
(let [m-in-tranche (- (min tmax revenu) tmin)] | |
(+ total (max 0 (* m-in-tranche coeff))))) | |
0 | |
tranches)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def duration-pattern #"^(?<sign>\+|-)?P(?:(?:(?:(?<years>\d+(?:[,.]\d+)?)Y)?(?:(?<months>\d+(?:[.,]\d+)?)M)?(?:(?<days>\d+(?:[.,]\d+)?)D)?(?<time>T(?:(?<hours>\d+(?:[.,]\d+)?)H)?(?:(?<minutes>\d+(?:[.,]\d+)?)M)?(?:(?<seconds>\d+(?:[.,]\d+)?)S)?)?)|(?<weeks>\d+(?:[.,]\d+)?W))$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns hello-world.handler | |
(:require [compojure.core :refer :all] | |
[compojure.route :as route] | |
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]) | |
(:use [ring.adapter.jetty])) | |
(defroutes app-routes | |
(GET "/" [] "Salut Billy") | |
(route/not-found "Not Found")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vidal.pmsi.data; | |
import java.util.HashSet; | |
import java.util.Set; | |
import org.apache.jena.riot.RDFDataMgr; | |
import org.apache.jena.riot.RDFFormat; | |
import org.junit.Test; | |
import com.hp.hpl.jena.rdf.model.Model; | |
import com.hp.hpl.jena.rdf.model.ModelFactory; | |
import com.hp.hpl.jena.rdf.model.Resource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Buckethead - Soothsayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol ConsistentHashRing | |
(add-node [this node] "add node to the ring") | |
(remove-node [this node] "remove node and its replicas of the ring") | |
(find-node [this data] "find the node responsible of data")) | |
(defn- find-closest-key [xs h] | |
(or (first (drop-while #(> h %) xs)) | |
(first xs))) | |
(extend-protocol ConsistentHashRing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <signal.h> | |
void infinite_loop(int signum) { | |
printf("in loop"); | |
//signal(5, infinite_loop); | |
__asm__("int3"); | |
} | |
int main(int argc, char ** argv) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/ptrace.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <signal.h> | |
#include <sys/user.h> | |
#include <sys/reg.h> | |
void fizzbuzz() { |