Monthly Shaarli

All links of one month in a single page.

January, 2018

[Sondage] Utilisez-vous toujours des flux RSS pour vous informer ?

Donc actuellement plus de 60% des gens qui ont participé utilisent RSS.
RSS est donc loin d'être mort.

Release v0.9.4 · shaarli/Shaarli · GitHub
thumbnail

Ztes bons les gars !

Tweet de Nature is Amazing 🌿 (@AMAZlNGNATURE), à 29 janv. à 17:20

Les bêtes pas si bêtes.

Le nuage de Cozy monte au troisième étage – Framablog

Ça évolue dans le bon sens, mais je préfère encore nextcloud pour trois raisons :
Le multi utilisateurs.
Les API, carddav, caldav, etc.
Les clients de synchronisation qui sont de mieux en mieux.

Engie, inOui et autres idioties | Grise Bouille
thumbnail

Je suis tellement d'accord.

Intermarché : une promotion sur le Nutella vire à l’émeute dans plusieurs magasins - Le Parisien - Liens de Dixie le Trait-plat

J'aurai aimé qu'on trouve une petite bactérie qui soit assez violente avec le tube digestif dans ces pots. Ça aurait été marrant.

Question : Monitoring - Shaarli de Erase

Zabbix Power \o/ (j'ai les certifs, j'adore ce produit et ça fait depuis 2011 que je l'utilise).
Et si besoin, je file de l'aide (création de templates, gestion des bases, bonnes pratiques, etc.).

[ZBX-8042] On server startup, the value cache being populated freezes the insert of data into the database - ZABBIX SUPPORT

*** de cache....
ça m'a fait un sacré blackout. Faut que je trouve un moyen....

untitled

Docs/howto/zabbix2 postgresql autopartitioning
Contents

1 Auto Partitioning with Zabbix 2.0 and Postgresql.
2 Create the partitions schema
3 Create the main function with the following code
4 Create a trigger for each (clock based) table you want to partition
5 Disable partitioning
6 Remove unwanted old partitions

Auto Partitioning with Zabbix 2.0 and Postgresql.

Here is my take on Zabbix and Postgresql 9.x (auto) partitioning.

This approach:

does not require you to prepare the database to partition it with zabbix
does not require you to create/schedule a cron job for creating the tables in advance
seems a bit simpler to implement than other solutions.

It will auto create partitions under the "partition" schema with the following name convention

partitions.tablename_pYYYYMMDD # for DAILY partitions
partitions.tablename_pYYYYMM # for MONTHLY partitions

Create the partitions schema

The partitioned tables will be created under the "partitions" schema, which you can create with:

-- Schema: partitions

-- DROP SCHEMA partitions;

CREATE SCHEMA partitions
AUTHORIZATION zabbix;

Grant authorization to the PostgreSQL account used by Zabbix. See DBUser in zabbix_server.conf.
Create the main function with the following code

-- Function: trg_partition()

-- DROP FUNCTION trg_partition();

CREATE OR REPLACE FUNCTION trg_partition()
RETURNS trigger AS
$BODY$
DECLARE
prefix text := 'partitions.';
timeformat text;
selector text;
_interval interval;
tablename text;
startdate text;
enddate text;
create_table_part text;
create_index_part text;
BEGIN

selector = TG_ARGV[0];

IF selector = 'day' THEN
timeformat := 'YYYY_MM_DD';
ELSIF selector = 'month' THEN
timeformat := 'YYYY_MM';
END IF;

_interval := '1 ' || selector;
tablename := TG_TABLE_NAME || '_p' || to_char(to_timestamp(NEW.clock), timeformat);

EXECUTE 'INSERT INTO ' || prefix || quote_ident(tablename) || ' SELECT ($1).*' USING NEW;
RETURN NULL;

EXCEPTION
WHEN undefined_table THEN

startdate := extract(epoch FROM date_trunc(selector, to_timestamp(NEW.clock)));
enddate := extract(epoch FROM date_trunc(selector, to_timestamp(NEW.clock) + _interval ));

create_table_part:= 'CREATE TABLE IF NOT EXISTS '|| prefix || quote_ident(tablename) || ' (CHECK ((clock >= ' || quote_literal(startdate) || ' AND clock < ' || quote_literal(enddate) || '))) INHERITS ('|| TG_TABLE_NAME || ')';
create_index_part:= 'CREATE INDEX '|| quote_ident(tablename) || '_1 on ' || prefix || quote_ident(tablename) || '(itemid,clock)';

EXECUTE create_table_part;
EXECUTE create_index_part;

--insert it again
EXECUTE 'INSERT INTO ' || prefix || quote_ident(tablename) || ' SELECT ($1).*' USING NEW;
RETURN NULL;

END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION trg_partition()
OWNER TO postgres;

Create a trigger for each (clock based) table you want to partition

CREATE TRIGGER partition_trg BEFORE INSERT ON history FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_uint FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_str FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_text FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON history_log FOR EACH ROW EXECUTE PROCEDURE trg_partition('day');
CREATE TRIGGER partition_trg BEFORE INSERT ON trends FOR EACH ROW EXECUTE PROCEDURE trg_partition('month');
CREATE TRIGGER partition_trg BEFORE INSERT ON trends_uint FOR EACH ROW EXECUTE PROCEDURE trg_partition('month');

Disable partitioning

Should you want to remove the partitioning, just remove the partition_trg from each table, or run the following

DROP TRIGGER partition_trg ON history;
DROP TRIGGER partition_trg ON history_uint;
DROP TRIGGER partition_trg ON history_str;
DROP TRIGGER partition_trg ON history_text;
DROP TRIGGER partition_trg ON history_log;
DROP TRIGGER partition_trg ON trends;
DROP TRIGGER partition_trg ON trends_uint;

Remove unwanted old partitions

The following optional routine is to delete partitions older than the desired time. Unfortunately it requires you to schedule it using "cron" or run it manually. (SEE BELOW)

-- Function: delete_partitions(interval, text)

-- DROP FUNCTION delete_partitions(interval, text);

CREATE OR REPLACE FUNCTION delete_partitions(intervaltodelete interval, tabletype text)
RETURNS text AS
$BODY$
DECLARE
result record ;
prefix text := 'partitions.';
table_timestamp timestamp;
delete_before_date date;
tablename text;

BEGIN
FOR result IN SELECT * FROM pg_tables WHERE schemaname = 'partitions' LOOP

    table_timestamp := to_timestamp(substring(result.tablename from '[0-9_]*$'), 'YYYY_MM_DD');
    delete_before_date := date_trunc('day', NOW() - intervalToDelete);
    tablename := result.tablename;

-- Was it called properly?
    IF tabletype != 'month' AND tabletype != 'day' THEN
 RAISE EXCEPTION 'Please specify "month" or "day" instead of %', tabletype;
    END IF;

--Check whether the table name has a day (YYYY_MM_DD) or month (YYYY_MM) format
    IF length(substring(result.tablename from '[0-9_]*$')) = 10 AND tabletype = 'month' THEN
        --This is a daily partition YYYY_MM_DD
        -- RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
        CONTINUE;
    ELSIF length(substring(result.tablename from '[0-9_]*$')) = 7 AND tabletype = 'day' THEN
        --this is a monthly partition
        --RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
        CONTINUE;
    ELSE
        --This is the correct table type. Go ahead and check if it needs to be deleted
 --RAISE NOTICE 'Checking table %', result.tablename;
    END IF;

IF table_timestamp <= delete_before_date THEN
RAISE NOTICE 'Deleting table %', quote_ident(tablename);
EXECUTE 'DROP TABLE ' || prefix || quote_ident(tablename) || ';';
END IF;
END LOOP;
RETURN 'OK';

END;

$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION delete_partitions(interval, text)
OWNER TO postgres;

You can then remove old partition using the following commands

SELECT delete_partitions('7 days', 'day')
SELECT delete_partitions('11 months', 'month')

EDIT : ma correction pour éviter un max_lock_per_transaction quand il y a beaucoup de tables :
-- Function: delete_partitions(interval, text)

-- DROP FUNCTION delete_partitions(interval, text);

CREATE OR REPLACE FUNCTION delete_partitions(intervaltodelete interval, tabletype text)
RETURNS text AS
$BODY$
DECLARE
result record ;
prefix text := 'partitions.';
table_timestamp timestamp;
delete_before_date date;
tablename text;
maxtable integer :=25;
deletedtable integer :=0;

BEGIN
delete_before_date := date_trunc('day', NOW() - intervalToDelete);
RAISE NOTICE 'Deleting table before %', delete_before_date;

FOR result IN SELECT * FROM pg_tables WHERE schemaname = 'partitions' LOOP

    table_timestamp := to_timestamp(substring(result.tablename from '[0-9_]*$'), 'YYYY_MM_DD');
    tablename := result.tablename;

-- Was it called properly?
    IF tabletype != 'month' AND tabletype != 'day' THEN

RAISE EXCEPTION 'Please specify "month" or "day" instead of %', tabletype;
END IF;

--Check whether the table name has a day (YYYY_MM_DD) or month (YYYY_MM) format
    IF length(substring(result.tablename from '[0-9_]*$')) = 10 AND tabletype = 'month' THEN
        --This is a daily partition YYYY_MM_DD
        -- RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
        CONTINUE;
    ELSIF length(substring(result.tablename from '[0-9_]*$')) = 7 AND tabletype = 'day' THEN
        --this is a monthly partition
        --RAISE NOTICE 'Skipping table % when trying to delete "%" partitions (%)', result.tablename, tabletype, length(substring(result.tablename from '[0-9_]*$'));
        CONTINUE;
    ELSE
        --This is the correct table type. Go ahead and check if it needs to be deleted

--RAISE NOTICE 'Checking table %', result.tablename;
END IF;

EXIT WHEN deletedtable >= maxtable;

IF table_timestamp <= delete_before_date THEN
RAISE NOTICE 'Deleting table %', quote_ident(tablename);
EXECUTE 'DROP TABLE ' || prefix || quote_ident(tablename) || ';';
deletedtable := deletedtable+1;
END IF;
END LOOP;
RETURN 'OK';

END;

$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION delete_partitions(interval, text)
OWNER TO postgres;

Maintenance and Release Schedule · nextcloud/server Wiki
thumbnail

Overview
release date end of life current version next version
13 2018-01 Release of NC 15 - 13.0.0 (2018-01-31)

-> ça va être chaud à tenir ;-) (j'adore quand on me fait mentir cela dit)

SSL Server Test: api.sandbox.mangopay.com (Powered by Qualys SSL Labs) - Oros links

Si besoin, on fait du paiement dans ma petite boite.

Steam Soldes - Far Cry - Strak.ch | Actu et liens en vrac

Le 3 est sympa mais j'ai des bugs à n'en plus finir :
Le jeu plante en validant une action
Les sols disparaissent
Impossible de valider une invitation sur le mode coop
Impossible de bouger pendant 5s après une résurrection
Les ennemis ne sont pas touchés par des balles pleine tête mais j'ai des points de kill alors que je recharge...
Bref, sympa mais pas fini. Et de quoi foutre la rage des fois.

Firefox veut ajouter des contenus sponsorisés dans vos onglets - Tech - Numerama
thumbnail

Cher Mozilla. Si au lieu de te lancer dans tous les projets tête baissée tu faisais des études de marché même basiques (sondage par le navigateur, etc.), tu n'investirai pas dans des fonctionnalités futiles voire des services non pertinents. Par contre, tu pourrais passer des partenariats sur du long terme sur des projets où de nombreux développeurs sont extrêmement motivés.
De plus, je pense que démontrer que ta force est dans ton navigateur est ce qu'il faut le plus rappeler à tous.
Reste concentrer sur ce que tu sais faire de mieux.
Fait peu, mais fait bien.

Bourges : licenciée pour avoir tourné dans un film X, elle saisit les prud'hommes - Les liens du Lapin Masqué

Je rebondis sur ta remarque pour dire que je trouve inacceptable ce licenciement, et encore plus si elle a été dénoncé par un/une DP.
Nous sommes là pour protéger les salariés, tous. Ce qui encore plus important dans le rôle de DP c'est de savoir écouter le salarié, dans le perso si besoin comme dans le pro sans jamais essayer de lui faire mélanger sa vie pro et perso.

Disk Usage - PostgreSQL wiki

SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;

Lancement de la campagne “crypto-dons” avec le Samu Social de Paris
thumbnail

Pour ceux qui ne savent plus quoi faire de leurs BC ;-)

Note: Mon futur smartphone ??? - Liens et humeurs

J'attends le moto g5 plus à moins de 220€, il serait pas mal à tous niveaux.
Compatible lineageos en plus

on motor bike... - YouTube
thumbnail

Très très bon.

How to upgrade a single package using apt-get? - Ask Ubuntu
thumbnail

apt-get install --only-upgrade <packagename>

Exchange 2013 - OWA Password Expired - Requiring DOMAIN\Username

Question
Sign in to vote
5
Sign in to vote

I found a way to default the domain:

Browse to:

C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\<latestversion>\scripts\premium\

Make a backup copy of fexppw.js, then look for this section:
// UPN authentication isn't supported, don't fill in the username
// if it's an email address
//
if (rg && rg[3].indexOf('@') == -1)
{
// Fill in username, set focus to password
//
gbid("username").value = rg[3];
gbid("oldPwd").focus();
}

Change the username value setting code to this:

gbid("username").value = "YOURDOMAIN\" + rg[3];

Levothyrox, 0,75 % des patients traités ont signalé des effets indésirables - Le Monde
thumbnail

J'aimerai bien savoir comment ils ont fait leur calculs : j'ai déjà deux de mes proches qui l'ont signalé à leur médecin. Pas certain que les médecins aient fait la déclaration à chaque fois...

Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
thumbnail

rsync_parallel.sh

!/bin/bash

set -e

Usage:

rsync_parallel.sh [--parallel=N] [rsync args...]

Options:

--parallel=N Use N parallel processes for transfer. Defaults is the number of processors.

#

Notes:

* Requires GNU Parallel

* Use with ssh-keys. Lots of password prompts will get very annoying.

* Does an itemize-changes first, then chunks the resulting file list and launches N parallel

rsyncs to transfer a chunk each.

* be a little careful with the options you pass through to rsync. Normal ones will work, you

might want to test weird options upfront.

#

if [[ "$1" == --parallel= ]]; then
PARALLEL="${1##
=}"
shift
elif [ -f /proc/cpuinfo ]
then
PARALLEL=$( grep processor /proc/cpuinfo | wc -l )
else
PARALLEL=10
fi
echo "Using up to $PARALLEL processes for transfer..."

TMPDIR=$(mktemp -d)
trap "rm -rf $TMPDIR" EXIT

echo "Figuring out file list..."

sorted by size (descending)

rsync $@ --out-format="%l %n" --no-v --dry-run | sort -n -r > $TMPDIR/files.all

check for nothing-to-do

TOTAL_FILES=$(cat $TMPDIR/files.all | wc -l)
if [ "$TOTAL_FILES" -eq "0" ]; then
echo "Nothing to transfer :)"
exit 0
fi

function array_min {

return the (index, value) of the minimum element in the array

IC=($(tr ' ' '\n' <<<$@ | cat -n | sort -k2,2nr | tail -n1))
echo $((${IC[0]} - 1)) ${IC[1]}
}

echo "Calculating chunks..."

declare chunk-size array

for ((I = 0 ; I < PARALLEL ; I++ )); do
CHUNKS["$I"]=0
done

add each file to the emptiest chunk, so they're as balanced by size as possible

while read FSIZE FPATH; do
MIN=($(array_min ${CHUNKS[@]}))
CHUNKS["${MIN[0]}"]=$((${CHUNKS["${MIN[0]}"]} + $FSIZE))
echo $FPATH >> $TMPDIR/chunk.${MIN[0]}
done < $TMPDIR/files.all

find "$TMPDIR" -type f -name "chunk.*" -printf "\n %p \n" -exec cat {} \;

echo "Starting transfers..."
find "$TMPDIR" -type f -name "chunk.*" | parallel -j $PARALLEL -t --verbose --progress rsync --files-from={} $@

Mise à jour Kernel sans reboot - Les liens de Knah Tsaeb

ça marche top (testé sur debian + ubuntu et actuellement en prod). ça reload les services, le réseau, etc mais pas le hardware.
ça ressemble à un soft reboot chez android.

apt-get install kexec-tools
systemctl kexec
uname -r

coldreboot pour un vrai redémarrage

OpenNews

Je crois que je vais aller sur un moto g5 plus :
Environ 5"
Lineageos compatible
Batterie changeable
NFC + 700mhz
Bon appareil photo et bonne autonomie.
Pour 250€ environ.

J'attends les soldes.

La magie d'internet - HowTommy | Liens et actu en vrac

Même chose de mon côté !
Ça le ferait de se croiser. Mais les distances n'aident pas toujours.

Microprocessor Side-Channel Attacks (CVE-2017-5715, CVE-2017-5753, CVE-2017-5754): Impact on Dell EMC products (Dell Enterprise Servers, Storage and Networking) | Dell US

topo dell sur les failles CPU

Tweet de Open Culture (@openculture), à 6 janv. à 22:16

Software Used by Hayao Miyazaki’s Animation Studio Becomes Open Source & Free to Download https://t.co/JDPRdq1Xfg https://t.co/9DjUr440K1

Tweet de Hubert Łępicki🍳🥓🌶️🍗🥩🧀 (@hubertlepicki), à 7 janv. à 02:32

TIL: Visualize your PostgreSQL database schema with 3 commands:

$ sudo apt-get install graphviz postgresql-autodoc
$ postgresql_autodoc -t dot -d yourdatabasename
$ dot -Tpng https://t.co/5EDEoYMkWV -o schema.png