This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/root/audit_env/bin/python | |
import psycopg2 | |
import psycopg2.extras | |
import sqlite3 | |
import socket | |
import json | |
import pathlib | |
import urllib.request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wgService = require("./wgService"); | |
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
const cors = require('cors'); | |
const config = require("./config"); | |
const asyncHandler = require('express-async-handler'); | |
const fs = require('fs'); | |
const path = require("path"); | |
const archiver = require('archiver'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import json | |
import csv | |
from pathlib import Path | |
red_line, end_line = "\033[91m", "\033[0m" | |
export_path = Path.home() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/root/env/bin/python | |
import subprocess | |
from prettytable import PrettyTable | |
services = [ | |
"wg-quick@wg0", | |
"wg-bot", | |
"wg-slave", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
id | |
, title | |
, create_dt | |
, score | |
, status | |
, comments | |
, action | |
, valid_from | |
, coalesce( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create trigger banki_hist_insert_trigger after insert on home.dt_banki_responses | |
for each row execute procedure home.banki_hist_insert(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION home.banki_hist_insert() | |
RETURNS trigger | |
LANGUAGE plpgsql AS | |
$function$ | |
BEGIN | |
INSERT INTO home.dth_banki_responses | |
(id, link, ... action, valid_from) | |
VALUES | |
(NEW.id, NEW.link, ... 'I', current_timestamp); | |
RETURN NEW; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table if not exists home.dth_banki_responses ( | |
id int, | |
link varchar(255) not null, | |
... | |
action char(1) not null, | |
valid_from timestamptz not null | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
round( | |
avg(date_part('day', bank_answer_date-create_dt)::int), 1 | |
) as "Среднее время ответа в днях" | |
, round( | |
median(date_part('day', bank_answer_date-create_dt)::int), 1 | |
) as "Медианное время ответа в днях" | |
from | |
home.dt_banki_responses | |
where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
substr(create_dt::varchar,1,7) as month | |
, round(avg(coalesce(score, 0)), 1) as "Среднее" | |
, trunc(median(coalesce(score, 0))) as "Медиана" | |
, count(*) as "Общее кол-во" | |
, sum(case when score = 1 then 1 else 0 end) as "Оценка 1" | |
, sum(case when score = 2 then 1 else 0 end) as "Оценка 2" | |
, sum(case when score = 3 then 1 else 0 end) as "Оценка 3" | |
, sum(case when score = 4 then 1 else 0 end) as "Оценка 4" | |
, sum(case when score = 5 then 1 else 0 end) as "Оценка 5" |
NewerOlder