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
var myNamespace = (function () { | |
var myPrivateVar, myPrivateMethod; | |
// A private counter variable | |
myPrivateVar = 0; | |
// A private function which logs any arguments | |
myPrivateMethod = function( foo ) { | |
console.log( foo ); |
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
import fr.pmu.commons.spring.SpringBuilder; | |
import org.junit.*; | |
import org.junit.Test; | |
import org.springframework.beans.factory.config.AutowireCapableBeanFactory; | |
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.scheduling.annotation.Async; | |
import org.springframework.scheduling.annotation.EnableAsync; | |
import org.springframework.scheduling.annotation.EnableScheduling; | |
import org.springframework.stereotype.Service; |
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
;; Anything you type in here will be executed | |
;; immediately with the results shown on the | |
;; right. | |
(use 'clojure.test) | |
(with-test | |
(defn extract-scheme | |
"extract scheme from url" |
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 minus [v1 v2] | |
"substract 2 vectors, v2 must be a subset of v1" | |
(reduce (fn [acc v] | |
(let [index (.indexOf acc v)] | |
(into (subvec acc 0 index) (subvec acc (inc index))))) v1 v2)) | |
(minus [:c :a :b :b :a :a :b] [:a :a :b :a]) ; [:c :b :b] |
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
(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> | |
int waitchild(pid_t pid) { |