This file contains hidden or 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
compile | |
> nim c -d:release -d:danger renderer.nim | |
to render image from prompt: | |
> renderer sincos.nims | |
Render a function to a grey scale image, using nimscripter https://github.com/beef331/nimscripter for realtime scriptable applications. |
This file contains hidden or 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 vmath | |
import math | |
type | |
ColinearSegmentError* = object of Defect | |
Input2D = object | |
dir: Vec2 # tangent vector at first input knot | |
knot: seq[Vec2] | |
This file contains hidden or 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
/* | |
Database schema SQLite for a table that keeps its own history and | |
never deletes data. | |
On update, historic data is kept under a new id and references the original | |
creation id. The end of life timestamp (ts_eol) is set so a time line can be | |
built. The new data is used to update the data under the existing id. | |
On delete, nothing is deleted. Only the ts_eol timestamp is set to current. | |
*/ |
This file contains hidden or 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
# Compile: | |
# nim c --gc:orc --experimental:strictFuncs -d:ssl -d:nimStressOrc --import:std/httpcore sseClient.nim | |
# based on Harpoon https://github.com/juancarlospaco/harpoon | |
import std/[net, macros, strutils, times, json, httpcore, uri] | |
type | |
SSE = object | |
comment: string |
This file contains hidden or 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
# Goertzel oscillator bank (scalar): | |
# (seconds: 208, nanosecond: 253406100) | |
# duration: 4440s samplerate: 44100 samples: 195804000 | |
# 0.0000010635809590202449 seconds per sample @ 1000 oscillators | |
# Goertzel AVX oscillator bank: | |
# (seconds: 26, nanosecond: 403254200) | |
# duration: 4440s samplerate: 44100 samples: 195804000 | |
# 0.00000013484532593818306 seconds per sample @ 1000 oscillators | |
# Speedup: 7.887414351371886x |
This file contains hidden or 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 random, math, times | |
#randomize() | |
type | |
TransitionMatrix* = object | |
order: int | |
tMatrix: seq[seq[float]] | |
multiplier: seq[int] |
This file contains hidden or 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 std/[os, asyncdispatch, asyncstreams, strutils, oids, tables, options] | |
type | |
PSBusException* = object of Defect | |
Topic* = string | |
MsgDist* = enum | |
mtPS, #pub/sub | |
mtRR, #public request(/reply) |
This file contains hidden or 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 sequtils, math | |
## Spline and curve interpolation for many variants. | |
## Based upon the works of Steve H. Noskowicz. | |
## http://web.archive.org/web/20151002232205/http://home.comcast.net/~k9dci/site/?/page/Piecewise_Polynomial_Interpolation/ | |
## Get the book PDF and the appendix. | |
type | |
CurveSegmentError* = object of Defect | |
CurveOrderError* = object of Defect |
This file contains hidden or 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 asyncdispatch, asynchttpserver, asyncnet, nativesockets, net | |
import logging, oids, strformat, strutils, tables, times | |
#import sse_db | |
type SSEClient = object | |
fs: FutureStream[string] | |
clientClosed: int | |
req: Request | |
This file contains hidden or 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 streams | |
from strutils import parseInt, Whitespace | |
#from os import getFileSize | |
type | |
PGMError* = object of Defect | |
proc pgmRead(strm: FileStream, filePos: int=0): auto= | |
var data: char | |
strm.setPosition(filePos) |