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 / 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 / _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 / 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 / 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 / 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().