Skip to content

Instantly share code, notes, and snippets.

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
@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.
#!/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 / 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()
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
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
@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(
@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 / logger.py
Created December 14, 2011 02:34
python logger with colors
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__ = 'Tzury Bar Yochay'
__version__ = '0.1'
__license__ = 'GPLv3'
import logging
from logging import handlers
@zuriby
zuriby / sgmllib.py
Created December 26, 2011 04:01
add UnicodeError, UnicodeEncodeError,UnicodeDecodeError at except in finish_starttag and finish_endtag methods (between lines: 331-377)
"""A parser for SGML, using the derived class as a static DTD."""
# XXX This only supports those SGML features used by HTML.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDATA (character data -- only end tags are special). RCDATA is
# not supported at all.