Skip to content

Instantly share code, notes, and snippets.

View seanh's full-sized avatar

Sean Hammond seanh

View GitHub Profile
(DataError) invalid input syntax for type numeric: " " LINE 2: VALUES (' ', to_tsvector(' ')); ^ 'INSERT INTO "0b12b45b-32c0-4408-a8d8-2a17da72294d" ("value", "_full_text")\n VALUES (%s, to_tsvector(%s));' [(9750, '9750'), (9751, '9751'), (9752, '9752'), (9753, '9753'), (9754, '9754'), (9755, '9755'), (9756, '9756'), (9757, '9757') ... displaying 10 of 250 total bound parameter sets ... (9998, '9998'), (u' ', ' ')]
@seanh
seanh / Install.txt
Last active August 29, 2015 14:07
ckanext-deadoralive demo
pip install ckanext-deadoralive
Add deadoralive to ckan.plugins in config file
Create a user for the link checker
Add ckanext.deadoralive.authorized_users to config file
Restart CKAN
pip install deadoralive
deadoralive --url ... --apikey ...
Add cron job
" I manage my vim plugins using vundle:
"
" https://github.com/gmarik/vundle
"
" This file contains my vundle config settings, and also any
" plugin-specific config settings that won't work (and might
" cause vim to complain) if the plugins aren't installed.
"
" To install all the plugins (or any newly added plugins) on a new machine,
" do :BundleInstall in vim or on the command line:
@seanh
seanh / openbox_shutdown_window.py
Created September 2, 2013 21:20
A GUI window presenting logout, suspend, shutdown, reboot options. Uses GTK 2.0 and dbus.
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import os
import dbus
class LogoutWindow:
@seanh
seanh / gist:5736861
Created June 8, 2013 22:34
Scraper for the 130 1600x1200 wallpapers from the [National Geographic Photo Contest 2012](http://ngm.nationalgeographic.com/ngm/photo-contest/2012/), saves having to click on each one manually.
#!/usr/bin/env python2
"""
Scrapes all the 1600x1200 wallpapers from the National Geographic Photo Contest
2012: <http://ngm.nationalgeographic.com/ngm/photo-contest/2012>
This just prints out the URLs, you can pipe them to a file and then use wget
to download them:
./scrape.py > wallpapers.txt && wget -i wallpapers.txt
#!/bin/bash
cd /usr/lib/ckan/sa/src/ckanext-datastorer/ && /usr/lib/ckan/sa/bin/paster datastore_upload -c /etc/ckan/sa/production.ini
@seanh
seanh / README.md
Last active December 16, 2015 15:29
Proposed new CKAN documentation outline, for comments

Aims:

  • The structure/organization should be simple and immediately obvious so that:
    1. Readers can find stuff
    2. Devs know where new docs should go, or what docs need to be updated if they've change something
  • Structure is more "flat" with less generic sections, hopefully this makes the structure clearer
  • The stuff under the top-level heading "Installation" is meant to take you through a complete install, deployment and basic customisation, the idea is that we (the ckan dev team) would follow this when deploying new client sites, instead of having our own wiki pages etc.
  • Probably Overview and Contact will be pulled into Sphinx from the top-level README file, so they will also appear on the github front-page
  • Changelog is pulled-in from the top-level CHANGELOG file
@seanh
seanh / README.md
Last active March 27, 2021 17:06
My ZSH prompt in Python

My ZSH prompt in Python, with:

  • A horizontal rule (as wide as the terminal) before each prompt (when scrolling this makes it easier to see where one command's output ends and the next command begins)
  • Nicely truncated current working directory (like fish shell)
  • Active virtualenv
  • Git branch
  • Non-zero exit status
  • user@host only if connected over ssh
Watching /home/seanh/Projects/ckan/ckan/ckan/public/base/less
An error occurred running the less command:
Command failed: TypeError: Cannot call method 'charAt' of undefined
at getLocation (/home/seanh/Projects/ckan/ckan/node_modules/less/lib/less/parser.js:212:34)
at new LessError (/home/seanh/Projects/ckan/ckan/node_modules/less/lib/less/parser.js:221:19)
at Object.toCSS (/home/seanh/Projects/ckan/ckan/node_modules/less/lib/less/parser.js:385:31)
at /home/seanh/Projects/ckan/ckan/node_modules/less/bin/lessc:107:28
at /home/seanh/Projects/ckan/ckan/node_modules/less/lib/less/parser.js:434:40
at /home/seanh/Projects/ckan/ckan/node_modules/less/lib/less/parser.js:94:48
at /home/seanh/Projects/ckan/ckan/node_modules/less/lib/less/index.js:116:17
File '/home/seanh/Projects/ckan/ckan/ckan/controllers/package.py', line 697 in new_metadata
get_action('package_update')(context, data_dict)
File '/home/seanh/Projects/ckan/ckan/ckan/logic/__init__.py', line 323 in wrapped
return _action(context, data_dict, **kw)
File '/home/seanh/Projects/ckan/ckan/ckan/logic/action/update.py', line 251 in package_update
data, errors = _validate(data_dict, schema, context)
File '/home/seanh/Projects/ckan/ckan/ckan/lib/navl/dictization_functions.py', line 237 in validate
converted_data = unflatten(converted_data)
File '/home/seanh/Projects/ckan/ckan/ckan/lib/navl/dictization_functions.py', line 394 in unflatten
current_pos = current_pos[key]