Skip to content

Instantly share code, notes, and snippets.

View ramiabraham's full-sized avatar

Rami Abraham ramiabraham

View GitHub Profile
@ramiabraham
ramiabraham / MatricomManual.md
Created October 27, 2018 05:56 — forked from sli/MatricomManual.md
Transcribed manual for Matricom GPad controllers.

Matricom Gamepad

For your enjoyment and safety, we recommend that you read this manual thoroughly before using this product and keep this manual handy for reference if needed.

Characteristics:

  1. Compatible with Android and PC
  2. Wireless
  3. D-Pad and 12 buttons
  4. Dual analog joysticks
@ramiabraham
ramiabraham / TinyTS_v11.ino
Created January 3, 2017 18:10
The Tiny-TS Touch Synthesizer
// (*) All in the spirit of open-source and open-hardware
// Janost 2016 Sweden
 
// The Tiny-TS Touch Synthesizer
// https://janostman.wordpress.com/the-tiny-ts-diy-touch-synthesizer/
 
// Copyright 2016 DSP Synthesizers Sweden.
//
// Author: Jan Ostman
//
@ramiabraham
ramiabraham / bash_colors
Last active March 28, 2023 23:39 — forked from ian128K/bash_colours
Shell script colours
## Colours and font styles
## Syntax: echo -e "${FOREGROUND_COLOUR}${BACKGROUND_COLOUR}${STYLE}Hello world!${RESET_ALL}"
# Escape sequence and resets
ESC_SEQ="\x1b["
RESET_ALL="${ESC_SEQ}0m"
RESET_BOLD="${ESC_SEQ}21m"
RESET_UL="${ESC_SEQ}24m"
# Foreground colours
@ramiabraham
ramiabraham / ask.sh
Created May 17, 2016 17:19
Bash: General-purpose Yes/No prompt function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"

Disable Plugins

Quickly disable all plugins in WordPress.

Usage

This plugin needs to go into the wp-content/mu-plugins/ directory. Provided you have SSH access to the server where WordPress lives, you can do this:

cd $SITE_ROOT/wp-content/mu-plugins
@ramiabraham
ramiabraham / nginx.conf
Last active August 29, 2015 14:25 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@ramiabraham
ramiabraham / set-affwp-reg-role.php
Last active August 29, 2015 14:20 — forked from pippinsplugins/gist:d973776836ab984aea06
Set affiliate role on registration
<?php
/*
* Plugin name: Affiliate role on registration
*/
function pw_affwp_set_role_on_registration( $affiliate_id = 0 ) {
$user_id = affwp_get_affiliate_user_id( $affiliate_id );
$user = new WP_User( $user_id );
$user->add_role( 'affiliate' );
@ramiabraham
ramiabraham / edd.php
Last active August 29, 2015 14:07 — forked from amdrew/edd.php
<?php
/**
* Disable commission on an entire product category in Easy Digital Downloads
*/
function affwp_custom_wc_disable_commission_per_category( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) {
// Array of categories to disable commission for. Separate by a comma and use either the term name, term_id, or slug
$disabled_categories = array( 'category-one', 5 );