Skip to content

Instantly share code, notes, and snippets.

View Yaulendil's full-sized avatar

Yaulendil

  • Single
  • Michigan
View GitHub Profile
@Yaulendil
Yaulendil / format.py
Last active May 27, 2021 15:50
HexChat plugin for Twitch.tv stream chat IRC bridge; implements channel events, user purges, and badges
__module_name__ = "Twitch Formatter"
__module_version__ = "2.16.4"
__module_description__ = (
'(irc.twitch.tv) Subscription notifications, name shortening, user "badges", and more'
)
"""
By @Davarice
Formatting plugin for use with HexChat and Twitch.TV
@Yaulendil
Yaulendil / mastermind.py
Created November 4, 2018 04:10
A quick implementation of Mastermind
from numpy import random as npr
SECRET = [npr.randint(1,7) for _ in range(4)]
TURN = 0
guesses = []
def tryseq(sequence):
"""
[2, 2, 5, 4] for example
:type sequence: list
@Yaulendil
Yaulendil / ffedit.py
Last active September 8, 2019 08:55
FFedit: A prompt-based Python Wrapper around FFmpeg.
#!/usr/bin/env python3
"""A semi-interactive tool to manipulate the contents of a video file using
FFprobe and FFmpeg.
Provide a file and it will be analyzed with FFprobe. A prompt will then be
provided to allow interactive renaming of streams in the file. An empty
Input to the prompt will run the FFmpeg Command and move on to the next
File.
Created because I am too dumb to memorize all the options FFmpeg has.
@Yaulendil
Yaulendil / bits.py
Created September 25, 2019 04:48
Module for representation of bytes as UTF-16 Braille Characters for direct visualization of the bits.
from itertools import product
_hexd = "0123456789ABCDEF"
# Pairs of Hexadecimal Digits as Unicode Characters.
byte_pairs = tuple(map("".join, product(_hexd, _hexd)))
# Braille Characters. The Index of each Character is also its Integer Value.
@Yaulendil
Yaulendil / olden.py
Last active November 6, 2019 23:11
A String converter for a pseudo Middle English style, c. AD 1150.
"""Small Module providing text "conversion" into a pseudo-Middle-English style.
Based mostly, but loosely, on the orthography of Middle English c. AD 1150.
"""
from functools import partial
from re import compile
from typing import Any, Callable, Dict, Match, Union
__all__ = ("antiquate", "SubMap")
@Yaulendil
Yaulendil / rxfmt.py
Created August 31, 2020 20:23
RxFmt - A streamlined factory function for reformatting Python Strings, using Regular Expressions and groups.
"""RxFmt: Implements a factory function to convert a Regular Expression Pattern,
a String, and a Dict into a new function. The new function takes a String,
breaks it into the groups in the Pattern, and formats the groups into a new
String.
Example:
>>> hl = reformatter(
... r"(?P<INDEX>\d+)\W*(?P<WORD>.*)", # RegEx Pattern defining named groups.
... "{WORD} : {INDEX:0>3}", # Python String taking the groups as fields.
... {"WORD": str.upper} # (Optional) Dict mapping group names to functions.
@Yaulendil
Yaulendil / color.sh
Created December 19, 2020 20:36
Bash Function for easy ANSI color codes
function color() {
reset=(reset)
if ( [[ -z "$1" ]] || [[ "$@" == "$reset" ]] ); then
echo -en "\e[0m"
else
style=22
class=3
color=0