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
// ES6 version using asynchronous iterators, compatible with node v10.0+ | |
const fs = require("fs"); | |
const path = require("path"); | |
async function* walk(dir) { | |
for await (const d of await fs.promises.opendir(dir)) { | |
const entry = path.join(dir, d.name); | |
if (d.isDirectory()) yield* walk(entry); | |
else if (d.isFile()) yield entry; |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf8" /> | |
<title>Canvascolor</title> | |
<style> | |
body { | |
background-image:url(http://github.com/favicon.ico); /*Just for fun*/ | |
} | |
main { |
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
/** pe | |
* @argument f: the multiple-argument function to turn into a partially-evaluatable | |
* @returns : A single-argument function that applies its argument as the first argument of f, and returns the partially-evaluated function | |
* @exemple: pe((a,b)=>a+b)(9)(1) === 10 | |
*/ | |
function pe(f, context, args) { | |
if(!args) args = []; | |
if (args.length === f.length) return f.apply(context, args); | |
return function partial (a) { | |
var args_copy = args.concat.apply(args, arguments); |
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
#!/usr/bin/env bash | |
# Dichotomic search in bash | |
# This is a bash-specific function that uses bash features. | |
# This is not guaranteed to work in other shells. | |
# | |
# Usage: | |
# source dichotomic-bash.sh | |
# result=$(dichotomic_search min max command) | |
# | |
# Returns the largest i for which `command i` succeeds (exits with a null exit code) |
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 board | |
import busio | |
from adafruit_mcp230xx.mcp23017 import MCP23017 | |
import time | |
from typing import List, Tuple | |
i2c = busio.I2C(board.SCL, board.SDA) | |
mcp = MCP23017(i2c, address=0x27) | |
NOMBRE_POMPES = 16 |
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 main | |
import ( | |
"compress/gzip" | |
"context" | |
"encoding/json" | |
"fmt" | |
"io" | |
"log" | |
"os" |
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
man_1_preference_1 | man_1_preference_2 | man_2_preference_1 | man_2_preference_2 | woman_1_preference_1 | woman_1_preference_2 | woman_2_preference_1 | woman_2_preference_2 | woman_1_mariage | woman_2_mariage | ||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | ||
1 | 2 | 1 | 2 | 1 | 2 | 2 | 1 | 1 | 2 | ||
1 | 2 | 1 | 2 | 2 | 1 | 1 | 2 | 2 | 1 | ||
1 | 2 | 1 | 2 | 2 | 1 | 2 | 1 | 2 | 1 | ||
1 | 2 | 2 | 1 | 1 | 2 | 1 | 2 | 1 | 2 | ||
1 | 2 | 2 | 1 | 1 | 2 | 2 | 1 | 1 | 2 | ||
1 | 2 | 2 | 1 | 2 | 1 | 1 | 2 | 1 | 2 | ||
1 | 2 | 2 | 1 | 2 | 1 | 2 | 1 | 1 | 2 |
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
# My AES implementation | |
# By Daniel Miller | |
# Ported to python 3 by @lovasoa | |
def xor(s1, s2): | |
return bytes(a ^ b for a, b in zip(s1, s2)) | |
class AES(object): |
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
/*** | |
Tower of Hanoi solver. | |
https://en.wikipedia.org/wiki/Tower_of_Hanoi | |
Example : | |
``` | |
$ rustc hanoi.rs | |
$ ./hanoi 3 |
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
#[derive(Clone, Debug, PartialEq)] | |
struct B { | |
x: bool, | |
y: f64, | |
} | |
pub trait AutoVec { | |
type Vec; | |
} |
NewerOlder