Skip to content

Instantly share code, notes, and snippets.

View networkextension's full-sized avatar

abigt networkextension

  • Star
View GitHub Profile
@networkextension
networkextension / FreeBSD_Boot_RPI3
Created March 31, 2016 10:00
FreeBSD Boot RPI3
cpu_resetConsoles: pl011 console
FreeBSD Raspberry Pi 3 loader
Booting kernel at 0x200000, size 9714192
DTB: 0xc35000 0xffffff8000a35000
entry: 0x201000 9400003d ffffff8000a38000
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
@networkextension
networkextension / AES_CFB_Nopadding
Created May 21, 2016 18:12
AES/CFB/Nopadding Objective-C
+(NSData*) encryptData: (NSData*) data withKey: (NSData*) key
{
//Key to Data
// NSData *key = [keyString dataUsingEncoding:NSUTF8StringEncoding];
//String to encrypt to Data
//NSData *data = [stringToEncrypt dataUsingEncoding:NSUTF8StringEncoding];
// Init cryptor
CCCryptorRef cryptor = NULL;
@networkextension
networkextension / evpBytesToKey.swift
Last active July 11, 2016 14:02
evpBytesToKey equal openssl EVP_BytesToKey func
func evpBytesToKey(password:String, keyLen:Int) ->NSData {
let md5Len:Int = 16
let cnt = 1// (keyLen -1)/md5Len + 1
let m = NSMutableData.init(length: cnt*md5Len)!
let bytes = password.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
// memcpy((m?.mutableBytes)!, bytes.bytes , password.characters.count)
let md5 = bytes.md5
m.setData(md5)
@networkextension
networkextension / crash.log
Created July 21, 2016 06:44
Xcode 7.3.1 crash When debug A.BIG.T
Process: Xcode [8401]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 7.3.1 (10188.1)
Build Info: IDEFrameworks-10188001000000000~3
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [8401]
User ID: 502
@networkextension
networkextension / GRDB_stack
Created July 26, 2016 15:46
GRDB crash on A.BIT.T
(lldb) bt
* thread #10: tid = 0x55be3, 0x00000001838a232c libsqlite3.dylib`___lldb_unnamed_function119$$libsqlite3.dylib + 52, queue = 'GRDB.SerializedDatabase', activity = 'NEVirtualInterface processing read event', stop reason = EXC_BAD_ACCESS (code=1, address=0xe90)
frame #0: 0x00000001838a232c libsqlite3.dylib`___lldb_unnamed_function119$$libsqlite3.dylib + 52
frame #1: 0x000000018389a474 libsqlite3.dylib`___lldb_unnamed_function114$$libsqlite3.dylib + 23540
frame #2: 0x00000001838938e0 libsqlite3.dylib`sqlite3_step + 504
frame #3: 0x0000000100547638 GRDB`UpdateStatement.execute(arguments=nil, self=0x000000015ce5b2a0, $error=ErrorType @ 0x000000016e500e68) throws -> () + 460 at Statement.swift:378
* frame #4: 0x00000001004f0ae8 GRDB`Database.(codeUnits=(_position = 0x000000015ce5b1b0, _end = 0x000000015ce5b294), sqlCodeUnits=<unavailable>, observer=0x000000015ce38920, self=0x000000015ce0c900, error=nil, sql="INSERT INTO requests (mode, url, app,start,status,closereason,reqHeader,respHead
@networkextension
networkextension / zombie_swift
Created August 8, 2016 09:16
zombie_swift_crash_rep
* thread #23: tid = 0x8e5ba, 0x000000019241a014 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.yarshure.dispatchqueue', stop reason = signal SIGABRT
frame #0: 0x000000019241a014 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x00000001924e1470 libsystem_pthread.dylib`pthread_kill + 112
frame #2: 0x000000019238e490 libsystem_c.dylib`abort + 140
frame #3: 0x000000019245a718 libsystem_malloc.dylib`szone_error + 420
frame #4: 0x0000000192464740 libsystem_malloc.dylib`free_list_checksum_botch.294 + 36
frame #5: 0x0000000192451644 libsystem_malloc.dylib`tiny_free_list_remove_ptr + 300
frame #6: 0x0000000192464a0c libsystem_malloc.dylib`tiny_free_no_lock + 708
frame #7: 0x000000019246516c libsystem_malloc.dylib`free_tiny + 624
frame #8: 0x0000000193e3e06c Foundation`-[NSConcreteMutableData dealloc] + 64
@networkextension
networkextension / chunked.swift
Created August 11, 2016 03:26
http Transfer-Encodeing parser Swift sample
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
let a = "25\r\nThis is the data in the first chunk\r\n" + "1C\r\nand this is the second one\r\n" + "3\r\ncon" + "8\r\nsequence" + "0\r\n\r\n"
let d = a.data(using: .utf8, allowLossyConversion: false)
struct chunked{
var len:Int = 0
@networkextension
networkextension / surf.conf
Last active January 4, 2017 06:44
surf.conf
# A.BIG.T rule config
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: error,warning, notify, info, verbose (默认值: info)
loglevel = info
# 跳过某个域名或者 IP 段,这些目标主机将不会由 A.BIG.T 处理。
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
# 强制使用特定的 DNS 服务器
@networkextension
networkextension / Triangle.swift
Created October 18, 2016 06:55
Pascal's Triangle
func angelx(n:Int) ->[[Int]] {
var a = [[Int]]()
for i in 0 ..< n {
//a[i][0] = 1
var b :[Int] = []
b.append(1)
var bP:[Int]?
if i != 0 {
bP = a[i-1]
}
@networkextension
networkextension / Swift3_memory_pressureEvent.swift
Last active June 11, 2018 15:19
demo Swift3 memory pressureEvent use DispatchSource API
import Foundation
class A {
var d:[Int]?
init(len:Int) {
d = Array(repeating: 0, count: len)
}
}
func test() {