Skip to content

Instantly share code, notes, and snippets.

View harrytang's full-sized avatar

Harry Tang harrytang

View GitHub Profile
@harrytang
harrytang / zookeeper.yaml
Created April 3, 2025 17:31
HA ZooKeeper
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: zookeeper-pod-disruption-budget
namespace: plausible
spec:
selector:
matchLabels:
app: zookeeper
@harrytang
harrytang / plausible-replicated.sql
Created April 3, 2025 17:26
plausible-replicated.sql
CREATE TABLE default.location_data ON cluster '{cluster}'
(
`type` LowCardinality(String),
`id` String,
`name` String
)
ENGINE = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/{table}', '{replica}')
ORDER BY (type, id)
SETTINGS index_granularity = 128
COMMENT '2024-07-09';
@harrytang
harrytang / pi-ubuntu-k8s-base.sh
Last active October 27, 2024 11:25
Pi Ubuntu K8s base
#!/usr/bin/env bash
# Function to validate IPv4 and IPv6 addresses or CIDR notation
validate_ip() {
local ip="$1"
if [[ "$ip" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}(/[0-9]{1,2})?$ ]]; then
# Validate IPv4 octets and CIDR range
IFS='.' read -r -a octets <<< "$(echo "$ip" | cut -d '/' -f1)"
for octet in "${octets[@]}"; do
if ((octet < 0 || octet > 255)); then
@harrytang
harrytang / config-k8s.sh
Created February 28, 2023 08:23
config-k8s
#!/usr/bin/env bash
set -e
SNAP_DATA=/var/snap/microk8s/current
SNAP=/snap/microk8s/current
CONFIG_DIR=/var/snap/microk8s/current/args
source ${SNAP}/actions/common/utils.sh
# update the kube-apiserver
refresh_opt_in_local_config "enable-admission-plugins" "PodNodeSelector" kube-apiserver
refresh_opt_in_local_config "feature-gates" "IPv6DualStack=true,StatefulSetMinReadySeconds=true" kube-apiserver
@harrytang
harrytang / event-notification.eml
Last active April 25, 2022 13:38
Email template
<!DOCTYPE html>
<html style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{{object}}: {{event}}</title>
<style type="text/css">
img {
max-width: 100%;
}

MacOS: Disable Device Enrollment Notification

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
@harrytang
harrytang / outline-server-setup.md
Created March 18, 2020 20:22 — forked from hadisfr/outline-server-setup.md
How to setup an Outline VPN Server on Ubuntu 16.04

How to setup an Outline VPN Server on Ubuntu 16.04 Server

This guide will show you how to install Outline Server on an Ubuntu 16.04 Server and use Outline Manager.

Install Outline Manager

Outline Manager supports Windows, macOS and Linux.

Outline Manager for Windows

@harrytang
harrytang / script.js
Created January 31, 2020 06:57
thoa exercise
function calCulate(time) {
var time = parseInt(document.getElementById("day").value);
//const yearDay = 365;
//const monthDay = 30;
//const weekDay = 7;
var year = 0,
month = 0,
week = 0,
day = 0;
@harrytang
harrytang / .eslintrc.js
Created December 14, 2019 17:49
.eslintrc.js
module.exports = {
parser: "@typescript-eslint/parser",
extends: [
"react-app",
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
plugins: ["@typescript-eslint", "react-hooks", "react"],
rules: {
{
"success":true,
"data":[
[
{
"q":"Cum quaerat alias ut atque ab error.",
"a":"At fuga neque recusandae voluptatem cum rerum excepturi. Dolorum id ullam cum alias asperiores. Quis voluptas eius voluptatem ipsam."
},
{
"q":"Totam eos repellendus iste eligendi laudantium voluptatem.",