Skip to content

Instantly share code, notes, and snippets.

@ralphotowo
ralphotowo / gist:7d6f85cefaf129a89448a37b506c16c6
Created January 24, 2018 22:34 — forked from hroling/gist:85f36e86d48285f08161
Apache 2.4 SSL config for A+ on SSLLabs.com
OS: Ubuntu 14.04 LTS, Apache 2.4.7, OpenSSL 1.0.1f
SSL Labs: A+ (RSA2048, SHA256 certificate)
Certificate: 100%
Protocol Support: 95%
Key Exchange: 90%
Cipher Strength: 90%
#### In the SSL.CONF file
SSLCipherSuite AES256+EECDH:AES256+EDH:AES128+EECDH:AES128+EDH
@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 / munch.c
Created April 19, 2017 16:23
C app (munch.c) to gobble up memory
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv) {
int max = -1;
int mb = 0;
char* buffer;
if(argc > 1)
@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