Skip to content

Instantly share code, notes, and snippets.

@migueldeicaza
migueldeicaza / godot-mixed-coretext-hacks.patch
Last active August 19, 2025 14:28
Ugly and contains two unrelated things, a CoreText backend (which I broke) and using CoreText-fonts to render fonts in the regular codepath.
diff --git a/editor/project_manager/project_manager.cpp b/editor/project_manager/project_manager.cpp
index 507931c744..ac2539a3ba 100644
--- a/editor/project_manager/project_manager.cpp
+++ b/editor/project_manager/project_manager.cpp
@@ -1498,7 +1498,7 @@ ProjectManager::ProjectManager() {
filter_option->connect(SceneStringName(item_selected), callable_mp(this, &ProjectManager::_on_order_option_changed));
hb->add_child(filter_option);
- filter_option->add_item(TTRC("Last Edited"));
+ filter_option->add_item(TTRC("😀Last Edited"));
@migueldeicaza
migueldeicaza / godot-coretext.patch
Last active August 16, 2025 16:39
Patch to use CoreText in Godot instead of OpenType.
diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub
index 1167fbc187..fb90e8689d 100644
--- a/modules/text_server_adv/SCsub
+++ b/modules/text_server_adv/SCsub
@@ -12,8 +12,13 @@ env_text_server_adv = env_modules.Clone()
thirdparty_obj = []
freetype_enabled = "freetype" in env.module_list
+coretext_enabled = env.get("coretext", False) and env["platform"] == "macos"
msdfgen_enabled = "msdfgen" in env.module_list
@migueldeicaza
migueldeicaza / gist:adb5a3ccabab75a14381d02b25d6942e
Created May 19, 2022 20:39
Dumps passwords from the iOS keychain
func dump () {
let k = kSecClassGenericPassword
let query: [String: Any] = [
kSecClass as String: k,
kSecMatchLimit as String: kSecMatchLimitAll,
kSecReturnRef as String: true,
kSecReturnAttributes as String: true
]
var itemCopy: AnyObject?
let status = SecItemCopyMatching(query as CFDictionary, &itemCopy)
@migueldeicaza
migueldeicaza / gist:7b383f9481e95fab8b5d16943eccf545
Created April 21, 2022 21:39
Alternative to semaphore locking around a task
init () {
//let _ = LinuxTop (source: try! String (contentsOfFile: "/Users/miguel/cvs/CpuStatus/pi-top-output"))
//let _ = MacTop (source: try! String (contentsOfFile: "/Users/miguel/cvs/CpuStatus/mac-top-output"))
Task {
print ("await/Starting")
let x: Bool = await withCheckedContinuation { cc in
Task {
print ("await/Sleeping")
@migueldeicaza
migueldeicaza / MyTextLabel.swift
Created January 26, 2021 03:47 — forked from CrystDragon/MyTextLabel.swift
Most basic custom UITextInput conformance, without selection interaction, no UI elements but only pure texts.
import UIKit
class MyTextLabel: UIView {
var textLayer = CATextLayer()
var textStorage: String = "" {
didSet {
textLayer.string = textStorage
}
}
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/miguel/cvs/SwiftSH/SwiftSH/SSHLibrary.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Queue.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Session.swift /Users/miguel/cvs/SwiftSH/SwiftSH/ConsoleLogger.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Error.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Extensions.swift /Users/miguel/cvs/SwiftSH/SwiftSH/SFTP.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Logger.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Libssh2.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Shell.swift /Users/miguel/cvs/SwiftSH/SwiftSH/SCP.swift /Users/miguel/cvs/SwiftSH/SwiftSH/DNS.swift -primary-file /Users/miguel/cvs/SwiftSH/SwiftSH/Channel.swift /Users/miguel/cvs/SwiftSH/SwiftSH/Command.swift -emit-module-path /Users/miguel/DerivedData/SwiftSH-cyqzhumcvedcnhajuftnadmnmmiy/Build/Intermediates.noindex/SwiftSH.build/Debug-iphonesimulator/SwiftSH.build/Objects-normal/x86_64/Channel\~partial.swiftmodule -emit-module-doc-pa

I have a problem with a native library dependency in my project SwiftTerm, the native library dependency is a wrapper for libssh, and I compile this as a .framework which I then reference from SwiftTerm.

The problem is that on the same system where I build the .framework, something makes the build system go poking at the original site where the code was built, and produces this error:

/Users/miguel/cvs/SwiftTerm/SwiftSH.binaries/module.modulemap:1:8: error: redefinition of module 'Libssh2'
module Libssh2 {
 ^
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
* frame #0: 0x00000001008e32ac mlir-translate`llvm::FunctionType::getReturnType(this=0x0000000000000000) const at DerivedTypes.h:129:40
frame #1: 0x00000001008e3135 mlir-translate`llvm::CallInst::CallInst(this=0x000000010741a020, Ty=0x0000000000000000, Func=0x0000000000000000, Args=ArrayRef<llvm::Value *> @ 0x00007ffeefbf9c58, Bundles=ArrayRef<llvm::OperandBundleDefT<llvm::Value *> > @ 0x00007ffeefbf9c80, NameStr=0x00007ffeefbf9e10, InsertBefore=0x0000000000000000) at Instructions.h:1632:20
frame #2: 0x00000001008e3040 mlir-translate`llvm::CallInst::CallInst(this=0x000000010741a020, Ty=0x0000000000000000, Func=0x0000000000000000, Args=ArrayRef<llvm::Value *> @ 0x00007ffeefbf9cd0, Bundles=ArrayRef<llvm::OperandBundleDefT<llvm::Value *> > @ 0x00007ffeefbf9cf0, NameStr=0x00007ffeefbf9e10, InsertBefore=0x0000000000000000) at Instructions.h:1636:30
frame #3: 0x00000001008e2d82 mlir-translate`llvm::CallIn
$next = 0;
while (<>){
if (/DllImport/){
$import = $_;
$next = 1;
} elsif ($next){
($prefix, $func, $args) = $_ =~ /(.*) (TF_[A-Za-z0-9]*) (\(.*)/;
#print "Got [$prefix][$func][$args] - $_\n";
$res = $import;
$res =~ s/Library/Library, EntryPoint="$func"/;
@migueldeicaza
migueldeicaza / gist:624675f0edc9f5dd1a908bf547445987
Created April 2, 2018 15:56
Public type surface for System.Runtime.Extensions.dll
Assembly Information:
Culture=neutral
PublicKeyToken=b03f5f7f11d50a3a
System.AppDomain
System.AppDomainUnloadedException
System.ApplicationId
System.AssemblyLoadEventArgs