Skip to content

Instantly share code, notes, and snippets.

[00] Oblivion.esm - [REFR:0009BDDC] (places OblivionRDCitadelEntrance "The Tower Portal" [DOOR:00051A95] in GRUP Cell Persistent Children of [CELL:00099D92] (in OblivionRD007 "Wastes of Oblivion" [WRLD:00099C15]) at -2,-1)
[00] Oblivion.esm - [REFR:0009BDDE] (places OblivionRDCaveExit "Nether Tunnels" [DOOR:0005191F] in GRUP Cell Persistent Children of [CELL:00099D92] (in OblivionRD007 "Wastes of Oblivion" [WRLD:00099C15]) at -1,-2)
[00] Oblivion.esm - [REFR:0009BDDF] (places OblivionRDCaveEntrance "Nether Tunnels" [DOOR:0005191E] in GRUP Cell Persistent Children of [CELL:00099D92] (in OblivionRD007 "Wastes of Oblivion" [WRLD:00099C15]) at 0,-2)
[00] Oblivion.esm - [REFR:0009BDE9] (places OblivionGatetoTamriel "Oblivion Gate" [DOOR:00051925] in GRUP Cell Persistent Children of [CELL:00099D92] (in OblivionRD007 "Wastes of Oblivion" [WRLD:00099C15]) at -1,1)
[00] Oblivion.esm - [REFR:00055FCA] (places CitadelMainTowerDoor01 "The Tower Portal" [DOOR:000314D5] in GRUP Cell Persistent Children of [CELL:00054A09] (
@Infernio
Infernio / LICENSE
Last active February 6, 2021 17:27
### GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
import __builtin__
orig_getattr = __builtin__.getattr
_getattr_sentinel = object()
def getattr_py3(object, name, default=_getattr_sentinel):
if isinstance(name, bytes):
raise TypeError(u'Do not pass bytestrings to getattr!')
if default is not _getattr_sentinel:
return orig_getattr(object, name, default)
else:
@Infernio
Infernio / gist:b34b47797e32581f9fcd93b8315a1dd1
Last active August 13, 2020 00:30
Memory dump after building BP, no duplicate objects
types | # objects | total size
================================================================================================ | =========== | ============
dict | 20426 | 8.37 MB
str | 67990 | 5.37 MB
unicode | 28008 | 2.00 MB
set | 11611 | 1.43 MB
tuple | 26449 | 1.39 MB
type | 2902 | 1.28 MB
@Infernio
Infernio / gist:f07ddbbbd39984d544003e74bc79e38f
Created August 13, 2020 00:31
Memory dump after building BP, duplicate objects included
This file has been truncated, but you can view the full file.
types | # objects | total size
================================================================================================ | =========== | ============
dict | 24028 | 11.91 MB
str | 246980 | 10.68 MB
type | 15499 | 6.52 MB
unicode | 35173 | 2.33 MB
tuple | 28716 | 1.53 MB
set | 11611 | 1.43 MB
PS C:\Users\Infernio> py -2 -m timeit -s """
>> class Foo(object):
>> bar = 'test'
>>
>> o = Foo()
>> getter = o.__getattribute__
>> """ "getter('bar')"
10000000 loops, best of 3: 0.044 usec per loop
PS C:\Users\Infernio> py -2 -m timeit -s """
>> class Foo(object):
@Infernio
Infernio / gist:800526e1a9e8d2d32d788763c0a15429
Created November 30, 2020 22:43
Destructible records in Skyrim.esm
[00] Skyrim.esm - ResourceObjectFarm [ACTI:0001DA07]
[00] Skyrim.esm - ResourceObjectMine "Smelter" [ACTI:0001DA0D]
[00] Skyrim.esm - MS04Hearth "Forge" [ACTI:0002267B]
[00] Skyrim.esm - DA10BoethiahStatue "Boethiah Statue" [ACTI:00022F0D]
[00] Skyrim.esm - TG02BeeHive [ACTI:00025D94]
[00] Skyrim.esm - TG04TempMover "Move Gulum-Ei to Cave" [ACTI:0002CC4F]
[00] Skyrim.esm - MG05Rubble "Debris" [ACTI:000327C7]
[00] Skyrim.esm - CWFortNorPortcullis "Portcullis" [ACTI:00038780]
[00] Skyrim.esm - DA16FirstRemains "First Remains" [ACTI:000242E2]
[00] Skyrim.esm - DA16SecondRemains "Second Remains" [ACTI:0002995D]
@Infernio
Infernio / dice.py
Created December 16, 2020 16:32
Decently fast 'dice simulator' in Python for calculating chances and expected value for n throws
import sys
import time
from collections import Counter
from random import randint
def chances(results):
total = sum(results.values())
return {k: v / total for k, v in results.items()}
def avg(chances):
@Infernio
Infernio / wb_mem_dump.py
Last active January 6, 2021 18:06
WB Memory Investigation, Part 1
[u'37066 dicts, taking up 32.2 MB',
u'93220 unicodes, taking up 12.8 MB',
u'29430 sets, taking up 6.9 MB',
u'50022 tuples, taking up 6.4 MB',
u'80488 builtin_function_or_methods, taking up 4.9 MB',
u'61970 strs, taking up 4.5 MB',
u'286 frozensets, taking up 4 MB',
u'2243 types, taking up 2 MB',
u'11031 lists, taking up 1.5 MB',
u'10209 codes, taking up 1.2 MB',
@Infernio
Infernio / wb_dict_sizes.py
Created January 6, 2021 18:06
WB Memory Investigation, Part 2
[u'17.2 MB',
u'10.6 MB',
u'10.6 MB',
u'10.6 MB',
u'8.6 MB',
u'8.6 MB',
u'6.8 MB',
u'5.4 MB',
u'5.4 MB',
u'5.4 MB',