Skip to content

Instantly share code, notes, and snippets.

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

zqqf16 zqqf16

:electron:
Focusing
View GitHub Profile
@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 / IKEv2.mobileconfig
Last active February 28, 2023 22:57
strongSwan IKEv2 configurations for iOS without certificate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>IKEv2</key>
<dict>
<key>AuthName</key>
@zqqf16
zqqf16 / t.py
Last active November 29, 2022 02:23
A command line translation tool.
#!/usr/bin/env python3
import sys
import uuid
import time
import hashlib
import requests
YOUDAO_URL = 'https://openapi.youdao.com/api'
APP_KEY = '4eb54b2bc1173f2b'
@zqqf16
zqqf16 / IPSecDemo.m
Last active May 29, 2020 08:11
Start IPSec programmatically in iOS 8
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
{
"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 / 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 / get_scheme.sh
Last active November 5, 2018 10:35
Get the URL scheme from ipa file
#!/bin/bash
ipa_name=$1
plist_path=$(unzip -l "$ipa_name" | grep "Payload/[^/]*\/Info.plist" | sed 's/.*\(Payload.*Info.plist\)/\1/g')
#unzip
unzip -jo "$ipa_name" "$plist_path" >/dev/null
#convert to xml1 format
plutil -convert xml1 Info.plist
@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) + ".*"
@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
#!/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