Skip to content

Instantly share code, notes, and snippets.

@devloco
devloco / pihole-macvlan-synology-docker.txt
Created January 20, 2020 01:53 — forked from xirixiz/pihole-macvlan-synology-docker.txt
Add a PiHole instance on a macvlan enabled Docker network (Synology eth0 example)
#!/bin/bash
# NAS IP: 192.168.1.10 in this example
# DHCP scope reservation for macvlan: 192.168.1.208/28 (Details below)
## Network: 192.168.1.208/28 11000000.10101000.00000001.1101 0000 (Class C)
## HostMin: 192.168.1.209 11000000.10101000.00000001.1101 0001
## HostMax: 192.168.1.222 11000000.10101000.00000001.1101 1110
## Hosts/Net: 14 (Private Internet)
# Create a macvlan Docker network using eth0
@devloco
devloco / .bash_aliases
Created May 18, 2019 16:28
Useful Bash aliases
# Did you forget to use "sudo" with a command? Use this alias to auto add sudo and re-run it.
# usage example:
# > apt update
# Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
# > oops
# (now your previous command runs with sudo)
alias oops='sudo $(fc -ln -1)'
@devloco
devloco / cors_in_iis.txt
Created May 15, 2019 10:40
How To: CORS with IIS
https://blogs.iis.net/iisteam/getting-started-with-the-iis-cors-module
@devloco
devloco / download-pdf.js
Last active December 2, 2024 04:14
Download a PDF via POST with Fetch API
let fnGetFileNameFromContentDispostionHeader = function (header) {
let contentDispostion = header.split(';');
const fileNameToken = `filename*=UTF-8''`;
let fileName = 'downloaded.pdf';
for (let thisValue of contentDispostion) {
if (thisValue.trim().indexOf(fileNameToken) === 0) {
fileName = decodeURIComponent(thisValue.trim().replace(fileNameToken, ''));
break;
}