Skip to content

Instantly share code, notes, and snippets.

View sageworksstudio's full-sized avatar

Chris Brown sageworksstudio

View GitHub Profile
@sageworksstudio
sageworksstudio / Custom-TinyMCE.md
Last active December 23, 2022 03:05
Customizing TinyMCE in SilverStripe 4.x
@sageworksstudio
sageworksstudio / ServerSetup.md
Last active December 29, 2021 15:18
Ubuntu 20.04 LAMP setup

Ubuntu 20.04 LAMP setup

Note: Because this is my personal cheat sheet, I'm installing a few PHP modules that you may not need if you're not running SilverStripe 4.x.x. Otherwise this is a pretty standard and secure LAMP installation.

SECURITY FIRST: Add a sudo user, require public key authentication and disable root login

Log into the remote machine as root: ssh root@123.45.67.890

First, add the admin user.

@sageworksstudio
sageworksstudio / certbot-cheatsheet.md
Last active October 3, 2021 00:09
certbot cheatsheet

Certbot cheatsheet

Deb/Ubuntu Install

$sudo apt install certbot python3-certbot-apache

First Run

$sudo certbot run

Create a cron job to auto-renew

$sudo crontab -e

@sageworksstudio
sageworksstudio / restart-mysql.md
Last active May 15, 2021 18:24
Restart MySQL

Restart MySQL

Create a file that root/sudo can access:

restart-mysql.sh:

#!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
if [[ "$(service mysql status)" != "running" ]]
@sageworksstudio
sageworksstudio / rsync.md
Last active July 17, 2020 19:56
rsync cheatsheet

rsync

TFM https://linux.die.net/man/1/rsync

Copy a directory and it's contents

$rsync -av --progress /folder/to/backup/* /destination/of/backup/

Log results

To log results add the log flag

@sageworksstudio
sageworksstudio / Generating-RSA-Keys.md
Last active July 9, 2020 20:37
Generating a public/private RSA key pair.

Generating RSA keys

On a Mac or other Unix-like system, locate your ~/.ssh directory and from that directory run this in the command line:

ssh-keygen -t rsa -b 4096 -C "your_comment"

-t = type (The possible values are 'dsa', 'ecdsa', 'ed25519', or 'rsa')

-b = bits

@sageworksstudio
sageworksstudio / FolderPermissions.md
Last active June 1, 2020 05:19
Change permissions on folders only, not files

Set folder permissions

find . -mindepth 1 -type d | xargs chmod 700

@sageworksstudio
sageworksstudio / SSL_Creating-csr-keys-certs.md
Last active June 1, 2020 05:18
SSL - Creating CSR, keys and storing certificates for Apache2

SSL (HTTPS) - Creating CSR, keys and storing certificates

More info

Apache


Create a new folder to store certs and keys:

@sageworksstudio
sageworksstudio / creating-tar-backups.md
Last active June 1, 2020 04:47
Tar backups --exclude <dir>

Creating TAR backups

Bash example

  • First create a timestamp that looks something like (YearMonthDay-Hour:Minute:Second) or (20200512-02:30:00). This will give you a unique identifier.
  • Then cd into the directory you want to back up.
  • Create a tar.bz2 (bzip2 compression) file.
  • Optionally, delet the original files.

Example:

@sageworksstudio
sageworksstudio / wpa_supplicant.md
Last active May 25, 2020 19:41
Headless Raspberry Pi - Add this file to the boot partition.

wpa_supplicant.conf

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your_real_wifi_ssid"
 scan_ssid=1