Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Burnette ryanburnette

View GitHub Profile
View gist:2a2cdcc3af979e5197adc381d2f74f1a
openssl pkcs12 -export -out certificate.p12 -inkey privkey.pem -in fullchain.pem
View use-iso-to-restore-in-macos.bash
hdiutil convert -format UDRW -o /path/to/target /path/to/source.iso
# ext should be .img, not .dmg
mv /path/to/target.dmg /path/to/target.img
diskutil unmountDisk /dev/diskN
sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m
View overlay.css
.noscroll {
overflow: hidden;
}
.overlay {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow-y: scroll;
@ryanburnette
ryanburnette / Caddyfile
Last active Nov 23, 2020
Caddy v2.1 CORS whitelist
View Caddyfile
(cors) {
@origin{args.0} header Origin {args.0}
header @origin{args.0} Access-Control-Allow-Origin "{args.0}"
}
myawesomewebsite.com {
root * /srv/public/
file_server
import cors https://member.myawesomewebsite.com
import cors https://customer.myawesomewebsite.com
}
@ryanburnette
ryanburnette / bash
Created Jun 3, 2020
macOS create disk image then write it back again
View bash
# find disk by checking mount
diskutil list
# unmount disk
diskutil unmountDisk /dev/disk2
# create image
sudo dd if=/dev/disk2 of=foo.img.dd bs=512
# verify image
@ryanburnette
ryanburnette / Caddyfile
Created May 21, 2020
nested WordPress instances with Caddy
View Caddyfile
[hostname] {
encode gzip
log {
output file /var/log/caddylog
}
@canonicalPath {
file {
try_files {path}/index.php
}
not path */
View install-mysql.sh
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install mysql-server -y
View configure-mysql.sql
CREATE DATABASE IF NOT EXISTS databasename;
CREATE USER IF NOT EXISTS 'username'@'localhost' IDENTIFIED BY '_not_password_';
ALTER USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
@ryanburnette
ryanburnette / Caddyfile
Last active May 20, 2020
WordPress Caddyfile
View Caddyfile
{
email [email]
}
[hostname] {
php_fastcgi unix//var/run/php/php-fpm.sock
file_server
encode gzip
log {
output file /var/log/caddy
}
View install-php.sh
#!/usr/bin/env bash
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip
You can’t perform that action at this time.