Skip to content

Instantly share code, notes, and snippets.

View Dan-Q's full-sized avatar
πŸš€
Looking for my next work opportunity! Hire me!

Dan Q Dan-Q

πŸš€
Looking for my next work opportunity! Hire me!
View GitHub Profile
@Dan-Q
Dan-Q / openai-gpt4o-photo-geolocation-prompt.md
Created April 17, 2025 12:42
Prompt for GPT4o to guess GPS coordinates from data in a photographic image.

Identify the location from photographs and provide an analysis.

When given one or more photographs, your task is to analyze the visual elements within each photo to determine the most likely location where it was taken. You should consider details such as architectural styles, natural landmarks, linguistic elements in signage, and any other distinguishable geographic or cultural features. Once you've identified a possible location, provide a rationale for your guess, explaining the reasoning behind your conclusion. Additionally, supply a set of GPS coordinates in decimal format that corresponds to the guessed location.

Steps

  1. Analyze Details: Examine the photograph(s) for identifiable landmarks, languages, architectural styles, natural scenery, vehicles, clothing, signage, and any other clues that may indicate the region or city.

  2. Reasoning: Develop a reasoning process based on these observed details to narrow down the potential locations.

@Dan-Q
Dan-Q / 7-red-lines-claude-3.7-sonnet.html
Created February 27, 2025 10:40
I asked Claude 3.7 Sonnet "Write a JavaScript program that uses a `<canvas>` element to draw seven red lines, all of them strictly perpendicular; some with green ink and some with transparent. Can you do that?". It responded "I see you're referencing the famous "Expert Talks - Draw 7 Red Lines" comedy sketch! This is a deliberately impossible ta…
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Seven Red Perpendicular Lines</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
@Dan-Q
Dan-Q / generate-continuum.php
Created February 10, 2025 17:07
Script to run via WP-CLI to generate "continuum" images (and associated HTML imagemaps) of the featured images associated with the posts in a WordPress blog. More details: https://danq.me/2025/02/10/continuum/
<?php
# Run using WP-CLI, e.g. with `wp eval-file /path/to/generate-continuum.php`
$V_WIDTH = 640;
$H_HEIGHT = 1160;
$OUTPUT_DIR = '/home/dan/tmp';
$OUTPUT_TMP_DIR = "$OUTPUT_DIR/thumbnails-banner-parts";
$parts = [];
$posts_with_thumbnails = new WP_Query(
[
@Dan-Q
Dan-Q / bbc-news-with-sports.rb
Created February 3, 2025 20:41
"BBC News... without the crap" RSS feed generators 2025 | https://danq.me/2025/02/03/bbc-news-rss-improved/ β€Ž
#!/usr/bin/env ruby
require 'bundler/inline'
# Dependencies:
# * open-uri - load remote URL content easily
# * nokogiri - parse/filter XML
gemfile do
source 'https://rubygems.org'
gem 'nokogiri'
end
@Dan-Q
Dan-Q / jigidi-helper.js
Last active January 15, 2025 14:38
Experimental under-development code to streamline Jigidi solving.
window.jColors = ['red', 'blue', 'brown', 'orange', 'yellow', 'pink', 'lightblue', 'lightgreen', 'lightgray'];
window.lColors = ['white', 'black', 'purple', 'darkgray', '#009'];
window.lWidths = [5, 10, 20];
window.jCols = parseInt(document.getElementById('info-creator').innerText.match(/(\d+)Γ—/)[1]);
window.jC = 0;
CanvasRenderingContext2D.prototype.putImageData = function(imageData, dx, dy){
const col = window.jC % window.jCols;
const row = Math.floor(window.jC / window.jCols);
this.fillStyle = window.jColors[col % window.jColors.length];
this.fillRect(-1000,-1000,2000,2000);
@Dan-Q
Dan-Q / radio.garden-region-bypass.user.js
Last active January 1, 2025 23:57
Userscript to facilitate bypassing the (UK) region lock on radio.garden
// ==UserScript==
// @name radio.garden: bypass region restrictions (e.g. UK)
// @namespace dqne.me.radio.garden
// @match http://radio.garden/*
// @grant none
// @version 1.0
// @author Dan Q <https://danq.me/>
// @description Adds a secondary player interface to radio.garden which still works even on region-blocked radio stations. Allows listening to non-UK stations from the UK.
// @run-at document-idle
// ==/UserScript==
@Dan-Q
Dan-Q / bbc-news-rss-filter-sport-out.rb
Last active November 14, 2024 16:17
Improve the BBC News RSS feed by (a) filtering out sport, iplayer links, and BBC sounds links; and (b) stripping the anchor (#0, #1, #2 etc.) off <guid>s so "republished to front page" stories don't re-appear in your feed reader
#!/usr/bin/env ruby
require 'bundler/inline'
# Dependencies:
# * open-uri - load remote URL content easily
# * nokogiri - parse/filter XML
gemfile do
source 'https://rubygems.org'
gem 'nokogiri'
end
@Dan-Q
Dan-Q / hero.js
Created October 31, 2024 15:43
A graphical implementation of Hero's algorithm for derivation of square roots. https://danq.me/2024/10/31/hero-of-alexandria/
/**
* A graphical implementation of Hero's algorithm for derivation of square roots.
* Assumes existence of a <div id="p246620-hero"></div>
*
* Author: Dan Q <https://danq.me/>
* Explanation: https://danq.me/2024/10/31/hero-of-alexandria/
* License: Public Domain / CC0 / The Unlicense (your choice)
*/
(function(){
@Dan-Q
Dan-Q / _no_code_page_.php
Last active October 12, 2024 16:49
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@Dan-Q
Dan-Q / README.txt
Created May 4, 2018 07:33
GC591VV "You Can't Do It Alone!" geocache source code
This is the source code the the Arduinos powering my GC591VV "You Can't Do It Alone!" cache:
further details can be found at https://danq.me/2014/08/13/gc591vv/
synchronise_clocks.ino - this program sets the clock on the device to the date and time of
compilation: run it at the same time on both boxes to synchronise them
it_takes_two_cache.ino - this is the program that runs on both boxes when they're to be
deployed to the field; some constants need setting:
* SALT - needs to be set to a random number (the same for both boxes); this helps to prevent