Skip to content

Instantly share code, notes, and snippets.

@phreeza
phreeza / test_conv_reg.py
Created June 12, 2015 17:27
Test the regularisation parameter on the convolutional Layer for keras
# Test the regularisation parameter on the convolutional Layer
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.convolutional import Convolution2D
from keras.layers.core import Dense,Flatten
from keras.utils import np_utils
from keras.regularizers import l2
import numpy as np
I’ve created 2 mailing lists for people to keep in touch.
[http://groups.google.com/group/cells-game-users]
[http://groups.google.com/group/cells-game-devs]
from random import random
while True:
#keep my room warm
i = random()
@phreeza
phreeza / himawari-8.py
Last active January 27, 2016 10:18 — forked from jarmitage/himawari-8.py
Himawari-8 Wallpaper Bot: Fresh images of the whole Earth from space, every 10 minutes
import urllib
import datetime as dt
from datetime import timedelta
import pytz
from PIL import Image
import numpy as np
import subprocess
import socket
import os

Keybase proof

I hereby claim:

  • I am phreeza on github.
  • I am tmco (https://keybase.io/tmco) on keybase.
  • I have a public key whose fingerprint is CD4C 0BFB 64C8 D681 4227 561E 5924 70A9 0C46 A0EE

To claim this, I am signing this object:

@phreeza
phreeza / scalebars.py
Created March 6, 2016 18:31 — forked from dmeliza/scalebars.py
matplotlib: add scale bars to axes
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# Adapted from mpl_toolkits.axes_grid2
# LICENSE: Python Software Foundation (http://docs.python.org/license.html)
from matplotlib.offsetbox import AnchoredOffsetbox
class AnchoredScaleBar(AnchoredOffsetbox):
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4,
pad=0.1, borderpad=0.1, sep=2, prop=None, **kwargs):
"""
@phreeza
phreeza / ocv_median_example.cpp
Created July 19, 2012 09:50
OpenCV DynamicImager example
#include <iostream> // for standard I/O
#include <string> // for strings
#include <iomanip> // for controlling float print precision
#include <sstream> // string to number conversion
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
#include <mtip.h>
int ocvMedianBlurMDF(HMTIPMOD hMod)
@phreeza
phreeza / wedding.py
Last active July 2, 2016 16:43
A small terminal based animation I made for a friend's wedding
# This script is released 'as is' into the public domain
from math import cos,sin
import os
from time import sleep
def y(p):
return (sin(p)**3)
def x(p):
return -(13*cos(p)-5*cos(2*p)-2*cos(3*p)-cos(4*t))/16
while True:
for r in range(14):
import glob
entries = []
for n,fname in enumerate(glob.glob('/Users/tom/Downloads/data/*/*.txt')):
f = open(fname)
s = f.readlines()
x = [g.split('\t') for g in ' '.join(s).strip().split('\n ----------\n')][:-1]
if n%1000 == 0:
print n,fname
for raw_entry in x:
@phreeza
phreeza / embeddings.tsv
Created January 27, 2017 11:47
arxiv embeddings
We can't make this file beautiful and searchable because it's too large.
0.871428 0.818533 0.616601 -0.896398 0.750342 -0.0670242 -0.985361 -0.901136 -0.799989 0.661025 0.896552 -0.999996 -0.815607 -0.999946 0.210674 -0.795743 -0.936592 0.984476 0.415128 -0.640509 0.934588 0.483844 0.399479 0.215688 -0.992214 0.324514 0.454484 -0.800055 -0.999993 0.788731 -0.28611 -0.0720174 0.0251022 0.588688 0.598253 0.857084 0.999794 -0.953029 -0.865772 -0.289119 0.999546 -0.709774 -0.415915 0.0922971 -0.997911 -0.108204 -0.999999 -0.414267 -0.799834 -0.0698598 0.572549 0.410644 -0.790586 0.293573 0.999865 -0.476083 -0.678337 -0.662886 -0.999999 -0.136961 0.70228 0.05713 -0.96455 -0.715666 0.996947 -0.777469 0.999629 0.887067 0.506511 -0.691616 0.676756 -0.918784 0.835962 0.451829 -0.801001 0.0379395 0.999999 -0.096177 -1.0 0.977844 -0.771265 0.999997 0.97939 0.19234 -0.641295 -0.0612696 0.916226 0.447681 -0.651528 -0.844617 -0.661612 0.413032 0.989486 -0.897041 -0.685231 -0.335238 0.302788 -0.710447 -0.42624 0.914872 -0.312054 0.156264 0.983085 0.925359 0.916282 0.283454 0.371099 0.0488607 0.3