Skip to content

Instantly share code, notes, and snippets.

View evantahler's full-sized avatar
💭
Programmin'

Evan Tahler evantahler

💭
Programmin'
View GitHub Profile
# managed by ansible
CHECK PROCESS actionhero-{{ application }}
WITH PIDFILE /home/{{ deploy_user }}/www/{{ application }}/shared/pids/cluster_pidfile
START PROGRAM "/bin/bash -c 'source /home/deploy/.profile && cd /home/{{ deploy_user }}/www/{{ application }}/current && HOME=/home/{{ deploy_user }} ./node_modules/.bin/actionhero start cluster --daemon --workers={{ actionhero_workers }}'"
as uid {{ deploy_user }}
with timeout 30 seconds
@evantahler
evantahler / gitter.txt
Created May 11, 2016 06:08
Actionhero Gitter Chat History [Sep 13 2014 - May 10 2016]
Evan Tahler @evantahler Sep 13 2014 09:38
Welcome to the actionhero room!
Pablo Jairala @davidjairala Sep 16 2014 14:51
hello people
Evan Tahler @evantahler Sep 16 2014 14:57
We announced this gitter room to the google group @ https://groups.google.com/forum/#!topic/actionhero-js/EONsyvCDBDc
Evan Tahler @evantahler Sep 17 2014 08:57
local name = ARGV[1]
local partition = "eventr:partitions:" .. ARGV[2]
local coutnerKey = "eventr:counters:" .. ARGV[2]
-- If we have a key already for this name, look it up
local counter = 0
if redis.call("HEXISTS", coutnerKey, name) == 1 then
counter = redis.call("HGET", coutnerKey, name)
counter = tonumber(counter)
end

Forklift ETL

Moving heavy databases around. Gem Version Build Status

What?

Forklift is a ruby gem that makes it easy for you to move your data around. Forklift can be an integral part of your datawarehouse pipeline or a backup tool. Forklift can collect and collapse data from multiple sources or across a single source. In forklift's first version, it was only a MySQL tool but now, you can create transports to deal with the data of your choice.

Set up

exports.action = {
name: "authenticatedAction",
description: "authenticatedAction",
inputs: {
required: [],
optional: [],
},
blockedConnectionTypes: [],
outputExample: {},
run: function(api, connection, next){
var crypto = require('crypto');
var redisPrefix = "__users-";
var caluculatePassowrdHash = function(password, salt){
return crypto.createHash('sha256').update(salt + password).digest("hex");
}
var cacheKey = function(connection){
return redisPrefix + connection.params.email.replace("@","_").replace(".","_")
}
exports.userAdd = {
exports.session = function(api, next){
api.session = {
prefix: "__session:",
duration: 60 * 60 * 1000, // 1 hour
};
api.session.connectionKey = function(connection){
if(connection.type === 'web'){
return api.session.prefix + connection.rawConnection.fingerprint;
class Test
def transform(connection, database, logger)
logger.log "Running on DB: #{database}"
logger.log "Counting users..."
connection.q("USE `#{database}`")
users_count = connection.q("count(1) as 'users_count' from `users`")
logger.log("There were #{users_count} users")
end
1
def run
lock_pidfile # Ensure that only one instance of Forklift is running
rebuild_working_database # Ensure that the working database exists
ensure_forklift_data_table # Ensure that the metadata table for forklift exists (used for frequency calculations)
run_checks # Preform any data integrity checks
run_extractions # Extact data from the life databases into the working database
run_transformations # Perform any transformations
run_load # Load the manipulated data into the final database
require 'rubygems'
require 'bundler'
Bundler.require(:default)
require 'forklift/forklift' # Be sure to have installed the gem!
#########
# SETUP #
#########
forklift = Forklift::Plan.new({