Skip to content

Instantly share code, notes, and snippets.

View data-man's full-sized avatar
🖖
Open sources forever

Dmitry Atamanov data-man

🖖
Open sources forever
View GitHub Profile
@ikskuh
ikskuh / zig-up.sh
Created March 27, 2020 12:24
zigup
#!/bin/bash
ROOT=$HOME/software
REPO_URL=https://ziglang.org/download/index.json
TMPDIR=/tmp/zig-update
REPO_ENTRY=x86_64-linux
function die()
{
{.experimental: "caseStmtMacros".}
import macros
macro match(n: tuple): untyped =
result = newTree(nnkIfStmt)
let selector = n[0]
for i in 1 ..< n.len:
let it = n[i]
case it.kind
@mashingan
mashingan / monitorfs.nim
Last active January 14, 2021 17:59
Monitor folder and files using in Windows
import winim
proc quit(value: DWORD) =
quit value.int
proc refreshDirectory(handle: var HANDLE) =
handle = FindFirstChangeNotification(".", false,
FILE_NOTIFY_CHANGE_FILE_NAME)
if handle == INVALID_HANDLE_VALUE:
quit GetLastError()
void somefunc(rax *mytree) {
raxIterator iter;
raxStart(&iter,mytree);
/* As seek operator you can use >, <, >=, <=, == */
raxSeek(&iter,(unsigned char*)"chromo",6,"<="); /* Seek key <= "chromo" */
while(raxNext(&iter,NULL,0,NULL)) { /* or raxPrev() */
printf("Current key: %.*s, val %p\n",
(int)iter.key_len, (char*)iter.key, iter.data);
}
@Orc
Orc / mkdio.h++
Last active May 18, 2024 04:22
c++ header for discount -- trivially tested (the header compiles, a open/format test program works)
#ifndef _MKDIO_CXX
#define _MKDIO_CXX
extern "C" {
#include <stdio.h>
#include <mkdio.h>
}
class MKIOT {
protected:
@sergeevabc
sergeevabc / timecmd.bat
Created November 29, 2016 01:21
Measure execution time
@echo off
:: Get start timestamp
set _time=%time%
set _hours=100%_time:~0,2%%%100
set _min=100%_time:~3,2%%%100
set _sec=100%_time:~6,2%%%100
set _cs=%_time:~9,2%
set /a _started=_hours*60*60*100+_min*60*100+_sec*100+_cs
@mlocati
mlocati / main.c
Last active January 19, 2024 14:10
Enable/disable/check color support for Windows (ENABLE_VIRTUAL_TERMINAL_PROCESSING flag)
#define _WIN32_WINNT 0x0600
#include <stdio.h>
#include <windows.h>
#include <fileapi.h>
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
@bangedorrunt
bangedorrunt / article-style.css
Last active July 17, 2023 13:40
GoldenDict Dark Theme
body
{
margin-top: 1px;
margin-right: 3px;
margin-left: 2px;
margin-bottom: 3px;
background: #201F1F;
color: white;
font-family: Bookerly, Segoe UI, Palatino Linotype, Arial Unicode MS;
}
@galloscript
galloscript / imgui_color_gradient.cpp
Last active June 6, 2024 15:23
Gradient color generator and editor for ImGui
//
// imgui_color_gradient.cpp
// imgui extension
//
// Created by David Gallardo on 11/06/16.
#include "imgui_color_gradient.h"
#include "imgui_internal.h"
@yamnikov-oleg
yamnikov-oleg / calling_conventions.md
Created February 20, 2016 09:19
Linux Syscalls Reference

Source: man syscall

Architecture calling conventions

Every architecture has its own way of invoking and passing arguments to the kernel. The details for various architectures are listed in the two tables below.

The first table lists the instruction used to transition to kernel mode, (which might not be the fastest or best way to transition to