Skip to content

Instantly share code, notes, and snippets.

View vivianspencer's full-sized avatar

Vivian Spencer vivianspencer

View GitHub Profile
@vivianspencer
vivianspencer / server_hardening.md
Last active November 6, 2026 14:52
Debian 8 Hardening

Debian 8 Hardening

  1. Update root's mail recipient. Open /etc/aliases replacing administrator@example.tld with an administrator's email address. This is where logs will be emailed.

    root:     administrator@example.tld
    
  2. Update the the default umask to 027. Edit the file /etc/init.d/rc and change the following setting:

umask 027

@vivianspencer
vivianspencer / db_remote_to_local.sh
Last active October 17, 2025 17:21
DB backup remote to local
#!/bin/bash
set -euo pipefail # Exit on error, undefined variables, and pipe failures
####
# REMOTE MySQL DATABASE LOCAL IMPORT SCRIPT
#
# This script copies a remote database to a local machine.
# It connects to a remote server, dumps the database, and imports it locally.
#
@vivianspencer
vivianspencer / form_embed.js
Last active January 5, 2025 15:09
Act-On form embed code
var _aoFormLoader = (function(w) {
var stylesLoaded = false;
var captchaLoaded = false;
var gfLoaded = false;
var htmlId = false;
var scheme = document.location.protocol + "//";
var loadForm = function(options) {
import pjson from './package.json';
export default class Akismet {
protected blog: string;
protected key: string;
protected userAgent: string;
protected rootEndpoint: string;
@vivianspencer
vivianspencer / utilities.js
Created March 4, 2023 19:02
Javascript Utilities
/**
* Taken from stackoverflow
* https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript#answer-1026087
*/
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
@vivianspencer
vivianspencer / index.md
Created January 5, 2025 15:07
Laravel Valet

Fix for "cURL error 60: SSL certificate problem: unable to get local issuer certificate" when using Laravel Valets signed certs. Thanks to laravel/valet#515 (comment)

  1. Backup current OpenSSL cert
cp `brew --prefix`/etc/openssl@3/cert.pem `brew --prefix`/etc/openssl@3/cert.pem.bak
  1. Append Laravel Valets CA certificate to the main cert.pem
@vivianspencer
vivianspencer / macos-sierra-recovery.md
Created December 30, 2024 12:55
Recovery instructions for MacOS Sierra
@vivianspencer
vivianspencer / setup.md
Last active January 16, 2024 14:59
Debian 11 LEMP

Debian 11 (bullseye) LEMP setup

Installs

  • MariaDB (latest stable version)
  • PHP 8.3
  • Nginx

  1. Install necessary components to begin this setup
@vivianspencer
vivianspencer / db_backup.sh
Created January 9, 2024 16:34
MariaDB automated backup script
#!/bin/bash
# Adapted from https://www.spacerex.co/how-to-automatically-backup-a-mysql-or-mariadb-server-with-mysqldump/
# Backup storage directory
backupfolder=/var/backups/db
logfile=/var/backups/db-bkp.log
# MySQL user
user=USER
password=PASSWORD
@vivianspencer
vivianspencer / caching.conf
Last active March 23, 2023 03:31
Wordpress PHP7 Nginx LetsEncrypt Config
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include snippets/wordpress-wp-super-cache.conf;
#include snippets/wordpress-w3-total-cache.conf;