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
async def show_list(msg, args, role): | |
if not await get_or_none(Role.select(Role.user_id).where(Role.role == role)): | |
return await msg.answer(f'Группа {role} пуста 🙄') | |
message = f"Список пользователей {role}:\n" | |
for u in await db.execute(Role.select(Role.user_id).where(Role.role == role)): | |
users = await msg.vk.method('users.get', {'user_ids': u.user_id, 'fields': 'online'}) | |
user = users[0] | |
message += f"[id{user['id']}|{user['first_name']} {user['last_name']}] {' - онлайн' if user['online'] else ''}\n" |
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
nim compile -f --symbolfiles:off --compileonly --gen_mapping --cc:gcc --skipUserCfg --os:android --cpu:arm -d:release compiler/nim.nim | |
command line(1, 2) Error: unknown OS: 'android' | |
Error: call to nim compiler failed | |
Error: execution of an external program failed: 'C:\Users\Tiberium\Nim\tools\niminst\niminst.exe --var:version=0.17.0 --var:mingw=none csource --main:compiler/nim.nim compiler/installer.ini -d:release' | |
FAILUR |
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
$ sh build.sh | |
# OS: android | |
# CPU: arm64 | |
gcc -o bin/nim -lrt -landroid-glob -ldl -lm -lrt -landroid-glob | |
/data/data/com.termux/files/usr/bin/../lib/crtbegin_dynamic.o: In function `do_arm64_start': | |
crtbegin.c:(.text+0x20): undefined reference to `main' | |
crtbegin.c:(.text+0x4c): undefined reference to `main' | |
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation) | |
$ |
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
template debug*(body: untyped) = | |
when not defined release: | |
body | |
debug echo "hello" |
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 math | |
import unittest, strutils # Только для тестов | |
proc arithmetic[T](a, b: T, op: char): float = | |
# Тут используются дженерики для того, чтобы процедура принимала разные числа :) | |
case op | |
of '+': result = float(a + b) | |
of '-': result = float(a - b) | |
of '*': result = float(a * b) | |
of '/': result = float(a / b) |
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
foo MyType: | |
doStuff | |
foo: | |
doAnotherStuff |
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
proc gen_event(ad: AddressDirection) {.async.} = | |
let href = ("http://$1:$2/sub$3" % [ cts.host, $cts.port, $sid ]) | |
let ev = %* CallEventNotification( | |
callingParticipant: calling, | |
calledParticipant: called, | |
eventDescription: EventDescription(callEvent: evtype), | |
notificationType: "callEvent", | |
callSessionIdentifier: $ id, | |
addressDirection: ad, |
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
if (let data = "hello"; data.len > 0): | |
echo data |
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
Traceback (most recent call last) | |
vkbot.nim(104) vkbot | |
asyncdispatch.nim(1010) runForever | |
asyncdispatch.nim(1045) poll | |
asyncdispatch.nim(179) processPendingCallbacks | |
asyncmacro.nim(34) cb0 | |
asyncmacro.nim(126) handler9Iter | |
gc.nim(278) asgnRefNoCycle | |
SIGSEGV: Illegal storage access. (Attempt to read from nil?) |
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 httpclient, asyncdispatch, strutils, tables, unicode, json, math, times | |
const | |
ForecastUrlFormat = "http://api.openweathermap.org/data/2.5/forecast/daily?APPID=$1&lang=en&q=$2&cnt=$3" | |
ResultFormat = """$1: | |
$2 | |
Temperature: $3 °C | |
Humidity: $4% | |
Clouds: $5% |