Skip to content

Instantly share code, notes, and snippets.

@eddieh
eddieh / style.adoc
Created March 31, 2016 01:22
Universal Code Style

Universal Code Style

There are three important principles related to coding style. All three principals should be followed.

First, follow the base guidlines for whatever language you happen to be working in. Usually this means you try to make your code look like

@eddieh
eddieh / gist.el.error.txt
Last active December 10, 2019 21:14
gist.el choked on non-ascii multibyte character
error in process sentinel: Multibyte text in HTTP request: PATCH /gists/1c784cd92b2de48a214d16734dd59807 HTTP/1.1
MIME-Version: 1.0
Connection: keep-alive
Extension: Security/Digest Security/SSL
Host: api.github.com
Accept-encoding: gzip
Accept: */*
User-Agent: URL/Emacs Emacs/26.3 (OpenStep; x86_64-apple-darwin14.5.0)
Authorization: token super-secrect-token-of-many-ascii-characters
Content-Type: application/json
@eddieh
eddieh / howto-shebang
Last active December 11, 2019 05:30
Insert shebang #! with Emacs
#!/usr/bin/tail -n+2
Don't chmod that file! Don't type a shebang! Edit an executable script
in Emacs and invoke
M-x executable-set-magic
This is a self-displaying file made with `executable-self-display'. If
you have had a stroke and forgotten how to make a script executable by
hand, just insert the following form as the first line of the script
@eddieh
eddieh / .profile
Last active December 11, 2019 05:43
Name tabs based on the current directory in Terminal.app
# set the current tab's name
function tab_name {
printf "\e]1;$1\a"
}
# set the tab's name to the current working directory name
function update_tab_name {
tab_name "$(basename $PWD)"
}
@eddieh
eddieh / iPadUpdater 91.log
Last active December 11, 2019 22:53
iPad Pro fails to recover
2019-09-20 12:12:46.000 iTunes[4560:507]: restore library built Aug 29 2019 at 10:37:51
2019-09-20 12:12:46.000 iTunes[4560:507]: iTunes: iTunes 12.9.5.5
2019-09-20 12:12:46.000 iTunes[4560:507]: iTunes: Apple Mobile Device version: 1190.9.1
2019-09-20 12:12:46.000 iTunes[4560:507]: iTunes: Software payload version: 16G102
2019-09-20 12:12:46.000 iTunes[4560:507]: iTunes: Using MobileRestore state machine
[12:12:54.2907] Can't get board config with NULL device map
[12:12:54.2915] You can't copy the serial number from a DFU mode device
[12:12:54.2930] Can't search 0 registry node for serial device
[12:12:54.2932] =====================================================
[12:12:54.2932] Device info:
@eddieh
eddieh / .profile
Last active December 11, 2019 23:03
Colorize ls output and display a special symbol indicating the file type
## Colors
## The color designators are as follows:
# a black
# b red
# c green
# d brown
# e blue
# f magenta
# g cyan
# h light grey

Build Your Own Windows Vagrant Box

Intro

I have found myself needing to test on Windows frequently. I need to be able to spin up fresh virtual machines—Vagrant seems to be the perfect solution.

I primarily use Macs for development and am currently using a cross compiler to develop native Win32 apps (and eventually Win64 apps). On the Mac side, basics like Homebrew are assumed to be

@eddieh
eddieh / simple.m
Created June 8, 2020 15:31
Simplest possible single-file Cocoa app with dock icon and menu
#import <Cocoa/Cocoa.h>
int main(int argc, char **argv)
{
NSRect rect;
NSWindowStyleMask style;
NSAutoreleasePool *pool;
NSApplication *app;
NSMenu *menubar, *appMenu;
NSMenuItem *appMenuItem, *quitMenuItem;
@eddieh
eddieh / .msmtprc
Created February 29, 2020 18:38
msmtp configuration for iCloud email account
# -*- mode: conf; tab-width: 4; -*-
defaults
port 587
tls on
account primary
host smtp.mail.me.com
auth on
from account@icloud.com
@eddieh
eddieh / gist:56fbf306587482a429f0f1fa185c8945
Created December 30, 2020 16:32
GitHub's Homebrew request
$ brew update
Error:
homebrew-core is a shallow clone.
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you