This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class Trie(): | |
"""Regex::Trie in Python. Creates a Trie out of a list of words. The trie can be exported to a Regex pattern. | |
The corresponding Regex should match much faster than a simple Regex union.""" | |
def __init__(self): | |
self.data = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :chronicle do | |
desc "Rename Store tags in Chronicle after Accounts integration" | |
task :migrate_for_accounts, [:client_id] => :environment do |t, args| | |
client = Client.find(args.client_id) | |
vitrue_id = client.vitrue_id_for_account.to_s | |
stores = client.stores | |
stores.find_each do |store| | |
old_tag = "s:#{store.id}" | |
new_tag = "s:#{store.vitrue_id_for_resource}" | |
# ChronicleClient::Tabs::TagRename.rename(old_tag, new_tag, vitrue_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http = require 'http' | |
util= require 'util' | |
options = { | |
host: 'api.staging.cloud.vitrue.com', | |
port: 80, | |
path: '/chronicle/1/', | |
method: 'GET', | |
disable_ssl_peer_verification: true, | |
timeout: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
queue_length = `/opt/redis-2.2.2/bin/redis-cli zcard q:jobs:total_report:inactive` | |
begin | |
if queue_length.to_i > 50000 | |
puts "status ok there are #{queue_length.to_i} jobs" | |
elsif queue_length > 10000 | |
puts "status warn there are #{queue_length.to_i} jobs" | |
else | |
puts "status err there are #{queue_length.to_i} jobs" |