This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Recursivelly removes all apps from your Xcode archives from the LaunchServices database, preventing them from being used for widgets, launch at login, etc. | |
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -R -f -u $HOME/Library/Developer/Xcode/Archives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import MobileCoreServices.UTCoreTypes | |
if #available(iOS 14.1, *) { | |
let input = Bundle.main.url(forResource: "IMG_0037", withExtension: "HEIC")! | |
let output = FileManager().temporaryDirectory.appendingPathComponent("IMG_0037.GAIN_MAP.BMP") | |
let source = CGImageSourceCreateWithURL(input as CFURL, nil)! | |
// urn:com:apple:photo:2020:aux:hdrgainmap | |
let dataInfo = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeHDRGainMap)! as Dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
extension Dictionary where Key == String, Value == Any { | |
public subscript(keyPath: JSON.Path.Index...) -> Value? { | |
get { self[keyPath: .init(path: keyPath)] } | |
set { self[keyPath: .init(path: keyPath)] = newValue } | |
} | |
public subscript(keyPath keyPath: JSON.Path) -> Value? { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import psutil | |
import multiprocessing as mp | |
from multiprocessing import Process | |
def f(thread, duty, freq, q): | |
p = psutil.Process() | |
p.cpu_affinity([thread]) | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdint> | |
// bit layout: | |
// +-1-+ | |
// 8 2 | |
// +-4-+ | |
bool matchHorizontal(uint8_t left, uint8_t right) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function base64url_encode($binary_data) { return strtr(rtrim(base64_encode($binary_data), '='), '+/', '-_'); } | |
function apns_jwt_token($team_id, $key_id, $private_key_pem_str) | |
{ | |
if (! function_exists('openssl_get_md_methods') || ! in_array('sha256', openssl_get_md_methods())) throw new Exception('Requires openssl with sha256 support'); | |
$private_key = openssl_pkey_get_private($private_key_pem_str); | |
if (! $private_key) throw new Exception('Cannot decode private key'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To use this, open console (developer tools), change the brigtness you want, paste it there and run | |
// 1 = 100% ... | |
twitchBrightness(1.2) | |
function twitchBrightness(amount) { | |
const video = document.querySelector('video') | |
video.style.filter = `brightness(${amount * 100}%)` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Douglas Hill, December 2018 | |
// Made for https://douglashill.co/reading-app/ | |
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit | |
import UIKit | |
/// A table view that allows navigation and selection using a hardware keyboard. | |
/// Only supports a single section. | |
class KeyboardTableView: UITableView { | |
// These properties may be set or overridden to provide discoverability titles for key commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace 104 bytes at $3204 with the following. | |
This stores the animated color palette for the letters, and the static color palette for the shimmer. | |
16 70 E0 01 1E 68 B0 01 1F 7C F0 01 0B 64 E0 01 | |
1D 50 60 01 1F 7C F0 01 0B 64 E0 01 1D 50 60 01 | |
1F 7C F0 01 0B 64 E0 01 1D 50 60 01 1F 7C F0 01 | |
0B 64 E0 01 1D 50 60 01 1F 7C F0 01 0B 64 E0 01 | |
1D 50 60 01 1F 7C F0 01 0B 64 E0 01 1D 50 60 01 | |
1F 7C F0 01 1F 7C F0 01 1F 7C F0 01 1F 7C F0 01 | |
1F 00 FF 7F F7 5E EF 3D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"bytes" | |
"fmt" | |
"image" | |
"image/jpeg" | |
_ "image/png" | |
"io" |
NewerOlder