Eventually I get into producing something I think is useful for others. You'll find random technical knowledge in this Blog so please be patient and use the search function. Some of these software are rather lame and old, the list is ordered by the approximate age (newest first). Unfortunately my older stuff are lost or scattered around my old CDs, not readable anymore 8(.
Simplistic bash script to read DVD label from disc.
#!/bin/bash dd if="$1" count=1 bs=1024 skip=32 2>/dev/null | cut -b 41-72 | sed 's/[^[:alnum:]]._ -]+//g' | sed 's/^ *//g' | rev | sed 's/^ *//g' | rev
This is my quick shell script wrapper using dialog to create a new signed key with my own CA.
#!/bin/bash set -e hostname=`dialog --stdout --clear --inputbox "hostname (pl: www.tricon.hu)" 8 50` hostmaster=`dialog --stdout --clear --inputbox "hostmaster e-mail (pl: hostmaster@tricon.hu)" 8 50` cp reqtemplate_openssl.cnf reqs/$hostname.req.openssl.conf rpl "|HOSTNAME|" "$hostname" reqs/$hostname.req.openssl.conf rpl "|HOSTMASTER|" "$hostmaster" reqs/$hostname.req.openssl.conf openssl req -new -nodes -out reqs/$hostname.req.pem -keyout keys/$hostname.key.pem -config reqs/$hostname.req.openssl.conf openssl ca -out certs/$hostname.cert.pem -config ./openssl.cnf -infiles reqs/$hostname.req.pem echo "Kesz, ezt a ket fajlt kell hasznalnod:" echo "keys/$hostname.key.pem" echo "certs/$hostname.cert.pem" echo "" echo "A CA cert a cacert.pem fajlban van, ezt kell telepiteni a kliensekben" echo "" echo "Az /etc/CA konyvtarban es alkonyvtaraiban fajlokat torolni, atnevezni TILOS!"
contents of reqtemplate_openssl.cnf follows:
# # OpenSSL configuration file. # [ req ] default_bits = 1024 # Size of keys default_md = md5 # message digest algorithm default_keyfile = keys/|HOSTNAME|.key.pem string_mask = nombstr # permitted characters distinguished_name = req_distinguished_name req_extensions = v3_req prompt = no [ req_distinguished_name ] countryName = HU stateOrProvinceName = Budapest localityName = Budapest organizationName = TRICON organizationalUnitName = |HOSTNAME| commonName = |HOSTNAME| emailAddress = |HOSTMASTER| [ v3_req ] basicConstraints = CA:FALSE subjectKeyIdentifier = hash
As an user of OpenVZ it's often my task to migrate database driven web applications to separate environments. In recent versions of OpenVZ, bind mounting of sockets between virtual environments is prohibited. I had to find a way to proxy local connections to /var/run/mysqld/mysqld.sock to the remote mysql server.
First I've created a mysql user and group:
addgroup --system mysql adduser --system --home /var/run/mysqld --ingroup mysql mysql
Then I've installed and configured the excellent socat utility using launchtool.
db.vz is the address remote database host in the following executable launchtool configuration script
#!/usr/bin/launchtool -C tag = mysql-proxy daemon = yes user = mysql command = socat UNIX-LISTEN:/var/run/mysqld/mysqld.sock,fork,mode=0666 TCP:db.vz:3306,forever start dir = /var/run/mysqld wait times = 5 infinite runs = yes stats = yes launchtool output = syslog:mysql-proxy,LOG_DAEMON,LOG_INFO launchtool errors = syslog:mysql-proxy,LOG_DAEMON,LOG_ERR command output = syslog:mysql-proxy,LOG_DAEMON,LOG_INFO command errors = syslog:mysql-proxy,LOG_DAEMON,LOG_ERR
A very small GAWK script that splits a mysql text dump to separate table dump files.
#!/bin/sh # GPLv2 by Erno Rigo <mcree_AT_tricon_DOT_hu> gawk ' BEGIN { FS=" "; dest="/dev/null" } /^(USE)/ { dir=gensub(";","","g",$2) ; dir=gensub("`","","g",dir) ; system("mkdir "dir) } /^(CREATE|USE|DROP)/ { fflush(dest); dest="/dev/null" } /^CREATE TABLE/ { file=gensub("`","","g",$3) ; fflush(dest); dest=dir"/"file".sql" } { print >> dest } '
freemail.zip - My old contribution to the web IMAP email gateway scene. Written in an early version of PHP in 2001 and it's still in use somewhere (I won't tell you: use google…).
<< Newer entries | Older entries >>