Skip to content

Instantly share code, notes, and snippets.

View basile-henry's full-sized avatar

Basile Henry basile-henry

View GitHub Profile
❯ ./twitter_wordle.py
#Wordle 215 3/6
⬛⬛⬛⬛🟩
🟨⬛⬛⬛🟩
🟩🟩🟩🟩🟩
Lucky third guess
Day 215: 2266 candidates left
@basile-henry
basile-henry / r13y.sh
Created November 21, 2020 15:43
Quickly check if a derivation is reproducible
#! /usr/bin/env nix-shell
#! nix-shell -i bash --pure -p diffoscope nix
# shellcheck shell=bash
set -eo pipefail
if [[ -z "$1" ]]; then
cat <<EOF
usage:
./r13y.sh -A some.attribute
~/hash-test
➜ curl -L https://github.com/dhall-lang/dhall-haskell/releases/download/1.35.0/dhall-1.35.0-x86_64-linux.tar.bz2 --output dhall-original.tar.bz2 2>/dev/null
~/hash-test took 12s706ms
➜ mkdir dhall # create a directory to unpack into
~/hash-test
➜ (cd dhall && tar xvjf ../dhall-original.tar.bz2)
./
./bin/
@basile-henry
basile-henry / snake.py
Created March 7, 2020 14:27
Snake MicroBit
# Add your Python code here. E.g.
from microbit import *
import random
def create_dots(dots):
s = ""
for y in range(5):
for x in range(5):
if (x, y) in dots:
➜ ghc -ddump-simpl Test.hs
[1 of 1] Compiling Main ( Test.hs, Test.o )
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 23, types: 12, coercions: 0, joins: 0/0}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$trModule1_r1Eb :: GHC.Prim.Addr#
[GblId, Caf=NoCafRefs]
import Data.List
conv :: [Int] -> [Int]
conv = concat . f
where f [] = []
f (x:xs) = map (x+) xs : f xs
inverseConv :: [Int] -> [Int]
inverseConv xs
| d == fromIntegral (round d) = inverseF $ inverseConcat n xs
@basile-henry
basile-henry / insert-sort-steps.hs
Created March 26, 2017 18:29
Little code review for mojjo
-- This program genereates all computation steps that the
-- imperative algorithm InserSort would take while sorting a list.
-- The output might be further used for vizualizations of the
-- alorithm behavior.
-- Example usage:
-- insertSortSteps [3,2,1]
-- Result:
-- [Step {i = 0, j = 1, xs = [3,2,1]},
@basile-henry
basile-henry / Challenge output
Last active February 10, 2017 17:21
DailyProgrammer -- 302 [Hard] ASCII Histogram Maker: Part 2
100
99
98
97
96
95
94
93
92
@basile-henry
basile-henry / Main.hs
Created February 3, 2017 14:48
DailyProgrammer -- 301 [Hard] Guitar Tablature
-- stack exec -- ghc -O2 Main.hs
-- cat input1.txt | ./Main --sound | aplay
module Main where
import Control.Applicative
import Data.List
import Data.Maybe
import Data.WAVE
import Notes