Skip to content

Instantly share code, notes, and snippets.

@zuriby
zuriby / public.xml
Created July 27, 2011 03:27
other trunk config
<include>
<context name="public">
<extension name="localxtens">
<condition field="destination_number" expression="^([0]?[9]?88975[0-9][0-9])$">
<action application="set" data="ringback=${us-ring}"/>
<action application="bridge" data="${sofia_contact(internal/$1@$${domain})}"/>
</condition>
<condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
@zuriby
zuriby / asynciostream.py
Created July 5, 2011 06:36
Tornado IO Stream Handler
class StreamHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
self.post()
@tornado.web.asynchronous
def post(self):
self.ioloop = tornado.ioloop.IOLoop.instance()
self.pipe = self.get_pipe()
self.ioloop.add_handler(
static
08602cf1.0 -> boxes_CA.pem
9b5e6b55.r0 -> crl.pem
aabda215.0 -> afikoman_CA.pem
ea48d2c0.0 -> customers_CA.pem
1000.key
1000.pem
customers_CA.pem
afikoman_CA.pem
boxes_CA.pem
There are a lot of simple, intuitive explanations of this to be had out there … but I kind of hate them all. You might google around a bit and find discussion of something called "relativistic mass," and how it requires more force to accelerate an object that's already moving at a high velocity, stuff like that. That's a venerable way of interpreting the mathematics of special relativity, but I find it unnecessarily misleading, and confusing to the student who's just dipping her first toe into the ocean of modern physics. It makes the universe sound like a much different, and much less wonderful, place than it really is, and for that I kind of resent it.
When I talk about this subject, I do it in terms of the geometric interpretation that's consistent with general relativity. It's less straightforward, but it doesn't involve anything fundamentally more difficult than arrows on pieces of paper, and I think it offers a much better understanding of the universe we live in than hiding behind abstractions like "f
@zuriby
zuriby / gist:975588
Created May 16, 2011 23:27
Stream handlers with Tornado
class StreamHandler(AMSHandler):
@tornado.web.asynchronous
def get(self):
self.post()
@tornado.web.asynchronous
def post(self):
self.write("<pre>")
self.ioloop = tornado.ioloop.IOLoop.instance()
self.pipe = self.get_pipe()
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from amsutils import common, confighelpers
from amsutils.common import shell
from amsutils.confighelpers import get_meta_config
lines = [
# take the bridge down
"ifconfig afik_br down",
@zuriby
zuriby / daemon.py
Created May 8, 2011 08:40
A generic python daemon class
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
rocommunity afikoman
## sec.name source community
## ======== ====== =========
com2sec local localhost afikoman
com2sec network_1 20.0.0.0/24 afikoman
com2sec network_2 10.0.0.0/24 afikoman
## Access.group.name sec.model sec.name
## ================= ========= ========
group MyROGroup_1 v1 local
www:
requirements:
- faye
- jade
@zuriby
zuriby / hash32.py
Created March 29, 2011 04:33
32bit hash function for python
hash32 = lambda value: hash(value) & 0xffffffff