Skip to content

Instantly share code, notes, and snippets.

@danmilleruk
danmilleruk / gist:1409580
Created November 30, 2011 15:54
Minecraft Auto Restart Script
@ECHO OFF
CLS
ECHO The server started: %time:~0,5% %date:~1%
:SERVERLOOP
SET BINDIR=%~dp0
CD /D "%BINDIR%"
"%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xincgc -Xmx1G -jar C:\games\minecraft\minecraft_server.jar nogui
ECHO Server crashes and restarted %time:~0,5% %date:~1%
ECHO.
GOTO SERVERLOOP
@danmilleruk
danmilleruk / get_subreddits.pl
Created February 12, 2012 19:06
Obtains image files from multiple subreddits using reddit-get.
#!/usr/bin/perl
open(SUBREDDIT, "<subreddits.txt");
my(@data) = <SUBREDDIT>;
@data = sort(@data);
my($line);
foreach $line (@data)
{
@danmilleruk
danmilleruk / get.pl
Created February 12, 2012 19:08
reddit-get - Grabs image files from reddit (./get.pl <subreddit>).
#!/usr/bin/env perl
use strict;
use warnings;
use JSON;
use WWW::Mechanize;
die "Usage: $0 subreddit [...]\n" unless @ARGV;
my $mech = WWW::Mechanize->new(autocheck=>0);
@danmilleruk
danmilleruk / TShock_count.php
Created February 21, 2012 14:24
Grabs the tshock counts and places them inside a tag for use on webnumbr.
<?PHP
// Grab the data.
$page = @file_get_contents("http://tshock.co/count.php");
// A little error handling.
if($page == FALSE)
{
echo "Cannot retrieve data, exiting.";
die ();
@danmilleruk
danmilleruk / mysql_backup.sh
Created February 26, 2012 03:04
A MySQL backup script I wrote to backup all databases.
#!/bin/sh
# Remote FTP Configuration
USER="username"
PASSWD="password"
HOST="123.123.123.13"
# Remote FTP path to store the compressed backups.
RMDIR="/backups/mysql"
# Local configuration
@danmilleruk
danmilleruk / dayz_download.sh
Created June 6, 2012 16:08
Dayz Mission Download Loop
#!/usr/local/bin/bash
for i in {631..731}
do
echo Downloading Map $i
wget -q "http://www.silentspy.net/utility/dayz/mission-generator/loop/dayz_$i.Chernarus.pbo"
done
#!/bin/bash
#
# A very simple script to used to work with "swaks" to send white-label test messages
# to clients.
#
# Written by Karl Baillie
# kb@sub6.com
# 15/11/2011
#
#!/usr/bin/perl
# use 'swaks --help' to view documentation for this program
#
# Homepage: http://jetmore.org/john/code/swaks/
# Online Docs: http://jetmore.org/john/code/swaks/latest/doc/ref.txt
# http://jetmore.org/john/code/swaks/faq.html
# Announce List: send mail to updates-swaks@jetmore.net
# Project RSS: http://jetmore.org/john/blog/c/swaks/feed/
# Google+: https://plus.google.com/u/0/110270727761256449657
@danmilleruk
danmilleruk / backup_web.sh
Created March 10, 2013 12:24
Best path for this being /scripts/backups/backup_web.sh
#!/bin/sh
# Web backup script
# by Dan Miller
# http://www.danmiller.co.uk
### Begin Configuration ###
EMAIL="you@email.com" # Email address to send the backup report to. (sendmail must be installed)
WEBPATH="/data/www" # No trailing slash
@danmilleruk
danmilleruk / serverdensity_install.sh
Created April 1, 2013 20:27
Server Density installation script. Edit the two configurables and run to add new servers to your Server Density account.
#!/bin/sh
# Configurables
SD_URL="http://changeme.serverdensity.com"
AGENT_KEY="changeme"
# Core - DO NOT CHANGE
CONFIGFILE="/etc/sd-agent/config.cfg"
wget -q https://www.serverdensity.com/downloads/boxedice-public.key -O- | sudo apt-key add -