Skip to content

Instantly share code, notes, and snippets.

View jbenner-radham's full-sized avatar

James Benner jbenner-radham

View GitHub Profile
@jbenner-radham
jbenner-radham / Vagrantfile
Created August 14, 2017 23:25
Python 2.7 Dev Env
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@jbenner-radham
jbenner-radham / py3-venv-Flask.Makefile
Last active July 17, 2017 21:51
A Makefile to setup a Python 3 venv.
VENV_INSTALL_DIR = venv
# The first target listed acts as the default.
install:
@python3 -m venv ${VENV_INSTALL_DIR}
@. ${VENV_INSTALL_DIR}/bin/activate && pip3 install Flask > /dev/null && python3 -c \
"import subprocess; \
import re; \
flask_info = subprocess.run('pip3 show Flask', encoding='utf-8', shell=True, stdout=subprocess.PIPE).stdout; \
flask_version = re.compile('Version: ([0-9]+.[0-9]+)').search(flask_info)[1]; \
@jbenner-radham
jbenner-radham / Makefile
Last active April 23, 2017 21:03
Fun with linked list data structures!
STD = -std=c99
# > If there are C compiler options that must be used for proper compilation of
# > certain files, do not include them in CFLAGS. Users expect to be able to
# > specify CFLAGS freely themselves. Instead, arrange to pass the necessary
# > options to the C compiler independently of CFLAGS, by writing them
# > explicitly in the compilation commands or by defining an implicit rule [...]
CFLAGS = $(STD) -O2 -pedantic -Wall -Wextra -Iinclude -g -fsanitize=address -fno-omit-frame-pointer
# The first target listed acts as the default.
@jbenner-radham
jbenner-radham / paper_word_count.c
Last active April 20, 2017 00:10
Comparing a couple different function implementations.
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <string.h>
#define PENCIL_SPACE ' '
size_t paper_word_count(char *paper)
{
size_t count = 0;
@jbenner-radham
jbenner-radham / README.md
Last active February 11, 2024 23:04
An opinionated Jasmine spec generator for AMD modules.

Jasmine Spec Generator

An opinionated Jasmine spec generator for AMD modules.

Installation

$ npm install && chmod +x cli.js

Search For An Item With the Label "Sega Mega Drive"

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT * WHERE {
    ?id rdfs:label "Sega Mega Drive"@en
}
@jbenner-radham
jbenner-radham / Cargo.toml
Last active February 5, 2017 19:57
A simple "hello world" web server written in Rust.
[package]
name = "simple-web-server"
version = "0.1.0"
authors = ["James Benner <[email protected]>"]
[dependencies]
time = "0.1"
^([a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)?)__([a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)?)(?:--)([a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)?)$
int server_sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);