This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "package:flutter/material.dart"; | |
void main() { | |
runApp(App()); | |
} | |
class App extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import future | |
import options | |
#[ | |
proc flatMap[X](iter: iterator(): X, mapper: X -> iterator(): X): (iterator(): B) = | |
result = proc() = | |
yield X | |
proc iter(): int = |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
value | |
100 | |
150 | |
200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Test = object | |
field: seq[int] not nil | |
var t: Test | |
echo t.field.isNil() # true |
NewerOlder