Skip to content

Instantly share code, notes, and snippets.

View Airblader's full-sized avatar
:octocat:

Ingo Bürk Airblader

:octocat:
  • Confluent
  • Munich, Germany
View GitHub Profile
@Airblader
Airblader / interpolate.js
Last active November 29, 2023 16:33
rxjs – Interpolate progress straight from hell
// Use https://rxviz.com to see it in action.
/**
* Interpolates a (numeric) source stream with predicted values based on how
* quickly the source stream's value increases. This was intended to smooth out
* a progress bar, but should one really use this piece of sheer terror in production?
*/
const interpolate = (source$, relax = 50) => {
/* This just allows a shorter syntax, avoiding return statements in arrow functions. */
const id = obj => obj;
@Airblader
Airblader / make_dock.sh
Created May 9, 2017 09:44
Turn any window into a dock for i3 (caution, dock windows do not take focus ever)
#!/usr/bin/env bash
# call like this:
# /path/to/this/script.sh <window_id> <dock height>
win="${1:-}"
height="${2:-}"
width=$(xrandr -q | head -n1 | awk '{print $8}')
xdotool windowunmap --sync ${win}
xdotool windowsize --sync ${win} ${width} ${height}
### Keybase proof
I hereby claim:
* I am Airblader on github.
* I am ingorok (https://keybase.io/ingorok) on keybase.
* I have a public key whose fingerprint is 96A5 2700 8D21 5F55 C52D 56EE 1DCA 7EFC 3970 FA1B
To claim this, I am signing this object:
@Airblader
Airblader / py3lock.py
Created May 11, 2015 16:41
Obscure only actual windows for i3lock
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# vim:ts=2:sw=2:expandtab
import os
import xcb
from xcb.xproto import *
from PIL import Image
XCB_MAP_STATE_VIEWABLE = 2
@Airblader
Airblader / i3bar-ws-spacing.patch
Last active September 6, 2021 00:20
Remove padding around i3bar contents
diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c
index 6878e29..ced03c6 100644
--- a/i3bar/src/xcb.c
+++ b/i3bar/src/xcb.c
@@ -129,11 +129,11 @@ static const int ws_hoff_px = 4;
static const int ws_voff_px = 3;
/* Offset between two workspace buttons */
-static const int ws_spacing_px = 1;
+static const int ws_spacing_px = 0;
@Airblader
Airblader / detect-changes-on-change.ts
Last active May 10, 2021 07:20
Typescript / Angular Decorator: DetectChangesOnChange
// Copyright 2018 Ingo Bürk
// Released under the MIT License (https://opensource.org/licenses/MIT)
// TODO: Is there a better way to get access to a ChangeDetectorRef from
// within the decorator?
/**
* Decorator for class methods which caches the returned value and,
* if the value has changed, triggers change detection.
*
@Airblader
Airblader / gist:357f2c2d0c8b1ede639c
Created March 14, 2016 13:57
Outer gaps without inner gaps
diff --git a/src/con.c b/src/con.c
index aefdcad..bcae637 100644
--- a/src/con.c
+++ b/src/con.c
@@ -2048,7 +2048,7 @@ gaps_t calculate_effective_gaps(Con *con) {
.outer = workspace->gaps.outer + config.gaps.outer};
/* Outer gaps are added on top of inner gaps. */
- gaps.outer += 2 * gaps.inner;
+ // gaps.outer += 2 * gaps.inner;
@Airblader
Airblader / subscribe-workspace.pl
Created July 17, 2015 09:39
Wallpaper per workspace
# example
/path/to/wallpaper.pl | while read num; do echo "feh --bg-scale /path/to/wallpaper$num.png"; done
# produces
# feh --bg-scale /path/to/wallpaper3.png
# feh --bg-scale /path/to/wallpaper1.png
# ...
@Airblader
Airblader / analyze.py
Last active August 29, 2015 14:19
Analyze #unixporn
#!/usr/bin/env python3
import json
import urllib.request
import time
import sys
patterns = {
'i3': ['i3'],
'bspwm': ['bspwm'],
'awesome': ['awesome'],