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 / zshrc.txt
Created April 29, 2018 04:04
zshrc
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
@ldong
ldong / linux_bash.md
Last active April 23, 2024 00:47
linux and bash notes I took on LFS101x from EDX LinuxFoundationX

Linux and Bash

Lets talk about Linux and Bash.

Notes

Notes were taken from edx.org of LFS101x Introduction to Linux.

Date: Sun Sep 28 00:30:48 EDT 2014

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 / download_egghead_videos.md
Last active December 7, 2023 16:16
download egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});
@ldong
ldong / file_magic_numbers.md
Created December 20, 2015 08:25 — forked from leommoore/file_magic_numbers.md
File Magic Numbers

#File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

##Image Files

@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 / javasript_amd_commonjs.md
Created July 27, 2014 16:32
javascript AMD CommonJS modules

JavaScript

Lets talk about how to write modules in JavaScript.

AMD vs CommonJS

AMD and CommonJS are the two most popular JavaScript conventions for writing modules.

Asynchronous Module Definition (AMD)

@ldong
ldong / Sample Exam Questions – InfoVis.txt
Created December 9, 2014 14:43
Sample Exam Questions – InfoVis
# Sample
Sample Exam Questions – InfoVis
1. What info viz principles are employed in the application of hyperbolic tree views?
2. What are two advantages and two drawbacks of the treemap method of visualization?
3. Define the 'magic lens' technique and explain how can it be used for information
visualization.
4. Explain the difference between Information Visualization and Scientific Visualization.
5. Give two ways Information Visualization improves cognition.
6. Explain the difference between Overview and Detail and Focus + Context. Give an
example of each.
@ldong
ldong / next_prime.py
Created August 22, 2014 16:37
find the next prime number in python
#!/usr/bin/env python
def main():
n = input('Find the next prime number greater great than: ')
print find_next_prime(n+1)
def find_next_prime(n):
return find_prime_in_range(n, 2*n)
def find_prime_in_range(a, b):