Skip to content

Instantly share code, notes, and snippets.

View jangler's full-sized avatar

Casey Mulcahy jangler

View GitHub Profile
#!/usr/bin/env python
"""
it2fss.py, version 0.2
----------------------
Python 3 only.
This script converts single-channel Impulse Tracker module into a FSS text file
for use with fsound.exe. No effects commands are supported. Needless to say,
@jangler
jangler / plugbot.rb
Last active August 29, 2015 13:56
extensible IRC bot (requires suckless.org sic)
#!/usr/bin/env ruby
# vim:sw=2
# IRC bot (requires suckless.org sic).
# Each executable file in the current directory is treated as a command
# plugin for the bot, and is executed when a command corresponding to its
# filename is called. For example, a plugin with filename "greet" would be
# invoked via the command "!greet".
@jangler
jangler / itsynth.py
Created February 21, 2014 05:07
IT module-based custom synth renderer
#!/usr/bin/env python
"""
Program that renders a WAV file by converting IT pattern data into a
playback routine for an imaginary sound chip.
"""
import operator
import wave
@jangler
jangler / search.go
Created February 21, 2014 05:04
simple regex-based recursive filename search
package main
import (
"io/ioutil"
"os"
"path"
"regexp"
)
func handle(err error) {
@jangler
jangler / anagrap.py
Created February 21, 2014 04:57
anagram game IRC bot
#!/usr/bin/env python
"""
Anagram game IRC bot.
Requires http://tools.suckless.org/sic.
Public commands:
- !start
- !score [NICK]
@jangler
jangler / midimck.rb
Created June 29, 2013 21:35
Compiles MML to MIDI
require_relative 'midifile'
TicksPerQuarter = 32
NoteOffsets = { 'c' => 0, 'd' => 2, 'e' => 4, 'f' => 5, 'g' => 7, 'a' => 9, 'b' => 11 }
class Track
attr_reader :delay, :octave, :note, :velocity, :bytes, :default_delay
attr_writer :delay, :octave, :note, :velocity, :bytes, :default_delay
def initialize()
@delay = 0
@jangler
jangler / midifile.rb
Last active December 19, 2015 03:39
Rudimentary MIDI file writing code in Ruby
SingleTrack = 0
MultipleTracksSync = 1
MultipleTracksAsync = 2
class Event
attr_reader :command_byte, :num_data_bytes
def initialize(command_byte, num_data_bytes)
@command_byte = command_byte
@num_data_bytes = num_data_bytes
end
@jangler
jangler / tag.py
Last active August 13, 2020 16:55
CLI python2 / mutagen audio tag editor
#!/usr/bin/env python2
from argparse import ArgumentParser
from sys import stderr
import mutagen
def get_args():
parser = ArgumentParser(description='view and edit audio tags')
parser.add_argument('-t', '--title', type=str, help='set title')
@jangler
jangler / modfile.py
Created October 4, 2012 19:55
Amiga module reader
#!/usr/bin/env python
periods = (
1712,1616,1525,1440,1357,1281,1209,1141,1077,1017, 961, 907,
856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453,
428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226,
214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113,
107, 101, 95, 90, 85, 80, 76, 71, 67, 64, 60, 57
)
@jangler
jangler / ascii.c
Created August 9, 2012 21:44
idiotically simple ncurses ascii art program
// Controls:
// - Arrow keys - move cursor
// - Esc - toggle reprint of last character on movement
// - ^C - exit program, printing the screen to standard output
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ncurses.h>