Skip to content

Instantly share code, notes, and snippets.

View siwells's full-sized avatar

Simon Wells siwells

View GitHub Profile
@siwells
siwells / Tkinter_hello_world.py
Created October 10, 2011 15:38
A Python GUI "Hello World" using Tkinter
from Tkinter import *
root = Tk()
w = Label(root, text="Hello World")
w.pack()
root.mainloop()
@siwells
siwells / gist:1114395
Created July 29, 2011 18:19
Use a regex to remove the font tags & their attributes from a page to undo highlighting applied using those self-same font tags
/*
* Clear the highlighting to allow the user to toggle
* between the original page & the highlighted page.
*/
function clearHighlighting()
{
alert("clearing hightlighting...");
if (!document.body || typeof(document.body.innerHTML) == "undefined") {
if (warnOnFailure) {
@siwells
siwells / gist:d0e8c60317cdd81286a1e80438cefc12
Created February 15, 2018 19:10
Morse Code Audio Example using Web Audio API
<!DOCTYPE html>
<html>
<meta charset="utf-8"/>
<head>
</head>
<body>
<button onclick="morseSounds();">Sound</button>
<script>
var context = null;
@siwells
siwells / targets.md
Last active November 16, 2017 09:12
Partly an aspirational list, partly an aide memoire for when I am trying to decide where to send a piece of work... This is a useful list of journals, conferences, and workshops series that are important in my area of Artificial Intelligence research. Because of overlap with pedagogic aspects of argumentation and dialogue systems, this list also…
@siwells
siwells / rot13.py
Created October 31, 2011 16:57
A little python rot13 coder
#!/usr/bin/python
from string import maketrans
rot13trans = maketrans('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm')
def rot13(text):
return text.translate(rot13trans)
def main():
@siwells
siwells / daterange.sh
Last active December 26, 2015 08:19
Shell script for Bash on OS X to generate a range of dates given a start date and an end date in the YYYY-MM-DD format.
#!/bin/bash
currentDateTs=$(date -j -f "%Y-%m-%d" $1 "+%s")
endDateTs=$(date -j -f "%Y-%m-%d" $2 "+%s")
offset=86400
while [ "$currentDateTs" -le "$endDateTs" ]
do
date=$(date -j -f "%s" $currentDateTs "+%Y-%m-%d")
echo $date
@siwells
siwells / SH.logs_accesses.total+unique.sh
Created October 23, 2013 16:31
Short script to process SUPERHUB log files to count the total number of access and the unique number of access to the application between the supplied dates.
#!/bin/bash
currentDateTs=$(date -j -f "%Y-%m-%d" $1 "+%s")
endDateTs=$(date -j -f "%Y-%m-%d" $2 "+%s")
offset=86400
while [ "$currentDateTs" -le "$endDateTs" ]
do
date=$(date -j -f "%s" $currentDateTs "+%Y-%m-%d")
searchstring="INFO | $date"
@siwells
siwells / hindex
Created May 17, 2013 16:34
A little script to retrieve and print my total number of citations, h-index, and i10 number from Google Scholar. Only prerequisite is BeautifulSoup which does the heavy lifting/HTML parsing.
import urllib2
from BeautifulSoup import BeautifulSoup
base_url = "http://scholar.google.co.uk/citations?"
link = "&"
lang = "en"
lang_str = "&hl=" + lang
user = "NJ4EZFwAAAAJ"
user_str = "user="+user
@siwells
siwells / dotastro_remote.ipynb
Created November 4, 2015 12:58 — forked from astrofrog/dotastro_remote.ipynb
Remote data access from Python - #dotastro - Day Zero
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.