Skip to content

Instantly share code, notes, and snippets.

View larryhou's full-sized avatar

larryhou larryhou

  • Tencent
  • Shenzhen, China
View GitHub Profile
tshark -r t.pcapng -Y 'dns.a' -Tfields -e 'dns.qry.name' -e 'dns.a' | sort | uniq
Domain Name Address
bugly.qq.com 183.61.38.230,14.215.138.13
dir.4.363442878.cs.gcloud.qq.com 101.226.68.121
ftest.next.qq.com 101.227.130.100
# get_dict_value(data, 'contents.[platforms.[.=iOS]]')
# get_dict_value(data, 'contents.[staticContentId=1884]')
def get_dict_value(data, refpath):
is_list_node = False
refpath = refpath.replace(' ', '')
if refpath[0] == '.': return data
index, position, node_name = -1, 0, ''
if refpath[0] == '[':
is_list_node = True
balance = 1
Sign in with Apple ID Individual Organization Enterprise Program
Xcode Developer Tools
Xcode Beta Releases
Developer Forums
Bug Reporter
Test on Device
Beta OS Releases
Advanced App Capabilities
App Store Distribution

larryhou-rmbp:Downloads larryhou$ ./mortage.py -r 4.9 -y 30 -n 1190000 1190000.0 0.00408333333333 360

[等额本息方案] 贷款:1190000 利率:4.9 期限:30年

期数 月供 月供利息 累计利息 月供本金 累积本金 剩余贷款 结清占比 月供本金占比 累积本金占比
001 6315.65 4859.17 4859.17 1456.48 1456.48 1188543.52 0.12% 23.06% 23.06%
002 6315.65 4853.22 9712.39 1462.43 2918.91 1187081.09 0.25% 23.16% 23.11%
003 6315.65 4847.25 14559.63 1468.40 4387.31 1185612.69 0.37% 23.25% 23.16%
./loan_interest.py -y 30 20 15 10 5 3 2 1 -r 3.0 -g 3

贷款年限: 30年

利率 月供 等额本息利息 等额本金利息 利息差
3.00 0.4216% 51.7775% 45.1250% 6.6525%
3.10 0.4270% 53.7259% 46.6292% 7.0967%
3.20 0.4325% 55.6881% 48.1333% 7.5547%

-crf bigger value leads to lower quality output, set to 18-28 for good quality with small size.

ffmpeg -i sample.mp4 -c:v libx264 -crf 22 -preset slow -an output.mp4 -y
@larryhou
larryhou / dict_utils.py
Last active April 7, 2018 06:57
Merge two dict object deeply
#!/usr/bin/env python
def merge_dict(data, target):
for key, value in data.iteritems():
node = target.get(key)
if not node or type(value) != type(node):
target[key] = value # add new value or replace value when type conficts
continue
if isinstance(value, dict):
merge_dict(value, node) # iterate merge dict-type value
continue
@larryhou
larryhou / README.md
Last active April 10, 2018 07:16
Bugfix for unity game crash on iOS Airplay

Bugfix for unity game crash on iOS Airplay

python unity_airplay_bugfix.py -i -f ./iOSProj/Classes/Unity/DisplayManager.mm
Incident Identifier: C0C2D616-E91B-40FA-8A95-B011F00B2707
CrashReporter Key:   0f5b8e228d89ea826e3793c64583ebfa05d27b11
Hardware Model:      iPhone9,2
https://itunes.apple.com/br/app/arena-of-valor/id1150318642
https://itunes.apple.com/ca/app/arena-of-valor/id1150318642
https://itunes.apple.com/cz/app/arena-of-valor/id1150318642
https://itunes.apple.com/de/app/arena-of-valor/id1150318642
https://itunes.apple.com/dk/app/arena-of-valor/id1150318642
https://itunes.apple.com/es/app/arena-of-valor/id1150318642
https://itunes.apple.com/fi/app/arena-of-valor/id1150318642
https://itunes.apple.com/fr/app/arena-of-valor/id1150318642
https://itunes.apple.com/hr/app/arena-of-valor/id1150318642
@larryhou
larryhou / memory_stream.py
Created May 25, 2018 12:52
MemoryStream class for python script
#!/usr/bin/env python
#encoding:utf-8
import io, os, struct
UINT32_MAX_VALUE = 0xFFFFFFFF
class TestCase(object):
def run_test_suit(self):
self.test_sqlit_sint32()