Skip to content

Instantly share code, notes, and snippets.

View kesor's full-sized avatar
🏠
Working from home

Evgeny Zislis kesor

🏠
Working from home
View GitHub Profile
@kesor
kesor / eza-wrapper.sh
Last active January 16, 2025 05:11
Wrapper around `eza` to make it have `ls`-like arguments, especially `-t`
#!/bin/bash
# CHANGE THIS
ACTUAL_EZA=/usr/local/bin/_eza
display_time="modified"
sort_time=""
args=()
while [ "$#" -gt 0 ]; do
@kesor
kesor / env-wrapper.nix
Last active November 28, 2024 05:30
NIX Environment Variables Wrapper with symlinkJoin to symlink all the original package into the new wrapper
{ lib, pkgs, ... }:
let
# Function to wrap a package with custom environment variables
makeWrappedPackage = pkg: envVars: pkgs.symlinkJoin {
name = "env-wrap-${pkg.pname or pkg.name}";
paths = [ pkg ]; # Symlink all files form the original
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
for exe in ${lib.getExe pkg}; do
@kesor
kesor / nix-env-vars-wrapper.nix
Last active November 28, 2024 02:18
A function to wrap home-manager packages in environment variable setting shell script
{ lib, pkgs, ... }:
let
# Function to wrap a package with custom environment variables
makeWrappedPackage = pkg: envVars: pkgs.stdenv.mkDerivation {
name = "env-wrap-${pkg.name}";
nativeBuildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
for exe in ${lib.getExe pkg}; do
@kesor
kesor / keybindings.txt
Created November 10, 2024 14:39
dwm keyboard cheat sheet
# Window Navigation
Mod j / k : Focus next / prev window
Mod Enter : Move to master
Mod Tab : Prev tag
# Window Management
Mod h / l : Shrink / Grow master
Mod Shift c : Close window
Mod Shift Space : Toggle float
Mod Shift f : Fullscreen
@kesor
kesor / scratch.sh
Created November 9, 2024 12:30
wm scratchpad script
#!/bin/sh
name=$1
case "$name" in
speedcrunch)
win_ids=$(xdotool search --classname "SpeedCrunch")
visible_win=""
hidden_win=""
@kesor
kesor / indicator-reader-blocking.ino
Created September 19, 2024 14:05
Arduino code for Chinesium Calipers or Dial Indicator digital output
int bit_array[25]; // For storing the data bit. bit_array[0] = data bit 1 (LSB), bit_array[23] = data bit 24 (MSB).
unsigned long time_now; // For storing the time when the clock signal is changed from HIGH to LOW (falling edge trigger of data output).
int CLOCK_PIN = 2;
int DATA_PIN = 3;
void setup() {
Serial.begin(115200);
pinMode(CLOCK_PIN, INPUT);
@kesor
kesor / eslint.config.ts
Last active January 13, 2025 17:26
ESLing Flat Config Typescript
/**
* @file
* ESLint configuration for a monorepo project
*/
import { default as pluginTs, Config } from 'typescript-eslint'
import { FlatCompat } from '@eslint/eslintrc'
import globals from 'globals'
import jsdoc from 'eslint-plugin-jsdoc'
import pluginJs from '@eslint/js'
import pluginJson from 'eslint-plugin-json'
@kesor
kesor / beltmatic_solver.py
Last active July 23, 2024 20:57
BFS-based Solver for the Game Beltmatic
#!/usr/bin/python3
from collections import deque
MAX_NUMBER = 18
# Define operations as functions
def add(x, y): return x + y
def sub(x, y): return x - y
def mul(x, y): return x * y
@kesor
kesor / pivot-sr.pine
Last active May 23, 2024 23:34
TradingView Pine Script indicator for Pivot points and Support-Resistance lines
//@version=5
indicator("Pivot SRs", overlay=true)
lookback = input.int(12, "Lookaround bars")
number_of_lines = input.int(5, "Lines to keep")
getLastNonNaInfo(series) =>
float lastValue = na
int lastIndex = na
for i = 0 to 1000 // Adjust the range as necessary
@kesor
kesor / multi-ma.pine
Created May 23, 2024 23:21
Multiple Moving Averages for TradingView Pine Script
// @version=5
indicator(title="Multi-MA", shorttitle="MA", overlay=true)
var string MA_EMA = "EMA" // (Exponential Moving Average)"
var string MA_SMA = "SMA" // (Simple Moving Average)"
var string MA_WMA = "WMA" // (Weighted Moving Average)"
var string MA_HMA = "HMA" // (Hull Moving Average)"
var string MA_RMA = "RMA" // (Relative Moving Average)"
var string MA_SWMA = "SWMA" // (Symmetrically-Weighted Moving Average)"