Skip to content

Instantly share code, notes, and snippets.

@skleeschulte
skleeschulte / TwoWayBoundString.java
Last active February 26, 2016 03:33 — forked from Nilzor/TwoWayBoundString.java
Observable String for two-way data binding, based on Fabio Collini's article and Frode Nilsen's gist. This version works without an extra id in the resources and with all TextViews.
import android.databinding.BaseObservable;
import android.databinding.BindingAdapter;
import android.databinding.BindingConversion;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.TextView;
import java.io.Serializable;
@skleeschulte
skleeschulte / protectUserId.js
Created March 8, 2017 21:00
LoopBack 3 boot script for protecting userId properties on custom models
'use strict';
/**
* Add before safe hook and validation to all custom models with an userId property to prevent changing userId
* properties by non-admin users.
*/
const USER_ID_PROPERTY = 'userId';
const INVALID_USER_ID = -1;
@skleeschulte
skleeschulte / 01-netcfg.yaml
Created February 5, 2020 15:16
Example Netplan config file for IPv6 on Ubuntu 18.04
network:
version: 2
renderer: networkd
ethernets:
ens3:
addresses: ['203.0.113.100/24','2001:db8:2:1::1/64']
gateway4: 203.0.113.1
gateway6: fe80::1
nameservers:
addresses: [203.0.113.10,203.0.113.20,'2001:db8:1:1::a','2001:db8:1:1::b']
@skleeschulte
skleeschulte / daemon.json
Last active February 7, 2020 15:41
Example Docker config file for IPv6 on Ubuntu 18.04
{
"ipv6": true,
"fixed-cidr-v6": "fd00::/80"
}
@skleeschulte
skleeschulte / netstat-output.txt
Created February 7, 2020 17:49
Sample output of "netstat -plnt" showing docker-proxy listening only for IPv6 connections on TCP
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 615/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 758/sshd
tcp6 0 0 :::8080 :::* LISTEN 13101/docker-proxy
tcp6 0 0 :::22 :::* LISTEN 758/sshd
Site A Site B
IPv4 address 192.168.10.2 192.168.20.2
IPv4 netmask 255.255.255.0 255.255.255.0
IPv4 gateway 192.168.10.1 192.168.20.1
Use custom DNS servers 192.168.10.1 192.168.20.1
@skleeschulte
skleeschulte / Keep luci-app-wireguard installed on OpenWrt
Last active December 1, 2021 22:19
Keep the package luci-app-wireguard installed on OpenWrt. Useful to automatically (re)install the package after a sysupgrade.
Usage:
1. Save install-luci-app-wireguard.sh in /root folder (e.g. with vi or with WinScp).
2. Make file executable:
chmod +x /root/install-luci-app-wireguard.sh
3. Add file to crontab (execute every 5th minute, but then sleep another two minutes before execution):
echo '*/5 * * * * sleep 120 && /root/install-luci-app-wireguard.sh' >> /etc/crontabs/root