Skip to content

Instantly share code, notes, and snippets.

@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@ageis
ageis / bitcoin-monitor.md
Last active June 5, 2024 01:36
Prometheus exporter for monitoring statistics of Bitcoin daemon

bitcoind-monitor.py

This is a script written in Python intended to run alongside a Bitcoin node and export statistics for monitoring purposes. It assumes the existence of bitcoin-cli in the PATH and access to the RPC interface over localhost.

It tracks stuff like: block height, difficulty, number of peers, network hash rate, errors, uptime in seconds, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, and transaction inputs and outputs. These Bitcoin metrics are refreshed once every 5 minutes.

How it works

Prometheus is a monitoring system and time-series database.

@LNBIG-COM
LNBIG-COM / rebalanceThroughOutside.js
Last active January 24, 2020 23:54
Rebalance script through outside network (not all modules but the core code). With russian-languiage comments
/*
* Copyright (c) 2019 LNBIG.com
* All rights reserved.
*/
const PromisePool = require('es6-promise-pool')
const util = require('util');
const nodeStorage = require('../global/nodeStorage');
const {Mutex} = require('await-semaphore')