Skip to content

Instantly share code, notes, and snippets.

@ralphotowo
ralphotowo / Git push deployment in 7 easy steps.md
Created October 16, 2017 20:05 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@ralphotowo
ralphotowo / convert-to-ssh.sh
Created October 11, 2017 15:12 — forked from bhagyas/convert-to-ssh.sh
Convert BitBucket HTTPS to SSH
#/bin/bash
#-- Author: Bhagya Silva (https://about.me/bhagyas)
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
#-- based on original code from : https://gist.github.com/m14t/3056747
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
@ralphotowo
ralphotowo / README.md
Created October 1, 2017 15:57 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@ralphotowo
ralphotowo / letsencrypt-webroot-apache.md
Created June 23, 2017 20:33 — forked from daronco/letsencrypt-webroot-apache.md
Letsencrypt with webroot on Apache

Config Apache with /etc/apache2/conf-available/le.conf:

Alias /.well-known/acme-challenge/ "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
@ralphotowo
ralphotowo / gist:fe8ec3d7ec10f510dbcc3120f16ce019
Created June 11, 2017 10:37 — forked from nkokkos/gist:4f8c8d56bba3762a11fa
cache_store.yml and redis.yml files
#cache_store.yml file:
production:
cache_store: redis_store
servers:
- redis://localhost
database: 1
#redis.yml file:
production:
@ralphotowo
ralphotowo / db-connect-test.php
Created May 13, 2017 14:31 — forked from M165437/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@ralphotowo
ralphotowo / MySQL Replication Check
Created May 4, 2017 09:36 — forked from ssimpson89/MySQL Replication Check
Just a simple Mysql Replication Health Check script I wrote. You can put this in a cron.
#!/bin/bash
### VARIABLES ### \
EMAIL=""
SERVER=$(hostname)
MYSQL_CHECK=$(mysql -e "SHOW VARIABLES LIKE '%version%';" || echo 1)
LAST_ERRNO=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Last_Errno" | awk '{ print $2 }')
SECONDS_BEHIND_MASTER=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G"| grep "Seconds_Behind_Master" | awk '{ print $2 }')
IO_IS_RUNNING=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Slave_IO_Running" | awk '{ print $2 }')
SQL_IS_RUNNING=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G" | grep "Slave_SQL_Running" | awk '{ print $2 }')
@ralphotowo
ralphotowo / collectd.conf
Created April 17, 2017 21:19 — forked from anthony-kam/collectd.conf
Collectd.conf with pretty generic metrics
### collectd.conf config file (Collectd 5.5)
FQDNLookup true
Interval 300
Timeout 2
ReadThreads 5
LoadPlugin syslog
@ralphotowo
ralphotowo / collectd.conf
Created April 16, 2017 21:11 — forked from uffsalot/collectd.conf
sample collectd.conf
FQDNLookup true
Interval 120
LoadPlugin syslog
<Plugin syslog>
LogLevel info
</Plugin>
LoadPlugin disk
@ralphotowo
ralphotowo / etc init.d unicorn-redmine
Created July 6, 2016 01:22 — forked from shrkw/etc init.d unicorn-redmine
init script for unicorn on RHEL, Cent OS, Scientific Linux way
#!/bin/sh
#
# unicorn_redmine Startup script for unicorn for redmine
#
# chkconfig: - 86 14
# processname: unicorn_rails
# pidfile: /opt/redmine/tmp/pids/unicorn.pid
# description: Rails application server for Redmine
#
### BEGIN INIT INFO