Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastian Büttner Bueddl

View GitHub Profile
View php.hpp
#include <vector>
#include <iostream>
#define ​ auto
#define array(x...) std::vector{x}
#define as ,
#define rev(a, v) auto v : a
#define foreach(x) for (rev(x))
#define echo std::cout <<
@Bueddl
Bueddl / sort_maps_by_titlepack.sh
Created Jul 21, 2017
Sort ManiaPlanet maps into folders by titlepack
View sort_maps_by_titlepack.sh
find . -type f -iname '*.Gbx' -print0 |
while IFS= read -r -d $'\0' file; do
title=$(grep -aPo 'title="(.*?)"' "$file" | sed -r 's/.*?="(.*)"/\1/g')
titledir="repack/$title"
if [ ! -d $titledir ]; then
mkdir -vp $titledir
fi
filename=$(basename "$file")
cp -v "$file" "$titledir/$filename"
done
View find_maps_by_author.sh
#!/bin/bash
author=insen
find . -type f -iname '*.gbx' -print0 |
while IFS= read -r -d $'\0' file; do
if grep -aq 'author="$author"' "$file"; then
echo "Filename: $file";
uid=$(grep -aPo 'uid="(.*?)"' "$file" | sed -r 's/.*?="(.*)"/\1/g')
title=$(grep -aPo 'title="(.*?)"' "$file" | sed -r 's/.*?="(.*)"/\1/g')
@Bueddl
Bueddl / migrate_servers_batch.sh
Last active May 12, 2017
migrate server in batch
View migrate_servers_batch.sh
#!/bin/bash
# (C) 2017 by Sebastian 'bueddl' Büttner <tm@bueddl.de>
#
# MP4 & NADEO rocks!
# ---------------------------------------------------------------------
# !!!! ATTENTION !!!!
# You are supposed to change at least the next 2 variables.
@Bueddl
Bueddl / utf8decode.cpp
Created May 12, 2017
utf8 encoding test
View utf8decode.cpp
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <cassert>
// (C) 2017 by Sebastian 'bueddl' Büttner
void checkCodepoint(wchar_t codepoint)
{
// Primary requirement for validity of XML
@Bueddl
Bueddl / XmlRpcParsingTest.cpp
Last active May 11, 2017
Parsingtest for XmlRpc using tinyxml
View XmlRpcParsingTest.cpp
#include <tinyxml.h>
int main()
{
TiXmlDocument doc("../toffe.xml");
if(!doc.LoadFile())
{
std::cout << "Could not load XML File." << std::endl;
return 1;
@Bueddl
Bueddl / migrate_servers.sh
Last active May 11, 2017
Import your mp3 gameservers into mp4
View migrate_servers.sh
#!/bin/bash
# (C) 2017 by Sebastian 'bueddl' Büttner <tm@bueddl.de>
#
# MP4 & NADEO rocks!
# ---------------------------------------------------------------------
# !!!! ATTENTION !!!!
# You are supposed to change at least the next 2 variables.
View IPlugin.h
#pragma once
#include <iostream>
class IPlugin
{
public:
virtual void doSth() = 0; // muss implementiert werden
virtual void otherToDo()
View quota.sql
SELECT
r.`id` AS `rule_id`,
SUM(qu.`value`) AS `window_usage`,
TIMESTAMPDIFF(SECOND, NOW(), MIN(qu.`created_at`)) AS `eslapsed_window_first_usage`
FROM
quota_rules` qr
LEFT JOIN `rules` r
ON (r.`id` = qr.`rule_id`)
LEFT JOIN `actions` a
ON (a.`id` = r.`action_id`)
@Bueddl
Bueddl / my_string.cpp
Created Jan 25, 2017
Implementation of small string optimization
View my_string.cpp
#include <cstring>
#include <cstdio>
class my_string
{
private:
union
{
char inline_buf[16]; // sso
char *bufptr;
You can’t perform that action at this time.