Skip to content

Instantly share code, notes, and snippets.

bogus-priv
no-resolv
server=1.1.1.1
server=1.0.0.1
server=2606:4700:4700::1111
server=2606:4700:4700::1001
local=/lan.aaronjwood.com/
interface=br0
bind-interfaces
expand-hosts
$dev = (Get-PnpDevice -PresentOnly).Where{ $_.InstanceId -like $instanceId }
$vm = Get-VM $vmName
$locationPath = (Get-PnpDeviceProperty -KeyName DEVPKEY_Device_LocationPaths -InstanceId $dev.InstanceId).Data[0]
Disable-PnpDevice -InstanceId $dev.InstanceId -Confirm:$false
Dismount-VMHostAssignableDevice -LocationPath $locationPath -Force -Verbose
Add-VMAssignableDevice -VM $vm -LocationPath $locationPath -Verbose
# Default policy to drop all incoming packets.
ip6tables -P INPUT DROP
ip6tables -P FORWARD DROP
# Accept incoming packets from localhost and LAN.
ip6tables -A INPUT -i lo -j ACCEPT -m comment --comment "Accept incoming loopback"
ip6tables -A INPUT -i $BRIDGE -j ACCEPT -m comment --comment "Accept incoming LAN"
# Accept incoming packets from the WAN if the router initiated the connection.
ip6tables -A INPUT -i $WAN -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT -m comment --comment "Accept incoming established, related WAN"
sysctl -w net.ipv6.conf.all.forwarding=1
sysctl -w net.ipv6.conf.$WAN.accept_ra=2
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# Default policy to drop all incoming packets.
iptables -P INPUT DROP
iptables -P FORWARD DROP
# Accept incoming packets from localhost and LAN.
iptables -A INPUT -i lo -j ACCEPT -m comment --comment "Accept incoming loopback"
iptables -A INPUT -i $BRIDGE -j ACCEPT -m comment --comment "Accept incoming LAN"
# Accept incoming packets from the WAN if the router initiated the connection.
iptables -A INPUT -i $WAN -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT -m comment --comment "Accept incoming established, related WAN"
[Unit]
Description=Grafana
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStartPre=-/usr/bin/docker pull grafana/grafana
ExecStart=/usr/bin/docker run --name grafana --user 1000 -p 3000:3000 -e "GF_AUTH_ANONYMOUS_ENABLED=true" -e "GF_AUTH_ANONYMOUS_ORG_NAME=Main Org." -v /home/aaron/grafana:/var/lib/grafana grafana/grafana
ExecStop=/usr/bin/docker stop grafana
@aaronjwood
aaronjwood / LCA.java
Created November 27, 2017 19:47
Lowest common ancestor of a binary tree
class LCA {
static class Node {
int data;
Node left, right;
Node(int item) {
data = item;
left = right = null;
}
@aaronjwood
aaronjwood / Change.java
Created October 17, 2017 17:10
Ways to make change (naive approach and dynamic programming approach)
class Change {
static int countDP(int coins[], int cents) {
int[] table = new int[cents + 1];
table[0] = 1;
for (int coin : coins) {
for (int j = coin; j <= cents; j++) {
table[j] += table[j - coin];
}
}
@aaronjwood
aaronjwood / HM.java
Created October 13, 2017 17:26
Hash map using an array
class HM<K, V> {
private static class HashNode<K, V> {
private HashNode<K, V> next;
private K key;
private V value;
HashNode(K key, V value) {
this.key = key;
this.value = value;