Skip to content

Instantly share code, notes, and snippets.

View T1T4N's full-sized avatar
👽

Robert Armenski T1T4N

👽
View GitHub Profile
@T1T4N
T1T4N / clang-format-for-xcode-12.md
Created July 12, 2022 14:43
Getting clang-format to work in Xcode 12+

Version info

The original repository can be found on GitHub: XcodeClangFormat

Tested with version 1.2.1 (commit 240bba0)

Setup

  1. Clone the original repository from GitHub (XcodeClangFormat)
  2. Navigate into the directory (cd XcodeClangFormat)
  3. Make sure to read the README.md file
  4. Execute ./configure in the repository directory, which will generate an xcconfig file
@T1T4N
T1T4N / build-an-xcode-source-extension.md
Created July 12, 2022 14:38
Creating an Xcode Source Extension

Build Settings

Depending on the project requirements, these are the necessary changes it running:

  • Set the correct ARCHS (standard or only x86_64)
  • Add XcodeKit.framework dependency (Embed and Sign) to the extension target
  • If Swift code needs to be parsed, Embed and Sign the following library:
    • $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/lib_InternalSwiftSyntaxParser.dylib

Troubleshooting

Menu item is there but disabled

@T1T4N
T1T4N / stress-ng-test.sh
Created July 5, 2022 19:22
Linus Tech Tips (LTT) M1 Ultra Review
# M1 Ultra
stress-ng --cpu 20 --cpu-method idct --matrix 20 --matrix-method mean --maximize
# M1 Max
stress-ng --cpu 10 --cpu-method idct --matrix 10 --matrix-method mean --maximize
# Intel PC
stress-ng --cpu 24 --cpu-method fft --matrix 24 --matrix-method mean --maximize
@T1T4N
T1T4N / git-sparse-checkout.md
Last active July 11, 2022 10:06
Git sparse checkout

Introduction

Starting with Git 2.37.0 there are a lot of improvements, particularly the full integration and rollout of sparse index. Using partial checkouts can really help the speed of git commands, among others committing, amending, stashing and querying status. This guide is to be considered experimental, so please don't modify/destroy your main repo checkout. A personal recommendation: use a sparse worktree

Usage

Note: the sparse-checkout.txt file mentioned below is a simple newline separated list of relative directories within the repository.

@T1T4N
T1T4N / QueryIPAddresses.swift
Created June 21, 2022 09:31
Query internal iOS IP addresses from all interfaces and return them in a Swift-friendly structure
struct IPData {
var address: String
var family: UInt8
var interface: String
}
func getIpAddresses() -> [IPData] {
var addresses: [IPData] = []
// Get list of all interfaces on the local machine:
@T1T4N
T1T4N / workaround.md
Created March 24, 2022 13:46
coc.nvim python linter fix for macOS 12.3
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister /Library/QuickLook/QuickNFO.qlgenerator
1. If that doesn't work, create a dummy script application using Script Editor and copy `UTExportedTypeDeclarations` from QuickNFO.qlgenerator/Contents/Info.plist to this dummy app's Info.plist
2. lsregister RegisterUTI-NFO.app
// ==UserScript==
// @name Redirect to teddit
// @description Automatically redirect from Reddit to Teddit
// @match https://old.reddit.com/*
// @match https://www.reddit.com/*
// @match https://reddit.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
// ==UserScript==
// @name Redirect to nitter
// @description Automatically redirect from twitter to nitter
// @match https://mobile.twitter.com/*
// @match https://twitter.com/*
// @grant none
// @inject-into content
// @run-at document-start
// ==/UserScript==
@T1T4N
T1T4N / swiftpm-strip.txt
Created February 4, 2022 09:30
SwiftPM Release Builds
SwiftPM builds don't pass -dead_strip to the linker by default,
you might want to pass -Xlinker -dead_strip for release builds
if you care about binary size