Skip to content

Instantly share code, notes, and snippets.

View zqqf16's full-sized avatar
:electron:
Focusing

zqqf16 zqqf16

:electron:
Focusing
View GitHub Profile
{
"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 June 7, 2018 02:48
Mount iOS app sandbox
#!/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 June 18, 2023 05:36
Remove an object from a static library
#!/bin/sh
# Remove an object from a static library.
LIB_SRC=${1}
OBJ=${2}
if [ -z ${OBJ} ]; then
@zqqf16
zqqf16 / check_assets.sh
Created March 28, 2017 07:41
A "post action" script to check Assets.cer in iOS App
#!/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 January 22, 2017 08:54 — forked from sciolist/CorsProxy.swift
GCDWebServer Cors proxy
import GCDWebServer
class CorsProxy {
init(webserver : GCDWebServer!, urlPrefix: String) {
var prefix =
(urlPrefix.hasPrefix("/") ? "" : "/")
+ urlPrefix
+ (urlPrefix.hasSuffix("/") ? "" : "/")
let pattern = "^" + NSRegularExpression.escapedPatternForString(prefix) + ".*"
#!/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 November 24, 2016 05:26
Diff Podfile.lock
#!/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 August 4, 2016 07:26 — forked from neonichu/DynamicFunctions.swift
Using dlopen / dlsym to call C functions from 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 July 19, 2016 11:24
Create .icns & .iconset from .png
#!/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 00:53
List all objective-c classes in static libraries.
#!/bin/bash
find ./ -name "*.a" | xargs nm -gU | sed -n -e 's/.*_OBJC_CLASS_$_\(.*\)/\1/p'