Skip to content

Instantly share code, notes, and snippets.

@landfound
landfound / clean_imageset.sh
Created September 24, 2015 08:56
删除imageset中的没有图片的文件夹
DIRECTORY="$(pwd)"
for imageset in $(find "$DIRECTORY" -type d | grep imageset); do
imagesetFiles=$(ls "$imageset")
[[ "$imagesetFiles" =~ ^\s*(Contents\.json|\s*)$ ]] && mv $imageset ~/Desktop/Removed
done
@landfound
landfound / PSPDFUIKitMainThreadGuard.m
Last active September 15, 2015 11:50 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@landfound
landfound / install_charles_CA
Created November 19, 2014 09:57
install_charles_CA
#/bin/bash
install() {
if [ -f "$SQLITEDBPATH" ]; then
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup"
sqlite3 "$SQLITEDBPATH" <<EOF
INSERT INTO "tsettings" VALUES(X'189B6E28D1635F3A8325E1E002180DBA2C02C241',X'3123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E6731243022060355040B0C1B687474703A2F2F636861726C657370726F78792E636F6D2F73736C3111300F060355040A0C08584B3732204C74643111300F06035504070C084175636B6C616E643111300F06035504080C084175636B6C616E64310B3009060355040613024E5A',X'3C3F786D6C2076657273696F6E3D22312E302220656E636F64696E673D225554462D38223F3E0A3C21444F435459504520706C697374205055424C494320222D2F2F4170706C652F2F44544420504C49535420312E302F2F454E222022687474703A2F2F7777772E6170706C652E636F6D2F445444732F50726F70657274794C6973742D312E302E647464223E0A3C706C6973742076657273696F6E3D22312E30223E0A3C61727261792F3E0A3C2F706C6973743E0A',X'3082045E30820346A003020102020101300D06092A864886F70D01010505003081913123302106035504030C1A436861726C65732050726F78792053534C2050726F7879696E67312430
@landfound
landfound / uninstall_charles_CA
Created November 19, 2014 09:47
uninstall charles core simulator CA
uninstall() {
if [ -f "$SQLITEDBPATH.charlesbackup" ]; then
echo "$SQLITEDBPATH.charlesbackup"
mv -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup.uninstall"
mv -n "$SQLITEDBPATH.charlesbackup" "$SQLITEDBPATH"
fi
}
for SQLITEDBPATH in $(find ~/Library -name TrustStore.sqlite3); do
uninstall
@landfound
landfound / download_wwdc2014
Created June 15, 2014 02:41
download wwdc2014
brew install axel
curl https://developer.apple.com/videos/wwdc/2014/ | grep -ioI 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g'| xargs -n1 axel -a -n 8
curl https://developer.apple.com/videos/wwdc/2014/ | grep -ioI 'http.*pdf?dl=1' | sed 's/\?dl=1//g' | xargs -n1 axel -a -n 4
@landfound
landfound / apt-get_add_source
Created June 11, 2014 14:07
ubuntu add apt-get source by add-apt-repository
apt-get install python-software-properties
add-apt-repository ${source}
@landfound
landfound / build_binutils
Created June 10, 2014 15:39
build binutils on linux for macho
./configure --target=x86_64-apple-darwin
@landfound
landfound / install_atosl
Created June 9, 2014 06:44
install atosl
sudo apt-get install libdwarf-dev binutils-dev
git clone [email protected]:facebook/atosl.git
cd atosl
make
@landfound
landfound / delete_file_infile
Created June 8, 2014 04:49
delete file listed in a file
while read file ; do rm "$file" ; done < delete.list