Skip to content

Instantly share code, notes, and snippets.

@morgajel
morgajel / gist:7fa8b232a9f05c711e3b
Last active October 28, 2023 09:49
Mass Layer Gimp Python Fu scripts
align multiple layers to the center of an image in gimp
layer = gimp.image_list()[0].layers[0]
image = gimp.image_list()[0]
for layer in gimp.image_list()[0].layers :
x = (image.width - layer.width) / 2
y = (image.height - layer.height) / 2
layer.set_offsets(x, y)
@morgajel
morgajel / .bashrc
Created March 24, 2023 04:36
.bashrc prompt colorization
if [[ "$TERM" == "xterm-256color" ]] ; then
# This snippet can replace the existing block in your .bashrc and provides the following benefits:
# 1. It checksums your host's FQDN, then assigns a color so your prompt for it. This means every host has a (semi) unique color
# 2. it checksums your username, then does the same thing.
# This means your username is always the same color, and your hostname is consistent-yet-different.
# colors range between 21 and 231 on this page: https://robotmoon.com/256-colors/#shell-prompt
# enjoy! - morgajel
num=$((0x$(echo `hostname -f` | md5sum | cut -f 1 -d " " | cut -c 1-4)))
color=$((num%210+21))
2014-08-26 21:34:59,148 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2014-08-26 21:34:59,150 INFO sqlalchemy.engine.base.Engine SELECT count(%s) AS count_1
FROM "user"
2014-08-26 21:34:59,150 INFO sqlalchemy.engine.base.Engine ('*',)
127.0.0.1 - - [26/Aug/2014 21:34:59] "GET /admin/userview/ HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/morgajel/flask-admin/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/home/morgajel/flask-admin/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
@morgajel
morgajel / gist:6491421
Last active December 22, 2015 15:19
Drawing Districts

Drawing districts is difficult. There are many factors to be taken into account:

  • Number of cells on a map: ranges from 150-1000 cells.
  • Number of cells within a city: usually 1/3rd of the map cells.
  • Number of districts: ranges from 0 to 20
  • Max percentage of city covered in districts: If your city has a market, education and arena, you need to reserve some part for "everything else".
  • Max percentage of city covered by one district: If your city has 2 districts, can one be 100% of the city? of course not.
  • Number of cells in a district: how many cells are in each district, given the limitations above?

DeityGenerator Sects

When creating a sect for a deity, which would you find more interesting, sects based on alignment, or sects based on portfolio? Let me give an example...

Boccob is the god of magic, arcane knowledge, balance, and foresight. His alignment is neutral. Which is more interesting:

a) a sect of lawful neutral followers who focus on how to apply Boccob's beliefs in a lawful manner; a sect of neutral evil followers who focus on how to use Boccob's teaching for personal gain.

b) a sect of Boccob followers who who try to use Boccob's teaching to bring balance to the world; a sect of followers who use Boccob to gain foreseight on what will happen in the future.

@morgajel
morgajel / gist:6349265
Last active December 21, 2015 18:39
CityGenerator v2.2 Release Notes
@morgajel
morgajel / gist:6246749
Created August 16, 2013 02:29
CityGenerator 2.1 Reviews
<ni770664> I have to say, your city generator may have saved me a lot of time making filler cities for D&D.
<survivortype> where was this like 20 years ago when I played D&D?
@morgajel
morgajel / gist:6233762
Last active December 21, 2015 02:18
v2.1 Release Notes for CityGenerator

CityGenerator v2.1 comes hot off the heels of v2.0, with a boatload of new features and fixes.

Returning Features

You asked for it, so they're back! Some features were removed to complete with the 2.0 release and were left off. They are now back with 2.1

City Map is back!###

The most requested feature. The 2.0 release saw the removal of the CityMap for refactoring, but it's back now. Expect to see it improve in subsequent releases.

Districts are back!

@morgajel
morgajel / gist:6149048
Last active December 20, 2015 14:48
Generating Landmarks

I'd like to change how locations and landmarks are generated because frankly they don't mesh well with the new generators. Our best bet is to generate new Landmarks via a LandmarkGenerator. I am unsure how locations will factor in at this point.

What Landmarks do we want, and how will we break them up? Note these are natural landmarks only (for the time being) to prevent cross contamination with other generators.

What important features can we pass in? If there's a port nearby? coast? river?

Perhaps we can sort it by climate? i.e. landmarks for the tundra will be different than a jungle.

Do I use more than just the biome?

@morgajel
morgajel / gist:6127780
Last active December 20, 2015 11:59
release notes for CityGenerator v2.0

CityGenerator 2.0 now features several great new features:

New Look!

A new layout and display gives it a much better look.

Separate Generators

Major internal refactoring from a single package into several separate Generator packages, which now includes: