Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Adan Rehtla djravine

🏠
Working from home
View GitHub Profile
@djravine
djravine / OpenShift-V2-MySQL-RepairAllDatabases.txt
Last active May 2, 2017
OpenShift V2 - MySQL - Repair All Databases
View OpenShift-V2-MySQL-RepairAllDatabases.txt
mysqlcheck --repair --all-databases -h $OPENSHIFT_MYSQL_DB_HOST -P ${OPENSHIFT_MYSQL_DB_PORT:-3306} -u ${OPENSHIFT_MYSQL_DB_USERNAME:-'admin'} --password="$OPENSHIFT_MYSQL_DB_PASSWORD"
@djravine
djravine / OpenShift-V2-MySQL-DumpAllDatabases.txt
Last active May 9, 2016
OpenShift V2 - MySQL - Dump All Databases
View OpenShift-V2-MySQL-DumpAllDatabases.txt
mysqldump -h $OPENSHIFT_MYSQL_DB_HOST -P ${OPENSHIFT_MYSQL_DB_PORT:-3306} -u ${OPENSHIFT_MYSQL_DB_USERNAME:-'admin'} --password="$OPENSHIFT_MYSQL_DB_PASSWORD" --all-databases > ~/app-root/data/tmp/all.sql
@djravine
djravine / ec2-host-from-tag-to-env-vars.sh
Last active Mar 6, 2017
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
View ec2-host-from-tag-to-env-vars.sh
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Modifier: Adan Rehtla (Adan@AdanRehtla.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
# Original GIST: https://gist.github.com/marcellodesales/a890b8ca240403187269
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq awscli)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
@djravine
djravine / .bash_aliases
Last active Feb 6, 2020
'.bash_aliases' - DEV - Change PHP Version
View .bash_aliases
# Aliases - PHP
alias php.info='php -i'
alias php5.6='sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php5.6 && sudo update-alternatives --set php /usr/bin/php5.6 && sudo service apache2 restart'
alias php7.0='sudo a2dismod php5.6 && sudo a2dismod php7.1 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php7.0 && sudo update-alternatives --set php /usr/bin/php7.0 && sudo service apache2 restart'
alias php7.1='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.2 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php7.1 && sudo update-alternatives --set php /usr/bin/php7.1 && sudo service apache2 restart'
alias php7.2='sudo a2dismod php5.6 && sudo a2dismod php7.0 && sudo a2dismod php7.1 && sudo a2dismod php7.3 && sudo a2dismod php7.4 && sudo a2enmod php7.2 && sudo update-alternatives --set php /usr/bin/php7.2 && sudo service apache2 restart'
alias php7.3='sudo a
@djravine
djravine / purge.sh
Created Feb 21, 2019 — forked from adrienbrault/purge.sh
Script to reduce VM size before packaging for vagrant
View purge.sh
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@djravine
djravine / codedeploy_deploy.py
Last active Apr 8, 2020
codedeploy_deploy.py - Implement exponential back off to reduce chance rate limiting and increase number of retries
View codedeploy_deploy.py
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed on an "AS IS"
# BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under the License.
@djravine
djravine / algolite-test.js
Created Mar 26, 2019
Algolite Test Script
View algolite-test.js
# npm i algoliasearch
var algoliasearch = require('algoliasearch');
var connectJSON = {
timeout: 4000,
protocol: 'http:',
hosts: {
read: ['localhost:9201'],
write: ['localhost:9201']
@djravine
djravine / git-update-index-script.sh
Last active Jul 22, 2019
Automatically apply “git update-index --chmod=+x” to executable files
View git-update-index-script.sh
find . -name '*.sh' | xargs git update-index --chmod=+x
@djravine
djravine / read-input-with-visible-countdown.sh
Last active May 15, 2019
BASH - Read input with visible countdown
View read-input-with-visible-countdown.sh
#!/bin/bash
# set -euo pipefail
READTIMEOUT=5
function read_yn {
MESSAGE=$1
TIMEOUTREPLY=$2
NORMALREPLY="Y"
if [ -z "${TIMEOUTREPLY}" ]; then
@djravine
djravine / git-reset.sh
Created Jul 2, 2019
GIT RESET - Squash all commits into 1
View git-reset.sh
git reset $(git commit-tree HEAD^{tree} -m "A new start")
You can’t perform that action at this time.