Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / netatalk-build.sh
Last active Aug 8, 2018 — forked from stunpix/netatalk-build.sh
Build netatalk 3.1.11 on Ubuntu 16.04
View netatalk-build.sh
#!/bin/bash
# Enable extended attributes on filesystem
# http://netatalk.sourceforge.net/wiki/index.php/Install_Netatalk_3.1.11_on_Ubuntu_16.04_Xenial#Setting_Up
# Get system to updated state and install required packages
sudo apt update
sudo apt full-upgrade -y
sudo apt install -y clang make libdb-dev libgcrypt20-dev libavahi-client-dev libpam0g-dev
@kylemcdonald
kylemcdonald / summary.py
Created Mar 26, 2018 — forked from HTLife/summary.py
Pytorch model summary
View summary.py
import torch as th
from collections import OrderedDict
def summary(input_size, model):
def register_hook(module):
def hook(module, input, output):
class_name = str(module.__class__).split('.')[-1].split("'")[0]
module_idx = len(summary)
m_key = '%s-%i' % (class_name, module_idx+1)
@kylemcdonald
kylemcdonald / pytorch_char_rnn.py
Last active May 19, 2018 — forked from kastnerkyle/pytorch_char_rnn.py
Pytorch char rnn as a script, based on examples from Kyle McDonald, Laurent Dinh, and Sean Robertson
View pytorch_char_rnn.py
# Special thanks to Kyle McDonald, this is based on his example
# https://gist.github.com/kylemcdonald/2d06dc736789f0b329e11d504e8dee9f
# Thanks to Laurent Dinh for examples of parameter saving/loading in PyTorch
# Thanks to Sean Robertson for https://github.com/spro/practical-pytorch
from tqdm import tqdm
from torch.autograd import Variable
import torch.nn as nn
import torch
@kylemcdonald
kylemcdonald / traffic-cameras.json
Last active Jul 14, 2016 — forked from camb416/traffic-cameras.json
All traffic camera locations in NYC
View traffic-cameras.json
[{
"lat": "40.79142677512476",
"lng": "-73.93807411193848",
"name": "1 Ave @ 110 St",
"camera": "http://207.251.86.238/cctv261.jpg"
}, {
"lat": "40.800426144169315",
"lng": "-73.93155097961426",
"name": "1 Ave @ 124 St",
"camera": "http://207.251.86.238/cctv254.jpg"
View ArtNetGPU.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# this is a quick implementation of http://arxiv.org/abs/1508.06576
# BUT! This is kind of dirty. Lots of hard coding. 
import numpy as np
import math
from chainer import cuda, Function, FunctionSet, gradient_check, Variable, optimizers
import chainer.functions as Fu
@kylemcdonald
kylemcdonald / scratchml.xml
Created Jan 22, 2012 — forked from jamiew/scratchml.xml
ScratchML draft spec v3
View scratchml.xml
<sml>
<!--
# SCRATCH MARKUP LANGUAGE, WORKING DRAFT
http://scratchml.com
* version -- minor versions for small changes, major for incompatibilities
* info -- general file metadata: author info, client info etc.
* turntable - hardware metadata
* mixer -- hardware metadata
View sketchup_downloader.rb
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'httparty'
unless ARGV[0] && ARGV[1]
puts "Usage: ruby sketchup_downloader.rb path/to/terms.csv path/to/folder"
exit 1
end
View ArduinoTemperatureFlashlight.ino
#include <i2cmaster.h>
#include "Wire.h"
#include "BlinkM_funcs.h"
const float lowReading = 75;
const float highReading = 110;
const int blinkm_addr = 0;
const unsigned char separatorCharacter = 255;
void setup(){