Skip to content

Instantly share code, notes, and snippets.

@donno
donno / test_config.cpp
Created January 3, 2011 10:33
Mineserver Test case using catch for Config class in Mineserver.
/*
Copyright (c) 2010, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
@donno
donno / Logger.cpp
Created January 5, 2011 13:41
Little bit of work on what the log in logger should ideally be.
// Log debug infomation to terminal
void Logger::log(std::string msg, std::string file, int line)
{
Mineserver::get()->screen()->log("[" + file + "@" + dtos(line) + "]: " + msg);
}
// Log messages
void Logger::log(LogType type, const std::string& channel, const std::string& message)
{
// This should be expanded eventaully to support saving to file and if config option is enabled saving a channel per a file
@donno
donno / Fibonacci.cpp
Created February 11, 2012 14:55
Provides a way to iterate over the Fibonacci sequence.
//===----------------------------------------------------------------------===//
//
// NAME : FibonacciGenerator
// VERSION : 0.2
// NAMESPACE : Global namespace.
// PURPOSE : Provided a way to iterate over the Fibonacci sequence.
// COPYRIGHT : (c) 2012 Sean Donnellan. All Rights Reserved.
// AUTHORS : Sean Donnellan (darkdonno@gmail.com)
// DESCRIPTION : Provided a way to iterate over the Fibonacci sequence.
//
@donno
donno / Flask-ardfmap
Created October 6, 2013 08:53
A prototype server developed as a proof-of-concept for a new mapping system for foxhunting and balloon chases using the Flask microframework.
#!/usr/bin/env python
"""A prototype server developed as a proof-of-concept for a new mapping system
for foxhunting and balloon chases.
This requires Flask, which is a microframework for Python.
See http://flask.pocoo.org/
"""
import database
import flask
@donno
donno / fetch_vcdist.py
Last active July 13, 2024 21:12
Downloads and extract the Visual C++ Redistributables.
"""Downloads and extract the Visual C++ Redistributables.
This is useful when working with minidump files as the user may be running
with a new different version of the runtime. This script aims to maintain
a copy of the various versions.
Versions are normally added once I encounter them, in November 2022, I added
a rather large back catalogue of versions.
This requires dark.exe from Wix (http://wixtoolset.org/releases/) and
@donno
donno / sweeper.py
Created September 27, 2019 23:47
An implementation of the game of an old classic, Minesweeper (Engine)
"""An implementation of the old classic game, Minesweeper.
The objective is to pick cells in a grid where you don't believe there is a
mine (bomb). If you pick incorrectly you loose the game because the mine goes
off (it explodes).
TODO
- No way to flag a cell.
- Add a clock/timer?
- Add handling for intergrating a user interface.
@donno
donno / entwineoutput.py
Created April 12, 2020 04:01
Parses the entwine output to determine which files weren't completed.
"""Parses the entwine output to determine which files weren't completed at
the time of a crash.
There are two lines from the output that this script is interested in. The
lines with 'Adding' and 'Done'.
Output Example:
Adding 0 - E:/data/Volcano/LAZ/E262N1546_LAZ_PL1.laz
Adding 1 - E:/data/Volcano/LAZ/E262N1547_LAZ_PL1.laz
Adding 2 - E:/data/Volcano/LAZ/E262N1548_LAZ_PL1.laz
@donno
donno / gnaf.py
Created May 8, 2020 13:48
List addresses with their latitude and longitude from the Geocoded National Address File.
"""GNAF is the Geocoded National Address File.
The G-NAF is Australia's authoritative, geocoded address file.
It is produced by PSMA Australia (psma.com.au) but is freely
available.
The data for this script is available from:
https://data.gov.au/dataset/geocoded-national-address-file-g-naf
Detail of the file format:
@donno
donno / internet_usage_graph.py
Last active May 11, 2020 14:41
Generate plots of my Internet usage
"""Generate monthly usage graphs for Internet usage.
Usage is classified as metered and unmetered.
Known issues
- There is excess padding before the first bar and after the last bar.
TODO
- Support quarterly and yearly graphs
@donno
donno / Output
Created July 10, 2020 14:05
Python module for working with LVX (File format by Livox)
$ python lvx_reader.py HorizonSample.lvx
Container:
public_header_block = Container:
signature = b'livox_tech\x00\x00\x00\x00\x00\x00' (total 16)
version = ListContainer:
1
1
0
0
magic_code = 2886641511