Tuesday, March 14, 2017

Align text centered vertically

Awesome, but doesn't work on older browsers:

.parent {
display: flex;
align-items: center;

Works on older browsers:

.parent {
display: table;

.child {
display: table-cell;
vertical-align: middle;

Thursday, February 26, 2015

Things about vim

Find replace

Show line numbers

:set number

Replace using ranges

Insert # at begin of line from line 1 to 10

Find each occurrence on each line and replace



Find each line starting with 0, and replace the zero with 27

Sort, removing duplicates

:sort u

Thursday, January 08, 2015

MySQL - create database and user quickly

I'm not a MySQL fan. I don't use it enough to remember some basic things.

mysql> create database mydb;
mysql> create user 'myuser'@'localhost' IDENTIFIED BY '*******';

mysql> grant all privileges on mydb.* to 'myuser'@'localhost';

Wednesday, January 07, 2015

Things about python that I constantly forget (hate)

SyntaxError: Non-ASCII character '\xe2' in file blah.py on line 67, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


Put at top of file:
# -*- coding: utf-8 -*-

Friday, October 03, 2014

Things about developing on Mac that I constantly forget (hate)


Starting apache:

sudo apachectl start

Browsing to the right place


Tuesday, August 26, 2014

Things in Django I constantly forget

There are some things in Django I constantly forget!

Getting the friendly value for a enum value

You have model:

class MyModel(models.Model)
    thing = models.IntegerField(choices=SOME_CHOICES)

You want the value for thing:
happy_value = my_instance.get_thing_valuedisplay()

Monday, August 25, 2014

SCU-17 on Ubuntu

Configuring FLDIGI to work with SCU-17 on Ubuntu 13.10, I ran into a permissions issue.

Normal users can't access /dev/ttyUSBx You have to:
sudo chmod o+rwx /dev/ttyUSB0
sudo chmod o+rwx /dev/ttyUSB0 

Or (to make permanent) - from some sites on the internet (links lost - sorry):
sudo adduser youruser 
dialout sudo reboot