I recently started having issues with my Yubikey / Security Key that I use for Gitea, and was unable to login.
This explains how to fix it.
Connect to the database. I only have a single user, and so I use the sqlite3 database backend.
$ sqlite3 gitea.db
sqlite> select id from user where name="wkumari";
sqlite> delete from u2f_registration where user_id =1;
This still didn't work -- and then I noticed that the url ended in 'webauthn', so I also did:
$ sqlite3 gitea.db
sqlite> select * from webauthn_credential;
sqlite> delete delete from webauthn_credential where id=2;
Done!
For a long time I ran the 'fish' shell, with the Oh My Fish extension and Agnoster theme. I did this purely because I like the magic autocompletion, but never really liked it, because it has some very strong views on things like scripting, gratuitiously differnt syntax, etc. E.g:
echo $(PATH)
fish: $(...) is not supported. In fish, please use '(PATH)'
After a friend showed me that the combination of zsh, Oh My Zsh and zsh-autosuggestions I moved to this, and am much much happier.
However, every now and then I still pick up and use a machine which I haven't yet migrated. I recently did this and ran into the annoying error:
~ $
fatal: not a git repository (or any of the parent directories): .git
~ $
fatal: not a git repository (or any of the parent directories): .git
This happens on every command, after just pressing enter, etc because it is actually part of building the prompt. I knew I'd run into this before, and that the root cause had filled me with rage, but it once again took some digging to find and fix.
My fish prompt included:
command git rev-parse --is-inside-work-tree ^/dev/null >/dev/null
and, apparently, in some fish update they decided that ^ is no longer a supported redirection, and so I had to change this everywhere to 2> so:
command git rev-parse --is-inside-work-tree 2>/dev/null >/dev/null
So, next time I run into this:
grep -r '\^[/&]' ~/.config/fish/
and then go fix them... or, better yet, get around to removing fish and adding zsh instead...
I use fail2ban to stop annoying things like ssh bruteforcers, etc.
Sometimes I accidentally manage to get my own address added, or need to unblock a specifc address. Here's how:
user> sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
| |- Currently failed: 0
| |- Total failed: 3
| `- File list: /var/log/auth.log
`- Actions
|- Currently banned: 1
|- Total banned: 1
`- Banned IP list: 192.0.2.1
And then to remove the IP:
user> sudo fail2ban-client set sshd unbanip 76.104.43.89
tcpdump can be configured to write its capture to standard out, and Wireshark can read from standard in. SSH allows you to remote exec a command, and have it stream the output back.
This allows one to perform a remote Wireshark capture quickly and easily - one of the nice uses for this is to perform captures from a Ubiquti router. For exmaple:
ssh 192.168.0.1 'sudo tcpdump -f -i eth1 -w - port 53' | /Applications/Local/Wireshark.app/Contents/MacOS/Wireshark -k -i -
This ssh's to my home router, and starts tcpdump listening on interface eth1. It writes the output to STDOUT ('-w -') and only captures port 53. This then streams to wireshark on my local machine (-k is "start capturing immediately" and -i is interface -- in this case, STDIN (-)).
I need to do this fairly frequently, and for some reason I can never remember the steps, so I'm writing it down!
This isn't news, it is lifted from the GitHub Configuring a remote for a fork and Syncing a fork pages.
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
-
Make your edits, etc. Push (this will push to your fork), make pull-request. Next time you need to sync the orogin, start at the '
git fetch upstream
' step.