Skip to content

Instantly share code, notes, and snippets.

View cluster-up.sh
#!/bin/bash
#
# TMBI Kubernetes E2E Test
#
# Author: Reilly Lowery <https://github.com/rifi2k>
# Copyright: 45AIR
# Permission to copy and modify is granted under the MIT license
#===============================================================================
set -eo pipefail
View woocommerce_order_pay_authentication.php
if ( class_exists( 'woocommerce' ) ) {
if ( is_wc_endpoint_url( 'order-pay' ) ) {
global $wp;
$order_id = $wp->query_vars['order-pay'];
$order_author_id = get_post_field( 'post_author', $order_id );
$current_user_id = get_current_user_id();
if ( $order_author_id !== $current_user_id ) {
// Do something here when user did not place the order.
// Redirect to homepage etc.
}
@RiFi2k
RiFi2k / cloudSettings_public
Created Oct 6, 2019
Copy of my private cloudSettings gist I use to sync my VSCode configurations between work and home
View cloudSettings_public
{"lastUpload":"2019-10-06T01:41:34.820Z","extensionVersion":"v3.4.3"}
@RiFi2k
RiFi2k / removeContent.js
Created Jun 21, 2019
Cloudflare Worker Function to find and replace content on a page
View removeContent.js
addEventListener("fetch", event => {
event.respondWith(handle(event.request))
})
async function handle(request) {
// Fetch from origin server.
let response = await fetch(request)
// Make sure we only modify text, not images.
let type = response.headers.get("Content-Type") || ""
@RiFi2k
RiFi2k / fedora-proxy.md
Last active Mar 4, 2021
Instructions for setting up localhost proxy for most services on Fedora
View fedora-proxy.md

Fedora 127.0.0.1 Proxy

DNF

sudo nano /etc/dnf/dnf.conf

Add proxy=socks5://127.0.0.1:8123

GIT

View nginx_chk_404
location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp)$ {
try_files $uri $uri/ @stage;
}
location @stage {
resolver 8.8.8.8;
rewrite ^/wp-content/(.*) /$1; # In S3, the path starts with /uploads
proxy_pass http://stagebucket.s3-website-us-east-1.amazonaws.com$uri;
proxy_intercept_errors on;
error_page 404 = @production;
View pubkey.pgp
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFytvmcBEADBCRPPEueXbuGzvgO5m+qp0r2jsQ2AvlqNfBNk48NF0Rx9iu1U
YQL+G+izXFR23x+QCEPB5ap3KmCO279BBfl72zJITlz9NHA1KFUnxraYOjloHQ51
kH4EG83KwTlrfCQWF+wMQ0Pi84MoBr5zHbmuq8E+4Hx4pNWgtwniqKG1dxYaZaLY
WIWWtDFNBEV9m+jY5EajexVfxTXdnsZ3fGaRWusOnyF+ch428nTZxcTfXaeoykPN
ZVKje38rC9bBWoLT9hi+kLQtto5wj/qqydwRvy8n+Uc5zlY9XkhkAaf8PqW3IiEk
SbsX+SKHM+Lh15yy5szxuLifpBaQ32gPEdhIpIoQcmIUP6wuck9xjBCEpe362oaq
wI9vPopZ+iSX2+3mS0egJC9kJq2ikDjo5MnOw5ee9MZWKQAugtJVw9EwCBC2sRVY
d7tiYI/cm/r7jEmgjRUg4Q/r76XtFC+HK8wY7tP16aq9v4XKpGylOTZk+8ZHIlmn
View request.js
import Qs from 'qs';
import axios from 'axios';
// Axios defaults.
axios.defaults.baseURL = smu.siteurl;
axios.defaults.headers.post['Content-Type'] =
'application/x-www-form-urlencoded';
axios.defaults.transformRequest = data => Qs.stringify(data);
// Async await request
View check.js
(function(jQuery) {
jQuery(window).load(function() {
var cookie_name = '_bw';
function get_cookie() {
var keyValue = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
return keyValue ? keyValue[2] : null;
}
function set_cookie(value) {
View get_post_meta
[{"type":"container","id":0,"name":"Market Visibility","required":false,"columns":[{"id":0,"type":"item","required":false,"media":[{"id":12,"media":[]},{"id":71,"media":[{"id":2747,"url":"https://cdn.smehost.net/www2sonymusicucom-45pressdevel/wp-content/uploads/2018/11/IMG_4521.jpeg","title":"#CherryPools Party Setup","caption":"I threw a Halloween Party at my house on Oct. 27 and set up a mirror with “Love, #CherryPools” written on it, pointing to the box of blow pops and encouraged guests to take the blow pops as well as take selfies in the mirror.","selected":true,"video":false},{"id":2762,"url":"https://cdn.smehost.net/www2sonymusicucom-45pressdevel/wp-content/uploads/2018/11/IMG_4563-e1541273819375.jpeg","title":"Guest interacting with #CherryPools mirror and blow pops","caption":"Party guests took selfies in the #CherryPools mirror and sent them to me","selected":true,"video":false},{"id":2752,"url":"https://cdn.smehost.net/www2sonymusicucom-45pressdevel/wp-content/uploads/2018/11/IMG_4562-e154127384595