Skip to content

Instantly share code, notes, and snippets.

View larryhou's full-sized avatar

larryhou larryhou

  • Tencent
  • Shenzhen, China
View GitHub Profile
#!/usr/bin/env bash
cd $(dirname ${0})
name=$(date '+wwdc_mp4_%m%d%H%M.txt')
if [[ $(find . -iname 'wwdc_mp4_*.txt' | wc -l) -eq 0 ]]
then
touch $name
fi
#!/usr/bin/env python2
#encoding:utf-8
import argparse, os, sys, hashlib, re, time, json, tempfile
DB_FIELD_NAME_HASH = 'hash'
DB_FIELD_NAME_INDX = 'index'
def main():
arguments = argparse.ArgumentParser()
arguments.add_argument('--root-path', '-r', required=True, help='local folder path for walking through')
#!/usr/bin/env python3
import requests, json, argparse, sys, time, re, urllib
YOUTUBE_API_KEY = 'AIzaSyCyLSmcEDJt3HaLFK0_LdJYPkq0RFAVzKA'
CHANNEL_SETTING = [
'UCQT2Ai7hQMnnvVTGd6GdrOQ',
'UCO3pO3ykAUybrjv3RBbXEHw',
'UCkWfzJTG5j-V8gTJQgEOexA',
'UCdRKafyb--geO9ySg6CbhYA',
#!/usr/bin/env bash
# http://prdl-download.adobe.com/Photoshop/66A1D1E00DE44601B041A631261EC584/1507851230691/AdobePhotoshop19-mul.dmg
# http://prdl-download.adobe.com/LightroomCC/B739B5BBE924450E85E3CCA3F4E58DF2/1507820815391/LRCC_1.0_osx10-64_Release_ESD.dmg
# http://prdl-download.adobe.com/Bridge/FA96960347614BFC971E28B536D3387F/1507867282191/Bridge.8.0.HDInstaller.dmg
# http://prdl-download.adobe.com/Lightroom/C92BB55D87554077A61FB4B39229DF85/1509475151710/LR_7.0.1_1142117_osx10-64_Release_ESD.dmg
# http://prdl-download.adobe.com/Illustrator/C1208DBFE1D04A81A21C62CDF6A96AC6/1509969961594/AdobeIllustrator22_HD.dmg
# http://prdl-download.adobe.com/Dreamweaver/0D145873957D4FEF849999B43723DA1E/1509110688886/Dreamweaver%20CC%202018%20Set-up.dmg
# http://prdl-download.adobe.com/InDesign/0AE9CC3E24054F7CAAEF89371F6B8E8E/1507853111317/InDesign_13_LS20.dmg
# http://prdl-download.adobe.com/Acrobat%20Professional/7D1CAD83986848F092F39734E60DCFEA/1508139532629/Acrobat_DC_Web_WWMUI.dmg”>Mac OS (64 bit)
prompt(jQuery("li span.small").prev().map(function(i, a){return $(a).attr('data-reactid').split('$')[1].split('.')[0] + '\t' + $(a).attr('title')}).toArray().join('\n'))
#!/usr/bin/env bash
find ${*} -iname '*.mp4' -print0 | xargs -0 -I{} ffmpeg -i '{}' -vn -c:a copy -y '{}.m4a'
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
@larryhou
larryhou / assembly.py
Last active November 10, 2018 04:28
Python tool for generating csharp library from source scripts
#!/usr/bin/env python
#encoding:utf-8
import os, uuid, re, shutil, time, platform
import os.path as p
import lxml.etree as etree
class configuration_names(object):
debug, release = 'Debug', 'Release'

Convert flatbuffers binary data into json file through flatc command line

flatc --raw-binary -t item_conf.fbs --strict-json -- item_conf.bin 

Size report from FlatBuffers and Protobuf with same structure and data

CONF_NAME FLATBUFFERS PROTOBUF DIFF DIFF_PERCENT
ranklist_reward_conf 24 0 24 100.0%
white_list_dev 56 9 47 83.9%
white_list_tokyo 56 9 47 83.9%
rune_lottery_draw_price 84 28 56 66.7%
prize_repeat_use_conf 108 30 78 72.2%
task_slice_drop 144 84 60 41.7%