Skip to content

Instantly share code, notes, and snippets.

View mingliangguo's full-sized avatar

Mingliang mingliangguo

View GitHub Profile
@mingliangguo
mingliangguo / grokking_to_leetcode.md
Created May 20, 2022 01:58
Grokking the coding interview equivalent leetcode problems

EDIT: Forked the original list and added suggestions from comments

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@mingliangguo
mingliangguo / jwtRS256.sh
Created July 18, 2019 12:44 — forked from Holger-Will/jwtRS256.sh
generate public private key pair (RSA RS256) for use with koa-jwt jasonwebtoken etc.
# generate private key
openssl genrsa -out private.pem 2048
# extatract public key from it
openssl rsa -in private.pem -pubout > public.pem
@mingliangguo
mingliangguo / gist:8a5eb4a518354622dd5bd788be7fc1c7
Created May 7, 2019 03:07 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@mingliangguo
mingliangguo / multiline-regexp.js
Created April 11, 2019 13:38 — forked from shannonmoeller/multiline-regexp.js
Multiline Regular Expressions using ES6 Template Strings
/**
* Inspired by XRegExp via 2ality
* http://www.2ality.com/2012/12/template-strings-xregexp.html
* http://xregexp.com/
*/
import test from 'ava';
export function rx(flags) {
const trailingComments = /\s+#.*$/gm;
@mingliangguo
mingliangguo / pre-commit
Created January 24, 2017 15:40 — forked from mebibou/pre-commit
JSHint and JSCS pre-commit hook
#!/bin/sh
# pre-commit git hook.
files=$(git diff --cached --name-only --diff-filter=ACMR -- \*.js **/*.js)
pass=true
if [ "$files" != "" ]; then
for file in ${files}; do
@mingliangguo
mingliangguo / maven-war-exclude-directory.md
Created January 12, 2017 03:00 — forked from baybatu/maven-war-exclude-directory.md
Excluding Directory From War Package In maven-war-plugin

packagingExcludes configuration tag can be used to exclude certain files or directories from the war file. It is important to put '/' character at the end of the directory to be excluded. If there is no such '/' character, then the entry is interpreted as a regular file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
 
@mingliangguo
mingliangguo / osx-setup.md
Created December 26, 2016 03:44 — forked from zenorocha/.hyper.js
Setup macOS Sierra (10.12)

Setup macOS

I'm in a hospital in Spain and my MacBook was stolen.

Hospital Commit

Now I bought a new one and need to configure it. I have an AirPort Time Capsule that backs up everything using Time Machine, but I don't want all the crap I had in the old one. So let's get our hands dirty!

1. Update OS to latest version

@mingliangguo
mingliangguo / tmux.conf
Created November 23, 2016 17:47 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@mingliangguo
mingliangguo / 0_reuse_code.js
Created October 18, 2016 13:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mingliangguo
mingliangguo / git_branch_parent.sh
Last active October 20, 2016 00:33 — forked from intel352/git_branch_parent.sh
get the parent of the current branch
#!/usr/bin/env zsh
branch=`git rev-parse --abbrev-ref HEAD`
git show-branch | ack '\*' | ack -v "$branch" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# How it works:
# 1| Display a textual history of all commits.
# 2| Ancestors of the current commit are indicated
# by a star. Filter out everything else.