Skip to content

Instantly share code, notes, and snippets.

View artlung's full-sized avatar
💭
🤖

Joe Crawford artlung

💭
🤖
View GitHub Profile
@artlung
artlung / Roanoke.php
Last active November 9, 2023 02:25
This was because I wanted a sentence on my about page that would read: "This blog has 8,586 posts, 2,353 comments, 5,936 embedded images, and 3,258 outbound links." https://artlung.com/about/ -- I use a cron to run the CLI prefixed files to update the outbound links and images. For your use, possibly.
<?php
/**
* class Roanoke
*/
class Roanoke {
// Note, this depends on every post having a post_image_count and post_link_count
public static function postStatsSentence() {
$number_of_published_posts = wp_count_posts()->publish;
<?php
$year = 2024;
$adult_days_and_prices = [
'wed' => 59,
'thu' => 79,
'fri' => 79,
'sat' => 79,
'sun' => 54,
@artlung
artlung / RoanokeMenuExampleUsage.php
Last active October 26, 2023 21:53
I wanted to replace the text of my menu with font awesome icons so I created a new walker class to do replacements for links with specific outbound links. Not at all generic but I wanted to stash it. I'm sure there are better ways to do this.
<?php
// https://developer.wordpress.org/reference/functions/wp_nav_menu/
$args = [
'menu' => 'roanoke-menu-bar',
'container' => 'nav',
'container_class' => 'roanoke-menu-bar',
'container_aria_label' => 'Menu Bar',
'walker' => new RoanokeMenuWalker(),
];
@artlung
artlung / thumb.php
Last active September 27, 2023 15:04
Multiple Image Thumbnails - Command line PHP tool to generate image to represent multiple images
<?php
// By Joe Crawford joe@artlung.com
// September 2023
// intended to be run from the command line
// php thumb.php
// place images in the same directory as this script and their names in the array below
// or place urls in the array below - filenames must be unique
// height and width of the final image, for now the math relies on everything being square
@artlung
artlung / artlung.basic
Last active April 28, 2023 02:19
A program to display ARTLUNG logo on a TI-99/4a
1 REM ARTLUNG START
2 REM TI-EXTENDED BASIC TI-99/4A
3 CALL CLEAR
9 REM
10 CALL CHAR(33, "0F1F7F7F7E7C7CFC")
11 CALL VCHAR(1, 1, 33)
12 CALL CHAR(34, "FCFFFFFFFFFFFFFF")
13 CALL VCHAR(2, 1, 34)
14 CALL CHAR(35, "7F7F7F7E7EFCFCFC")
15 CALL VCHAR(3, 1, 35)
@artlung
artlung / artlung_results.txt
Last active January 9, 2022 20:12
I wanted to see if I could find earworms in my last.fm data which I've used more or less reliably for many years. Yes, I found some. Little Fluffy Clouds I'm pretty sure is an error - I made a playlist with just that and it ran over a weekend on a work computer. But the rest look pretty legit to me. Sequential plays of the same song over and over.
Found earworm on 2020-05-12: An Angry Thunderstorm by White Noise Meditation: played 238 times.
Found earworm on 2018-10-18: Little Fluffy Clouds (7" Edit) by The Orb: played 245 times.
Found earworm on 2018-10-18: Little Fluffy Clouds (7" Edit) by The Orb: played 25 times.
Found earworm on 2015-04-15: Johannesburg by Gil Scott-Heron: played 16 times.
Found earworm on 2015-04-15: Ring Capacity (Green Lantern Song) by Kirby Krackle: played 39 times.
Found earworm on 2015-04-15: Senses Working Overtime by XTC: played 23 times.
Found earworm on 2015-04-15: Ch-Check It Out by Beastie Boys: played 22 times.
Found earworm on 2015-04-15: She's An Angel (live) by They Might Be Giants: played 32 times.
Found earworm on 2015-04-15: Kansas by The Wolfgang Press: played 24 times.
Found earworm on 2015-04-15: A Real Hero (feat. Electric Youth) by College: played 29 times.
@artlung
artlung / inc.tracker.php
Created December 22, 2021 05:56
In 2010 when I was applying for jobs I added a little tracker chunk of php to any page I sent to recruiters so I could get a notification if they actually clicked through. It worked pretty well. Primitive and intrusive but also pretty funny.
<?php
define('TRACK', false);
function isSpider($HTTP_USER_AGENT) {
$spiders = array(
'Baiduspider',
'msnbot',
'youdao',
'YandexBot',
@artlung
artlung / make-git-lfs-commands.php
Created December 15, 2021 20:32
Git LFS command generator for my blog
<?php
$i = 2001;
$types = ['jpg', 'png', 'gif'];
$years = range(2001, 2021);
foreach ($years as $year) {
foreach ($types as $type) {
echo "git lfs track blog/wp-content/uploads/{$year}/**/*.{$type};\n";
}

Keybase proof

I hereby claim:

  • I am artlung on github.
  • I am artlung (https://keybase.io/artlung) on keybase.
  • I have a public key ASBIdwaUOPWU_0J_rgMNDyNL1k6NuJdrZBcG2fgEjJeRawo

To claim this, I am signing this object:

@artlung
artlung / keybase.md
Created December 7, 2021 18:42
keybase.md

Keybase proof

I hereby claim:

I am artlung on github. I am artlung (https://keybase.io/artlung) on keybase. I have a public key ASBIdwaUOPWU_0J_rgMNDyNL1k6NuJdrZBcG2fgEjJeRawo

To claim this, I am signing this object: