Skip to content

Instantly share code, notes, and snippets.


Jie Han jiehan1029

  • Cultivate AI
  • San Francisco Bay Area
View GitHub Profile
View Apps Script Gmail

Google Apps Script Gmail Utilities

##sendAndLabel(recipient, subject, body, options, label)##

An alternative to GmailApp.sendEmail(), which applies a label to the message thread in the sender's account.

Sends an email message with optional arguments. The email can contain plain text or an HTML body. The size of the email

jiehan1029 / base.css
Created Feb 12, 2019
reserved stylesheet base including normalization and bootstrap grid system
View base.css
@import url(',400,600,700,800');
/* 1. css normalization; 2. customize default form; 3. customize default table; 4. customize default a and font; 5. bootstrap grid (and hide/show) layout classes and modal classes; 6. bootstrap helper classes; 7. overrides css of other modules in use if necessary; 8. customize buttons; 9. customize layout classes; 10. customize helper classes; 11. cutomize specific/one-time classes */
/* breakpoints at: min-width: (320),(468),576, 768, 992, 1200*/
/****************** normalize ******************/
html {
height: 100%;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
font-size: 10px;
-webkit-tap-highlight-color: transparent;
jiehan1029 /
Created Jan 17, 2019 — forked from JamieMason/
Download all OpenSans fonts from Google Fonts
#!/usr/bin/env bash
wget -O src/assets/web-fonts/opensans/opensans-light_cyrillic-ext_normal_300
wget -O src/assets/web-fonts/opensans/opensans-light_cyrillic_normal_300
wget -O src/assets/web-fonts/opensans/opensans-light_greek-ext_normal_300
wget -O src/assets/web-fonts/opensans/opensans-light_greek_normal_300
wget -O src/assets/web-fonts/opensans/opensans-light_vietnamese_normal_300
wget -O src/assets/web-fonts/opensans/opensans-light_latin-ext_normal_300
wget -O src/as
View AWS VPC template with NAT for CloudFormation.template
"Description": "Building on AWS VPC",
"Parameters": {
"KeyName": {
"Description": "Choose an existing EC2 KeyPair",
"Type": "AWS::EC2::KeyPair::KeyName"
"Mappings": {
"AWSRegionToAMI": {
View AWS VPC template for CloudFormation.template
"Description": "Building on AWS VPC",
"Mappings": {
"AWSRegionToAMI": {
"us-west-2": {
"AMI": "ami-32cf7b4a"
"Resources": {
View AWS IAM policy template.txt
// full access to AWS IAM, Amazon EC2, Amazon S3, Amazon RDS, Amazon SNS, Amazon SQS, Amazon Rekognition, AWS Lambda, Amazon Cognito, AWS Cloud9, AWS X-Ray, and AWS CloudFormation
// copy the following in JSON tab of the Create policy section
"Version": "2012-10-17",
"Statement": [
"Sid": "Sid1",
"Effect": "Allow",
"Action": [
View Building on

This is the note for AWS course 1 on edX. List selected AWS services in alphabetic order. Course link is here.


Building on AWS --

  • Create VPC which simulates a local network that contains all your servers and databases.
  • Create IAM policy, user/role which has permission to specific AWS services, but not all -- this adds security overall.
  • Create S3 bucket (login as specific IAM user) which will be used to store assets.
  • Create RDS database instance (login as specific IAM user) as database server.
  • Create Cloud9 environment (login as specific IAM user) which is an online IDE that you can build & save your project.
  • Create EC2 instance (login as specific IAM user) and deploy the application via user data. This EC2 instance should have corresponding IAM role (to allow EC2 instance to call AWS service) and security group (to allow web t
View install MongoDB on AWS EC2
View run Nodejs server on AWS EC2

Install Node on EC2 and keep it running

This is the most straightforward way -- install node in the virtual server and simply keep it running. Good for testing, prototyping, etc. Obviously not for production.

First create a new EC2 instance (Amazon Linux AMI). SSH into it. Then install Node, install MongoDB or other database you'll be using, git clone your project repo, install dependencies, run the app, and finally make sure app will be running even if you close the terminal.

Install Node

You can follow the steps here (using NVM to install node):

Or simply use yum to install node, as below.

View Mongo basics

Get all


Limit and sort

Find the command that makes the first 10 restaurants appear when db.restaurants is alphabetically sorted by the name property.


Get by _id

Retrieve a single restaurant by _id from the restaurants collection. This means you'll first need to get the _id for one of the restaurants imported into the database.

var id = db.restaurants.findOne()._id;