Install MariaDB via Yum, Apt, etc.

To get the latest MariaDB for your distribution (Yum, Apt, etc.), use:

It will generate a config entry like:

name = MariaDB
baseurl =

which you can install by saving to /etc/yum.repos.d/mariadb.repo and run: yum install MariaDB-server MariaDB-client

Cheatsheet: dynamic date value in shell scripts

using a variable – easier to read in scripts:
NOW=$(date +"%Y%m%d%H%M%S")
echo "bar" > "$NOW"foobar.txt

one-line, equivalent to above:
echo "bar" > $(date +"%Y%m%d%H%M%S")foobar.txt

alternate single-line format:
echo "bar" >> $(date "+myfile%Y%m%d.txt")

man strftime to see formatting values

Docker stop and remove all active containers

docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)

MySql select from nested query with max date constraint

Example of MySql select from nested query with max (or min) constraint.

SELECT company_id FROM (
	SELECT co.company_id, DATE(tsk.modified) mm
        FROM company co
        LEFT JOIN project p ON p.company_id = co.company_id
        LEFT JOIN task tsk ON tsk.project_id = p.project_id
        WHERE 1
            AND < 1
            AND co.pay_status < 0
            AND co.test_account < 1
) AS tmpt
GROUP BY company_id
ORDER BY `tmpt`.`company_id`  DESC

Docker pass term env to container with exec

Sometimes you need quick interactive access to a container that doesn’t have the TERM environment set, so you can pass it via something like this:

docker exec -ti mysql env TERM=xterm mysql -u mysqluser

Mongo db admin – node.js app

MongoExpress is a nice little basic app for monitoring and managing MongoDB (view, edit, export, etc.).

docker run -d --name=mongoexp -p 8081:8081 -m 400M --link mongo:meteor-db mongo-express

« Previous Entries Next Entries »