Skip to content

Instantly share code, notes, and snippets.

View zealotous's full-sized avatar

Mike Feoktistov zealotous

  • RapidRatings
  • Dublin
View GitHub Profile
@zealotous
zealotous / daemon.json
Created February 8, 2024 08:48
k3s compatible /etc/docker/daemon.json and DOCKER_HOST
{
"hosts": [
"tcp://172.16.1.200:2375",
"unix:///var/run/docker.sock"
],
"exec-opts": [
"native.cgroupdriver=cgroupfs"
]
}
@zealotous
zealotous / gist:86b08623765af05cce2bbb2a8e462a72
Created September 17, 2023 15:39
Ubuntu22.04 Huge Trackball
sleep 3
xinput set-prop "pointer:Getech HUGE TrackBall" "libinput Button Scrolling Button" 10
xinput set-prop "pointer:Getech HUGE TrackBall" "libinput Scroll Method Enabled" 0 0 1
@zealotous
zealotous / loads-dotenv.sh
Created September 22, 2021 15:49
Loads .env files with comments and values containing spaces
# Loads .env files with comments and values containing spaces
IFS="\n" env "$(cat .env | sed -r 's/#.+$//gi;/^\s*$/d')" printenv
@zealotous
zealotous / pipewire-cli-set-aac-prfile.sh
Last active August 9, 2021 17:11
pipewire cli set bluetooth profile
#!/usr/bin/env bash
DEVICE_NAME="Bose QC35 II"
DEFAULT_PROFILE="High Fidelity Playback (A2DP Sink, codec AAC)"
HEADSET_PROFILE="Headset Head Unit (HSP/HFP, codec mSBC)"
function get-headphones-id() {
local dev_name="$1"
pw-cli dump Device | grep -B 8 '"'"$dev_name"'"' | head -n1 | awk '{ print $2 }'
@zealotous
zealotous / lines-color.sh
Created December 30, 2020 20:20
lines-color.sh
#!/bin/bash
while read line
do
echo -e "\x1b[48;5;235m$line\x1b[K\x1b[0m"
read line
echo -e "$line"
done
@zealotous
zealotous / compare-versions.sh
Last active November 9, 2020 09:49
Update docker-compose to minimal version that has --compatibility flag
v1=$(docker-compose --version | awk '{print $3}' | sed 's/,//gi')
v2="1.20"
compose_v="1.26.0"
python3 -c "a, b = tuple(map(lambda x: int(x[0]) + int(x[1]) * 0.001, map(lambda s: s.split('.'), ['$v1', '$v2']))); exit(int(a < b))" \
|| {
sudo apt remove -f docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/${compose_v}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose;
}
@zealotous
zealotous / yaml2json.sh
Created October 1, 2020 09:29
YAML to JSON python one-liner example
echo -e "services: {a: 'foo'}" \
| python -c "import sys; import json; import yaml; print(json.dumps(yaml.safe_load(''.join(l for l in sys.stdin))))" \
| jq .
@zealotous
zealotous / hide_global_navigations.js
Created December 20, 2019 18:12
Hide global navigation in Jira
// ==UserScript==
// @name hide navigation
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://dedsert.atlassian.net/secure/RapidBoard.jspa*
// @grant none
// ==/UserScript==
# https://www.parallels.com/blogs/ras/configuring-windows-server-firewall-for-parallels-ras/
Set-Service sshd -StartupType Automatic
Set-Service ssh-agent -StartupType Automatic
New-NetFirewallRule -DisplayName "OpenSSH" -Direction Inbound -Action -Allow -Protocol TCP -LocalPort 22
#!/bin/bash
# This script runs ssh-agent if it does not running
# or uses existing ssh-agent instance.
# Loads a private key ONLY IF you are running an interactive shell.
cat << 'SH' >> ~/.profile
export SSH_AUTH_SOCK=$(\
find /tmp \
-path '*/ssh-*' -name 'agent*' -uid $(id -u) 2>/dev/null \