Skip to content

Instantly share code, notes, and snippets.

View migueltg's full-sized avatar

Miguel migueltg

View GitHub Profile
@migueltg
migueltg / README.md
Created February 17, 2023 09:44 — forked from woblerr/README.md
Docker containers logs clearing script

Docker containers logs clearing script

chmod +x ./clear_docker_container_logs.sh

Usage

Usage: ../clear_docker_container_logs.sh [-c ""]
@migueltg
migueltg / install-docker-ubuntu.sh
Last active November 12, 2020 13:13
install-docker-ubuntu.sh
sudo apt-get remove docker docker-engine docker.io
sudo apt-get update
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo usermod -aG docker $USER
#!/bin/sh
export AWS_DEFAULT_REGION=us-east-1
eipid=eipalloc-id
instanceid=$(wget -q -O - http://instance-data/latest/meta-data/instance-id)
aws ec2 associate-address --instance-id $instanceid --allocation-id $eipid
@migueltg
migueltg / updateCleanDebianUbuntu.sh
Created October 10, 2019 07:14
Update and cleand Debian / Ubuntu system
apt-get update -y && echo "" && \
apt-get install deborphan -y && \
apt-get dist-upgrade -y && echo "" && \
apt-get upgrade -y && echo "" && \
deborphan | xargs sudo apt-get remove -y --purge && echo "" && \
apt-get autoremove -y && echo "" && \
apt-get autoclean -y && echo ""
@migueltg
migueltg / nexcloud
Created June 6, 2019 10:46
Nextcloud commands
sudo -u www-data php occ db:add-missing-indices
sudo -u www-data php occ db:convert-filecache-bigint
@migueltg
migueltg / tunnelssh
Created June 6, 2019 10:27
SSH Tunnel
ssh usuario@remoteHost -L 3306:destinationhost:3306 -N -v
ssh -i backendprovider-pro.pem -NL 9000:destinationhost:3306 usuario@remoteHost -v
@migueltg
migueltg / ScreenCommands
Created June 6, 2019 10:20
Screen linux commands
Screen
Ctrl a c -> Creates a new screen session so that you can use more than one screen session at once.
Ctrl a n -> Switches to the next screen session (if you use more than one).
Ctrl a p -> Switches to the previous screen session (if you use more than one).
Ctrl a d -> Detaches a screen session (without killing the processes in it - they continue).
screen -ls -> See all screens
# rm all files
git rm -r --cached .
# add all files as per new .gitignore
git add .
# now, commit for new .gitignore to apply
git commit -m ".gitignore is now working"
@migueltg
migueltg / MySQLcommands
Last active June 6, 2019 10:20
MySQL commands
# Dump database
mysql -u username -p -h host -P 3306 dbname < filename.sql
@migueltg
migueltg / gitPullOverAllSubdirectories.sh
Last active June 6, 2019 10:22
Run git pull over all subdirectories
#! /usr/bin/env bash
find . -type d -depth 2 -exec echo git --git-dir={}/.git --work-tree=$PWD/{} status \;
find . -type d -depth 2 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;