Skip to content

Instantly share code, notes, and snippets.

@illia-danko
illia-danko / stdc++.h
Created March 15, 2023 11:20
bits/stdc++.h for clang++ compatible with -c++20
// Apple clang version 14.0.0 (clang-1400.0.29.202)
// Target: arm64-apple-darwin22.3.0
#include <algorithm>
#include <any>
#include <array>
#include <atomic>
#include <barrier>
#include <bit>
#include <bitset>
@illia-danko
illia-danko / generate-iterm2-theme.go
Created January 1, 2023 18:27
Generate iterm2 theme from RGB hex colors.
// Generate iterm2 theme from RGB hex colors.
//
// The Golang main file reads rgb hex colors from stdin and produces iterm2 theme to stdout.
//
// The usage example of dark variant of https://github.com/navarasu/onedark.nvim:
//
// cat <<EOF | go run generate-iterm2-theme.go >> onedark.itermcolors
// #282c34
// #abb2bf
// #181a1f
@illia-danko
illia-danko / slice_operations.go
Last active August 10, 2022 10:20
Golang array(slice) operations
package main
import "fmt"
// Array operations in Golang.
//
// Note: a generic `array` term is using, however all operation involve go
// slice, which is a reference to an underline 'real' array.
func main() {
@illia-danko
illia-danko / gnome-shell-set-font.sh
Last active August 9, 2022 21:30
Change font of gnome-shell globally
#!/usr/bin/env bash
#
# Author: Elijah Danko (me@elijahdanko.net)
# License: MIT
#
# Change font on Adwaita gnome-shell theme using gresource.
# You can adapt the script to adjust whatever you want.
#
# Tested on archlinux gnome-shell 3.34.2.
# Make sure that `gresource` and `glib-compile-resources` are located in the path.
@illia-danko
illia-danko / go-rpc_test.go
Last active March 6, 2019 00:32
Golang benchmark test to compare two built-in Gob and Json RPC servers.
// The purpose of this source file is to compare transmittion speed of two
// built-in RPCs servers, namely Gob and Json by using blocking calls.
package main
import (
"net"
"net/rpc"
"net/rpc/jsonrpc"
"testing"
@illia-danko
illia-danko / pre-commit
Last active March 6, 2019 00:29
golang pre-commit hook
#!/bin/sh
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
# This script does not handle file names that contain spaces.
# The script is adopted version of