Skip to content

Instantly share code, notes, and snippets.

@shawnzhu
shawnzhu / unbound.conf
Last active August 13, 2023 18:20
configure unbound as DOH server
server:
verbosity: 1
interface: 0.0.0.0@443
tls-service-key: "cert.key"
tls-service-pem: "cert.pem"
# TLS 1.3 only
tls-ciphersuites: "TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_AES_128_CCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256"
https-port: 443
access-control: 0.0.0.0/0 allow_snoop
access-control: ::0/0 allow_snoop
@shawnzhu
shawnzhu / README.md
Last active June 9, 2023 13:56
Setup Pi as a router (share Wifi via Ethernet)

Use case

It turns a Raspberry Pi into a router:

  1. Connect to internet via Wifi - this is a one time manual step.
  2. Route traffic from devices connected via ethernet to internet - automatic step as long as devices are connected via ethernet port

Notice it's more like a wireless bridge router but do NAT for all connected devices.

How to use it

@shawnzhu
shawnzhu / trc.cli
Last active April 2, 2020 16:50
Debug info of using ibm-db w/ IAM authentication via API key
<db2trc_header>
Marker : @TRACE@
Trace version : 7.0
Platform : Linux/X8664
Build level : special_39510
maxBufferSize : 33554432 bytes (32 MB)
auxBufferSize : 0 bytes (0 MB)
allocationCount : 0
DB2TRCD pid : 0
Trace destination : trc.dmp
@shawnzhu
shawnzhu / use_ibmcloudsql.ipynb
Created June 15, 2019 02:30
use ibmcloudsql in jupyter notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
FROM openjdk:8u181-jre-stretch
WORKDIR /opt
RUN curl -L http://apache.mirrors.pair.com/hive/hive-2.3.3/apache-hive-2.3.3-bin.tar.gz | tar zxf - && \
curl -L http://apache.mirrors.pair.com/hadoop/common/hadoop-2.9.1/hadoop-2.9.1.tar.gz | tar zxf -
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
ENV HADOOP_HOME=/opt/hadoop-2.9.1
ENV HIVE_HOME=/opt/apache-hive-2.3.3-bin
@shawnzhu
shawnzhu / captialize
Created June 2, 2017 20:49
a commit-msg git hook
#!/bin/bash
COMMIT_MSG="$(head -n 1 "$1")"
if [[ "${COMMIT_MSG:0:1}" =~ [^A-Z] ]]; then
>&2 echo Commit message must be capitalized.
exit 1
fi