Skip to content

Instantly share code, notes, and snippets.

View kLabz's full-sized avatar
🦆
\_o<

Rudy Ges kLabz

🦆
\_o<
View GitHub Profile
@kLabz
kLabz / A.md
Last active February 13, 2021 12:22
Strictly typed event handlers
@kLabz
kLabz / A.md
Last active February 13, 2021 12:22
List<T> modification
@kLabz
kLabz / Main.hx
Last active May 6, 2021 08:27
Haxe C# dictionary iteration
import cs.system.collections.generic.IEnumerator_1;
import cs.system.collections.generic.KeyValuePair_2;
import cs.system.collections.generic.Dictionary_2;
using Main;
@:nativeGen class Main {
public static function main() {
var dict = new Dictionary_2<String, String>();
dict.Add('hello', 'world');
@kLabz
kLabz / Test.hx
Created December 8, 2021 07:20
Haxe GADTs for API endpoints
class Test {
static function main() {
var req = makeRequest(Foo, r -> trace(r.foo));
req.send();
var req2 = makeRequest(Bar(42), r -> trace(r.answer));
req2.send();
}
static function makeRequest<T>(endpoint:Endpoint<T>, handler:T->Void) {
@kLabz
kLabz / astro-contrib.json
Last active March 22, 2022 07:08
Astro slide delivery monitoring
{
"user_id": 123456,
"contrib_id": 123456,
"cookie": "..."
}
@kLabz
kLabz / monitor-geom.sh
Created May 22, 2022 12:59
Monitor Geom
#!/bin/bash
MONITORS=$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')
# Get the location of the mouse
XMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $2}')
YMOUSE=$(xdotool getmouselocation | awk -F "[: ]" '{print $4}')
for mon in ${MONITORS}; do
# Parse the geometry of the monitor
# Mode: Focus
# ---------------------------
set $mode_focus Focus: (Shift+1~5) Mark ⋅ (1~5) Focus ⋅ (Alt+1~5) Clear ⋅ (a) Create custom ⋅ (g) Focus custom ⋅ (c) Clear custom
mode "$mode_focus" {
# Keybindings for custom marks
bindsym a exec i3-input -F 'mark %s' -P 'Mark name: '
bindsym g exec i3-input -F '[con_mark=%s] focus' -P 'Go to mark: '
bindsym c exec i3-input -F 'unmark %s' -P 'Clear mark: '
# Assign marks to keys 1-5
# Mode: Screenshot
# ---------------------------
set $monitorGeom $(monitor-geom)
set $maimCopy | xclip -selection clipboard -t image/png
set $maimFilename ~/Pictures/Screenshots/$(date +%Y-%m-%d-%H:%M-%S-%N).png
set $mode_screenshot Screenshot mode: (w) Window ⋅ (x) All screens ⋅ (s) Selection ⋅ (d) Desktop ⋅ (w/x/s/d + Shift) Use clipboard | (c) Color picker
mode "$mode_screenshot" {
# Save screenshot to file
bindsym w exec --no-startup-id maim -i $(xdotool getactivewindow) $maimFilename, mode "default"
bindsym x exec --no-startup-id maim $maimFilename, mode "default"
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "k"
let s:palette = {
\ 'bg': '#111111',
\ 'fg': '#dedbd4',
\ 'dull': '#f9edce',
lua << EOF
require'compe'.setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;