Skip to content

Instantly share code, notes, and snippets.

View ethanliew's full-sized avatar

Ethan Liew ethanliew

View GitHub Profile
@ethanliew
ethanliew / ffmpeg.md
Created October 12, 2022 04:54 — forked from dvlden/ffmpeg.md
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@ethanliew
ethanliew / README.md
Created December 19, 2021 14:18 — forked from djfdyuruiry/README.md
WSL 2 - Enabling systemd

Enable systemd in WSL 2

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh:

    cd /tmp
@ethanliew
ethanliew / parse_json_post.go
Created September 11, 2021 13:21 — forked from andreagrandi/parse_json_post.go
Parse a JSON http POST in GoLang
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type test_struct struct {
Test string
@ethanliew
ethanliew / camtasia-batch-export.scpt
Created August 22, 2021 03:29 — forked from walkingriver/camtasia-batch-export.scpt
AppleScript to batch-export an entire folder of Camtasia 3 projects with your default settings.
set projDir to choose folder with prompt "Choose a folder with .cmproj files in it" without invisibles
set myDirectory to POSIX path of projDir
tell application "Finder"
set fl to files of alias (projDir as text)
end tell
@ethanliew
ethanliew / android_instructions.md
Created July 26, 2021 07:43 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@ethanliew
ethanliew / Mac OS X: Open in Visual Studio Code
Last active July 16, 2020 15:34 — forked from tonysneed/Mac OS X: Open in Visual Studio Code
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Quick Action
- Change "Workflow Receives current" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in VSCode"
@ethanliew
ethanliew / convert id_rsa to pem
Created June 24, 2020 15:15 — forked from mingfang/convert id_rsa to pem
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 600 id_rsa.pem
@ethanliew
ethanliew / google-domains-dynamic-dns-update.sh
Created March 10, 2020 14:07 — forked from cyrusboadway/google-domains-dynamic-dns-update.sh
Script to update a Google Domains DNS record
#!/bin/bash
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""
@ethanliew
ethanliew / aggregation_lookup.md
Created February 11, 2020 03:18 — forked from bertrandmartel/aggregation_lookup.md
MongoDB $lookup aggregation example

MongoDB $lookup aggregation

SO link

db.votes.aggregate([{
    $lookup: {
        from: "users",
        localField: "createdBy",
        foreignField: "_id",
@ethanliew
ethanliew / beerSchema.js
Created December 12, 2019 07:56 — forked from suissa/beerSchema.js
Creating models dynamically
var mongoose = require('mongoose');
var BeerSchema = new mongoose.Schema({
id: { type: Number, min: 0},
name: { type: String, default: '' },
description: { type: String, default: '' },
abv: { type: Number, min: 0},
category: { type: String, default: ''},
created_at: { type: Date, default: Date.now },
updated_at: { type: Date, default: Date.now }