Skip to content

Instantly share code, notes, and snippets.

View mike-anderson's full-sized avatar

Mike Anderson mike-anderson

  • Victoria, British Columbia, Canada
  • 01:51 (UTC -08:00)
View GitHub Profile
@mike-anderson
mike-anderson / install_go.sh
Last active November 20, 2023 04:26
stratux barebones debian installation
#!/bin/bash
set -exo pipefail
#install go
cd /root
rm -rf go
rm -rf go_path
find ./ -name "go*.tar.gz" -delete
if [ "$GOROOT" != "/root/go" ]; then
echo "export PATH=/root/go/bin:\${PATH}" >> .bashrc
{
"title": "Leopold FC660 Capslock to FN w/ function keys and escape",
"rules": [
{
"description": "Map capslock to fn",
"manipulators": [
{
"conditions": [{ "type": "device_if", "identifiers": [{
"product_id": 257, "vendor_id": 1204
}]}],
@mike-anderson
mike-anderson / hex180.geojson
Last active October 22, 2017 00:58
TurfJS issue geojson files
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mike-anderson
mike-anderson / pdfmix.py
Created March 3, 2017 17:22
mix two pdfs with odd and even pages from a document feeder scanner
#!/usr/local/bin/python
from PyPDF2 import PdfFileReader, PdfFileWriter
import sys
if len(sys.argv) < 4:
print "usage: mix.py odd.pdf even.pdf result.pdf"
exit()
odd = PdfFileReader(open(sys.argv[1],'rb')).pages
@mike-anderson
mike-anderson / keybase.md
Created November 18, 2016 17:37
keybase proof

Keybase proof

I hereby claim:

  • I am mike-anderson on github.
  • I am mike0x41 (https://keybase.io/mike0x41) on keybase.
  • I have a public key ASDJHQc6VCLy3FvgW8v7EfzPzcZ6n2o0NFfoHvdq4O_10Ao

To claim this, I am signing this object:

#some useful path aliases
set -x DEV_TOOLS "$HOME/Dev/tools"
#place usr/local/bin in the front
set -x PATH "/usr/local/bin" $PATH
#imports
. ~/.autojump/etc/profile.d/autojump.fish
set -x PATH $PATH "$DEV_TOOLS/depot_tools"
set -x PATH $PATH "$DEV_TOOLS/../harpDoc/bin"
@mike-anderson
mike-anderson / trainer.py
Last active December 30, 2015 15:59
comment composition random forrest
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import cross_val_score
import json
import numpy
data = json.load(open('askreddit.json'))
corpus = []
classifiers = []
for article_key in data:
@mike-anderson
mike-anderson / crawler.py
Last active December 30, 2015 15:58
subreddit comment crawler
import sys
import requests
import json
subreddit_name = sys.argv[1]
output_file = open(sys.argv[2],'w')
subreddit_address = 'http://reddit.com/r/'+subreddit_name+'.json'
#default is front page, hot
subreddit = requests.get(subreddit_address).json()
@mike-anderson
mike-anderson / Election.py
Last active December 25, 2015 17:29
Electoral District parser
class Election:
# ed_data: [district_name, record]
ed_data = None
# va_data: {district_name: [record]}
va_data = None
def __init__(self,ed_data_,va_data_):
self.ed_data = ed_data_
self.va_data = va_data_
@mike-anderson
mike-anderson / UIView+NativeCSSIBShim.h
Created August 14, 2013 04:35
Allows setting nativeCSS (nativecss.com) id and class as user defined runtime attributes in interface builder.
#import <UIKit/UIKit.h>
#import "UIView+NativeCSS.h"
@interface UIView (NativeCSSIBShim)
@property (nonatomic,weak) NSString *nativeCSSId;
@property (nonatomic,weak) NSString *nativeCSSClass;
@end