Skip to content

Instantly share code, notes, and snippets.

View peterng014's full-sized avatar

peterng014 peterng014

  • Da Nang, Viet Nam
View GitHub Profile
@peterng014
peterng014 / private_fork.md
Created December 27, 2023 14:41 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@peterng014
peterng014 / readme.md
Created August 11, 2021 03:08 — forked from bgromov/readme.md
Compiling Swift framework with mixed-in Objective-C code

Problem

You can't use bridging headers within a framework.

Solution 1 (umbrella header):

Xcode will automatically create umbrella header for you Cocoa Framework project. That will be the file named <FrameworkName>.h in the <FrameworkName> group/folder (where the rest of your sources are).

  1. To include the required Obj-C header you need to set it as Public: select it in the project explorer (left pane) and change the property Target Membership (left—Inspectors—pane) from Project to Public.
  2. Open umbrella header (<FrameworkName>.h) and import the required header as:
@peterng014
peterng014 / UIImageToDataTests.swift
Created October 1, 2019 07:00 — forked from benbahrenburg/UIImageToDataTests.swift
Swift Playground for testing memory associated with converting UIImage to Data
import UIKit
import ImageIO
import MobileCoreServices
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
func report_memory() -> UInt64 {
var taskInfo = mach_task_basic_info()
var count = mach_msg_type_number_t(MemoryLayout<mach_task_basic_info>.size)/4