Skip to content

Instantly share code, notes, and snippets.

View Mostafa-Hamdy-Elgiar's full-sized avatar

Mostafa Hamdy Elgiar Mostafa-Hamdy-Elgiar

  • CITC - Mansoura University
  • Mansoura - Egypt
View GitHub Profile
#!/usr/bin/python
import csv,os
count = 0
os.chdir("work/airline_ontime")
files = os.popen("find . -name *.zip")
for f in files:
print f
file_name = f.split("/")[-1]
@Mostafa-Hamdy-Elgiar
Mostafa-Hamdy-Elgiar / office-dashboard-terminal.yml
Created February 25, 2017 21:21 — forked from jage/office-dashboard-terminal.yml
Ansible playbook to schedule display sleep (OS X)
---
- hosts: office-dashboard-terminal
become: yes
tasks:
- name: Ensure displays are up during office hours
cron:
name="Activate display"
minute="0"
hour="8"
weekday="1-5"
import ldap , sys
if len(sys.argv != 2) :
print "Usage: python disableuserinAD.py <username>"
sys.exit(1)
Server = "ldap://xxx.xxx.xxx.xxx"
DN = "cn=username,cn=user,dc=example,dc=com" # DN for [email protected] in order to authentication
Secret = "xxxxxxx" #password for username
#Previous username and password used to autenticate in AD.
Base = "ou=xxxx,dc=example,dc=com"
@Mostafa-Hamdy-Elgiar
Mostafa-Hamdy-Elgiar / Filetimes.py
Created February 25, 2017 09:22
Python Script to convert Microsoft widows file time to python date and also date to windows file time
#!/usr/bin/env python
# Copyright (c) 2009, David Buxton <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@Mostafa-Hamdy-Elgiar
Mostafa-Hamdy-Elgiar / zimbra-grouping.py
Created February 25, 2017 08:28
A Python script to grouping all users in zimbra
import os
pathtozmprov = "/opt/zimbra/bin/zmprov -l"
f = os.popen(pathtozmprov + ' gaa') #list all users in zimbra mail server
zmprovgaa= []
zmprovgaa = f.readlines()
for i in zmprovgaa:
print i
os.system("/opt/zimbra/bin/zmprov adlm <groupname>@xxxxx.xxx.xx.xx " + i) #add a user to the group
@Mostafa-Hamdy-Elgiar
Mostafa-Hamdy-Elgiar / ADsearch.py
Created February 24, 2017 17:50
A Python Script to search in a MS AD
#!/usr/bin/env python
import ldap , sys
if len(sys.argv) != 2 :
pritn "Example of usage: python ADsearch.py <username>"
sys.exit(1)
username = sys.argv[1]
Server = "ldap://xxx.xxx.xxx.xxx"
DN = "cn=xxx,cn=xxx,dc=xxx,dc=xxx,dc=xxx,dc=" #a DN for the user using in auth process
Secret = "xxxxxx"
Base = "dc=xxxx,dc=xxx,dc=xxx,dc=xx" #The search domain level
@Mostafa-Hamdy-Elgiar
Mostafa-Hamdy-Elgiar / mysql-checkdbs.py
Created February 24, 2017 13:05
This is a Python script to compare between the databases in Mysql Engine and the databases in backup solution, also send an E-mail about the databases not in the backup plan.
#!/usr/bin/python
#this script check the databases created in the Mysql engine and not in the backup script.
import os , commands , sys
import smtplib
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
DBs=os.popen('grep ^"DBNAMES" /opt/scripts/automysqlbackup.sh | cut -d"=" -f2') #Get all DBs in backup scripts
DBs=DBs.readlines()
DBs=DBs[0][1:-2]
import pymedia.audio.sound as sound
import pymedia.audio.acodec as acodec
import time
import sys
import wx
from threading import Thread
app = wx.App()
class frame(wx.Frame):