Skip to content

Instantly share code, notes, and snippets.

@krackers
krackers / CVPixelFormat Descriptions
Created November 6, 2023 07:17 — forked from gregcotten/CVPixelFormat Descriptions
All Public and Private CVPixelFormat Descriptions
View CVPixelFormat Descriptions
Structure is [PixelFormatTitle: DescriptionDictionary]. PixelFormatTitle is the kCVPixelFormatType_ suffix (if known) and the FourCharCode as a string or int if the string is too short.
[["32ARGB / 32": {
BitsPerBlock = 32;
BitsPerComponent = 8;
BlackBlock = <ff000000>;
CGBitmapContextCompatibility = 1;
CGBitmapInfo = 16388;
CGImageCompatibility = 1;
ContainsAlpha = 1;
@krackers
krackers / DefaultKeyBinding.dict
Created November 5, 2023 04:10 — forked from zsimic/DefaultKeyBinding.dict
OSX key bindings
View DefaultKeyBinding.dict
{
/* ~/Library/KeyBindings/DefaultKeyBinding.dict
See https://gist.github.com/zsimic/1367779, prefix cheatsheet:
Char Short Key
$ S- Shift ⇧
^ C- CTRL ⌃
~ O- Option ⌥ (⊞ Win key position on PC)
@ M- Command ⌘ (Alt position on PC)
# Numeric Keypad
@krackers
krackers / Makefile
Created September 19, 2023 04:51 — forked from kazupon/Makefile
semaphore multi process sample for Mac OSX
View Makefile
CC=gcc
all: multi-process-counter
build: multi-process-counter
multi-process-counter:
${CC} -std=c99 -o multi-process-counter multi-process-counter.c
#${CC} -std=c99 -arch x86_64 -o multi-process-counter multi-process-counter.c
@krackers
krackers / mach_semaphore.c
Created September 19, 2023 04:51 — forked from kazupon/mach_semaphore.c
Using mach_semaphore on Mac OS X to mutually signaling between two threads. This could be extended to work with different processes.
View mach_semaphore.c
//
// Created by Yogesh Swami on 2/24/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
//
// clang -Wall -Wextra -Wall -o mach_semaphore mach_semaphore.c
//
// using mach semaphore for mutually signalling between two threads.
@krackers
krackers / gist:2b85ef0d6fab32ab0aaac1bd3aa38907
Created September 3, 2023 09:10 — forked from andrewsardone/gist:3751168
How does UIKit get pixels onto the screen?
View gist:2b85ef0d6fab32ab0aaac1bd3aa38907

UIView Drawing Model

-[UIView setNeedsDisplay]

You have some kind of custom UIView which implements some awesome drawing in -[UIView drawRect:]. In order to have UIKit draw it for you, you send the -[UIView setNeedsDisplay] to the view object to queue it up for drawing.

-[CALayer setNeedsDisplay]

     *------------*           *------------*

| | | |

@krackers
krackers / python_stream.md
Created August 25, 2023 09:22 — forked from hzhu212/python_stream.md
Python iterator with chain-call like Java stream
View python_stream.md

Python Stream object act like Java Stream, features include lazy calculating, slicing, chain-call etc.

stream.py:

import functools
import itertools


class Stream(object):
@krackers
krackers / LegacyDocsets.md
Created August 23, 2023 22:10 — forked from fzwo/LegacyDocsets.md
Download and view old Apple developer documentation
View LegacyDocsets.md

How to download and view legacy documentation from Apple (no need to sign in to your dev account)

  1. Download the docset index XML.
  2. Find the docset you want (there are some with URL https://apple.com/none.dmg; ignore them - you will find them again further down the file with a working URL).
  3. Download the dmg. It's probably around a gigabyte or so.
  4. "Install" the .pkg file somewhere on your disk. If you don't trust the installer, do it manually:
    1. Find the largest file, named Payload, and extract it using The Unarchiver.
    2. This creates a new, even larger file, probably named Payload-1.
    3. Extract Payload-1 using The Unarchiver.
  5. After many minutes of extracting, we have our .docset file.
@krackers
krackers / swizzler.h
Last active August 20, 2023 00:19 — forked from saagarjha/swizzler.h
Type-safe, RAII swizzler for Objective-C++
View swizzler.h
// https://twitter.com/_saagarjha/status/1692839886053625917#m
#import <Foundation/Foundation.h>
#import <atomic>
#import <memory>
#import <objc/runtime.h>
#include <objc/message.h>
#import <stdexcept>
#import <iostream>
@krackers
krackers / README.md
Created June 12, 2023 02:57 — forked from Mnkai/README.md
TDP and turbo parameter modification with MSR on non-overclockable Intel CPU (such as Intel i7-8550U)
View README.md

TDP and turbo parameter modification with MSR on non-overclockable CPU

Disclaimer

  • MSR modification may void your CPU's (or system board's) warranty. Proceed with care. I'm not responsible for any destruction caused by this article.
  • MSR address (greatly) differs from CPU to CPU. Check your own CPU's MSR address using Intel's documentation.
  • Only tested on Intel i7-8550U (Kaby Lake R).
  • This article is translation of this article. If you can understand Korean, I recommend reading that article, not this.

Start

View Wayback Machine SPN2 API Docs
From https://docs.google.com/document/d/1Nsv52MvSjbLb2PCpHlat0gkzw0EvtSgpKHu4mk0MnrA/
Save Page Now 2 Public API Docs Draft
Vangelis Banos, updated: 2022-04-05
Capture a web page as it appears now for use as a trusted citation in the future. Changelog: https://docs.google.com/document/d/19RJsRncGUw2qHqGGg9lqYZYf7KKXMDL1Mro5o1Qw6QI/edit#
Contents
Glossary 1
Basic API Reference 1
Capture request 1