Skip to content

Instantly share code, notes, and snippets.


James Cridland jamescridland

View GitHub Profile
jamescridland / op3-grab-day.php
Last active Nov 29, 2022
Get all OP3 podcast hits from a single day
View op3-grab-day.php
// To get all podcast hits on a specific day
// Very rough PHP code from
if (empty($config['op3-bearer'])) {
// Grab a API key here:
// Get the bearer and add it in this line below
// For testing purposes, the preview bearer given here will also work
jamescridland /
Last active Jan 23, 2022
Helipad useful debugging tools for Helipad app

Get the local database

On your Mac...

scp umbrel@umbrel.local:~/umbrel/app-data/helipad/data/database.db ~/

... this will download the SQLite database from the Umbrel, and dump it into your home directory. Use DB Browser for SQLite to view it.

jamescridland / favicons.txt
Created Nov 17, 2021
All you really need for favicons
View favicons.txt
This is all you need...
<link rel="icon" href="" sizes="any">
<link rel="icon" href="" type="image/svg+xml">
<link rel="apple-touch-icon" type="image/png" href="/f/apple-icon.png"/>
The top one will only load if your browser doesn't support SVG icons
The second one will load if it does (most do)
The third is needed for some proprietary Apple nonsense.
jamescridland / commandline
Created Jan 4, 2020
To add an image to a podcast
View commandline
ffmpeg -i podnews200103.mp3 -i podnews200103.jpeg -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" podnews200103withart.mp3
jamescridland / links.php
Created Nov 13, 2019
[MOD] get total clicks per link in a newsletter
View links.php
jamescridland /
Last active Feb 3, 2019
Chromebook setup for Gatsby

This assumes you're running ChromeOS with Linux inside.

Turn on Linux

  • Hit the clock in the taskbar
  • Hit the settings cog
  • Type "Linux" in the search at the top
  • Press the big button that enables Linux ('turn on' then 'install').

Wait for a bit while it does its thing. (Wait for a bit, honestly, don't idly search the web, things will go wrong).

View total by useragent.sql
SELECT count(*),useragent FROM cloudfront_logs
WHERE "date" BETWEEN DATE '2019-01-01' AND DATE '2019-01-31'
AND uri LIKE '/audio/%' AND bytes>750000 GROUP BY useragent ORDER BY useragent
jamescridland / reports.php
Last active Apr 26, 2021
An additional API for Sendy, that offers a report for a specific sent campaign
View reports.php
<?php include('../_connect.php');?>
<?php include('../../includes/helpers/short.php');?>
---Little helper function from for reporting
Put this file in a new folder within the /api/ folder, called "reporting", and call it "reports.php". (Or whatever you like).
Call by POST to api/reporting/reports.php with the following mandatory elements
'api_key' => (your API key)
View example.php
$re = '/[\*].*(gimlet)(.+?\n\n)/';
$str = '* Google Play Music have [buttons for your podcasts]( Note, however, that outside the US, they just redirect to the front page of Google Play. One step forward, one step back.
* Recommended: [ReplyAll investigates Facebook]( using your phone\'s microphone to spy on your conversations. And, how to stop them doing it, even though they\'re not.
* Event: on now in Austin TX, USA: [Media Tech Week](';
preg_match($re, $str, $matches);
jamescridland / ofcom.php
Created Oct 16, 2016
A quick check to see if Ofcom's txparams have updated themselves
View ofcom.php
// A small piece of code to check the Last-Modified header in PHP
// The below currently (on 16 October) returns:
// "Tue, 11 Oct 2016 11:26:59"
// ... so that's when it was last updated.
// I'm told that this URL is a permanent link. My assumption is that any update to the
// DAB, FM or AM data will produce an update for this main file; even though my own code
// actually just uses the .csv files.