Skip to content

Instantly share code, notes, and snippets.

View jeffersonsetiawan's full-sized avatar

Jefferson Setiawan jeffersonsetiawan

  • Jakarta, Indonesia
View GitHub Profile
@luckman212
luckman212 / airdropfix.sh
Created January 23, 2022 21:14
When Airdrop stops working, this might fix it without requiring a reboot...
#!/usr/bin/env bash
# requires blueutil: `brew install blueutil`
if ! sudo -v ; then
echo requires root
exit
fi
function dots() {
@cardoso
cardoso / CryptoKitE2EEPlayground.swift
Created April 4, 2020 02:47
CryptoKit End-to-end Encryption
import CryptoKit
import Foundation
var protocolSalt = "Hello, playground".data(using: .utf8)!
// generate key pairs
let sPrivateKey = Curve25519.KeyAgreement.PrivateKey()
let sPublicKey = sPrivateKey.publicKey
@hyuni
hyuni / wwdc.sh
Created July 18, 2018 13:31 — forked from idiomatic/wwdc.sh
Fetch WWDC videos, slides, and sample code.
#!/bin/bash
# usage: get [ RESOLUTION [ YEAR [ IDS... ] ] ]
resolution=${1:-SD}
year=${2:-2015}
shift
shift
ids=$*
RESOLUTION=$(echo $resolution | tr '[:lower:]' '[:upper:]')
@matux
matux / scntool.md
Last active April 11, 2023 13:49
SceneKit scntool command line options
$ xcrun scntool --verbose
| Current SceneKit version is 4.560000
| Running scntool (compiled on Jul  1 2018 01:01:55)

usage: scntool --convert file --format format [--output file]
000084a8:  7363 7269 7074 696f 6e00 2d2d 7461 7267 6574 2d70 6c61 7466  :scription.--target-platf
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active April 26, 2024 10:15
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse