Skip to content

Instantly share code, notes, and snippets.

View bluenote10's full-sized avatar

Fabian Keller bluenote10

  • Bosch
  • Ludwigsburg, Germany
View GitHub Profile
@bluenote10
bluenote10 / benchmark_delay_line.py
Last active February 27, 2023 14:38
Benchmark delay line
import os
import time
from contextlib import contextmanager
from pathlib import Path
from typing import List, Literal
import numba
import numba.cuda
import numpy as np
import tabulate
@bluenote10
bluenote10 / main.dart
Last active August 12, 2021 18:51
Flutter: Center Positioned
import "package:flutter/material.dart";
void main() {
runApp(App());
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@bluenote10
bluenote10 / plot_oscillations.py
Created December 7, 2020 08:37
ssqueezepy oscilattions
import numpy as np
import matplotlib.pyplot as plt
from ssqueezepy import ssq_cwt, cwt
SAMPLE_RATE = 44100
def sine(freq, num_samples=SAMPLE_RATE // 4, amp=1.0):
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8921bcc0302b066ef5e39bc6e9a8b7e3
#![allow(dead_code)]
use std::collections::HashMap;
struct Test {
offset: f64,
buffers: HashMap<i32, Vec<f64>>,
data: Vec<f64>,
@bluenote10
bluenote10 / flatmap.nim
Last active June 22, 2021 16:31
Flatmap
import future
import options
#[
proc flatMap[X](iter: iterator(): X, mapper: X -> iterator(): X): (iterator(): B) =
result = proc() =
yield X
proc iter(): int =
@bluenote10
bluenote10 / data1.csv
Created January 1, 2017 11:14
Issues with d3 tip
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
value
100
150
200
@bluenote10
bluenote10 / chantest.nim
Created August 30, 2015 09:47
Nim Channel Test
import os, threadpool
proc spawnBackgroundJob[T](channel: ptr Channel[T], f: iterator (): T) =
type Args = tuple[iter: iterator (): T, channel: ptr Channel[T]]
proc threadFunc(args: Args) {.thread.} =
echo "Thread is starting"
let iter = args.iter
var channel = args.channel # note: still a `ptr Channel`
@bluenote10
bluenote10 / stringParseTest.nim
Created May 13, 2015 10:21
MacroStringParseTest
macro stringParseTest(s: string): stmt =
let trueString = s.strVal
let ne = parseExpr(trueString)
let ns = parseStmt(trueString)
echo treeRepr(ne)
echo treeRepr(ns)
# looking good:
# Infix
# Ident !"+"
# Ident !"y"
@bluenote10
bluenote10 / nimrun
Last active August 29, 2015 14:20 — forked from flaviut/nimrun
#!/usr/bin/env sh
# A wrapper around the Nim compiler to allow for easy scripting of Nim. Puts
# all temporary files in a temporary directory and cleans up after itself.
#
# Usage:
# - add `#!/usr/bin/env nimrun` at the beginning of your script
# - execute the nim file with it, for example, `nimrun file.nim args`
#
# Possible future extentions:
@bluenote10
bluenote10 / notNilTest
Created April 30, 2015 13:25
Testing not nil
type
Test = object
field: seq[int] not nil
var t: Test
echo t.field.isNil() # true