Skip to content

Instantly share code, notes, and snippets.

@ChadSki
ChadSki / weap.py
Created March 5, 2016 23:44
Plugin Comparison
from basicstruct import field
from halolib.structs.halostruct import define_halo_struct
from halolib.structs import halofield
tag_types['weap'] = define_halo_struct(struct_size=0x504,
model=halofield.TagReference(offset=0x28),
animation=halofield.TagReference(offset=0x38),
collision=halofield.TagReference(offset=0x70),
physics=halofield.TagReference(offset=0x80),
magazines=halofield.StructArray(offset=0x4F0, struct_size=112,
import field
from structs import BasicStruct, HaloStruct
MapHeader = \
BasicStruct("MapHeader",
integrity=field.Ascii(offset=0, length=4, reverse=True),
game_version=field.UInt32(offset=4),
map_size=field.UInt32(offset=4),
index_offset=field.UInt32(offset=16),
metadata_size=field.UInt32(offset=20),
@ChadSki
ChadSki / kyloren.md
Last active December 31, 2015 20:35
STAH WAHS

Deleted scene with important dialogue between Snoke and Ren

“Kylo Ren, I watched the Galactic Empire rise, and then fall. The gullible prattle on about the triumph of truth and justice, of individualism and free will. As if such things were solid and real instead of simple subjective judgments. The historians have it all wrong. It was neither poor strategy nor arrogance that brought down the Empire. You know too well what did.” Ren nodded once. “Sentiment.” “Yes. Such a simple thing. Such a foolish error of judgment. A momentary lapse in an otherwise exemplary life. Had Lord Vader not succumbed to emotion at the crucial moment—had the father killed the son—the Empire would have prevailed. And there would be no threat of Skywalker’s return today.” Ren has this interesting concept of being seduced by the light side of the force

kinda inverse Luke

#############
## Python
#############
*.py[co]
# Packages
*.egg
*.egg-info
dist
build
@ChadSki
ChadSki / local_ip_addresses.fs
Created October 26, 2015 22:40
Find local IP addresses using F#
open System
open System.Net
open System.Net.NetworkInformation
open System.Net.Sockets
let localIPs () =
let networkInterfaces = NetworkInterface.GetAllNetworkInterfaces()
|> Array.filter(fun iface -> iface.OperationalStatus.Equals(OperationalStatus.Up))
let addresses = seq {
@ChadSki
ChadSki / proxy.py
Last active October 25, 2015 21:12
Wraps an object and always casts properties to string
class Proxy(object):
"""Wraps an object and always casts properties to string"""
def __init__(self, obj_to_proxy):
self._obj = obj_to_proxy
def __getattr__(self, attr_name):
"""Pass through to proxied object, but return result as a string."""
return str(getattr(self.obj, attr_name))
# Labrynth generator for The A-MAZE-ing Labyrinth board game
import random
import turtle
from turtle import fd, bk, rt, lt, up, down
from enum import Enum
Orientation = Enum('Orientation', 'North East South West')
Shape = Enum('shape', 'Straight Corner Tee')
if x > 3:
pass
else:
if x > 0:
pass
# semantically identical to
if x > 3:
pass
@ChadSki
ChadSki / Create VM.reg
Created July 31, 2015 03:35
Adds a "Create VM" option to the context-menu for VHD files.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Windows.VhdFile\shell\Create VM\command]
@="powershell.exe \"$fullpath = \\\"%1\\\"; $name = [io.path]::GetFileNameWithoutExtension(\\\"$fullpath\\\"); New-VM -Generation 1 -BootDevice VHD -MemoryStartupBytes 1GB -SwitchName \\\"New Virtual Switch\\\" -Name \\\"$name\\\" -VHDPath \\\"$fullpath\\\"\""
>>> bar = "asdf\\asdf\\asdf\\qwer"
"asdf\asdf\asdf\qwer"
>>> bar.replace(/\\/g, "sssss")
"asdfsssssasdfsssssasdfsssssqwer"