Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Burnette ryanburnette

View GitHub Profile
@ryanburnette
ryanburnette / Caddyfile
Last active Dec 1, 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
header Access-Control-Allow-Methods "POST, GET, OPTIONS"
header Access-Control-Allow-Headers "*"
import cors https://member.myawesomewebsite.com
@ryanburnette
ryanburnette / universal-definition-pattern.js
Last active Nov 26, 2020
A universal definition pattern for JavaScript libraries. Supports require(), AMD, and browser.
View universal-definition-pattern.js
;(function() {
function myModule() {
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = myModule;
}
else {
if (typeof define === 'function' && define.amd) {
define([], function() {
@ryanburnette
ryanburnette / gist:0e6a0159f58052aec119ab87fdd6be99
Created Oct 12, 2020
proxmox get apt working without subscription
View gist:0e6a0159f58052aec119ab87fdd6be99
# /etc/apt/sources.list
deb http://ftp.debian.org/debian buster main contrib
deb http://ftp.debian.org/debian buster-updates main contrib
# PVE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve buster pve-no-subscription
# security updates
deb http://security.debian.org/debian-security buster/updates main contrib
@ryanburnette
ryanburnette / lcwipe
Created Oct 7, 2020
life cycle controller wipe
View lcwipe
winrm i LCWipe http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_LCService?SystemCreationClassName=DCIM_ComputerSystem+CreationClassName=DCIM_LCService+SystemName=DCIM:ComputerSystem+Name=DCIM:LCService -u:root -p:calvin -r:https://192.168.41.101/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic
View tmux-pairing
# create tmux session w/ a socket file
tmux -S /tmp/pairing new-session -s pairing
# open up permissions on the socket file
chmod 777 /tmp/pairing
# all users connect to tmux session using the socket
tmux -S /tmp/pairing attach-session -t pairing
@ryanburnette
ryanburnette / async-await-experimentation.js
Created Aug 20, 2020
playing around with async/await... it's not as useful as I had hoped it would be
View async-await-experimentation.js
var _foo = 0;
async function foo() {
return new Promise(function (resolve) {
setTimeout(function () {
_foo++;
console.log(_foo);
resolve(_foo);
}, 1000);
});
}
@ryanburnette
ryanburnette / Caddyfile
Last active Aug 18, 2020
caddy cache strategy
View Caddyfile
(asset-paths) {
path *.bmp *.jpg *.png *.svg *.gif *.pdf *.css *.js
}
(cache) {
@content {
not {
import asset-paths
}
}
header @content cache-control max-age=0
@ryanburnette
ryanburnette / gist:9c6898493336f849e8280df7c3fd101b
Created Aug 16, 2020
markdownify for getting consistent results when you need a p tag on a single paragraph
View gist:9c6898493336f849e8280df7c3fd101b
{{- $markdown := .Inner | markdownify -}}
{{ if not ( findRE "<[h|p][^>]*>" $markdown ) }}
<p>{{ $markdown }}</p>
{{ else }}
{{ $markdown }}
{{ end }}
@ryanburnette
ryanburnette / caddy_snippet_log
Created Aug 7, 2020
snippet for caddy to set the log up to use the output and format I prefer
View caddy_snippet_log
(log) {
log {
output stdout
format console
}
}
You can’t perform that action at this time.