Skip to content

Instantly share code, notes, and snippets.

View shenoudab's full-sized avatar

Shenouda Bertel shenoudab

View GitHub Profile
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@shenoudab
shenoudab / gist:3004760
Created June 27, 2012 15:19
vumi application_0.log & sms_0.err
application_0.log
2012-06-27 07:51:57-0700 [-] Log opened.
2012-06-27 07:51:57-0700 [-] twistd 12.1.0 (/var/praekelt/vumi/ve/bin/python 2.6.5) starting up.
2012-06-27 07:51:57-0700 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2012-06-27 07:51:57-0700 [-] Starting factory <vumi.service.AmqpFactory instance at 0x95a220c>
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Got an authenticated connection
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Starting a HTTPRelayApplication worker with config: {'url': 'http://127.0.0.1:8001/', 'transport_name': 'smpp_transport'}
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Started the publisher
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Starting Smpp_transportInboundDynamicConsumer with {'exchange_name': 'vumi', 'queue_name': 'smpp_transport.inbound', 'routing_key': 'smpp_transport.inbound', 'exchange_type': 'direct', 'start_paused': False, 'durable': True}
@shenoudab
shenoudab / gist:3004652
Created June 27, 2012 15:03
vumi transport_0 log
2012-06-27 07:51:57-0700 [-] Log opened.
2012-06-27 07:51:57-0700 [-] twistd 12.1.0 (/var/praekelt/vumi/ve/bin/python 2.6.5) starting up.
2012-06-27 07:51:57-0700 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2012-06-27 07:51:57-0700 [-] Starting factory <vumi.service.AmqpFactory instance at 0xb760c04c>
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Got an authenticated connection
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Started the publisher
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Started the publisher
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Started the publisher
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Starting the SmppTransport with {'transport_name': 'smpp_transport', 'host': 'localhost', 'password': 'password', 'system_id': 'smppclient1', 'port': 2775}
2012-06-27 07:51:57-0700 [WorkerAMQClient,client] Connected to Redis, prefix: smppclient1@localhost:2775
@shenoudab
shenoudab / gist:1584025
Created January 9, 2012 17:31
Vumi 0.3.0 Installation from Vagrant
[default] Box lucid32 was not found. Fetching box from specified URL...
[default] Downloading with Vagrant::Downloaders::HTTP...
[default] Downloading box: http://files.vagrantup.com/lucid32.box
[default] Extracting box...
[default] Verifying box...
[default] Cleaning up downloaded box...
[default] Importing base box 'lucid32'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
@shenoudab
shenoudab / pip.log
Created January 2, 2012 09:37
vumi installation log
Requirement already satisfied (use --upgrade to upgrade): zope.interface in ./ve/lib/python2.7/site-packages (from -r config/requirements.pip (line 1))
Requirement already satisfied (use --upgrade to upgrade): carrot==0.10.4 in ./ve/lib/python2.7/site-packages (from -r config/requirements.pip (line 2))
Requirement already satisfied (use --upgrade to upgrade): celery==1.0.6 in ./ve/lib/python2.7/site-packages (from -r config/requirements.pip (line 3))
Requirement already satisfied (use --upgrade to upgrade): twisted==10.1 in ./ve/lib/python2.7/site-packages (from -r config/requirements.pip (line 4))
Requirement already satisfied (use --upgrade to upgrade): txamqp==0.5 in ./ve/lib/python2.7/site-packages (from -r config/requirements.pip (line 5))
Requirement already satisfied (use --upgrade to upgrade): Django==1.3 in ./ve/lib/python2.7/site-packages (from -r config/requirements.pip (line 6))
Requirement already satisfied (use --upgrade to upgrade): PyYAML==3.09 in ./ve/lib/python2.7/site-packages (from -r conf
@shenoudab
shenoudab / templates layouts
Created November 4, 2010 14:52
templates and layouts conflict
layout :layout_by_resource
theme :layout_by_resource
def layout_by_resource
if devise_controller?
if resource_name == :participant
if subdomain_conference && user_signed_in?
"conf_manage"
elsif subdomain_conference && participant_signed_in?
"conf_participant"
model_object.copy_to_db(CouchRest.database!("http://admin:[email protected]:5984/db")
# couchrest/document
def copy_to_db(db, bulk = false)
raise ArgumentError, "doc.database required to copy" unless db
#result = db.copy_doc(self, dest)
result = db.save_doc self, bulk
result['ok']
end
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket
{
"name": "NokiaN70",
"brand": "Nokia",
"model": "N70",
"user-agent": ["NokiaN70-1","NokiaN70-2","NokiaN70-3"],
"css": {
"css_supports_width_as_percentage": true
},
"sms": {
"callericon": true,
#!/usr/bin/ruby
require "rubygems"
require "mongo"
require "json/pure"
require "open-uri"
# db config
db = Mongo::Connection.new.db('friendfeed')
col = db.collection('lifesci')