Skip to content

Instantly share code, notes, and snippets.

View sdshlanta's full-sized avatar

Mike Shlanta sdshlanta

  • Los Alamos National Lab
  • Los Alamos, NM
View GitHub Profile
@sdshlanta
sdshlanta / metaBS.py
Last active July 25, 2016 16:03
Because I got tired of writing self.x all the time when making data classes
class dataClassTemplate():
_fields = []
def __init__(self, *args):
for name, val in zip(self.__class__.fields, args)
setattr(self, name, val)
class Record(dataClassTemplate):
_fields = ["owner", "systemName"] #put the names of the feilds in here
r = Record("Hello","world")
@sdshlanta
sdshlanta / sillyThing.py
Created August 3, 2016 14:02
A silly thing I made with openCV it detects faces and sticks an image over them
import cv2
import sys
imagePath = sys.argv[1]
cascPath = sys.argv[2]
kronk = cv2.imread(sys.argv[3], -1)
faceCascade = cv2.CascadeClassifier(cascPath)
image = cv2.imread(imagePath)
def boilerPlate(servName):
def realDec(opener):
def newOpen(*args, **kwargs):
while not TheEndOfTime:
try:
opener(*args, **kwargs)
except Exception, e:
if debug:
print servName
print e
Dear all,
As some of you may know today is my last day, I thought I would share some thoughts and feelings that I have had about working here at Citi.
I would like to thank you sincerely for the support and assistance you have offered me in my role. I have been proud to work for Citi over the past three months; it has been a journey that has provided me an unparalleled foundation to move forward to new and exciting opportunities.
As such, I have decided to become a professional pirate. It has always been a dream of mine to live the life of a swashbuckling corsair, beholden to none and master of all I survey. Once my crew of unabashed rogues is assembled, we shall take to the capacious expanse of the high seas to pursue fortune, fame, and hair-raising adventure.
Our path may not be filled with the porcine comforts and technological marvels that Citi provides, but we shall nonetheless move forward to carve a name for ourselves in the annals of bold insurgency and death-defying derring-do. Once I have a keen
@sdshlanta
sdshlanta / accessConsole.py
Last active June 9, 2017 16:58
I didn't have access to a copy of Microsoft Access but I still needed to get some data out of a mde so I put together this quick SQL console for it.
import pyodbc
import sys
import argparse
import os
import subprocess as sp
if not bool(filter(lambda x: 'Microsoft Access Driver' in x, pyodbc.drivers())): #empyt list == False
print("Please install the x64 version of the Microsoft Access ODBC which can be found here: https://www.microsoft.com/en-US/download/details.aspx?id=13255")
sys.exit()
@sdshlanta
sdshlanta / melvin.py
Created October 13, 2017 00:35
A Metasploit automation tool
#!/usr/bin/python
# horible monkey patching bullshit :P
import metasploit.msfrpc as msfrpc
# we need this because even though our replacement MsfModule.__init__ will go into the namespace of msfrpc
# this namespace is the highest it knows about and can't actually see into the namespace of msfrpc unless
# we bring stuff here.
from metasploit.msfrpc import MsfRpcMethod
def MsfModule__init__(self, rpc, mtype, mname):
"""
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#define SEGMENT 100
#define PRIMEMAX 1000
int comp (const void * elem1, const void * elem2) {
unsigned int f = *((unsigned int*)elem1);
@sdshlanta
sdshlanta / recursive_safe_dataclass_compare.py
Created April 13, 2023 17:28
This is a utility class for safely checking dataclass structures when they may contain circular references. Such as in the case of parent child relationships where parents have references to their children and the children have references to all of their parents.
from dataclasses import (
dataclass,
fields,
)
@dataclass(eq=False)
class RecursiveCompareMixin:
"""A utility class to provide recursion safe dataclass comparison.
"""
def __eq__(self, __o: object) -> bool: