Skip to content

Instantly share code, notes, and snippets.

@Alex-Werner
Alex-Werner / gist:3cabab2ba09ea749a4c38b70326f9acf
Last active January 16, 2023 14:45
Moleculer JS NATS and Scaleway Messenging JS Code
const { ServiceBroker } = require('moleculer');
const { credsAuthenticator } = require('nats');
// Format of process.env.CREDENTIALS
// -----BEGIN NATS USER JWT-----
// ...
// ------END NATS USER JWT------
// -----BEGIN USER NKEY SEED-----
// SUAF...
// ------END USER NKEY SEED------
@Alex-Werner
Alex-Werner / git.migrate
Created August 10, 2020 13:17 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@Alex-Werner
Alex-Werner / index.js
Last active November 3, 2017 13:08
Use bitcore-node-dash as dependencies
const bitcore = require('bitcore-node-dash');
const start = bitcore.scaffold.start;
let config = {
"network": "testnet",
"port": 3001,
"services": [
"bitcoind"
],
"servicesConfig": {
"bitcoind": {
[Unit]
Description=Bitcore Server Testnet
#Requires=After=dashd.service
[Service]
PIDFile=/home/obusco/.pids/bitcore.pid
ExecStart=/home/obusco/insight/bitcore-node-dash bin/bitcore-node-dash start > /home/obusco/.logs/bitcore.log
Restart=always
RestartSec=10
[Unit]
Description=Dashd Service
After=networking.service
[Service]
PIDFile=/home/obusco/.pids/dashd.pid
ExecStart=/home/obusco/dashcore/github/dash/src/dashd -daemon
ExecStop=/home/obusco/dashcore/github/dash/src/dash-cli stop
KillMode=process
- Install local dashcore version.
- Create dash.conf file in .dashcore with data allowing to be requested by RPC (server=1, rpcport,... - You can use exemple [REF1] below)
- Start dashd by simply call for ./bin/dashd
- Then in another folder (insight?) do a git clone https://github.com/dashevo/bitcore-node-dash -b skip-dash-download
- cd bitcore-node-dash
- npm install
- npm install insight-api-dash --S
- npm install insight-ui-dash --S
@Alex-Werner
Alex-Werner / gist:255f709b5942256d0b4152ca80f36421
Last active August 7, 2017 23:07
The New Economic Crash ?
Predicting new crash soon as per :
- Banco Popular bank run in Espana who died in June 2017 (2bn € per day where moved out). It was the third biggest bank in Espana (1700 agency).
- Stress-test are shit (as Banco Popular has passed them easily).
- Banco Popular has been bought for 1€ by Santander (first bank of the country), so the debt are still existing by has switch of hands.
- European Union to block account during 20 days to avoid bankrun
- Otmar Issing (German economist, 1 of the father of the Euro and previously Member of Executive comitee@BCE) said "The card-castle will collapse"
he also said the WirschaftsWoche journal "The crisis is not over", but this can be understand by seing what has really changes since 2008 (actually nothing, it's worse).
- Junk-bonds are now representing ~1 000 bns €.
- 114 of the 500 italian bank are near the end (Fitch)
@Alex-Werner
Alex-Werner / gist:00ce1086213395004db355653dde2953
Created July 18, 2017 18:35
How to calculate Dash network hashrate
You will need :
Actual diff (find it here http://insight.dash.org/insight/status).
Expected number of block per day (576 : 1blk every 2.5min. 1440min / 2.5).
Real number of block found that day.
Algo is : D*2**32/150, or also other term : BlkFound/BlkExpected*Diff*2**32/150.
With exemple as of data today :
@Alex-Werner
Alex-Werner / shell
Created July 14, 2017 21:09
Bitcore-node-dash install
sudo apt-get install -y -q \
build-essential \
curl \
git \
libzmq3-dev \
python2.7 \
apt-get update \
&& apt-get install -y -q software-properties-common \
&& add-apt-repository ppa:bitcoin/bitcoin \
'use strict';
// import blockchain parameters for Dash
var params = require('webcoin-dash').blockchain
var levelup = require('levelup');
// create a LevelUp database where the block data should be stored
var db = levelup('dash.chain', { db: require('memdown') })
var DBH = require('dash-blockchain-helpers');
var dbh = new DBH({