Skip to content

Instantly share code, notes, and snippets.

View ldong's full-sized avatar
❤️
Love & Peace

Alan Dong ldong

❤️
Love & Peace
  • Sunnyvale, CA
View GitHub Profile
@ldong
ldong / cidr.py
Created April 5, 2018 04:17 — forked from lordkebab/cidr.py
Python script to calculate CIDR values
""" Calculate the subnet mask, its binary representation, number of host and
network bits, and the total number of hosts for a given CIDR address.
Usage: python cidr.py [cidr]
Notes: Pipe the command to jq to pretty print the JSON. Python 2 or 3 compatible.
Examples:
python cidr.py 10.0.0.0/24
python cidr.py 172.0.0.0/16 | jq
"""
from __future__ import print_function
@ldong
ldong / README.md
Created March 29, 2018 06:49 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

OP: @leonardofed founder @ plainflow.


Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@ldong
ldong / Ember_Expand_Properties_Benchmark_RESULTS.md
Created February 25, 2018 06:57 — forked from nickiaconis/RESULTS.md
Expand Properties Benchmark

$ node index.js
status quo x 183,314 ops/sec ±7.01% (81 runs sampled)
comma fix x 88,004 ops/sec ±5.18% (81 runs sampled)
alternate fix x 88,608 ops/sec ±4.89% (84 runs sampled)
regex match fix x 36,670 ops/sec ±5.04% (83 runs sampled)
iteration fix x 175,519 ops/sec ±5.20% (84 runs sampled)
nested x 88,474 ops/sec ±3.91% (82 runs sampled)

@ldong
ldong / javascript_proto.js
Last active June 1, 2017 21:09 — forked from CatTail/proto.js
Javascript prototype in a nutshell
var assert = require('assert')
var util = require('util')
function test (inherits) {
function Fruit () {
}
Fruit.prototype.round = false
Fruit.prototype.sweet = true
Fruit.prototype.eat = function () {}
@ldong
ldong / proto.js
Created June 1, 2017 21:09 — forked from CatTail/proto.js
Javascript prototype in a nutshell
var assert = require('assert')
var util = require('util')
function test (inherits) {
function Fruit () {
}
Fruit.prototype.round = false
Fruit.prototype.sweet = true
Fruit.prototype.eat = function () {}
@ldong
ldong / LICENSE.txt
Created April 7, 2017 16:50 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ldong
ldong / one-liners.md
Created January 20, 2017 09:52 — forked from KL-7/one-liners.md
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@ldong
ldong / ember.js
Created September 29, 2016 22:11 — forked from crofty/ember.js
// Version: v1.0.0-pre.2-396-g99357c2
// Last commit: 99357c2 (2013-01-14 11:38:40 +0000)
(function() {
/*global __fail__*/
/**
Ember Debug
g=git
ga='git add'
gaa='git add --all'
galias='alias | grep git'
gapa='git add --patch'
gb='git branch'
gba='git branch -a'
gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d'
gbl='git blame -b -w'
gbnm='git branch --no-merged'