Skip to content

Instantly share code, notes, and snippets.

View subnut's full-sized avatar
🏛️
Busy. Very very Busy.

Subhaditya Nath subnut

🏛️
Busy. Very very Busy.
View GitHub Profile
@media print {
#preview-page {
margin: 0;
}
.repository-content > div > h3 {
display: none;
}
@subnut
subnut / swap_ctrl_caps.ps1
Created April 16, 2021 19:58 — forked from wfxr/swap_ctrl_caps.ps1
Swap ctrl and capslock in Win10
$hexified = "00,00,00,00,00,00,00,00,03,00,00,00,3A,00,1D,00,1D,00,3A,00,00,00,00,00".Split(',') | % { "0x$_"};
$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';
New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);
@subnut
subnut / tinyproxy.conf
Created August 11, 2021 18:17
Minimum config required to get subdomains using tinyproxy
Port 80
ReverseOnly Yes
MaxClients 100
StartServers 10
MinSpareServers 5
MaxSpareServers 20
Upstream http localhost:4567 "subdomain1.hostname.com"
Upstream http localhost:5678 "subdomain2.hostname.com"
@subnut
subnut / sudo_logexclude_pihole.sh
Created August 13, 2021 08:43
Exclude successful invokations of `sudo pihole ...` being logged to syslog
sudo tee /etc/sudoers.d/020_pihole >/dev/null <<EOF
Cmnd_Alias PIHOLE = $(command -v pihole)
Defaults!PIHOLE syslog_goodpri=none, !pam_session
EOF
sudo chmod 0440 /etc/sudoers.d/020_pihole
@subnut
subnut / transient_prompt.zsh
Last active November 10, 2024 14:22
Transient prompt for zsh (insipred by romkatv's powerlevel10k)
### Simple transient prompt
[[ -c /dev/null ]] || return
zmodload zsh/system || return
## Set the transient prompt PROMPT here -
TRANSIENT_PROMPT='%# ' # Sample value
function set_prompt {
## Set the values of PROMPT and RPROMPT here

Create Root Certificate Authority and self-signed certificate for your Home Assistant. Compatible with Chrome browser > version 58, including the macOS Catalina 10.15 / iOS 13 (and above) new requirements.

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@subnut
subnut / init.el
Last active February 2, 2022 15:40
Emacs config
"Required fonts -
| Name | Usage | URL |
|-------------+--------------------+-----------------------------------------------|
| Victor Mono | default | https://github.com/rubjo/victor-mono |
| Roboto Mono | fixed-pitch | https://fonts.google.com/specimen/Roboto+Mono |
| Bitter | variable-pitch | https://fonts.google.com/specimen/Bitter |
| Lobster Two | org-document-title | https://fonts.google.com/specimen/Lobster+Two |
"
;; Enable MELPA
@subnut
subnut / glirc2_config
Created February 2, 2022 15:40
config for glirc2 (aka. glguy/irc-core)
activity-bar: yes
show-ping: yes
nick-padding:
side: left -- try right if you don't like left padding
width: 20
macros:
* name: "shrug"
commands: "say ¯\\_(ツ)_/¯"
@subnut
subnut / dbus-run-session.sh
Created February 7, 2022 14:01
Alternative to dbus-run-session
#!/bin/sh
{ { ADDRESS=$(dbus-daemon --session --print-address 1 --print-pid 2 --fork); } 2>&1
echo $ADDRESS; } | { tr '\n' ' '; echo; } |
read DBUS_DAEMON_PID DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_ADDRESS
"$@"; EXITCODE=$?
kill $DBUS_DAEMON_PID
exit $EXITCODE
@subnut
subnut / ssh-askpass.sh
Created February 7, 2022 14:06
ssh-askpass using zenity
#!/bin/sh
## Logging purposes
# PREVDIR=`pwd`
# cd "$(dirname "$0")"
# exec 1>./log.txt
# exec 2>./log_err.txt
# echo '$PREVDIR:' "$PREVDIR"
# echo '$1:' "$1"
# env | grep ^SSH_