Skip to content

Instantly share code, notes, and snippets.

@diazona
diazona / loader-trainer-multiprocess.py
Last active December 11, 2017 07:12
Simple example of multiprocessing
import torch.multiprocessing as tmp
N_MINIBATCHES = 10
def load_minibatches(q):
for i in range(N_MINIBATCHES):
# load minibatch i
q.put(minibatch)
q.close()
@diazona
diazona / obama-coverage-analysis.ipynb
Last active April 3, 2017 19:09
Obama coverage analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diazona
diazona / qratings.ipynb
Last active August 27, 2016 10:54
Data informing the Physics SE homework policy update
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diazona
diazona / df.csv
Last active March 18, 2017 08:50
Data on Twitter activity collected while I was tweeting for @RealScientists
We can't make this file beautiful and searchable because it's too large.
,Event,Time,Associated Time,Associated ID,Source,Target
0,favorite,2016-08-15 23:51:55,2016-08-15 18:21:14,7.652520240530104e+17,ellipsix,realscientists
1,tweet,2016-08-15 23:54:39,2016-08-15 23:54:39,7.653359291961221e+17,realscientists,
2,reply,2016-08-15 23:55:01,,7.653359291961221e+17,realscientists,realscientists
3,favorite,2016-08-15 23:56:01,2016-08-15 23:55:01,7.653360206068531e+17,jenburgessart,realscientists
4,favorite,2016-08-15 23:58:46,2016-08-15 23:55:01,7.653360206068531e+17,Die_Primel,realscientists
5,retweet,2016-08-15 23:59:26,2016-08-15 23:54:39,7.653359291961221e+17,FreelanceSciWri,realscientists
6,retweet,2016-08-15 23:59:27,2016-08-15 23:55:01,7.653360206068531e+17,FreelanceSciWri,realscientists
7,favorite,2016-08-16 00:08:07,2016-08-15 23:54:39,7.653359291961221e+17,HawkFiction,realscientists
8,retweet,2016-08-16 00:11:22,2016-08-15 19:00:05,7.652618008332165e+17,jsimons_uoa,EcologyOfShane
@diazona
diazona / impossibleproblem.py
Last active March 25, 2016 17:24
Code review of composing valid subtractions
from math import trunc
def solver(number, number2, numberofdigits):
seq = str(number),str(number2), str(number - number2)
digits = "".join(seq)
goodChecks = 0
count= numberofdigits/3
for i in range(1,10):
if digits.count(str(i)) == count:
goodChecks += 1
@diazona
diazona / Pipfile
Last active August 30, 2025 05:27
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
tvnamer = "*"
[dev-packages]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diazona
diazona / category_map_test.cpp
Last active August 29, 2015 14:17
Program producing error
#include <list>
#include <map>
#include <string>
#include <stdexcept>
#include <iostream>
using std::cerr;
using std::cout;
using std::endl;
using std::ostream;
#include <muParser.h>
#include <iostream>
#include <functional>
#include <boost/bind.hpp>
struct MyClass {
double m_arbitrary_value;
MyClass(int arbitrary_value) : m_arbitrary_value(arbitrary_value) {}
double make_a_value(double a, double b) {return m_arbitrary_value*a+b;}
};
@diazona
diazona / cvdatabase.cls
Created November 6, 2012 12:56
CV LaTeX class
% cvdatabase.cls
% Copyright 2012 David Zaslavsky
% Based on resume.cls, copyright 2005 Daniel Burrows
%
% You may use, modify, and redistribute this file in any way you please, so
% long as this copyright notice is maintained.
% A work in progress
\NeedsTeXFormat{LaTeX2e}