Skip to content

Instantly share code, notes, and snippets.

View SamusAranX's full-sized avatar

SamusAranX

  • Germany
  • 23:12 (UTC +02:00)
View GitHub Profile
@zats
zats / ContentView.swift
Last active May 12, 2025 09:14
Internal SF Symbols
struct ContentView: View {
var body: some View {
let names = [
["appstore.app.dashed", "buildings.3d", "emoji.chicken.face"],
["person.text.rectangle.and.nfc", "secure.element", "laugh.bubble.tapback.2.he"],
["apple.news", "apple.podcasts.square.stack", "apple.slice"],
]
VStack(spacing: 20) {
Grid(horizontalSpacing: 20, verticalSpacing: 20) {
ForEach(names, id: \.self) { nameRow in
@insidegui
insidegui / lsremovearchives.sh
Created December 21, 2021 18:28
Remove Xcode app archives from macOS LaunchServices database
#!/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
@kiding
kiding / HDRGainMap.swift
Last active May 13, 2025 03:30
Extracting HDR Gain Map from iOS 14.1+ (iPhone 12+) photos
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
@ollieatkinson
ollieatkinson / Dictionary+KeyPath.swift
Last active January 7, 2024 03:30
KeyPath to get/set from a Swift JSON object ([String: Any] or [Any])
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? {
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:
#include <cstdio>
#include <cstdint>
// bit layout:
// +-1-+
// 8 2
// +-4-+
bool matchHorizontal(uint8_t left, uint8_t right)
{
@marcoarment
marcoarment / apns_jwt_token.php
Last active January 8, 2025 14:19
Generate ES256 JWT tokens for Apple Push Notification Service (APNS) in PHP
<?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');
@ecnepsnai
ecnepsnai / update_go.sh
Last active May 2, 2025 06:32
Script to manage go versions easily
#!/bin/bash
set -e
VERSION=$(curl -sS "https://go.dev/dl/?mode=json" | jq -r '.[0].version' | sed 's/go//')
INSTALL_DIR="/usr/local/go"
if [[ ! -d ${INSTALL_DIR} ]]; then
echo "Install directory '${INSTALL_DIR}' does not exist, sudo required to create it..."
sudo mkdir -p ${INSTALL_DIR}
fi
@schovi
schovi / brightness.js
Last active September 24, 2024 11:33
Small scripts to boost twitch volume beyond 100% or change brightness of video
// 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}%)`
}
@douglashill
douglashill / KeyboardTableView.swift
Last active March 30, 2023 22:01
A UITableView that allows navigation and selection using a hardware keyboard.
// 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.