Skip to content

Instantly share code, notes, and snippets.

View bastosmichael's full-sized avatar
🏠
Working from home

Michael Bastos bastosmichael

🏠
Working from home
View GitHub Profile
@bastosmichael
bastosmichael / database.class.php
Created October 5, 2012 03:49
Basic PHP Database Class
<?php
class database {
var $Host = "localhost"; // Hostname of our MySQL server.
var $database = ""; // Logical database name on that server.
var $User = "username"; // User and Password for login.
var $Password = "password";
var $Link_ID = 0; // Result of mysql_connect().
var $Query_ID = 0; // Result of most recent mysql_query().
@bastosmichael
bastosmichael / gist:5223111
Created March 22, 2013 17:21
WordPress-tests configuration
/* Path to the WordPress codebase in relation to the location of these tests. Since they are included with our plugin, we refer to a few directories above. */
define( 'ABSPATH', '../../../../../' );
/* The name of the database for running the tests. Make sure this is a database just for testing as it's created and trashed during tests. */
define( 'DB_NAME', 'throwaway' );
/* The usual credentials for a local database. */
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', '' );
define( 'DB_HOST', 'localhost' );
@bastosmichael
bastosmichael / gist:5376293
Last active December 16, 2015 04:19
Blocking WordPress Botnet for Nginx Configurations
location / {
try_files $uri $uri/ /index.php?$args;
# block WP Botnet workstations
deny 31.184.238.38;
deny 178.151.216.53;
deny 91.224.160.143;
deny 195.128.126.6;
deny 85.114.133.118;
deny 177.125.184.8;
deny 89.233.216.203;
@bastosmichael
bastosmichael / _wordpress-redis
Last active July 14, 2019 20:48
WordPress Nginx Configuration with Redis
server {
client_max_body_size 20M;
listen 80;
server_name _; #make sure _ is replaced with your main domain if you plan on hosting multiple sites.
root /home/wordpress/wordpress; #You can also use /home/ubuntu/your_domain
#on server block
##necessary if using a multi-site plugin
server_name_in_redirect off;
##necessary if running Nginx behind a reverse-proxy
port_in_redirect off;
@bastosmichael
bastosmichael / test.rb
Last active December 26, 2015 15:19
Reverse Polish Notation Ruby Test with Standard In / Out, Error Handling and History
#!/usr/bin/env ruby
class Controller
def initialize debug = false
puts 'Enter your Reverse Polish Notation (Example: 5 ! 1 2 + 4 * + 3 -),
Enter q to Quit,
Enter t to Test,
Enter d to Debug'
while true
input = $stdin.gets.strip
@bastosmichael
bastosmichael / default
Last active December 28, 2015 11:08
Nginx Rails Config
server {
listen 80;
server_name localhost;
root /home/ubuntu/app/current/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
<?php
echo 'This has been customized!!!';
// Perform post-install customizations
if ( function_exists( 'add_action' ) ){
add_action( 'wp_mail_content_type' , customize_install );
function customize_install(){
// Switch themes
switch_theme('twentytwelve');
@bastosmichael
bastosmichael / etc-network-interfaces
Last active December 30, 2015 12:39
Ubuntu NAT setup between eth0 and eth1
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
@bastosmichael
bastosmichael / gitlab6.5.sh
Last active August 29, 2015 13:55
Gitlab 6.5 Ubuntu Installer
#!/bin/bash
if [ $# -eq 0 ]
then
echo "gitlab.sh [options] postgres|mysql|restart
postgres - Automatically install gitlab with postgres on ubuntu
mysql - Automatically install gitlab with mysql on ubuntu (Not Finished)"
elif [ $1 == 'postgres' ]; then
#!/bin/bash
if [ $# -eq 0 ]
then
echo "https.sh [options] install"
elif [ $1 == 'install' ]; then
echo "Self signing SSL Certs..."
sudo mkdir /etc/nginx/ssl