Skip to content

Instantly share code, notes, and snippets.

View kkm000's full-sized avatar
📆
Celebrating the first day of the rest of my life

Cy 'kkm' Katsnelson kkm000

📆
Celebrating the first day of the rest of my life
View GitHub Profile
@kkm000
kkm000 / 80-cascadia-semilight.conf
Created June 3, 2021 05:17
Fontconfig to make Emacs recognise semilight Cascadia fonts as such
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Place into an fcconfig directory (e.g. /etc/fonts/conf.d/) -->
<!-- Run 'fc-conflist' to see where your fontconfig is looking. -->
<!-- Run 'fc-cache -f' after dropping this file. -->
<description>Adjust weight of Cascadia fonts for Emacs</description>
@kkm000
kkm000 / ssh-agent-headless.service
Last active October 18, 2022 19:54
Sharing ssh-agent between multiple remote command-line sessions
# -*- mode: conf-unix; -*-
# SPDX-License-Identifier: Unlicense OR CC0-1.0 OR Apache-2.0 OR WTFPL
# ~/.config/systemd/user/ssh-agent-headless.service
#
# Written by Kirill 'kkm' Katsnelson in 2018 and dedicated to public domain. If
# public domain is not recognized in your jurisdiction, use any of the licenses
# listed above that suit you the best.
#
# This is a per-user service to run ssh-agent(1) under a systemd user's service,
# shared by all sessions of this user. Many distros come with a service
@kkm000
kkm000 / logs-shoots-and-leaves.cc
Created March 2, 2019 09:38
Standalone verification of Kaldi logging code rework
/* logs-shoots-and-leaves.cc.
One-liner test in bash:
set -x; for cxx in g++-6 g++-7 g++-8 clang++-6.0 clang++-7; do \
for std in 11 14 17; do \
for endl in 0 1; do \
$cxx -std=c++${std} -g -fdiagnostics-color \
-Wall -Wextra -Wpedantic -rdynamic \
-DTEST_ENDL=$endl -DHAVE_CXXABI_H -DHAVE_EXECINFO_H \
@kkm000
kkm000 / if-else-branch.cc
Last active March 1, 2019 07:24
How compilers decide which branch is conditionally jumped to
// Try this code on godbolt.com: https://godbolt.org/z/oXGnoY
// Command line: -std=c++11 -O1 (or -O2).
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
#define KALDI_ASSERT(cond) do { if (cond) (void)0; else \
KaldiAssertFailure_(__func__, __FILE__, __LINE__, #cond); } while(0)
@kkm000
kkm000 / benchmark.cpp
Created September 11, 2015 05:05
Benchmarking key store enumeration
#include <stdio.h>
#include <windows.h>
#include <wincrypt.h>
static void failerr(const char *funName) {
fprintf(stderr, "%s() failed: 0x%08lX\n", funName, GetLastError());
exit(1);
}
void enum_keys(HCRYPTPROV hprov) {