Skip to content

Instantly share code, notes, and snippets.

View jameslmartin's full-sized avatar

James Martin jameslmartin

View GitHub Profile
@jameslmartin
jameslmartin / HaskellExplorations.md
Last active August 29, 2015 14:00
Explorations with Haskell

Explorations in Haskell as a platform

Note: I'm pretty new to Haskell, I've only experimented with it during COMP 524, and written some pretty basic functions.

So I decided I wanted to try to throw together a quick web server together with Haskell, but it's been a small disaster setting up the tools necessary.

OS: Ubuntu 12.10

The first thing I did was create a folder for my experiment, under ~/Documents/Code/haskell I then ran sudo apt-get install haskell-platform to get ghci and cabal, Haskell's package manager. I then wanted to create cabal sandbox, so I ran cabal sandbox init and this was the beginning of a two-hour struggle...

@jameslmartin
jameslmartin / provision.sh
Last active August 29, 2015 14:03
provision.sh
if grep -q "\[thestinger\]" "/etc/pacman.conf"; then
echo "Repository already added."
else
echo $'\n[thestinger]\nSigLevel = Optional\nServer = http://pkgbuild.com/~thestinger/repo/$arch' >> /etc/pacman.conf
fi
pacman -Syuq --noconfirm
pacman -Sq --noconfirm community/rust
@jameslmartin
jameslmartin / jsonParser.java
Created July 11, 2014 18:30
Neat little JSON parser, grabs outer level keys from a JSONObject that has been converted to a string with toString() and returns them in an ArrayList
/**
* getNames() - Returns ArrayList of Strings that are outer-most keys of a JSONObject that has been converted
* to a String with the toString() method (JSON4J)
* @author martinlj
* @param json - JSONObject that has been converted to a string with toString()
*/
private ArrayList<String> getNames(String json){
//Strip outer curly braces
json = json.substring(1,json.length()-1);
ArrayList<String> names = new ArrayList<String>();
@jameslmartin
jameslmartin / example.java
Last active August 29, 2015 14:23
Example
// Retrieve raw information, then actually path into the object
keywords = retrieveRawKeywordInformation(json);
keywords = keywords.path("keywords");
if(keywords != null &&
!(keywords instanceof MissingNode) &&
!(keywords.toString().equals("{}"))){
...}
@jameslmartin
jameslmartin / bad-example.java
Last active August 29, 2015 14:23
Bad example
// Retrieve keyword information
keywords = retrieveRawKeywordInformation(json);
if(keywords.path("keywords") != null &&
!(keywords.path("keywords") instanceof MissingNode) &&
!(keywords.path("keywords").toString().equals("{}"))){
...}
@jameslmartin
jameslmartin / emacspeak.md
Last active February 8, 2016 20:23
Emacspeak Installation

Following these instructions. Note that emacspeak does not work with the Apple shipped version of emacs, so we install emacs local to the user with brew.

Use brew, note that --cocoa is deprecated, use --with-cocoa instead. This step will take a while, as emacs is installed.
brew install emacs --HEAD --use-git-head --with-cocoa --srgb
brew linkapps emacs
mkdir -p ~/Sources
cd ~/Sources
git clone https://github.com/tvraman/emacspeak.git
cd ~/Sources/emacspeak

@jameslmartin
jameslmartin / reader.js
Last active July 19, 2016 10:00
reader, a Jupyter Notebook nbextension that provides audio cues for visually impaired users
/*
* Author: James Martin (jamesml@cs.unc.edu)
*/
define(function() {
"use strict";
var Jupyter = require('base/js/namespace');
var events = require('base/js/events');
@jameslmartin
jameslmartin / app.js
Created February 15, 2016 20:05
Small node app for serving files
function p(d) {
console.log(d);
}
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/'));
var server = app.listen('9999', function() {

Keybase proof

I hereby claim:

  • I am jameslmartin on github.
  • I am jlmartin (https://keybase.io/jlmartin) on keybase.
  • I have a public key ASBsqyVy6qQWX-ZI2UfHi7SlVmf-z9oq9alGmxEOTsI6igo

To claim this, I am signing this object:

@jameslmartin
jameslmartin / nginx-config-update.md
Last active September 16, 2021 16:13
Installing nginx from Source

Installing nginx from Source

Following these instructions.

I would recommend using Ubuntu 18.04 LTS, specifically for certbot (which you will need for SSL). Certbot does not currently support 19.10.

Before installing pre-reqs (pre-pre-reqs)

Ensure that your system is up to date with apt-get update