Skip to content

Instantly share code, notes, and snippets.

sc268

Block or report user

Report or block sc268

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View serialization.cpp
struct AMG_ANGLES {
float yaw;
float pitch;
float roll;
};
int main() {
AMG_ANGLES struct_data;
struct_data.yaw = 87.96;
@sc268
sc268 / setting.json
Created Feb 11, 2019
vs code cygwin default terminal setting
View setting.json
{
"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": [
@sc268
sc268 / save_objs.py
Created Jan 29, 2019
python save & load objects
View save_objs.py
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)
@sc268
sc268 / getSums.py
Last active Dec 2, 2018
getSums.py
View getSums.py
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]
View tfidf.py
##############################################################
# 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
@sc268
sc268 / ui.xml
Created Jun 9, 2018
pinterest xml
View ui.xml
<?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="
@sc268
sc268 / parallel.py
Last active Jul 5, 2018
run foo.py with different date input in parallel
View parallel.py
# 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 = []
View asympotic5
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)
@sc268
sc268 / classification
Created Jul 11, 2014
final - simplified
View classification
{
"metadata": {
"name": "classfication.ipynb"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
View billing.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.