Skip to content

Instantly share code, notes, and snippets.

View achintangal's full-sized avatar

Abhiram Chintangal achintangal

View GitHub Profile
@achintangal
achintangal / gist:10990720
Created April 17, 2014 15:10
vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@achintangal
achintangal / gist:10988684
Created April 17, 2014 14:41
error while running vagrant up
/opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/version.rb:163:in `=~': invalid byte sequence in UTF-8 (ArgumentError)
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/version.rb:163:in `correct?'
from /opt/vagrant/embedded/lib/ruby/2.0.0/rubygems/version.rb:192:in `initialize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/box_collection.rb:273:in `new'
from /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/box_collection.rb:273:in `block (2 levels) in find'
from /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/box_collection.rb:270:in `map'
from /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/box_collection.rb:270:in `block in find'
from /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/box_collection.rb:416:in `block in with_collection_lock'
from /opt/vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /opt/vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/box_c
@achintangal
achintangal / settings_local.py
Created March 2, 2014 03:42
local settings for weather
# local settings for testing
# add setting that you wish to override during testing
TESTING=True
# doesn't send emails, instead it writes them a file
# specified in EMAIL_FILE_PATH
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
@achintangal
achintangal / gist:9003681
Created February 14, 2014 16:04
listner.py from weather ( this gets invoked from a django command "runlistner")
A module for listening to Tor for new consensus events. When one occurs,
initializes the checker/updater cascade in the updaters module.
"""
import logging
from config import config
from weatherapp import updaters
from stem.control import EventType, Controller
@achintangal
achintangal / listener.py
Last active August 29, 2015 13:56
getting weather to communicate with stem
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 8 wants to read.
Feb 14 20:47:48.000 [debug] connection_handle_listener_read(): Connection accepted on socket 4 (child of fd 8).
Feb 14 20:47:48.000 [notice] New control connection opened.
Feb 14 20:47:48.000 [debug] connection_add_impl(): new conn type Control, socket 4, address 127.0.0.1, n_conns 3.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 16 bytes. 16 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
Feb 14 20:47:48.000 [debug] conn_read_callback(): socket 4 wants to read.
Feb 14 20:47:48.000 [debug] read_to_chunk(): Read 91 bytes. 91 on inbuf.
Feb 14 20:47:48.000 [debug] conn_write_callback(): socket 4 wants to write.
@achintangal
achintangal / gist:8688282
Created January 29, 2014 13:46
Stem Interface from Weather's Stem Patch
"""
This module contains the CtlUtil class. CtlUtil objects set up a connection to
Stem and handle communication concerning consensus documents and descriptor
files.
@var unparsable_email_file: A log file for contacts with unparsable emails.
"""
import logging
import re