This file contains 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
input = """0:07 Komm, ihr Töchter (Chor) | |
8:02 De Jesu diese Rede (Rezitativ) | |
8:46 Herzlieber Jesu (Choral) | |
9:38 Da Versammleten (Rezitativ) | |
10:02 Ja nicht auf das Fest (Chor) | |
10:17 Da nun Jesus war zu Bethanien (Rezitativ) | |
10:49 Wozu dienet dieser Unrat? (Chor) | |
11:16 Da das Jesus merkete (Rezitativ) | |
12:50 Du liebert Heiland du (Arioso) | |
13:46 Buss un Reu (Arie) |
This file contains 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
nruns = 10000 | |
FPR <- function(population, allowedFailedRatio){ | |
allowFails = population * allowedFailedRatio | |
count = match = 0 | |
while (count < nruns) { | |
x <- rnorm(population, 0, 1) | |
if (sum(x > 2 | x < -2) <= allowFails){ | |
match = match + 1 | |
} |
This file contains 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
struct AMG_ANGLES { | |
float yaw; | |
float pitch; | |
float roll; | |
}; | |
int main() { | |
AMG_ANGLES struct_data; | |
struct_data.yaw = 87.96; |
This file contains 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
{ | |
"window.zoomLevel": 0, | |
// start bash, not the mintty, or you'll get a new window | |
"terminal.integrated.shell.windows": "C:\\cygwin64\\bin\\bash.exe", | |
// Use this to keep bash from doing a 'cd ${HOME}' | |
"terminal.integrated.env.windows": { | |
"CHERE_INVOKING": "1" | |
}, | |
// Make it a login shell | |
"terminal.integrated.shellArgs.windows": [ |
This file contains 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
def getModelName(model_path): | |
fn = args.model.split('/')[-1] | |
return fn.replace('.tar', '') | |
def createFolderIfnotExist(dir): | |
if not os.path.exists(dir): | |
os.mkdir(dir) | |
def saveList(fn, alist): | |
with open(fn, 'w') as f: | |
for c in alist: | |
f.write("%s\n" % c) |
This file contains 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
def initPartialSum(A): | |
nrow, ncol = len(A), 0 if not matrix else len(A[0]) | |
#S[i][j] = sum(m, n) for 0 <= m <= i, 0 <= n <= j | |
S = [[0] * ncol for _ in range(nrow)] | |
for i in range(nrow): | |
partialSum = 0 | |
for j in range(ncol): | |
partialSum += A[i][j] | |
S[i][j] = partialSum | |
if i > 0: S[i][j] += S[i-1][j] |
This file contains 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
############################################################## | |
# V2 = use bounding box information to weight words in OCR | |
## add imagehash to dedup | |
############################################## | |
## common functions | |
############################################## | |
import logging, os, re | |
import pandas as pd | |
import collections, struct, pickle, json, re | |
from ast import literal_eval |
This file contains 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
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?> | |
<hierarchy rotation="0"> | |
<node index="0" text="" resource-id="" class="android.widget.FrameLayout" package="com.pinterest" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1200,1823]"> | |
<node index="0" text="" resource-id="" class="android.widget.LinearLayout" package="com.pinterest" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1200,1823]"> | |
<node index="0" text="" resource-id="" class="android.widget.FrameLayout" package="com.pinterest" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds=" |
This file contains 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
# run foo.py with different date input in parallel | |
# input: sys.argv[1]: starting date ; sys.argv[2]): num of days | |
import sys | |
import os | |
from multiprocessing import Process | |
import pandas as pd | |
children = [] |
This file contains 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
m0 =5 | |
m1 =18 | |
alpha = 0.05 | |
tau = 1.0 | |
m_arr = sort(list(set(map(lambda x: int(round(x)), np.linspace(m0, m1, 10))))) | |
print m_arr | |
for m in m_arr: | |
kmax = int(round(m/3.)) | |
prior_levels = [1./(m+1)]*(m+1) |
NewerOlder