Skip to content

Instantly share code, notes, and snippets.

View Pet3ris's full-sized avatar
🎯
Focusing

Peteris Erins Pet3ris

🎯
Focusing
View GitHub Profile
@Pet3ris
Pet3ris / camweather.pl
Created May 5, 2011 19:14
Perl Cambridge (DTG rooftop http://www.cl.cam.ac.uk/research/dtg/weather/) weather data retreiver
#!/usr/bin/perl
# Usage
# camweather
# camweather Wind speed
# ..etc.
use LWP::Simple;
# Get raw RSS and beautify
@Pet3ris
Pet3ris / lightbox.c
Created May 16, 2011 20:19
Solutions to lightbox entry question
// This one will probably take up linear stack size in most compilers although it shouldn't
f(int n,int*a){return n-1?n-*a+f(n-1,a+1):1;}
@Pet3ris
Pet3ris / mytrie.rb
Created May 21, 2011 12:44
A simple trie
module Spellchecker
class Trie
attr_reader :kids
attr_accessor :terminal
def initialize()
@kids = Hash.new
@terminal = false
end
@Pet3ris
Pet3ris / LICENSE.txt
Created May 24, 2011 11:06 — forked from 140bytes/LICENSE.txt
Y combinator in 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Peteris Erins http://peteriserins.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Pet3ris
Pet3ris / LICENSE.txt
Created May 25, 2011 19:36 — forked from 140bytes/LICENSE.txt
Generate Normally Distributed Random Variable
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Peteris Erins http://peteriserins.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Pet3ris
Pet3ris / README
Created May 30, 2011 19:33
C++ FOR macro
Old macro for use in programming competitions. Iterates over numbers and iterators, choosing the right comparison for each range.
@Pet3ris
Pet3ris / skiplist.cpp
Created May 31, 2011 12:47
Old skip list implementation
#include <cstdio>
#include <cstdlib>
#include <set>
using namespace std;
const int N = 10000000;
const int maxLevel = 20;
@Pet3ris
Pet3ris / project.properties
Created June 15, 2011 18:03
Jekyll + HTML5 boilerplate build script config to include all posts
file.pages = {% for post in site.posts %}{{ post.url | replace_first: '/', '' }},{% endfor %}index.html, 404.html
nd_merge xs ys
| choice == 1 && xs == [] = ys
| choice == 2 && ys == [] = xs
| choice == 1 = (head xs):nd_merge (tail xs) ys
| otherwise = (head ys):nd_merge xs (tail ys)
where choice = amb (seq xs 1) (seq ys 2)
@Pet3ris
Pet3ris / README.md
Created August 18, 2011 18:01
arrowmania

arrowmania

A copy and improvement (with appropriate Unicode characters inserted) of a deleted Project Fortress (programming language) wiki entry describing conventions for converting unicode arrows to valid ASCII operators.

The document was originally created by members of the Project Fortress community, I am only copying it here as it might be of interest for other programmers.