Skip to content

Instantly share code, notes, and snippets.

View georgeyue's full-sized avatar
🎯
Focusing

George Yue georgeyue

🎯
Focusing
  • Los Angeles, California
View GitHub Profile
@georgeyue
georgeyue / GIF-Screencast-OSX.md
Created May 21, 2020 17:38 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@georgeyue
georgeyue / encryption.js
Created August 28, 2019 07:54 — forked from vlucas/encryption.ts
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@georgeyue
georgeyue / OSX-Convert-MOV-GIF.md
Created May 15, 2019 19:29 — forked from tskaggs/OSX-Convert-MOV-GIF.md
Creating GIFs from .MOV files in OSX using FFmpeg and ImageMagick

Convert MOV to GIF using FFmpeg and ImageMagick

I tried a few different techniques to make a GIF via command-line and the following gives me the best control of quality and size. Once you're all setup, you'll be pumping out GIFs in no time!

Preparation

Install FFmpeg

  • $ brew install ffmpeg [all your options]
    • Example: $ brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

Install ImageMagick

@georgeyue
georgeyue / backspace.sh
Last active October 28, 2018 01:09
remap remap right-cmd to backspace
#!/usr/bin/env bash
hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x7000000e7,
"HIDKeyboardModifierMappingDst":0x70000002a}]
}'
@georgeyue
georgeyue / gist:02971fe517e5f07e5daa4c51b492ca34
Created August 1, 2018 07:08
Walmart Mobile node.js Setup

Overview

We run multiple server processes in two data centers. Each process listens on two ports, one for HTTP and one for HTTPS. HTTPS is terminated by Apache prior to reaching node.js. HTTP goes directly from the client to node.js (through a master load balancer). We do not use clusters. We slice our physical servers into thin virtual machines running SmartOS, each with about 3GB of memory designed for a single node.js process.

Our node.js servers are hapi.js servers using the composer functionality and plugins architecture. We have three sets of plugins loaded: mobile web front end experience (single page app), legacy API reverse proxy, and monitoring.

We also serve original node.js services off another server zone which runs closed source plugins using hapi.

Analytics

Create an Order History page listing a user's order in the following format.
{confirmation_number} - {event_name}
You have access to the following data via a Web API
1. API to fetch orders for the current user:
https://tm-service.herokuapp.com/orders
2. API to fetch details of an order:
https://tm-service.herokuapp.com/orders/{order_id}
javascript:(function(){ var h=window.location.host.split('.');var t=prompt("cookie key");var a=prompt("value");if (t && a) {document.cookie = t+"="+a+"; path=/; domain="+("."+h[h.length-2]+"."+h[h.length-1]);}})()
@georgeyue
georgeyue / stuff.md
Last active January 24, 2017 18:37
CSS stuff

HTML

<ul>
  <li>
    <a>asdas</a>
  </li>
</ul>

CSS

@georgeyue
georgeyue / specification.txt
Last active March 13, 2017 18:18
Order History specification
Create an Order History page listing a user's order in the following format.
{confirmation_number} - {event_name} - {number_of_times_clicked}
You have access to the following data via a Web API
1. API to fetch orders for the current user:
https://tm-service.herokuapp.com/orders
2. API to fetch details of an order:
https://tm-service.herokuapp.com/orders/{order_id}
@georgeyue
georgeyue / ES5 Newnewss
Created April 11, 2016 19:08 — forked from sym3tri/ES5 Newnewss
New features of ES5 summarized
- Trailing commas are ok
- No reserved words for property names
- NaN, Infinity, undefined : are all constants
- parseInt() defaults to radix 10
- /regexp/ produces new reg ex object every time
- JSON.parse(), JSON.stringify()
- Function.prototype.bind
- String.prototype.trim
- Array.prototype.every, filter, forEach, indexOf, lastIndexOf, map, reduce, reduceRight, some,
- Date.now()