This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define a class with a method | |
function MyClass(value) { | |
this.value = value; | |
this.function = function() { | |
return this.value; | |
}; | |
} | |
// Instanciate the class | |
my_class = new MyClass("my value"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoopLabel(object): | |
def __init__(self): | |
super(LoopLabel, self).__init__() | |
class MyLoopLabel(Exception): pass | |
self._label_exception = MyLoopLabel | |
def __enter__(self): | |
return self._label_exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
class Default(object): | |
def __init__(self, name): | |
super(Default, self).__init__() | |
self.name = name | |
def set_defaults(defaults): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<style> | |
#byte_content { | |
margin: 5px 0; | |
max-height: 100px; | |
overflow-y: auto; | |
overflow-x: hidden; | |
} | |
#byte_range { margin-top: 5px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _remove_visual_c_ref(self, manifest_file): | |
try: | |
# Remove references to the Visual C runtime, so they will | |
# fall through to the Visual C dependency of Python.exe. | |
# This way, when installed for a restricted user (e.g. | |
# runtimes are not in WinSxS folder, but in Python's own | |
# folder), the runtimes do not need to be in every folder | |
# with .pyd's. | |
# Returns either the filename of the modified manifest or | |
# None if no manifest should be embedded. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import inspect | |
class Tracer(object): | |
def __init__(self): | |
self._indentation_level = 0 | |
@property | |
def indentation_level(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import operator | |
import construct | |
class ConstructGetter(object): | |
def __init__(self): | |
self._index = 0 | |
def __getattr__(self, name): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Attribute Abbreviation. | |
This file contains a metaclass that can be used to abbreviate attribute names for a class. | |
This is a POC made for fun. | |
Do yourself a favor and NEVER do this in actual code. | |
You've been warned. | |
""" | |
class AbbreviationError(Exception): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from easy_construct import cs, struct, Container | |
MyStruct = struct("MyStruct", | |
_0=cs.Magic("EZConstruct"), | |
variable=cs.UBInt32, | |
another_var=cs.UBInt16, | |
_1=cs.Padding(0x4), | |
array=cs.Bytes(13), | |
_2=cs.Magic("MagicEndsHere"), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Bitmapper | |
Usage: | |
bitmapper.py <input> <output> [<width>] | |
Options: | |
-h --help Show this screen. | |
<input> The input binary file. | |
<output> The output bitmap. | |
<width> The width of the bitmap in pixels. Optional. |
OlderNewer