Skip to content

Instantly share code, notes, and snippets.

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
const arr = Array(5).fill([true]))
arr[0][0] = false
console.log(arr) //guess what!
@DadgadCafe
DadgadCafe / coroutine.js
Created August 18, 2017 04:26
naive prototype of coroutine
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) })
@DadgadCafe
DadgadCafe / np.py
Created June 30, 2017 03:44
notes of numpy and pandas.
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
@DadgadCafe
DadgadCafe / unfair_coin.py
Created June 23, 2017 05:02
some algorithm...
# 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):
@DadgadCafe
DadgadCafe / promise.py
Created June 22, 2017 15:10
naive async flow like node, using promise
import signal
# broken in eventloop things
class Promise:
def __init__(self, f):
self.status = 'PENDING'
self.cb = None
f(self.__resolve)
def resolve(v):
# 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
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
-- 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
@DadgadCafe
DadgadCafe / HPFFP.md
Last active November 3, 2022 10:49
Haskell Programming From First Principles

HASKELL PROGRAMMING FROM FIRST PRINCIPLES

CHAPTER1. ALL YOU NEED IS LAMBDA

1.1 All You Need is Lambda

lambda calculus:

computation model, 1930s, Alonzo Church, formalizing a method, Turing machines