Skip to content

Instantly share code, notes, and snippets.

@nathansizemore
nathansizemore / JSONRequest.java
Created June 2, 2014 11:49
Java JSON HTTP Client
package com.nathansizemore;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
@nathansizemore
nathansizemore / android-usbhost-service.java
Created December 15, 2014 20:37
Android UsbHost Service
/*
* Service for UsbHost Communication with an Arduino Due
*/
import java.util.Arrays;
import android.annotation.SuppressLint;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
@nathansizemore
nathansizemore / .bash_profile
Last active April 7, 2017 21:03
macOS bash settings
# Prompt
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
# Terminal colors
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# ls
alias ls="ls -lGAFh"
perl -pi -e 's/\r\n|\n|\r/\r\n/g' file-to-convert # Convert to DOS
perl -pi -e 's/\r\n|\n|\r/\n/g' file-to-convert # Convert to UNIX
# Sweet branch and commit mappings
git config --global alias.map "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
@nathansizemore
nathansizemore / Contract Killer 3.md
Created November 5, 2015 22:48
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: October 8th 2015
  • Original post

@nathansizemore
nathansizemore / latency.txt
Created November 18, 2015 14:43 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@nathansizemore
nathansizemore / gcc-install.sh
Last active June 13, 2024 12:17
Customizable GNU Toolchain install script
#! /bin/bash
BINUTILS_VERSION=binutils-2.28
GCC_VERSION=gcc-7.1.0
LIBC_VERSION=glibc-2.24
MPFR_VERSION=mpfr-3.1.5
GMP_VERSION=gmp-6.1.2
MPC_VERSION=mpc-1.0.3
ISL_VERSION=isl-0.16.1
CLOOG_VERSION=cloog-0.18.1
@nathansizemore
nathansizemore / socket.rs
Created November 16, 2016 21:00
Rust wrapper for a raw Linux socket
// Copyright 2016 Nathan Sizemore <[email protected]>
//
// This Source Code Form is subject to the terms of the
// Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed
// with this file, you can obtain one at http://mozilla.org/MPL/2.0/.
use std::io::{self, Error, ErrorKind, Read, Write};
use std::os::unix::io::{AsRawFd, RawFd};
@nathansizemore
nathansizemore / injustice.2.db.js
Last active December 26, 2017 15:45
Injustice 2 frame data
var frameData = [
{
"name":"Aquaman",
"strength":1700,
"ability":1600,
"defense":1500,
"hp":1050,
"basicAttacks":[
{
"name":"Flounder Fist",