Skip to content

Instantly share code, notes, and snippets.

View paulmwatson's full-sized avatar

Paul Watson paulmwatson

View GitHub Profile
@paulmwatson
paulmwatson / search_before_you_tweet.js
Last active December 15, 2021 20:56
A simple bookmarklet that searches Twitter with the URL you are on.
// A simple bookmarklet that searches Twitter with the URL you are on.
// Before you Tweet your own hot-take see what others are saying and ReTweet them instead.
// Author: @paulmwatson
// License: MIT
// Notes: It first looks for the "canonical" URL before falling back to the window.location.
// It strips any URL parameters e.g. UTM and keeps just the protocol, host, and path.
// This broadens the search as often UTM or other identifiers are unique to your session
// and Twitter's search will return no results. However it can be inacurate on websites
// that use URL parameters to identify content to show.
// Usage: Visit an article on a website like Buzzfeed.com and click the bookmarklet. A new tab
Verifying my Blockstack ID is secured with the address 19TRWSpycNtv6DDoXC3Y9L1zjH2GnJ46wp https://explorer.blockstack.org/address/19TRWSpycNtv6DDoXC3Y9L1zjH2GnJ46wp

Keybase proof

I hereby claim:

  • I am paulmwatson on github.
  • I am paulmwatson (https://keybase.io/paulmwatson) on keybase.
  • I have a public key ASD2XGJj0yHtO2h7rLqeowR08sT0lJ9YGj4841XgIcljnAo

To claim this, I am signing this object:

// A simple bookmarklet that opens the current URL on Google's
// Structured Data Testing Tool. Useful for checking for
// Schema.org ClaimReview and other embedded structured data.
// Author: @paulmwatson
// License: MIT
// Usage: Go to a URL you think has structured data and click the
// bookmarklet e.g. https://africacheck.org/reports/zumas-anc-birthday-speech-6-claims-fact-checked/
// Installation: Create a new bookmark in your bookmarks bar and put the following as the URL.
javascript:var u = window.location.protocol + '//' + window.location.host + window.location.pathname; window.open('https://search.google.com/structured-data/testing-tool#url=' + encodeURIComponent(u));
@paulmwatson
paulmwatson / claim_review_for_domain_from_commoncrawl.py
Created January 10, 2018 11:51
Output a CSV of ClaimReview structured data from CommonCrawl for a specific domain
# Original: https://www.bellingcat.com/resources/2015/08/13/using-python-to-mine-common-crawl/
# Adapted: [email protected]
# License: MIT
# Usage: python claim_review_for_domain_from_commoncrawl.py -d africacheck.org
import requests
import argparse
import time
import json
import io
@paulmwatson
paulmwatson / claim_review_for_africacheck_org_from_commoncrawl.csv
Created January 10, 2018 12:00
Example output of paulmwatson/claim_review_for_domain_from_commoncrawl.py for africacheck.org, performed on 2018-01-09
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
datePublished,dateModified,url,description,claimReviewed,itemReviewed.@type,itemReviewed.url,itemReviewed.datePublished,reviewRating.@type,reviewRating.alternateName,reviewRating.ratingValue,reviewRating.worstRating,reviewRating.bestRating
2017-12-13T13:40:33+00:00,2017-12-13T13:40:33+00:00,https://africacheck.org/reports/just-700000-public-workers-gobble-half-kenyas-taxes-ruto-said/,"While highlighting the drain on Kenyas resources by a high public wage bill, deputy president William Ruto said 700,000 workers cost half of the money raised from taxation. The data shows this is mostly corrrect.","'700,000 public servants consume half of Kenya taxpayers money'",creativeWork,https://youtu.be/a2Zdtpsf898?t=823,2017-12-05T00:00:00+00:00,Rating,"Mostly correct
",5,1,6
2017-12-14T07:44:53+00:00,2017-12-14T07:44:53+00:00,https://africacheck.org/reports/handwashing-101-dettols-disease-busting-claims-microscope/,"To promote handwashing, hygiene brand Dettol launched a campaign in October 2017 to teach children about th
@paulmwatson
paulmwatson / rails_route_redirect_everything_to_another_domain.rb
Last active October 26, 2018 14:15
A Rails route.rb rule that will redirect any GET to another domain and maintain the path, query, and hash/fragment.
Rails.application.routes.draw do
get '(*path)', to: redirect{|params, request| "#{ENV['DOMAIN_TO_REDIRECT_TO']}#{request.url.gsub(request.scheme, '').gsub('://', '').gsub(request.host + '/', '')}"}
end
Joke Funny Clever
What is wet and sticky? A Stick True False
I threw a boomerang a few years ago. I now live in constant fear. True True
My wife accused me of being immature. I told her to get out of my fort. False False
You don't need a parachute to go skydiving. You need a parachute to go skydiving twice. True True
option_settings:
"aws:elasticbeanstalk:container:python":
NumProcesses: 1
NumThreads: 1
aws:elasticbeanstalk:cloudwatch:logs:
StreamLogs: true
DeleteOnTerminate: true
RetentionInDays: 1
aws:elasticbeanstalk:healthreporting:system:
SystemType: enhanced
SolutionStack: 64bit Amazon Linux 2018.03 v2.9.6 running Python 3.6
OptionSettings:
aws:elasticbeanstalk:container:python:
NumProcesses: 1
NumThreads: 1
aws:elasticbeanstalk:cloudwatch:logs:
StreamLogs: true
RetentionInDays: 1
aws:elasticbeanstalk:healthreporting:system:
SystemType: enhanced