Skip to content

Instantly share code, notes, and snippets.

View eekfonky's full-sized avatar

Christopher Welsh eekfonky

  • West Linton
  • 04:53 (UTC +01:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am eekfonky on github.
  • I am eekfonky (https://keybase.io/eekfonky) on keybase.
  • I have a public key ASCfJ_OT-fAttB3yLx97wGbSbi2LdZ-cLn8E9pMVchgVDAo

To claim this, I am signing this object:

@eekfonky
eekfonky / mongodb-bkup.sh
Created October 30, 2017 15:12
Backup a Mongo database to S3
#!/bin/bash
clear
# Check AWS credentials
if [[ $(aws configure list | grep "*") && $? -eq 0 ]]; then
:
else
echo -e "\\n\\e[1mPlease configure AWS credentials to continue...\\e[0m"
aws configure
@eekfonky
eekfonky / mysqlbkup.sh
Created October 30, 2017 15:14
Backup MySQL running in Docker to S3
#!/bin/bash
# .mylogin.cnf created with;
# mysql_config_editor set -h localhost -G dbbkup -P 3306 -u root -p
#
# to workaround a bug in Docker you need to create a small script with;
# /usr/bin/mysqldump --login-path=dbbkup --all-databases > mis-core-dev.sql
# inside the conatiner at root
# set variables
@eekfonky
eekfonky / aws-config-check.sh
Last active December 23, 2017 06:05
Check if AWS configure is set
#!/bin/bash
# Check AWS credentials exist
if [[ $(aws configure list | grep "*") && $? -eq 0 ]]; then
echo "Please configure AWS credentials to continue..."
aws configure
fi
@eekfonky
eekfonky / removing SSH known_hosts from Chromebook
Last active December 30, 2023 17:18
ChromeOS – removing SSH known_hosts from Chromebook
# Here is how to remove a known host fingerprint (from known_hosts) on a Chromebook.
term_.command.removeKnownHostByIndex(INDEX);
# Replace INDEX with the number obviously.
# To clear all the known hosts:
term_.command.removeAllKnownHosts();
@eekfonky
eekfonky / OpenVPN-at-boot-cli
Created November 6, 2017 15:25
OpenVPN at boot cli
1. Create auth.txt file inside /etc/openvpn directory via this command:
sudo gedit /etc/openvpn/auth.txt
Fill it with your VPN credentials:
username
password
Save it.
2. Then open the file which you are using to establish a connection:
@eekfonky
eekfonky / snapshot.sh
Created November 20, 2017 13:13
AWS Snapshot
#!/bin/bash
# error handling
error_handler() {
echo "Error occurred in script at line: ${1}"
echo "Line exited with status: ${2}"
}
trap 'error_handler ${LINENO} $?' ERR
@eekfonky
eekfonky / Disk_Space
Last active November 23, 2017 15:39
Disk Space
# All Directories
sudo du -sch /* 2>/dev/null
# Top 10
sudo du -sch /* 2>/dev/null | sort -rh | head -n 10
# Specific Directory
sudo du -sch /<DIR>/* | sort -rh
# Current Directory
@eekfonky
eekfonky / package_to_install
Last active December 23, 2017 06:03
Add package install to bash script
package_to_install () {
# enter the package you want installed in PKG_NAME below
PKG_NAME="<PACKAGE_NAME>"
if ! type $PKG_NAME > /dev/null 2>&1; then
# check Linux package manager (yum or apt)
declare -A osInfo;
osInfo[/etc/redhat-release]=yum
osInfo[/etc/arch-release]=pacman
osInfo[/etc/gentoo-release]=emerge
osInfo[/etc/SuSE-release]=zypp
@eekfonky
eekfonky / EC2-snapshot
Last active December 1, 2017 22:02
Create EC2 Snapshot in source region, copy to another region copy and remove after X days
#!/bin/bash
# error handling
error_handler() {
echo "Error occurred in script at line: ${1}"
echo "Line exited with status: ${2}"
}
trap 'error_handler ${LINENO} $?' ERR