Skip to content

Instantly share code, notes, and snippets.

@RobinStamer
Created April 25, 2012 03:07
Show Gist options
  • Save RobinStamer/2485887 to your computer and use it in GitHub Desktop.
Save RobinStamer/2485887 to your computer and use it in GitHub Desktop.
#!/bin/sh
(
cat <<END
<!doctype html>
<html lang="en">
<head>
<script>
var a = [
END
ls *.jpg *.gif *.png | sort -r | sed 's/.*/"&",/g'
cat <<END
""]
a.pop()
function changeImage() {
document.getElementById('pic').src = a[Math.floor(Math.random() * a.length)]
}
setInterval(changeImage, 15 * 60 * 1000)
</script>
</head>
<body onload="changeImage()">
<img id="pic" src="error.jpg" width="100%" />
</body>
</html>
END
) > index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment