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
  • 01:06 (UTC +01:00)
View GitHub Profile
def test_database_sqlite(self):
"""
"""
def create_handler(url):
interaction = mk.interaction_factory(
url, pool_size_min=1, pool_size_max=1)
#self.handler = TestDatabaseHandler(interaction, capacity=1)
self.handler = TestDatabaseHandler(interaction, capacity=1)
return self.handler
def _runDeferred(self, deferred, timeout, debug):
"""
Does the actual deferred execution.
"""
if not deferred.called:
deferred_done = False
while not deferred_done:
self._iterateTestReactor(debug=debug)
deferred_done = deferred.called
Trigger: Version of zabbix_agent(d) was changed on Daneș
Trigger status: OK
Trigger severity: Information
Trigger URL:
Item values:
1. Version of zabbix_agent(d) running (Daneș:agent.version): 2.0.7
2. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*
3. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*
class TestUser(object):
"""
An object storing all user information.
"""
def __init__(self, name, uid=None, gid=None, home_path=None,
home_group=None, shell=None, shadow=None, password=None,
domain=None, pdc=None):
if home_path is None:
home_path = u'/tmp'
-bash-3.2$ du -s ~/fix-packs/5300-06/
230640 /home/chevah/fix-packs/5300-06/
-bash-3.2$ du -s ~/fix-packs/5300-06/
219792 /home/chevah/fix-packs/5300-06/
-bash-3.2$ du -s ~/fix-packs/5300-06/
227072 /home/chevah/fix-packs/5300-06/
-bash-3.2$ du -s ~/fix-packs/5300-06/
@adiroiban
adiroiban / t.py
Created December 11, 2013 07:43
test generator
class FileHandlerTestCase(ServerTestCase):
"""
Base test case for all file handlers.
"""
def setUp(self):
super(FileHandlerTestCase, self).setUp()
self.handler = self.getNewHandler()
self.handler.stream = StringIO()
def _patched_emit(self, record):
"""
Emit a record.
If a formatter is specified, it is used to format the record.
The record is then written to the stream with a trailing newline. If
exception information is present, it is formatted using
traceback.print_exception and appended to the stream. If the stream
has an 'encoding' attribute, it is used to determine how to do the
@adiroiban
adiroiban / gist:8260720
Last active January 2, 2016 05:59
Multi Part POST format
POST /SERVER_UPLOAD_URL HTTP/1.1
Content-Length: 1325
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryePkpFF7tjBAqx29L
------WebKitFormBoundaryePkpFF7tjBAqx29L
Content-Disposition: form-data; name="MAX_FILE_SIZE"
100000
------WebKitFormBoundaryePkpFF7tjBAqx29L
Content-Disposition: form-data; name="directory"
@adiroiban
adiroiban / gist:8260747
Created January 4, 2014 21:08
Octet Stream POST format
POST /HTTP_ROOT/path/to/server/destination/directory HTTP/1.1
Content-Length: 1325
Content-Type: application/octet-stream
<file data>
@adiroiban
adiroiban / google_form_submit.js
Created January 4, 2014 22:31
Example for sending confirmation email for Google Forms. You still need to manually configure the trigger and attach it to onFormSubmit.
// Code under Public Domain.
function onFormSubmit(event) {
// event.responses - FormResponse
var response = event.response.getItemResponses();
// Update 5 with yout email field.
var recipient = response[5].getResponse();
// Update 0 with your name field.
var name = response[0].getResponse();
// Email address only of owner of the form.
var owner = 'MYEMAIL@gmail.com';