Skip to content

Instantly share code, notes, and snippets.

View amillert's full-sized avatar
🍜

Albert Millert amillert

🍜
  • web
View GitHub Profile
@amillert
amillert / para.sh
Created March 15, 2021 17:00
Use to repetitively allocate resources and execute jobs on Grid5k server with (e.g.) different input files run like: `./para.sh <files in parallel> <walltime> <script as string can contain its arguments>` using `runner.sh` script
i=0
for file in $(ls ~/files/); do
if [ $(( $i % $1 )) -eq 0 ]; then
wait
fi
~/runner.sh $2 $3 &
i=$(( i + 1 ))
done
@amillert
amillert / TriePreorder.scala
Created February 1, 2021 21:18
Trie preorder traversal using foldLeft (Trie)
sealed trait Trie[+A]
case class Node[+A](key: A, kids: List[Trie[A]]) extends Trie[A]
case class Leaf[A](key: A) extends Trie[A]
object TriePreorder extends App {
val trie = Node("c", List(
Node("a", List(
Leaf("r"),
Leaf("t"))),
@amillert
amillert / auto_formants_extraction.praat
Created January 4, 2021 23:08
Simple Praat (doing phonetics by computer)
# To run:
# 1) Open Praat
# 2) Click Praat
# 2.1.1) Click-> New Praat script
# 2.1.2) Paste code
# 2.2.1) Click -> Open Praat script...
# 2.2.2) Select file
# 2.3) Run -> Run
# Given vowels phonemes are in tier 2:
@amillert
amillert / challenge1.scala
Created November 24, 2020 14:08
Category Theory for Programmers (Scala) - Bartosz Milewski; Challenges 1
def identity[A]: A => A = a => a
def compose[A,B,C](x: A)(f: A => B)(g: B => C): C = g(f(x))
def compose2[A,B,C] = (x: A) => (f: A => B) => (g: B => C) => g(f(x))
val inc: Int => Int = (x: Int) => x + 1
assert(compose(12)(identity)(inc) equals compose(12)(inc)(identity))
assert(compose2(12)(identity)(inc) equals compose2(12)(inc)(identity))