Skip to content

Instantly share code, notes, and snippets.

View eparadis's full-sized avatar
💭
getting things done

Ed Paradis eparadis

💭
getting things done
View GitHub Profile
@eparadis
eparadis / fractal_tree_2.py
Created January 25, 2015 23:02
draw a fractal tree in Pythonista for iOS
import canvas
import math
branches_drawn = 0
def along( start, direction, fraction):
'''return a start point fraction amount in direction'''
newstart = ( start[0] + fraction * direction[0] * math.sin(direction[1]),
start[1] + fraction * direction[0] * math.cos(direction[1]) )
return newstart
@eparadis
eparadis / tracking-lookup-table-creating-code.md
Created June 10, 2017 08:18
Ginko Synthese Grains eurorack module 1v/oct lookup table generator (originally http://www.ginkosynthese.com/uploads/tracking-lookup-table-creating-code.doc)

The code below is written in C++ to create a lookup table for the grains for 1V/oct tracking

based on a linear PWM frequency of 31.25KHz, 32.70 is choosen as lowest frequency (C), 65536=2^16 is max pulsewidth on 31.25KHz, pow(x,y) is x^y pow(2,f) creates the exponential value of 0V to 5V in 1024 steps pow(2,0) = 1 generates a value of 32.50Hz pow(2,1) = 2 generates 32.50 * 2 = 65 Hz etc.

@eparadis
eparadis / mandel.bas
Last active January 12, 2022 04:46
ascii art mandelbrot drawing program in BASIC
10 x1=59
11 y1=21
20 i1=-1.0
21 i2=1.0
22 r1=-2.0
23 r2=1.0
30 s1=(r2-r1)/x1
31 s2=(i2-i1)/y1
40 for y=0 to y1
50 i3=i1+s2*y
@eparadis
eparadis / extensible_basic.md
Last active May 15, 2021 05:11
A modified BASIC designed to support language extensions

Extensible BASIC

A modified BASIC designed to support language extensions

6/12/2019

The common BASIC dialect on home computers of the 1970s and 1980s is Microsoft BASIC 4.7 or very similar. Generally speaking, the dialect supports a single user-defined FCN() which allows for a user defined expression with a single input parameter. Occasionally it will support machine-code methods with USR().

@eparadis
eparadis / hexdump.bas
Last active June 26, 2019 07:30
formatted hex dump of an area of memory in BASIC
5 INPUT "offset (dec) "; F
10 FOR I = 0 TO 255 STEP 16
11 IF I+F<16 THEN PRINT "0";
12 IF I+F<256 THEN PRINT "0";
13 IF I+F<4096 THEN PRINT "0";
15 PRINT HEX$(I+F);" ";
20 FOR J = 0 TO 15
25 V = PEEK(I+J+F)
27 IF V < 16 THEN PRINT "0";
30 PRINT HEX$(V);
@eparadis
eparadis / sector_forth_boot.f
Created October 15, 2021 00:22
All the examples from sector forth concatenated, trimmed, and immediate executions removed. The idea is that this is what you would provide to get a running system
: dup sp@ @ ;
: -1 dup dup nand dup dup nand nand ;
: 0 -1 dup nand ;
: 1 -1 dup + dup nand ;
: 2 1 1 + ;
: 4 2 2 + ;
: 6 2 4 + ;
: invert dup nand ;
: and nand invert ;
: negate invert 1 + ;
@eparadis
eparadis / meeting_countdown.sh
Created October 18, 2021 19:23
a script that writes to a text file that you can use in OBS for an on-screen meeting timer
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Usage: ./meeting_countdown.sh NUM_MINS"
exit 1
fi
MINS=$1
OUTFILE=~/src/obs/timer_out.txt
MESSAGE="time remaining in this meeting: "
@eparadis
eparadis / cpu_foo.c
Last active October 22, 2021 01:04
sketch of a 8 bit cpu simulator/emulator
#include <stdint.h>
#include <stdio.h>
typedef uint8_t FLAG;
typedef uint8_t INSTR;
typedef uint8_t REGISTER;
typedef uint16_t IP;
const FLAG FLAG_HALT = 0x80;
const INSTR INSTR_LOAD = 0x08;
@eparadis
eparadis / switch_composite.sh
Created October 27, 2021 00:54
script to switch to composite output on the NTC PocketCHIP
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/chip/.Xauthority
C=`xrandr | grep 480x272 | grep "*"`
if [ "$C" = "" ]; then :
echo "composite active, switch back"
xrandr --output Composite-1 --off
xrandr --output None-1 --mode 480x272
else :
echo "display active, switching to composite"
Vendor Title Support Status
ECHO AudioFire Pre8 Community Support
M-Audio Ozonic Community Support
M-Audio FireWire Solo Community Support
MOTU Traveler Community Support
Yamaha GO46 Community Support
Yamaha GO44 Community Support
Focusrite Saffire PRO 24 Experimental
Focusrite Saffire Pro 14 Experimental
iCON FireXon Experimental