Skip to content

Instantly share code, notes, and snippets.

View MartinBrugnara's full-sized avatar

Martin Brugnara MartinBrugnara

View GitHub Profile
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
# PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
PROMPT+=' %{$fg[cyan]%}%/%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@MartinBrugnara
MartinBrugnara / Missing user on lightdm login screen
Created July 1, 2021 14:47
Missing user on lightdm login screen
We identified 3 possible "common" causes:
1) If no user shows up at all, check for `greeter-hide-users=false` in `/etc/lightdm/lightdm.conf.d/*` , if missing create it.
See also: https://wiki.debian.org/LightDM#Enable_user_list
2) If only some of the users shows up, or step 1 is already correct. Check for MIN_UID/MAX_UID settings.
Most likely locations:
- /etc/lightdm/users.conf --> `minimum-uid`
- /etc/login.defs
@MartinBrugnara
MartinBrugnara / NFS 4 uses wrong clientaddr
Created March 27, 2021 18:00
NFS 4 uses wrong clientaddr
TL;DR; Force the use nfs4.0 (the issue arises with nfs > 4.1).
# Situation:
* NFS server with multiple IP. E.g. different subnets for different access levels and or bandwidth/MTU.
IPs
192.168.10.1
192.168.20.1
Exports:
/srv/nfs/lvl10 192.168.10.0/255.255.255.0
@MartinBrugnara
MartinBrugnara / systemd-networkd-wait-online.service
Created February 10, 2021 21:23
systemd-networkd-wait-online stuck with all relevant interfaces online
By default will wait on all the interfaces managed by `systemd-networkd` to come online and get fully configured.
All interfaces that appear in any file in `/etc/systemd/network` (and friends) are considered managed.
We can use `networkctl` to see the actual "configuration progress status". Any interface stuck on "configuring" is an issue.
While this is usually an indication of network problem, it may be a false positive, for example:
* Slave interfaces in a bond
* Slave interfaces in a bridge
Since these interfaces appear in the folders above but do not have any ip will never reach the state of "configured",
hence the service will halt.
@MartinBrugnara
MartinBrugnara / EdgeRouter PPPoE Public IP - Port forwording
Last active March 27, 2021 17:29
EdgeRouter PPPoE Public IP / Port forwording
Symptoms: Port forwarding not working, machine not reachable from outside, strange public IP.
By default, many ISPs that use PPPoE for authentication do not automatically assign a public IPv4 (to save some..),
you may have to ask your ISP to assign one to you either static or dynamic.
By default, EdgeRouter does not setup the IP (if) provided by the ISP when connecting via PPPoE.
To use the IP, execute the following procedure:
- From the dashboard
Select "Actions" on the PPPoE interface
Then "config"
@MartinBrugnara
MartinBrugnara / gist:271824d98e975d145b888043f3248bb9
Last active December 31, 2020 12:22
Windows native & WSL2 SSH with gpg cards support (e.g. yubikey)
Windows & WSL1 & WSL 2 SSH with gpg cards support
>> Windows & WSL1
Based upon:
- https://www.antirandom.com/2020/03/ssh-on-windows-with-private-key-on-yubikey/
- https://github.com/benpye/wsl-ssh-pageant
Requirements:
- [win] gpg4win
@MartinBrugnara
MartinBrugnara / doc.txt
Last active March 26, 2024 03:50
DigitalOcean, assign public ipv6 to wireguard clients
# /etc/sysctl.d/wireguard.conf
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.eth0.proxy_ndp=1
#/etc/wireguard/wg0.conf (DO virtual machine)
[Interface]
# The server interface does not actually need an ipv6.
# The 2 following must be repeated for each used addres [0, 1]
@MartinBrugnara
MartinBrugnara / Elementary_OS.setup
Created May 15, 2018 21:21
Elementary OS setup
Hide users:
sudo vim /var/lib/AccountsService/users/<username>
```
[User]
SystemAccount=true
```
Install scanner (default lib is too old and buggy)
```
@MartinBrugnara
MartinBrugnara / 85-yubikey.rules
Last active August 9, 2021 19:51
Xscreensaver autolock on yubikey remove
# /etc/udev/rules.d/85-yubikey.rules
# https://stackoverflow.com/questions/13699241/passing-arguments-to-shell-script-from-udev-rules-file#14982520
# https://askubuntu.com/questions/635266/use-of-yubikey-neo-for-login-2fa-and-lock-screen#635267
# Bus 001 Device 012: ID 1050:0407 Yubico.com
ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", RUN+="/usr/local/bin/yubikey_lock.sh '%E{ID_SERIAL}' '%E{ID_MODEL_ID}'"
@MartinBrugnara
MartinBrugnara / fixing_matrix.rb
Created April 23, 2018 07:23
fixing_matrix.rb
#!/usr/bin/env ruby
# matrix.rb
# MB version (heavily broken)
# class MatrixArgumentError < ArgumentError; end
# class MatrixRuntimeError < RuntimeError; end
class Matrix