Skip to content

Instantly share code, notes, and snippets.

@steipete
steipete / UIWindow+PSPDFAdditions.h
Last active June 5, 2024 20:09
Mac Catalyst: Get the NSWindow from a UIWindow (Updated for macOS 11 Big Sur, also works with Catalina)
// Don't forget to prefix your category!
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIWindow (PSPDFAdditions)
#if TARGET_OS_UIKITFORMAC
@atomicbird
atomicbird / wwdc2019-online-sessions.md
Last active May 29, 2020 22:59
WWDC 2019 Online-only Sessions

At WWDC 2019 Apple released some videos directly online, with no corresponding live session. This is a list of those videos with links to the video pages.

Some sessions were presented during WWDC but then split into multiple videos when posted online. This list includes the online versions, since they don't appear in the WWDC schedule. For example WWDC included session 711, "Introducing Combine and Advances in Foundation". This was split into two online videos-- 722, "Introducing Combine", and 723, "Advances in Foundation". Both 722 and 723 are included here.

@luk6xff
luk6xff / ARMonQEMUforDebianUbuntu.md
Last active May 13, 2025 12:57 — forked from bruce30262/ARMDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

If there's no qemu-arm-static in the package list, install qemu-user-static instead

@gvolpe
gvolpe / di-in-fp.md
Last active September 16, 2024 07:18
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active December 3, 2024 21:48
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
#import <WebKit/WebKit.h>
#include "ui.h"
#include "ui_darwin.h"
#define uiWebViewSignature 0x57656276 // "Webv"
typedef struct uiWebView uiWebView;
#define uiWebView(this) ((uiWebView *) (this))
struct uiWebView {
@facepainter
facepainter / FaceGrab.py
Last active March 11, 2025 21:22
Batch extract known face from video/image sequence (CNN GPU with CUDA / HoG)
'''
Extract a known face from a video.
Uses a combination of a deep learning CNN model to batch detect faces
in video frames, or a sequence of images, in GPU with CUDA and HoG to compare
the detected faces with a computed reference set of face encodings.
'''
from os import path, listdir
from typing import NamedTuple
@nicklockwood
nicklockwood / UnicodeScalarView.swift
Last active May 30, 2021 13:12
UnicodeScalarView.swift
// This is a really simple drop-in replacement for String.UnicodeScalarView
// As of Swift 3.2, String.UnicodeScalarView no longer supports slice operations, and
// String.UnicodeScalarView.Subsequence is ~5x slower
//
// Only a small subset of methods are implemented, specifically the ones useful for
// implementing a parser or lexer that consumes a string by repeatedly calling popFirst()
//
// I've benchmarked popFirst() as ~7x faster than String.UnicodeScalarView.Subsequence in Swift 3.2 and 4.0
// The performance is close to that of String.UnicodeScalarView in Swift 3.1, but may be slightly worse in some use cases
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 26, 2025 14:47
Swift Concurrency Manifesto
#import <Foundation/Foundation.h>
@interface KKSimpleAirPlay2Player : NSObject
- (id)initWithURL:(NSURL *)inURL;
- (void)play;
- (void)pause;
@property (readonly, getter=isStopped) BOOL stopped;
@end