Skip to content

Instantly share code, notes, and snippets.

View intv0id's full-sized avatar
👾

Clément Trassoudaine intv0id

👾
View GitHub Profile
type ordinals = Left | Right | Up | Down;;
let concat x y = x::y ;;
let rec map f l = match l with
| [] -> []
| a::b -> f(a)::(map f b)
;;
let rec filter f l = match l with
let rec combinations_tail f k m prefix = match k, m with
| a, b when a < 0 || b < 0 -> failwith "ki or mi negative"
| a, b when a > b -> failwith "k > m"
| 0, 0 -> if f (Array.of_list prefix) then [prefix] else []
| 0, b -> combinations_tail f 0 (b-1) (false::prefix)
| a, b when a = b -> combinations_tail f (a-1) (b-1) (true::prefix)
| a, b -> (combinations_tail f (a-1) (b-1) (true::prefix)) @ (combinations_tail f a (b-1) (false::prefix))
;;
let generate_tail m n =
let rec combinations k m = match k, m with
| k, m when k < 0 || m < 0 -> failwith "ki or mi negative"
| k, m when k > m -> failwith "k > m"
| 0, 0 -> [[]]
| 0, m -> map (concat false) (combinations 0 (m-1))
| k, m when k = m -> map (concat true) (combinations (k-1) (m-1))
| k, m -> map (concat true) (combinations (k-1) (m-1)) @ map (concat false) (combinations k (m-1))
;;
let generate m n =
var onEnter, onExit, $d, hovered;
$d = $('.label');
$d.hide();
//hovered = jgraph.makeMaterial(0xffffff);
onEnter = function (node) {
$d.html('<p><b>' + node.name + '</b></p><br><p>' + node.label + '</p>');
$d.show();
node.defaultMaterial = node.material;
node.material = hovered;
};
@intv0id
intv0id / snippet.js
Created March 14, 2018 12:52
[Download Humble Bundle] #HumbleBundle
$('a').each(function(i){
if ($.trim($(this).text()) == 'EPUB') { //Change EPUB to whatever you want
$(this).click();
}
});
@intv0id
intv0id / snippet.py
Last active November 25, 2017 23:44
[Ipython parallel] #Python #Jupyter #Notebook
import ipyparallel as ipp
c = ipp.Client()
c.ids
c[:].apply_sync(lambda : "Hello, World")
@intv0id
intv0id / snippet.sh
Created October 27, 2017 14:03
[Secure Wipe an USB Key] Needs to be updated #To_improve
#!/bin/bash
for n in `seq 7`;
do dd if=/dev/urandom of=/dev/sda bs=8b conv=notrunc;
done
&&
dd if=/dev/zero of=/dev/sda bs=8b &
disown;
@intv0id
intv0id / snippet.tex
Last active October 27, 2017 13:59
[Defining Commands in LaTeX] #Commands #LaTeX
%VARS
\def\Variable{Content}
%FUNCS
\newcommand{\Command1}{Contenu}
\newcommand{\Command2}[NbVar]{#1 #2 #3}
%USE CASE
\Variable
\Command1
\Command2{x}{y}{z}
@intv0id
intv0id / snippet.py
Last active October 27, 2017 13:42
[Data mining] An example script for data mining with BeautifulSoup in Python #BeautifulSoup #Urllib #Python
#!/bin/env python3
#! encoding: utf-8
import urllib.requests as ul2
from bs4 import BeautifulSoup