# Goto the end of file Alt + /
# Goto specific line Ctrl + _
# Install Raspbian SO, you can get it at https://www.raspberrypi.org/documentation/installation/installing-images/ | |
# Connect to a screen and login onto the raspberry, user "pi", password "raspberry" | |
# Activate the SSH server running the command: | |
sudo raspi-config | |
# Select and then 7-Advance Options -> Expand Filesystem | |
# Select and 5-Interfacing Options -> Activate the SSH server. | |
# Also want to 4-Localisation Options -> configure the WiFi country; at select and select your contry. | |
# After those changes you need to reboot the machine. |
# Doc from https://wiki.gentoo.org/wiki/SSH_jump_host | |
ssh -J jump_named_configured_at_conf,user@host_jump user@end_machine |
# On a docker container force to not reach Internet/connectivity | |
# The docker must be started as a privileged with the param --privileged and | |
# on the running container, you must have iptables installed (apt-get install iptables), | |
# then you can run: | |
# To avoid all connectivity at all | |
iptables -A OUTPUT -j DROP | |
# Avoid all connectivity on a specific interface | |
iptables -A OUTPUT -o eth1 -j DROP | |
# Avoid connectivity to a specific IP |
# View the source code of any function in use directly at the debugger, useful to be sure what code are you executing | |
import inspect | |
print(''.join(inspect.getsourcelines(NAME_OF_METHOD_TO_SEE_SOURCE_CODE)[0])) | |
# Create a virtual environment with a specific python version | |
virtualenv --python=/usr/bin/python2.7 ~/.virtualenvs/test | |
-- Look for a table filtering by the name (MySql) | |
-- If you already has the database selected | |
SHOW TABLES LIKE '%_name' | |
-- If the database is not selected | |
SELECT TABLE_NAME | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_NAME like '%_name' | |
and TABLE_SCHEMA = 'your_db_name' |
# Goto the end of file Alt + /
# Goto specific line Ctrl + _
# Force a shellscript to run from its folder, instead the current directory | |
# folder where was called from. Useful to use relative paths. | |
# Set the folder to project, no matter from where the script was called. | |
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
pushd $SCRIPT_DIR | |
# Test the connectivity from a machine to another and the port | |
nc -vv 192.168.1.200 80 |
# _____ _ | |
# | __ \ | | | |
# | |__) |___| |__ __ _ ___ ___ | |
# | _ // _ \ '_ \ / _` / __|/ _ \ | |
# | | \ \ __/ |_) | (_| \__ \ __/ | |
# |_| \_\___|_.__/ \__,_|___/\___| | |
# | |
# At the branch containing all the changes you must run... | |
git checkout BRANCH_WITH_ALL_CHANGES | |
git rebase -i BRANCH_TO_PUT_CHANGES_INTO |
# In the first machine just execute the tool netcat with the port to test and in listening mode | |
nc -lp 8080 | |
# In the second machine just execute also the netcat but connecting to the previous machine by IP | |
# or and nameserver, and to the same port | |
nc 123.123.123.123 1 8080 | |
# From now on all wrote in any machine must appear at the other after INTRO | |
# This can be used to test connectivity issues between machines, docker containers, etc. |
# After open a lot of console windows with the csshX (ClusterSSH), if the windows are too small to work with, | |
# then is better to resize the consoles and view only one (the rest will be also executing the same commands) | |
# in order to be able to work for example with some editors and other stuff. | |
# move the console to 0,0 | |
printf '\e[3;0;0t' | |
# resize to 27x85 characters (laptop) | |
printf '\e[8;27;85t' |