Skip to content

Instantly share code, notes, and snippets.

@HouzuoGuo
HouzuoGuo / gist:c648966928997651ac86cb318efc2d43
Created April 18, 2018 11:55
A basic CloudFormation template for HTTPD running on EC2 in VPC, with EIP.
{
"Description": "Bring up an EC2 that runs apache HTTP server",
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"InstanceType": {
"Description": "EC2 instance type",
"Type": "String",
"Default": "t2.nano"
},
"InstanceAMI": {
@HouzuoGuo
HouzuoGuo / gist:f8b31ad521af54fe057129f770c7629e
Created August 31, 2018 12:28
Example control file of laitos software package for Debian/Ubuntu
Source: laitos
Section: devel
Priority: optional
Maintainer: Houzuo (Howard) Guo <i@hz.gl>
Build-Depends: debhelper (>= 9), dh-golang, golang-go
Standards-Version: 3.9.8
Homepage: https://github.com/HouzuoGuo/laitos
XS-Go-Import-Path: github.com/HouzuoGuo/laitos
Package: laitos
@HouzuoGuo
HouzuoGuo / gist:07023ea2aa584c13fc4539d29ca2effc
Created August 31, 2018 12:29
Example rules file of laitos software package for Debian
#!/usr/bin/make -f
export DH_VERBOSE = 1
export DH_GOPKG := github.com/HouzuoGuo/laitos
%:
dh $@ --buildsystem=golang --with=golang
override_dh_auto_install:
dh_auto_install -- --no-source
@HouzuoGuo
HouzuoGuo / gist:60f399d6c7770c57618f7179e71f3a28
Created September 6, 2018 09:06
OpenSSL self signed CA certificate one liner
openssl req -x509 -sha512 -nodes -extensions v3_ca -newkey rsa:4096 -keyout ca-cert-and-key.pem -days 7320 -out ca-cert-and-key.pem
# Reinstall SpaceVim along with useful bunch of tools that work well together with SpaceVim.
# This is for Ubuntu 20.04
sudo apt install -y ctags miscfiles python3-dev python3-pip rsync shellcheck software-properties-common wbritish wbritish-huge ruby ruby-dev nodejs gcc g++ make universal-ctags python3-pygments ripgrep
sudo select-default-wordlist
sudo apt-get update
sudo apt-get install -y --reinstall neovim
sudo update-alternatives --install /usr/bin/vi vi /usr/bin/nvim 5
sudo update-alternatives --install /usr/bin/vim vim /usr/bin/nvim 5
@HouzuoGuo
HouzuoGuo / gist:03cfccbca604b200ccf2273d9b26a00d
Created September 29, 2018 16:37
Useful MacOS software packages available from homebrew
ansible
apache2-utils
autoconf
automake
ca-certificates-mozilla
caca-utils
cloc
conemu
cscope
ctags
@HouzuoGuo
HouzuoGuo / gist:67f054aac42bc05df2bcc7dbb7bfbfe7
Created November 29, 2018 13:13
Forward HTTP traffic from intermediate Squid proxy to an exit Squid proxy
Intermediate proxy, the initial receipient of HTTP traffic:
coredump_dir /var/spool/squid
pid_filename /var/run/squid-http.pid
access_log /var/log/squid-http.log
cache_log /var/log/squid-http.log
via off
cache_peer 127.0.0.1 parent 13129 0 default no-query no-digest
never_direct allow all
http_access allow all
@HouzuoGuo
HouzuoGuo / gist:90cea01dbe2c7b6d7815de243a33e1b2
Last active May 16, 2021 08:48
Arduino UNO R3 serial port example: read input string via serial and print it back
void setup()
{
Serial.begin(1200);
Serial.setTimeout(1000);
Serial.println("Microcontroller has started");
}
int seqNum = 0;
String lastRead = "";
@HouzuoGuo
HouzuoGuo / gist:5becdf602eab2e7e2b5990659e1dc5f9
Created June 18, 2019 06:23
Squid HTTPS proxy - non-transparent proxy inspects TLS destination server name via SNI
debug_options ALL,2
coredump_dir /var/spool/squid
pid_filename /var/run/squid-https.pid
access_log /var/log/squid/access.log
cache_log /var/log/squid/cache.log
# Avoid interfering with timeout behaviour of TCP client applications
# The timeout values are 10x their default
shutdown_lifetime 10 seconds
@HouzuoGuo
HouzuoGuo / gist:a5512173a79fce84c3f17d72d8eaaa28
Created September 10, 2019 14:19
I am hguo on keybase.io
### Keybase proof
I hereby claim:
* I am HouzuoGuo on github.
* I am hguo (https://keybase.io/hguo) on keybase.
* I have a public key whose fingerprint is 60BD 93B6 F0C4 FCC7 1735 08D4 4132 7BD9 50FA B38C
To claim this, I am signing this object: