Skip to content

Instantly share code, notes, and snippets.

View T1T4N's full-sized avatar
👽

Robert Armenski T1T4N

👽
View GitHub Profile
@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
Preview on macOS 10.14.6 Mojave can remove PDF owner password
@T1T4N
T1T4N / safari_inject.m
Created January 28, 2022 20:49
Restore old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
@T1T4N
T1T4N / poc-jailbreak.c
Created January 28, 2022 20:20
macOS 11.5.2-iOS 14.7.1 Kernel Race Condition POC Jailbreak
/*
Written By Pan ZhenPeng(@peterpan980927) of Alibaba Security Pandora Lab
use it on macOS: cc poc.c -o poc while True; do ./poc ; done
*/
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>