Skip to content

Instantly share code, notes, and snippets.

Avatar

Zhang Naville

View GitHub Profile
@Naville
Naville / .swift-build-presets
Last active Sep 28, 2018
Swift Toolchain Preset that I uses
View .swift-build-presets
[preset: HikariSwift]
ios
tvos
watchos
lldb
llbuild
swiftpm
playgroundsupport
@Naville
Naville / README.md
Last active Jan 5, 2018
Compile OpenCV3 with opencv_contribution&&Python2&&Python3 Support
View README.md

This is constructed with multiple tutorials online as well as opencv's issues

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/Development/opencv_contrib/modules -DPYTHON2_EXECUTABLE=$(which python2) -DPYTHON2_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")  -DPYTHON2_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -DPYTHON2_PACKAGES_PATH=$(python -c "import site; print(site.getsitepackages()[-1])")  -DPYTHON3_EXECUTABLE=$(which python3)  -DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")  -DPYTHON3_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -DPYTHON3_PACKAGES_PATH=$(python3 -c "import site; print(site.getsitepackages()[-1])") -DBUILD_opencv_python2=on -DBUILD_opencv_python3=on -DPYTHON_LIBRARY=$(python3 -c "import dist
View gist:f1d8ea43ffde61f57497492d599b32fb

Assume LLVM Source tree is located at ../LLVM
The -DLLVM_CREATE_XCODE_TOOLCHAIN=on is only useful for macOS users that requires an Xcode Toolchain to use within Xcode. This enables an extra target called install-xcode-toolchain.
Add -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ installs the Toolchain for the current user.
To install the toolchain globally, replace with -DCMAKE_INSTALL_PREFIX=/Library/Developer/ and invoke sudo ninja install-xcode-toolchain

LLVM Development:

cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DLLVM_APPEND_VC_REV=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM

Daily Usage

View BreakOnMethod.py
'''
Break on Objective-C 's method using its address'
'''
import shlex
import lldb
import re
def breakonmethod(debugger, command, exe_ctx,result, internal_dict):
args=shlex.split(command)
Class=args[0]
Method=args[1]
View gist:da45507fb90fdf9340665718b95ab921
垃圾平台。自己申请的不用了要的拿去
App Key:1999547747
App Secret:0bdb539e0d38ced514d207bf23e081e4
CallBack URL: http://navillezhang.me
View FixATS.py
import plistlib
import os
PATH=os.path.dirname(os.path.abspath(__file__))+"/Info.plist"
x=plistlib.readPlist(PATH)
x['NSAppTransportSecurity']=dict()
x['NSAppTransportSecurity']['NSAllowsArbitraryLoads']=True
plistlib.writePlist(x,PATH)
@Naville
Naville / iTunesVerify.py
Created Dec 5, 2016
Verify if all songs in the iTunes Library actually exists on disk
View iTunesVerify.py
#Tool to valid all songs in iTunes Library
import plistlib
import urllib
import os
import json
import sys
from os.path import expanduser
iTunesTracks=plistlib.readPlist(expanduser("~")+"/Music/iTunes/iTunes Music Library.xml")["Tracks"]
InvalidItemList=list()
View keybase.md

Keybase proof

I hereby claim:

  • I am Naville on github.
  • I am navillezhang (https://keybase.io/navillezhang) on keybase.
  • I have a public key whose fingerprint is 2DD3 AF5E F257 5771 65BD 3F09 BCDB 9630 EAB4 7648

To claim this, I am signing this object:

You can’t perform that action at this time.