Skip to content

Instantly share code, notes, and snippets.

#!/home/rockj/pysh/bin/python
"""Remove duplicate emails
Script that tries as good as it can to delete duplicates based
on the 'message-id' mail header and diffing mail body of 'message-id'
duplicatse.
This script do the following:
Loops thru every mailfile, append em in a hash which is keyed on the
var Browser = {
Version: function() {
var version = 999; // we assume a sane browser
if (navigator.appVersion.indexOf("MSIE") != -1)
// bah, IE again, lets downgrade version number
version = parseFloat(navigator.appVersion.split("MSIE")[1]);
return version;
},
DocumentVersion: function () {
var version = 999; // we assume a sane browser
"""Tiny LDAP Wrapper module"""
import simpleldap
class LDAP(object):
def __init__(self):
self.connection = None
self.search_base = None
self.protocol = None
self.encryption = None
class LDAPTestCase(unittest2.TestCase):
def setUp(self):
simpleldap.Connection = mock.MagicMock(name='simpleldap.Connection')
self.module = LDAP()
def test_if_protocol_is_ssl_on_ssl_port(self):
self.module.connect('foo', 636, None, 'ldap')
self.assertEquals('ldaps', self.module.protocol)
(rt_ldap_sync)dworek:~/rt# python manage.py sync_ldap_groups dotkom
(objectClass=posixGroup) ou=groups,dc=xxx ['cn']
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/root/.virtualenvs/rt_ldap_sync/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/root/.virtualenvs/rt_ldap_sync/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
friend | Rockj: vrrp tracking og logging, eem som matcher på syslog og action snmp-trap
friend | magisk :p
friend | om traps er godt nok da
Rockj | tror sjefen min hyler ganske bra om han må gjøre det der, tror ikke verden blir noe betre at våre kunder (sysadmins i hele utdanningssektoren) må sette opp slikt :P
#!/usr/bin/env python
import re
import fileinput
import getopt
import getopt, sys
def main():
#!/usr/bin/env python
#
# Copyright (C) 2012 Roy Sindre Norangshol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
@norrs
norrs / gist:3864753
Created October 10, 2012 10:53
tickets_to_nav.txt
#1 Link to netmap with VLAN argument
Possible to create a hyperlink to netmap with VLAN id to choose as a selected vlan.
Should also be able to create a hyperlink to a specific view.
Example on hashbangs:
#!netmap/vlan/navvlanid
#!netmap/1234/vlan/navvlanid
01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV620 PRO [Radeon HD 3470] (prog-if 00 [VGA controller])
Subsystem: Dell Device 3243
Flags: bus master, fast devsel, latency 0, IRQ 16
Memory at e0000000 (64-bit, prefetchable) [size=256M]
Memory at f7df0000 (64-bit, non-prefetchable) [size=64K]
I/O ports at dc00 [size=256]
Expansion ROM at f7e00000 [disabled] [size=128K]
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Legacy Endpoint, MSI 00
Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+