Skip to content

Instantly share code, notes, and snippets.

View iandioch's full-sized avatar
Ag déanamh tada

Noah Ó Donnaile iandioch

Ag déanamh tada
View GitHub Profile
@iandioch
iandioch / average_colour.pde
Created October 2, 2015 16:24
Finds the average of a number of colours. Makes interesting palettes.
color a = color(255, 152, 145);
color b = color(52, 81, 255);
void setup(){
size(500,500);
}
void draw(){
fill(a);
noStroke();
@iandioch
iandioch / corpus_cleaner.py
Created November 26, 2015 05:43
Grabs just the tweet text from sentiment140 tweet corpus and discards the noise
# loads the CSV corpus file from the links here (http://help.sentiment140.com/for-students) and outputs just the tweet text
lines = []
with open("testdata.manual.2009.06.14.clean.txt", "w") as outfile:
with open("testdata.manual.2009.06.14.csv", 'r') as infile:
lines = infile.readlines()
for line in lines:
bits = line.split(",")
text = ",".join(bits[5:]).replace("&amp;", "&").replace("&lt;", "<").replace("&gt;", ">")
text = text[1:-2]
@iandioch
iandioch / permute.go
Created December 30, 2015 04:00
Basic permutation functions for Ints and Bytes in Go
// to use these functions, place this file in ./permute/permute.go and import "./permute"
// uses the "recursive algorithm" method from here: http://www.cut-the-knot.org/do_you_know/AllPerm.shtml
package permute
var level int
var value []int
var N int
var num int
var intPerms [][]int
var bytePerms [][]byte
@iandioch
iandioch / modulus_rules.md
Last active February 13, 2016 04:13
Arithmetic rules with modulus

Addition

(a + b) % n = ((a % n) + (b % n)) % n

Multiplication

(a * b) % n = ((a % n) * (b % n)) % n

Division

Keybase proof

I hereby claim:

  • I am iandioch on github.
  • I am iandioch (https://keybase.io/iandioch) on keybase.
  • I have a public key whose fingerprint is 4874 78D2 5F43 05D7 7770 FC4B 419C A3B3 F48E 4E60

To claim this, I am signing this object:

@iandioch
iandioch / kattis_cpssd.py
Last active April 7, 2017 03:12
Measure CPSSD's contributions to Ireland's score on open.kattis.com
#!/usr/bin/python3
# adapted from code at https://github.com/iandioch/ceres/
import json
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
cpssds = set([
'Noah Ó Donnaile',
@iandioch
iandioch / kattis_dcu.py
Last active April 7, 2017 03:13
Measure DCU's contributions to Ireland's score on open.kattis.com
#!/usr/bin/python3
# adapted from code at https://github.com/iandioch/ceres/
import json
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
def is_dcu(c):
return c == 'Dublin City University'
@iandioch
iandioch / rotatedog.pde
Created April 30, 2017 20:45
rotatedog.pde
PImage dog;
final int NUM_DOGS = 5;
int iter = 0;
final int MAX_ITER = 64;
void setup(){
size(600, 600);
dog = loadImage("dog-mature-landing-hero.jpg");
}
@iandioch
iandioch / repeal8.pde
Created May 1, 2017 01:48
repeal8.pde
int iter = 0;
final int MAX_ITER = 120;
final String PHRASE = "Repeal";
final int TEXT_SIZE = 96;
void setup() {
size(600, 600);
frameRate(60);
background(0);
noStroke();
@iandioch
iandioch / advent09.in
Created December 9, 2017 18:48
Advent of code day 9 input
{{{{{<!!!>},<!e!!!'ue!o!!!>"oo<u!}<<{>},{{{}},{<!>},<'>,{<!!"!!!>"u!!!>!!!>,<"!>,<!>},<}!!}!!!>{>}},{{<"!>}}!'!!u!!!!e!!!>>}}}},{{{<!>>}},{{{<{{!!,>},{<u!!e'!>},<>}}},{<,o!!!""a!>},<!>},<<}>,{<!!!!,,!>,<!>},<"!!!>u>}}},{{{<}{!<{i!>>}},{{}},{{},<!>,<!>,<!>!!,<!!!!{}!!i>}}},{{},{{{}}},{{<ae{>,{}}},{{<!!!!">,<{'}!!},<!>a,!>!!!>{!!e>},{{<!ao!!i!'!>,<!!o>,<'e}!!!>!!!>e'!!u{>},<",'i!!!>{>},{<uai,!!{!>},<uu!!e>}}},{{{{{<!!,a!>>}}}},{},{{{{{{},{{<au<,!!iuu!!!!!>,<>}}},{<i!>,<!>},<!!'iu{!!o"{i,i}!{{>}},{},{{<a!>a"!!!!!>},<>,{<!!!>">}},{{{{<ae}a!!!!{!},u!!o<!!!">},{<!>,<!!!>!!!>},<ee<!'!>},<!!!>u"ae>},{<e'!!!>},<'e!>>}},{<u!>},<a!>!>i,u>,{<i,!!>}},{<'>}},{{<!ee!>},<!!!>!!!>>},<!!!>},<a!u>}}}},{{{{{}}},<!!!>>},{}}},{{{{<!>,<,,},,!>,<<!!!!<<!!<!!!!>}}},{{},{}},{{},{<o,!>},<!!}!,!>},<o!>uoa{<a!!,<a!>,<>}}},{{<'!>},<e!>>}},{{{<!>"<e!!!>}!!!>!>u<'i!!}'!!!>>},<ie!>a{!{>}}}},{{{{<{i<!>}e!>},<}!!,,!>},<!!aa!>a!!!>!,{>,{{<ii!>,<>},<{e!!!>"!!o!>,<'a!>},<u!>!>>}},{<!!!>"!>,<!<!>,<u!!!!i!>,<a!eeu!!!!!>!!e>}},{<i,}a!!{e>}},{{{<}eue