Skip to content

Instantly share code, notes, and snippets.

View julianeon's full-sized avatar

Julian Martinez julianeon

View GitHub Profile
@julianeon
julianeon / dest_all.rb
Created January 15, 2015 02:39
All the scripts that I used for destination tag.
#!/usr/bin/env ruby
require 'httparty'
require 'yaml'
ripple=YAML.load_file("ripple.yml")
rpc_endpoint = ripple["server"]["jsonrpc"]
account_set=ripple["address"]["gatewayiscold"]
account_secret=ripple["secret"]["gatewayiscold"]
data={
@julianeon
julianeon / tw_scraper.rb
Created January 10, 2015 02:15
Scraping example.
raw_html=ARGV[0]
tweets_text= raw_html.gsub(/html/,"txt")
puts tweets_text
final_html=raw_html
ruby_prefix="ruby /home/julian/Ruby/Various/"
get_tweets="#{ruby_prefix}noko_arg.rb #{raw_html} #{tweets_text}"
convert_tweets_html="#{ruby_prefix}ff_arg.rb #{tweets_text} #{final_html}"
firefox_open="firefox #{final_html}"
puts get_tweets
@julianeon
julianeon / localhost_rpc_example.js
Created January 10, 2015 01:49
Example of sending XRP through JSON-RPC with rippled on a VM.
var rpc = require('node-json-rpc');
var options = {
port: 5005,
host: '10.15.20.161',
path: '/',
strict: true
};
// Create a server object with options
@julianeon
julianeon / local_curl_example.rb
Created January 10, 2015 01:34
Example of a local host GET request.
#!/usr/bin/env ruby
endpoint = "http://10.15.20.161:5990/v1/uuid"
cmd_curl_get_guid="curl -H \"Content-Type: application/json\" \"#{endpoint}\""
puts cmd_curl_get_guid
system(cmd_curl_get_guid)
@julianeon
julianeon / tx.json
Created January 7, 2015 20:54
Transaction record.
{
"DeletedNode": {
"FinalFields": {
"Account": "erl",
"BookDirectory": "B394392FFF9368C119B19E8E5B5E42AC70A0FDF874987EA05F0538F50BD1E000",
"BookNode": "0000000000000000",
"Flags": 131072,
"OwnerNode": "0000000000000000",
"PreviousTxnID": "388AAEB6446FA984DE77ED2F4ED4EEAD38546507926801196AC7956C78B8B25D",
"PreviousTxnLgrSeq": 10928011,
@julianeon
julianeon / bitstamp_hot_wallet.txt
Created December 29, 2014 18:04
Bitstamp hot wallet JSON output as of 9:49 AM PST time.
https://api.ripple.com/v1/accounts/rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1/payments?direction=outgoing
{
"success": true,
"payments": [
{
"client_resource_id": "",
"payment": {
"source_account": "rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1",
"source_tag": "",
@julianeon
julianeon / get_account_balance_yaml.rb
Created December 27, 2014 00:32
To get account balances using a YAML file.
#!/usr/bin/env ruby
require 'httparty'
require 'yaml'
ripple=YAML.load_file("ripple.yml")
jumarion=ripple["address"]["jumarion"]
account=jumarion
ENDPOINT = "https://api.ripple.com/v1/accounts/#{account}/balances"
response = HTTParty.get(
@julianeon
julianeon / class_time.rb
Created December 23, 2014 13:36
Class usage.
class TimeCalc
def convertTime(time)
hour = time.split(':')[0]
min = time.split(':')[1]
if hour == '12' && min.include?('pm')
total = 720 + min.to_i
elsif hour != '12' && min.include?('pm')
total = 720 + (hour.to_i * 60) + min.to_i
elsif hour == '12' && min.include?('am')
@julianeon
julianeon / curl_unfreeze_account.rb
Created December 20, 2014 02:05
To unfreeze an account.
require 'json'
#server="localhost:5990"
endpoint = 'http://s1.ripple.com:51234/'
gateway_account="rUTwEtrKy4uygfVGou9XYR6dJspnUHjsYQ"
gateway_account_secret="sssss..."
frozen_account="rDvTRFtmE2pRSPmWhp39SapPdvyry8ddf"
data = {
@julianeon
julianeon / curl_freeze_account.rb
Created December 20, 2014 02:04
To freeze a rippled account.
require 'json'
#server="localhost:5990"
endpoint = 'http://s1.ripple.com:51234/'
gateway_account="rUTwEtrKy4uygfVGou9XYR6dJspnUHjsYQ"
gateway_account_secret="sssss..."
frozen_account="rDvTRFtmE2pRSPmWhp39SapPdvyry8ddf"
data = {