Skip to content

Instantly share code, notes, and snippets.

View shiftycow's full-sized avatar

Michael Harris shiftycow

View GitHub Profile
@shiftycow
shiftycow / Visual Studio Code Settings
Created April 22, 2017 19:58
My boilerplate Visual Studio Code user settings
// Place your settings in this file to overwrite the default settings
{
"python.linting.pylintEnabled": false,
"python.linting.pep8Enabled": true,
"editor.renderWhitespace": "all",
"git.autofetch": false,
"git.autorefresh": false,
"diffEditor.ignoreTrimWhitespace": false,
"files.trimTrailingWhitespace": true,
"files.eol": "\n",
@shiftycow
shiftycow / OSX Keymap
Last active August 29, 2015 14:17
Sublime Text 3 Settings
[
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} }
,{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }
,{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} }
,{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }
]
@shiftycow
shiftycow / dict_sort.py
Created May 19, 2014 22:11
An example of sorting complicated objects using a key dictionary
#!/usr/bin/env python
l = [
{'id':1,'val':'foo'}
,{'id':2,'val':'bar'}
,{'id':3,'val':'zig'}
,{'id':4,'val':'zig'}
,{'id':5,'val':'bar'}
]
print l
@shiftycow
shiftycow / mharris.pub
Created May 19, 2014 20:07
RSA Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfKTPDYa2W/5b5ylM1d9ykx9WKoPjlLR5pCdhz0/+9CROsznz47TPpQ/1nfnxgKCi7FRIRjFAPwbqOIs7Qn8sDe74Y0ZKFVPBKKy8O3ZzPVbK+o8xsEtxsoadyfjQT4vpnwvsl60kMRT889nwycJVCObE6zvjeuZFRKyPS7Z6QD4hWMe15c5gC2xLsZJKObZTjPMiYTMXRc+5tbvY3pXLx0fUk3Qc+MnNUL/XjQcGLV5Kkw0OdI5VBI339s6/Uz1SpVSh1MmTbyMUhyPtWffxcZ1Lea30S0ZRN0amokWwHIEvCYFCVUkuEqs25J+yLHri/q982W34TTe52Ou/vclWf mharris@reason
@shiftycow
shiftycow / ipRange_cidr.js
Created September 16, 2013 03:01
This is some simple javascript that converts a netmask to an integer number of mask bits (usually used in CIDR notation). It does some basic sanity checking, but won't catch invalid input such as "255.255.255.125"
var IPRange=function(){
this.start = "192.168.1.0";
this.subnetMask = "255.255.255.0";
this.cidrMask = function(){
mask = this.subnetMask.split(".");
if(mask.length != 4){
throw("Precondition failed: subnet mask should only have four octets!");
}
bits = 0;
#
# Contains helper functions for slicing arrays in multiprocessing systems
# These function were based off of C macros from an HPC class and, as such,
# return the actual array indicies. When using Python's slice notation,
# you'll need to add one to blockHigh() like so:
#
# n = len(array)
# process(array[blockLow(i,p,n):blockHigh(i,p,n)+1]
#
@shiftycow
shiftycow / boards.txt
Created June 21, 2013 04:15
entry for Arduino Tiny boards.txt file for ATTiny2313 using a 16MHz external crystal. I haven't tried to use to burn a bootloader, but the fuse settings should be OK. Use at your own risk ;)
###########################################################################
attiny2313at16.name=ATtiny2313 @ 16 MHz
# The following do NOT work...
# attiny2313at16.upload.using=avrispv2
# attiny2313at16.upload.using=Pololu USB AVR Programmer
# The following DO work (pick one)...
attiny2313at16.upload.using=arduino:arduinoisp
@shiftycow
shiftycow / .gitignore
Last active July 28, 2016 15:32
Generally useful .gitignore. It ignores editor files, temporary compilation files, and other cruft that you wouldn't want getting committed to source control.
# Generated build files
#######################
## LaTeX
*.aux
*.dvi
*.lof
*.ps
*.toc
@shiftycow
shiftycow / tab_demo.html
Created May 15, 2013 20:23
A simple example of Javascript powered tabs
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function(){
console.log($(".tab"));
$(".tab").hide();
$(".active").show();
});
@shiftycow
shiftycow / homework_template.tex
Created September 8, 2011 16:58
LaTeX homework template
\documentclass[11pt]{article} % I prefer "article" over "amsart" for homework. "report" also looks nice
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper} % ... or a4paper or a5paper or ...
\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx} % for graphics
\usepackage{epstopdf} % for importing PostScript graphics from GraphViz
\usepackage{amssymb} % math packages from AMS
\usepackage{amsmath}
\usepackage{amsthm} % for theorems and proofs