Skip to content

Instantly share code, notes, and snippets.

View qxcv's full-sized avatar

Sam Toyer qxcv

View GitHub Profile
@qxcv
qxcv / unblur.m
Last active December 8, 2015 04:02
Applying a small kernel to an image to reduce blurriness.
% Demo of a basic filter for deblurring an image
% Grab image
img_url = 'http://www.artwallpaperhi.com/thumbnails/detail/20121017/sand%20macro%20blurred%201920x1200%20wallpaper_www.artwallpaperhi.com_77.jpg';
img = imread(img_url);
img = single(img) / 255;
% Apply convolution. Play around with the filter matrix if you're curious.
filter = [-1 -1 -1; -1 9 -1; -1 -1 -1];
result = zeros(size(img));
@qxcv
qxcv / index.html
Last active August 29, 2015 14:20
MU0 assembler in Javascript
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>MU0 assembler</title>
<style>
body {
font-family: sans-serif;
@qxcv
qxcv / tikzmagic.py
Last active August 29, 2015 14:18
tikzmagic.py for Py3K
# -*- coding: utf-8 -*-
"""
=========
tikzmagic
=========
Magics for generating figures with TikZ.
.. note::
@qxcv
qxcv / Makefile
Last active August 29, 2015 14:00
comp2300 a2 automatic tester
CXXFLAGS=-std=gnu++11 -Os -Wall -Wextra
URL=http://cs.anu.edu.au/courses/COMP2300/rpeanut/rPeANUt2.3.jar
.PHONY: all
all: autogen reference rPeANUt2.3.jar
chmod +x autotest
@echo "Build complete"
autogen: autogen.cpp
$(CXX) $(CXXFLAGS) autogen.cpp -o autogen
@qxcv
qxcv / gollyconvert.py
Created March 22, 2014 08:45
Script to convert from .bmp wireworlds to Golly wireworlds
#!/usr/bin/python2
from os.path import basename
from subprocess import PIPE, Popen, check_output
from sys import argv, exit, stdout, stderr
from re import compile
USAGE = "USAGE: {0} input.bmp|input.rle > output.rle|output.bmp\n".format(argv[0])
RLE_HEADER = "x = {x}, y = {y}, rule = WireWorld\n"