Skip to content

Instantly share code, notes, and snippets.

View csm10495's full-sized avatar

Charles Machalow csm10495

View GitHub Profile
"""
iseq.py - A script for comparing the speed of is, ==, and neither with boolean values
csm10495 - Charles Machalow - MIT License
Hint: Usually == is slowest. Neither is fastest
"""
import timeit
def testN(n=1000):
"""
@csm10495
csm10495 / bdm241.py
Created October 18, 2015 17:29
Bomb Defusal Helper
"""
bdm241.py - Bomb Defusal Manual Version 1. Verification Code 241.
This file contains functions to solve various challenges faster than using the guide for 'Keep Talking and Nobody Explodes'
(C) - Charles Machalow - MIT License
"""
import itertools
words = ["about", "after", "again", "below", "could", "every", "first", "found", "great", "house", "large", "learn", "never", "other", "place", "plant", "point", "right", "small", "sound", "spell", "still", "study", "their", "there", "these", "thing", "think", "three", "water", "where", "which", "world", "would", "write"]
morse_seqs = {
@csm10495
csm10495 / enumToString.py
Created January 4, 2016 06:00
Python Script to make a function to get a std::string for a given C++ enum's values.
"""
Brief:
This file can be used to convert C++ enum code into a function to get a std::string from enum value.
To use: Copy and paste the entire enum code (from MSDN) as input to the script.
Output goes to an 'out.txt' file.
Author:
Charles Machalow
"""
lowCaseFirstLetter = lambda s: s[:1].lower() + s[1:] if s else ''
@csm10495
csm10495 / enumToPyDict.py
Created May 8, 2016 06:41
Script to make a Python dictionary from C++ enum
"""
Brief:
This file can be used to make a Python dict from a c++ enum.
Simply copy-paste the enum from typedef to end as input and
out.txt will be created with it as a Python dict.
Author:
Charles Machalow
"""
@csm10495
csm10495 / structToPython.py
Last active May 8, 2016 06:42
Script to make a ctypes Structure from C++ enum
"""
Brief:
This file can be used to make a ctypes Structure from a c++ struct.
Simply copy-paste the structure from typedef to end as input and
out.txt will be created with it as a Structure
You may need to make some type fixes...
Author:
Charles Machalow
"""
@csm10495
csm10495 / regexFiles.py
Created October 3, 2016 05:02
Quick and Dirty Recursive File Regex Counter
'''
Brief:
This searchs a directory recursively (by default the current directory) for a given regex match. The total number of matches is counted and printed at the end.
By default, it looks for lines where the author tag is given but there is no name provided.
Author(s):
Charles Machalow
'''
import os, re
REGEX = re.compile(r".*Author.*:\n(?:\s*|\s*\'\'\'\s*|\s*\"\"\"\s*)\n")
MAX_FILE_SIZE = 1024 * 128 #128 KB
@csm10495
csm10495 / selfExtractorMakerPyinstaller.py
Last active March 22, 2017 05:05
A Python based folder extractor. Save a folder to a .py or .exe, use the result to extract anywhere, even if you don't have Python!
"""
Brief:
This script makes a self-extracting .py/,exe of a given folder
Author:
Charles Machalow
"""
import argparse
import base64
import os
@csm10495
csm10495 / ast_test.py
Created October 26, 2017 13:52
Play around with Python's Abstract Syntax Tree, to see if we can say that a function will call a specific function (and what the args to that call would be).
'''
Brief:
ast_test.py - Quick and dirty test code of the Python abstract syntax tree.
The big thing is the ability to (sort of) see if a function calls another
specific function.
License:
MIT License - 2017
Author(s):
@csm10495
csm10495 / snb.py
Last active December 16, 2017 18:29
Hides the red box around a Skype screenshare
'''
Brief:
snb.py - Removes the red border Skype makes when screensharing.
Also sets Skype to low priority with a processor affinity to only run on one cpu/core.
This should help keep game/other app performance decent.
Description:
Run the script once when the border is up, and it will go away
(C) - MIT License - 2017
@csm10495
csm10495 / Enum.h
Last active September 9, 2018 04:48
Silly.. though functional self-describing C++ enums.
See https://github.com/csm10495/Enum.h/blob/master/StringEnums/Enum.h for the latest.