You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am surprised by how great TMatrix's output is, the gradient looks amazing, and I think another good feature would be giving more control on which characters are shown.
The idea comes from will8211/unimatrix and the implementation there is actually very simple, there are two command-line parameters, one for predetermined charsets and other for custom characters. I believe even just one of the two strategies would already be a good additioon to TMatrix, and sooner or later I'll probably implement this to some extent even if just for me to use it, so I may be able to send a PR.
Then for the charsets option just concatenate the characters for each specified Charset into a Variable with all possible characters. And to make things even simpler, the custom characters passed through the parameter are saved as one of the charsets:
# "-l" option has been usedifargs.character_list:
chars=''forletterinargs.character_list:
try:
chars+=char_set[letter]
exceptKeyError:
print("Letter '%s' does not represent a valid character list."%letter)
exit()
And just pick a random character from the all-possible-characters variable to display:
@staticmethoddefget_char():
""" Returns a random character from the active character set """returnchars[randint(0, chars_len)]
This has the advantage of specifying not only which characters are available but also how common or rare each character is.
I'd probably use a lambda for the "m" charset and maybe using a lambda or something to generate charsets in a cleaner way
In Ruby (which is my go-to language) for instance, I can do stuff like this:
I am surprised by how great TMatrix's output is, the gradient looks amazing, and I think another good feature would be giving more control on which characters are shown.
The idea comes from will8211/unimatrix and the implementation there is actually very simple, there are two command-line parameters, one for predetermined charsets and other for custom characters. I believe even just one of the two strategies would already be a good additioon to TMatrix, and sooner or later I'll probably implement this to some extent even if just for me to use it, so I may be able to send a PR.
The implementation on Unimatrix is pretty simple:
First there's an Object/Hash/etc with the predefined charsets:
Then for the charsets option just concatenate the characters for each specified Charset into a Variable with all possible characters. And to make things even simpler, the custom characters passed through the parameter are saved as one of the charsets:
And just pick a random character from the all-possible-characters variable to display:
This has the advantage of specifying not only which characters are available but also how common or rare each character is.
I'd probably use a lambda for the "m" charset and maybe using a lambda or something to generate charsets in a cleaner way
In Ruby (which is my go-to language) for instance, I can do stuff like this:
So putting that together with my love for hackish stuff, I'd most likely consider taking arguments formatted as something like:
...so I could do this kinda madness:
Or the slightly more readable and less quirky:
Pretty neat for less than 10 lines of code, if I do say so myself... And I think this covers pretty much everything I might want.
The text was updated successfully, but these errors were encountered: