Skip to content

Instantly share code, notes, and snippets.

DNSSERVER=8.8.8.8; while true; do dig @$DNSSERVER www.google.com | grep time|awk '{print $1"@"$DNSSERVER}'; sleep 0.5; done
@thiagoeh
thiagoeh / python-jupyter-setup.sh
Last active March 26, 2018 20:07
Basic setup of ipython from a basic Debian install
# You should have a basic install after this
sudo apt-get update && sudo apt-get install --yes python3-pip
# Updating pip3, following the recomendation on https://jupyter.readthedocs.io/en/latest/install.html
# sudo is optional in this step
sudo pip3 install --upgrade pip
# Installing virtualenv. Instructions: https://virtualenv.pypa.io/en/stable/installation
sudo pip3 install virtualenv
@thiagoeh
thiagoeh / debian-afterinstall-laptop-setup.sh
Created March 26, 2018 22:25
Basic after install setup for Debian running in a laptop
apt-get update
# Ansible
apt-get update
apt-get install dirmngr
@thiagoeh
thiagoeh / ssh-setup.sh
Last active March 27, 2018 01:41
SSH setup for a new host
#!/bin/bash
# SSH server installation
sudo apt-get update
sudo apt-get install --yes ssh
# mosh and tmux make life easier :)
sudo apt-get install --yes mosh tmux
## https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
sudo apt-get install apt-transport-https
pip3 install --user --upgrade awscli
aws --version
@thiagoeh
thiagoeh / youtube-dl
Last active April 17, 2021 14:56
Some useful youtube-dl commands
pip3 install --user --upgrade youtube-dl
# Download a youtube playlist, only videos newer than 3 months
youtube-dl --dateafter now-3months https://www.youtube.com/playlist?list=PLI1_CQcV71RmeydXo-5K7DAxLsUX6SVhL
# Organizing downloaded files in folders
youtube-dl --output '%(playlist)s/%(playlist_index)s- %(title)s.%(ext)s'"
@thiagoeh
thiagoeh / SSH-basic-hardening.md
Last active April 20, 2018 19:41
Basic hardening of SSH for a (Debian based) Linux instance

Automation script draft

ADMIN_USER=thiago

usermod -a $ADMIN_USER -G sudo
@thiagoeh
thiagoeh / pgexercises.md
Last active May 2, 2018 18:17
Running pgexercises in a container

A dedicated container for running a PostgreSQL instance for PGexercises

PostgreSQL Exercises provides exercises for learning SQL, using a Postgres instance. This is a reference on how to setup a dedicated environment using a Docker container.

Running the container

The official Docker image for Postgres will be used. Data is persisted in a named volume PGEXERCISES, mapped to the default path inside the container. We aren't defining a password, as the connection will be local (from inside the container).