Skip to content

Instantly share code, notes, and snippets.

View alsunseri's full-sized avatar

Al Sunseri alsunseri

  • NYC, NOLA
View GitHub Profile
@alsunseri
alsunseri / clear-client-and-browser-dns-cache.txt
Created November 10, 2020 22:58
Clear DNS cache on client browsers and workstations.
When changing DNS, host entries, routes etc. Or when testing vpn leaks, etc.
Also needed when migrating servers
Windows: Press Win + R and run cmd. Execute command ipconfig /flushdns.
MacOS: Open Terminal and execute command sudo killall -HUP mDNSResponder.
Ubuntu: Open Terminal and execute command sudo service network-manager restart.
You may also need to clear DNS cache in your browser.
Found: master for n1trux/awesome-sysadmin — A curated list of amazingly awesome open source sysadmin resources. — 3174⭐️ — last updated 14 days ago
🔎 Checking 407 links
⚪ https://easybuild.readthedocs.org/en/latest/
⚪ http://cobbler.github.io/
⚪ http://andrewchilds.github.io/overcast/
⚪ http://tumblr.github.io/collins/
⚪ https://retspen.github.io
⚪ http://hekad.readthedocs.org/en/latest/
⚪ https://phpsysinfo.github.io/phpsysinfo/
⚪ http://graphite.readthedocs.org/en/latest/
@alsunseri
alsunseri / Amazon_AWS_Linux_2_on_KVM_qemu.md
Last active October 31, 2024 20:36
Install and run Amazon AWS Linux 2 locally on KVM virt-manager with qemu virtual disk
@alsunseri
alsunseri / mount_luks-qubes-OS_in_debian.txt
Created December 28, 2020 23:29
mount qubes LUKS drive in debian
# lsblk -e7
# udisksctl info -b /dev/sdXn
# sudo cryptsetup luksOpen luks-UUID
> Enter PassPhrase
# lsblk -e7
# mkdir /mnt/yada # if needed
# mount /dev/mapper/qubes_dom0-root /mnt/yada
@alsunseri
alsunseri / irb_console_db_migration.txt
Created June 4, 2021 22:14
run migration via rails console
[6] pry(main)> require "./db/migrate/20201216202520_add_activity_logging_to_user.rb"
=> true
[2] pry(main)> AddActivityLoggingToUser.new.up
=> nil
[3] pry(main)> AddActivityLoggingToUser.up
=> nil
[4] pry(main)> AddActivityLoggingToUser.new.migrate(:up)
== AddActivityLoggingToUser: migrating =======================================
-- add_column(:users, :last_login_from_ip_address, :string, {:default=>nil})
(1.5ms) ALTER TABLE "users" ADD "last_login_from_ip_address" character varying DEFAULT NULL
@alsunseri
alsunseri / fix_too_many_ssh_auth_fails.txt
Created June 30, 2021 18:00
fix for ssh "too many authentication failures"
If ssh on - for example, Debian - starts failing to log into a server even though you know you have the right key.
Also works when you intend to use a password but ssh client fails before allowing that method.
You can tell the ssh client to ignore the default identity files and only attempt one specific file.
$ ssh -o 'IdentitiesOnly=yes' -i ~/.ssh/correct_id_file user@host
IdentitiesOnly
Specifies that ssh(1) should only use the authentication identity and certificate files explicitly configured
in the ssh_config files or passed on the ssh(1) command-line,
@alsunseri
alsunseri / show_block_size.sh
Last active October 23, 2021 01:13
get block size of linux drive partition or disk
#!/usr/bin/env bash
# blockdev is in the util-linux package and the binary is in /sbin usually
# util-linux: /sbin/blockdev
# Display an error message if the partition (input) is not
# Exit the shell script with a status of 1 using exit 1 command.
[ $# -eq 0 ] && { echo "Usage: $0 partion"; exit 1; }
PARTITION=$1
/sbin/blockdev --getbsz $PARTITION
@alsunseri
alsunseri / show_cert_serial.sh
Last active October 23, 2021 01:13
show SSL certificate file serial number via CLI
#!/usr/bin/env bash
# Display an error message if the command does not include a filename
# Exit the shell script with a status of 1 using exit 1 command.
[ $# -eq 0 ] && { echo "Usage: $0 certfilename"; exit 1; }
CERTFILE=$1
openssl x509 -noout -serial -in $CERTFILE
# for formatting the output in quad see
@alsunseri
alsunseri / add_disk-space_to_debian_guest-vm.txt
Created October 28, 2021 02:23
move swap partition before using growparts and resize2fs on vda1 for debian guest in KVM with qemu qcow2 drive
Debian desktop vms add swap partitions at the end of the virtual /dev/vda drive.
In order to take advantage of new space added via virsh one has to take the swap partition into account.
The new space will be added after the extended and swap partition so to speak.
So before growpart will work one has to move the swap partiion to the end of the disk.
Then vda1 can grow up to the start of the new extended or swap partition
@alsunseri
alsunseri / grep-for-tabs.txt
Created December 4, 2021 06:36
grep for tabs
Several methods depending on the implementation of grep or whether the grep needs to be scripted etc.
1: If grep comes compiled with perl regex support use 'grep -P '
grep -P "\t" filelist
embedded in a pattern:
grep -P "^1.1G\t" /tmp/du-h-output.txt
2 this is neat - grep -G $'\t'
it works in larger patterns as well:
grep -G "^1.1G"$'\t' /tmp/du-h-output.txt