From: Nicolas Boisselier Date: Tue, 5 Dec 2017 18:50:21 +0000 (+0000) Subject: etc/profile.d/functions X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=21a89065d091d700835f3d2257a72862b7ca6562;p=nb.git etc/profile.d/functions --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 05f6f4b5..663283a4 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -757,6 +757,20 @@ while (@_) { ' "$t" } +tab2space() { + local size=2 + [ "$1" = "-size" ] && shift && size=$1 && shift + local space=$(eval "printf ' %.0s' {1..$size}") + perl -pe "1 while s/^\t/$space/" $@ +} + +space2tab() { + local size=2 + [ "$1" = "-size" ] && shift && size=$1 && shift + local space=$(eval "printf ' %.0s' {1..$size}") + perl -pe "1 while s/^$space/\t/" $@ +} + shell_replace() { local usage="Usage: shell_replace [-i[.BACKUP_EXTENSION]] [-find PAHT]" diff --git a/share/db/sys.sql b/share/db/sys.sql index 0e707c12..d46cb976 100644 --- a/share/db/sys.sql +++ b/share/db/sys.sql @@ -1,4 +1,4 @@ -DROP TABLE IF EXISTS service; +-- NB 05.12.17 DROP TABLE IF EXISTS service; -- NB 25.10.17 CREATE TABLE IF NOT EXISTS service ( -- NB 25.10.17 name VARCHAR(100), -- NB 25.10.17 description VARCHAR(200), @@ -38,3 +38,14 @@ CREATE TABLE shell_function ( -- NB 25.10.17 option VARCHAR(100), -- NB 25.10.17 price float(5,2) -- NB 25.10.17 ); +CREATE TABLE IF NOT EXISTS mime ( + id varchar(32) NOT NULL PRIMARY KEY, + name varchar(128), + cmd_check varchar(300) +); +CREATE TABLE IF NOT EXISTS mime_type ( + name varchar(128), + type varchar(128) NOT NULL DEFAULT '' PRIMARY KEY, + ext varchar(128) +); +CREATE INDEX IF NOT EXISTS mime_type_ext_idx ON mime_type (ext);