Skip to content

Instantly share code, notes, and snippets.

# Keymap file for https://github.com/samvel1024/kbct
# Maps left Ctrl+Alt+hjkl to arrows.
- keyboards: ["AT Translated Set 2 keyboard"]
# Specify layered configurations (much similar to fn+F keys)
layers:
# Specify the modifiers of the layer
- modifiers: ['leftalt','leftctrl']
keymap:
@barsv
barsv / heap.py
Last active November 30, 2021 20:15
Fixed version of the heap implementation from https://www.programiz.com/dsa/heap-data-structure
# Max-Heap data structure in Python
import math
def siftDown(arr, n, i):
largest = i
l = 2 * i + 1
r = 2 * i + 2
if l < n and arr[i] < arr[l]:
largest = l
@barsv
barsv / gist:7c0c788daa185797518db646937b0d1d
Created June 10, 2020 08:33
remove shit from jira kanban
#ghx-header.contains-breadcrumbs {
position: absolute;
right: 0;
width: 400px !important;
z-index: 999999999;
}
#breadcrumbs-container {
display: none !important;
}
#page-body > #content {
@barsv
barsv / matplotlib_in_tkinter.py
Created April 11, 2020 11:52
How to put matplot lib graph into tkinter window
# minimal example on how to put matplot lib graph into tkinter window
import tkinter as tk
import matplotlib.backends.backend_tkagg as tka
from matplotlib.figure import Figure
import numpy as np
win = tk.Tk()
fig = Figure()
canvas = tka.FigureCanvasTkAgg(fig, win)
toolbar = tka.NavigationToolbar2Tk(canvas, win)
@barsv
barsv / logger.ps1
Last active January 17, 2024 12:39
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line
@barsv
barsv / BindingTest.cs
Last active September 26, 2020 19:38
Binding Proof of concept
using System;
using System.Linq.Expressions;
using PostSharp.Aspects;
namespace BindingTest
{
class Program
{
static void Main()
{