BASH

  1. To recursively give directories read&execute privileges:
    find /path/to/base/dir -type d -exec chmod 755 {} +
  2. To recursively give files read privileges:
    find /path/to/base/dir -type f -exec chmod 644 {} +
  3. Delete broken symlinks:
    find -L /etc/ssl/certs -type l -delete
  4. REMOVE FILES 3DAYS OLD
    find /u1/database/prod/arch -type f -mtime +3 -exec rm {} \;
  5. WGETPROXY
    wget —no-host-lookup —proxy=on 192.168.202.1:3128 —proxy-user=blablabla —proxy-passwd=blablabla
  6. TOPMEM

VNC

vncserver — заспустить сервер:

New ‘X’ desktop is <host>:<id>

Starting applications specified in /home/maxselym/.vnc/xstartup
Log file is /home/maxselym/.vnc/OpenSuseVMI:2.log

Для соединения набрать: vncviewer <host>:<id>

Persistent VNC sessions can be configured by editing $HOME/.vnc/xstartup. By default this shell script starts an xterm and the twm Window Manager. To start either GNOME or KDE instead, replace the line starting twm with one of the following:

/usr/bin/gnome # GNOME
/usr/bin/startkde # KDE
/usr/bin/startxfce4 #XFCE

UPSERT через функцию

— Комбинация колонок должна быть уникальной!!!

— Name: UniStChDate; Type: CONSTRAINT; Schema: public; Owner: maxselym; Tablespace:

ALTER TABLE ONLY «Data_ch»
ADD CONSTRAINT «UniStChDate» UNIQUE («Station_ID», «Chanel_ID», «DateTime»);

CREATE OR REPLACE FUNCTION merge_db(«Station_ID_in» bigint, «Chanel_ID_in» integer, «DateTime_in» timestamp without time zone, «val_in» real) RETURNS VOID AS
$$
BEGIN
LOOP
— first try to update the key
— UPDATE db SET b = data WHERE a = key;
UPDATE «Data_ch» Set «val» = «val_in» WHERE («Station_ID»= «Station_ID_in» and «Chanel_ID» = «Chanel_ID_in» and «DateTime» = «DateTime_in»);
IF found THEN
RETURN;
END IF;
— not there, so try to insert the key
— if someone else inserts the same key concurrently,
— we could get a unique-key failure
BEGIN
—        INSERT INTO db(a,b) VALUES (key, data);
INSERT INTO «Data_ch» («Station_ID», «Chanel_ID», «DateTime», «val») VALUES («Station_ID_in»,»Chanel_ID_in»,»DateTime_in»,»val_in»);
RETURN;
EXCEPTION WHEN unique_violation THEN
— do nothing, and loop to try the UPDATE again
END;
END LOOP;
END;
$$
LANGUAGE plpgsql;

—SELECT merge_db(1,110,’2014-03-05 09:00:00′,15);

PSQL Dump

Dump:

Restore:

PostgreSQL установка

opensuse:~ #

local   all         all                               ident sameuser
host    all         all         127.0.0.1/32          ident sameuser
host    all         all         ::1/128               ident sameuser

to

local   all         all                               md5 sameuser
host    all         all         127.0.0.1/32          md5 sameuser
host    all         all         ::1/128               md5 sameuser

In phpPgAdmin in config.inc.php check localhost

Персональная страничка