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 /
Created Dec 2, 2019
Change RDP port - Azure script
$TSPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server'
$RDPTCPpath = $TSPath + '\Winstations\RDP-Tcp'
Set-ItemProperty -Path $TSPath -name 'fDenyTSConnections' -Value 0
# RDP port
$portNumber = (Get-ItemProperty -Path $RDPTCPpath -Name 'PortNumber').PortNumber
Write-Host Get RDP PortNumber: $portNumber
if (!($portNumber -eq $RDPPort))
adiroiban /
Last active Feb 13, 2019
Ampoule Example from main thread
This code is launched in the child process.
It is also loaded/imported in the main process for AMP protocol to know the
available command, arguments and results.
Each process will use about 30MB of ram, as this is how much Twisted uses.
Having more imports here, will increase the size of the process.
adiroiban /
Created Oct 31, 2018
Code to help writing tests for Twisted HTTP client
# Copyright (c) 2014 Adi Roiban.
# See LICENSE for details.
Helpers for testing code related to HTTP protocol.
from __future__ import absolute_import
from httplib import HTTPConnection, HTTPSConnection
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from select import error as SelectError
View doc.diff
diff --git a/chevah/server/static/documentation/operation-client/transfers.rst b/chevah/server/static/documentation/operation-client/transfers.rst
index 5605264..0322b10 100644
--- a/chevah/server/static/documentation/operation-client/transfers.rst
+++ b/chevah/server/static/documentation/operation-client/transfers.rst
@@ -310,6 +310,10 @@ The `lowercase` is a simple transformation which will transfer the file
using destination file path and file name all in lower case.
It takes no options.
+.. note::
+ If the remote filesystem is case insensitive and a file with the same
View test
adiroiban /
Last active Jun 29, 2019
Script to add a file to dropzone via Selenium... from Python
def addFileToDropzone(self, driver, css_selector, name, content):
Trigger a file add with `name` and `content` to Dropzone element at `css_selector`.
script = """
var dropzone_instance = Dropzone.forElement(css_selector)
var new_file = new File(['%s'], '%s', {type: 'application/octet-binary'})
""" % (content, name)
adiroiban /
Created Mar 24, 2018
flaky decorator
def flaky(count=3, os_version=None):
A decorator generator to retry a test if it fails in one of the OS from
When `os_version` is None it will retry on any OS.
It will not work with any tests.
The setUp and tearDown is only called once and not called between
adiroiban / pycodestyle.txt
Last active Mar 17, 2018
Statistic for pycodestyle errors in Twisted
View pycodestyle.txt
autopep8 -r -i --ignore E226,E24,W503,E3,E123,E128
1 E272 multiple spaces before keyword
2 E211 whitespace before '('
2 E743 ambiguous function definition 'l'
2 W191 indentation contains tabs
3 E101 indentation contains mixed spaces and tabs
Helpers for testing code related to HTTP Proxy .
It provides a context manager for starting the proxy.
Copyright (c) 2017 Adi Roiban.
License BSD
This code is based on HTTP Proxy Server in Python.
:copyright: (c) 2013 by Abhinav Singh.
adiroiban /
Last active Nov 26, 2017
Twisted Mail SMTPConnectError strange behaviour
# Copyright (c) 2015 Adi Roiban.
# MIT License
(E)SMTP high level client.
from email.header import Header
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formataddr, formatdate, make_msgid
You can’t perform that action at this time.