Skip to content

Instantly share code, notes, and snippets.

@summersab
summersab / git-update.sh
Created September 12, 2023 16:26
Simple script to keep the local and remote origin of forked repos fresh
#!/bin/bash
if [[ -z "${1}" ]] || [[ "${1}" == "-h" ]] || [[ "${1}" == "--help" ]]
then
echo "This is a simple script to keep the local and remote of your forked"
echo "repositories fresh. It does so by:"
echo " 1. Detecting if the repo's origin and upstream are different (indicating"
echo " a fork)"
echo " 2. Performing a \`fetch --all\` on the repo to update from origin and"
echo " upstream"
@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))
@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 / 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 / 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 / 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 / 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 / remove_foxy_links.php
Created March 12, 2021 15:33
Remove `_links` element from FoxyCart responses
@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 / 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 = "";