Skip to content

Instantly share code, notes, and snippets.

View oradwell's full-sized avatar

Oliver Radwell oradwell

View GitHub Profile
@oradwell
oradwell / gmail_remove_image_proxy.user.js
Last active January 12, 2017 03:27
Gmail Image Proxy Disable - Greasemonkey script
// ==UserScript==
// @name Gmail remove gstatic
// @namespace ockcyp/gmail-remove-gstatic
// @version 0.1
// @description Remove gstatic from external image URLs (useful when URLs contain internal domains)
// @author ockcyp
// @grant none
// ==/UserScript==
setTimeout(function() {
// Page is loaded and the div is not already created
@oradwell
oradwell / no_popups.user.js
Created March 3, 2015 09:36
Disable opening of new windows - Greasemonkey script
// ==UserScript==
// @name No popups
// @namespace ockcyp/no-popups
// @description Disable opening of new windows for included websites
// @version 1.0
// @grant none
// @include none
// @author ockcyp
// ==/UserScript==
window.open = function () {
@oradwell
oradwell / admin_view.php
Created February 27, 2018 14:48
Analytics Real-Time like Real Online Script
<?php
mysql_connect("localhost","<username>","<password>");mysql_select_db("<dbname>");
if (isset($_GET['rt']) && isset($_GET['mode'])) {
if($_GET['mode']=='count') {
$query="SELECT count(distinct userid) FROM user_online WHERE online_date>DATE_SUB(NOW(),INTERVAL 310 SECOND)";
$count=mysql_fetch_row(mysql_query($query));
echo $count[0];
} elseif ($_GET['mode']=='users') {
$query="SELECT users.username,users.userid FROM user_online,users WHERE online_date>DATE_SUB(NOW(),INTERVAL 6 SECOND) AND users.userid=user_online.userid AND user_online.userid NOT IN (SELECT userid FROM user_online WHERE online_date>DATE_SUB(NOW(),INTERVAL 310 SECOND) AND online_date<DATE_SUB(NOW(),INTERVAL 6 SECOND))";
$data=mysql_query($query);
@oradwell
oradwell / s3-editor.sh
Created August 20, 2018 13:11
Modify an S3 file and save
#!/bin/bash -e
if [[ -z "${1}" ]]
then
echo "Missing argument s3_path" >&2
echo "Usage: ${0} <s3_path> [<profile>]"
exit 1
fi
s3_path=${1}
@oradwell
oradwell / metrics-server-production.yaml
Created July 10, 2021 19:22
Metrics Server Helm chart production configuration
---
# 3 replicas for redundancy
replicas: 3
resources:
requests:
cpu: 25m
memory: 25Mi
limits:
cpu: 90m
memory: 50Mi
@oradwell
oradwell / test-data.sql
Created July 14, 2021 07:59
Update with Join using MariaDB
CREATE TABLE user (
id INT(10) UNSIGNED PRIMARY KEY,
name VARCHAR(128) NOT NULL,
email VARCHAR(128) NOT NULL,
country_code CHAR(2) DEFAULT NULL,
country_name VARCHAR(60) DEFAULT NULL
);
CREATE TABLE country (
id INT(10) UNSIGNED PRIMARY KEY,
@oradwell
oradwell / minikube.service
Created September 3, 2021 14:30
minikube systemd service
[Unit]
Description=Minikube Kubernetes service
After=docker.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/minikube start
ExecStop=/usr/local/bin/minikube stop
User=jsmith
Group=jsmith
@oradwell
oradwell / backend-deployment.yaml
Last active September 14, 2021 08:07
WordPress Blog MariaDB Backend Kubernetes Manifests
apiVersion: apps/v1
kind: Deployment
metadata:
name: radwell-blog-db
labels:
app: radwell-blog
tier: backend
spec:
replicas: 1
selector:
@oradwell
oradwell / code-pv.yaml
Created September 11, 2021 20:51
WordPress Blog Frontend Application Kubernetes Manifests
apiVersion: v1
kind: PersistentVolume
metadata:
name: radwell-code-pv
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 2Gi
hostPath:
@oradwell
oradwell / Dockerfile
Created September 13, 2021 20:54
WordPress Blog Dockerfile
FROM php:7.4.23-fpm
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
zlib1g-dev libpng-dev libzip-dev libmagickwand-dev \
&& pecl install imagick \
&& docker-php-ext-install -j$(nproc) mysqli gd zip exif \
pdo_mysql opcache \
&& docker-php-ext-enable imagick \
&& apt-get autoremove -y \