Skip to content

Instantly share code, notes, and snippets.

View larryhou's full-sized avatar

larryhou larryhou

  • Tencent
  • Shenzhen, China
View GitHub Profile
#!/bin/bash
mkdir -pv stream
tshark -r 26.pcapng -T fields -e tcp.seq -e tcp.len -Y 'ip.src==14.215.85.23' | while read line
do
let num=num+1
seq=$(echo ${line} | awk '{print $1}')
len=$(echo ${line} | awk '{print $2}')
file="stream/${num}.bin"
tshark -r 26.pcapng -T fields -e data -2 -R "tcp.seq==${seq}" -w t.bin -Q
#!/bin/bash
palette="palette.png"
filters="fps=30,scale=320:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
@larryhou
larryhou / tinyproxy.md
Last active November 27, 2024 19:06
Install tinyproxy on macOS
  • brew install tinyproxy

  • Comment out Allow 127.0.0.1 in /usr/local/etc/tinyproxy.conf.

  • Start tinyproxy with tinyproxy -d.

  • Follow the log file with

    tail -f /usr/local/var/log/tinyproxy/tinyproxy.log
  • On the iOS device, in Wi-Fi settings, set HTTP Proxy to Manual and set

@larryhou
larryhou / arrange_photos.sh
Last active December 26, 2016 06:06
Group photo by year, and rename photo with continuous index automatically
#!/bin/bash
find . \( -iname '*?.*' -not -iname '*.sh' -not -iname '*.txt' \) -maxdepth 1 > new.txt
find . \( -iname '*?.*' -not -iname '*.sh' -not -iname '*.txt' \) -mindepth 2 > raw.txt
BASE_TIME=$(cat new.txt | xargs stat -f '%B' | sort -n | head -n 1 | awk '{print $1}')
if [ "${BASE_TIME}" = "" ]
then
echo "WARN:NO_PICTURES_FOR_PROCESS"
rm *.txt
@larryhou
larryhou / samplecode_dl.sh
Created January 6, 2017 06:29
Shell tool for downloading all apple latest sample codes automatically
#!/bin/bash
# set -x
JSON='library.json'
export HOME='https://developer.apple.com/library/content'
# curl -s -o ${JSON} ${HOME}/navigation/library.json
function dojob()
{
# echo "$3.date:${1} url:${2}"
location=${HOME}/$(echo ${2} | sed 's/..\///' | awk -F'/Introduction' '{print $1}')
@larryhou
larryhou / beyond_compare.md
Last active July 20, 2019 04:14
diff script for BeyondCompare in macOS system
  1. 在BeyondCompare里面配置转换脚本/usr/local/bin/bcadapter -s %s -t %t,并设置分隔符为^

/usr/local/bin/bcadapter

#!/usr/bin/env python
#encoding: utf-8
@larryhou
larryhou / mp3tags.py
Created September 19, 2017 12:27
Manipulate mp3 tags
#!/usr/bin/env python
#encoding:utf-8
from mutagen.mp3 import MP3
from mutagen.id3 import TIT2, TALB, TPE1
import os, re
def main():
import os.path as p
os.chdir(p.dirname(p.abspath(__file__)))
#include <android/log.h>
#include "utils/StringUtils.h"

#define CString(L) il2cpp::utils::StringUtils::Utf16ToUtf8(&(L->___start_char_1), L->___length_0).c_str()
#define debug(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, "larryhou", fmt, __VA_ARGS__)

debug("LOAD[%d] %s => %s", ___isAdditive1, (const char*)&L_29->___m_first_2, CString(V_9));
- (void)removePreferences
{
    NSArray* classCollection =  [NSArray arrayWithObjects:
                                 (__bridge id)kSecClassInternetPassword,
                                 (__bridge id)kSecClassGenericPassword,
                                 (__bridge id)kSecClassCertificate,
                                 (__bridge id)kSecClassKey,
                                 (__bridge id)kSecClassIdentity, nil];
    for (int n = 0; n < classCollection.count; n++)