Skip to content

Instantly share code, notes, and snippets.

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

cntrump

👀
Connecting...
View GitHub Profile
@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 10, 2022 11:01
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
@cntrump
cntrump / str2hex.c
Last active May 10, 2022 08:05
Convert hex string to number.
int str2hex(char *str, int len) {
len = MIN(len, 8);
int hex = 0;
int bit = 0;
for (int i = len - 1; i >= 0; i--) {
int n;
char ch = str[i];
if (ch >= '0' && ch <= '9') {
n = ch - '0';
@cntrump
cntrump / bcompare_patch.py
Last active September 8, 2024 04:06
Beyond Compare 4 Patcher
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import os
import sys
import platform
def useage():
print("useage: bcompare_patch.py /path/to/BCompare")
@cntrump
cntrump / cl-fmt.sh
Last active April 7, 2021 13:35 — forked from leilee/cl-fmt.sh
clang-format files recursively
#!/usr/bin/env bash
set -e
# Variable that will hold the name of the clang-format command
FMT=""
# Some distros just call it clang-format. Others (e.g. Ubuntu) are insistent
# that the version number be part of the command. We prefer clang-format if
# that's present, otherwise we work backwards from highest version to lowest