Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import math
def amp_power_required(lreq, spl, hr, d2, dref):
dBW = lreq - spl + (20 * math.log10(d2 / dref)) + hr
return math.pow(10, dBW / 10)
# Speaker sensitivity measured at 1 W at 1 meter distance
spls = [82, 84, 86, 88, 91, 92, 94, 96, 98]
@rtgnx
rtgnx / config
Created August 18, 2023 12:11
rofi
rofi.color-enabled: true
rofi.color-window: #1E1E1E, #1E1E1E, #1E1E1E
rofi.color-normal: #1E1E1E, #FFFFFF, #1E1E1E, #268BD2, #1E1E1E
rofi.color-active: #1E1E1E, #FFFFFF, #1E1E1E, #268BD2, #1E1E1E
rofi.color-urgent: #1E1E1E, #FFFFFF, #1E1E1E, #FF5555, #1E1E1E
rofi.location: 0
rofi.width: 60
rofi.lines: 10
rofi.line-margin: 6
rofi.line-padding: 12
@rtgnx
rtgnx / ping-stat
Created November 3, 2020 21:33
Measures latency to a host (Threaded) and plot it with matplotlib
import re
import sys
import click
import logging
import numpy as np
import matplotlib.pyplot as plt
from subprocess import check_output
man bash | sed 's/./&\n/g' | awk -v mx=$COLUMNS -v my=$LINES 'BEGIN{x=y=e=f=1}{if(x==mx||!x){e*=-1};if(y==my||!y){f*=-1};x+=e;y+=f;printf "\033[%s;%sH%s",y,x,$1;for (a=0;a<400000;a++){}}'

Keybase proof

I hereby claim:

  • I am rtgnx on github.
  • I am rtgnx (https://keybase.io/rtgnx) on keybase.
  • I have a public key whose fingerprint is A301 BA41 642B 7642 2D85 7D7B AEDA 0B12 C01F AFE2

To claim this, I am signing this object:

@rtgnx
rtgnx / getpass.sh
Created September 16, 2018 09:31
Select password from password store with rofi. Fills clipboard with garbage after 30s
#!/bin/bash
[ ! -f "$(command -v rofi)" ] && echo "rofi not found" && exit 1
[ ! -f "$(command -v pass)" ] && echo "pass not found" && exit 1
PASWORD_STORE="$HOME/.password-store"
garbage() {
# Use only for throwing garbage into clipboard !!!!
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 32 | head -n 1
@rtgnx
rtgnx / wifi.sh
Created July 20, 2018 17:13
Wifi menu script
#!/bin/bash
function wifi_list() {
wpa_cli list_networks | tail -n +3 | rofi -dmenu | cut -d' ' -f1
}
wpa_cli select_network "$(wifi_list)"
@rtgnx
rtgnx / png_fix.go
Created June 2, 2017 00:48
Solution to challenge from live stream (https://goo.gl/jRPkth)
package main
/*
Solution to challenge from live stream (https://goo.gl/jRPkth)
Generate colormap
perl -e ' print "\xff\x00\x00\x00\xff\x00\x00\x00\xff\xff\xff\x00"; print "\x00"x12;' > colormap.bin
$: go run png_fix.go file.png colormap.bin
@rtgnx
rtgnx / [email protected]
Created February 3, 2017 18:20
[PGP] Public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFfluOABEADEJq5tNGzOLBrJ2ciZmIniDlw04XOO7O7Mb0LPyOMeX2Bhkjlt
iZ6ndQ/kDC71tNzRlR0I5kf4MTcJj6/YTinEUZ2U91GjRpaUGEENIjawX1RJwdU6
LYkJhE4aj5Y9RA3r955NAMJg68U4rMnAI7f5tNgG/yJYGG5rYPezNhVpmuCDZlOv
UG3BDInGB9t51+38PDRaG/i4IcMTJHSTe5FiHRtVzJSRBBAFkmra+sRErLyl6sg+
iKC0wWLWRw6wIlNIeCCRvT1xywez6D/kTnyTUSwOgu2Q57JvyJ70ddf/zxxLbu/B
XJtsinup9YPIkhUThueRl7kqSV7ONmWba7b5lGKhBqwGJM57ke2UHyNevDpga5W5
yq3J9maPDE9BmFXYTVyXuJ6G3bw8o78vtIdSTEPsqcaBvI5wWrhs5Tc41qAl/fHe
t/fDoSFNseUGecWwMI+GulaXbAW7xjAeDdARt1fJztTSvbqhRlBZRTTlnZOVvo1v
@rtgnx
rtgnx / container.json
Last active September 27, 2016 15:34
[JSON] systemd container description file
{
"name": "test",
"_comment": "type is either arch or image",
"type": "arch|image",
"_comment": "if arch then specifiy packages beside base ",
"packages": [
"vim",
"git"
],
"_comment": "if image then specifiy either url or path to img",