Skip to content

Instantly share code, notes, and snippets.

@gosko
gosko / dt
Last active January 30, 2022 21:50
dt - display current date/time in various time zones
#!/bin/bash
#
# dt: display useful date/time info incl current time in various time zones
#
# Any optional extra args are passed along to 'date'.
#
# usage examples:
#
# $ dt
# $ dt --date '3 hours ago'
@vincent-zurczak
vincent-zurczak / Validator.java
Last active September 26, 2021 18:50
HTML 5 validation in Java (based on the Nu HTML Checker)
/**
* Verifies that a HTML content is valid.
* @param htmlContent the HTML content
* @return true if it is valid, false otherwise
* @throws Exception
*/
public boolean validateHtml( String htmlContent ) throws Exception {
InputStream in = new ByteArrayInputStream( htmlContent.getBytes( "UTF-8" ));
ByteArrayOutputStream out = new ByteArrayOutputStream();
@bxt
bxt / proxy.py
Last active August 30, 2020 15:57
A very basic caching python HTTP proxy server.
# Originally from http://sharebear.co.uk/blog/2009/09/17/very-simple-python-caching-proxy/
#
# Usage:
# A call to http://localhost:80000/example.com/foo.html will cache the file
# at http://example.com/foo.html on disc and not redownload it again.
# To clear the cache simply do a `rm *.cached`. To stop the server simply
# send SIGINT (Ctrl-C). It does not handle any headers or post data.
import BaseHTTPServer
import hashlib
@tylor
tylor / Procfile
Created December 7, 2012 20:29
Quick node.js HTTP proxy on Heroku
web: node index.js

Room Rules


1. Speak English!

2. Don't be a dick!

@henare
henare / mw-to-gollum.rb
Created March 10, 2011 02:41
Imports a MediaWiki XML export into a Gollum wiki
#!/usr/bin/env ruby
require 'rubygems'
require 'hpricot'
require 'gollum'
wiki = Gollum::Wiki.new('openaustralia.wiki')
file = File.open("OpenAustralia-20110309232515.xml", "r")
doc = Hpricot(file)