Skip to content

Instantly share code, notes, and snippets.

Geoffrey Hing ghing

Block or report user

Report or block ghing

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ghing
ghing / README.md
Created Mar 23, 2020
Identifying which PDFs are image vs. text
View README.md

Identifying which PDFs are images vs. text

Someone who was in my PDF text extraction session at NICAR 2020 asked how to identify image vs. text PDFs when you have thousands of files and they're a mixture of formats with the end goal of only running OCR software on the image PDFs.

This is how I would approach the problem using command-line tools.

Assumptions

  • You’re working on a Mac or Linux machine where you have access to some common command-line utilities such as find and sed
    • This should work under the Windows Subshell for Linux under Windows also
@ghing
ghing / README.md
Created Mar 12, 2020
`CERTIFICATE_VERIFY_FAILED` in Python, on a Mac, on a computer that uses Cisco Umbrella
View README.md

CERTIFICATE_VERIFY_FAILED in Python, on a Mac, on a computer that uses Cisco Umbrella

If you've ever tried to initiate an HTTPS request in Python on a Mac, perhaps usign the popular requests library, you've probably run into an exception that looks something like this:

requests.exceptions.SSLError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/03-11-2020.csv (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))

These issues are complicated by the fact that many users have multiple versions of Python installed and that there may be multiple pieces of software handling certificates.

@ghing
ghing / README.md
Last active Mar 7, 2020
The Original Pinettes during NICAR 2020
View README.md

Hi NICAR friends! My friend with whom I'm staying suggested checking out an all-woman brass band called the Original Pinettes who play every Friday.

The band's Wikipedia entry (https://en.wikipedia.org/wiki/The_Original_Pinettes_Brass_Band) says the Pinettes are the only all-woman brass band in New Orleans, started when the members were at a Catholic Girls school, and persisted as a band despite being disrupted by relocation caused by Katrina.

Here's the details:

Friday, March 6, 2020
Bullet's Sports Bar
2441 A P Tureaud Ave.
New Orleans, LA 70119

@ghing
ghing / copy_markdown_link_bookmarklet.js
Created Feb 27, 2020
User script and bookmarklet for copying current page title and URL as a Markdown link
View copy_markdown_link_bookmarklet.js
@ghing
ghing / dropbox_on_ubuntu.md
Created Dec 6, 2019
Log of steps I took when installing Ubuntu 18.04 in such a way that I could use Dropbox after they dropped support for many Linux filesystems.
View dropbox_on_ubuntu.md

This is an excerpt from an install log notebook I kept when reinstalling my system that includes just the parts relevent to Dropbox.

WTF Dropbox

This whole OS installation was precipitated by the fact that Dropbox dropped support for all Linux filesystems except for plain ext4, so it wasn't working with ecryptfs and LVM and all the default ways Ubuntu sets up the filesystem.

However, Dropbox does work with full-disk encryption and an ext4 filesystem. The technology for full disk encryption under Linux is LUKS.

The key things I need to make sure happen when setting up my partitions and installing the system are:

@ghing
ghing / README.md
Created Oct 8, 2019
Installing landsat-util on MacOS with Python 3.7
View README.md

Installing landsat-util on MacOS with Python 3.7

Last updated October 8, 2019.

Or don't

If you have expereince with Docker, running the Dockerized landsat-util is probably the easiest way to avoid all these dependency issues.

The problem

@ghing
ghing / .bash_completion
Last active Jul 5, 2019
Make and Bash completion
View .bash_completion
# bash completion for GNU make
# This has been modified from the version in
# `/usr/local/etc/bash_completion.d/make` so that file paths are also
# autocompleted.
#
# To use, copy or append this to `~/.bash_completion`
have make || have gmake || have gnumake || have pmake &&
_make()
{
@ghing
ghing / dailygraphics_markdown_links.js
Created Oct 10, 2017
Dailygraphics markdown links bookmarklet
View dailygraphics_markdown_links.js
@ghing
ghing / .block
Last active Oct 6, 2017
West Virginia Referendum Results Choropleth Example
View .block
height: 800
View export_appalachia.sh
#!/bin/bash
latest_date_file=.last-statement-date
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-s|--since)
You can’t perform that action at this time.