Skip to content

Instantly share code, notes, and snippets.

View pschmitt's full-sized avatar
🧠
spaces > tabs

Philipp Schmitt pschmitt

🧠
spaces > tabs
View GitHub Profile
@pschmitt
pschmitt / sway-maximize.sh
Last active March 26, 2024 01:01
sway ipc script to maximize the currently focused window
#!/usr/bin/env bash
usage() {
echo "Usage: $(basename "$0") [-d DEFAULT_BORDER_PX] [-m MAXIMIZED_BORDER_PX]"
}
get_waybar_height() {
# Waybar's config is JSONC, ie it contains comments. We need to strip
# these for jq.
grep -v '//' ~/.config/waybar/config | jq -er '.height'
@pschmitt
pschmitt / xdg-portal-screencast-watcher.sh
Created February 23, 2024 07:23
XDG Desktop Portal DBUS monitoring tool to react to ScreenCast start/stop events
#!/usr/bin/env bash
# Monitor D-Bus for XDG Portals screencasting events
# Requires: busctl and jq
echo_debug() {
if [[ -z "$DEBUG" ]]
then
return 0
fi
@pschmitt
pschmitt / binds.conf
Last active February 17, 2024 10:00
hyprland input config
# https://wiki.hyprland.org/Configuring/Binds/
$mod = SUPER
# hyprland binds
bind = $mod SHIFT, C, exec, $bin_dir/kill-active.sh
bind = $mod SHIFT, K, exec, hyprctl kill
bind = $mod SHIFT, Q, exec, $bin_dir/leave.sh
bind = $mod SHIFT, R, exec, $bin_dir/reload-config.sh
bind = $mod ALT, R, forcerendererreload,
@pschmitt
pschmitt / hyprland.log
Created February 10, 2024 15:30
hyprland 0.35 xkb_layout issue
Feb 10 16:07:48 ge2 hyprland[2382428]: Welcome to Hyprland!
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] Instance Signature: 84ab8d11e8951a6551d1e1bf87796a8589da6d47_1707577668
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] Hyprland PID: 2382428
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] ===== SYSTEM INFO: =====
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] System name: Linux
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] Node name: ge2
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] Release: 6.7.4
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] Version: #1-NixOS SMP PREEMPT_DYNAMIC Mon Feb 5 20:17:12 UTC 2024
Feb 10 16:07:48 ge2 hyprland[2382428]: [LOG] GPU information:
Feb 10 16:07:48 ge2 hyprland[2382428]: 00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-P [Iris Xe Graphics] [8086:a7a0] (rev 04) (prog-if 00 [VGA controller])
@pschmitt
pschmitt / proxmox-get-vm-ip.sh
Created July 15, 2017 17:53
Get the IP address of a VM hosted on Proxmox
#!/usr/bin/env bash
usage() {
echo "$(basename $0) VM"
}
get_vm_id() {
qm list | awk '/'"${1}"'/ { print $1 }'
}
@pschmitt
pschmitt / json-input.patch
Created February 19, 2023 21:04
home-assistant-cli read JSON from stdin patch
diff --git a/homeassistant_cli/plugins/raw.py b/homeassistant_cli/plugins/raw.py
index 46c544e..62e6a1a 100644
--- a/homeassistant_cli/plugins/raw.py
+++ b/homeassistant_cli/plugins/raw.py
@@ -61,7 +61,9 @@ def get(ctx: Configuration, method):
def post(ctx: Configuration, method, json):
"""Do a POST request against api/<method>."""
if json:
- data = json_.loads(json)
+ data = json_.loads(
@pschmitt
pschmitt / pulseaudio.zsh
Created April 13, 2022 15:01
Overengineered pulseaudio cli wrapper
# Generic PulseAudio wrapper commands
if (( ! $+commands[pactl] ))
then
return
fi
pulseaudio::list() {
local invert
local friendly_name
local monitor
@pschmitt
pschmitt / zinit-logo-2.svg
Last active November 6, 2021 14:19
zinit svg logo without color
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pschmitt
pschmitt / resume.json
Last active June 3, 2021 12:53
resume.json
{
"meta": {
"theme": "elegant",
"canonical": "https://gist.github.com/pschmitt/0ab646d4a39b16393db354c6e1082305",
"version": "0.1",
"easter-egg": "Hello, recruiter! You made it. I'm honnestly amazed you actually just ran this random command you've seen on a resume! Cheers!"
},
"basics": {
"name": "Philipp Schmitt",
"label": "Cloud Automation Engineer / DevOps",
@pschmitt
pschmitt / wifi-scan.zsh
Created January 4, 2021 20:56
wifi-scan.zsh
wifi-scan() {
setopt localoptions pipefail errreturn
local device="$(wifnames | tail -1)"
local raw
zparseopts -D -K -E \
r=raw -raw=raw
if [[ -z "$device" ]]