Skip to content

Instantly share code, notes, and snippets.

@qs-wang
qs-wang / flutter_alias
Created May 24, 2020 06:22
The bash shell alias for flutter command line tool
#!/bin/bash
alias f='flutter'
alias fpg='flutter pub get'
alias fr='flutter run'
alias ft='flutter test'
alias ftc='flutter test --coverage'
alias fa='flutter analyze'
@qs-wang
qs-wang / iterm2.md
Created April 19, 2020 12:27 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
const clone = (items) => items.map(item => Array.isArray(item) ? clone(item) : item);
#!/usr/bin/env bash
set -euxo pipefail
readonly QEMU_SYS='qemu-system-arm'
readonly TMP_DIR="${HOME}/qemu_vms-jessie"
readonly RPI_KERNEL="${TMP_DIR}/kernel-qemu-4.4.34-jessie"
readonly RPI_FS="${TMP_DIR}/2017-07-05-raspbian-jessie-lite.img"
# # # Emulate Raspberry Pi
#!/usr/bin/env bash
set -euxo pipefail
readonly QEMU_SYS='qemu-system-arm'
readonly TMP_DIR="${HOME}/qemu_vms-jessie"
readonly RPI_KERNEL="${TMP_DIR}/kernel-qemu-4.4.34-jessie"
readonly RPI_FS="${TMP_DIR}/2017-07-05-raspbian-jessie-lite.img"
# Tweak filesystem: start qemu with init flag, switch to guest window to execute tweak and close window afterwards
#!/usr/bin/env bash
set -euxo pipefail
readonly IMAGE_FILE='2017-07-05-raspbian-jessie-lite.zip'
readonly IMAGE_URL="http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-07-05/${IMAGE_FILE}"
readonly KERNEL_URL='https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/c5a491c093604a71db2f01b8fab72bad0e96e2b5/kernel-qemu-4.4.34-jessie?raw=true'
readonly TMP_DIR="${HOME}/qemu_vms-jessie"
readonly RPI_KERNEL="${TMP_DIR}/kernel-qemu-4.4.34-jessie"
@qs-wang
qs-wang / docker-cheat-sheat.md
Created January 3, 2020 02:39 — forked from dwilkie/docker-cheat-sheat.md
Docker Cheat Sheet

Build docker image

$ cd /path/to/Dockerfile
$ sudo docker build .

View running processes

@qs-wang
qs-wang / jq-commands
Last active March 2, 2020 03:57
jq commands collection which I am using
# filter by property value
cat dump.json | jq '.[] | select(.status=="InternalError")' | jq -s
cat produc_dump.json | jq '.[] | select(.apiKey == "DEuEDyCmVSedhKyszKoZL7Su4PWByCCp")'
# filter by date range
cat 20190902-prod-errors.json | jq --arg s '2019-08-23T00:00' --arg e '2019-09-02T08:09' 'map(select(.timeSubmitted | . >= $s and . <= $e + "z"))'
# sort by date descreasing
cat dump.json | jq 'sort_by(.timeSubmitted) | | reverse[]'
TaskExecutionDynamoDBReadRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
# Service: [ecs.amazonaws.com] this wrong principal make the cloudformation stuck forever.
Service: [ecs-tasks.amazonaws.com]
Action: ['sts:AssumeRole']
bcrypt $(echo -n "amwyagvdepsbtvcg" | sha256sum | cut -d " " -f 1) && echo