Skip to content

Instantly share code, notes, and snippets.

Avatar
💎
Rubyin'

Justin Aiken JustinAiken

💎
Rubyin'
View GitHub Profile
View foo.rb
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "net-sftp"
end
require "net/sftp"
@JustinAiken
JustinAiken / keybase.md
Created August 18, 2014 21:12
Keybase Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am justinaiken on github.
  • I am justinaiken (https://keybase.io/justinaiken) on keybase.
  • I have a public key whose fingerprint is D5DA 713A C9A7 5CB4 46AB B4AF 08D2 F343 6C6C BB16

To claim this, I am signing this object:

@JustinAiken
JustinAiken / lumenvox.pp
Created April 9, 2014 23:25
puppet error
View lumenvox.pp
define lumenvox::language_pack (
$language = undef,
$version = latest,
) {
package { "LumenVox-${language}SREModel":
ensure => $version,
provider => 'yum',
}
}
@JustinAiken
JustinAiken / adhearsion.log
Created February 18, 2014 19:12
Bits o' a log
View adhearsion.log
[2014-02-16 12:04:21] DEBUG Roster: Selecting 363@10.1.2.87/browser for inside_sales_prospect
[2014-02-16 12:04:21] INFO Roster: Updating 363@10.1.2.87/browser to composing
[2014-02-16 12:04:21] DEBUG Adhearsion::OutboundCall: 6d0cd0bd-83bb-4a84-9eab-82f43aef9e7d@: Finished executing controller #<OutboundConnectingController call=6d0cd0bd-83bb-4a84-9eab-82f43aef9e7d, metadata={}>
[2014-02-16 12:04:21] INFO Adhearsion::OutboundCall: 6d0cd0bd-83bb-4a84-9eab-82f43aef9e7d@: Connecting customer inside_sales 25376541 to extension 363
[2014-02-16 12:04:21] INFO OutboundCustomersController: Call was hung up while executing a controller
[2014-02-16 12:04:21] DEBUG OutboundCustomersController: Finished executing controller #<OutboundCustomersController call=, metadata={}>
[2014-02-16 12:04:21] INFO Adhearsion::OutboundCall: 6d0cd0bd-83bb-4a84-9eab-82f43aef9e7d@: connecting inside_sales 25376541 to extension 363
[2014-02-16 12:04:21] DEBUG Adhearsion::OutboundCall: 232d2f70-566d-47ae-82d9-eb2a4d532e0a@: Executing co
View patch.diff
diff --git a/app/classes/talkbox/phone_config_creator.rb b/app/classes/talkbox/phone_config_creator.rb
index 104f263..0a22236 100644
--- a/app/classes/talkbox/phone_config_creator.rb
+++ b/app/classes/talkbox/phone_config_creator.rb
@@ -29,18 +29,22 @@ class PhoneConfigCreator
end
def generate
- if user.office_ext.present? && APP_CONFIG['provision']['pbx_host']
- config_file << pbx_account
View Cookbooks.rb
cookbook 'build-essential'
cookbook 'apt'
cookbook 'ruby_build'
cookbook 'rbenv', :git => 'https://github.com/fnichol/chef-rbenv'
cookbook 'unicorn'
cookbook 'nginx'
cookbook 'runit'
cookbook 'rails-lastmile', :git => 'git://github.com/DanThiffault/rails-lastmile.git'
@JustinAiken
JustinAiken / order.rb
Created February 21, 2013 19:06
refactoring
View order.rb
def order(n)
i=1, a=1, list=[]
until (i==61 or a==n) do
if (a^i).modulo(n)==1
[a,i]>>list
a+=1
i=1
else
i+=1
View adhearsion.log
This file has been truncated, but you can view the full file.
[2013-01-22 11:14:46] DEBUG Adhearsion::Call: bc22d026-9854-4c87-a6e8-b894fb44e596: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event name="VarSet", attributes_hash={:privilege=>"dialplan,all", :channel=>"SIP/4.55.12.163-00007e7d", :variable=>"PLAYBACKSTATUS", :value=>"SUCCESS", :uniqueid=>"1358871283.32381"}, target_call_id="bc22d026-9854-4c87-a6e8-b894fb44e596", component_id=nil, target_mixer_name=nil>
[2013-01-22 11:14:46] DEBUG Adhearsion::Call: bc22d026-9854-4c87-a6e8-b894fb44e596: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event name="AGIExec", attributes_hash={:privilege=>"agi,all", :subevent=>"End", :channel=>"SIP/4.55.12.163-00007e7d", :commandid=>"1369246299", :command=>"EXEC Playback \"lmc/monitored-and-recorded\"", :resultcode=>"200", :result=>"Success"}, target_call_id="bc22d026-9854-4c87-a6e8-b894fb44e596", component_id=nil, target_mixer_name=nil>
[2013-01-22 11:14:46] DEBUG Adhearsion::Call: bc22d026-9854-4c87-a6e8-b894fb44e596: Receiving message: #<Punchblock::Event::Ast
View gist:4346524
1.9.2p320 :001 > @call_flow = CallFlow.find_by_id(7107)
=> #<CallFlow id: 7107, provisioned_route_id: 1147, dnis: "2162019670", message: "blank", default_ringto: "0000000000", ouid: 170, caller_to_sms: nil, email_to_notify: nil, play_disclaimer: "before", created_at: "2012-12-19 18:43:14", updated_at: "2012-12-20 16:11:38", country_code: "1", tx_boost: nil, rx_boost: nil, vm_enabled: nil, routable_type: "OutboundRoute", routable_id: 5, webhook_enabled: nil>
1.9.2p320 :002 > call_flow_params = {:country_code=>"1", :ouid=>"170", :dnis=>"2162019670", :message=>"blank", :play_disclaimer=>"before"}
=> {:country_code=>"1", :ouid=>"170", :dnis=>"2162019670", :message=>"blank", :play_disclaimer=>"before"}
1.9.2p320 :003 > @call_flow.update_attributes(call_flow_params)
NameError: undefined local variable or method `to_ary' for #<CallFlow:0xa968ef8>
from /home/jaiken/.rvm/gems/ruby-1.9.2-p320@callengine/gems/activemodel-3.0.8/lib/active_model/attribute_methods.rb:392:in `method_missing'
from /home/jaiken/.rvm/g
@JustinAiken
JustinAiken / facebook_scrape.rb
Created December 4, 2012 22:49
facebook election scraper
View facebook_scrape.rb
require 'koala'
AUTH_TOKEN = ENV["AUTH_TOKEN"]
START_TIME = Date.new(2012,11,5).to_time.to_i
END_TIME = Date.new(2012,11,8).to_time.to_i
@facebook = Koala::Facebook::API.new(AUTH_TOKEN)
friends = @facebook.get_connections("me", "friends").sort_by {|friend| friend["name"]}
friends = friends[161..(friends.count - 1)]