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 std/httpclient | |
import std/net | |
import std/strutils | |
import std/json | |
import std/re | |
var client = newHttpClient(sslContext=newContext(verifyMode=CVerifyNone)) | |
# const extEvent = "vereya-gruppa2023" | |
# const urlEvent = "https://mysport.photo/public/photo-service/api/v1/events?externalEventId=" & extEvent |
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 osproc | |
const sleepMs = 500 | |
proc exec(cmd: string) = | |
if 0 != execCmd cmd: | |
echo "Error during: "&cmd | |
quit 1 |
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 threading | |
c = 0 # counter | |
def inc(): | |
global c | |
c = c + 1 | |
threads = list() |
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 counter*[T: byte](a: openArray[T]): Counter[T] = | |
let mask0 = set1_epi8(0) | |
let mask1 = set1_epi8(1) | |
let mask2 = set1_epi8(2) | |
let mask3 = set1_epi8(3) | |
var i = 0 | |
while i < a.len-avx.width: | |
let ymm = loadu_byte(unsafeAddr a[i]) | |
if 0 < popcnt_u32 movemask_epi8 cmpgt_epi8(ymm, mask3): | |
unroll for off in 0..<(avx.width): |
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
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, tag2__eD00OL9aGxJKms4Pcav4Eew)(tyObject_StreamFix2__puuL7GxzNXmsnKOJJ8DRDw* f, NimStringDesc* tag) { | |
NimStringDesc* result; | |
size_t tLen; | |
NIM_CHAR* tAddr; | |
{ result = (NimStringDesc*)0; | |
tLen = ((size_t) ((tag ? tag->Sup.len : 0))); | |
tAddr = (&tag->data[((NI) 0)]); | |
{ | |
while (1) { | |
if (!((*f).pos < (*f).last)) goto LA2; |
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
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, tag1__HiKHrrLOYR4hBpllSVCC1A)(tyObject_StreamFix__b69b4grKaFTd4YkM1TSIRbA* f, NI tag) { | |
NimStringDesc* result; | |
NI l; | |
NI t; | |
{ result = (NimStringDesc*)0; | |
l = ((*f).msg ? (*f).msg->Sup.len : 0); | |
t = (NI)0; | |
{ | |
while (1) { | |
NI c; |
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 tables | |
import threadpool | |
proc count(i: int): CountTable[int] = | |
for x in 0..i: | |
result.inc(x) | |
proc calc() = | |
var res = newSeq[FlowVar[CountTable[int]]](3) | |
for i in 0..2: |
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 asyncdispatch, json | |
proc f(): Future[seq[JsonNode]] {.async.} = | |
let fullJson = %*{"list": [{"c":1}, {"c":2}]} | |
for json in fullJson["list"]: | |
result.add(json) | |
when isMainModule: | |
let cs = waitFor f() |
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
use std::thread; | |
use std::time::Duration; | |
use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; | |
fn main() { | |
let m = MultiProgress::new(); | |
let sty = ProgressStyle::default_bar() | |
.template("[{elapsed_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {msg}") | |
.progress_chars("##-"); |
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
#![feature(duration_as_u128)] | |
#[macro_use] | |
extern crate bson; | |
extern crate mongo_driver; | |
use std::time::Instant; | |
use std::sync::Arc; | |
use mongo_driver::client::{ClientPool, Uri}; |
NewerOlder