Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🤖

Joe Crawford artlung

💭
🤖
View GitHub Profile
@artlung
artlung / sitemap.xml.php
Created October 14, 2009 21:42
Generate XML sitemap from list of urls
View sitemap.xml.php
<?php
/**
*
* This is a quick way to turn a simple text file
* with a list of urls in a text file (sitemap-urls.txt)
* into a valid XML Sitemap:
* http://en.wikipedia.org/wiki/Sitemaps
* Put this file sitemap.xml.php and sitemap-urls.txt at
* the webroot http://example.com/sitemap.xml.php
@artlung
artlung / artlung.basic
Last active April 28, 2023 02:19
A program to display ARTLUNG logo on a TI-99/4a
View artlung.basic
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)
View sitemap-siteindex.php
<?php
/**
*
* This is a quick way to turn a simple text file
* with a very long list of urls in a text file (sitemap-urls.txt)
* Where "very long" is an expected url number greater than 10,000
* If loaded without a valid query parameter "page" it will load a
* Site Index site map, otherwise load the individual XML site map
* 10,000 urls into a valid XML Sitemap:
* http://en.wikipedia.org/wiki/Sitemaps
View wordpress-image-alignment-default-styles.css
img.alignright {float: right;margin: 0 0 1em 1em;}
img.alignleft {float: left;margin: 0 1em 1em 0;}
img.aligncenter {display: block;margin-left: auto;margin-right: auto;}
a img.alignright {float: right;margin: 0 0 1em 1em;}
a img.alignleft {float: left;margin: 0 1em 1em 0;}
a img.aligncenter {display: block;margin-left: auto;margin-right: auto;}
@artlung
artlung / jquery-example.html
Created May 1, 2010 17:20
A simple hello world jQuery example
View jquery-example.html
<html>
<head>
<title>My Sample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var new_num = 40; // global variable
jQuery(document).ready(function(){
http://api.jquery.com/css/
$('p').css({border: '5px solid red', color: 'green', padding: '20px'});
@artlung
artlung / RANDOM_CSS_javascript.html
Created February 11, 2010 02:20
Load a random CSS file
View RANDOM_CSS_javascript.html
<!-- this will print one of these:
<link rel="stylesheet" type="text/css" href="css/bk1.css" />
<link rel="stylesheet" type="text/css" href="css/bk2.css" />
<link rel="stylesheet" type="text/css" href="css/bk3.css" />
<link rel="stylesheet" type="text/css" href="css/bk4.css" />
<link rel="stylesheet" type="text/css" href="css/bk5.css" />
<link rel="stylesheet" type="text/css" href="css/bk6.css" /> -->
<script type="text/javascript" src="RANDOM_CSS_javascript.js"></script>
<script type="text/javascript">
RANDOM_CSS.printlinktag();
@artlung
artlung / Onload-Event-ArtLung-Rosetta.html
Created September 21, 2009 23:56
JavaScript Onload Techniques
View Onload-Event-ArtLung-Rosetta.html
<script type="text/javascript">
/**
* Several different ways to calls an onload event
* first up, here's a function we will call using all the methods
*/
function artlungOnload() {
alert('The body of the document has loaded');
}
</script>
View cursor-position.html
<html>
<head>
<title>Cursor Position Radius</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#square {
height: 400px;
width: 400px;
background-color: #000;
margin: auto;
@artlung
artlung / monte_carlo.py
Created May 19, 2010 00:30
Monte Carlo Python Program
View monte_carlo.py
"""Run a Monte Carlo simulation to validate the lottery example."""
import random
from lottery import winner, PEOPLE
def simulate(runs, f=winner, arg=PEOPLE):
"""Simulate function f with argument arg with number of given runs."""
# Store the number of results in a dict.
result_counts = {} # this is a dict
@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.
View artlung_results.txt
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.