Skip to content

Instantly share code, notes, and snippets.

@AstraSerg
AstraSerg / gist:8d567b2d6cdb1fe7dc88f4c3b91378a4
Created December 3, 2019 14:55
Convert grafana SQLite DB to postgres
# cat command
load database
from '/var/spool/grafana_data/grafana.db'
into postgresql://grafana:password@localhost/grafana
with include drop, create tables, create indexes, reset sequences
set work_mem to '16MB', maintenance_work_mem to '512 MB';
==============
# cat convert.sh
docker update
usermod -aG docker astraserg
apt-get remove docker docker-engine docker.io containerd runc
apt-get install \
apt-transport-https \
ca-certificates \
curl \
#!/usr/bin/env python3
# coding: utf-8
import consul as cons
'''
Cs = {
'redmine_db_ip': '',
'mongo_conn_string': '',
'mongo_un': 'root',
import gettext
gettext.install("locales")
apt install gettext
@AstraSerg
AstraSerg / update_certs.sh
Last active August 8, 2019 11:06
post renew SSL certs lego
#!/bin/bash
# checks if certs was updated by lego
# and put it to spot
key_file='/home/certs/certificates/hs1.srv.key'
crt_file='/home/certs/certificates/hs1.srv.crt'
mix_file='/opt//config/server.pem'
# take 1 line from the middle of new (?) cert
@AstraSerg
AstraSerg / docker-compose.yml
Created February 26, 2019 12:01 — forked from ssplatt/docker-compose.yml
docker - prometheus with snmp_exporter, node_exporter, and cadvisor
version: "3"
services:
prometheus:
image: prom/prometheus
volumes:
- /opt/docker-persist/prometheus/data:/prometheus-data
ports:
- 9090:9090
restart: always
command: --config.file=/prometheus-data/prometheus.yml
@AstraSerg
AstraSerg / mongo2csv_export.sh
Created February 14, 2018 14:11
Export from mongo to CSV
mongoexport \
--db db \
--collection coll \
--type=csv \
-h host:27017 \
--fields rm_issue_id,status,period,partner_id,summ_info,summ_clear \
-u user \
-p password \
--out file.dump.csv