bikegogl.blogg.se

Single line ascii art
Single line ascii art








single line ascii art
  1. SINGLE LINE ASCII ART HOW TO
  2. SINGLE LINE ASCII ART CODE

Pokemon = get_pokemon(pid=pid,pokemons=pokemons)Īvatar = "%s\n\n%s" print_screen = True: Pid = numpy.mod(hash(string),number_pokemons) # The IDs are numbers between 1 and the max :param include_name: if True, will add name (minus end of address after to avatar :param print_screen: if True, will print ascii to the screen (default True) and not return :param pokemons: an optional database of pokemon to use '''get_avatar will return a unique pokemon for a specific avatar based on the hash The function is pretty simple, it looks like this:ĭef get_avatar(string,pokemons=None,print_screen=True,include_name=True): This means that, given that the database doesn’t change, and given that the pokemon have unique IDs in the range of 1 to 721, you should always get the same remainder, and this number will correspond (consistently!) with a pokemon ascii. I take the hash of a string, and then use modulus to get the remainder of that number divided by the number of pokemon in the database. I came up with a simple algorithm to do something like this. I thought about this, and likely the basis for all of these avatar generators is to use the ID to generate a HASH, and then have a function or algorithm that takes the hash and maps it onto an image (or cooler) selects from some range of features (e.g., nose mouth eyes) to generate a truly unique avatar. Now that we have ascii images, each associated with a number from 1 to 721, we would want to be able to take some unique identifier (like an email or name) and consistently return the same image.

SINGLE LINE ASCII ART CODE

Huge thanks, and complete credit, goes to the author of the original code, and a huge thanks for sharing it! This is a great example of why people should share their code - new and awesome things can be built, and the world generally benefits! Associate a pokemon with a unique ID New_image = image.resize((new_width*2, new_height))

single line ascii art

# This scales it wider than tall, since characters are biased New_height = int(aspect_ratio * new_width) (original_width, original_height) = image.sizeĪspect_ratio = original_height/float(original_width) The SELECT statement at the end just queries the "a" CTE to retrieve all lines of ASCII-art, one by one."""Resizes an image preserving the aspect ratio. Finally, each row in the "a(t)" CTE holds a string which is a single line of the output ASCII-art. The "m2(iter,cx,cy)" CTE holds the maximum number of iterations reached when starting at point cx,cy. The number of iterations in this example is limited to 28 (which severely limits the resolution of the computation, but is sufficient for low-resolution ASCII-art output). Each row in the "m(iter,cx,cy,x,y)" CTE means that after "iter" iterations, the Mandelbrot iteration starting at cx,cy has reached point x,y.

single line ascii art

In this query, the "xaxis" and "yaxis" CTEs define the grid of points for which the Mandelbrot Set will be approximated. SELECT group_concat(rtrim(t),x'1f') FROM a SELECT max(iter), cx, cy FROM m GROUP BY cx, cy SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis Yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y<1.0), Xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x<1.2), The following query computes an approximation of the Mandelbrot Set and outputs the result as ASCII-art: WITH RECURSIVE "C:\Program Files\Sophos\Live Query\SophosOsqueryExtension.exe" -verbose -socket \\.\pipe\sophososquery.sock "C:\Program Files\Sophos\Live Query\SophosOsquery.exe" -allow_unsafe -socket \\.\pipe\sophososquery.sock Some folks find it easier to develop queries from the cmdline as opposed to from central.

single line ascii art

SINGLE LINE ASCII ART HOW TO

Below shows how to launch the SophosOsquery.exe and the Extension we use for journal access. has both a great detailed explanation of the statements available in sqlite (Most are available in Live Discover but not all) and some excellent examples.įor this one to run with the output the way it wants I had to start SophosOsquery.exe from a cmdshell. For a good set of examples and explanation of what is possible with SQLite you can simply search the internet with your favorite search engine. You can see recursion used with the Process Tree queries we published and the WITH clause in a number of other queries where we want to build some sort of temporary table that another select statement will join with. Using the WITH and WITH RECURSIVE clause really opens up a lot of power.










Single line ascii art