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 / rust-research.org
Last active November 3, 2020 09:09
Noodling with rust, with rustic-babel

Rust Research

org-babel

Include crates with :crates '((regex . 0.2)) syntax. However there is a bug in org-babel that only lets you use decimal versions, not semver. Shave off the bugfix suffix. I opened an issue here brotzeit/rustic#176 with a PR to fix here brotzeit/rustic#180

extern crate regex;
@0atman
0atman / hello.py
Created September 14, 2020 11:47
testing github api
print("hello")
@0atman
0atman / Dockerfile
Created September 14, 2020 08:22
multi-stage docker file for building bare-metal, tiny, rust containers
# Build Stage #
FROM rust:1.40.0 AS builder
WORKDIR /usr/src/
RUN rustup install nightly
RUN rustup default nightly
RUN rustup target add x86_64-unknown-linux-musl
RUN USER=root cargo new app
WORKDIR /usr/src/app
@0atman
0atman / pyinstaller.sh
Created September 2, 2020 14:35
pyinstaller works well!
λ python hello.py
hi
λ pyinstaller hello.py
18 INFO: PyInstaller: 4.0
18 INFO: Python: 3.8.2
24 INFO: Platform: Linux-5.4.0-45-generic-x86_64-with-glibc2.29
24 INFO: wrote /home/oatman/projects/pyinsttest/hello.spec
26 INFO: UPX is available.
@0atman
0atman / stillalive.nim
Last active June 20, 2020 16:05
The code for my video cover of Jonathan Coulton's "Want You Gone" here https://youtu.be/k6giW_6_bFY
import strutils
import terminal
import autotyperpkg/typer
const lyrics = """
1#
0#Forms FORM-29827201#
0#Test Assessment Report
This was a triumph.
I'm making a note here:
@0atman
0atman / wantyougone.nim
Last active June 6, 2020 18:52
The code from my music video, "Want You Gone", available here https://youtu.be/zvLGFe_8yWU
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
@0atman
0atman / side-effects.nim
Last active May 21, 2020 08:40
Example of how nim siloes side-effecting code
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)

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
0atman / metronome.rb
Created May 5, 2020 07:06
Simple sonic pi metronome
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
end
end