Build
$ ./compileall.sh
# Cleanout #############################################################
# Go ###################################################################
real 0m0,283s
user 0m0,227s
## Debug utilities, to keep it simple and stdlib-only. | |
import functools | |
__all__ = ("debugs", ) | |
def debugs(func): |
$ ./compileall.sh
# Cleanout #############################################################
# Go ###################################################################
real 0m0,283s
user 0m0,227s
TRC20 Tron Network
TPfjb2mbSQQwUe9AScZmu5bRax3dHdBBiL
BEP20 Binance Smart Chain Network BSC
import httpclient, json, xmltree, q | |
proc wikipediaDns*(name: string): string {.inline.} = | |
const w = "http://en.wikipedia.org/w/api.php?action=query&prop=info&inprop=url&format=json&limit=1&titles=" | |
let hc = newHttpClient() | |
for x in hc.getContent(w & name).parseJson{"query", "pages"}.pairs: | |
for u in q(hc.getContent(x.val{"fullurl"}.getStr)).select"table.infobox tbody tr a[href*=http]": | |
return u.attr"href" | |
echo wikipediaDns("Nim-lang") |
proc printf*(format: cstring): cint {.importc, header: "<stdio.h>".} | |
proc fprintf*(stream: File, format: cstring): cint {.importc, header: "<stdio.h>".} | |
proc sprintf*(str: var cstring, format: cstring): cint {.importc, header: "<stdio.h>".} | |
proc vsprintf*(str: var cstring, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".} | |
proc vfprintf*(stream: File, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".} |
name: Build Nim 👑 | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: |
import strformat, times, os, osproc, nicypkg/functions | |
export functions | |
when isMainModule: | |
let | |
prompt = returnCondition(ok = "👍", ng = "👎") & " " | |
nl = "\n" | |
gitBranch = color(gitBranch(), "yellow") | |
cwd = color(tilde(getCwd()), "cyan") | |
dirty = color("×", "red") |
# args are immutable by default. | |
# Variables immutables by default (std lib). | |
# func ensures exampleFunction dont have Side Effects (is a Functional function). | |
func exampleFunction(arg: Natural): range[0..100] = # Static Types no type Bugs possible (wont compile otherwise). range[0..100] only allows integers from 0 to 100. Natural only allows integers not Negative (>=0). | |
# result variable is automatically created for you (you always need to return a result anyways) | |
preconditions arg > 0, arg < 101 # Preconditions (like a Unittest BEFORE a block of code, asserts on args and variables) | |
postconditions result > 0, result < 101 # Postconditions (like a Unittest AFTER a block of code, asserts on result) | |
result = arg + 1 # Mimic some logic here, it does not really matter for this example | |
# result is automatically returned, no need for "return result" (can still use return if wanted tho) |
2019-02-28T16:00:52-03:00: Nim Website Creator: starting. | |
*** Starting xvfb server: "Xvfb" ":529" "-screen" "0" "800x600x24" *** | |
*** Stating xvfb client: "firejail" *** | |
*** Attaching to Xvfb display 529 *** | |
Basic read-only filesystem: | |
Mounting read-only /bin | |
Mounting read-only /lib | |
Mounting read-only /usr |