Skip to content

Instantly share code, notes, and snippets.

View mkhl's full-sized avatar
🖤
…at any cost

Martin Kühl mkhl

🖤
…at any cost
View GitHub Profile
@mkhl
mkhl / acme-editorconfig
Created April 1, 2019 20:05
EditorConfig support for Acme
#!/usr/local/plan9/bin/rc
. 9.rc
. $PLAN9/lib/acme.rc
fn convert {
awk -F'=' '
$1 == "indent_style" {
print "Spaces", ($2 == "space") ? "on" : "off"
}
/*
* ctrl-f1
* -------
* Query or toggle the "Full Keyboard Access" hotkey, Ctrl-F1
*
* make CC=clang CFLAGS="-framework Carbon" ctrl-f1
*/
#include <Carbon/Carbon.h>
@mkhl
mkhl / acme-autoformat
Last active July 19, 2023 15:52
My current autoacme event handler script
#!/usr/local/plan9/bin/rc
. 9.rc
. $PLAN9/lib/acme.rc
event=$1
target=$2
fn hashbang {
awk '
@mkhl
mkhl / Makefile
Created July 31, 2009 21:44
Small and generic Makefile skeleton
PROJECT=foo
SOURCES=bar.c baz.c
LIBRARY=nope
INCPATHS=../some_other_project/
LIBPATHS=../yet_another_project/
LDFLAGS=-ldosomething
CFLAGS=-c -Wall
CC=gcc
# ------------ MAGIC BEGINS HERE -------------
@mkhl
mkhl / Makefile
Created August 8, 2022 18:41
my `make help` variant
.PHONY: help
help: ## Show this help
@awk -F ':.* ## ' '/^\w.*##/{printf "%-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@mkhl
mkhl / changes
Created March 11, 2022 01:00
"keep a changelog" "management" "tools"
#!/bin/sh
# Usage: changes <version> [<file>...]
# Print the changes made in <version> according to the changelog
# Defaults: <file>: CHANGELOG.md
if [ $# -eq 0 ]; then
usage "$0"
exit 64
fi
@mkhl
mkhl / nix-2.3.10.nix
Created December 5, 2021 15:03
pin nix to version 2.3
# $HOME/.config/nixpkgs/overlays/nix-2.3.10.nix
# pin nix to version 2.3
self: super:
{
nixStable = super.nix_2_3;
nix = super.nix_2_3;
nix_2_4 = super.nix_2_3;
}
@mkhl
mkhl / DebugLog.h
Created December 8, 2008 18:14
Objective-C Logging
// Source: http://blog.mbcharbonneau.com/post/56581688/better-logging-in-objective-c
#define DebugLog(format, ...) NSLog(@"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(format), ##__VA_ARGS__])
@mkhl
mkhl / wait-for.sh
Last active April 23, 2021 09:57 — forked from michael-simons/wait_for_bolt.sh
A bash script waiting for port some host and port to become available without netcat or similar
#!/usr/bin/env bash
host=${1:?missing host}
port=${2:?missing port}
timeout=${3:-180}
until (exec 3<>"/dev/tcp/$host/$port") &>/dev/null; do
((timeout == 0)) && exit 1
((timeout--))
echo -n .
sleep 1
done
@mkhl
mkhl / dump-completions.lisp
Created November 25, 2008 09:34
Dump symbols to a file to support tab-completion in sn SBCL REPL.
(with-open-file (!!!-stream (merge-pathnames ".sbcl_completions" (user-homedir-pathname))
:direction :output
:if-exists :supersede)
(let ((!!!-seen (make-hash-table :size 6000 :test #'equal))
(!!!-cl-package (find-package "CL"))
(!!!-cl-user-package (find-package "CL-USER")))
(loop for !!!-package in (list-all-packages)
do (let ((!!!-prefixes
(if (or (eq !!!-package !!!-cl-package)
(eq !!!-package !!!-cl-user-package))