Skip to content

Instantly share code, notes, and snippets.

View astleychen's full-sized avatar

Astley Chen astleychen

View GitHub Profile
@astleychen
astleychen / StitchingSheets.js
Created December 6, 2022 08:07 — forked from mrlynn/StitchingSheets.js
Google Sheets Script - Complete Script for Article Stitching Sheets
/****
* Michael Lynn - http://blog.mlynn.org
* Stitching Sheets - Integrating Google Sheets with MongoDB Using MongoDB Stitch
****/
// Create an object which contains keys for each column in the spreadsheet
var columns = { // 0 indexed
type: 2,
date_start: 3,
date_end: 4,
@astleychen
astleychen / kubectl-exec-all.sh
Created April 20, 2021 05:35
kubectl-exec-all.sh
#!/usr/bin/env bash
PROGNAME=$(basename $0)
function usage {
echo "usage: $PROGNAME [-n NAMESPACE] [-m MAX-PODS] -s SERVICE -- COMMAND"
echo " -s SERVICE K8s service, i.e. a pod selector (required)"
echo " COMMAND Command to execute on the pods"
echo " -n NAMESPACE K8s namespace (optional)"
echo " -m MAX-PODS Max number of pods to run on (optional; default=all)"
@astleychen
astleychen / k-cmds.txt
Last active November 12, 2019 02:40
Kubectl Command Tips
# Run debug app directly
Alpine with curl
```bash
kubectl run -i --tty --rm debug --image=byrnedo/alpine-curl --restart=Never --command sh
```
@astleychen
astleychen / debug-with-curl.md
Created August 15, 2019 13:39
Timing with cURL

Concept about measuring network latency

Methods for latency test

  • PING - ICMP ping does not give a good indication of end-user latency.
  • Time To First Byte (TTFB) - A good way to measure time to first HTTP response is to issue a curl command repeatedly to the server to get a response from the web server.

The Theory for Ideal

When comparing results, be aware that latency on fiber links is constrained mainly by the distance and the speed of light in fiber, which is roughly 200,000 km/s (or 124,724 miles/s).

@astleychen
astleychen / macos-bash-profile
Created October 24, 2018 14:01
.bash_profile for macOS
## pyenv Setup
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
alias ll='ls -al'
alias lf='ls -lF'
export CLICOLOR=1
@astleychen
astleychen / mozconfig-icecc
Last active January 5, 2018 02:26
A Firefox build profile that use icecc compiler farm
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-icecc
# -s makes builds quieter by default
# -j4 allows 4 tasks to run in parallel. Set the number to be the amount of
# cores in your machine. 4 is a good number.
mk_add_options MOZ_MAKE_FLAGS="-s -j128"
mk_add_options AUTOCLOBBER=1
@astleychen
astleychen / mozconfig-desktop
Last active January 5, 2018 02:25
A Firefox desktop build profile
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-desktop
# -s makes builds quieter by default
# -j4 allows 4 tasks to run in parallel. Set the number to be the amount of
# cores in your machine. 4 is a good number.
mk_add_options MOZ_MAKE_FLAGS="-s -j8"
@astleychen
astleychen / .bash_profile
Last active October 23, 2017 15:59
macOS bash profile used across all my mac machines.
alias ll='ls -al'
# Enable python for development
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
# mozconfig wrapper - https://github.com/ahal/mozconfigwrapper
source /usr/local/bin/mozconfigwrapper.sh
# Rust tool chain
RUST_BIN=~/.cargo/bin
@astleychen
astleychen / standing.sh
Last active October 3, 2017 16:07
A script to dump contributors standings in a period of time in a mercurial repo.
#!/bin/bash
# == Arguments ==
# $1 : date range, exp: "2016-07-01 to 2016-09-30"
# $2 ~ $n : bug mail list, exp: aschen@mozilla.com
#
# == Output ==
# Individual standings and sum of standings.
dateRange="$1"