Skip to content

Instantly share code, notes, and snippets.

View clemesha's full-sized avatar

Alex Clemesha clemesha

View GitHub Profile
diff --git a/djangoweb/settings.py b/djangoweb/settings.py
index f9cba67..fe0c8ac 100644
--- a/djangoweb/settings.py
+++ b/djangoweb/settings.py
@@ -2,7 +2,7 @@ import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
STATIC_PORT = 8000
STOMP_PORT = 9999
-INTERFACE = "localhost"
+INTERFACE = "0.0.0.0"
Index: orbited/transports/base.py
===================================================================
--- orbited/transports/base.py (revision 675)
+++ orbited/transports/base.py (working copy)
@@ -15,7 +15,7 @@
self.packets = []
self.request = request
self.opened()
-# self.request.notifiyFinish().addCallback(self.finished)
+ self.request.notifyFinish().addBoth(self.finished)
import smtplib
s = smtplib.SMTP("smtp.gmail.com")
s.ehlo()
s.starttls()
s.ehlo()
s.login("username", "password")
msg = "From: username@gmail.com\r\nTo: other.user@gmail.com\r\nSubject: Testing 1 2 3\r\n\r\n"
msg += "This is a test, only a test."
s.sendmail("username@gmail.com", "other.user@gmail.com", msg)
diff --git a/codenode/frontend/notebook/models.py b/codenode/frontend/notebook/models.py
index 56a8ec3..2c55fff 100644
--- a/codenode/frontend/notebook/models.py
+++ b/codenode/frontend/notebook/models.py
@@ -28,7 +28,7 @@ class Notebook(models.Model):
def save(self):
if not self.guid:
- self.guid = str(uuid.uuid4()).replace("-", "")
+ self.guid = unicode(uuid.uuid4()).replace("-", "")
# 1) "gem install wirble"
# 2) create ~/.irbrc shown below
# 3) fire up 'irb'. see colors, use tab-complete.
require 'irb/completion'
require 'rubygems'
require 'wirble'
ARGV.concat [ "--readline", "--prompt-mode"]
Wirble.init
#twisted_log_watcher.py from http://github.com/derfred/doord/tree
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from twisted.internet.defer import Deferred
from twisted.application import internet, service
from twisted.mail.smtp import ESMTPSenderFactory
from email.MIMEText import MIMEText
import re, StringIO, time, os
sed -i "s/target/result/" some_file
"""
'How to do basic authentication on twisted web', from here:
http://twistedmatrix.com/pipermail/twisted-python/2009-August/020236.html
Original Copyright (c) 2008 Twisted Matrix Laboratories. See LICENSE for details.
Which I modified to use Twisted's Application framework.
USAGE
-----
1) Make htpasswd file:
adduser --gecos GECOS --disabled-password some_user
import os
from whoosh import index
from whoosh import analysis
from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT
from whoosh.filedb.filestore import FileStorage
SEARCH_INDEX = "search_index"
SEARCH_SCHEMA = Schema(
guid=ID(stored=True),