Skip to content

Instantly share code, notes, and snippets.

View khcrysalis's full-sized avatar
☁️
Windy

khcrysalis

☁️
Windy
View GitHub Profile
@drumnkyle
drumnkyle / CropImageToCircle.swift
Last active November 29, 2023 10:42
Code to mask a square image to a circle
// UIImage+Utils.swift
// This is just one way to do this.
public func croppedToCircle() -> UIImage {
// Begin a new image that will be the new image with the rounded corners
UIGraphicsBeginImageContextWithOptions(size, false, scale)
let circleWidth = size.width
let radius = circleWidth / 2
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 14, 2025 23:59
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@zwaldowski
zwaldowski / DoneAccessoryView.swift
Created February 11, 2019 16:01
iOS Done Accessory Bar — The two versions below are mutually exclusive
import UIKit
class DoneAccessoryView: UIInputView {
private let toolbar = UIToolbar()
init() {
super.init(frame: .zero, inputViewStyle: .default)
translatesAutoresizingMaskIntoConstraints = false
allowsSelfSizing = true
@Amzd
Amzd / PreferenceUIHostingController.swift
Last active November 14, 2024 10:01
PreferenceUIHostingController. Adds hiding home indicator and deferring system edge gestures to SwiftUI. (Don't work at the same time but I think that's normal?)
extension View {
/// Controls the application's preferred home indicator auto-hiding when this view is shown.
func prefersHomeIndicatorAutoHidden(_ value: Bool) -> some View {
preference(key: PreferenceUIHostingController.PrefersHomeIndicatorAutoHiddenPreferenceKey.self, value: value)
}
/// Controls the application's preferred screen edges deferring system gestures when this view is shown. Default is UIRectEdgeNone.
func edgesDeferringSystemGestures(_ edge: UIRectEdge) -> some View {
preference(key: PreferenceUIHostingController.PreferredScreenEdgesDeferringSystemGesturesPreferenceKey.self, value: edge)
}
class FloatingPanel: NSPanel {
init(contentRect: NSRect, backing: NSWindow.BackingStoreType, defer flag: Bool) {
// Not sure if .titled does affect anything here. Kept it because I think it might help with accessibility but I did not test that.
super.init(contentRect: contentRect, styleMask: [.nonactivatingPanel, .resizable, .closable, .fullSizeContentView], backing: backing, defer: flag)
// Set this if you want the panel to remember its size/position
// self.setFrameAutosaveName("a unique name")
// Allow the pannel to be on top of almost all other windows
@rmorey
rmorey / gen.sh
Created August 17, 2021 19:58
List of Uniform Type Identifiers
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep uti: | cut -c 29- | sort | uniq > utis.txt
@osy
osy / JBX-0001.md
Created May 19, 2022 04:49
Secure jailbreak infrastructure

Secure jailbreak infrastructure

  • Proposal: JBX-0001
  • Authors: osy
  • Status: draft

Introduction

The ecosystem of iOS [jailbreaks][1] has remained largely unchanged since iOS 1.0 even though the system internals of iOS has undergone several evolutions, enhancing security and enabling new features. iOS jailbreaks traditionally involves neutering a significant portion of the OS's security in order to enable unsigned code execution ("apps") and system modifications ("tweaks"). This allows [malware][2] to target jailbroken users and for misbehaving apps to corrupt data.

@stephancasas
stephancasas / CustomMenuBarExtraCornerMask.swift
Last active April 28, 2025 12:59
A SwiftUI MenuBarExtra window with custom corners
//
// MenuBarTestApp.swift
// MenuBarTest
//
// Created by Stephan Casas on 7/7/23.
//
import SwiftUI
@main
@Saik0s
Saik0s / convert.sh
Last active March 15, 2025 09:40
This shell script converts a Google Chrome extension into a Safari web extension. It prints all available extensions, prompts the user for the chrome extension path and desired name, converts and builds safari extension for macOS, and opens the built app.
#!/bin/zsh
ext_root_path=~/Library/Application\ Support/Google/Chrome/Default/Extensions
find "$ext_root_path" -name "manifest.json" -print0 | while IFS= read -r -d '' file; do echo "\033[1;33m$file\033[0m"; echo "-----------------"; cat "$file" | nl -n ln | GREP_COLOR='01;30' grep --color=always '.*'; echo "-----------------"; done
# Prompt the user for the working directory path which is chrome extension root
read -p "Enter the chrome extension path(for example difoiogjjojoaoomphldepapgpbgkhkb/2.7.7_0): " workdir
# Prompt the user for the result app name
read -p "Enter the desired app name: " app_name
@0xdevalias
0xdevalias / reverse-engineering-macos.md
Last active July 14, 2025 22:20
Some notes, tools, and techniques for reverse engineering macOS binaries