Skip to content

Instantly share code, notes, and snippets.

View panbanda's full-sized avatar

Jonathan Reyes panbanda

View GitHub Profile

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@panbanda
panbanda / gist:815bbbe2ad9e35b613e6
Created April 10, 2015 13:49
Flatten Hash Ruby on Rails
def flatten_hash hash
hash.each_with_object({}) do |(k, v), h|
if v.is_a? Hash
flatten_hash(v).map do |h_k, h_v|
h["#{h_k}"] = h_v
end
else
h[k] = v
end
end
@panbanda
panbanda / gist:6876ef32f73875c403fd
Created April 4, 2015 14:51
Ruby not read in crontab (whenever)
# Add this to top of schedule.rb
env :PATH, ENV['PATH']
@panbanda
panbanda / figaro-capistrano.rb
Last active August 29, 2015 14:11 — forked from patte/figaro-capistrano.rb
Adding environment variables for figaro to Capistrano deployment.
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/config/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
@panbanda
panbanda / wp-install.sh
Last active August 29, 2015 14:10
Wordpress speedy installer.
# Install wp-cli.org
# Use: bash -c "$(curl -fsSL https://gist.githubusercontent.com/jylinman/f14885421729a77153f6/raw/wp-install.sh)"
echo "Database name: "
read db_name
echo "Database username: "
read db_user
echo "Database password: "
read db_pass
echo "Database host: "
@panbanda
panbanda / etc-init.d-nginx
Last active August 29, 2015 14:07
Nginx control script to be placed in /etc/init.d/nginx. This is adjusted for digital ocean's setup and includes chkconfig.
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin and includes chkconfig
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
@panbanda
panbanda / get_locust.sh
Last active August 29, 2015 14:02
Upgrade Latest Python & PIP on EC2 for Locust Swarms
# Build tools
sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y
# Install python 2.7 and change default python symlink
sudo yum install python27-devel -y
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
# yum still needs 2.6, so write it in and backup script
sudo cp /usr/bin/yum /usr/bin/_yum_before_27
@panbanda
panbanda / nginx.default.conf
Last active August 29, 2015 14:01 — forked from sumardi/nginx.default.conf
Nginx / Apache + PHP Installation on EC2 Instance
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@panbanda
panbanda / min.config.xml
Created July 22, 2012 23:40
GIT: Precommit Minify CSS + Javascript
#!/usr/bin/php
<?php
// See if we even need to run this file
$modified_files = shell_exec("git st");
if (strpos($modified_files, '.js') === FALSE AND strpos($modified_files, '.css') === FALSE) die("/ Skipping minification.\n");
// Find the config files to minify
$search = shell_exec("find . -name min.config.xml");
$config_files = explode("\n", $search);
@panbanda
panbanda / gist:2141902
Created March 20, 2012 22:22
Form Submission Handler for Base Controller
<?php
/**
* Check for form submission with a csrf check
*/
private function __form_submission()
{
if ($post = Input::post())
{
$token = Arr::get($post, 'csrf');