Skip to content

Instantly share code, notes, and snippets.

Danil Yarantsev Yardanico

Block or report user

Report or block Yardanico

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gamemodel.rst

Basic idea: A Nim DSL that describes the game model declaratively

There is a raw list/sequence of the data for fast iteration over all elements. The implementation should be either based on an ordinary contiguous sequence or something like: which is essentially a linked list of growing arrays so that no reallocations are required.

In addition to the contiguous storage there can be multiple indexes into the data. The indexes can be hash based or based on a BTree depending on whether ranges queries need to be supported. There is always a primary key of type integer that can be used to index the contiguous array.

An example:

View get_field_names.nim
import macros, times, strutils, tables
Data* = object
value*: int
fvalue*: float
tvalue*: Time
Container* = object
desc*: string
mikroskeem / get_shell.c
Last active Aug 30, 2018
A script to get Arch Linux ARM rootfs running in proot on Android (Termux)
View get_shell.c
* clang -static -O2 get_shell.c get_shell
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
int main(int argc, char *argv[]) {
mratsim / call_cuda.nim
Last active Sep 16, 2017
Calling CUDA kernels from Nim
View call_cuda.nim
import nimcuda/[cuda_runtime_api, driver_types, nimcuda]
import sequtils, future
type GpuArray[T: SomeReal] = object
data: ref[ptr T]
len: int
{.compile: "./".}
proc cuda_square(bpg, tpb: cint, y: ptr cfloat, x: ptr cfloat) {.importc, header:"../square.cuh".}
#../square.cuh is a workaround because header is not copied to nimcache

First suggestion:

<pkgname>.nimble # with srcDir = "src"

library with single module

zacharycarter /
Last active Aug 31, 2019
Binding to C Libraries with Nim
Francesco149 /
Last active Sep 15, 2019
Ultimate guide to low-latency osu on linux
fstab /
Last active Jul 13, 2019
How to use and as an IRC client

How to use and as an IRC client

How to Join an IRC Channel on

Join the room #freenode_<#channel>, replacing <#channel> with the name of the IRC channel. For example, in order to join the #prometheus IRC channel, join the room on

In, rooms can be joined with the directory symbol on the bottom left.

fujin / gettimeofday.cpp
Created Apr 1, 2015
LD_PRELOAD gettimeofday linux speedhack
View gettimeofday.cpp
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <dlfcn.h>
#include <stdio.h>
static timeval * timezero = 0;
typedef int (*go)(timeval *tv, timezone *tz);
kelvinn /
Created Jul 24, 2014
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000
You can’t perform that action at this time.