Skip to content

Instantly share code, notes, and snippets.

View jprudent's full-sized avatar
🦋
Chasing butterflies

Jérôme Prudent jprudent

🦋
Chasing butterflies
View GitHub Profile
@jprudent
jprudent / ptrace_ex_6.c
Created June 25, 2016 11:35
ptrace ex 6
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <sys/user.h>
#include <sys/reg.h>
@jprudent
jprudent / ptrace_ex5.c
Created June 25, 2016 11:33
ptrace ex 5
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <sys/user.h>
#include <sys/reg.h>
@jprudent
jprudent / ptrace_ex4.c
Created June 25, 2016 11:32
ptrace ex 4
#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) {
@jprudent
jprudent / ptrace_ext3.c
Created June 25, 2016 11:29
ptrace ex 3
#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() {
#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) {
@jprudent
jprudent / consistent-hashing.clj
Created January 12, 2016 12:00
A simple implementation of consitant hashing in Clojure
(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
Buckethead - Soothsayer
@jprudent
jprudent / LearnJenaTest.java
Created November 30, 2015 17:05
Extract model
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;
(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"))
@jprudent
jprudent / gist:ce1e06377784c88763d1
Created July 4, 2015 19:50
ISO 8601 duration regexp
(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))$")