Brett Code
Some folks solve crosswords.
Some folks make crosswords.
Some folks play computer games.
I write computer code.
Quick Links to the Main Stubs
A New Format! Now With Less Content!
001 - print
↠ assert
: A few short words on the subject.
000 - Blank: A Blank Pre-Formated Page.
2020 Projects
_ALPHA_CHANNEL_ is still alive and kicking.
Dead Code
This shall (if I can remember) be my Garbage Can of choice for unused code, whose useful life has come to an end.
2019 Projects
I'll expect to have only the single entry.
_ALPHA_CHANNEL_
Image Manipulations on the Command Line.
After years of programming, I am finally tackling the Command Line. These are my practice projects using G'MIC, ImageMagick, and any other Command Line Tool that looks useful, including PowerShell.
2018 Projects: The results are distributed elsewhere on the site. But there is no doubt, my interest in programming wanes.
2017 Projects
What's shown is only the tip of the iceberg!
HTML Named Entities
For a symbol like ©, one can either paste the symbol in as a character, use numeric codes (© in this case), or used the named entity (© for the © symbol). So, in it's construction, the page was good practice; and as a result, a nice little cheat sheet of sorts.
Circle Fill
Um, it's basically a fractal circle generator of sorts... or call it what it really is: Array Manipulation using Numpy. Yeah, that sounds better.
2016 Projects
It's the Year of the Mon'key, just in case you were wondering.
Tk Test Kitchen
I wanted to explore an environment in which I could have real time interaction with my code and Tkinter was the answer. Thus, in this write up, you'll find implementations of Tic Tac Toe (the classic game), Proximity (a Mine Sweeper clone), and Risk It (a simplistic territorial control game). Anyhow, Mission Complete, I think I've got that real time environment thing down... or at least, the initial building blocks. And those three games, a nice collection of sample code, if I do say so myself.
HTML Box Test
By this point, I've hand coded a few web hundred pages. OK, sure. Many of them are repetitive and based on templates. But all the same, I've put some thought into HTML syntax. And still, I can never seem to get complex pages right the first time... or the second... and am often forced to simplify complex designs to conform to my limited abilities. Well, it's time to change all that. Thus, this demo/tester page, laid out all nice and easy like for all the world to see how those div
tags really work.
Maze
What my people call a labyrinth?
A fairly short (and thus, hopefully sweet) post-mortem web page for a maze creation project I undertook in Python. Or if that's not clear: How I Learned to Stop Worrying About an Overflow and Came to Love the Stack or something witty like that.
2015 Projects
MutaGenetic Football™
There was a time when I was trying to put up a major web-page a week. I'd spend a few days coding and then throw something up. For this, I spent months coding the Genetic Algorithm. It was basically my Big Project for the Summer of 2015 (along with doing a bunch of travelling, so who knows how many hours were involved)... and now, I'm just getting around to posting it in late March of 2016, out of... what, not obligation, because obligation to who, but more because that's what I do. Without kicking the page too hard, because, let's face it, who knows how I'll feel about this page or even this project in a year (and my complaints have more to do with the page than the project), one thing is for certain, both the project and the web-page are long past their expire by date for me. Or in my vernacular, they're no longer ripe. My mind having moved on long ago. So, I guess, that means, even if I say I want the next web-page I do to be better than this, that's still setting the bar amazingly low. Oh, but, hey, happy reading. Maybe I should go take some Prozac or something.... or you know, spend a few minutes, long hours, whatever, thinking about what I have done (wrong), so I can avoid it next time.
HTML Tag Tutorial
- If coding a html page by hand (as say, opposed to this page which
KompoZer was kind enough to assemble), I use a minimum of tags. Most of
them are listed on this page.
Functional Programming
- A Lightning Talk presenting a quick introduction to the core concept
behind Functional Programming (i.e. immutability is a good thing, which
leads to... other good things).
Genetic Programming - A Lightning Talk presenting a quick introduction to the core concept behind Genetic Programming.
Image Cracking Tutorial - A Lightning Talk about basic image access and manipulation.
Craig Reynold's: Boids
- a basic implementation. Looking for a framework to start from, a
person could do worse. Perhaps I'll come back to this and add greater
functionality. For now, it mainly seems like a study in classes.
Conway's Life Bitwise Operator - Being pretty much what it sounds like, a bit a code with a few pictorial representations of The Game.
Python Library Review
- It makes sense to jot a few notes to myself after reviewing a Python
Library (or using it for the first time, whatever). This, then,
would be a place to record said notes... for all the world to see.
NxN: Pixelated GiF Effect - more picture work using Numpy. Don't ask me why I'd never tried to square (img*img) an image array before.
Mandelbrot Set
- A little fun with the Numpy Library. Now I know why so many
folks have played with the Mandelbrot Set themselves. It's
very-very basic and easy.
Never Get Out of the Boat
- Logical Programming in Python, The Eight Queens Problem, Family Tree
example, and why it's not a good idea to leave one's preferred
programming paradigm.
Forest for the Trees - a quick look at the tree structure and Genetic Programming... or something like that.
Hello PHP - a simple page that displays the history of when it was viewed and little else.
Note: I pulled this on August 2nd, 2016, as this lone php app required special permissions to be set with my web hosting company. And for such a cheesy demo, I deemed it cleaner and easier to delete the page. It wasn't that special, the entirely of the php code consisted of:
<?php
echo file_get_contents("php.txt");
$t = date("Y-m-d H:m:s") . "<br>\n";
file_put_contents("php.txt", $t, $flags=FILE_APPEND);
?>
HTML Tables as Image Display - The obvious sequel to a color wheel page and not a bad way to start the year, I like to think.
HTML: Color Reference - Just another color chart. The 'Hello World' of the CSS World.
2014 Projects
Weekly Python Code Snippets
- true, Python might not staty my language of choice forever. And
at that point, I'll change the heading to Weekly Code Snippets.
But until then, rather than start another Game Tyrants or Vision
Quest type blog, I hope to appease my urge to Blog by posting code
snippets here. We'll see how that works...
recurse
- a Python script that outputs a html file, whose contents, if viewed
in a browser and copied into another Python file, will result in the
same html being recreated. So, html to python to html ad
infinitum. Actually, quite a bit harder than it sounds. Of
limited practical value. But someday, the robots will be proud...
or not, one can never tell with that lot.
Flat Webpage Example Page
- part example, part come on, for services related to 'flat' web page
design: much like everything else on this site, code light, html heavy,
and about as simple and straightforward as a web page can get.
Oh, and it's got a pretty nice image header, as well, perhaps
worth checking out for that recursive gif imaging effect alone.
WebNodes
- part Graph Theory part Web Sniffer, a work in progress, to be sure,
but at the point it makes sense to push some output to the web.
If nothing else, this page contains a graphical
record/description of all my websites as of Late November 2014 and my thoughts concerning the improvements to a prototype web-sniffer I coded up on a lark.
HTML Symbol List
of the form &#XX; from 0-9999. © = © I
made this as a quick reference not really realizing I'd already done
more or less the same thing with the YUI Library (UTF Symbol Generator
Link Below). Anyhow, between the two, the code for this page is
much easier, much more straightforward; as I composed the text in
Python and then copied and pasted the lot wholesale. So it's a
static page, loads fast, and is pretty much exactly what I envisioned.
California Lottery Analysis
- A thorough analysis, complete with charts and graphs and a system for
picking the best draw game to play at any one time to maximize one's
long term profit. So, not so much about programming, as it is the
result of programming.
Vision Quest
- is where I am posting my Python Photomanipulation Imaging work: a
description which is perhaps too short, so let's say, I am interested
in manipulating photographs and turning them into works of art.
From there, often as not, I turn groupings of these photos into
short stories of sorts. Perhaps short on plot, but better than
just a gallery, in my opinion. Anyhow, that kind of photo fiction
can be found here along with insights into how the pictures were
created and more than a little bit of Python code. With any luck,
this will turn into a full on computer vision blog, but for now, it's
mostly about making pretty pictures.
Python Cheat Sheet -
I decided to start a reference sheet for myself, which as I go along
will be where I jot down whatever generalized knowledge I come
across in regards to the python programming language (List
Comprehensions and that sort of thing mainly, but who knows what comes
next.)
Transform Image Progression
is likely a totally unhelpful page title. Using imageMagick's
transform function to alter pictures (and make gif's out of the
results), I found creating a debugging image that showed what the
program was doing (the points of effect and how they changed from
beginning to end) was quite helpful and removed the need to stare at
matrixes of numbers for long periods of time.
HTML Text Input Scrubber for Python
- a simple function that reduces random text input to lower case
letters. Nothing fancy. But if I can't find a good answer
to what I'm working on. Looks like I'm going to start posting my
answers here.
LambdaBeans: "Cannot find Java 1.5 or higher"
I found the work around for this. I'm quite proud of
myself at the moment for figuring it out. And others may
have run into the same problem. Yes. It's silly. But
I really felt like a 'Hacker' for a moment, there.
One
could always do a web search to see what the various ASCII codes are
for. But that seems like a hassle, so instead I decided to write
a Python Script that would compile a list the ASCII in text file. It's not a difficult program, which is exactly as it should be. (Text File Here)
Quazy - Face of the Prophet
- utilizing the chart module from the YUI Library, I did a 'proof of
concept' program for a moving mouth. I'm actually quite happy
with this.
- Quazy - Face of the Prophet - Finish Screen for the Mouth with working control buttons
- Quazy - Face of the Prophet - build up and conceptual walk through
as I assembled the project. Not code examples, but working builds
as I moved from prototype to prototype if you're interested in that
sort of thing.
Barrel Roll - this precursor to Face of the Prophet can also be found at BrettStuff
YUI Tree Graphic - similiar to the HTML Tree below, but utilizing the YUI javascript library for sligtly different functionality.
HTML Tree Graphic - located on my
Brett Stuff spur. Pictures of a tree organized spatially in a tree like manner.
UTF - Symbol Generator
- Utilizes the YUI library to pump out the various symbols preloaded on
your web browser. There are literally hundreds of thousands of
them. Displayed in increments of a thousand at the push of a
button.
2014 -2013 Summary
As I look forward to 2014, this is what I'm most proud of (or at least, what I want to link back to) from 2013.
My paperJS tutorials, culminating in:
Also from paperJS, I continue to like
And perhaps most of all
- The Rectangle Game (this is singularly unimpressive on my iphone, so try a desktop mozzilla browswer for best results)
New
this year, it looks like I will be focusing more attention on Yahoo's
YUI library and other associated products, so the open database, too.
My first project for that is a
- UTF Symbol Generator (see
the hundred of thousands of preloaded symbols available on your browser
at the click of a few buttons... or until you get tired of clicking)
- A HTML Tree Graphic is next (photos presented in a non-standard array with resizing and perhaps other cool features)
2013 - Brett Code - 2013
I like to write. I'm into creative fiction. And somewhere
along the line, I heard that a good computer program is a lot like a
well written story. The idea sounded intriguing to me. And
as they say, the rest is history.
The computer languages I am interested in these days (and their associated libraries) are:
Python
BeautifulSoup
JavaScript
paperJS
paperJS (tutorial)
_.underscore
JavaScript
I have been focusing most of my programming effort on JavaScript.
It's open, easy to see, and doesn't require a LAMP stack or any other
sort of compiler to work, so it's the ideal starting place for
me. All I have to do is open a browser and what I've written either works or it
doesn't. Nothing could be easier. And that makes a lot of
sense to me as a place to start.
paperJS
I'd been playing with JavaScript for a while and I decided it was time
to learn a library or two (specialize at it were). And since I
like Vector Graphics, I opted to start with paperJS. I choose it
over Raphael mainly because I liked the documentation better (when you
download the code, you get the complete online reference in http if you
want and the website looks organized to me). Anyhow (personal
quirks aside), I have no idea which is better (Raphael or paperJS), maybe
I choose the more complicated of the two. But having made the
decision, I'm sticking with it. And these are the various
projects I have completed to date.
QuaziTronics (it's spelled correctly). For whatever reason, I find
this sort of graphical display to be amazingly soothing. Those
prone to epileptic seizures might beg to disagree. Ultimately, I
expect to come back to this one.
QuaziTronics - Beating Heart
QuaziTronics - Big Bang
Rectangle Game
(also known as WWI Machine Gun Demo, among other
things). It truly is amazing how much functionality one can
squeeze out of a library only knowing a few methods. And if I
do say so myself, this is one pretty darn captivating program, you know,
for the
five or ten minutes you're likely to spend with it. Still, it's
probably the coolest thing I've made up to this point (8-21-13), so
worth another link:
Rectangle Game (same as Balloon Pop Game, Endless Shooter,etc.)
Affine Transform Demo (because I couldn't find one online and I didn't know what this was). If you don't
know about the Affine Transform, click here to launch an interactive demo so as to get a general idea as to what it's all about.
OctoGon Game (this is currently a work in progress... or a work that's stopped being in progress). So, like, here's the
story (and if you code at all, one you probably recognize). I
thought of an idea, figured I could pound it out in an hour, maybe two
tops. Three hours later, I realized I didn't have the slightest
idea how to implement the idea nor had I made any real progress
towards the solution. Well, this is that in a nutshell. All I
wanted was to do was get a ball to bounce off the walls of an OctoGon.
OK, couldn't do that, so maybe it's because I didn't have the vector set up
right. So, tear down the code, isolate a vector, and then I realized I
didn't have the slightest idea how vectors were implemented. (i.e. I
wrote some code, had an expectation about what would happen on screen,
and surprise-surprise, I was not even close. Not even close.) So,
this is the where and when I decided to post projects as I go.
Sure, page by page, the effects are stupid and the code simple, but
that's where I am, and believe it or not, this sort of simple graphical
interface is what rocks my boat (it's certainly not web page layout as
the more astute amongst you may have noticed).
paperJS tutorial
And then, having failed completely to understand hitTest(), getAngle(),
and a few other basic functions from the paperJS library, I decided to
go through the library and work every last function, method, and
property up as a sort of tutorial and/or sample test page (or at least, until a better project pops into
my little noggin).
_.underscore (library walkthrough &/or meander)
Not so much a tutorial as my personal progression through the
library. Personally, when I do web searches for help, I'm looking
for fast and easy code examples, so that's pretty much all I'm planning
on posting for this. Not much by way of explaination, just the
code I've written to learn the library. My personal homework
loaded online. Probably will do a lottery data analyzer, but who
knows.
Python
(All sample code is as-is, no warranty and will require Python 2.7.5 or
comparable loaded onto your machine to do any good. Though, it's all easy
enough to view with a text editor or probably even your browser, if
interested in seeing the source.)
Py2.7 - BrettFood - HTML Image Page Creator
Loading pictures into my food blog was a major pain. I figured
there had to be an easier way. And then there's the theory that
whatever a human being finds dull, repetitive, and boring, a computer is
ideally suited to do. So, I put together this Python program to
automatically create a web page (in the program's current directory)
that includes all the image files from that or any other
directory. Oh, the code is crap. No art, here. But
the program works; and for a first attempt, what more can one ask?
Py2.7 - BrettFood - Figure Caption - HTML Page Creator
This version does more or less the same thing (creates a web page for
all the images in a directory) only it wraps the <img> tags in
<figure> tags, as well. I did this so I could set a web
page up using <figcaption>. I'm assuming anyone who can use
these programs (has Python loaded) is also smart enough to know how to
modify the code so as to meet their needs (otherwise, I do believe you
would be assigning any copyright to me if you used the output as
written). Me, I'm happy with the result. Writing the code
took me far less time than adding the <figcaption> tags manually
would have taken. (Sample FigCaption Webpage Output, captions added)
Py2.7 - BrettFood - Sequential HTML Image Page Creator - 1.0
This is another automatic HTML page creator. It's specialized for
my uses, but if you're smart enough to figure out how to load and run
it, you're probably smart enough to use a text editor to modify the
outputs to fit your needs. Rather that dumping all the pictures
in one HTML page, this one creates a sequence of HTML pages with
premade links from one to the next out of all the images in a
directory. (Place this program inside the directory in question
prior to activating.) (Sample Webpage Output, captions added -- redirects to first page in sequence)
Py2.7 File Downloader - Working - Minataur Tails
I download certain files on a repetitive basis. Rather than
opening a web page, this program downloads specific files from a
specific directory at the click of a button. This one is set up
to download the first chapter of Minataur Tails
one of the greatest pieces in all of literature, if I do say so
myself, onto your computer. By modifying this basic file (along with few improvements
utilizing BeautifulSoup), almost any file -- not behind a pay wall --
can be downloaded automatically. This particular program, however, is limited
to downloading the first chapter of Minataur Tails. But then, why you might ever want to download anything else (except for maybe the second chapter of Minataur Tails; and then, the third) is beyond me.
Py2.7.5 - Imgur Tab Opener
The
problem was that I was sick and tired of opening new tabs while
surfing Imgur, so I made an app that would open a bunch of tabs at
once. The ironic part to all this is that as I was testing the
program out
and surfing Imgur, I came a cross a post that bemoaned the fact that
one could not use the arrow key on facebook to go to the next page, you
know, like you could on Imgur. In a twinkling, my program became
obsolete... or maybe, I can find a way to adopt its functionality to
facebook. If nothing else, this program (along with the previous Minataur Tails chapter downloader)
highlights the utility of Python in the creation of custom web scripts.
Py2.7 JSON Image Object Creator
One
of those things that would be just as happy in the rubbish bin, but it
fits in with the rest of the content here. Takes a directory with
images, outputs a JSON object file I used to link to those images in
JavaScript.
More to come. Always, more to come.
Though in truth, the paper.js tutorials are taking most of my time these days.
The Waste Basket
Cleaning up and other projects as left for dead -- sorted by year.
2013
Copyright © 2013 to 2020 Brett Paufler
All code as is, works in progress, all liable to have gaping errors.
But then, in JavaScript, the worst that can happen is a browser
freeze... or so, I am led to believe. So, no real worries there.
In
Python, total system crashes and wipe-outs are not out of the
question. But then, to run the Python programs, Python needs to
be installed, and if that's the case, then I trust you're smart enough
to vet any code that you may run. The scripts just aren't that
long or complicated, so simple in fact, that if you know Python, I'd
have to assume it would be far easier to write the scripts yourself
than search the web at random...