This file contains hidden or 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
| ''' | |
| Might want to port this to C/C++ for a microcontroller in the future | |
| I'm sure the arduino IDE has a `rand()` package for a better, more optimized version though, but was still fun | |
| ''' | |
| # Custom random number generator parameters | |
| custom_seed = 123456789 # The seed value | |
| custom_a = 1664525 # Multiplier | |
| custom_c = 1013904223 # Increment | |
| custom_m = 4294967296 # Modulus, 2^32 |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from typing import Any | |
| # Consider using the same binary lookup table approach a `switch` statement in C/C++ uses? | |
| # NOTE: I know this is inefficient, I wrote this for fun / out of curiosity and did not allow myself to use any real hashing | |
| # simply trying to leverage `hash()` felt like cheating, looking up hashing algo's also felt like cheating. | |
| # Please don't assume I know nothing about hashing algo's from reading this | |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import os | |
| import re | |
| import sys | |
| ''' | |
| Example of how to dynamically trace all function calls for your python project, and not any other python code. | |
| use case: |
This file contains hidden or 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
| // Object comparison lib/functions. | |
| // These are intended to behave as one would expect vanilla JS to behave if JS wasn't so hacky. | |
| export const isObject = (a: any): boolean => { | |
| // Strictly check if something is an object. | |
| // Javascript is such a hacky language... -_- | |
| return typeof a === "object" && a !== null && !Array.isArray(a); | |
| }; | |
| export const isObjectOrArray = (a: any): boolean => { |
This file contains hidden or 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
| // ==UserScript== | |
| // @name WikiWand Redirect | |
| // @namespace InnateEssense.wikiwand | |
| // @version 0.1 | |
| // @description Automatically redirects wikipedia urls to wikiwand for a better UX | |
| // @author InnateEssense | |
| // @license MIT | |
| // @source TODO | |
| // @match en.wikipedia.org/wiki/* | |
| // @icon TODO |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Walmart Colorize Small Order Fee | |
| // @namespace InnateEssense.wallmart-fee-colorizer | |
| // @version 0.1 | |
| // @description Automatically colors the minimum order fee red for order under $35 with a $7 fee. | |
| // @author InnateEssense | |
| // @license MIT | |
| // @source TODO | |
| // @match www.walmart.com/* | |
| // @icon TODO |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Bypass Medium Paywall | |
| // @namespace InnateEssense.bypass_medium_paywall | |
| // @version 0.1 | |
| // @description Automatically bypasses medium.com's articles paywalls | |
| // @author InnateEssense | |
| // @license MIT | |
| // @source TODO | |
| // @match medium.com/* | |
| // @icon TODO |
This file contains hidden or 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 django.db import models | |
| class Permission: | |
| # Random permissions added here | |
| # Follow binary pattern 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, ... | |
| VIEW = 1 | |
| EDIT = 2 | |
| EXECUTE = 4 | |
| MANAGE_OTHERS = 8 |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| class Observable: | |
| def __init__(self, value): | |
| self._value = value | |
| self._subscribers = [] | |
| @property | |
| def value(self): |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # desired outcome: | |
| # expect(1).toBe(equal(1)) # True | |
| # expect(1).toBe(equal(2)) # False | |
| # expect(1).toBe(lessThan(2)) # True | |
| # expect(1).toBe(lessThan(1)) # False | |