This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # multi-threaded off | |
| 7z b -mmt=off | |
| # 4 threads | |
| 7z b -mmt=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # get config for which branches will get pulled | |
| git config --get remote.origin.fetch | |
| # e.g. only master: +refs/heads/master:refs/remotes/origin/master | |
| # set config to pull all branches | |
| git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://wiki.archlinux.org/title/Identify_damaged_files#Force_the_disk_to_reallocate_bad_block | |
| # scan entire disk for bad blocks (slow but complete) | |
| sudo badblocks -v -b 4096 /dev/sda | |
| # smartctl test find bad block (fast but not complete) | |
| sudo smartctl -t short /dev/sda | |
| # get block number of error | |
| sudo smartctl -a /dev/sda | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 16 TB drive with ext4 file system optimized for max available space: | |
| # -------------------------------------------------------------------- | |
| $ sudo mkfs.ext4 -m 0 -T largefile4 /dev/sdX | |
| /dev/sdX: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54 | |
| /dev/sdX: 8 bytes were erased at offset 0xe8d7dfffe00 (gpt): 45 46 49 20 50 41 52 54 | |
| /dev/sdX: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa | |
| /dev/sdX: calling ioctl to re-read partition table: Success | |
| mke2fs 1.45.5 (07-Jan-2020) | |
| Creating filesystem with 3906461696 4k blocks and 3814912 inodes | |
| Filesystem UUID: 3ea950c5-ae13-4755-a6b8-6f317f6f8dea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -e | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "This script must be run as root" | |
| exit 1 | |
| fi | |
| grep "^HostKey" /etc/ssh/sshd_config | while read -r HOST_KEY; do | |
| KEY_FILE=$(echo "$HOST_KEY" | cut -d' ' -f2) | |
| KEY_DIR=$(dirname "$KEY_FILE") | |
| KEY_TYPE=$(echo "$KEY_FILE" | cut -d'_' -f3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run this every time you open spotify (after it has launched and says it is offline) | |
| # it probably notices network manager is stopped for a second which disables the check | |
| sudo systemctl restart network-manager.service | |
| # turning off network manager makes it immediately show online when it starts up | |
| sudo systemctl stop network-manager.service | |
| sudo systemctl disable network-manager.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SERVER=<your-server> | |
| DOMAIN=<your-domain> | |
| ssh-keygen -R ${SERVER} | |
| ssh-keygen -R ${SERVER}.${DOMAIN} | |
| ssh-keygen -R $(dig +short ${SERVER}.${DOMAIN}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # list of hostnames from file | |
| ssh-keyscan -H -f /<path>/<to>/<file> >> ~/.ssh/known_hosts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # requires docker-cli 19.03 or higher | |
| docker run --privileged linuxkit/binfmt:v0.7 | |
| export DOCKER_CLI_EXPERIMENTAL=enabled | |
| docker buildx use arm64builder || docker buildx create --name arm64builder --use | |
| docker buildx inspect --bootstrap | |
| docker buildx build --platform=linux/arm64 -t <tag> -f <docker-file> . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nmap -p <port> 192.168.0.*|grep -B3 open |