Skip to content

Instantly share code, notes, and snippets.

View eneko's full-sized avatar
💻

Eneko Alonso eneko

💻
View GitHub Profile
@eneko
eneko / list-of-curl-options.txt
Last active April 16, 2024 17:12
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@eneko
eneko / swiftui_public_interface.swift
Created November 10, 2023 16:35
SwiftUI public interface - Xcode 15.0 15A240d
This file has been truncated, but you can view the full file.
import Accessibility
import AppKit
import Combine
import CoreData
import CoreFoundation
import CoreGraphics
import CoreText
import CoreTransferable
import Darwin
@eneko
eneko / dealloc-breakpoint.md
Last active January 3, 2024 02:24
Xcode UIViewController dealloc breakpoint

Xcode deinit breakpoint for UIViewController

This breakpoint provides an easy way to track view controller deinitialization (deallocation) in UIKit-based applications. This can help finding memory leaks caused by retain cycles preventing view controllers from being deinitialized when dismissed or popped.

From Cédric Luthi's tweet in 2017:

Useful Xcode breakpoint. When you dismiss a controller and you don’t hear the pop sound (or see the log), you probably have a retain cycle.

@eneko
eneko / git-purge
Last active June 28, 2023 03:48
`git purge` command to delete local branches that have been deleted on remote
#!/usr/bin/env sh
set -e
echo "Pulling latest code..."
git pull
echo "Deleting local branches that were removed in remote..."
git fetch -p
git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
echo "Remaining local branches:"
git branch -vv
@eneko
eneko / create_dmg.sh
Last active March 12, 2023 15:51
Create DMG image from folder
#
# <filename>.dmg can be a path to a file on an existing folder
# <window title> appears when the DMG is open
# <file system> APFS, HFS+, etc
# UDRW format makes the image read/write (use UDSP for read-only)
#
hdiutil create <filename>.dmg -volname "<window title>" -fs APFS -format UDRW -srcfolder <path/to/folder>
@eneko
eneko / main.swift
Created October 26, 2022 15:13
Swift 5.7 compiler hang
public indirect enum Expression {
case term(Bool)
case list(_ expressions: [Expression])
public func contains(where predicate: (Bool) -> Bool) -> Bool {
switch self {
case let .term(term):
return predicate(term)
case let .list(expressions):
return expressions.contains { expression in
@eneko
eneko / LRUCacheActor.swift
Last active October 7, 2022 11:54
Thread-safe, ordered-dictionary-backed, actor-based LRU cache
//
// LRUCacheActor.swift
// LRUCacheActor
//
// Created by Eneko Alonso on 9/5/21.
//
import Foundation
import OrderedCollections
@eneko
eneko / words.spanish.json
Created January 8, 2022 17:30
List of Spanish words from wspanish 1.0.29 source package in Ubuntu Raw (JSON array)
This file has been truncated, but you can view the full file.
[
"a",
"aarónica",
"aarónico",
"ab",
"abab",
"ababillarse",
"ababol",
"abacá",
@eneko
eneko / words.spanish.utf8
Created January 8, 2022 17:07
List of Spanish words from wspanish 1.0.29 source package in Ubuntu
a
aarónica
aarónico
ab
abab
ababillarse
ababol
abacá
abacera
abacería
@eneko
eneko / wordle2.json
Created January 7, 2022 22:15
List of World words (second collection) sorted alphabetically
[
"aahed",
"aalii",
"aargh",
"aarti",
"abaca",
"abaci",
"abacs",
"abaft",
"abaka",