Skip to content

Instantly share code, notes, and snippets.

@abma
abma / backup
Last active July 9, 2018 22:52
Incremental backup to external drive using snapper and btrfs send/receive
#!/bin/bash
# James W. Barnett
# Takes snapshots of each snapper configuration. It then sends the snapshot to
# a location on an external drive. After the initial transfer, it does
# incremental snapshots on later calls. It's important not to delete the
# snapshot created on your system since that will be used to determine the
# difference for the next incremental snapshot.
# Can set the backup directory here, or in the snapper configuration file with
@abma
abma / client.py
Created January 16, 2015 20:55
upq client example to fetch latest 64 bit engine
#!/usr/bin/env python
from xmlrpclib import ServerProxy
proxy = ServerProxy('http://api.springfiles.com/xmlrpc.php')
searchstring = {
"category" : "engine_linux64",
"limit": 1
}
@abma
abma / test.cpp
Created August 3, 2014 18:05
sdl2 example app
#include <SDL2/SDL.h>
#include <stdio.h>
#undef main
static bool process_events( void )
{
/* Our SDL event placeholder. */
SDL_Event event;
@abma
abma / lagtest.lua
Last active August 29, 2015 14:02
springrts.com widget to show frames which consumed a lot of time
function widget:GetInfo()
return {
name = "LAG INFO",
desc = "abcdef",
author = "abcdef",
date = "abcdef",
license = "abcdef",
layer = 0,
enabled = true, -- loaded by default?
}
@abma
abma / getlobbyid.cs
Last active August 29, 2015 14:01
.net getlobbyid (spring lobby protcol)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.NetworkInformation;
namespace LobbyClient {
using System;
public class Crc32 {
static uint[] table;
@abma
abma / signaltest.c
Created March 29, 2014 05:42
compiles with: gcc -g -o signaltest signaltest.c -lpthread -lunwind -lunwind-x86_64
/**
*
* signaltest.c
*
* Tests a simple idea for suspending a thread and inspecting its stack using posix thread signals (pthread_kill()).
*
* 1. Create a simple worker thread that does some (lengthy) work and run it.
* 2. Pause the main thread for a while so that we can be fairly certain that the worker's signal handler is installed and it is running.
* 3. In the main thread, lock a mutex that the worker will wait on inside its signal handler.
* 4. Send SIGUSR1 from the main thread to the worker. The worker's handler tries to lock the mutex. At this point it is suspended.
@abma
abma / unitinfo.lua
Created July 31, 2013 20:38
debug widget for the springrts.com engine
function widget:GetInfo()
return {
name = "unitinfo",
desc = "prints unit info each frame, used for debugging",
author = "abma",
date = "Feb. 2012",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = true,
}
diff --git a/rts/Sim/Units/CommandAI/TransportCAI.cpp b/rts/Sim/Units/CommandAI/TransportCAI.cpp
index 3ac2f5d..cb0db19 100644
--- a/rts/Sim/Units/CommandAI/TransportCAI.cpp
+++ b/rts/Sim/Units/CommandAI/TransportCAI.cpp
@@ -230,6 +230,7 @@ void CTransportCAI::ExecuteLoadUnits(Command& c)
StopMove();
owner->script->TransportPickup(unit);
+ StopTransportee(*unit);
}
@abma
abma / movedb2disk2.php
Created December 5, 2012 00:06
script to move database store attachments to disk in mantisbt, see http://www.mantisbt.org/bugs/view.php?id=7176
<pre>
<?php
include('../../springpw.php');
mysql_connect($spring_dbhost, $spring_dbuser, $spring_dbpass);
mysql_select_db($spring_dbname);
$res = mysql_query("SELECT f.id, filename, filesize, p.file_path
FROM mantis_bug_file_table f
LEFT JOIN mantis_bug_table b ON f.bug_id = b.id
@abma
abma / atifail.lua
Created May 2, 2012 21:56
Lua widget that triggers a bug in spring (http://springrts.com/mantis/view.php?id=2116)
function widget:GetInfo()
return {
name = "ATI pointsize Fail",
desc = "ATI pointsize Fail",
author = "Masure",
date = "2010 Sept 14",
license = "GNU GPL, v2 or later",
layer = 1, -- after the normal widgets
enabled = false -- loaded by default?
}