Skip to content

Instantly share code, notes, and snippets.

@lizconlan
lizconlan / decrypt.rb
Last active May 30, 2017 17:10
JSON cookie decryption for Rails 4.1, a hybrid of work by @nbibler and @pdfrod
def decrypt_session_cookie(cookie, key)
cookie = CGI::unescape(cookie)
# Default values for Rails 4 apps
key_iter_num = 1000
salt = "encrypted cookie"
signed_salt = "signed encrypted cookie"
key_generator = ActiveSupport::KeyGenerator.new(key, iterations: key_iter_num)
secret = key_generator.generate_key(salt)
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-93-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Tue Aug 23 17:35:20 UTC 2016

  System load:  1.03              Processes:           107
  Usage of /:   3.5% of 39.34GB   Users logged in:     0
 Memory usage: 6% IP address for eth0: 10.0.2.15
WITH last_response_times AS (
SELECT events.info_request_id, MAX(events.created_at) AS last_response_time
FROM info_request_events events
JOIN incoming_messages
ON incoming_messages.id = events.incoming_message_id
WHERE
events.event_type = 'response' AND
incoming_messages.prominence = 'normal'
GROUP BY events.info_request_id
)

Keybase proof

I hereby claim:

  • I am lizconlan on github.
  • I am lizconlan (https://keybase.io/lizconlan) on keybase.
  • I have a public key whose fingerprint is A37A 4153 EC35 E827 F426 E742 80A9 5F5D 8567 B2DE

To claim this, I am signing this object:

To re-run the Hansard parser to attempt to pick up old files which may have been skipped previously:

[if in the UK, change your DNS servers to 8.8.8.8 and 8.8.4.4 (i.e. Google) to get a more stable connection]

Delete old sources from the database which refer to the old parliament.go.ke site:

    # check to see whether there are any and how many
    SELECT COUNT(*) FROM hansard_source WHERE last_processing_success IS NULL AND url LIKE '%/plone/%';

delete matching sittings

@lizconlan
lizconlan / shapes.graffleshapes.extract
Last active December 15, 2015 17:39
Omnigraffle - crow's foot with filled ball
{
Gap = 0;
LineGap = 0.5;
Name = CrowFilledBall;
Filled = YES;
Path = {
elements = (
{element = MOVETO; point = "{0, 0}"; },
{element = LINETO; point = "{12, 0}"; },
{element = CLOSE; },
@lizconlan
lizconlan / Historic Committee Debate Scraper
Created February 24, 2011 16:11
Scrapes historic committee debate info into CouchDB
require 'rubygems'
require 'nokogiri'
require 'net/http'
require 'rest_client'
require 'uri'
require 'json'
def format_member_name(input)
return "" if input.nil?
@lizconlan
lizconlan / CouchDB security - prevent non-admins from editing
Created July 26, 2010 12:37
CouchDB security - prevent non-admins from editing
function(newDoc, oldDoc, userCtx) {
if (userCtx.roles.indexOf('_admin') !== -1) {
return;
} else {
throw({forbidden: 'Only admins may edit the database'});
}
}
sudo apt-get install git-core
sudo apt-get install ruby
sudo apt-get install mysql-server
sudo apt-get install build-essential
sudo apt-get install libopenssl-ruby
sudo apt-get install ruby1.8-dev
sudo apt-get install rubygems
sudo apt-get install couchdb
sudo apt-get install jedit
@lizconlan
lizconlan / hacked readability bookmarklet
Created March 30, 2010 14:00
Hacked readability bookmarklet
javascript:(function(){readStyle='style-novel';readSize='size-medium';readMargin='margin-wide';_readability_script=document.createElement('SCRIPT');_readability_script.type='text/javascript';_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(_readability_script);_readability_css=document.createElement('LINK');_readability_css.rel='stylesheet';_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';_readability_css.type='text/css';_readability_css.media='all';document.getElementsByTagName('head')[0].appendChild(_readability_css);_readability_print_css=document.createElement('LINK');_readability_print_css.rel='stylesheet';_readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';_readability_print_css.media='print';_readability_print_css.type='text/css';document.getElementsByTagName('head')[0].appendChild(_readability_print_css)