Skip to content

Instantly share code, notes, and snippets.

diff --git a/lib/token_generator.rb b/lib/token_generator.rb
index 8481154..4fe7527 100644
--- a/lib/token_generator.rb
+++ b/lib/token_generator.rb
@@ -2,7 +2,6 @@
module TokenGenerator
def self.generate
- random_text = ([Time.now.to_f] + (1..10).map{rand}).join('--')
- ActiveSupport::Base64.encode64_url(Digest::SHA1.digest(random_text))
@jpterry
jpterry / freeswitch_json_to_couch.rb
Created May 23, 2014 03:47
Finds all .json freeswitch cdrs in the current directory and posts them to local couchdb.
#!/usr/bin/env ruby
require 'rubygems' unless defined?(Gem)
require 'json'
require 'pry'
require 'net/http'
module Couch
diff --git a/lib/ring_switch/call_flow/ivr_flow.rb b/lib/ring_switch/call_flow/ivr_flow.rb
index 3f0d0dd..71cb9ed 100644
--- a/lib/ring_switch/call_flow/ivr_flow.rb
+++ b/lib/ring_switch/call_flow/ivr_flow.rb
@@ -89,7 +89,8 @@ def hangup_received?
# Robo caller tone detection
ROBOT_TONES = {
:fax_send_tone => {:hz => 1100, :hits => 3, :timeout => 10.seconds},
- :wardialer_modem_signal => {:hz => 2100, :hits => 3, :timeout => 10.seconds}
+ :wardialer_modem_signal => {:hz => 2100, :hits => 3, :timeout => 10.seconds},
# bad
begin
# calls to exit and kill signals will be caught (except kill -9)
exit
rescue Exception
puts "you didn't really want to exit, right?"
# exception handling
end
loop do
#nothing forever
diff --git a/recipes/_freeswitch.rb b/recipes/_freeswitch.rb
index b5594e6..4e4aa56 100644
--- a/recipes/_freeswitch.rb
+++ b/recipes/_freeswitch.rb
@@ -59,6 +59,7 @@ file "/etc/apt/preferences.d/freeswitch_pin" do
group "root"
mode 0644
content pin_string
+ notifies :run, resources(:execute => "apt-get update"), :immediately
end
lib/rake_helpers.rb
@jpterry
jpterry / Dockerfile
Last active January 2, 2016 01:59
Ruby 2.0.0-p353 on rbenv on wheezy on docker
FROM jpterry/debian-wheezy:wheezy
MAINTAINER "John Terry <[email protected]>"
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y build-essential git curl libssl-dev
RUN git clone https://github.com/sstephenson/rbenv.git /opt/rbenv
RUN mkdir /opt/rbenv/plugins
def attribute_for_inspect(attribute)
case attribute
when 'public_key_encrypted_password'
hexify_string(public_key_encrypted_password)
when 'salt'
hexify_string(salt)
else
super
end
end
# Install Nginx from source
node.set['nginx']['init_style'] = 'init'
node.set['nginx']['user'] = 'nginx'
node.set['nginx']['version'] = '1.4.0'
node.set['nginx']['source']['url'] = 'http://nginx.org/download/nginx-1.4.0.tar.gz'
node.set['nginx']['source']['checksum'] = '84aeb7a131fccff036dc80283dd98c989d2844eb84359cfe7c4863475de923a9'
node.set['nginx']['source']['prefix'] = '/opt/nginx'
include_recipe 'nginx::source'
@jpterry
jpterry / .ssh-config
Last active December 16, 2015 14:29
ssh_config. Agent forwarding. Shared connections. Keep alives
Host *
# Connection sharing across sessions to the same machine
ControlMaster auto
ControlPath /tmp/%r@%h:%p
ForwardAgent true
ServerAliveInterval 30
ServerAliveCountMax 240