Skip to content

Instantly share code, notes, and snippets.

@joao
joao / screenshot.js
Created May 16, 2015 18:34
Screenshots with Phantom.js
// SCREENSHOT WEBPAGES WITH PHANTOMJS
// USAGE: phantomjs screenshot.js http://webpage.com screenshot.png
// NOTES: use it in the command line
// WORKS: tested with PhantomJS, installed via Homebrew in OS X
// For passing args in the command line
var system = require('system');
var args = system.args;
Bas Ording (presentation at Doors of Perception 5, 1998)
ording@worldonline.nl
Bas Ording was born in 1973 in the Netherlands. In 1992 he started the four year course Interaction Design at the Utrecht School of the Arts. During the course he developed design skills as well as programming skills. In 1997 he graduated from the Master of Arts course in Interactive Multi Media, where he worked in a multidisciplinairy team on a CD-ROM for the Dutch Aids Foundation. From 1994 he worked as a freelance HCI-designer for various multimedia companies. This made for a nice balance between free-research and applied design. The projects varied from visual database representations to Shockwave games for the web, company presentations and interactive educational CD-ROMs. In most of the projects he was involved in both concept development as well as production. On an autonomous/experimental basis he develops prototypes and demos of new interface elements and styles. His work is focused at, what he calls `Dynamical User Inter
@joao
joao / temperature_scraper.rb
Created September 8, 2018 09:22
Scraper para tempo.pt
# Instruções:
# 1) correr 'gem install httparty' no terminal do macOS
# 2) actualizar o station_id com o ID da estação que se pretende do website tempo.pt
# 3) escolher o espaço temporal pretendido nas variáveis mais abaixo: start_date, end_date
# 4) correr 'ruby temperature_scraper.rb'
#
# É gerado um ficheiro temp_media, separado por ','
require 'httparty'
require 'date'
@joao
joao / style.css
Last active November 18, 2018 15:41
old Gmail stylesheet
/* Hide Gmail logo */
#gb > div.gb_Ld.gb_je.gb_Td > div.gb_Dc.gb_5d.gb_Je {
visibility: hidden;
}
/* Hide side panel */
body > div:nth-child(17) > div.nH > div > div.nH.bkL > div.no > div.nH.bAw.nn.it > div.brC-dA-I-Jw {
@joao
joao / memory_usage.py
Created December 20, 2018 18:44
Check memory usage on Webfaction (or any server)
#!/usr/local/bin/python2.5
import subprocess
import sys
import re
import os,pwd
from pprint import pprint
class TerminalController:
"""
@joao
joao / data.json
Created September 20, 2019 21:33
Candidatos
{
"dias": ["2013-01-01", "2013-01-02", "2013-01-03", "2013-01-04", "2013-01-05", "2013-01-06"],
"ps": [140, 150, 200, 120, 150, 160],
"ps_area": [[150, 140, 110], [200, 150, 115], [300, 200, 50], [135, 120, 110], [180, 150, 130], [199, 160, 125] ],
"s-catolica-ps": [200, null, null, 400, 450]
}
@joao
joao / report
Created October 4, 2019 16:08
Coconut battery crash on launch on macOS 10.14
Process: coconutBattery [60898]
Path: /Applications/coconutBattery.app/Contents/MacOS/coconutBattery
Identifier: com.coconut-flavour.coconutBattery
Version: 3.8.1 (3.8.1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: coconutBattery [60898]
User ID: 501
Date/Time: 2019-10-04 17:06:15.148 +0100
@joao
joao / base2ocds_corrector.rb
Last active December 14, 2019 11:28
base2ocds_corrector.rb
open('base2ocds_corrected.json', 'a') do |f|
f << '['
File.readlines('./base2ocds.json').each_with_index do |line, index|
puts index + 1
f << line + ','
end
f << ']'
end
@joao
joao / index.html
Last active February 4, 2020 21:46
RR test
<style type="text/css">
h1 {
font-family: sans-serif;
color: pink;
cursor: pointer;
font-size: 36px;
}
@joao
joao / info.txt
Created March 3, 2020 12:17
urgencias
endpoint:
POST https://wabi-north-europe-api.analysis.windows.net/public/reports/querydata?synchronous=true
request body:
{"version":"1.0.0","queries":[{"Query":{"Commands":[{"SemanticQueryDataShapeCommand":{"Query":{"Version":2,"From":[{"Name":"r","Entity":"REDE_URGENCIA_MONIT__AGR_DIA_URG"}],"Select":[{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"Data"},"Name":"REDE_URGENCIA_MONIT__AGR_DIA_URG.Data"},{"Aggregation":{"Expression":{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"Total epis. urg."}},"Function":0},"Name":"Sum(REDE_URGENCIA_MONIT__AGR_DIA_URG.Total epis. urg.)"}],"Where":[{"Condition":{"Comparison":{"ComparisonKind":2,"Left":{"Column":{"Expression":{"SourceRef":{"Source":"r"}},"Property":"ano"}},"Right":{"Literal":{"Value":"2016D"}}}}}]},"Binding":{"Primary":{"Groupings":[{"Projections":[0,1]}]},"DataReduction":{"DataVolume":4,"Primary":{"BinnedLineSample":{}}},"Version":1}}}]},"CacheKey":"{\"Commands\":[{\"SemanticQueryDataShapeCommand\":{\"Query\":{\"Version