Skip to content

Instantly share code, notes, and snippets.

View cntrump's full-sized avatar
👀
Connecting...

cntrump

👀
Connecting...
View GitHub Profile
@cntrump
cntrump / UIViewController+ChildManagement.swift
Created June 17, 2025 14:25
This UIViewController extension provides methods to easily embed and detach a child view controller, managing its view hierarchy and layout within a parent view controller.
// details: https://developer.apple.com/documentation/uikit/creating-a-custom-container-view-controller
extension UIViewController {
@objc(attachToParentViewController:layout:)
public func attach(toParent parent: UIViewController?, layout: (@MainActor (UIView) -> Void)? = nil) {
guard let parent else {
return
}
@cntrump
cntrump / config
Last active February 27, 2025 06:56
My Ghostty configuration
term = xterm-256color
bold-is-bright = true
background-opacity = 0.98
background-blur-radius = 20
font-family = "mononoki"
font-size = 11
adjust-cell-height = 30%
cursor-click-to-move = true
theme = dark:catppuccin-mocha,light:catppuccin-latte
@cntrump
cntrump / UninstallRosetta.sh
Last active December 15, 2024 00:22
Uninstall Rosetta
#!/usr/bin/env sh
for file in `pkgutil --files com.apple.pkg.RosettaUpdateAuto`
do
if [ -f "$file" ]; then
rm -f "$file"
fi
done
@cntrump
cntrump / v2fly
Last active December 26, 2023 23:28
A simple v2fly daemonizing wrapper for FreeBSD
#!/bin/sh
# PROVIDE: v2fly
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
. /etc/rc.subr
name="v2fly"
rcvar="v2fly_enable"
import ObjectiveC
@discardableResult
public func synchronized<T>(_ lock: AnyObject, closure: () -> T) -> T {
let lock_ = lock
objc_sync_enter(lock_)
defer { objc_sync_exit(lock_) }
return closure()
}
@cntrump
cntrump / settings.json
Created March 14, 2023 05:56
Zed Editor configuration file
// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
"theme": "Rosé Pine Moon",
@cntrump
cntrump / hugo_docsy_patch.css
Last active December 17, 2022 15:27
Docsy hugo theme CSS patch
body {
font-family: system-ui;
}
tt, code, kbd, samp, pre {
font-family: ui-monospace, 'SF Mono', monospace;
}
code[class*="language-"],
pre[class*="language-"] {
@cntrump
cntrump / csv2html.py
Created July 27, 2022 11:05
CSV to HTML table
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
csv = pd.read_csv("codes.csv", engine = 'c')
csv.to_html("codes.html", index = False, justify='left')
/*
* Copyright (c) 2008 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
@cntrump
cntrump / office2016_retail_to_vol.bat
Last active May 5, 2025 03:34
Office 2016 Retail to VOL
@echo off
title Office2016 Retail to VOL
if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16"
if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16"
cls