Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Max: askz

🎯
Focusing
  • Freelance
  • In your ~/.bash_profile
Block or report user

Report or block askz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@askz
askz / rpc.sh
Last active May 29, 2018
Universal rpc call
View rpc.sh
#!/bin/bash
TICKER=$(echo $1 | tr '[:upper:]' '[:lower:]')
METHOD=$2
PARAMS="${@:3}"
RPCUSER=main
RPCPORT=net
function join_by { local IFS="$1"; shift; echo "$*"; }
@askz
askz / bitcoin-monitor.md
Created May 11, 2018 — forked from ageis/bitcoin-monitor.md
Prometheus exporter for monitoring statistics of Bitcoin daemon
View bitcoin-monitor.md

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.

View gist:3ac3dd819271e644e5dc3f3c61da2f07
komodo-core_1 | Executing: komodod -printtoconsole -txindex=1 -rpcuser=test -rpcpassword=net -ac_supply=257142857 -gen -datadir=/home/komodo/.komodo/TESTKMD -ac_name=TESTKMD
komodo-core_1 | call komodo_args.(komodod) NOTARY_PUBKEY.()
komodo-core_1 | >>>>>>>>>> TESTKMD: port.10782/10783 magic.7e51ad18 2119281944 257142857 coins
komodo-core_1 | error creating (genTESTKMD)
komodo-core_1 | initialized TESTKMD
komodo-core_1 | Zcash version v1.0.15-10d5104 (2018-04-17 15:42:39 +0300)
komodo-core_1 | Komodo version v1.0.15-10d5104 (2018-04-17 15:42:39 +0300)
komodo-core_1 | Using OpenSSL version OpenSSL 1.1.0d 26 Jan 2017
komodo-core_1 | Using BerkeleyDB version Berkeley DB 6.2.23: (March 28, 2016)
komodo-core_1 | Default data directory /home/komodo/.komodo/TESTKMD
View test_failing_with_pg.py
______________________________________________________ test_getting_list_of_oauth2_clients_by_authorized_user[auth_scopes0] ______________________________________________________
flask_app_client = <AutoAuthFlaskClient <Flask 'app'>>
regular_user = <User(id=1, username="regular_user", email="regular_user@email.com", is_internal=False, is_admin=False, is_regular_user=True, is_active=True, )>
regular_user_oauth2_client = <app.modules.auth.models.OAuth2Client object at 0x7ff93a0b7710>, auth_scopes = ['auth:read']
@pytest.mark.parametrize('auth_scopes', (
['auth:read'],
['auth:read', 'auth:write'],
))
@askz
askz / le-renew.sh
Created Nov 7, 2017
Renew Let's Encrypt certificates and put them in HAProxy ssl folder
View le-renew.sh
#!/bin/bash
# Let's encrypt: renew certificates and put them in haproxy ssl folder for reloading.
# Maxime Saddok <maxime@businessagile.eu>
# put in /etc/cron.weekly/le-renew && chmod +x /etc/cron.weekly/le-renew
set -x
set -e
/opt/letsencrypt/letsencrypt-auto --standalone --standalone-supported-challenges http-01 --http-01-port 9999 renew;
@askz
askz / create-mysql.bash
Created May 16, 2017 — forked from omeinusch/create-mysql.bash
Simple bash script to create mysql db, user with generated password
View create-mysql.bash
#!/bin/bash
# The script will fail at the first error encountered
set -e
PASS=`pwgen -s 40 1`
mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost';
@askz
askz / add-user.sh
Last active Jul 4, 2018 — forked from floudet/ssh-chroot-jail.sh
Chroot Jail for SSH/SFTP Access toolkit
View add-user.sh
#!/bin/bash
# add "prisoner" in the jail you created before !!
# USAGE : ./add-user.sh <username> <password> <type>
# Type 1 : sftp jailed user ; Type 2 ssh jailed user
# A password will be auto-generated with pwgen (sudo apt install pwgen)
# Set your jail path wherever you want.
JAIL_PATH=/home/www/
View gist:91fc3368691501ff0f4d2d838ec6b4f5
#Setup UID filter limit
export UGIDLIMIT=500
#copy /etc/passwd accounts to /opt/move/passwd.mig using awk to filter out system account
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /opt/move/passwd.mig
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /opt/move/group.mig
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd \
View gist:9cd52dbc5bfa3a2f9b9def6cc73ae3ec
### Keybase proof
I hereby claim:
* I am askz on github.
* I am askz (https://keybase.io/askz) on keybase.
* I have a public key ASCNbD-Mt9XPOal6bL6ZXHe3eL4fI2oKH2ayfZE9UZ0Cswo
To claim this, I am signing this object:
@askz
askz / cli-mysql-to-innodb.php
Created Apr 5, 2017 — forked from calevans/cli-mysql-to-innodb.php
Convert MyISAM to InnoDB - shell script
View cli-mysql-to-innodb.php
<?php
/*
* Use this version if you are NOT a Pantheon customer.
*/
$db = array();
/*
* Change these to match your database connection information
*/
$db['host'] = "localhost";
You can’t perform that action at this time.