Skip to content

Instantly share code, notes, and snippets.

View RichardTMiles's full-sized avatar
Kick it to Richard@Miles.Systems

Richard T. Miles RichardTMiles

Kick it to Richard@Miles.Systems
View GitHub Profile
@RichardTMiles
RichardTMiles / macos_php_build.md
Last active April 17, 2024 04:25 — forked from giladdarshan/macos_php_build.md
Steps to build / compile PHP from source on macOS

The following steps will describe how to build PHP from source including PHP's Apache module as it is no longer part of macOS starting with macOS Monterey.
If this is for a development environment, you can simply install PHP with Homebrew using the command brew install php. This guide is for cases where you need a more portable PHP without heavily dependening on external libraries.

https://dev.to/ramsey/using-clion-with-php-src-4me0

  1. Install Homebrew
  2. Install the following Homebrew packages
brew install libxml2 libiconv apr apr-util bison re2c python
curl https://bootstrap.pypa.io/get-pip.py | python3
@RichardTMiles
RichardTMiles / .htaccess
Created March 31, 2024 00:01 — forked from seoagentur-hamburg/.htaccess
UPDATE 2024/03: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2.0.9 - 03/2024
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://seoagentur-hamburg.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@RichardTMiles
RichardTMiles / .htaccess
Last active March 23, 2024 17:36
better wordpress .htaccess
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|xml|txt|css|js|svg|html|htm|hbs|json|map|woff|ttf|webp)$">
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
</FilesMatch>
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^xmlrpc\.php$ / [R=302,L]
@RichardTMiles
RichardTMiles / ApacheHTTPSConfig.md
Created August 25, 2023 00:31 — forked from nrollr/ApacheHTTPSConfig.md
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

@RichardTMiles
RichardTMiles / gist:de1b7b9705257895fdf75ca596925e22
Created September 28, 2021 15:50 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@RichardTMiles
RichardTMiles / background.js
Created October 14, 2020 16:44 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
<?php
/**
* Created by IntelliJ IDEA.
* User: Richard Miles
* Date: 6/27/2018
* Time: 4:05 PM
*
* A 6-Deck blackjack card counting game
*
* 2-6 is +1
@RichardTMiles
RichardTMiles / HopHashTable.cpp
Last active February 4, 2018 00:50
Compile with [ g++ -std=c++0x main.cpp ]. Run with [ ./a.out ], 110 lines.
#include <iostream>
#include <bitset>
using namespace std;
const int TABLE_SIZE = 17; // You can change consts with
const int MAX_DIST = 4; // *((int*)(&a)) = 6
unsigned int startingPlace = 1; // a binary representation of the hop
struct item {
int *input;
@RichardTMiles
RichardTMiles / Dynamic_Javascript_Inclusion.html
Last active January 18, 2018 08:50
Dynamic Javascript Inclusion using LoadJS and PJAX. Loading javascript files on call time when refreshing with Ajax.
<html> // This was chopped from https://carbonphp.com , a php framework which incorporates PJAX and and HTML5 Sockets
<head>
<script>
/*! loadJS: load a JS file asynchronously. [c]2014 @scottjehl, Filament Group, Inc. (Based on http://goo.gl/REQGQ by Paul Irish). Licensed MIT */
(function (w) {
let loadJS;
loadJS = function (src, cb) {
"use strict";
let ref = w.document.getElementsByTagName("script")[0];
let script = w.document.createElement("script");