Skip to content

Instantly share code, notes, and snippets.

View reinvented's full-sized avatar

Peter Rukavina reinvented

View GitHub Profile
@reinvented
reinvented / charging-stations-pei.geojson
Last active May 13, 2019 17:53
Electric Vehicle Charging Stations on Prince Edward Island as of May 13, 2019 (from https://developer.nrel.gov/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinvented
reinvented / harvest-hansard.py
Created December 7, 2018 19:44
Python script to harvest Prince Edward Island Legislative Assembly Hansard PDFs and convert them to ASCII text files
#!/usr/bin/env python
# You may need to do these:
#
# sudo pip install lxml
# sudo pip install requests
# sudo pip install pdfminer
from lxml import html
import requests
@reinvented
reinvented / hansard-to-csv.php
Created December 7, 2018 19:22
A PHP script to convert text files of Prince Edward Island Hansard to a CSV
<?php
$files = popen('find ./documents -name "*.txt"', 'r');
$out = fopen('hansard.csv', 'w');
fwrite($out, "date,text,speaker\n");
while (!feof($files)) {
$filename = chop(fgets($files, 4096));
$date = basename($filename);
@reinvented
reinvented / ruklinks.json
Last active July 9, 2018 19:49
Links between blog posts on ruk.ca
@reinvented
reinvented / blog-posts-by-week.sh
Last active June 23, 2018 19:55
Count the number of blog posts per week in Ton's blog
export LC_ALL=C
curl -s https://www.zylstra.org/blog/feed/ | \
grep pubDate | \
sed -e 's/<pubDate>//g' | \
sed -e 's/<\/pubDate>//g' | \
while read -r line ; do
date -j -f "%a, %d %b %Y %T %z" "$line" "+%V"
done | \
sort -n | \
uniq -c
@reinvented
reinvented / calculate-payroll.scpt
Created February 26, 2017 19:12
JXA Scripting of Numbers.app, using AJAX to calculate payroll deductions from a remote PHP script
Numbers = Application('Numbers');
Numbers.includeStandardAdditions = true
var table = Numbers.documents[0].sheets[0].tables[0]
var selectedRow = table.selectionRange().cells[0];
var hoursCellRow = selectedRow.row().address();
var weekEndingCell = table.ranges["B" + hoursCellRow + ":B" + hoursCellRow].cells[0];
var nameCell = table.ranges["C" + hoursCellRow + ":C" + hoursCellRow].cells[0];
@reinvented
reinvented / camino-with-waypoints.geojson
Last active April 27, 2020 19:18
Camino Frances walking route with overnight waypoints
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinvented
reinvented / caminofrances.geojson
Last active February 14, 2017 16:23
Route map of a walk of the Camino Frances
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinvented
reinvented / caminofrances1.geojson
Last active February 10, 2017 18:46
St Jean to Larrosaona of the Camino Frances
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinvented
reinvented / pdoc.php
Last active May 7, 2024 12:49
Automating the use of Canada Revenue's Payroll Deductions Online Calculator in PHP
<?php
/**
* get-pdoc.php - Scrape Canada Revenue Agency payroll deductions values
*
* This script takes an hourly amount, a number of hours, and a year,
* month and day of a pay period ending, and passes these to the
* Canada Revenue Agency Payroll Deductions Online Calculator
* (https://www.canada.ca/en/revenue-agency/services/e-services/e-services-businesses/payroll-deductions-online-calculator.html),
* returning the provincial tax, federal tax, CPP and EI amounts.
*