Skip to content

Involved, non-intuitive solutions for relatively simple problems.

Notifications You must be signed in to change notification settings

ABuffEr/crazyCodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crazy Codes

A collection of brief codes, quite useless or unlikely applicable, to solve in a shorter or involved manner some relatively simple problems.

Problems that, for majority of cases, come from my friend and colleague Emmanuel Schoysman, and which he uses to torture me for days and days. 😄

Ok, there could be serious things too... but it's not guaranteed. 😛

Python module redirection

Is there a way to make a module-in-the-middle attack? To run a filter between a module importer and a module imported from it? To intercept and alert about deprecations?

A first experiment (lacking of the class patching part) around PEP 562. Wrapper, diverted and main modules.

(for a single module redirection, see the repo tree under moduleWrapping/singleModule)

Python module customs

What's imported? What's used from this import?

A experiment to discover it statically, using ast: code

(manually run by command-line with your .py as argument, i.e.: "py -3.7 customsStaticAnalyzer.py your.py")

Old (Python 2)

Splitter Regex

A exercise/challenge to build a (monstrous) regex to split a string, in all possible cases.

Explanation and Python code.

Function Chooser

A code density exercise, to apply different functions on list items according to satisfied predicates.

Explanation and Python code.

Padding Regex

An attempt to use regex for padding; in practice, a replacing example using a function rather than a pre-determined string.

Explanation and Python code.

Compact Fast Modular Exponentiation

A challenge to minimize the well-known function for modular exponentiation.

Explanation and Python code.

About

Involved, non-intuitive solutions for relatively simple problems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages