/ Welcome to my site.
Everyone should have a webpage. Here is mine. Feel free to look around.
Why does this page look like it looks? Because it's a motherfuckingwebsite.
// Write-ups
- Bash on the Web - Running bash scripts via Apache CGI
- GPG Cheat Sheet - Encryption, signatures, and key management
- Linux Gaming - The hunt for the lowest input latency
- ThinkPad X220 Thermal Repaste Analysis - Thermal before/after benchmarks
- Tor Onion Service Setup - Explanation and setup script
// Some projects i participate in
❔ escaperoomhacked.net🎁 heywop.com
🎮 le-lan.ch
❤️ ravemitherz.li
// Snippets and Notes
System Administration
/// Set default alsa device
Find desired device
$ cat /proc/asound/cards
then create /etc/asound.conf with following:
defaults.pcm.card 1
defaults.ctl.card 1
Replace "1" with the number of your card.
/// Display file sizes
$ du -sh *
# Include hidden files
$ du -sh .[!.]* * | sort -h
$ du -sch .[!.]* * | sort -h
/// Print octal file permissions
$ stat -c "%a %n" *
$ stat -c "%a %n" .*
/// Get files used by certain process
$ pgrep httpd | xargs -I {} -n 1 lsof -p {}
/// Set a SASL password for virsh
$ saslpasswd2 -a libvirt "username-here"
Storage & Partitioning
/// Create dummy files
# Assuming you want to create a file having 100M size.
$ dd if=/dev/zero of=/tmp/100M_dummy_file bs=100M count=1 status=progress
/// ESXi increase VM disk size, no reboot
# Part1:
# In the esxi GUI increase the VM's disk size.
# Part2:
# Open a shell to your VM and tell the kernel to rescan your device. In this case sda.
$ echo 1 > /sys/class/block/sda/device/rescan
# Install growpart
$ yum install cloud-utils-growpart
$ apt install cloud-guest-utils
# Expand your partition using growpart. (Yes there is a space between /dev/sda and the partition number. Odd syntax right?)
$ growpart /dev/sda 2
# And finally resize your file system to the newly acclaimed space
$ resize2fs /dev/sda2
/// Resize ext4 partition
!Make backups before messing with any data!
# Example given:
+--------------------------------+--------+
| /dev/sda1 (ext4) | Free |
+--------------------------------+--------+
# Unmount partition
$ umount /dev/sda1
# Use fdisk to remove the partition. Then add the same partition but larger at the same location.
$ fdisk /dev/sda
# Resize the fs on your partition
$ resize2fs /dev/sda1
# Check partition state
$ e2fsck /dev/sda1
# Remount your partition
$ mount /dev/sda1 /whatever
Networking
/// arp-scan to discover devices
$ arp-scan -I enp0s25 -l
/// SSH port forwarding
# Example hosts used:
# A: 192.168.1.10 (local machine)
# B: 10.10.10.10 (target server)
# C: 172.16.1.10 (jump host)
# D: 172.16.1.250 (second jump host)
# Local port forwarding: Connect local port 2222 to port 22 on machine B via jump host C
[user@A]$ ssh -L localhost:2222:10.10.10.10:22 user@172.16.1.10
# Use the forwarded connection with X11 forwarding
[user@A]$ ssh -p 2222 -X localhost
# Now X11 programs on B will display on A
[user@B]$ firefox
# Port forwarding through multiple jump hosts (C and D) to reach B
[user@A]$ ssh -L localhost:1236:10.10.10.10:8443 -J user@172.16.1.10,user@172.16.1.250 user@10.10.10.10
/// Debian: interface configuration
$ vim /etc/network/interfaces
auto "interface_name"
iface "interface_name" inet static
address XXX.XXX.XXX.XXX
netmask XXX.XXX.XXX.XXX
gateway XXX.XXX.XXX.XXX
dns-nameservers XXX.XXX.XXX.XXX XXX.XXX.XXX.XXX
$ systemctl restart networking
/// Debian: disable ipv6
# check if it is enabled
$ sysctl net.ipv6.conf.all.disable_ipv6
# disable
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf
# apply changes
sysctl -p
Data & Text Processing
/// Viewing CSV
$ column -t -s, file.csv | less -S
/// Date calculations with the date command
$ date -d "${date} - 31 days"
$ date -d "+1 days"
$ date -d "Sun Sep 11 07:59:16 IST 2012+10 days"
$ prog_end_date=$(date '+%C%y%m%d' -d "$end_date+10 days")
Shell & Debugging
/// Bash sessions
found on this blog: https://www.thanassis.space/bashheimer.html
# Find current users bash handler
$ readlink /proc/$$/fd/1
/dev/pts/13
# Test with:
$ echo "Test" >> /dev/pts/13
# Get the pid of the current shell:
$ echo $$
# Start a gdb session on this pid:
$ sudo gdb --pid 1234
# Call the write history. This maybe has to be casted as an int:
$ call write_history("/tmp/foo")
$ call (int) write_history("/tmp/foo")
# Find your result:
$ less /tmp/foo
// Check out these links...
// Donations
Any donations are very welcome!
-
Monero
NOTE: If you want to contact me in a secure way use my gpg key: A499EB5B85717E49BACDCBDF04B61E5C476E329B