Skip to content

Instantly share code, notes, and snippets.

@NicolaiSoeborg
NicolaiSoeborg / smittestop-scrape.py
Created November 17, 2020 23:11
Scrape smittestop status
import re
import time
import httpx
URL = "https://smittestop.dk/status/"
r = httpx.get(URL)
assert r.status_code == 200, f'{r.status_code}: {r.content}'
@FrankGrimm
FrankGrimm / nodepost-1.js
Created November 9, 2010 15:31
HTTP body in node.js
var http = require('http');
http.createServer(function (req, res) {
// set up some routes
switch(req.url) {
case '/':
console.log("[501] " + req.method + " to " + req.url);
res.writeHead(501, "Not implemented", {'Content-Type': 'text/html'});
res.end('<html><head><title>501 - Not implemented</title></head><body><h1>Not implemented!</h1></body></html>');
break;
@FrankGrimm
FrankGrimm / na-sample.js
Created July 29, 2010 23:47
Abbreviation for command line parameters in node.js
// Example code for node-abbrev
var abbrevlib = require("node-abbrev");
var sys = require("sys");
// valid run modes for the imaginary tool
var validModes = ["help", "start", "stop", "status"];
// create Abbreviate instance for the modes
// second parameter (case sensitivity) optional, defaults to false
var abbrev = new abbrevlib.Abbreviate(validModes);