Skip to content

Instantly share code, notes, and snippets.

@zaccari
zaccari / encryption.rb
Created February 27, 2020 06:55 — forked from yukithm/encryption.rb
[Ruby] A simple example of AES encryption in Ruby
# encoding: utf-8
require "openssl"
require "base64"
CIPHER_ALGO = "AES-256-CBC"
SALT_SIZE = 8
def encrypt(data, pass)
salt = OpenSSL::Random.random_bytes(SALT_SIZE)
@zaccari
zaccari / rspec2to3.sh
Created September 25, 2015 08:52
Syntax converter for RSpec 2 to 3
#!/usr/bin/env bash
#
# Scans the given path(s) and converts shoulda syntax to expectations and
# upgrades rspec 3 syntaxes.
#
# Examples
#
# $ rspec2to3 spec/lib/**/*_spec.rb
files="${@}"
@zaccari
zaccari / standalone-ha.xml
Created July 8, 2015 19:09
TorqueBox Cluster Configuration with a Local Queue and Message Processor
<!-- previous lines omitted -->
<cluster-connections>
<cluster-connection name='my-cluster-topics'>
<address>jms.topic</address>
<connector-ref>netty</connector-ref>
<discovery-group-ref discovery-group-name='dg-group1'/>
<retry-interval>500</retry-interval>
<retry-interval-multiplier>1.5</retry-interval-multiplier>
<max-retry-interval>4000</max-retry-interval>
<reconnect-attempts>-1</reconnect-attempts>
@zaccari
zaccari / workers.rake
Created October 12, 2012 17:15 — forked from karmi/workers.rake
Rake taks to launch multiple Resque workers in development/production with simple management included
# Rake task to launch multiple Resque workers in development/production with simple management included
require 'resque/tasks' # Require Resque tasks
namespace :workers do
# = $ rake workers:start
#
# Launch multiple Resque workers with the Rails environment loaded,
# so they have access to your models, etc.