Skip to content

Instantly share code, notes, and snippets.

View system123's full-sized avatar

Lloyd Hughes system123

View GitHub Profile
@system123
system123 / gitsubmodule
Created March 19, 2015 08:50
Setup git sub-modules from an existing .gitmodules file in a new repo.
#!/bin/sh
set -e
git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
while read path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .gitmodules --get "$url_key")
git submodule add $url $path
@system123
system123 / MinCallController
Last active August 29, 2015 14:03
Call recording completion bug
class ClickToCallController < Adhearsion::CallController
def run
answer
call.on_end {
logger.info "CALL HAS ENDED - THIS IS ON_END METHOD"
}
call.on_joined {
@system123
system123 / cost_function.cpp
Created March 3, 2014 16:26
Ceres Bundle Adjustment Issues
struct QuaternionBasedAngularError {
QuaternionBasedAngularError(float x_hat, float y_hat) : observed_x(x_hat), observed_y(y_hat) {
ray_rotation[0] = y_hat*sin_half_theta;
ray_rotation[1] = -x_hat*sin_half_theta;
ray_rotation[2] = 0.0;
ray_rotation[3] = cos_half_theta;
}
static ceres::CostFunction* Create(const double observed_x, const double observed_y) {
@system123
system123 / Rejected call log
Created February 21, 2014 06:47
Adhearsion event hooks not working call logs
[2014-02-21 08:46:21.683] INFO CallQueue: CALLING {"call_ref"=>"123", "number"=>"074********"}
[2014-02-21 08:46:22.901] DEBUG Adhearsion::OutboundCall: @: Executing command #<Punchblock::Command::Dial target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, headers={}, to="SIP/billing/0741*******", from="OUTBOUND <123123123>", timeout=nil, join=nil>
[2014-02-21 08:46:24.015] INFO CallQueue: WAITING FOR SOME CALLS
[2014-02-21 08:46:24.691] DEBUG Adhearsion::OutboundCall: 82b2de71-26fe-4b10-bd8a-3825bd45c21c@: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event target_call_id="82b2de71-26fe-4b10-bd8a-3825bd45c21c", target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, name="VarSet", headers={"Privilege"=>"dialplan,all", "Channel"=>"SIP/billing-000011d6", "Variable"=>"punchblock_call_id", "Value"=>"82b2de71-26fe-4b10-bd8a-3825bd45c21c", "Uniqueid"=>"1392964869.62865"}>
[2014-02-21 08:46:24.695] DEBUG Adhearsion::OutboundCall
@system123
system123 / _form.html.erb
Created May 25, 2013 08:59
Devise Error
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %>
<%= f.email_field :email, :style => "margin-bottom: 15px" %></div>
<div><%= f.label :password %>
<%= f.password_field :password , :style => "margin-bottom: 15px" %></div>
<% if devise_mapping.rememberable? %>
<div><%= f.check_box :remember_me, :style => "float: left; margin-right: 10px" %>