PC Games

Orb
Lasagne Monsters
Three Guys Apocalypse
Water Closet
Blob Wars : Attrition
The Legend of Edgar
TBFTSS: The Pandoran War
Three Guys
Blob Wars : Blob and Conquer
Blob Wars : Metal Blob Solid
Project: Starfighter
TANX Squadron

Android Games

DDDDD
Number Blocks
Match 3 Warriors

Tutorials

2D shoot 'em up
2D top-down shooter
2D platform game
Sprite atlas tutorial
Working with TTF fonts
2D adventure game
Widget tutorial
2D shoot 'em up sequel
2D run and gun
Roguelike
Medals (Achievements)
2D turn-based strategy game
2D isometric game
2D map editor
2D mission-based shoot 'em up
2D Santa game
2D split screen game
SDL 1 tutorials (outdated)

Latest Updates

SDL2 Versus game tutorial
Wed, 20th March 2024

Download keys for SDL2 tutorials on itch.io
Sat, 16th March 2024

The Legend of Edgar 1.37
Mon, 1st January 2024

SDL2 Santa game tutorial 🎅
Thu, 23rd November 2023

SDL2 Shooter 3 tutorial
Wed, 15th February 2023

All Updates »

Tags

android (3)
battle-for-the-solar-system (10)
blob-wars (10)
brexit (1)
code (6)
edgar (9)
games (43)
lasagne-monsters (1)
making-of (5)
match3 (1)
numberblocksonline (1)
orb (2)
site (1)
tanx (4)
three-guys (3)
three-guys-apocalypse (3)
tutorials (17)
water-closet (4)

Books


The Red Road

For Joe Crosthwaite, surviving school was about to become more than just a case of passing his exams ...

Click here to learn more and read an extract!

A Reddit Wallpaper download script

Fri, 27th May 2016

I like having new wallpapers, daily. As I most often got them from /r/wallpapers, I decided to write a small script to download them to use on my desktop. The script is rather straight forward. It will download the RSS feed from /r/wallpapers and extract the URLs of the first two jpgs that are listed within, which are then downloaded using wget. It will then resize them to better fit the desktop (some wallpapers are 4K, so I just resize them to my native resolution), and that's that.

Okay, there are a few extras: it will first check to see if we're online (by pinging Google), it will then only download new wallpapers if it's been at least 6 hours since the last check. Wallpapers older than two days old will be deleted before the new ones are fetched. Additionally, the user agent is set to be the latest version of Chrome, as Reddit has checks against rogue bots (note: if you run this script too often, your ip address could be banned - best to only run it once every few hours).

You can view the code below. Either copy and paste that into a file, or download the wallpaper.sh file at the bottom of this page. Remember to tweak it to suit your own needs (as a minimum, update the paths), and then chmod +x it before running.

#!/bin/bash -e

TMP="/tmp/wallpapers"
DIR="/path/to/wallpapers"
LASTDL="$DIR/.lastDownload"
UA=`/opt/google/chrome/chrome -version`

if ping -q -c 1 www.google.com

then

if [ ! -f $LASTDL ] || [ `find "$LASTDL" -mmin +360` ]

then

find "$DIR" -name '*.jpg' -mtime +2 -exec rm {} \;

mkdir -p $TMP

FILES=$(curl -A "$UA" https://www.reddit.com/r/wallpapers.rss | xmllint --format - | grep -Eo 'http[s]?:[^"]*jpg' | grep -v thumbs | head -2)

for FILE in $FILES
do
wget -c $FILE -P $TMP
done

touch $LASTDL

mogrify -resize 1920x "$TMP/*.jpg"

mv $TMP/*.jpg $DIR

fi

fi
Downloads: wallpaper.sh (0Kb)
 
code 

Related News

Orb source code
Mon, 26th April 2021

Lasagne Monsters source code
Tue, 20th April 2021

3 Guys Apocalypse source code
Sun, 11th April 2021

Scraping Amazon's Wishlist
Sat, 21st May 2016

Resizing an array in C
Thu, 19th May 2016

Mobile site