Popular recipes tagged "meta:loc=26"http://code.activestate.com/recipes/tags/meta:loc=26/2017-03-25T14:12:25-07:00ActiveState Code RecipesTkinter Notebook that fits to the height of every tab (Python) 2016-12-06T03:58:32-08:00Miguel Martínez Lópezhttp://code.activestate.com/recipes/users/4189907/http://code.activestate.com/recipes/580726-tkinter-notebook-that-fits-to-the-height-of-every-/ <p style="color: grey"> Python recipe 580726 by <a href="/recipes/users/4189907/">Miguel Martínez López</a> (<a href="/recipes/tags/notebook/">notebook</a>, <a href="/recipes/tags/tkinter/">tkinter</a>). Revision 4. </p> <p>This simple widget is a notebook that changes its height to fit the height of the selected tab.</p> <p>This recipe also answer this question: <a href="http://stackoverflow.com/questions/25675098/change-window-size-each-tab-tkinter-notebook" rel="nofollow">http://stackoverflow.com/questions/25675098/change-window-size-each-tab-tkinter-notebook</a></p> A simple Unix shell utility to save cleaned-up man pages as text (Bash) 2017-03-25T14:12:25-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580766-a-simple-unix-shell-utility-to-save-cleaned-up-man/ <p style="color: grey"> Bash recipe 580766 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/documentation/">documentation</a>, <a href="/recipes/tags/man/">man</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/utilities/">utilities</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>It's a shell script that lets you save the man pages for one or more Unix commands, system calls or other topics, to text files, after cleaning up the man command output to remove formatting meant for emphasis, printing, etc.</p> <p>More information here:</p> <p><a href="https://jugad2.blogspot.in/2017/03/m-unix-shell-utility-to-save-cleaned-up.html" rel="nofollow">https://jugad2.blogspot.in/2017/03/m-unix-shell-utility-to-save-cleaned-up.html</a></p> Simple directory list command with filename wildcard support (Python) 2016-12-02T20:52:56-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580724-simple-directory-list-command-with-filename-wildca/ <p style="color: grey"> Python recipe 580724 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/commandline/">commandline</a>, <a href="/recipes/tags/directory/">directory</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/filesystem/">filesystem</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/utilities/">utilities</a>). </p> <p>This recipe shows a simple directory listing program. It can accept multiple command-line arguments specifying filenames. These filenames can include wildcard characters like * (asterisk) and ? (question mark), as is common in OS command shells like bash (Unix) and CMD (Windows). Tested on Windows but should work on Unix too, since it uses no OS-specific functions, or rather, it does use them, but that happens under the hood, within the libraries used.</p> Create a zip bomb, for testing (Python) 2016-06-07T13:11:50-07:00Simon Harrisonhttp://code.activestate.com/recipes/users/4191738/http://code.activestate.com/recipes/580676-create-a-zip-bomb-for-testing/ <p style="color: grey"> Python recipe 580676 by <a href="/recipes/users/4191738/">Simon Harrison</a> . </p> <p>This creates a zip bomb with a programmable recursion depth. It's useful when you want to create a very deep zip archive for testing decompression software, virus scanners and so on. Recursion depth is limited by Python itself, so very high values are probably not going to work. The algorithm could be re-structured to avoid recursion, but I've never needed a nesting depth of more than 900!</p> <p>Each zip file will get the name stack&lt;n&gt;.zip where &lt;n&gt; is the number of zip files inside each layer. The data file at the core is called needle.txt.</p> Decorator for defining functions with keyword-only arguments (Python) 2015-07-10T15:25:04-07:00Oscar Byrnehttp://code.activestate.com/recipes/users/4192487/http://code.activestate.com/recipes/579079-decorator-for-defining-functions-with-keyword-only/ <p style="color: grey"> Python recipe 579079 by <a href="/recipes/users/4192487/">Oscar Byrne</a> (<a href="/recipes/tags/arguments/">arguments</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/decorators/">decorators</a>, <a href="/recipes/tags/keyword/">keyword</a>, <a href="/recipes/tags/metadecorator/">metadecorator</a>, <a href="/recipes/tags/positional/">positional</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/python3/">python3</a>). Revision 2. </p> <p>Python2.x implementation of python3's keyword-only arguments (aka arguments that must be specified as keywords, and are not automatically filled in by positional arguments - see PEP 3102).</p> embedded ssl (Perl) 2015-07-17T01:39:05-07:00Roger Mbiama Assogohttp://code.activestate.com/recipes/users/4178746/http://code.activestate.com/recipes/579083-embedded-ssl/ <p style="color: grey"> Perl recipe 579083 by <a href="/recipes/users/4178746/">Roger Mbiama Assogo</a> (<a href="/recipes/tags/root/">root</a>). </p> <p>"This module is a true drop-in replacement for IO::Socket::INET that \ uses SSL to encrypt data before it is transferred to a remote server \ or client. IO::Socket::SSL supports all the extra features that one \ needs to write a full-featured SSL client or server application: \ multiple SSL contexts, cipher selection, certificate verification, and \ SSL version selection. As an extra bonus, it works perfectly with \ mod_perl."</p> Stopwatch in 26 lines (Tcl) 2014-09-05T13:33:13-07:00Mike Manilonehttp://code.activestate.com/recipes/users/4190728/http://code.activestate.com/recipes/578927-stopwatch-in-26-lines/ <p style="color: grey"> Tcl recipe 578927 by <a href="/recipes/users/4190728/">Mike Manilone</a> (<a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/time/">time</a>). </p> <p>This stopwatch works on Tcl/Tk 8.5 and higher. It makes use of the [clock] command and reduced the amount of code by -textvariable. A simple one, indeed. Nevertheless, it is still easy-to-read and easy-to-understand and it does show the power that Tcl has.</p> A DEMO to show how to write text into the Python terminal Title Bar... (Python) 2013-09-17T17:55:53-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578662-a-demo-to-show-how-to-write-text-into-the-python-t/ <p style="color: grey"> Python recipe 578662 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bar/">bar</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/title/">title</a>, <a href="/recipes/tags/title_bar/">title_bar</a>). </p> <p>This DEMO is show how to write some text of your choice into the Title Bar of the Python terminal window.</p> <p>Firstly it imports "time" just for this demo so that a simple time delay can be generated. Next the Python terminal window is written to for the 5 seconds of delay; see code. And finally the Title Bar is restored to normal...</p> <p>A snapshot image can be seen here:-</p> <p><a href="http://wisecracker.host22.com/public/Title_Bar.jpg" rel="nofollow">http://wisecracker.host22.com/public/Title_Bar.jpg</a></p> <p>Bazza...</p> Brute Force Break Caesar Cipher in Python (Python) 2013-06-03T17:54:16-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578546-brute-force-break-caesar-cipher-in-python/ <p style="color: grey"> Python recipe 578546 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/bruteforce/">bruteforce</a>, <a href="/recipes/tags/cipher/">cipher</a>, <a href="/recipes/tags/decryption/">decryption</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>This script was written for an article I wrote it generates all the combinations possible for brute force breaking a Caesar Cipher. For more information <a href="http://thelivingpearl.com/2013/06/03/caesar-ciphers-in-python/">Caesar Ciphers In Python</a></p> Simple Morse Code Translator in Python (Python) 2013-01-08T18:02:46-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578407-simple-morse-code-translator-in-python/ <p style="color: grey"> Python recipe 578407 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/morse_code/">morse_code</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>This is a basic Morse Code Generator in python. I wrote it for an article I put together <a href="http://thelivingpearl.com/2013/01/08/morse-code-and-dictionaries-in-python-with-sound/">Morse Code and Dictionaries in Python</a></p> A SOX 1KHz Sinewave Generator Using A Windows, (TM), Batch File... (Batch) 2013-05-02T17:48:18-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578516-a-sox-1khz-sinewave-generator-using-a-windows-tm-b/ <p style="color: grey"> Batch recipe 578516 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/sound_exchange/">sound_exchange</a>, <a href="/recipes/tags/sox/">sox</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>32 bit Windows to Windows 7...</p> <p>This batch file generates a 65536 byte binary file to give 8 seconds of pure sinewave at the earphone/speaker output(s)...</p> <p>It uses ONLY a default Windows 32 bit installation, to Windows 7, except for the installation of SOX...</p> <p>Obtain SOX from here:-</p> <p><a href="http://sox.sourceforge.net/" rel="nofollow">http://sox.sourceforge.net/</a></p> <p>Notepad was the _main_ editor... ;o)</p> <p>Hopefully the code section does NOT corrupt the binary part which is 8 bytes in size. If it does then let me know on here and I will post a pointer from where to grab it...</p> <p>Enjoy...</p> Appending Encrypted Username and Passwords to a File (Python) 2013-01-31T02:08:20-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578444-appending-encrypted-username-and-passwords-to-a-fi/ <p style="color: grey"> Python recipe 578444 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/encryption/">encryption</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>This script was written for an article I wrote to check user passwords. It stores data using SHA one-way function. For more information <a href="http://thelivingpearl.com/2013/01/29/authentication-of-users-and-passwords-in-python/">Authentication Of Users And Passwords In Python</a></p> Simple Script to Ask the User for a Password x Times (Python) 2013-01-19T04:05:41-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578428-simple-script-to-ask-the-user-for-a-password-x-tim/ <p style="color: grey"> Python recipe 578428 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/password/">password</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>This snippet of code was written as part of an article - <a href="http://thelivingpearl.com/2013/01/18/password-protecting-your-python-application/">Password Protecting You Python Application</a></p> Generate and Rank Passwords in Python (Python) 2013-01-02T14:30:47-08:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578396-generate-and-rank-passwords-in-python/ <p style="color: grey"> Python recipe 578396 by <a href="/recipes/users/4184772/">Captain DeadBones</a> (<a href="/recipes/tags/passwords/">passwords</a>, <a href="/recipes/tags/password_generator/">password_generator</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>See <a href="http://thelivingpearl.com/2013/01/02/generating-and-checking-passwords-in-python/">generating and checking passwords</a> for more information. </p> Countdown Timer (Python) 2012-12-06T03:24:35-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578363-countdown-timer/ <p style="color: grey"> Python recipe 578363 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/timer/">timer</a>, <a href="/recipes/tags/utility/">utility</a>). </p> <p>Ever wanted to set a timer that went off after a specified number of hours / minutes / seconds? This Windows recipe runs on the command line and does that with the arguments it accepts. Simple but effective, the program works well for remembering food in the oven among other things.</p> Unix tail -n analog (Batch) 2013-10-12T17:35:59-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578311-unix-tail-n-analog/ <p style="color: grey"> Batch recipe 578311 by <a href="/recipes/users/4184115/">greg zakharov</a> (<a href="/recipes/tags/tail/">tail</a>). Revision 4. </p> <p>Sometime it need to access last n strings in text file, right? Of course you can use third party tools for this purpose (such as tail from Win 2k3 Resource Kit) but how about to create it by yourself? For example:</p> Pi Circle (Python) 2012-05-13T04:35:46-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578130-pi-circle/ <p style="color: grey"> Python recipe 578130 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/art/">art</a>, <a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/fun/">fun</a>, <a href="/recipes/tags/pi/">pi</a>). Revision 5. </p> <p>Computes Pi to many decimal places and prints the digits in a circle.</p> Determinant of matrix of any order (Python) 2012-04-24T10:49:00-07:00Sachin Joglekarhttp://code.activestate.com/recipes/users/4181845/http://code.activestate.com/recipes/578108-determinant-of-matrix-of-any-order/ <p style="color: grey"> Python recipe 578108 by <a href="/recipes/users/4181845/">Sachin Joglekar</a> (<a href="/recipes/tags/algebra/">algebra</a>, <a href="/recipes/tags/determinant/">determinant</a>, <a href="/recipes/tags/matrix/">matrix</a>, <a href="/recipes/tags/order/">order</a>). </p> <p>A small snipet of code to find the determinant of a mtrix of any order.Input must be a list like [[1,2,3],[4,5,6],[7,8,9]] (for a matrix of order 3). Works fine.</p> Pure Fun For Text Mode Python... (Python) 2012-04-02T21:30:18-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578079-pure-fun-for-text-mode-python/ <p style="color: grey"> Python recipe 578079 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>). Revision 2. </p> <p>Printing to the screen with a difference. ;oD</p> <p>Works on almost any version of Python running in a terminal inside Linux.</p> <p>(C)2012, B.Walker, G0LCU...</p> Comparing two images (Python) 2011-04-03T11:13:24-07:00Charlie Clarkhttp://code.activestate.com/recipes/users/4171013/http://code.activestate.com/recipes/577630-comparing-two-images/ <p style="color: grey"> Python recipe 577630 by <a href="/recipes/users/4171013/">Charlie Clark</a> (<a href="/recipes/tags/compare/">compare</a>, <a href="/recipes/tags/images/">images</a>). </p> <p>Compare two images using the root mean squared analysis. A result close to 0 means a good match.</p>