Skip to content

Instantly share code, notes, and snippets.

View kazimuth's full-sized avatar
🕷️
numbers aren't real

james gilles kazimuth

🕷️
numbers aren't real
  • Detroit, MI
View GitHub Profile
@kazimuth
kazimuth / bc.h
Created January 10, 2018 01:16
Battlecode C API
/// GENERATED C, DO NOT EDIT
#ifndef bc_h_
#define bc_h_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
uint8_t bc_has_err();
int8_t bc_get_last_err(char** result);
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <assert.h>
#include <bc.h>
/// See bc.h at xxx for the API you have access too.
/// Note: the API is not thread safe; don't use pthreads.
import battlecode as bc
import random
import sys
import traceback
print("pystarting")
# A GameController is the main type that you talk to the game with.
# Its constructor will connect to a running game.
gc = bc.GameController()
@kazimuth
kazimuth / densenet.py
Last active December 23, 2017 03:18
More Efficient Dense Layers
'''More efficient dense layers for DenseNets.
author: James Gilles.'''
import torch
from torch import nn, autograd
class RepeatedConcat(nn.Module):
'''Hack for faster DenseNets.
Allocates O(n) memory for n concatenated layers,
instead of O(n^2).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kazimuth
kazimuth / compile.sh
Created April 4, 2017 14:41
dumb cuda + Boost::Python example
nvcc -arch sm_61 -O3 -L/usr/local/lib -lboost_python -I/usr/include/python2.7/ -Xcompiler -fPIC --shared test_python.cu -o test_python.so
#!/bin/sh
echo "don't run this"
exit 1
git init
mv .git git
ln -s git .git
while true
do
@kazimuth
kazimuth / lib.rs
Created January 16, 2017 00:01
peg issue
#![feature(plugin)]
#![plugin(peg_syntax_ext)]
extern crate peg;
#[derive(Debug, PartialEq, PartialOrd)]
pub enum NumericConstant {
U64(u64),
I64(i64),
F64(f64),
@kazimuth
kazimuth / README.md
Created October 25, 2016 06:23
Cruftmas

This python2 program reads in a csv of kerberoses (i.e. from Google Docs), creates a gift-giving chain, and sends cruftmas emails. The CSV should include column headings (i.e. Kerberos, Time, etc.) so that you can choose the correct heading. It asks for your athena password so that it can log into the MIT SMTP server and send the emails; it can also dump a list of assignments for you to send yourself.