Skip to content

Instantly share code, notes, and snippets.

View oliverhu's full-sized avatar
👓
solving problems

Keqiu Hu oliverhu

👓
solving problems
View GitHub Profile
import urllib.parse
import re
import os
for root, dirs, files in os.walk("./"):
for file in files:
if file.endswith(".md"):
# f_base_name = urllib.parse.quote(os.path.basename(f_name))
# print(f_base_name)
f_path = os.path.join(root, file)
p = re.compile(r"(.*)<a href.*>(.*.PDF)</a>(.*)", re.IGNORECASE)
/*
Installing/using this software, you agree that this software is
only for study purposes and its authors and service providers
take no responsibilities for any consequences.
[base script copied from: http://yo.uku.im/proxy.pac]
*/
function _check_regex_list(i,o){":80/"===o.slice(0,4)&&(o=o.slice(3));for(var c=0;c<i.length;c++)if(i[c].test(o))return!0;return!1}function _check_patterns(i,o,c,m){return!(!i.hasOwnProperty(o)||!_check_regex_list(i[o],c.slice(m+o.length)))||!!_check_regex_list(i.any,c.slice(m))}function _find_proxy(i,o,c,m){return _check_patterns(i.white,o,c,m)?"DIRECT":_check_patterns(i.proxy,o,c,m)?_proxy_str:"DIRECT"}function FindProxyForURL(i,o){var c=i.slice(0,6);return"http:/"===c?_find_proxy(_http_map,o,i,7):"https:"===c?_find_proxy(_https_map,o,i,8):"DIRECT"}var _http_map={white:{any:[],"bangumi.bilibili.com":[/^\/index\/ding\-count\.json$/i]},proxy:{any:[/^[^\/]*\.cupid\.iqiyi\.com\//i,/^[^\/]*\.video\.qq\.com\//i,/^[^\/]*\.video\.qq\.com\//i,/^[^\/]*\.dpool\.sina\.com\.cn\//i,/^
Name Description
strace system call debuggers
DTrace dynamic tracing of fs operations. latency
top includes memory usage summary
vmstat virtual memory statistics
sar various statistics. including historic
slabtop kernel slab allocator statistics
/proc/meminfo kernel memory breakdowns
@oliverhu
oliverhu / more-mem-tools.csv
Last active January 6, 2019 01:39
memory analysis tool
Name Description
free report free memory with buffere cache and page cache
dmesg check for oom messages from the oom killer
valgrind a performance analysis suite. This costs significant overhead - 20 - 30x slower
swapon add/observe physical swap devices or files.
iostat if swap device is physical disk or slice.
perf investigate cpi
/proc/zoneinfo statistics for memory zones
/proc/buddyinfo statistics for the kernel buddy allocator for pages
Name Description
vmstat virtual and physical memory statistics
sar historical statistics
slaptop kernel slab allocator statistics
pr process status
top monitor per-process memory usage
pmap process address space statistics
DTrace allocation tracing
@oliverhu
oliverhu / distributed.py
Created September 10, 2018 03:04
distributed tf
from __future__ import print_function
import tensorflow as tf
import sys
import time
import os
import json
import logging
# cluster specification
//
// main.m
// BlockPlayground
//
// Created by Keqiu Hu on 3/20/17.
// Copyright © 2017 LinkedIn. All rights reserved.
//
#import <Foundation/Foundation.h>
@oliverhu
oliverhu / c.m
Created March 20, 2017 22:31
code snippet
//
// main.m
// BlockPlayground
//
// Created by Keqiu Hu on 3/20/17.
// Copyright © 2017 LinkedIn. All rights reserved.
//
#import <Foundation/Foundation.h>
{
"app": "./Sample.app", # Relative path or abs path
"scheme-path": "./SampleAppTestScheme.xcscheme", # Relative path or abs path
"output-dir": "./build/" # Relative path or abs path
}
let test = testA
with same code base {
if (test.passedAtLeastOnce && test.failed) {
test.isFlaky = true
test.disable()
}
}