Skip to content

Instantly share code, notes, and snippets.

View shiablue's full-sized avatar

Oliver Xia shiablue

  • M35
  • Shenzhen
View GitHub Profile
@shiablue
shiablue / keyevents.json
Created April 11, 2024 06:00 — forked from arjunv/keyevents.json
All Android Key Events for usage with adb shell
{
"key_events": {
"key_unknown": "adb shell input keyevent 0",
"key_soft_left": "adb shell input keyevent 1",
"key_soft_right": "adb shell input keyevent 2",
"key_home": "adb shell input keyevent 3",
"key_back": "adb shell input keyevent 4",
"key_call": "adb shell input keyevent 5",
"key_endcall": "adb shell input keyevent 6",
"key_0": "adb shell input keyevent 7",
@shiablue
shiablue / post_form_data.m
Created April 26, 2023 02:27 — forked from juwencheng/post_form_data.m
POST multipart/form-data with Objective-C| 同时上传多张图片和参数的方式 Objective-C/Swift
- (NSData *)createBodyWithBoundary:(NSString *)boundary
parameters:(NSDictionary *)parameters
paths:(NSArray *)paths
fieldName:(NSString *)fieldName {
NSMutableData *httpBody = [NSMutableData data];
// add params (all params are strings)
[parameters enumerateKeysAndObjectsUsingBlock:^(NSString *parameterKey, NSString *parameterValue, BOOL *stop) {
[httpBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
@shiablue
shiablue / mac-clear-icon-cache.sh
Created November 10, 2022 02:26 — forked from ismyrnow/mac-clear-icon-cache.sh
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@shiablue
shiablue / objc_api_visibility.pl
Created April 27, 2017 05:22 — forked from jk/objc_api_visibility.pl
iOS AppStore private API usage checker
#!/usr/bin/env perl
# objc_api_visibility.pl
# by Ryan Petrich, inspired by Dustin Howett's Logos
# Reads all Objective-C method names from an installed SDK, determines their visibility and optionally compares against an iOS app binary
sub read_methods {
my $cmd = shift;
my $when_found = shift;
my $current_class;
open(LS_CMD, "$cmd |") or die "Can't run '$cmd'\n$!\n";
/*
File: UIImage+ImageEffects.h
Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur.
Version: 1.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
Alfred 2 Workflows 推荐 http://24says.com/alfred-2-workflows-recommend/
http://www.alfredforum.com/topic/164-wi-fi-toggle-network-location-fast-user-switching-finder-settings/
http://www.alfredforum.com/topic/612-run-terminal-command-in-current-finder-directory/
https://github.com/franzheidl/alfred-workflows/blob/master/run-terminal-command-here/src/terminalcommandhere-newwin.applescript
https://github.com/nathangreenstein/alfred-process-killer/
http://lucifr.com/2013/03/20/air-quality-index-workflow-for-alfred-2/
http://dferg.us/

迁移文件,powertoys,system,config

顺序安装,恢复环境

终端

  • 首先安装 brew,中间可能会提示安装 Command line tool,必须先安装。命令
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"