Skip to content

Instantly share code, notes, and snippets.

View aelam's full-sized avatar
🎯
Focusing

Lun Wang aelam

🎯
Focusing
View GitHub Profile
@lucascorrea
lucascorrea / Fastfile
Last active June 13, 2021 20:13
Fastfile to use with SonarQube - Coverage | Swift 4.1
require 'fileutils'
default_platform(:ios)
platform :ios do
before_all do
if !File.exists? "../DerivedData"
Dir.mkdir "../DerivedData"
end
@mr-pinzhang
mr-pinzhang / Xcode 文件下载.md
Last active August 22, 2023 04:24
Xcode 文件下载

在 Xcode 里下载文件真的是一种折磨, 特别是每次 Xcode 大版本更新都会遇到新的下载内容. 经过一翻周折, 本人找到一个方法可以轻松快速便捷地下载和安装对应的 Simulator 和 Doc 文件

  1. 在 Mac 下, 打开 Xcode, 进入 Preference 中的 Downloads 面板
  2. 点击任意的下载按钮
  3. 打开系统帮助工具 Console
  4. 稍等一会儿, 在 Xcode 里取消下载, 然后你会在 Console 里面看到对应的下载地址 (对应的 Cosnole Message 是 (DVTDownloadable: Download Cancelled. Downloadable: ...) 之类的)
  5. 复制对应的链接地址, 到某雷或者任何比 Xcode 下载快的工具里
  6. 等待下载完成, 进入 /Users/#{Username}/Library/Caches
@pudquick
pudquick / recentServersSFL.py
Last active December 29, 2023 17:43
Working with SharedFileList (.sfl) files from OSX 10.11 El Capitan in python
from Foundation import NSKeyedUnarchiver
from struct import unpack
# This entire function is black magic of the highest order and I'll blog about it later
def extract_share(bookmark_data):
content_offset, = unpack('I', bookmark_data[12:16])
first_TOC, = unpack('I', bookmark_data[content_offset:content_offset+4])
first_TOC += content_offset
TOC_len, rec_type, level, next_TOC, record_count = unpack('IIIII', bookmark_data[first_TOC:first_TOC+20])
TOC_cursor = first_TOC + 20
@shotamatsuda
shotamatsuda / skia.sh
Created May 6, 2015 12:45
Build Skia as universal static libraries for OSX and iOS
readonly DEPOT_TOOLS_GIT='https://chromium.googlesource.com/chromium/tools/depot_tools.git'
readonly SKIA_GIT='https://skia.googlesource.com/skia.git'
readonly PROJECT_DIR="$(cd "$(dirname "$0")/../"; pwd)"
readonly BUILD_DIR="${PROJECT_DIR}/build"
readonly DEPOT_TOOLS_DIR="${BUILD_DIR}/depot_tools"
readonly SKIA_DIR="${BUILD_DIR}/skia"
download_depot_tools() {
echo 'Downloading depot tools...'
@mobyjames
mobyjames / MovingAverage.swift
Created January 31, 2015 04:08
Moving Average
class MovingAverage {
var samples: Array<Double>
var sampleCount = 0
var period = 5
init(period: Int = 5) {
self.period = period
samples = Array<Double>()
}
@Marlunes
Marlunes / hide_status_bar
Created July 16, 2013 07:54
FORCE HIDE STATUS BAR FOR IOS 7 AND 6
//viewDidload
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
@jhass
jhass / dump_socket.sh
Last active June 11, 2024 13:15
Capture unix socket to pcap file with socat and tshark
#!/bin/bash
# Parameters
socket="/run/foo.sock"
dump="/tmp/capture.pcap"
# Extract repetition
port=9876
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig"
@zrxq
zrxq / gist:5363610
Last active February 3, 2016 15:35
CGRect inset with UIEdgeInsets
inline static CGRect CGRectEdgeInset(CGRect rect, UIEdgeInsets insets) {
return CGRectMake(CGRectGetMinX(rect)+insets.left, CGRectGetMinY(rect)+insets.top, CGRectGetWidth(rect)-insets.left-insets.right, CGRectGetHeight(rect)-insets.top-insets.bottom);
}
@OliverLetterer
OliverLetterer / XCDUUID.m
Created January 26, 2013 17:05
With this gist, I, as a total assembly noob, am trying to understand the XCDUUID runtime hack (https://github.com/0xced/NSUUID/blob/1.0.1/NSUUID.m#L167-L221) to be able to use NSUUID on iOS < 6.0.
@implementation XCDUUID
+ (void) load
{
// query runtime if NSUUID class already exists, if so => done
if (objc_getClass("NSUUID"))
{
return;
}
@moklett
moklett / openconnect.md
Created July 24, 2012 15:21
OpenConnect VPN on Mac OS X

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect