Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

上山打老虎 zqqf16

💭
I may be slow to respond.
View GitHub Profile
View models.json
{
"i386": "Simulator",
"x86_64": "Simulator",
"iPad1,1": "iPad",
"iPad2,1": "iPad 2",
"iPad2,2": "iPad 2",
"iPad2,3": "iPad 2",
"iPad2,4": "iPad 2",
"iPad3,1": "iPad (3rd generation)",
"iPad3,2": "iPad (3rd generation)",
@zqqf16
zqqf16 / sandbox.sh
Created Jun 7, 2018
Mount iOS app sandbox
View sandbox.sh
#!/bin/bash
TARGET="/Volumes/sandbox.app"
APP_ID="app.bundle.id"
if [ -d $TARGET ]; then
sudo umount $TARGET
fi
sudo mkdir $TARGET
@zqqf16
zqqf16 / rmobj.sh
Last active Feb 25, 2021
Remove an object from a static library
View rmobj.sh
#!/bin/sh
# Remove an object from a static library.
LIB_SRC=${1}
OBJ=${2}
if [ -z ${OBJ} ]; then
@zqqf16
zqqf16 / check_assets.sh
Created Mar 28, 2017
A "post action" script to check Assets.cer in iOS App
View check_assets.sh
#!/bin/bash
# Add this script to your Scheme->Build->Post Actions
ASSETS_PATH=${CODESIGNING_FOLDER_PATH}/Assets.car
xcrun --sdk ${PLATFORM_NAME} assetutil --info ${ASSETS_PATH} | grep -q "DisplayGamut.*P3"
if [ $? -eq 0 ]; then
osascript -e 'tell app "System Events" to display dialog "Some images are in Display P3 gamut, which is not supported in iOS 9.0~9.2"'
# xcrun --sdk ${PLATFORM_NAME} assetutil --info ${ASSETS_PATH} > /tmp/assets.json
@zqqf16
zqqf16 / CorsProxy.swift
Created Jan 22, 2017 — forked from sciolist/CorsProxy.swift
GCDWebServer Cors proxy
View CorsProxy.swift
import GCDWebServer
class CorsProxy {
init(webserver : GCDWebServer!, urlPrefix: String) {
var prefix =
(urlPrefix.hasPrefix("/") ? "" : "/")
+ urlPrefix
+ (urlPrefix.hasSuffix("/") ? "" : "/")
let pattern = "^" + NSRegularExpression.escapedPatternForString(prefix) + ".*"
View fuckxcode.sh
#!/bin/bash
DERIVED_DATA=~/Library/Developer/Xcode/DerivedData
# Kill Xcode
echo "💥 Killing Xcode ..."
kill $(ps aux | grep 'Xcode' | awk '{print $2}') 2>/dev/null
# Remove xcuserdata
for f in `ls -t $DERIVED_DATA`; do
@zqqf16
zqqf16 / poddiff.py
Last active Nov 24, 2016
Diff Podfile.lock
View poddiff.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import re
from distutils.version import LooseVersion
_POD_RE = re.compile(r'\s{1,1}- (.*) \((.*)\)')
def parse_lock_file(lock):
pods = {}
@zqqf16
zqqf16 / DynamicFunctions.swift
Created Aug 4, 2016 — forked from neonichu/DynamicFunctions.swift
Using dlopen / dlsym to call C functions from Swift
View DynamicFunctions.swift
import Darwin
let handle = dlopen("/usr/lib/libc.dylib", RTLD_NOW)
let sym = dlsym(handle, "random")
let functionPointer = UnsafeMutablePointer<() -> CLong>(sym)
let result = functionPointer.memory()
println(result)
@zqqf16
zqqf16 / icon.sh
Created Jul 19, 2016
Create .icns & .iconset from .png
View icon.sh
#!/bin/bash
# Usage: ./icon.sh icon.png
icon=$1
icon_name=${icon%.*}
icon_dir=${icon}.iconset
icon_tmp_path=/tmp/${icon_dir}
@zqqf16
zqqf16 / list_class.sh
Last active May 13, 2016
List all objective-c classes in static libraries.
View list_class.sh
#!/bin/bash
find ./ -name "*.a" | xargs nm -gU | sed -n -e 's/.*_OBJC_CLASS_$_\(.*\)/\1/p'