Skip to content

Instantly share code, notes, and snippets.

View 0atman's full-sized avatar
🦀
Oxidising

Tristram Oaten 0atman

🦀
Oxidising
View GitHub Profile
@0atman
0atman / Makefile
Last active February 27, 2023 19:41
Full-stack, pure Nim. Backend and JS using the same staticly-typed model.
app:
nim c app.nim
clean:
rm app
run:
./app
use rand_derive2::RandGen;
use rand::random;
fn main() {
println!("Hey, world! 👻 3spoopy5me");
let some_rooms: Vec<Room> = (1..=5)
.map(|n| Room {name: "empty room".into(), next_room: vec![], item: random()})
.collect();
let room = Room {
@0atman
0atman / rust-perfect.md
Created May 19, 2022 16:52
The sourcecode to my Rust Perfect presentation (available here https://www.youtube.com/watch?v=IA4q0lzmyfM)

Rust

Your code can be perfect

%% As developers we build critical infrastructure, it's time to build it in a language designed to build critical infrastructure. %%

@0atman
0atman / Makefile
Last active March 7, 2022 14:58
Sensible python defaults in 2022
default: lints run
run:
@poetry run python app.py
watch:
@poetry run watchmedo auto-restart --ignore-directories --patterns="*.py" --ignore-patterns="*#*" --recursive make
lints:
clear
@0atman
0atman / install-sonic-pi-ubuntu-20-04.sh
Created May 2, 2020 11:58
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 https://github.com/samaaron/sonic-pi.git
cd sonic-pi/app/gui/qt
./unix-prebuild.sh --build-aubio
./unix-config.sh
@0atman
0atman / lit.md
Last active September 4, 2021 19:35
Native literate programming in python through doctests. This is either the best or the worst thing I have ever written.

Imports

First the imports, this demo requires the flask_restful package. Then we set up the Flask wsgi application object, app and the api wrapper, api.

>>> from flask import Flask
>>> from flask_restful import Resource, Api

>>> app = Flask(__name__)
&gt;&gt;&gt; api = Api(app)
@0atman
0atman / markup-example.rs
Last active April 3, 2021 10:01
markup.rs is pug with brackets
html {
head {
title { "example.com" }
style {
"body { background: #fafbfc; }"
"#main { padding: 2rem; }"
}
}
body {
@Header { "example.com" }
/*******************************************************************
A telegram bot for your Adafruit Feather M0 with KeyboardFeatherWing
Adapted from telegram code written by Brian Lough
*******************************************************************/
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <WiFi101.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
@0atman
0atman / static-json.py
Created July 3, 2013 15:52
Simple flask-restful GET json stub
from flask import Flask
from flask.ext.restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class SimpleRest(Resource):
def get(self):
return {
@0atman
0atman / main.rs
Last active January 15, 2021 10:19
Simple C programming bootstrap file in Rust
#![feature(start, libc, lang_items)]
#![no_std]
#![no_main]
#![feature(rustc_private)]
extern crate libc;
extern { // A list of imported C functions
pub fn printf(format: *const u8, ...) -> i32;
}