Skip to content

Instantly share code, notes, and snippets.

View danieleggert's full-sized avatar

Daniel Eggert danieleggert

View GitHub Profile
@danieleggert
danieleggert / iOS_sysdiagnose.md
Created February 6, 2018 14:14
How to trigger a sysdiagnose on iOS

How To sysdiagnose on iOS:

  1. Hold volume up + volume down + power for 250 milliseconds.
  2. Wait (up to 5 minutes)
  3. Settings.app > Privacy > Analytics > Analytics Data
  4. Select the "sysdiagnose_" file and share via AirDrop to a Mac.
@danieleggert
danieleggert / GPG and git on macOS.md
Last active March 12, 2024 17:49
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys

Keybase proof

I hereby claim:

  • I am danieleggert on github.
  • I am danielboedewadt (https://keybase.io/danielboedewadt) on keybase.
  • I have a public key whose fingerprint is A529 F8B6 3037 F7F8 AA11 0849 FA00 7047 A6B1 67E1

To claim this, I am signing this object:

//
// main.c
// pausehandle
//
// Created by Daniel Eggert on 12/04/16.
//
// Run an HTTP server like so:
// % echo "Hello" > hello.txt
// % python -m SimpleHTTPServer
// The code expects to be able to get a text file at
import Foundation
/// A type-safe Key-Value-Observer (KVO).
///
/// Extend the class to be observed to implement `KeyCodable`, e.g.
/// ```
/// extension WKWebView: KeyCodable {
/// enum Key: String {
@danieleggert
danieleggert / NSData+hexadecimal.swift
Created August 30, 2015 12:09
Hexadecimal string from NSDate
import Foundation
extension NSData {
var hexadecimalString: String {
var result = ""
enumerateByteRangesUsingBlock { (pointer, range, _) in
let pointerToBytes = UnsafePointer<UInt8>(pointer)
let bytes = UnsafeBufferPointer(start: pointerToBytes, count: range.length)
for v in bytes {
result.appendContentsOf(String(format:"%02x", v))
@danieleggert
danieleggert / teardown.m
Created December 4, 2014 18:07
Tear Down for async code
@implementation Foo
{
BOOL _needsTearDown;
}
- (instancetype)init;
{
self = [super init];
if (self) {
_needsTearDown = YES;
@danieleggert
danieleggert / download-email.eml
Last active December 12, 2015 10:49
Multipart email
Delivered-To: daniel+test@helloclue.com
Received: by 10.220.201.70 with SMTP id ez6csp10837vcb;
Wed, 6 Feb 2013 02:50:28 -0800 (PST)
X-Received: by 10.101.40.2 with SMTP id s2mr9987477anj.88.1360147827848;
Wed, 06 Feb 2013 02:50:27 -0800 (PST)
Return-Path: <bounce-md_15131679.51123572.v1-2a00d47e46b0457fb24993692ada811c@mail263.us4.mandrillapp.com>
Received: from mail263.us4.mandrillapp.com (mail263.us4.mandrillapp.com. [205.201.137.7])
by mx.google.com with ESMTP id n67si25089644yhk.66.2013.02.06.02.50.27;
Wed, 06 Feb 2013 02:50:27 -0800 (PST)
Received-SPF: pass (google.com: domain of bounce-md_15131679.51123572.v1-2a00d47e46b0457fb24993692ada811c@mail263.us4.mandrillapp.com designates 205.201.137.7 as permitted sender) client-ip=205.201.137.7;