Skip to content

Instantly share code, notes, and snippets.

@movitto
movitto / xrptipbot.vue
Last active July 25, 2019 04:30
Embedding xrptipbot in a vuejs application
// VueJS does not permit <script> tags to be embedded in component templates
// Inorder to embed the xrptipbot widget (as described here: https://www.xrptipbot.com/account/embed):
// Add the following to your vuejs component template (make sure to change the tip receipient!):
<div id="xrptipbot">
<a amount="5.00" size="175" to="DevNullProd" network="twitter" href="https://www.xrptipbot.com" target="_blank"></a>
</div>
// Then add / extend the component 'mounted' hook to add the script:
mounted : function(){
@movitto
movitto / rippled.rpm.sh
Last active May 19, 2019 17:39
Commands needed to build the rippled RPM on a fresh CentOS 7 install
# Setup rippled RPM build environemnt on CentOS
# From a fresh CentOS install
# Update system, reboot
sudo yum update
sudo reboot
# Install deps
sudo yum install protobuf-static openssl-static zlib-static
@movitto
movitto / xag.rb
Created April 30, 2019 23:53
XRP Account Generator
#!/usr/bin/ruby
#
# Written by Dev Null Productions <devnullproductions@gmail.com>
#
# Small script to generate new XRPL account as described in the following document:
# https://developers.ripple.com/accounts.html
#
# Simply run it with:
# ruby xag.rb
#
@movitto
movitto / parallel_tests.sh
Created January 28, 2017 01:49
Parallel Catch - Invokes philsquared/Catch tests in a parallel fashion (https://github.com/philsquared/Catch)
# runs tests in parallel
TEST_CMD="./build/test/run_unit_tests"
JOBS="8"
TAGS="$($TEST_CMD -l | grep Scenario -A 1 | grep -v Scenario | sort -u)"
IFS=' ' read -a SPLIT <<< $TAGS
NUM_TAGS=${#SPLIT[@]}
# so as to round up
PER_JOB=`expr $NUM_TAGS + $JOBS - 1`
@movitto
movitto / xrpl-rocksdb.rb
Last active April 24, 2019 21:29
XRPL NodeStore - Type Extraction
# Work in progress: Ruby Script that parses rippled rocksdb node store and
# dumps out data types.
#
# Written by Dev Null Productions <devnullproductions@gmail.com>
#
# Many thanks for help received on XRPChat:
# https://www.xrpchat.com/topic/31118-question-pertaining-to-hashing-database-lookups/
#
# Requires upstream build of rocksdb-ruby to incorporate recent changes.
# Also the 'bistro' and 'tty-cursor' rubygems (gem install these).
@movitto
movitto / xrp-account-entropy.rb
Created February 6, 2019 14:54
Determine XRP account entropy by character and substring occurances in Base58 representation
#!/usr/bin/ruby
# Determine XRP account entropy, takes in a list of XRP accounts and
# outputs distribution by length, character, positional character,
# substring, and case-insensitive substring
require 'workers'
# Add method to extract all String substrings of a given length
class String
def substrings(n)
@movitto
movitto / sonic-pi-ruby-2.5.patch
Created January 7, 2019 20:40
Update sonic-pi vendored *rugged* dep to work with ruby 2.5
diff --git a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c
index 91716301f..9acd33253 100644
--- a/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c
+++ b/app/server/ruby/vendor/rugged-0.26.0/ext/rugged/rugged_blame.c
@@ -188,6 +188,11 @@ static VALUE rb_git_blame_count(VALUE self)
return UINT2NUM(git_blame_get_hunk_count(blame));
}
+static VALUE rugged_blame_enum_size(VALUE rb_blame, VALUE rb_args, VALUE rb_eobj)
+{
@movitto
movitto / xrp-64to58.cpp
Created December 17, 2018 22:14
XRP Base64 -> Base58 Convertor: Converts Base64 addresses output by various rippled requests to the Standard Base58 Representation (in C++ and Ruby)
// Converts a Base64 XRP address to standard Base58 representation
// Compile with:
// g++ b64.cpp -lssl -lcrypto
#include <stdlib.h>
#include <utility>
#include <string>
#include <iostream>
#include <boost/optional.hpp>
#include <boost/container/small_vector.hpp>
@movitto
movitto / rippled.sh
Last active November 7, 2018 21:10
Commands to setup a rippled validator on CentOS with a letsencrypt certificate
# Setup rippled validator on CentOS with a letsencrypt certificate.
# Run all commands as sudo unless otherwise indicated.
# Replace <HOSTNAME> with you full server hostname (ex. syracloud.net).
# Replace <COMPACT_HOSTNAME> with your server hostname minus periods (ex. syracloudnet).
# Replace <USER> with your login username
# Set system hostname to <HOSTNAME>
vim /etc/hostname
# Update the system
@movitto
movitto / rippled.html
Last active September 18, 2018 14:36
Small drop-in webpage to display rippled server status
<!--
Small drop-in webpage to display rippled server status.
To deploy download the following and place in the same web server directory as this file:
- https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.js
- https://github.com/ripple/ripple-lib/releases/download/1.0.0/ripple-1.0.0-min.js
- https://raw.githubusercontent.com/caldwell/renderjson/master/renderjson.js
Then change RIPPLED_URI below to the location of your rippled server.
-->