Skip to content

Instantly share code, notes, and snippets.

View vothanhkiet's full-sized avatar
🎯
99% of ideas are worth nothing without good execution.

Kiệt Thành Võ vothanhkiet

🎯
99% of ideas are worth nothing without good execution.
View GitHub Profile
@vothanhkiet
vothanhkiet / openwrt_enable_ssh_on_wan.md
Created July 22, 2024 03:14 — forked from Juul/openwrt_enable_ssh_on_wan.md
OpenWRT enable SSH on WAN port

To /etc/config/firewall add:

config rule                                     
        option name             Allow-SSH-WAN   
        option src              wan             
        option proto            tcp             
        option dest_port        22              
 option target ACCEPT 
@vothanhkiet
vothanhkiet / quickAP.sh
Created June 17, 2024 03:51 — forked from MitchRatquest/quickAP.sh
install dhcp server and wifi ap on orangepi board
#
# Sample configuration file for ISC dhcpd for Debian
#
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
#
# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
@vothanhkiet
vothanhkiet / AdbCommands
Created January 22, 2024 13:20 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

#!/bin/bash
#Variable Declaration - Change These
HOSTED_ZONE_ID="XXXXXXXX"
NAME="example.com."
TYPE="A"
TTL=60
#get current IP address
IP=$(curl http://checkip.amazonaws.com/)
@vothanhkiet
vothanhkiet / postgres.go
Created August 4, 2022 07:28 — forked from rivo/postgres.go
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
@vothanhkiet
vothanhkiet / exclude.sql
Created April 8, 2022 10:20 — forked from fphilipe/exclude.sql
PostgreSQL EXCLUDE constraint
CREATE EXTENSION btree_gist;
CREATE TABLE room_reservations (
room_id integer,
reserved_at timestamptz,
reserved_until timestamptz,
canceled boolean DEFAULT false,
EXCLUDE USING gist (
room_id WITH =, tstzrange(reserved_at, reserved_until) WITH &&
) WHERE (not canceled)
CREATE UNLOGGED TABLE exclude_test(id integer primary key);
INSERT INTO exclude_test(id) SELECT generate_series(1,50000);
CREATE UNLOGGED TABLE exclude AS SELECT x AS item FROM generate_series(1,40000,4) x;
-- Horrific AND list, takes 80s to plan and execute here:
EXPLAIN ANALYZE SELECT id FROM exclude_test WHERE id <> 1 AND id <> 5 AND id <> 9 AND id <> 13 AND id <> 17 AND id <> 21 AND id <> 25 AND id <> 29 AND id <> 33 AND id <> 37 AND id <> 41 AND id <> 45 AND id <> 49 AND id <> 53 AND id <> 57 AND id <> 61 AND id <> 65 AND id <> 69 AND id <> 73 AND id <> 77 AND id <> 81 AND id <> 85 AND id <> 89 AND id <> 93 AND id <> 97 AND id <> 101 AND id <> 105 AND id <> 109 AND id <> 113 AND id <> 117 AND id <> 121 AND id <> 125 AND id <> 129 AND id <> 133 AND id <> 137 AND id <> 141 AND id <> 145 AND id <> 149 AND id <> 153 AND id <> 157 AND id <> 161 AND id <> 165 AND id <> 169 AND id <> 173 AND id <> 177 AND id <> 181 AND id <> 185 AND id <> 189 AND id <> 193 AND id <> 197 AND id <> 201 AND id <> 205 AND id <>
@vothanhkiet
vothanhkiet / Dockerfile.yml
Created September 16, 2021 08:05 — forked from jgould22/Dockerfile
Postgres 13 - Alpine - pg_partman with pg_jobmon
FROM postgres:13-alpine
LABEL maintainer="Jordan Gould <[email protected]>"
# Based on https://github.com/andreaswachowski/docker-postgres/blob/master/initdb.sh
ENV PG_JOBMON_VERSION v1.3.3
ENV PG_PARTMAN_VERSION v4.4.0
# Install pg_jobmon
RUN set -ex \
\
@vothanhkiet
vothanhkiet / LICENSE
Created June 5, 2021 14:35 — forked from binji/LICENSE
pokegb.cc w/o macros
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.