Skip to content

Instantly share code, notes, and snippets.

View chasgames's full-sized avatar
🎯
Focusing

chasgames

🎯
Focusing
View GitHub Profile

In this example, setting up from Windows Machine, and logging in from Linux machine.

Windows:

Git Bash - RUN as admin (won't work without run as admin)

ssh-keygen -t ed25519-sk -O resident -O verify-required -O application=ssh:gserv3 -f ~/.ssh/gserv3 (optional -O user=chas -C "gserv testing")
eval $(ssh-agent -s)
ssh-add -K -S internal (on linux just ssh-add -K)\

@chasgames
chasgames / gist:4fabc342f1f4318e0fb88e40dda1953d
Created September 30, 2022 10:47
GIT get contents of file
1.1.1.1 = filename
### get commit ids
git --git-dir repo.git log -n 75 -- 1.1.1.1
### get full commit version
git --git-dir repo.git show COMMITID:1.1.1.1
@chasgames
chasgames / gist:406406aa64e1310ccc8b85e174232248
Created March 19, 2022 21:00
Tesseract on Windows (Python and PIP)
https://github.com/UB-Mannheim/tesseract/wiki
System Environment -> Edit "Path" -> New -> Tesseract Directory
python -m ensurepip --upgrade
pip install opencv-python
pip install pytesseract
pip install tesseract
@chasgames
chasgames / Store SSH keys on Yubikey 5 using FIDO2.md
Last active February 4, 2025 12:38
Store SSH keys on Yubikey 5 (using FIDO2)

This is probably the best way to store SSH keys on the Yubikey 5, this allows you to move around freely without needing to store private key files directly on every file system you want to connect from. There are some other possible methods also e.g GPG or PKCS11.

This method is only possible since 2020-02-14, OpenSSH 8.2 was released to add FIDO2/U2F hardware authenticator support.

This guide is for setting it up on Windows, for Linux it will be even easier.

Caveats:

  • The newer FIDO/U2F key types are only supported, ecdsa-sk and ed25519-sk (sk = security key)
  • The Yubikey 5 should be able to store up to 25 keys. (Alternatively use Solokeys for 50 keys)
  • Storing both parts of a key on a FIDO token increases the likelihood of an attacker being able to use a stolen token device. We will add a PIN to help mitigate this, you can also further add a passphrase to your key.
@chasgames
chasgames / automount.md
Last active February 11, 2021 17:10
Auto mount USB drive using systemd (Ubuntu/Debian)

Auto mount USB using systemd (Ubuntu/Debian)

NO fstab, just plain ol systemd. (systemd.mount systemd.automount features)

Note, if your USB is formatted with FAT32 and NTFS then everything will be locked to root, chown and chmod will not work. Format the USB with Ext4 otherwise to play nicely with linux users.

Get name of USB drive

lsblk

Get UUID of USB drive

### One-liner in bash to expand all subnets and save to new file
while read p; do $(nmap -n -sL $p | awk '/Nmap scan report/{print $NF}' >> allips); done < allipsubnets
### One-liner in bash to get all the IPs and find them in txt file.
### ^ used to find compare IP at starting line, otherwise can pick an IP within IP. e.g. 1.1.1.1 will find 21.1.1.1
while read p; do $(grep -n "^$p" ~/myfolder/*.txt >> output &); done < allips
### COPY OUTPUT of PANE
CTRL+B + :
type "capture-pane -S -3000" + return (Replace 3000 with however many lines you'd like to save.)
This copies those lines into a buffer.
#### SAVE to FILE
CTRL+B + :
type "save-buffer filename.txt" + return.
#!/bin/bash
#For cronjob - /usr/bin/tmux new-session -d -s my_session '/bin/bash hello.sh;bash -i'
#bash -i, makes bash interactive so the tmux session does not close.
tmux new-session -d -s my_session 'bash hello.sh;bash -i'
@chasgames
chasgames / gist:06cd7d1f5b3122b401b4a84376b8f3ae
Last active October 14, 2019 15:42
grep match ipv4/cidr e.g 127.0.0.1/32
grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}\b"
@chasgames
chasgames / README.md
Created January 15, 2018 15:16 — forked from christiannelson/README.md
Docker in 10 Minutes - Lightning Talk

Docker in 10 Minutes

What is Docker?

Docker is an open-source project to easily create lightweight, portable, self-sufficient containers. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.

What can you do with Docker?