Skip to content

Instantly share code, notes, and snippets.

🌴
Working from home

Adi Roiban adiroiban

🌴
Working from home
Block or report user

Report or block adiroiban

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View public.py
class IPublicAvatar(IPublicObject):
name = PublicAttribute()
peer = PublicAttribute()
class PublicAvatarAdapter(object):
delegates(IPublicAvatar)
def __init__(self, context):
self.context = context
service_avatar = ServiceAvatar()
View bla.diff
diff --git a/docs/_extensions/apilinks.py b/docs/_extensions/apilinks.py
index 656d350..7b939fb 100644
--- a/docs/_extensions/apilinks.py
+++ b/docs/_extensions/apilinks.py
@@ -23,15 +23,21 @@ def make_api_link(name, rawtext, text, lineno, inliner,
full_name = full_name.strip()
label = label.strip('>').strip()
else:
- full_name = label = text
+ full_name = text
@adiroiban
adiroiban / folder_traversal.py
Last active Aug 29, 2015
render_POST , render_GET will look at self.segments (which are relative paths) and use them for construct the final path.
View folder_traversal.py
#
# WARNING: This code does not work / had bugs ... is is just an idea.
#
def getChild(self, name, request):
"""
Return the resource for the request.
It will accumulate segments until we are at the end of the URL and
only then will do the filesystem check and return the final resource.
View gist:9125421
(venv)
/home/adi/chevah/pydoctor/trunk ----------------------------------------- @pp
$ nosetests pydoctor
..............................E........E...F.....................
======================================================================
ERROR: Failure: ImportError (No module named py)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
View gist:9246608
$ host -a deckbox.org
Trying "deckbox.org"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7848
;; flags: qr rd ra; QUERY: 1, ANSWER: 12, AUTHORITY: 0, ADDITIONAL: 9
;; QUESTION SECTION:
;deckbox.org. IN ANY
;; ANSWER SECTION:
deckbox.org. 86400 IN SOA ns1.deckbox.org. contact.deckbox.org. 9 86400 7200 3600000 86400
@adiroiban
adiroiban / gist:9723953
Last active Aug 29, 2015
Twisted development wiki changes
View gist:9723953
Some changes might be bold, but I tried to reduce noise level by reducing the amount of links that are referenced in this page.
Update links for removed Lore file.
Add info about changing wiki pages.
Move all info about working with ticket into ticket managemetn
Removed SVN commands and reference the VcsWorklow page as the place where VCS details are contained.
In this way we don't need to spread specific command all over the wiki.
View gist:cd1dc0ca199dc378ec16
def __init__()
self._login_recorder = LoginRecorder()
def handleEventAction(self, event):
"""
Perform associate actions for `event`.
"""
if self.configuration.server.reporter:
self._login_recorder.eventReceived(event)
View inotify_fail_clean.py
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler
class ObserverThread(Observer):
"""
Patched watched.Observer.
@adiroiban
adiroiban / spawn.py
Last active Aug 29, 2015
Spawn with timeout and with the same behaviour across operating systems
View spawn.py
"""
Execute external processes.
"""
import os
from twisted.internet import reactor, error, defer
from twisted.internet.protocol import ProcessProtocol
SPAWN_PROCESS_TIMEOUT = 5
@adiroiban
adiroiban / sshsimpleserverwithprimes.py
Created Nov 17, 2014
Twisted SSH Server with primes
View sshsimpleserverwithprimes.py
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.cred import portal, checkers
from twisted.conch import error, avatar
from twisted.conch.checkers import SSHPublicKeyDatabase
from twisted.conch.ssh import factory, userauth, connection, keys, session
from twisted.internet import reactor, protocol, defer
You can’t perform that action at this time.