Skip to content

Instantly share code, notes, and snippets.

View MegaLoler's full-sized avatar

Aardbei MegaLoler

View GitHub Profile
@MegaLoler
MegaLoler / parallel.scpt
Created July 30, 2017 04:34
An applescript that uses text-to-speech to read parallel texts to you line by line
-- Choose some line-aligned text files to read line by line
-- For exmaple, the first one in German, the second one in Dutch, and the third in English
-- The lines of the first file will be read aloud using text-to-speech
set srcFiles to {}
set fileLns to {}
repeat
set srcFile to (choose file with prompt ("L" & (length of srcFiles) + 1)) as text
copy srcFile to end of srcFiles
copy paragraphs of (read file srcFile as «class utf8») to end of fileLns
@MegaLoler
MegaLoler / vuby.html
Created September 3, 2017 00:19
Bouncing point mass structures on springs in a 3d tunnel
<html>
<head>
<title>Bouncing Vubes are Godo</title>
<style>
#id
{
padding: 0px;
margin: 0px;
border: 0px;
@MegaLoler
MegaLoler / marble.html
Created September 3, 2017 00:21
Ball physics with a tile map!
<html>
<head>
<title>Marb Maze Yo</title>
<style>
#id
{
padding: 0px;
margin: 0px;
border: 0px;
@MegaLoler
MegaLoler / subtitlestudier.py
Created September 3, 2017 00:24
Tools for interactively studying languages with .srt subtitle files or .csv files from Tatoeba
#!/usr/bin/python3
from subprocess import Popen
import os
import sys
import time
import random
import requests
import urllib.parse
import re
@MegaLoler
MegaLoler / launchseq.c
Created September 3, 2017 00:31
A live midi sequencer for the Launchkey Mini!
// by megaloler! ([email protected])
// a custom 100% midi-controlled live loop-based sequencer for the launchkey mini!
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <alsa/asoundlib.h>
#define ALSA_CLIENT_NAME "LaunchSEQ"
@MegaLoler
MegaLoler / avr_softsynth.asm
Created September 3, 2017 00:34
A 4 channel softsynth for AVR and a tracker in C that communicates with it over serial
.define NOTE_C 262
.define NOTE_Cs 277
.define NOTE_D 294
.define NOTE_Ds 311
.define NOTE_E 330
.define NOTE_F 349
.define NOTE_Fs 370
.define NOTE_G 392
.define NOTE_Gs 415
.define NOTE_A 440
@MegaLoler
MegaLoler / sub-eval.scm
Created October 29, 2017 10:17
trying out a bidirectional nondeterministic substitution evaluator
;; todo: variable constrainns throughout whole sub-eval
;; avoid infinite wildcard vars!!
;; figure out the perfect eval order...
;; how to handle infinite recursive rules?
;; inductive programming ? ?
;; return possible evaluations by substitution of expression according to rules
(define (sub-eval expression rules direction)
(let ((subs (sub expression rules direction)))
(if (not (null? subs))
@MegaLoler
MegaLoler / dsp.scm
Last active November 18, 2017 19:12
playing with audio processing in scheme
#!/usr/bin/chibi-scheme
(import (scheme r5rs)
(scheme base)
(chibi io))
; plot function f
; start with x = start
; get next value by applying function next-f to value
; for number of samples
; output vector vec
@MegaLoler
MegaLoler / subcleaner.lisp
Last active January 16, 2018 09:34
A little script written in Common Lisp to clean up .srt files.
#!/usr/bin/sbcl --script
;; a simple script to clean up .srt files
;; - removes html and other formatting
;; - removes duplicate segments (after removing formatting)
;; - merges consecutive segments with same start time
;;
;; usage: ./subcleaner.lisp < input.srt > output.srt
;;
;; todo:
;; - handle entries with double new lines?
@MegaLoler
MegaLoler / memrise.lisp
Last active January 18, 2018 08:44
Scrape Japanese Memrise course edit page html for items and audio
#!/usr/bin/sbcl --script
;; a simple script to scrape the html of a japanese memrise course edit page
;; change the main function at the very bottom to select output type
;; - main: outputs .tsv
;; - main-2: outputs .html
;; - main-3: outputs list of audio links
;; - main-4: outputs .tsv with audio links formatted for anki (and urls converted to sound file names, so download the audio files and put them in your anki media folder)
;; usage: ./memrise.lisp < memrise.html > output_file
(defun split-with-subseq (seq subseq)