Skip to content

Instantly share code, notes, and snippets.

View adiroiban's full-sized avatar
🇺🇦
Slava Ukraini!

Adi Roiban adiroiban

🇺🇦
Slava Ukraini!
  • VGR, La Gomera
  • 23:09 (UTC +01:00)
View GitHub Profile
@adiroiban
adiroiban / cookies.txt
Created January 22, 2014 12:12
Sample curl cookie format.
localhost FALSE / FALSE 0 cookie_name BIG_VALUE_HERE
class IPublicAvatar(IPublicObject):
name = PublicAttribute()
peer = PublicAttribute()
class PublicAvatarAdapter(object):
delegates(IPublicAvatar)
def __init__(self, context):
self.context = context
service_avatar = ServiceAvatar()
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 August 29, 2015 13:56
render_POST , render_GET will look at self.segments (which are relative paths) and use them for construct the final path.
#
# 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.
(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)
@adiroiban
adiroiban / gist:9246608
Created February 27, 2014 08:51
deckbox dns
$ 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 August 29, 2015 13:57
Twisted development wiki changes
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.
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)
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 August 29, 2015 14:05
Spawn with timeout and with the same behaviour across operating systems
"""
Execute external processes.
"""
import os
from twisted.internet import reactor, error, defer
from twisted.internet.protocol import ProcessProtocol
SPAWN_PROCESS_TIMEOUT = 5