Popular Python recipes tagged "sysadmin"http://code.activestate.com/recipes/langs/python/tags/sysadmin/2016-12-23T18:05:41-08:00ActiveState Code RecipesGet disk partition information with psutil (cross-platform) (Python) 2016-12-23T18:05:41-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580737-get-disk-partition-information-with-psutil-cross-p/ <p style="color: grey"> Python recipe 580737 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/device/">device</a>, <a href="/recipes/tags/disk/">disk</a>, <a href="/recipes/tags/file_system/">file_system</a>, <a href="/recipes/tags/psutil/">psutil</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/system/">system</a>). </p> <p>This is a recipe that shows how to easily get disk partition information, in a cross-platform manner (for the supported OSes), from your computer's operating system, using the psutil library for Python.</p> Quick-and-dirty Windows drive detector (Python) 2016-09-20T17:46:37-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580699-quick-and-dirty-windows-drive-detector/ <p style="color: grey"> Python recipe 580699 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/drives/">drives</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/system_programming/">system_programming</a>, <a href="/recipes/tags/utility/">utility</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>This is a quick-and-dirty Python script to detect the currently available drives on your Windows PC.</p> Persistent Queue (Python) 2015-11-12T06:45:12-08:00zhangkaizhaohttp://code.activestate.com/recipes/users/4189594/http://code.activestate.com/recipes/579124-persistent-queue/ <p style="color: grey"> Python recipe 579124 by <a href="/recipes/users/4189594/">zhangkaizhao</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>A class for persistent queues.</p> getch()-like unbuffered character reading from stdin on both Windows and Unix (Python) 2015-08-19T04:45:51-07:00jwhite88http://code.activestate.com/recipes/users/4192711/http://code.activestate.com/recipes/579095-getch-like-unbuffered-character-reading-from-stdin/ <p style="color: grey"> Python recipe 579095 by <a href="/recipes/users/4192711/">jwhite88</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>A small utility class to read single characters from standard input, on both Windows and UNIX systems. It provides a getch() function-like instance.</p> <p>This extends the original script by adding a timeout necessary for another project.</p> lndir.py (short python version of the BSD/X11 lndir utility) (Python) 2013-05-28T07:21:28-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578535-lndirpy-short-python-version-of-the-bsdx11-lndir-u/ <p style="color: grey"> Python recipe 578535 by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a> (<a href="/recipes/tags/directories/">directories</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/os_walk/">os_walk</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/walk/">walk</a>). Revision 2. </p> <p>This should be valid for Python 2.6 and up, including the 3.x series.</p> Treat the Win32 Registry like a Python dict -- pure python (Python) 2012-10-20T13:54:02-07:00Grizzly Nyohttp://code.activestate.com/recipes/users/4183996/http://code.activestate.com/recipes/578296-treat-the-win32-registry-like-a-python-dict-pure-p/ <p style="color: grey"> Python recipe 578296 by <a href="/recipes/users/4183996/">Grizzly Nyo</a> (<a href="/recipes/tags/registery/">registery</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/win32/">win32</a>). </p> <p>This class wraps most of the win32api functions for accessing a registry. It will read and write all win32 registry types, and will de/serialize python objects to registry keys when a string or integer representation is not possible.</p> <p>This is an update of <a href="http://code.activestate.com/recipes/573466/">recipe 573466</a>, which is an update of 551761, which is in turn an update of 174627, folding in the enhancements listed in the discussion there to allow registry value types to be read and written within the dictionary metaphor if required. It doesn't change how it worked before, it adds a new capability, and shouldn't break existing code using the 551761 version.</p> <p>Altered to use _winreg to avoid dependency on PyWin32 (not part of Python).</p> Running linux command inside your python script (Python) 2012-09-09T08:08:46-07:00Ahmed Kamelhttp://code.activestate.com/recipes/users/4183490/http://code.activestate.com/recipes/578254-running-linux-command-inside-your-python-script/ <p style="color: grey"> Python recipe 578254 by <a href="/recipes/users/4183490/">Ahmed Kamel</a> (<a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>Running any linux command line inside your python script.</p> IOPS calculator (Python) 2011-09-20T09:31:09-07:00Slava Yansonhttp://code.activestate.com/recipes/users/4176967/http://code.activestate.com/recipes/577873-iops-calculator/ <p style="color: grey"> Python recipe 577873 by <a href="/recipes/users/4176967/">Slava Yanson</a> (<a href="/recipes/tags/iops/">iops</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/performance/">performance</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>Calculates IOPS for all disks in Linux/Unix system</p> LoggingWebMonitor - a central logging server and monitor. (Python) 2010-02-02T01:56:42-08:00Gabriel Genellinahttp://code.activestate.com/recipes/users/924636/http://code.activestate.com/recipes/577025-loggingwebmonitor-a-central-logging-server-and-mon/ <p style="color: grey"> Python recipe 577025 by <a href="/recipes/users/924636/">Gabriel Genellina</a> (<a href="/recipes/tags/client_server/">client_server</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/logging/">logging</a>, <a href="/recipes/tags/remote/">remote</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/web/">web</a>). Revision 3. </p> <p>LoggingWebMonitor listens for log records sent from other processes running in the same box or network. Collects and saves them concurrently in a log file. Shows a summary web page with the latest N records received.</p> RSH with timeout (Python) 2010-09-13T06:49:35-07:00Shrinidhi Raohttp://code.activestate.com/recipes/users/4174946/http://code.activestate.com/recipes/577390-rsh-with-timeout/ <p style="color: grey"> Python recipe 577390 by <a href="/recipes/users/4174946/">Shrinidhi Rao</a> (<a href="/recipes/tags/command/">command</a>, <a href="/recipes/tags/execution/">execution</a>, <a href="/recipes/tags/remote/">remote</a>, <a href="/recipes/tags/rsh/">rsh</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/timeout/">timeout</a>). </p> <p>RSH sometimes hangs if it cannot resolve to a given host. So here is a quick recipe in python </p> Pyliner - Script to run arbitrary Python code on the command line (Python) 2011-07-29T13:22:54-07:00Drew Gulinohttp://code.activestate.com/recipes/users/4119417/http://code.activestate.com/recipes/577075-pyliner-script-to-run-arbitrary-python-code-on-the/ <p style="color: grey"> Python recipe 577075 by <a href="/recipes/users/4119417/">Drew Gulino</a> (<a href="/recipes/tags/awk/">awk</a>, <a href="/recipes/tags/oneliner/">oneliner</a>, <a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/pipe/">pipe</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sed/">sed</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>A Python script that runs arbitrary Python scripts in an input loop. This allows one-liner Python scripts similarly to how Perl runs them (-l,-a,-n,-F, BEGIN, END)</p> <p>It provides additional syntax that allows multiline Python scripts to be run on a single line</p> tgraph - Simple ASCII graphing utility (Python) 2011-07-28T21:13:23-07:00Drew Gulinohttp://code.activestate.com/recipes/users/4119417/http://code.activestate.com/recipes/577077-tgraph-simple-ascii-graphing-utility/ <p style="color: grey"> Python recipe 577077 by <a href="/recipes/users/4119417/">Drew Gulino</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/log/">log</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/tail/">tail</a>, <a href="/recipes/tags/unix/">unix</a>). </p> <p>Takes a stream of numbers and outputs simple ASCII graphs of those numbers</p> Keep a process up and running (Python) 2009-09-23T11:55:46-07:00Benjamin Sergeanthttp://code.activestate.com/recipes/users/4039626/http://code.activestate.com/recipes/576911-keep-a-process-up-and-running/ <p style="color: grey"> Python recipe 576911 by <a href="/recipes/users/4039626/">Benjamin Sergeant</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 2. </p> <p>If you have a long running process that can be killed for strange and unknown reason, you might want it to be restarted ... this script does that.</p> DateTimeSyncer with Daylight Savings Time adjustment (Python) 2008-10-31T15:52:18-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/576546-datetimesyncer-with-daylight-savings-time-adjustme/ <p style="color: grey"> Python recipe 576546 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/shortcuts/">shortcuts</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 5. </p> <p>DateTimeSyncer synchronizes computer's current date and time with Daylight Savings adjustment directly without depending on operating system or Python's time.localtime().</p> <p>This allows programmers to update Daylight Savings Time rules without depending on external updates to OS or Python.</p> <p>Double-clicking this module will synchronize your computer's date and time on a Windows machine. It can be easily extended other time zones and other operating systems.</p> using pyHook to block Windows Keys (Python) 2011-09-18T21:29:17-07:00Brian Davishttp://code.activestate.com/recipes/users/4119187/http://code.activestate.com/recipes/553270-using-pyhook-to-block-windows-keys/ <p style="color: grey"> Python recipe 553270 by <a href="/recipes/users/4119187/">Brian Davis</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>Normally you do NOT want to block operating system key combinations but there are a few legitimate cases where you do. In my case I am making a pygame script for my 1 year old to bang on the keyboard and see/hear shapes/color/sounds in response. Brian Fischer on the pygame mailing list pointed me to pyHook. This example was taken from here: <a href="http://www.mindtrove.info/articles/pyhook.html" rel="nofollow">http://www.mindtrove.info/articles/pyhook.html</a> and modified to use the pygame event system.</p> List System Process and Process Information on win32 (Python) 2008-07-18T02:03:13-07:00winterTTr Donghttp://code.activestate.com/recipes/users/4164498/http://code.activestate.com/recipes/576362-list-system-process-and-process-information-on-win/ <p style="color: grey"> Python recipe 576362 by <a href="/recipes/users/4164498/">winterTTr Dong</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>use ctypes , load the win32 API to enum process and list the process info</p> Get sys.argv with Unicode characters under Windows (Python) 2008-05-13T17:44:08-07:00Brodie Raohttp://code.activestate.com/recipes/users/2965587/http://code.activestate.com/recipes/572200-get-sysargv-with-unicode-characters-under-windows/ <p style="color: grey"> Python recipe 572200 by <a href="/recipes/users/2965587/">Brodie Rao</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>A function that employs ctypes to call the underlying UTF-8 APIs for getting command line arguments on Windows.</p> Method signature type checking decorator for Python 3 (Python) 2015-05-15T09:25:08-07:00Dmitry Dvoinikovhttp://code.activestate.com/recipes/users/2475216/http://code.activestate.com/recipes/572161-method-signature-type-checking-decorator-for-pytho/ <p style="color: grey"> Python recipe 572161 by <a href="/recipes/users/2475216/">Dmitry Dvoinikov</a> (<a href="/recipes/tags/checking/">checking</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/method/">method</a>, <a href="/recipes/tags/signature/">signature</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/type/">type</a>). Revision 8. </p> <p>This recipe allows nice and clean validation for method parameters/return values. It uses function annotations available in Python 3 for the actual signature specification.</p> Pickle the interactive interpreter state (Python) 2008-05-20T10:36:50-07:00Oren Tiroshhttp://code.activestate.com/recipes/users/2033964/http://code.activestate.com/recipes/572213-pickle-the-interactive-interpreter-state/ <p style="color: grey"> Python recipe 572213 by <a href="/recipes/users/2033964/">Oren Tirosh</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 2. </p> <p>This code extends the pickle module to enable pickling of functions and classes defined interactively at the command prompt. You can save the interpreter state by pickling the __main__ module and restore it later.</p> Treat the Win32 Registry like a Python dict -- updated (again!) (Python) 2008-06-21T08:12:09-07:00Chris Melvillehttp://code.activestate.com/recipes/users/103458/http://code.activestate.com/recipes/573466-treat-the-win32-registry-like-a-python-dict-update/ <p style="color: grey"> Python recipe 573466 by <a href="/recipes/users/103458/">Chris Melville</a> (<a href="/recipes/tags/sysadmin/">sysadmin</a>). Revision 4. </p> <p>This class wraps most of the win32api functions for accessing a registry. It will read and write all win32 registry types, and will de/serialize python objects to registry keys when a string or integer representation is not possible.</p> <p>This is an update of <a href="http://code.activestate.com/recipes/551761/">recipe 551761</a>, which is in turn an update of 174627, folding in the enhancements listed in the discussion there to allow registry value types to be read and written within the dictionary metaphore if required. It doesnt change how it worked before, it adds a new capability, and shouldnt break existing code using the 551761 version.</p>