Skip to content

Instantly share code, notes, and snippets.

View evanlouie's full-sized avatar

Evan Louie evanlouie

View GitHub Profile
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@evanlouie
evanlouie / jj flow
Created November 15, 2021 20:10
mermaid flow doc
sequenceDiagram
participant AI as Application Insights
link AI: JS SDK @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/nodejs
link AI: Node.js SDK @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript
link AI: Azure Functions Java Distributed Tracing @ https://docs.microsoft.com/en-ca/azure/azure-monitor/app/monitor-functions
link AI: AKS App Monitoring @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/kubernetes-codeless
link AI: AKS Java Codeless Monitoring @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent
participant Functions as Azure Functions
participant FrontendServer as Frontend
participant Storage as Storage Account
@evanlouie
evanlouie / ubuntu-debug-deployment.yaml
Last active March 27, 2019 20:42
Single pod ubuntu deployment
# Single pod Ubuntu deployment that will not terminate
apiVersion: apps/v1
kind: Deployment
metadata:
name: ubuntu-deployment
labels:
app: ubuntu
spec:
replicas: 1
selector:
@evanlouie
evanlouie / tfrecord_print.py
Created September 12, 2018 21:16
Print a target TFRecord file
import argparse
import tensorflow as tf
parser = argparse.ArgumentParser()
parser.add_argument("--example", help="target TFRecord Example file")
parser.add_argument("--sequence_example",
help="target TFRecord SequenceExample file")
args = parser.parse_args()
if args.sequence_example:
@evanlouie
evanlouie / WavEncoder.ts
Last active September 16, 2018 18:36
WAV Audio Encoder
/**
* TypeScript Conversion of https://github.com/Jam3/audiobuffer-to-wav
* @author Evan Louie <evan.louie@microsoft.com> (https://evanlouie.com)
*/
export class WavEncoder {
/**
* @param {AudioBuffer} buffer The AudioBuffer to encode
* @param {float32: boolean} options If float32 is true, PCM Floating point at 32-bits/sample will be use; defaults to PCM Integer at 16-bits/sample will be used.
* @see http://wavefilegem.com/how_wave_files_work.html
*/
@evanlouie
evanlouie / create-service-instance.js
Last active August 15, 2018 17:09
Create a namespaced service instance
const provision = (name: string, namespace: string, location: string, resourceGroup: string) =>
fetch(
`http://localhost:8001/apis/servicecatalog.k8s.io/v1beta1/namespaces/${namespace}/serviceinstances`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
apiVersion: "servicecatalog.k8s.io/v1beta1",
/**
* Prime number generator
*/
const Primes = function*(upto: number = Infinity) {
const primesList: number[] = [];
for (let current = 2; current < upto; current++) {
const hasPrimeFactor = Boolean(primesList.find(prime => current % prime === 0));
if (hasPrimeFactor) {
continue;
} else {
@evanlouie
evanlouie / spacemacs-cheshe.md
Created May 7, 2018 22:15 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@evanlouie
evanlouie / emacs26.sh
Created May 7, 2018 08:33 — forked from kissge/emacs26.sh
Compile Emacs 26 on Ubuntu 16.04 on Windows Subsystem for Linux (WSL, aka Bash on Ubuntu on Windows)
mkdir emacs
cd emacs
git init
git remote add origin https://github.com/emacs-mirror/emacs.git
git fetch --depth 1 origin emacs-26
git reset --hard FETCH_HEAD
sudo apt install autoconf make gcc texinfo libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff5-dev libgnutls-dev libncurses5-dev
./configure
make
sudo make install
@evanlouie
evanlouie / turbo_inject.js
Created December 13, 2017 01:37
Attach Turbolinks to page
script = document.createElement('script')
script.src = "https://cdn.rawgit.com/turbolinks/turbolinks/1066805f/dist/turbolinks.js"
document.head.appendChild(script)