Skip to content

Instantly share code, notes, and snippets.

View lethosor's full-sized avatar

Alan lethosor

View GitHub Profile
GLOBALS_DF = {
"point" : "selection_rect",
"menuposition" : "ui_menu_width",
"itemmade" : "created_item_type",
"itemmade_subtype" : "created_item_subtype",
"itemmade_subcat1" : "created_item_mattype",
"itemmade_subcat2" : "created_item_matindex",
"itemmade_number" : "created_item_count",
"mainview" : "map_renderer",
"title2" : "title_spaced",
static int internal_listStructFields(lua_State *L)
{
if (Lua::IsDFObject(L, 1) != Lua::OBJ_TYPE)
luaL_argerror(L, 1, "type expected");
if (!lua_getmetatable(L, 1))
luaL_error(L, "failed to retrieve type metatable");
lua_rawgetp(L, 2, &DFHACK_IDENTITY_FIELD_TOKEN);
auto tid = static_cast<type_identity*>(lua_touserdata(L, 3));
@lethosor
lethosor / __init__.py
Last active April 1, 2020 05:41
supybot kick plugin
###
# Copyright (c) 2014, Mike Stewart
# 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,
@lethosor
lethosor / interface.txt
Last active November 27, 2017 02:49
0.44.02 keybindings
[BIND:SELECT:REPEAT_NOT]
[SYM:0:Enter]
[SYM:0:Numpad Enter]
[BIND:SEC_SELECT:REPEAT_NOT]
[SYM:1:Enter]
[SYM:1:Numpad Enter]
[BIND:DESELECT:REPEAT_NOT]
[KEY:z]
[BIND:SELECT_ALL:REPEAT_NOT]
@lethosor
lethosor / .gitignore
Last active July 6, 2017 02:25
Python DFHack test
include/python
*.o
embed
libpython*
[info]
checksum=0x8fce00fb
version_name=v0.43.05 osx32
complete=true
[addresses]
cur_year_tick=0x01b66a48
current_year=0x01b66a40
dwarf_civ_index=0x01b68f68
dwarf_race_index=0x01b68f74
[info]
checksum=0xaf8cc86c
version_name=v0.43.05 linux64
complete=true
[addresses]
cur_year_tick=0x01a77260
current_year=0x01a77280
dwarf_civ_index=0x01a70a08
dwarf_race_index=0x01a70a14
[info]
checksum=0xdecc5bff
version_name=v0.42.02 osx
complete=true
[addresses]
translation_vector=0x01bfd00c
language_vector=0x01bfcff4
creature_vector=0x01afd40c
active_creature_vector=0x01afd418
@lethosor
lethosor / malloc-perturb.cpp
Last active August 29, 2015 14:23
OS X MALLOC_PERTURB_ implementation
#include <dlfcn.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef __APPLE__
#define LIBC "libc.dylib"
#else
@lethosor
lethosor / Multiwiki.php
Last active January 4, 2016 09:49
LocalSettings.php allowing multiple MW instances in the same directory
<?php
namespace Localsettings_switch;
$wikis = array(); // Add wikis to this array, corresponding to settings file - e.g. "test" should have its settings in settings/test.php
$activeWiki = preg_replace('/[^a-z]/', '', @file_get_contents(__DIR__ . '/active_wiki.txt'));
$settings = __DIR__ . "/settings/$activeWiki.php";
if (in_array($activeWiki, $wikis) && file_exists($settings)) {
require_once $settings;
}
else {
$wikis = implode("</li>\n<li>", $wikis);