Skip to content

Instantly share code, notes, and snippets.

Tristram Oaten 0atman

View GitHub Profile
0atman / stillalive.nim
Last active Jun 20, 2020
The code for my video cover of Jonathan Coulton's "Want You Gone" here
View stillalive.nim
import strutils
import terminal
import autotyperpkg/typer
const lyrics = """
0#Forms FORM-29827201#
0#Test Assessment Report
This was a triumph.
I'm making a note here:
0atman / wantyougone.nim
Last active Jun 6, 2020
The code from my music video, "Want You Gone", available here
View wantyougone.nim
import strutils
import autotyperpkg/typer
const lyrics = """
Forms FORM-29827281-12-2:
Notice of Dismissal
Well here we are again
It's always such a pleasure
Remember when you tried

The Bloglist Manefesto

  • Anonymous and protected forever
  • Create account with just an email
  • Privacy protection baked in from the start
  • Hosted in a freedom-protecting country
  • Partner with EFF or similar
  • Back up forever
  • Profitable
$ cat hello.nim
echo "hello world"
$ nim c -d:mingw hello.nim
Hint: used config file '/home/oatman/.choosenim/toolchains/nim-1.2.0/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: hello [Processing]
Hint: [Link]
0atman / metronome.rb
Created May 5, 2020
Simple sonic pi metronome
View metronome.rb
live_loop :metronome do
cue tick
128.times do
t = tick
bar = ((t - 1) / 4) + 1
beat = (t - 4 * bar) + 4
cue String(bar) + "/" + String(beat)
sleep 1
0atman /
Created May 2, 2020
An install script for sonic-pi on ubuntu 20.04
#!/usr/bin/env bash
echo "Sonic-pi will be installed into ./sonic-pi. Press enter to continue, ctrl-c to abort."
read input
sudo apt-get install ruby erlang-base libscsynth1 sc3-plugins libjack-jackd2-0 qt5-default libffi7 git cmake build-essential ruby-dev libqt5svg5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev libqt5webkit5-dev qtpositioning5-dev libqt5sensors5-dev libqt5opengl5-dev qtmultimedia5-dev libffi-dev libjack-jackd2-dev libxt-dev libudev-dev libboost-dev libasound2-dev libavahi-client-dev libicu-dev libreadline6-dev libfftw3-dev libaubio5
git clone
cd sonic-pi/app/gui/qt
./ --build-aubio
0atman / Makefile
Last active Apr 20, 2020
Full-stack, pure Nim. Backend and JS using the same staticly-typed model.
View Makefile
nim c app.nim
rm app
0atman / fibber.nim
Last active Apr 12, 2020
IMO Nim is an advanced, complied superset of python
View fibber.nim
import math, strformat, times
func fib(n: int): int =
if n <= 2:
return 1
return fib(n - 1) + fib(n - 2)
when isMainModule:
let x = 47
0atman / side-effects.nim
Last active May 21, 2020
Example of how nim siloes side-effecting code
View side-effects.nim
import httpClient
import strutils
func protocol(url: string): bool = ## ok, pure function
return "http://" in url
func get(url: string): string = ## side-effects.nim(7, 6) Error: 'get' can have side effects
if protocol url:
return newHttpClient().getContent(url)
0atman / hw.hs
Created Mar 11, 2020
A starter stack script, with RIO, example command useage and sensible defaults
View hw.hs
#!/usr/bin/env stack
{- stack
--resolver lts-15.1
--ghc-options -Wall
--ghc-options -Werror
--package rio
--package process
You can’t perform that action at this time.