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
@adiroiban
adiroiban / buildbot_configuration_builder.py
Last active Aug 29, 2015
Take a dict and create buildbot configuration.
View buildbot_configuration_builder.py
#
# Create buildbot configuration based on a plain dict.
#
from buildbot.buildslave import BuildSlave
from buildbot.config import BuilderConfig
from buildbot.changes.gitpoller import GitPoller
from buildbot.changes.filter import ChangeFilter
from buildbot.interfaces import IEmailLookup
from buildbot.process.factory import BuildFactory
from buildbot.process.properties import Property, Interpolate
View gist:ae1dd671db5bfe72e956
diff --git a/python-modules/chevah-python-test/test_python_binary_dist.py b/python-modules/chevah-python-test/test_python_binary_dist.py
index 58c2fe5..8de6e31 100644
--- a/python-modules/chevah-python-test/test_python_binary_dist.py
+++ b/python-modules/chevah-python-test/test_python_binary_dist.py
@@ -72,6 +72,14 @@ except:
print '"ctypes.utils - find_library" missing.'
exit_code = 1
+try:
+ import gmpy
@adiroiban
adiroiban / init.sh
Created Jan 5, 2015
Ubuntu post install
View init.sh
echo 'deb http://download.virtualbox.org/virtualbox/debian trusty contrib' | \
sudo tee /etc/apt/sources.list.d/virtualbox.list
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get remove --purge rhythmbox-data rhythmbox
sudo apt-get install \
chromium-browser network-manager-openvpn-gnome\
htop vim-nox synaptic mc unrar\
pidgin indicator-cpufreq \
@adiroiban
adiroiban / output
Last active Aug 29, 2015
Unhandled exceptions.OverflowError: getsockaddrarg: port must be 0-65535.
View output
$ ./build-ubuntu1404-x64/bin/python test.py
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/home/adi/chevah/server/build-ubuntu1404-x64/lib/python2.7/site-packages/twisted/internet/defer.py", line 551, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/home/adi/chevah/server/build-ubuntu1404-x64/lib/python2.7/site-packages/twisted/internet/base.py", line 250, in _checkTimeout
userDeferred.callback(result)
File "/home/adi/chevah/server/build-ubuntu1404-x64/lib/python2.7/site-packages/twisted/internet/defer.py", line 368, in callback
self._startRunCallbacks(result)
View test.py
from __future__ import print_function
import json
from StringIO import StringIO
from twisted.internet import defer, protocol, reactor, task
from twisted.web import server, static
from twisted.web.client import (
Agent,
FileBodyProducer,
HTTPConnectionPool,
@adiroiban
adiroiban / client.py
Last active Aug 29, 2015
Stop server HTTP transport
View client.py
"""
Client which makes a simple POST request.
"""
import urllib
import urllib2
params = urllib.urlencode(
{'action': 'delete-members', 'selected-members': 'README.rst'})
req = urllib2.Request(
'http://127.0.0.1:8080/',
@adiroiban
adiroiban / interface.py
Last active Aug 29, 2015
HTTP 100 continue and informing a resource that headers have been received
View interface.py
class IChevahRequest(IRequest):
"""
Extended request used in Chevah project.
"""
maximumBodyLength = Attribute(
"""
Set the maximum accepted body length.
Clients sending more data are disconnected.
View twisted_web_http_digest_md5_sess.py
from zope.interface import implements
from twisted.cred.portal import IRealm, Portal
from twisted.cred.checkers import InMemoryUsernamePasswordDatabaseDontUse
from twisted.web.static import File
from twisted.web.resource import IResource
from twisted.web.guard import HTTPAuthSessionWrapper, DigestCredentialFactory
from twisted.web.server import Site
from twisted.internet import reactor
View keybase.md

Keybase proof

I hereby claim:

  • I am adiroiban on github.
  • I am adiroiban (https://keybase.io/adiroiban) on keybase.
  • I have a public key whose fingerprint is B8E7 4048 044E F459 4A15 60B8 F2AD A018 852B 2B03

To claim this, I am signing this object:

@adiroiban
adiroiban / test.py
Created Apr 8, 2015
Unicode os.stat
View test.py
-> os.stat(path)
(Pdb) path
u'/tmp/4b385cfb-f96c-4eca-81c9-70d1223353d6-cp\u021b/3741-cp\u021baaaaaaaaaaaaaaaaaaaaaaaa'
(Pdb) os.stat(path)
*** UnicodeEncodeError: 'ascii' codec can't encode character u'\u021b' in position 44: ordinal not in range(128)
(Pdb) os.stat(path.encode('utf-8'))
*** OSError: [Errno 2] No such file or directory: '/tmp/4b385cfb-f96c-4eca-81c9-70d1223353d6-cp\xc8\x9b/3741-cp\xc8\x9baaaaaaaaaaaaaaaaaaaaaaaa'
(Pdb) os.environ.get('LANG')
'C'
(Pdb) os.stat(path)
You can’t perform that action at this time.