This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from bs4 import BeautifulSoup | |
# Read in wheat production ----- | |
wheat = {} | |
reader = csv.reader(open('aw98.csv'), delimiter=",") | |
#file has four lines of headers | |
next(reader, None) | |
next(reader, None) | |
next(reader, None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
# Read in wheat production ----- | |
wheat = {} | |
reader = csv.reader(open('psd_grains_pulses.csv'), delimiter=",") | |
#first line is the header | |
next(reader, None) | |
for row in reader: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Buffers | |
Exercise 1 | |
Create buffer 100 bytes | |
ill it with 0 to 99 | |
*/ | |
var buffer1 = new Buffer(100); | |
for(var i=0; i<buffer1.length;i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Part 1 Stream adventure | |
*/ | |
console.log("beep boop"); | |
/* | |
Part 2 Meet Pipe | |
*/ | |
var fs = require('fs'); | |
fs.createReadStream(process.argv[2]).pipe(process.stdout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
uppercase everything | |
*/ | |
module.exports = function(input) { | |
return input.toString().toUpperCase(); | |
} | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Fair Division Program | |
This is a program for dividing up items between people people. | |
So the minimum satisfaction of any of them is maximised. */ | |
param people, integer,> 0; | |
/* number of people dividing stuff */ | |
param divi, integer, >= 0; | |
param indiv, integer, >= 0; | |
/* number of items to be divided. divi divisible. indiv non divisible */ | |
set I:= 1..people; | |
/* set of people */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
county population pop | |
Carlow 54 54000 | |
Cavan 73 73000 | |
Clare 117 117000 | |
Cork 519 519000 | |
Donegal 161 161000 | |
Dublin 1273 1273000 | |
Galway 250 250000 | |
Kerry 145 145000 | |
Kildare 210 210000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<canvas id="myCanvas" width="1000" height="1000" | |
style="border:1px solid #d3d3d3;"> | |
Your browser does not support the HTML5 canvas tag.</canvas> | |
<script> | |
var c = document.getElementById("myCanvas"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Twitter now allows 10k characters in a direct message | |
#Below is the linux commands to convert Moby dick into | |
#1432 10k long direct messages | |
#It strips the Gutenberg header and footer as reading those would be odd | |
wget http://www.gutenberg.org/cache/epub/2701/pg2701.txt | |
sed '21745,22109d' mb.txt > mb-ft.txt | |
sed '1,537d' mb-ft.txt > mb-tr.txt | |
mkdir moby10k | |
split -b 10000 mb-tr.txt moby10k/ |
OlderNewer