Skip to content

Instantly share code, notes, and snippets.

@samdphillips
samdphillips / example-doc.rkt
Created November 9, 2022 22:16
Scribble pre-processing for Commonmark
#lang cmark-scribble
# This is a test document
1 + 1 is **@+[1 1]**
@noopkat
noopkat / 01 iTunesSong.scpt
Created January 31, 2019 18:48
Live Stream 'Now Playing' live text label
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set iTunesRunning to is_running("iTunes")
set noMusic to "no music is playing"
set song to noMusic
if iTunesRunning then
set song to run script "tell application \"iTunes\" to if player state is playing then \"now playing: \" & name of current track & \" by \" & artist of current track"
@jasny
jasny / authhash.php
Created May 9, 2012 17:20
Authentication without sessions in PHP
<?php
$secretword = "secret"; # Change this before use
$matches = null;
if (!empty($_REQUEST['AUTH']) && preg_match('/^(\w++):(\d++):(\w++)$/', $_REQUEST['AUTH'], $matches)) {
$username = str_rot13($matches[1]);
$time = (int)$matches[2];
$authhash = $matches[3];
$logged_in = md5($username . $time . $secretword) === $authhash && $time >= time() - 3000;
}