Skip to content

Instantly share code, notes, and snippets.

Avatar

John Mora JPaulMora

View GitHub Profile
@JPaulMora
JPaulMora / MoneroDiff.js
Created Feb 7, 2019
Small node.js snippet to query current monero difficulty from local daemon.
View MoneroDiff.js
const axios = require('axios');
let header = '';
for (let block = 1685551; block < 1685704; block++) {
axios.post('http://127.0.0.1:18081/json_rpc', '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":' + parseInt(block) + '}}').then(resp => {
header = resp.data.result.block_header
console.log(header.height + ', ' + header.timestamp + ', ' + header.difficulty)
})
}
@JPaulMora
JPaulMora / countShares.js
Created Feb 7, 2019
Script to manually count snipa's pool shares data from LMDB.
View countShares.js
"use strict";
let mysql = require("promise-mysql");
let fs = require("fs");
const range = require("range");
const debug = require("debug")("blockManager");
const async = require("async");
let config = fs.readFileSync("./config.json");
let protobuf = require('protocol-buffers');
this.lmdb = require('node-lmdb');
let comms = require('./lib/local_comms');
@JPaulMora
JPaulMora / launchdocker.sh
Created Feb 7, 2019
Script that logs into new docker shell
View launchdocker.sh
#!/bin/bash
/usr/bin/docker run -ti ubuntu
IFS=$'\n'
TODAY=$(/bin/date +"%Y-%m-%d")
/usr/bin/docker ps -a -f ancestor=ubuntu --format "{{.ID}} {{.CreatedAt}} {{.Status}}" | while read cont
do
IFS=' '
array=($cont)
@JPaulMora
JPaulMora / dockerfilter.sh
Created Feb 7, 2019
Get docker container IDs based on date and if they're exited or not.
View dockerfilter.sh
#!/bin/bash
IFS=$'\n'
TODAY=$(/bin/date +"%Y-%m-%d")
#CONTAINERS=$(sudo docker ps -a -f ancestor=ubuntu --format "table {{.ID}} {{.CreatedAt}} {{.Status}}")
/usr/bin/docker ps -a -f ancestor=ubuntu --format "{{.ID}} {{.CreatedAt}} {{.Status}}" | while read cont
do
IFS=' '
array=($cont)
View proxy.sh
#!/bin/sh -e
if [ $# != 3 ]
then
echo "usage: $0 <src-port> <dst-host> <dst-port>"
exit 0
fi
TMP=`mktemp -d`
BACK=$TMP/pipe.back
View config-1.txt
/*
* Number of threads. You can configure them below. Cryptonight uses 2MB of memory, so the optimal setting
* here is the size of your L3 cache divided by 2. Intel mid-to-high end desktop processors have 2MB of L3
* cache per physical core. Low end cpus can have 1.5 or 1 MB while Xeons can have 2, 2.5 or 3MB per core.
*/
"cpu_thread_num" : 1,
/*
* Thread configuration for each thread. Make sure it matches the number above.
* low_power_mode - This mode will double the cache usage, and double the single thread performance. It will
View config-2.txt
/*
* Number of threads. You can configure them below. Cryptonight uses 2MB of memory, so the optimal setting
* here is the size of your L3 cache divided by 2. Intel mid-to-high end desktop processors have 2MB of L3
* cache per physical core. Low end cpus can have 1.5 or 1 MB while Xeons can have 2, 2.5 or 3MB per core.
*/
"cpu_thread_num" : 2,
/*
* Thread configuration for each thread. Make sure it matches the number above.
* low_power_mode - This mode will double the cache usage, and double the single thread performance. It will