Skip to content

Instantly share code, notes, and snippets.

View bhowe's full-sized avatar

Blake Howe bhowe

View GitHub Profile
https://www.pexels.com/
https://pixabay.com/
https://search.creativecommons.org/
http://www.publicdomainpictures.net/
http://publicdomainarchive.com/
http://unsplash.com/
http://splitshire.com/
http://www.1millionfreepictures.com/
http://viintage.com/
http://www.gratisography.com/
@bhowe
bhowe / mysql_reserved_words
Created August 29, 2019 01:17
Common mysql reserved words in php array
#Good explanation
#https://stackoverflow.com/questions/23446377/syntax-error-due-to-using-a-reserved-word-as-a-table-or-column-name-in-mysql
$mysql_reserved_words = {
"ADD",
"AND",
"BEFORE",
"BY",
"CALL",
"CASE",
@bhowe
bhowe / twillo_mock_array_include
Created August 28, 2019 00:58
Twillo mock php array for local host testing
// Mock twillo objects
$twilllo_Mock_phone_array = array
(
Called => "+1601111111",
ToState =>"MS",
CallerCountry => "US",
Direction => "inbound",
CallerState => "MS",
ToZip => "39232",
@bhowe
bhowe / git_big_files.sh
Created March 2, 2019 22:29
Super handy script for finding large files.
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
# run sh git_big_files.sh
# @author Antony Stubbs
# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output
IFS=$'\n';
Regex Character Explanation
# Forces the server to ignore the text following the # on the same line. Typically used for comments
[F] Indicates Forbidden, with this the server should return a 403 forbidden error to the client
[L] The Last rule forces the server to stop processing rules in the .htaccess file
[N] Indicates Next and forces Apache to redo the rewrite process, except using the currently rewritten URL instead of the initial URL
[G] Gone tells the server to deliever the gone status message, which is used to mark pages that no longer exist on the site.
[R] This forces Apache to initialize a redirect, this can be a permanent redirect (page has moved, 301), or a temporary redirect (302).
[P] Indicates Proxy which tells the server to use mod_proxy to handle requests
[C] Tells the server to chain a rule with the next rule. If the rule matches for example, then the chained rules will run as well, if not, then they will not run.
[QSA] Tells the server to use the query string at the end of an expression
@bhowe
bhowe / fix-wordpress-permissions.sh
Last active July 22, 2018 21:15 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#this is real cute but you can also just ssh to the public HTML paste this
#root@theweb [/home2/whatever/public_html]# find . -type d -exec chmod 755 {} \;
#root@wtheeb [/home2/whatever/public_html]# find . -type f -exec chmod 644 {} \;
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
@bhowe
bhowe / temp_mail_server.md
Created June 14, 2018 18:29 — forked from gowtham1337/temp_mail_server.md
A quick guide for creating your own temporary mail server

##Overview You might have a need for a temporary mail service like mailinator.com on your own machine. This guide provides the minimum required steps to do that. The setup we will use is as follows

Procmail (Receive mail and forward to script)--->PHP Script(Parse Mail and put in Database)--->MySQL(Store the mails)--->JSON

Note: This is intended as a quick DIY for simple projects. Hence, we will not go into more details like spam detection and memory optimization.

##Instructions ####Setup Infrastructure

  1. Get a Top level domain name (Note: Getting this to work with a sub-domain will require more work and setup)
@bhowe
bhowe / .htaccess
Last active June 7, 2018 03:48 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#when troubleshooting remember htaccess is read from top to bottom with the top directives being run first.
#If there is a re-direct there, then it may be interfering with what you have added through the cPanel.
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
@bhowe
bhowe / curl-test.php
Last active May 26, 2018 12:27
This is a simple way to test CURL just copy to your webserver and run.
<?php
//Filename: curl_test.php
$ch = curl_init();
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@bhowe
bhowe / mail-poet-requirements check.php
Created May 12, 2018 22:35
Script to check your mail poet extensions
<?php
#requirements for mail poet. The top three are the most common.
#https://beta.docs.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#php_extension
#https://stackoverflow.com/questions/3131411/php-code-to-test-pdo-is-available
echo 'mail poet extension check' . "<br><br>";
echo "GD: ", extension_loaded('gd') ? 'OK' : 'MISSING', '<br>';
echo "XML: ", extension_loaded('xml') ? 'OK' : 'MISSING', '<br>';
echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br><br>';