Skip to content

Instantly share code, notes, and snippets.

@mxsrc
mxsrc / mergeDbs.py
Last active May 24, 2018 12:13
Script for merging OmNET++ SQLite result files
#!/usr/bin/python3
import logging
import os
import os.path as osp
import sys
import sqlite3
schema = '''
@mxsrc
mxsrc / configure_file.py
Last active April 4, 2018 12:56
Helper to replace parts of a file with corresponding values
import os
from string import Template
def configure_file(template_filename, out, **kwargs):
"""Rewrites placeholders within the file according to the given argument
The file specified by template_filename is read. Occurences of template values (e.g. identifiers prefixed with '$',
for more details see string.Template) are replaced with the corresponding keyword argument value. The resulting file
is written to out. If out is a directory, the template's filename is stripped of the '.in' extension and used as
@mxsrc
mxsrc / timeout_state.py
Last active January 13, 2020 12:13
ROS smach state for waiting for a message up to some amount of time
import roslib; roslib.load_manifest('smach_ros')
import rospy
import threading
import smach
__all__ = ['TimeoutState']
@mxsrc
mxsrc / wifi.tex.m4
Created February 1, 2018 16:35
WLAN QR Code page generator
\documentclass[paper=a6]{scrartcl}
\usepackage[margin=.5cm]{geometry}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}
\title{WLAN Access}
\date{}
\begin{document}
@mxsrc
mxsrc / backup.sh
Created September 5, 2013 12:55
Backup script using rsync and ssh
#!/bin/sh
if [ $# != 2 ]
then
echo usage: $0 SOURCE HOST
exit 1
fi
SOURCE=$1
BACKUP_DIR=backup
@mxsrc
mxsrc / SpellPatch
Created March 28, 2013 20:36
Fix for Lightwell bug in MaNGOS
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 3ceb20b..c18d5cb 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3143,8 +3143,8 @@ void Spell::_handle_immediate_phase()
if (m_spellInfo->Effect[j] == 0)
continue;
- // apply Send Event effect to ground in case empty target lists
- if (m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(SpellEffectIndex(j)))