This file contains 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 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 | |
This file contains 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 | |
''' | |
Just a fun project one night after work. | |
I enjoy this syntax. | |
''' | |
from typing import Any | |
from collections.abc import Callable |
This file contains 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 | |
''' | |
This will just keep summoning until you get the desired outcome and give you the stats. | |
The results are pretty close to what you'd expect, but sometimes it's fun to simulate how much it would take for the desired outcome. | |
''' | |
import random | |
from argparse import ArgumentParser |
This file contains 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 random import randint | |
# http://edspi31415.blogspot.com/2014/01/probability-odds-of-winning-at-slot.html | |
''' | |
Just the base logic I wrote for a take home assignment for a potential job | |
''' | |
class SymbolsMap: | |
# Using this structure, if we wanted, we could also display the slot above and below it. as if it was a real slot machine. |
This file contains 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 | |
''' | |
This is just a simple script which will scrape a random bible verse | |
and then send it as a Text Message from your E-mail address. | |
Throw it in a cronjob or use windows task scheduler to get a daily verse. | |
destination number must be formatted like this: "{number}@{domain}" |
This file contains 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
// started making a tetris game & ran into "How would I rotate this piece?" | |
// I liked this solution due to it's simplicity, albeit, I'm sure a more mathematical approach would have it's advantages. | |
// For something like tetris on modern hardware, this should be fine. | |
// To rotate it to the right, just rotate it left 3x, to rotate 180 degrees, either call it twice or possibly invert the order of the functions | |
function rotateTetriminoLeft(piece) { | |
function rows_to_columns(rows) { | |
let retval = [] | |
for (let i = 0; i < rows.length; i++) { |
This file contains 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 | |
# A simple python quine. | |
# A quine being a program which outputs it's source code when ran. | |
# This sounded more interesting in theory than it really is in practice. | |
import sys | |
fname = sys.argv[0] | |
with open(fname) as f: |
This file contains 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
M = {} | |
-- NOTE: Just use the built-in pattern matching instead of this. | |
-- This basically just parses your root lvim user config file | |
-- and makes additional autocommands to recompile & reload your | |
-- configs for lunarvim whenever any nested config files are altered. | |
-- without this, lvim will require a manual recompile and reload to | |
-- reflect changes in files other than config.lua (or whatever your root lvim user config file is) |
This file contains 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 pwsh | |
# My gist: https://gist.github.com/JackofSpades707/730739e1d85dc6fc3c6eb4a4f1f41e7b | |
# Inspired by: https://damopewpew.github.io/nvim/wsl/godot/unity3d/vim/2020/02/29/wsl-nvim-as-external-editor.html | |
Write-Output "[*] Args: $args" | |
$file=$args[0] | |
$file=(wsl.exe wslpath "$file") | |
Write-Output "[*] wslpath: $file" | |
$basename=(Split-Path "$file" -leaf) |
NewerOlder