Skip to content

Instantly share code, notes, and snippets.

Avatar
👹
Ducking and diving

Daniel Pett portableant

👹
Ducking and diving
View GitHub Profile
@portableant
portableant / fitz.json
Created May 19, 2021
Fitzwilliam Museum boundary
View fitz.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@portableant
portableant / code.js
Created May 18, 2021
Google action script for parsing sheets data to docs template replacements
View code.js
function createDocument() {
// Get the headers from a sheet with the sheet id number
var headers = Sheets.Spreadsheets.Values.get('1-3du2O3thRu4Ynj_6ShC0tajxjXOiAufA68Uq_z_F6M', 'A1:AU1');
// Define the area from which to pull data. Assume 200 rows
var starters = Sheets.Spreadsheets.Values.get('1-3du2O3thRu4Ynj_6ShC0tajxjXOiAufA68Uq_z_F6M', 'A2:AU200');
// Define your google document template id number
var templateId = '1tSMgb6m7IfbhSdAeGx2tqYS5fDG5uRyFBVEfmhPUDDA';
for(var i = 0; i < starters.values.length; i++){
console.log(starters.values[i])
@portableant
portableant / Error.md
Created Apr 12, 2021
Jekyll bundle fail - OSX Big Sur Ruby 3.0.0
View Error.md

Error

bundle exec jekyll serve Configuration file: /Users/danielpett/Documents/githubProjects/steppe-gold/_config.yml Source: /Users/danielpett/Documents/githubProjects/steppe-gold Destination: /Users/danielpett/Documents/githubProjects/steppe-gold/_site Incremental build: disabled. Enable with --incremental Generating... Jekyll Feed: Generating feed for posts done in 0.462 seconds.

@portableant
portableant / splitPDFandOCR.py
Last active Feb 13, 2021
Hacky script for splitting pdf to pages
View splitPDFandOCR.py
#!/usr/bin/python
## Split pdf files into pages and ocr text (this is a bit honky, but works as a demo)
## Daniel Pett 11/2/2021
__author__ = 'portableant'
## Tested on Python 2.7.16
## Usage example
## python3 splitPdf.py -p . -f 1975_1989.pdf -d processed -n 1975_1989_processed -o ocr
## mac osx brew install poplar and echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.zshrc
import argparse
View gist:2d67f707e7997271acc42857f0c6044d
<div class="card col-sm p-0 m-2">
<div class="embed-responsive embed-responsive-16by9">
<iframe src="https://www.youtube.com/embed/{{ video.id }}" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen class="embed-responsive-item"></iframe>
</div>
</div>
@portableant
portableant / howtouse.txt
Created Oct 12, 2020
Lenborough hoard stitch images together
View howtouse.txt
Install the PIL library on windows at the powershell prompt by typing the command below
pip3 install PIL
1. Now save your images into a folder on your computer and make a note of the path (don't work on your master images, use a copied folder)
2. Save the stitch.py file from here in the same directory
3. Remove all the images with the scale bar included as you don't need these
4. Now edit the stitch.py file and replace line 14 with the path to the directory where you have your lenborough images
5. Now go back to powershell and type:
View splitNile.py
#!/usr/bin/python
## Split audio files into chunks
## Daniel Pett 1/5/2020
__author__ = 'portableant'
## Tested on Python 2.7.16 - yes I know I need to upgrade.
import argparse
import os
import speech_recognition as sr
import csv
@portableant
portableant / transcribedAudio.csv
Created May 11, 2020
A raw csv of transcribed data
View transcribedAudio.csv
We can't make this file beautiful and searchable because it's too large.
"taskID","transcription","valid","comments","userID","inputBy","track"
91146,"","yes","",1,"Daniel Pett; Jeff Okazaki","https://fitz-audio-guide-micropasts.s3-eu-west-2.amazonaws.com/602_The_Nativity_Chunk0.mp3"
91146,"Domenico Ghirlandaio ran one of the biggest and most successful artist workshops in Florence towards the end of the Fifteenth century and it used to be thought that this","no","",,"Daniel Pett; Jeff Okazaki","https://fitz-audio-guide-micropasts.s3-eu-west-2.amazonaws.com/602_The_Nativity_Chunk0.mp3"
91146,"Domenico Ghirlandaio ran one of the biggest and most successful artist workshops in Florence towards the end of the Fifteenth Century and it used to be thought that this...","no","",243,"Daniel Pett; Jeff Okazaki","https://fitz-audio-guide-micropasts.s3-eu-west-2.amazonaws.com/602_The_Nativity_Chunk0.mp3"
,,,,,,
91147,"nativity scene was produced by a junior member under his supervision but cleaning in the 1990s revealed just how good some of the painting here is","yes","",243,"Daniel Pett; J
View splitAudio.py
#!/usr/bin/python
## Split audio files into chunks
## Daniel Pett 1/5/2020
__author__ = 'portableant'
## Tested on Python 2.7.16 - yes I know I need to upgrade.
import argparse
import os
import speech_recognition as sr
View splitAudio.py
#!/usr/bin/python
## Split audio files into chunks
## Daniel Pett 1/5/2020
__author__ = 'portableant'
## Tested on Python 2.7.13
import argparse
import os
import speech_recognition as sr