Skip to content

Instantly share code, notes, and snippets.


Andy Jordan andschwa

View GitHub Profile
andschwa / main.cpp
Last active March 20, 2022 15:32
Algorithm for Efficient Chunked File Reading in C++
View main.cpp
/* Algorithm for Efficient Chunked File Reading in C++
* The MIT License (MIT)
* Copyright 2014 Andrew Schwartzmeyer
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
andschwa / mailgun_tracking.js
Last active July 15, 2021 10:31
Google Scripts web app to receive MailGun webhooks
View mailgun_tracking.js
// Hook location:
var API_KEY = "key-abcd1234...";
var EMAIL = "";
// Naive function to email a posted event from a MailGun web hook.
// `doPost(e)` signature:
// `parameter` schema:
// Events API:
function doPost(e) {
// The output is not consumed, but required by the Google Scripts API.
andschwa / installkernel
Created August 17, 2015 00:12
Arch Linux development kernel installation script
View installkernel
# Arch Linux development installkernel script
# Andrew Schwartzmeyer <>
# See `Documentation/kbuild/kbuild.txt`
# Copy to `/sbin/installkernel`
# Use with `sudo make install`
# Copy the kernel image
cp -v $2 $4/vmlinuz-linux-$1
# Make initial RAM disk
andschwa / provided-mode-derived-p.el
Last active September 21, 2018 06:46
Make `provided-mode-derived-p` support `defalias` parents
View provided-mode-derived-p.el
;; Fixed to support `(defalias 'my-parent-mode ...)`
(defun provided-mode-derived-p (mode &rest modes)
"Non-nil if MODE is derived from one of MODES.
Uses the `derived-mode-parent' property of the symbol to trace backwards.
If you just want to check `major-mode', use `derived-mode-p'."
(while (and (not (memq mode modes))
(let ((parent (get mode 'derived-mode-parent)))
(let ((parentfn (symbol-function parent)))
(setq mode (if (and parentfn (symbolp parentfn))
andschwa /
Created May 11, 2017 19:19
Visual Studio 2017 CMake Build Tools Bug


The 3.7.2 version of CMake bundled with Visual Studio 2017 (latest update) cannot on its own find the Visual Studio 2017 build tools. This is reproducing for me using Visual Studio 2017 with individual components selected. Using CMake 3.8.1 (current CMake release), the tools can be found no problem. This becomes problematic when using the Visual Studio CMake tools because the ExternalProject_Add macro (used to include third-party CMake driven projects) re-invokes CMake, at which point it fails to find the compilers. It seems that Visual Studio originally invokes CMake "specially" shomehow as it finds the tools for the top-level project, but does not retain this environment when ${CMAKE_COMMAND} is invoked from within the build.

andschwa /
Created May 6, 2017 19:27
Keybase verification

Keybase proof

I hereby claim:

  • I am andschwa on github.
  • I am andschwa ( on keybase.
  • I have a public key ASBNS9VF0YqQ9M0J_vZ1D_C3YsmCwqsoTsRZP7QclouNxwo

To claim this, I am signing this object:

andschwa /
Last active August 29, 2015 14:27 — forked from datagrok/
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

andschwa / g++ test.cpp
Last active August 29, 2015 14:15 — forked from 13abylon/g++ test
View g++ test.cpp
// g++ test.cpp --std=c++11 -lpthread -O2
//#ifdef WIN32 <- stdafx breaks this ifdef...
//#include "stdafx.h"
#include <iostream>
#include <atomic>
#include <thread>
#include <vector>
andschwa / .vimrc
Created January 20, 2015 06:42
VIM configuration
View .vimrc
""" Andrew Schwartzmeyer's VIM configurations
""" I now use Emacs, but am saving these for posterity
""" Set Vim mode, not Vi
set nocompatible
""" Vundle
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()