Popular recipes tagged "system"http://code.activestate.com/recipes/tags/system/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> Finding the sizes of various Python data types (Python) 2016-04-28T18:28:59-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580655-finding-the-sizes-of-various-python-data-types/ <p style="color: grey"> Python recipe 580655 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/data/">data</a>, <a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/memory/">memory</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/type/">type</a>). </p> <p>This recipe shows how to find the sizes of various common data types in Python, both built-in and user-defined. It uses the sys.getsizeof() function and also discusses a few other points of interest.</p> Recursive Multimedia (audio, video) M3U Playlist Generator (Python) 2014-02-08T01:03:36-08:00Mano Bastardohttp://code.activestate.com/recipes/users/4182040/http://code.activestate.com/recipes/578771-recursive-multimedia-audio-video-m3u-playlist-gene/ <p style="color: grey"> Python recipe 578771 by <a href="/recipes/users/4182040/">Mano Bastardo</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/ffmpeg/">ffmpeg</a>, <a href="/recipes/tags/generate/">generate</a>, <a href="/recipes/tags/m3u/">m3u</a>, <a href="/recipes/tags/mulitmedia/">mulitmedia</a>, <a href="/recipes/tags/os/">os</a>, <a href="/recipes/tags/playlist/">playlist</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/video/">video</a>). Revision 9. </p> <p>Generate an m3u playlist searching recursively for multimedia files (video or audio) in the given directory. Information from ID3 tags will be extracted for audio files with <a href="http://en.wikipedia.org/wiki/FFmpeg">FFmpeg</a> available.</p> Windows directory walk using ctypes (Python) 2013-08-09T00:17:00-07:00Shao-chuan Wanghttp://code.activestate.com/recipes/users/4168519/http://code.activestate.com/recipes/578629-windows-directory-walk-using-ctypes/ <p style="color: grey"> Python recipe 578629 by <a href="/recipes/users/4168519/">Shao-chuan Wang</a> (<a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/system/">system</a>). </p> <p>Windows shell/explorer has a limit size of full path, but both NTFS and ReFS can support full path longer than the limit; this is making os.walk on Windows bad if files are in deeply nested folders, and therefore this recipe.</p> System Authentication against /etc/shadow or /etc/passwd (Python) 2013-03-11T12:40:10-07:00James Millshttp://code.activestate.com/recipes/users/4167757/http://code.activestate.com/recipes/578489-system-authentication-against-etcshadow-or-etcpass/ <p style="color: grey"> Python recipe 578489 by <a href="/recipes/users/4167757/">James Mills</a> (<a href="/recipes/tags/authentication/">authentication</a>, <a href="/recipes/tags/password/">password</a>, <a href="/recipes/tags/system/">system</a>). </p> <p>Sometimes it's useful to perform System Authentication against a Local System using the /etc/shadow or /etc/passwd password databases. This recipe provides a simple function that does exactly that.</p> Windows Event Log Viewer (Python) 2010-12-12T06:40:35-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577499-windows-event-log-viewer/ <p style="color: grey"> Python recipe 577499 by <a href="/recipes/users/4172570/">FB36</a> (<a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>Windows Event Log Viewer</p> Fnct.D, comprehensive Bash-shell coding scheme. (Bash) 2010-11-01T00:29:09-07:00Patrick Riendeauhttp://code.activestate.com/recipes/users/4175653/http://code.activestate.com/recipes/577446-fnctd-comprehensive-bash-shell-coding-scheme/ <p style="color: grey"> Bash recipe 577446 by <a href="/recipes/users/4175653/">Patrick Riendeau</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/oriented/">oriented</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/system/">system</a>). </p> <p>A Bash compromising shell-module to pre-introduce object-oriented Bash-code.</p> Win Services helper (Python) 2014-09-06T10:35:54-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/551780-win-services-helper/ <p style="color: grey"> Python recipe 551780 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/services/">services</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 4. </p> <p>A simple way to implement Windows Service.</p> Accessing DCOP services (Python) 2009-08-13T07:18:47-07:00Yuce Tekolhttp://code.activestate.com/recipes/users/2933766/http://code.activestate.com/recipes/576878-accessing-dcop-services/ <p style="color: grey"> Python recipe 576878 by <a href="/recipes/users/2933766/">Yuce Tekol</a> (<a href="/recipes/tags/dcop/">dcop</a>, <a href="/recipes/tags/interprocess_communication/">interprocess_communication</a>, <a href="/recipes/tags/kde/">kde</a>, <a href="/recipes/tags/system/">system</a>). Revision 2. </p> <p>This recipe shows how to interact with DCOP services using Python.</p> High level inotify wrapper (Python) 2008-09-21T05:17:23-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/576377-high-level-inotify-wrapper/ <p style="color: grey"> Python recipe 576377 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/inotify/">inotify</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/system/">system</a>). Revision 4. </p> <p>This is an exemple to show how to use the inotify module, it could be very usefull unchanged though.</p> <p>A Watcher instance let you define callbacks for any event that occur on any file or directory and subdirectories.</p> <p>The inotify module is from <a href="http://code.activestate.com/recipes/576375/">Recipe 576375</a></p> Multithreaded FIFO Gate (Python) 2008-09-08T08:29:14-07:00Anandhttp://code.activestate.com/recipes/users/760763/http://code.activestate.com/recipes/576418-multithreaded-fifo-gate/ <p style="color: grey"> Python recipe 576418 by <a href="/recipes/users/760763/">Anand</a> (<a href="/recipes/tags/semaphores/">semaphores</a>, <a href="/recipes/tags/synchronization/">synchronization</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/threading/">threading</a>). Revision 5. </p> <p>While programming with multiple threads, sometimes one needs a construct which allows to suspend the execution of a set of running threads. This is normally required by an outside thread which wants to suspend the running threads for performing a specific action. The threads need to resume after the action in the same order in which they got suspended. </p> <p>A thread gate (or gateway) allows you to do this. It acts like a gate through which only one thread can pass at a time. By default the gate is open, allowing all threads to "enter" the gate. When a thread calls "close", the gate is closed, blocking any threads which make a further call to "enter", till the gate is re-opened by the owner, whence the threads resume the order in which they got blocked.</p> <p>The real-life parallel for this is a human operated level cross, which allows only one vehicle to pass at a time.</p> Low level inotify wrapper (Python) 2013-08-12T14:39:57-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/ <p style="color: grey"> Python recipe 576375 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/ctypes/">ctypes</a>, <a href="/recipes/tags/inotify/">inotify</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/system/">system</a>). Revision 10. </p> <p>This module is meant to be as simple and straightforward as it gets.</p> Handling ANSI Terminal. (Python) 2010-02-09T05:51:23-08:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/574451-handling-ansi-terminal/ <p style="color: grey"> Python recipe 574451 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/ansi/">ansi</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/terminal/">terminal</a>). Revision 9. </p> <p>This function can be used, with or instead of print, to get <a href="http://en.wikipedia.org/wiki/ANSI_escape_code">ANSI</a> output.</p> Listing the package/patches dependencies of a binary on Solaris (Python) 2008-07-30T04:30:44-07:00Benjamin Sergeanthttp://code.activestate.com/recipes/users/4039626/http://code.activestate.com/recipes/576397-listing-the-packagepatches-dependencies-of-a-binar/ <p style="color: grey"> Python recipe 576397 by <a href="/recipes/users/4039626/">Benjamin Sergeant</a> (<a href="/recipes/tags/solaris/">solaris</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/unix/">unix</a>). Revision 2. </p> <p>Print (1) packages used by a binary, and (2) the list of installed patches related to these packages. If you have a binary that works with Solaris 10 update N, but doesn't with Solaris 10 update N-2, run this script on both platform and it will help you to find the patches you're looking for.</p> <p>(1) is retrieved:</p> <ul> <li>By using pldd(pid) on the process you want to trace to get a list of loaded shared library </li> <li>By retrieving in the main /var/sadm/install/contents database the list of package related to these shared libraries</li> </ul> <p>(2) is retrieved by parsing the output of the showrev -p command, given as input of this script</p> Win Registry module (Python) 2010-07-20T14:30:04-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/502268-win-registry-module/ <p style="color: grey"> Python recipe 502268 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/registry/">registry</a>, <a href="/recipes/tags/system/">system</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 5. </p> <p>_winreg module wrapper. Provides easy access, walking and creation/modification of keys and values. Tested with Win98 and XP (admin)</p>