computation model, 1930s, Alonzo Church, formalizing a method, Turing machines
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. C - Dm => C - C#dim7(A7) - Dm; F - G => F - F#dim - G | |
2. minor, half note down... michelle the beatles | |
3. 4736251 + leading bass 1765.., secondary domiant | |
4. passing chord | |
5. V7 half note down... C - Bb7 - A7 - Ab7 - G7 - any major | |
reason: multiple dominant fuzz the tonality | |
6. mode - color | |
minor dorian | |
major lydian | |
dominant phrygian-dominant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = Array(5).fill([true])) | |
arr[0][0] = false | |
console.log(arr) //guess what! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _go(g, step) { | |
while(!step.done) { | |
//run the closure function | |
const [state, value] = step.value() | |
switch (state) { | |
case "park": | |
// just wait, add to eventloop | |
// setImmediate(function() { _go(g, step) }) | |
setTimeout(function() { _go(g, step) }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# linspace:创建线段 | |
arr = np.array([[1, 2, 3] | |
[4, 5, 6]], dtype=int32) # list to matrix | |
arr.ndim # 2 dimensions | |
arr.shape # 2 * 3 | |
arr.size # number of elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://sahandsaba.com/interview-question-groupon-probability.html | |
import random | |
def bernoulli_process(p): | |
if p > 1.0 or p < 0.0: | |
raise ValueError("p should be between 0.0 and 1.0.") | |
while True: | |
yield random.random() > p | |
def von_neumann_extractor(process): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
# broken in eventloop things | |
class Promise: | |
def __init__(self, f): | |
self.status = 'PENDING' | |
self.cb = None | |
f(self.__resolve) | |
def resolve(v): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# naming conventions: | |
# module_name, package_name, method_name, function_name, global_var_name, instance_var_name, function_parameter_name, local_var_name | |
# ClassName, ExceptionName | |
# GLOBAL_CONSTANT_NAME | |
*a = *range(3), #(1, 2, 3) | |
################# | |
# http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I ii iii IV V vi vii' | |
i ii' IIIb iv v VIb VIIb | |
II7 III7 Vb7 VI7 | |
IIb | |
?: iib iiib vb vib viib vii VII |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- lambda | |
data Term = Lam Var Term | |
| Var Var | |
| App Term Term -- func application | |
data Var = V String | |
instance Show Var where | |
show (V s) = s | |
NewerOlder