WordPress password generate/check from python code

2016-02-15 by romanb password, wordpress

If you want to generate wordpress password from python code (like for updating/reseting user wordpress installs) here's code:

Firefox HSTS Settings store

2015-10-31 by romanb firefox, hacks, https

So I've set HSTS on whole domain with subdomains, preloaded, cosmic max-age, like:

Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"

And now Firefox forces HTTPS on every subdomain. Even if I enter http:// directly into address bar.

Changing HSTS to:

Strict-Transport-Security "max-age=3600"

doesn't help because previous one is somehow cached for very long time.

Clearing cache and history doesnt help either, firefox still stores it somewhere. On clear profile everything is working OK.

So there is this file in your Firefox profile directory called SiteSecurityServiceState.txt.

Turn off Firefox so there's nothing using your profile directory and edit that file, remove your site from cache.

siege [error] socket: connection refused

2015-09-26 by romanb benchmark, hacks, linux

If you testing stuff with siege and it starts throwing socket: connection refused errors first check if you did not run out of ports for outgoing connections, then use this commands:

sysctl net.ipv4.tcp_tw_reuse=1
sysctl net.ipv4.tcp_tw_recycle=1

Bitbucket show hg commands button

2013-07-01 by romanb bitbucket, hacks, mercurial, ui

Steve Losh noted on Twitter that there's no usable URL to pull changes from pull request in your command line. Well, there is, sorta, pull request page html contain hidden "merge-commands" <pre> in case there are conflicts, all you have to do is show it.

I used greasemonkey to add "hg" button between "merge" and "edit" buttons on pull request page. It looks like this:

Here is script source:

Distinguishable colors for stack graphs

2013-06-29 by romanb hacks, ui

I needed to stack some data on single graph (like network traffic from multiple hosts).

Colors on such graphs should be distinguishable, best approach is evenly space (hue-wise) color palette. To enhance separation every odd color has lower brightness.

It will look something like this:

or this:

I needed it for RRDgraph so here's perl version: