Skip to content

Instantly share code, notes, and snippets.

@perey
perey / svg-test.html
Created May 10, 2014 14:04
Test case for generating, viewing and saving SVG client-side in HTML+JS.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8"/>
<title>SVG Generator</title>
<style type="text/css">
figure {
width: 45%;
float: right;
}
@perey
perey / codegolf_stars.py
Created July 16, 2015 08:02
"The Colors in Our Stars" Code Golf Challenge
#!/usr/bin/env python3
"""Pretty star picture maker.
This is the ungolfed version.
http://codegolf.stackexchange.com/questions/53124/the-colors-in-our-stars
"""
from collections import namedtuple
@perey
perey / rectangle_tests.json
Last active August 29, 2015 14:25
Test data for reddit dailyprogrammer's Challenge #224 [Intermediate]
[
{"name": "the example",
"diagram": [
" +----+",
" | |",
"+-------------------------+-----+----+",
"| | | |",
"| +-------------------+-----+ |",
"| | | | |",
"| | | | |",
@perey
perey / challenge224hard.py
Last active August 29, 2015 14:25
Langford sequence coding challenge
#!/usr/bin/env python3
"""Daily Programmer Challenge #224 [Hard] Langford Strings
https://www.reddit.com/r/dailyprogrammer/
"""
from string import ascii_uppercase
from copy import copy
@perey
perey / fraction.chef
Last active August 29, 2015 14:26
Chef code for converting improper fractions to mixed numbers.
Fraction Dosa.
This recipe takes a numerator and denominator from STDIN and outputs the
mixed-number representation to STDOUT.
Ingredients.
2 cups numerator rice
2 cups denominator ukda chawal
1 cup whole part urad dal
10 teaspoons new line poha
@perey
perey / hexagonmake.py
Created September 18, 2015 10:04
Hexagon maker for "Beatles Songs and Hexagons" challenge
#!/usr/bin/env python3
"""Triangular code checker and hexagon builder.
http://codegolf.stackexchange.com/questions/58186/beatles-songs-and-hexagons
When run from the command line, this program accepts two filenames as
arguments. It will:
a) Check that they conform to the format specified in the challenge
b) Merge them into a hexagon and print the result to STDOUT
@perey
perey / esolang0815_examples.md
Last active December 15, 2015 11:44
0815 Interpreter

Hello World

The Esolang wiki version

<:48:x<:65:=<:6C:$=$=$$~<:03:+$~<:ffffffffffffffbd:+$<:ffffffffffffffb1:
+$<:57:~$~<:18:x+$~<:03:+$~<:06:x-$x<:0e:x-$=x<:43:x-$

Explanation

@perey
perey / paint_by_prog.py
Created January 14, 2016 10:27
Line-art painter
#!/usr/bin/env python3
"""Line-art painter."""
# Copyright © 2016 Timothy Pederick.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
@perey
perey / challenge_mondrian_results.txt
Last active December 20, 2016 17:01
Mondrian Puzzle in Piet
? 200
____________________________________________________________________________________________________
| |
| |
| |
| |
| |
| |
| |
| |
@perey
perey / nearest_stars.html
Last active September 17, 2021 13:26
3D Star Map
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>A star map</title>
<style>
html {
background-color: black;