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 / 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 / q23-podcasting-extensions.php
Created August 22, 2024 08:58
Subset of the code included in DanQ.me's theme, providing podcasting functionality into an RSS feed. See https://danq.me/dan-q-the-podcast for further explanation.
<?php
define('PODCAST_TAG', 'dancast');
define('PODCAST_DEFAULT_IMAGE', 'https://danq.me/wp-content/uploads/2024/05/podcast-art.jpg');
define('PODCAST_SUMMARY', "A podcast nobody asked for about things only Dan cares about. A spin-off of the blog of Dan Q, who's been making random stuff on the Internet since the 1990s.");
define('PODCAST_URL', 'https://danq.me/tag/dancast/');
define('PODCAST_TITLE', 'Dan Q - The Podcast');
/**
* If the 'podcast_link' postmeta is filled, advertise it appropriately in RSS:
*/
@Dan-Q
Dan-Q / wccom-production-highlight.user.js
Created July 22, 2024 16:47
Highlight when you're on WCCOM Production so you don't break it by accident. I'm talking to you, Future Dan!
// ==UserScript==
// @name WCCOM Production Highlight
// @namespace prodhighlight.wccom.danq.me
// @match https://woocommerce.com/*
// @grant GM_addStyle
// @version 1.0
// @author Dan Q
// @description Don't break production WCCOM, Dan! Remind yourself when you're on it with a highlight.
// ==/UserScript==
@Dan-Q
Dan-Q / wccom-showcase-checker.rb
Last active June 10, 2024 12:40
Extract all sites listed on https://woocommerce.com/showcase/ and check each, reporting to CSV if it (apparently) isn't running WooCommerce
#!/usr/bin/env ruby
# rubocop:disable Security/Open
#
# Version History
# 1.0.0 - Initial version
# Constants
SHOWCASE_ROOT = 'https://woocommerce.com/showcase/'
SHOWCASE_LIST_PAGE = 'https://woocommerce.com/showcase/page/%d/'
PROGRESSBAR_FORMAT = '%t | %B | %e'
@Dan-Q
Dan-Q / geocaching-extent.php
Created April 3, 2024 15:44
Draws the smallest possible convex polygon that surrounds a set of successful geocaching finds/geohashpoint expeditions. See: https://danq.me/geo-limits
<?php
/**
* Given an array of points, returns the convex hull over those points.
*/
function convex_hull_over( array $points ): array {
$cross = function($o, $a, $b) {
return ($a[0] - $o[0]) * ($b[1] - $o[1]) - ($a[1] - $o[1]) * ($b[0] - $o[0]);
};
$pointCount = count($points);
@Dan-Q
Dan-Q / list-detected-woocom-components.user.js
Created April 2, 2024 21:04
Userscript to report WooCom components detected on each visited page, by logging to console.log
// ==UserScript==
// @name WooCom Component Enumerator
// @namespace woo.com.danq.me
// @match https://woo.com/*
// @match https://woocommerce.test/*
// @grant none
// @version 1.0
// @author -
// @description Lists detected WooCom PHP/React components in the console.log as-you-browse.
// ==/UserScript==