from DevOps team {rduplain,mattd,teebes}, to mobile developers at WillowTree Apps
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and
PROCESS STATE CODES | |
Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process: | |
D uninterruptible sleep (usually IO) | |
R running or runnable (on run queue) | |
S interruptible sleep (waiting for an event to complete) | |
T stopped, either by a job control signal or because it is being traced | |
W paging (not valid since the 2.6.xx kernel) | |
X dead (should never be seen) | |
Z defunct ("zombie") process, terminated but not reaped by its parent |
// --- Compiling --- | |
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
$ tar xzvf redis-2.8.3.tar.gz | |
$ cd redis-2.8.3 | |
$ make | |
$ make install | |
// --- or using yum --- | |
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
def inner(): | |
d = {'b': 1} | |
try: | |
d['a'] | |
except: |
=== What is the best branching strategy for your team:
- Github flow - http://scottchacon.com/2011/08/31/github-flow.html
=== How to create pull request:
- git request-pull - https://git-scm.com/docs/git-request-pull
- And a better pull request by Atlasian - https://developer.atlassian.com/blog/2015/01/a-better-pull-request/
=== Good Practices using Git:
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import errno | |
import os | |
def mkdir_p(path): | |
try: |
#!/bin/bash | |
export FOO=100 | |
python - <<END | |
import os | |
print "foo:", os.environ['FOO'] | |
END |
#!/usr/bin/env python | |
# name binding always creates a name in the local scope | |
ng = 'a global' | |
def f(): | |
# without the following commented out line, UnboundLocalError will throw | |
# global ng | |
nl = 2 | |
print ng, nl | |
ng = 3 |
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |