Skip to content

Instantly share code, notes, and snippets.

@westurner
westurner / broadband_cap.py
Last active August 29, 2015 13:57
Calculate time to reach broadband cap with specified bandwidth speeds
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
from __future__ import division
"""
broadband_cap
==============
Calculate time to reach broadband cap with specified bandwidth speeds
Usage::
@edsu
edsu / list2.py
Last active August 29, 2015 14:10
#!/usr/bin/env python
import json
import rdflib
from rdflib.plugin import register, Parser, Serializer
register('json-ld', Serializer, 'rdflib_jsonld.serializer', 'JsonLDSerializer')
ex = rdflib.Namespace("http://example.com/ns#")
g = rdflib.ConjunctiveGraph()
#!/bin/sh
## newtab.sh -- newtab(), newwin() functions and osascripts for OSX Terminal
## src: https://stackoverflow.com/questions/7171725/open-new-terminal-tab-from-command-line-mac-os-x/12147804#12147804
## license: Creative Commons cc by-sa 3.0
function newtab {
# newtab() -- Open a new tab in the current Terminal window and
# optionally run a command.
# When invoked via a function named 'newwin', opens a new Terminal *window* instead.
@niklasl
niklasl / schemaorg_to_jsonldcontext.py
Last active December 30, 2015 19:19
Generates a JSON-LD Context for Schema.org.
from rdflib import *
SDO = Namespace("http://schema.org/")
datatype_coerce_map = {
#SDO.Number: XSD.double,
SDO.Date: 'xsd:date',
SDO.DateTime: "xsd:dateTime",
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jamesvg
jamesvg / init.js
Last active September 1, 2016 16:09
jQuery(document).ready(function($){
var body = $(document.body);
body.on('click', 'a[rel~="external"], a[target="_blank"]', function(e) {
e.preventDefault();
var destination = window.open();
destination.opener = null;
destination.location = this.href;
return false;
});
});
@bollwyvl
bollwyvl / nb4.context.jsonld
Last active September 6, 2016 15:40
JSON-LD Context for IPython
{
"@context": {
"@vocab": "http://ipython.org/nbformat/v4/",
"nb4": "http://ipython.org/nbformat/v4/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"foaf": "http://xmlns.com/foaf/0.1/",
"language": {"@type": "@id"},
"codemirror_mode": {"@type": "@id"},
@hrj
hrj / calib.sh
Created September 14, 2013 11:28
Script to add red tint to the entire screen.
#!/bin/bash
# Call with a percentage value from 0 to 100
# 0 means only red, 50 means half of green and blue is shown through
# if you don't give any arguments the calibration is cleared
if [[ -z "$1" ]]; then
echo Clearing all calibrations
xcalib -clear
else
@westurner
westurner / ordereddefaultdict.py
Created February 12, 2016 22:14
OrderedDefaultDict_.py
#!/usr/bin/env python
"""
ordereddefaultdict.OrderedDefaultDict
.. code:: bash
$ python ./ordereddefaultdict.py -t
$ nosetests ./ordereddefaultdict.py
$ py.test ./ordereddefaultdict.py
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.imageio.ImageIO;
import java.net.*;
/**