Skip to content

Instantly share code, notes, and snippets.

@shichao-an
shichao-an / evdn2.md
Last active June 5, 2016 05:26
English Vocabulary Digest Note 2
  • noob (n.) 新手 (a person who is inexperienced in a particular sphere or activity, especially computing or the use of the Internet.)
  • calamitous (adj.) 灾难性的
  • swamp (vt.) 淹没; 使…应接不暇; 使…人满为患
  • layman/layperson (n.) (non-expert) 外行
  • necessitate (vt.) 使成为必要
  • warrant (vt.) 证明…正当 (justify); 使成为必要 (necessitate); 为...作担保
  • instrumental (adj.) to be instrumental in [something]/doing [something] 对某事物/对做某事起重要作用 (to have important role)
  • stagnant (adj.) (sluggish) 停滞的; 不景气的
  • reap (vt.) 获得
  • weigh (vt.) 权衡; 衡量 (vt.) 有影响 (have influence) (exp. to weigh heavily/very little with [somebody] 对某人影响很大/很小)
@shichao-an
shichao-an / base_class.py
Created February 4, 2016 06:35
The Base class
class Base(object):
def __repr__(self):
try:
u = self.__str__()
except (UnicodeEncodeError, UnicodeDecodeError):
u = '[Bad Unicode data]'
repr_type = type(u)
return repr_type('<%s: %s>' % (self.__class__.__name__, u))
def __str__(self):
@shichao-an
shichao-an / vim_ag.txt
Created January 28, 2016 18:43
Vim Ag.vim crash dump
2016-01-28 10:41:06.926 Vim[33161:8900878] *** -[NSMachPort handlePortMessage:]: dropping incoming DO message because the connection is invalid
2016-01-28 10:41:06.932 Vim[33161:8900878] *** Terminating app due to uncaught exception 'NSInvalidReceivePortException', reason: 'connection is invalid'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff95bddae2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff8d67cf7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff95bdd98d +[NSException raise:format:] + 205
3 Foundation 0x00007fff86883b35 -[NSConnection sendInvocation:internal:] + 239
4 CoreFoundation 0x00007fff95b19412 ___forwarding___ + 514
5 CoreFoundation 0x00007fff95b19188 _CF_forwarding_prep_0 + 120
@shichao-an
shichao-an / evdn1.md
Last active February 12, 2016 23:41
English Vocabulary Digest Note 1
  • retroactive: 有追溯效力的; 追加的 example: a retroactive notice
  • afaik, AFAIK: as far as I know
  • recap (v.) 总结
  • drill down (v.) 钻取数据
  • to this end (v.) to achieve the previously specified goal.
  • predate (v.) 早于
  • roll out (v.) 推出; 展出; introduce; to initiate or produce for the first time;
  • verbiage (n.) 连篇累牍
  • surface (vi.) 露出水面; 出现; 重新出现
  • grinding (adj.) 刺耳的; 完全的; 难于忍受的
@shichao-an
shichao-an / cpp-dM.sh
Last active January 17, 2016 05:34
Show all the predefined macros: generate a list of #define directives for all the macros defined during the execution of the preprocessor
cpp -dM /dev/null
@shichao-an
shichao-an / .sshrc
Last active December 21, 2015 21:36
~/.sshrc for Ubuntu and Debian
# If .profile already exists, execute it.
if [ -f "$HOME/.profile" ]; then
. "$HOME/.profile"
else
# Otherwise, copy .profle from /etc/skel
if [ -f "/etc/skel/.profile" ]; then
cp /etc/skel/.profile "$HOME"
fi
# Also check if .bashrc exists and otherwise copy it from /etc/skel
if [ ! -f "$HOME/.bashrc" ]; then
@shichao-an
shichao-an / restore-default-route
Last active February 25, 2016 06:26
Personal Hotspot Backup Plan (OS X)
#!/usr/bin/env bash
# After disconnecting from the iPhone Hotspot, run this command
OLD_DEFAULT_ROUTE="10.0.1.1"
# Turn off WiFi
networksetup -setairportpower en0 off
# Flush all routes
sudo route flush
@shichao-an
shichao-an / montage.sh
Created September 10, 2015 02:47
ImageMagick montage
montage *.png -tile 2x4 -geometry +4+4 output.png
@shichao-an
shichao-an / google1.txt
Created September 5, 2015 07:40
SRE mianjings
1. LeetCode: Word Ladder
2. memory management
what's page fault? what would cause page fault?
char *a = 0x123456;
is the memory address pointing physical location?
kernel, software or hardware doing the memory translation?
what would cause page fault to load data from harddrive (not swap)? (
@shichao-an
shichao-an / companies.txt
Last active May 18, 2017 06:11
Popular companies for coding interviews (LeetCode)
Amazon
Microsoft
Facebook
Google
LinkedIn
Twitter
Apple
Zenefits
Uber
Airbnb