Skip to content

Instantly share code, notes, and snippets.

View marsol0x's full-sized avatar

marsol0x

  • Dun & Bradstreet Inc.
  • Hudson, NH
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS Testing</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
// NOTE(marshel): This is seemingly backwards so that I don't have
// to write a compare function for JS's built-in array sort.
var DAMAGE_TYPE_NONE = 3;
#include <stdio.h>
#include <string.h>
void printhelp(char *procname) {
printf("%s <email address>\n", procname);
}
int main(int argc, char **argv) {
if (argc < 2) {
printhelp(argv[0]);
@marsol0x
marsol0x / .emacs
Created February 25, 2015 18:00
Emacs config
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize)
(menu-bar-mode -1)
(evil-mode)
(ido-mode 1)
; Spaces, not tabs
@marsol0x
marsol0x / gist:5599071
Created May 17, 2013 13:37
Challenge of regex and grep
In 1998, Rob Pike and I were writing The Practice of Programming ("TPOP"). The last chapter of the book, "Notation", collected a number of examples where a good notation led to better programs and better programming. This included the use of simple data specifications (printf formats, for instance), and the generation of code from tables.
Given our Unix backgrounds and many years of experience with tools based on regular expression notation, we naturally wanted to include a discussion of regular expressions, and it seemed mandatory to include an implementation as well. Given our emphasis on tools, it also seemed best to focus on the class of regular expressions found in grep, rather than say those from shell wild cards, since we could also talk about the design of grep itself.
The problem was that any existing regular expression package was far too big. The local grep was over 500 lines long (about 10 book pages). Open-source regular expression packages tended to be huge, roughly the size of the entire book
@marsol0x
marsol0x / gist:5536313
Created May 7, 2013 21:31
My Sublime Text 2 config
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"fade_fold_buttons": false,
"font_face": "Source Code Pro for Powerline",
"font_options": ["subpixel_antialias"],
"highlight_line": true,
"highlight_modified_tabs": true,