Skip to content

Instantly share code, notes, and snippets.

@mks-m
mks-m / encrypt_decrypt.rb
Last active June 19, 2018 12:17 — forked from wteuber/encrypt_decrypt.rb
Simply encrypt and decrypt Strings in ruby.
require 'openssl'
require 'base64'
# key and iv stored in configs, generated using:
# cipher = OpenSSL::Cipher::Cipher.new('AES-256-CBC').encrypt
# key = cipher.random_key
# iv = cipher.random_iv
def encrypt_id(key, iv, id)
cipher = OpenSSL::Cipher::Cipher.new('AES-256-CBC').encrypt
@mks-m
mks-m / fullnode.md
Last active November 13, 2023 14:26 — forked from romanz/fullnode.md
Bitcoin Full Node on AWS Free Tier

Bitcoin Full Node on AWS Free Tier

Provisioning

  • Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
  • Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
  • Attach 150GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.

The pricing would be ~$15/month. See here for more details.

@mks-m
mks-m / speedtest.rb
Created July 16, 2012 12:50 — forked from equivalent/speedtest
ljust speed test
# just speed test for http://stackoverflow.com/questions/11502629/how-to-do-number-to-string-suffix/11502715#11502715
# if we properly test int<->str conversion the log_10 method is about 30% faster
begin
int = 5
a = Time.now.to_f
10_000_000.times { int.to_s.ljust(3, "0").to_i }
puts Time.now.to_f - a # => 1.3s