Skip to content

Instantly share code, notes, and snippets.

View michaelsbradleyjr's full-sized avatar
💭
Dip trip, flip fantasia 🎺

Michael Bradley michaelsbradleyjr

💭
Dip trip, flip fantasia 🎺
View GitHub Profile
@michaelsbradleyjr
michaelsbradleyjr / Emacs.md
Created December 20, 2011 08:43
Setting up Emacs daemon on OS X

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Homebrew

First you'll need to install the [Homebrew package manager][brew] if yo haven't already. It is amazing.

@["0x103cb8a08@[118, 116, 127, 127, 123, 225, 221, 123, 222, 127, 126, 69, 131, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225]\n", "0x103cb8a68@[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n", "0x103cb8ac8@[118, 116, 127, 127, 123, 225, 221, 123, 222, 127, 126, 142, 220, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225]\n", "0x103cb8b28@[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

@["0x103cae228@[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 48, 49, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32]\n", "0x103cae288@[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 48, 50, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32]\n", "0x103cae2e8@[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 48, 51, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32]\n", "0x103cae348@[104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 48, 52, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32

@michaelsbradleyjr
michaelsbradleyjr / otool.txt
Created February 8, 2022 16:47
comparing otool -L output for macports libunistring and libdeflate
$ cd /opt/local/lib
$ otool -L libunistring.2.dylib
libunistring.2.dylib:
/opt/local/lib/libunistring.2.dylib (compatibility version 5.0.0, current version 5.0.0)
/opt/local/lib/libiconv.2.dylib (compatibility version 9.0.0, current version 9.1.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1853.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
$ otool -L libdeflate.0.dylib
when (NimMajor, NimMinor, NimPatch) >= (1, 4, 0):
{.push raises:[].}
else:
{.push raises: [Defect].}
import chronos except `?`
import stew/results except `?`
export chronos except `?`
export results except `?`
@michaelsbradleyjr
michaelsbradleyjr / ext-ip.sh
Last active January 10, 2022 20:29
geth.service
#!/usr/bin/env bash
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'
@michaelsbradleyjr
michaelsbradleyjr / cljs-debug-macros.clj
Last active November 5, 2021 21:36
Macros and functions which facilitate the development and debugging of other macros and their supporting functions within a ClojureScript project.
(ns my-cljs.macros.debug
(:require [cljs.analyzer :as cljs]
clojure.walk))
(declare ap
cljs-macroexpand*
cljs-macroexpand-1*
cljs-macroexpand-all*
cljs-macroexpand

I wanted to share my "first big macro" in Nim (and it actually works, but still cleaning some things ups); has been an interesting experience:

https://github.com/status-im/nim-status/blob/feat/examples/client/examples/chat/task_runner/macros.nim

Some helpful things I learned, in case you need/want to write your own Nim macros:

When you've got a macro where you're passing in a body: untyped (usually the last param, and not necessarily called "body" but that's common), you can print it to the screen in the compile-time output with e.g.

echo()
echo(treeRepr body)
@michaelsbradleyjr
michaelsbradleyjr / pohle-preuss-links.txt
Last active June 2, 2021 00:26
Pohle–Preuss series in Dogmatic Theology
import os, threadpool
type
ThreadSafeString* = distinct cstring
proc safe*(input: string): ThreadSafeString =
var res = cast[cstring](allocShared(input.len + 1))
copyMem(res, input.cstring, input.len)
res[input.len] = '\0'
res.ThreadSafeString