Skip to content

Instantly share code, notes, and snippets.

@eddieh
eddieh / Makefile
Last active May 14, 2022 23:30
libdispatch.dylib Makefiles for building 32 bit libdispatch
SUBDIRS += dispatch
SUBDIRS += os
SUBDIRS += private
SUBDIRS += src
SDK_ROOT=/Applications/Xcode9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
libpthread_path=$(abspath ../libpthread-301.50.1)
libplatform_path=$(abspath ../libplatform-161.50.1)
xnu_path=$(abspath ../xnu-4570.71.2)
@eddieh
eddieh / gnu-make-oddness.org
Created December 29, 2021 01:22
GNU Make Oddness (with -rR)

GNU Make Oddness

Since version 4.0 of GNU Make a feature was added that almost every makefile should use. The 4.0 release notes describes the feature as “setting the -r and -R options in MAKEFLAGS inside a makefile now works as expected, removing all builtin rules and variables, respectively.”

#!/bin/bash
# tputcolors
# http://linuxtidbits.wordpress.com/2008/08/11/output-color-on-bash-scripts/
echo
echo -e "$(tput bold) reg bld und tput-command-colors$(tput sgr0)"
for i in $(seq 0 7); do
echo " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)"
done
@eddieh
eddieh / macos-appstore-installer-to-iso.org
Created November 29, 2021 07:42
Convert macOS App Store Installer to a Bootable ISO

Convert macOS App Store Installer to a Bootable ISO

IMG=Catalina
APPRES="/Applications/Install macOS Catalina.app/Contents/Resources"
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password).
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
@eddieh
eddieh / chroot-env-on-mac.org
Created July 28, 2021 19:43
chroot Environments on macOS (draft)

chroot Environments on macOS

This is a draft.

macOS doesn’t have many of the advanced Linux or UNIX features that have come about in the past 20 years. So getting a proper chroot environment up and running takes a little more work.

@eddieh
eddieh / console-style.js
Created March 21, 2021 20:02
Stylize console.log
console.log('%cYo!', 'font-family: cursive; font-size: 3em; color: indigo')
@eddieh
eddieh / mono.js
Created March 21, 2021 19:56
Turn an ASCII string into a Mathematical Monospaced String in JS
function mono(str) {
const ASCII_A = 'A'.codePointAt(0)
const ASCII_Z = 'Z'.codePointAt(0)
const ASCII_a = 'a'.codePointAt(0)
const ASCII_z = 'z'.codePointAt(0)
const ASCII_0 = '0'.codePointAt(0)
const ASCII_9 = '9'.codePointAt(0)
const MONO_Alpha_offset = '𝙰'.codePointAt(0) - ASCII_A
const MONO_alpha_offset = '𝚊'.codePointAt(0) - ASCII_a
const MONO_num_offset = '𝟶'.codePointAt(0) - ASCII_0
@eddieh
eddieh / lnemacs
Created March 17, 2021 18:36
make an alias in /Applications to emacs-mac from Homebrew
#!/bin/sh
#SRC=${1}
#DST=${2}
SRC="/usr/local/opt/emacs-mac/Emacs.app"
DST="/Applications"
osascript <<EOF
tell app "Finder"
@eddieh
eddieh / write-oldstyle-plist.m
Created March 4, 2021 17:42
Write Old-Style ASCII Property Lists like a Boss
#import <Foundation/Foundation.h>
#define BEGIN_AUTORELEASEPOOL @autoreleasepool {
#define END_AUTORELEASEPOOL }
int main(int argc, const char **arg)
{
BEGIN_AUTORELEASEPOOL
NSError *err;