Skip to content

Instantly share code, notes, and snippets.

@summersab
summersab / signifyd-webhook.php
Last active October 19, 2020 16:06
SignifyD Webhook JSON Validation (PHP)
<?php
function validatePostedJson() {
$json = file_get_contents('php://input');
if ($json == null) {
header('HTTP/1.1 400 Bad Request', true, 400);
die('No Data Found');
}
//Check the Hash
@summersab
summersab / FoxyCustomClient.php
Last active February 14, 2021 01:25
Extension of the FoxyCart PHP SDK to include auto-debugging
<?php
require './vendor/autoload.php';
use Foxy\FoxyClient\FoxyClient;
class FoxyCustomClient extends FoxyClient {
private $parent_class_filename = "";
private $last_function_line = "";
private $last_function = "";
@summersab
summersab / appstore.php
Last active April 13, 2021 23:45
Add app and category whitelisting and blacklisting to Nextcloud
<?php
/**
* @copyright Copyright (c) 2021, Platypus Innovations LLC
*
* @author Andrew Summers
*
* This snippet provides a way to implement app and category whitelists/
* blacklists on Nextcloud. This is accomplished by creating a dummy
* "appstore" on the local system:
* - Download the official listings from the Nextcloud servers
@summersab
summersab / remove_foxy_links.php
Created March 12, 2021 15:33
Remove `_links` element from FoxyCart responses
@summersab
summersab / darkice.cfg
Last active December 23, 2022 06:29
VLC -> Icecast without soundcard
darkice.cfg:
[general]
duration = 0 # duration of encoding, in seconds. 0 means forever
bufferSecs = 1 # size of internal slip buffer, in seconds
reconnect = yes # reconnect to the server(s) if disconnected
# this section describes the audio input that will be streamed
[input]
#device = /dev/dsp # OSS DSP soundcard device for the audio input COMMENTED OUT
device = default # best configuration as of Ubuntu 16.04
@summersab
summersab / mariadb.sh
Last active August 16, 2021 18:01
Quick and dirty Nextcloud installation
#!/bin/bash
# Change these to suit
export DBUSER=nextcloud
export DBPASS=
# Install MariaDB
apt-get update
apt-get install mariadb-server
@summersab
summersab / keycloak-api.php
Created October 22, 2021 21:14
A simple Keykloak REST API wrapper
<?php
class KeycloakApiClient
{
private $secret;
public $token;
private $base_url;
public function __construct($secret, $base_url) {
$this->secret = $secret;
@summersab
summersab / easy-debian-qemu.sh
Last active November 7, 2021 20:41
Simple script to install Debian on a variety of architectures with QEMU
#!/bin/bash
# The architecture you want to install. Options:
# amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x
arch=armhf
disk=16G
cores=2
RAM=4G
# Determine the correct QEMU platform based on the value of $arch
@summersab
summersab / password-tooltip.html
Last active June 8, 2022 15:58
A pretty and dynamic password requirements tooltip and validator (pure HTML and JS)
<!DOCTYPE html>
<!-- inspired by https://myloan.fremontbank.com/ -->
<html>
<head>
<style>
#password-validator {
position: absolute;
z-index: 50;
margin-top: 20px;
display: none;
@summersab
summersab / alter-tables.sql
Created June 29, 2022 18:48
Convert SQLite WordPress DB to MySQL
USE wordpress;
CREATE TABLE IF NOT EXISTS `wp_commentmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`comment_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
PRIMARY KEY (`meta_id`),
KEY `comment_id` (`comment_id`),
KEY `meta_key` (`meta_key`(191))