Skip to content

Instantly share code, notes, and snippets.

View jeffmess's full-sized avatar
🧑‍🍳

jeffmess

🧑‍🍳
  • Cloud Assess
  • Sunshine Coast, Australia
View GitHub Profile
@jeffmess
jeffmess / cassandra_migrate.rb
Created March 4, 2020 10:58
Migrate Cassandra Data
require 'cassandra'
cluster = Cassandra.cluster(port: 9042, consistency: :local_quorum)
session = cluster.connect("invoice")
# Simple migration script moving one tables data to another with different pk/cks
create_table = <<-TABLE_CQL
CREATE TABLE IF NOT EXISTS draft_invoices (
invoice_id UUID,
Running node v5.11.0 (npm v3.8.6)
Server started at http://0.0.0.0:3000
Hapi server running at: http://0.0.0.0:3000
There was a problem in file and it has been destroyed.
I, [2016-06-08T09:21:32.627029 #1] INFO -- : {"method":"GET","path":"/documentation/1.0/requests/show.html","format":"html","controller":"apipie/apipies","action":"index","status":200,"duration":1077.15,"view":362.97,"db":0.0,"@timestamp":"2016-06-08T09:21:32.619Z","@version":"1","message":"[200] GET /documentation/1.0/requests/show.html (apipie/apipies#index)"}
input {
file {
type => "ruby-logger"
path => "/logs/development.log"
}
}
filter{
if [type] == "ruby-logger" {
grok {
I, [2016-06-07T15:25:12.644074 #1] INFO -- : {"method":"GET","path":"/documentation/1.0.html","format":"html","controller":"apipie/apipies","action":"index","status":200,"duration":295.64,"view":100.37,"db":0.0,"@timestamp":"2016-06-07T15:25:12.641Z","@version":"1","message":"[200] GET /documentation/1.0.html (apipie/apipies#index)"}
version: '2'
services:
db:
image: postgres
redis:
extends:
file: common.yml
service: redis
rabbitmq:
image: gavinmroy/alpine-rabbitmq
class ConvertIndifferentHashToRubyHash
# Recursively steps through an ActiveSupport::HashWithSatanAccess object
# And converts all Indifferent Access objects to ruby hashes. Including those
# nested and nested in arrays
attr_accessor :indifferent_hash
def initialize(hash_with_indifferent_access)
self.indifferent_hash = hash_with_indifferent_access
end
@jeffmess
jeffmess / backbone-rails.js
Created July 26, 2011 13:16
Alias Backbone.sync method to inject Rails specific parameters
_.extend(Backbone.Model.prototype, {
// By default, rails expects model params to be wrapped in a nested params hash
// https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/params_wrapper.rb
_paramsWrapper : function() {
return this.paramsWrapper;
}
});
// Alias Backbone.sync method to inject Rails specific