Skip to content

Instantly share code, notes, and snippets.

View MegaLoler's full-sized avatar

Aardbei MegaLoler

View GitHub Profile
@MegaLoler
MegaLoler / boxgen.py
Created October 21, 2019 21:05
generates animation frames as svgs for a praticular animation
#!/usr/bin/env python3
import cairo
import numpy as np
def project(point, fov):
x, y, z = point[0:3]
d = z*fov+1
return x/d, y/d
@MegaLoler
MegaLoler / backlight.sh
Created September 23, 2019 21:42
a stupid backlight setter for no reason
#!/bin/bash
DEVICE_PATH=/sys/class/backlight/intel_backlight
function get_max {
cat "$DEVICE_PATH/max_brightness"
}
function getv {
cat "$DEVICE_PATH/brightness"
@MegaLoler
MegaLoler / Assembly Tutorial.md
Last active February 24, 2024 21:57
A tutorial for the Simple 8-bit Assembler Simulator in Javascript

Assembly Programming

Hello! This is a tutorial for the Simple 8-bit Assembler Simulator in Javascript.

CPU

The CPU has a few pieces of memory stored inside of it called registers. In this case, these registers hold a single byte (8 bits) of memory. So at any given time each of these 8-bit registers hold a single value from 0 to 255, or $00 to $FF in hexidecimal.

Registers

@MegaLoler
MegaLoler / mercury-review.md
Created April 30, 2019 19:29
A "code review" of fouric's Mercury project!

Mego's code review of Mercury 2019-4-30

I'll read through each file and write verbose live comments in hopes to provide some insight as to what might be going on in somebody's head while reading through it! (Although I'm just one person, and I don't read through others' code that much, and I've never done a "code review" like this before, anddddd I'm sure you know more CL than I do, so with all that in mind, of course take it all with a grain of salt XD)

Also keep in mind that this is very much a "speak before you think" scenario, in order to show you what's going on in my head, so much of what I say will be ininformed at first, and then gradually become more informed. You might want to read the conclusion first, to see what my final and more refined thougths are before delving into my completely unrefined thoughts! :D

After reading each file, I'll write a short summary of my thoughts after having read the whole thing. And finally, after I've read through all of the code, I'll write a short summary

@MegaLoler
MegaLoler / tagspec.md
Last active January 24, 2019 23:58
spec for a declarative tagging and correlation language to embed in text files

syntax

  • a tag expression is delimited initially by # and finally by whitespace
  • tags are alphanumeric strings that can also contain -
  • lists are sequences of tags conjoined by ,
  • a lone , denotes an empty list
  • a list can only contain tags and not other lists
  • a tag cannot exist by itself; a single tag implies a list of 1 item
  • a correlation is a pair of lists conjoined by :
  • a chained correlation is a correlation followed by a : followed by a list
@MegaLoler
MegaLoler / fridgebot.py
Last active February 7, 2019 03:24
a fresh new fridge bot for negative nancy server
#!/usr/bin/env python3
'''
hello, this is fridge bot for the negative nancy server : )
todo:
- linguitic fixes
- that includes quantification
- server settings?
- per server global command handlers
@MegaLoler
MegaLoler / jppollysubs.py
Last active December 31, 2018 05:59
Use romaji.me to add interlinear romanization to Japanese .srt files
#!/bin/env python3
# script to do tts using amazon polly for every line in a japanese .srt file
# does both slow and normal speed
import os
import sys
def tts(text, outfile, rate="medium", voice="Mizuki"):
# warning not sanitized!!!!
@MegaLoler
MegaLoler / mkgb
Created March 28, 2018 08:48
mkgb
#!/bin/env bash
# efforts in trying to get xmpck to work
# installed openeuphoria, had to use the intepretter (eui)
# had to lowercase some filenames, and adapt .bat scripts to .sh
# and of course, install wla-gb, and had to adjust the cli arguments
set -e
xpmc -gbc $1 gbmusic.asm
@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)
@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?