Skip to content

Instantly share code, notes, and snippets.

View rocwang's full-sized avatar

Roc Wong rocwang

View GitHub Profile
@rocwang
rocwang / kinesis-observerable.ts
Created December 15, 2022 03:29
Read events from a Kinesis stream as an observable
import { Kinesis } from 'aws-sdk'
import { Reader } from 'protobufjs'
import { Observable } from 'rxjs'
import * as rx from 'rxjs'
/**
* Read events from a Kinesis shard iterator as an observable
*
* @param kinesis A Kinesis client instance
* @param millisToWaitAfterEachBatch Wait time between each read on the shard iterator
@rocwang
rocwang / ssl.sh
Created October 1, 2018 08:29
How to set up stress-free SSL on an OS X development machine
# See https://gist.github.com/jed/6147872
cat > openssl.cnf <<-EOF
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
CN = *.${PWD##*/}.$(whoami)
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
@rocwang
rocwang / script.sh
Created October 1, 2018 08:27
How To Secure Nginx with Let's Encrypt on Ubuntu 18.04
# See https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot renew --dry-run
@rocwang
rocwang / postcode2Region.json
Created April 3, 2018 05:45
Convertion table for converting New Zealand postcode (first 2 digits) to region names (based on https://en.wikipedia.org/w/index.php?title=Postcodes_in_New_Zealand&oldid=833089579#Allocation)
{
"00": {
"allocation": "unused",
"region" : "Northland"
},
"01": {
"allocation": "Whangarei, Marsden Point, Ngunguru",
"region" : "Northland"
},
"02": {
@rocwang
rocwang / magento-site-launch-checklist.md
Created March 26, 2018 21:11
Magento Site Launch Checklist

Magento Site Launch Checklist

Technical Configuration

  • Admin: Web - Check Secure and Unsecure Base Url
  • HTML Head for SEO
  • Tax Settings
  • Minify the CSS and Flush CSS to 1 file
  • Clear Test Data
  • Flush JavaScript to 1 file
@rocwang
rocwang / magento-site-audit-outline.md
Created March 26, 2018 21:09
Magento Site Audit Outline
  • Document Overview

  • Audit Information

  • Integrated Extensions

  • Extension Details

  • Core System / Mage Overrides

  • Extension Class Conflicts

  • Store Configuration

@rocwang
rocwang / install-magerun.sh
Created March 26, 2018 21:07
Install Magerun for Magento 1
wget https://files.magerun.net/n98-magerun.phar -P /usr/local/bin/ && chmod +x /usr/local/bin/n98-magerun.phar
@rocwang
rocwang / crate-ssh-key.sh
Created March 26, 2018 21:06
Creates a new ssh key, using the provided email as a label
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
@rocwang
rocwang / temp-ignore.sh
Created March 26, 2018 21:06
Git temporarily ignoring files
git update-index --assume-unchanged FILE_NAME_HERE
@rocwang
rocwang / clean-git.sh
Created March 26, 2018 21:05
Clean the .git folder
git reflog expire --expire=now --all && git repack -ad && git prune