Skip to content

Instantly share code, notes, and snippets.

import asyncdispatch
template scheduleCall(ms: int, oneshot: bool, call: untyped) =
# We use `block` here because we can't use gensym with async
block:
proc sched() {.async.} =
await sleepAsync(ms)
await call
if not oneshot:
# We don't use await here because otherwise every sched() call
import strutils, strtabs, cgi
proc encode*(params: StringTableRef, isPost = true): string =
result = if not isPost: "?" else: ""
if not params.isNil():
for key, val in pairs(params):
let
enck = cgi.encodeUrl(key)
encv = cgi.encodeUrl(val)
result.add($enck & "=" & $encv & "&")
import macros, json
type Event = ref object of RootObj
id: string
type TestMade = ref object of Event
name: string
type Test = ref object of Event
import math, strutils
const
ArgsErrorMsg = "Incorrect number of arguments at pos $1 in function `$2`"
CharErrorMsg = "Unexpected char `$1` at pos $2"
proc eval(data: string): float =
## Evaluates math expression from string *data* and returns result as a float
var data = data.toLowerAscii()
const routerdll = "librouter.dll"
const
stEnableDebug = 0
stDebugVerbosity = 1
stWriteLogCallback = 2
stSetTableDataCallback = 3
stUserAgent = 4
stUseCustomPage = 5
stCustomPage = 6
total executions of each stack trace:
Entry: 1/41 Calls: 239/689 = 34.69% [sum: 239; 239/689 = 34.69%]
test.nim: expand 632/689 = 91.73%
test.nim: test 689/689 = 100.00%
Entry: 2/41 Calls: 55/689 = 7.98% [sum: 294; 294/689 = 42.67%]
test.nim: pixelsOn 55/689 = 7.98%
test.nim: test 689/689 = 100.00%
Entry: 3/41 Calls: 42/689 = 6.10% [sum: 336; 336/689 = 48.77%]
hashes.nim: hash 181/689 = 26.27%
hashes.nim: hash 181/689 = 26.27%
./koch boot -d:release
iteration: 1
compiler/nim0 c -d:release --nimcache:nimcache/r_macosx_amd64 compiler/nim.nim
Error: Requested executable is missing. (Path: /Users/tiber/.choosenim/toolchains/nim-#devel/bin/nim0)
Info: If unexpected, please report this error to https://github.com/dom96/choosenim
FAILURE
import osproc
let komande = ["-f", "video4linux2", "-s 640x480", "-i /dev/video0", "-ss 0:0:2", "-frames 1" , "/tmp/out.jpg"]
let process = startProcess("ffmpeg", "", komande)
CC: compiler_koch
Error: invocation of external compiler program failed. No such file or directory
Additional info: Could not find command: '/bin/sh'. OS error: No such file or directory 2
nim.nim(121) nim
nim.nim(77) handleCmdLine
main.nim(167) mainCommand
main.nim(74) commandCompileToC
modules.nim(240) compileProject
modules.nim(180) compileModule
passes.nim(218) processModule
passes.nim(136) processTopLevelStmt
cgen.nim(1337) myProcess
ccgstmts.nim(1163) genStmts