Skip to content

Instantly share code, notes, and snippets.

View tommorris's full-sized avatar

Tom Morris tommorris

View GitHub Profile
@tommorris
tommorris / gist:33457
Created December 8, 2008 14:01
the beginnings of a script to run atjobs anacronically.
atjobs = `atq`.split('\n').collect {|j| j = j.split }
atjobs.each do |job|
if ((Chronic.parse(job[1..5].join(' ')) - Time.now) < 0) # returns true if time in past
`at -c #{job.first} > /tmp/newjob`
`sudo #{job.last} sh /tmp/newjob`
`atrm #{job.first}`
`rm /tmp/newjob/`
end
end
#!/usr/bin/env ruby
require 'xmlrpc/client'
# USERNAME
username = ""
# PASSWORD
password = ""
# DOMAIN - of the style tommorris.org
domain = ""
# XMLRPC PATH
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
Subsystem: Acer Incorporated [ALI] Device 015b
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin A routed to IRQ 16
Region 0: Memory at 38540000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
[Dialer Defaults]
Phone = *99***1#
Username = guest
Password = guest
Stupid Mode = 1
Dial Command = ATDT
Modem = /dev/ttyUSB0
Baud = 460800
Init2 = ATZ
Init3 = ATE0V1&D2&C1S0=0+IFC=2,2
" Wikipedia syntax file for Vim
" Published on Wikipedia in 2003-04 and declared authorless.
"
" Based on the HTML syntax file. Probably too closely based, in fact. There
" may well be name collisions everywhere, but ignorance is bliss, so they say.
"
" To do: plug-in support for downloading and uploading to the server.
if !exists("main_syntax")
if version < 600
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix libris: <http://libris.kb.se/vocabulary/experimental#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
<http://libris.kb.se/resource/bib/5116955> rdfs:isDefinedBy <http://libris.kb.se/data/bib/5116955> .
<http://libris.kb.se/resource/bib/5116955> rdf:type bibo:Book .
<http://libris.kb.se/resource/bib/5116955> dc:title "Naming and necessity"@en .
<http://libris.kb.se/resource/bib/5116955> dc:creator "Kripke, Saul A., 1940-" .
# to see the results, go to http://is.gd/iVrH
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?city ?pop ?name
WHERE {
?city a <http://dbpedia.org/ontology/PopulatedPlace> .
{ ?city <http://dbpedia.org/property/populationEstimate> ?pop . } UNION { ?city <http://dbpedia.org/ontology/populationTotal> ?pop . }
?city <http://dbpedia.org/property/name> ?name .
# dbpedia lists fictional locations as PopulatedPlace
@tommorris
tommorris / gist:61066
Created February 9, 2009 22:22
Get a list of street names in London
# run at http://dbpedia.org/sparql
# see results at http://is.gd/iXQL
# based on a challenge by delineator - http://twitter.com/delineator/statuses/1192393684
SELECT DISTINCT ?street ?name
WHERE {
?level <http://www.w3.org/2004/02/skos/core#broader> <http://dbpedia.org/resource/Category:Streets_in_London> .
?street <http://www.w3.org/2004/02/skos/core#subject> ?level .
OPTIONAL
{ ?street <http://www.w3.org/2000/01/rdf-schema#label> ?name .
@tommorris
tommorris / gist:61467
Created February 10, 2009 17:05
lottery picker
(1..49).to_a.sort_by{ rand }.slice(0..6).sort
@tommorris
tommorris / gist:68628
Created February 22, 2009 21:55
Ruby en subtype detector
# a simple, ruby, regex-based EN subtype detector
# backstory: I spend a ridiculous amount of time editing text that's written in a
# variety of American and British English, to the point where it ends up screwing with my
# head and I get funny looks from my fellow Brits for writing American words.
# I wrote this so that I could pipe text I'm working on in Vim to it so I can see quickly
# which variant it's in.
def en_gb_or_us (text)
# compiled from https://wiki.ubuntu.com/EnglishTranslation/WordSubstitution