Skip to content

Instantly share code, notes, and snippets.

@phongnh
phongnh / app-delivery.md
Created August 30, 2023 17:26 — forked from rix0rrr/app-delivery.md
Python READMEs

Continuous Integration / Continuous Delivery for CDK Applications---

Stability: Experimental

This is a developer preview (public beta) module. Releases might lack important features and might have future breaking changes.

This API is still under active development and subject to non-backward compatible changes or removal in any future version. Use of the API is not recommended in production

#!/bin/bash
BIN_FILE="$1"
PAD_BIN_FILE="true"
BEFORE="$( ls -1 /dev/sd? )"
if [[ ! -f $BIN_FILE ]]; then
echo "Hmm... can't find firmware file at $BIN_FILE" 2>&1
exit 1
@phongnh
phongnh / build_cross_gcc
Created March 12, 2022 09:25 — forked from preshing/build_cross_gcc
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@phongnh
phongnh / index.js
Created December 19, 2020 17:35 — forked from smithclay/index.js
"Hello World" AWS Lambda + Terraform Example
// 'Hello World' nodejs6.10 runtime AWS Lambda function
exports.handler = (event, context, callback) => {
console.log('Hello, logs!');
callback(null, 'great success');
}
@phongnh
phongnh / recovery.sh
Created April 3, 2020 11:13 — forked from jonathantneal/recovery.sh
Create or update macOS Mojave Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""
@phongnh
phongnh / recovery.sh
Created April 3, 2020 11:12 — forked from magnusviri/recovery.sh
Create or update macOS Mojave Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
# Find the latest pkg at https://swscan.apple.com/content/catalogs/others/index-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz
DOWNLOAD_URL="http://swcdn.apple.com/content/downloads/24/46/061-41421-A_M34O0XGXUZ/vpexpha4aju1y04pz8ylxfm3mn1f543z94/macOSUpd10.14.6.RecoveryHDUpdate.pkg"
PACKAGE_NAME="macOSUpd10.14.6.RecoveryHDUpdate.pkg"
@phongnh
phongnh / stratify_experiment.py
Created December 16, 2019 06:11 — forked from SHi-ON/stratify_experiment.py
An expirement to show how stratify option works
# Experiment to confirm the effect of stratify option in Scikit Learn, tran_test_split() method.
# by Shayan Amani
from sklearn.model_selection import train_test_split
import pandas as pd
raw_data = pd.read_csv("codebase/adrel/dataset/train.csv")
cnt = raw_data.groupby('label').count()
''' experiment begins '''
@phongnh
phongnh / TrueColour.md
Created January 13, 2019 22:12 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@phongnh
phongnh / split_keyboards.md
Created February 9, 2018 18:18 — forked from itod/split_keyboards.md
Every "split" mechanical keyboard currently being sold that I know of
  • Kinesis Freestyle (Terrible key switches. Mushy and un-lovable)

  • Matias Ergo Pro (Looks pretty great. Have not tried.)

  • ErgoDox Kit (Currently, my everyday keyboard. Can buy pre-assembled on eBay.)

  • ErgoDox EZ (Prolly the best option for most people.)

  • Diverge 3 (Looks great. Might buy one. Ergo-dox really has too many thumb keys anyway. This might be a better design.)