Skip to content

Instantly share code, notes, and snippets.

@jpterry
jpterry / gist:4172439
Created November 29, 2012 22:51
Lists the files being played by itunes. Including what home sharing users are listening to.
# A neat trick to find out what embarrassing songs in your library your family or coworkers are listening to.
# Execute this in terminal
lsof +p $(pgrep -x iTunes) | grep iTunes\ Music/Music
@jpterry
jpterry / gist:4711762
Created February 5, 2013 02:53
Including a module in ruby inherits nested classes. This is an example.
module JohnsThings
class AwesomeTool
def is_awesome?
true
end
end
end
class HurricaneTool
include JohnsThings
@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
# 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'
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
@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 <jpterry@gmail.com>"
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
lib/rake_helpers.rb
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
# 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/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},