Skip to content

Instantly share code, notes, and snippets.

View rjmacarthy's full-sized avatar
🐁
The Tetris effect

rj rjmacarthy

🐁
The Tetris effect
  • The Wilderness
  • 06:57 (UTC +01:00)
View GitHub Profile
@rjmacarthy
rjmacarthy / bitcore-dirived-private-public.js
Created January 11, 2017 16:43
BIP38 Derived Public/Private key Bitcore.js
var bitcore = require('bitcore');
var assert = require('assert');
var index = 1;
// Create a new HD private key.
var hdPrivateKey = new bitcore.HDPrivateKey(); //returns xpriv...
//Use private key to create drived public key.
var hdPublicKey = hdPrivateKey.hdPublicKey;
// Derive address from public key
@rjmacarthy
rjmacarthy / backup.sh
Created July 12, 2017 16:27
Mongo backup
#!/bin/bash
#Force file syncronization and lock writes
mongo -u "username" -p "password" --authenticationDatabase "admin" --eval "printjson(db.fsyncLock())"
MONGODUMP_PATH="/usr/bin/mongodump"
MONGO_HOST="127.0.0.1" #replace with your server ip
MONGO_PORT="27017"
MONGO_DATABASE="dbname" #replace with your database name
@rjmacarthy
rjmacarthy / HelloWorld.sol
Created July 13, 2017 13:02
Hello World Ethereum Smart Contract
pragma solidity ^0.4.4;
contract HelloWorld {
address public owner;
string public message;
function HelloWorld() {
owner = msg.sender;
message = 'Hello, world';
}
@rjmacarthy
rjmacarthy / EscrowContract.sol
Last active December 3, 2017 05:36
Escrow Contract Solidity
pragma solidity ^0.4.4;
import './Ownable.sol';
contract EscrowContract is Ownable {
address public owner;
address public recipientAddress;
address public parent;
uint public escrowAmount;
EscrowStatuses public status = EscrowStatuses.Pending;
enum EscrowStatuses { Paid, Pending, Complete, Cancelled, Partial }
@rjmacarthy
rjmacarthy / build.sh
Created March 6, 2018 16:26
Start angular4 app with Jenkins and expose port
#!/bin/bash
pm2 stop angular4
. ~/.nvm/nvm.sh
nvm use 9.7.1
npm install
pm2 start start.sh --name angular4
@rjmacarthy
rjmacarthy / mong-start.sho
Last active July 16, 2018 08:55
start mongodb
mongod --fork --dbpath /home/mongodata/mongodb --smallfiles --logpath /var/log/mongodb.log --logappend
@rjmacarthy
rjmacarthy / linux-hdd-space.sh
Created July 16, 2018 08:55
Check hdd space liunx
sudo du -xh / | grep -P "G\t"
df -Bg
sudo su -s /bin/bash jenkins
** start **
mongod --fork --dbpath /home/mongodata/mongodb --smallfiles --logpath /var/log/mongodb.log --logappend --auth
** stop **
sudo killall -15 mongod
@rjmacarthy
rjmacarthy / Fix for nodemon watching too many files.
Last active December 5, 2018 11:43
Error: ENOSPC: no space left on device, watch
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p