Top-rated recipes tagged "apple"http://code.activestate.com/recipes/tags/apple/top/2017-05-13T12:12:30-07:00ActiveState Code RecipesA 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> A DEMO To Show How To Expand A Standard Python Terminal On The Fly... (Python) 2012-12-17T12:47:14-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578383-a-demo-to-show-how-to-expand-a-standard-python-ter/ <p style="color: grey"> Python recipe 578383 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/campimeter/">campimeter</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/size/">size</a>, <a href="/recipes/tags/terminal/">terminal</a>, <a href="/recipes/tags/window/">window</a>). </p> <p>This code shows how to open up a default Terminal running Python to tha maximum allowed on the _desktop_. I decided on writing code to do a crude emulation of a Campimeter. Anyone who has worn spectacles for a long time has had this test done at the optician's. Originally written for a Macbook Pro, OSX 10.7.5 but also tested on Debian Linux 6.0.x. READ the code for more information!!! This code WILL alter the size of the Terminal window AND changes the colours too, although it is very easy to return back to the default state it is NOT included in the code... I EXPECT professionals to know how to doo that.</p> <p>Before running Python inside the Terminal ensure the Terminal window is at the uppermost left hand corner of your desktop...</p> <p>I needed the maximised Python Terminal for something else but this was the easiest way to demonstrate ho to do it through Python...</p> <p>Written so that kids can understand what is going on...</p> <p>Enjoy finding simple solutions to often very difficult problems... ;o)</p> <p>Bazza, G0LCU...</p> A white noise generator to sooth baby to sleep. (Bash) 2017-05-13T12:12:30-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/580801-a-white-noise-generator-to-sooth-baby-to-sleep/ <p style="color: grey"> Bash recipe 580801 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/alarm/">alarm</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/baby_alarm/">baby_alarm</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/noise/">noise</a>, <a href="/recipes/tags/sleep/">sleep</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/whitenoise/">whitenoise</a>). </p> <p>This is a simple BASH, DASH and SH script to sooth a newborn baby to sleep for a laptop with a builtin mic. Develeoped around an Apple MacBook Pro.</p> <p>Usage:- [./]shush.sh &lt;time in seconds from 18 to 2700&gt; [sensitivity [Hh|Mm|Ll]]&lt;CR&gt;</p> <p>If time is omitted it defaults to 2 bursts of 9 seconds each and if sensitivity is omitted defaults to [M]edium.</p> <p>It uses Quicktime Player for Apple OSX 10.12.4 minimum /dev/dsp for CygWin and some Linux flavours and arecored for Linux ALSA machines for baby awake detector.</p> <p>Upon the two arguments the white noise generator runs for approximately the time given in $1 in bursts of 9 seconds until the time limit is reached. $2 is used to detect of baby is awake and reruns the noise generator again with a new noise waveform.</p> <p>Enjoy...</p> A pseudo-echo, (or printf), function for any Python version. (Python) 2017-01-20T22:17:23-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/580750-a-pseudo-echo-or-printf-function-for-any-python-ve/ <p style="color: grey"> Python recipe 580750 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/echo/">echo</a>, <a href="/recipes/tags/fs_uae/">fs_uae</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/printf/">printf</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>A simple example of having a pseudo-echo using sys.stdout.write...</p> <p>This gives exactly the same results from Python Versions, 1.4.0, 2.0.1, 2.5.6, 2.6.9, 3.4.3 and 3.5.2 on various platforms including the classic AMIGA A1200.</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza.</p> A simple raw hexdumper. (Python) 2016-09-19T13:24:37-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/580697-a-simple-raw-hexdumper/ <p style="color: grey"> Python recipe 580697 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/fs_uae/">fs_uae</a>, <a href="/recipes/tags/hex/">hex</a>, <a href="/recipes/tags/hexdump/">hexdump</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/raw_hexdump/">raw_hexdump</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>This is not a hexreader. This code creates a raw hexdump of a binary file that is whitespace, optional, delimited. The dump is saved into the current directory with a ".hex" extension.</p> <p>It works on just about any current platform but is designed around a stock Amiga A1200(HD) with Python 1.4.0. It also works on the current stable version 3.5.2.</p> <p>I needed a hexdump some years ago for banging the Amiga hardware, and decided to modify recently for another usage but it had to still work on version 1.4.0 for the classic A1200.</p> <p>Enjoy...</p> A simple shell script to keep the wife off of your back... (Bash) 2013-12-09T20:05:49-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578781-a-simple-shell-script-to-keep-the-wife-off-of-your/ <p style="color: grey"> Bash recipe 578781 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/reminder/">reminder</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>). </p> <p>How many times have you been asked to remember to do something from the other half whilst she is out for a short while.</p> <p>For example: "You WILL check the dinner every few minutes won't you?"</p> <p>And how many times did/do you forget?</p> <p>Most of us have been there...</p> <p>This is a simple kids level, practical learning, shell script that generates an "xterm" with your reminder inside every 30 seconds for a period of 3 seconds.</p> <p>It is always be the active front window for 3 seconds at a time to _annoy_ you into remembering.</p> <p>Usage: reminder "What you have to remember here using spaces AND double quotes."&lt;CR&gt;</p> <p>Just reanme the downloaded script to reminder and remember to chmod it as required.</p> <p>Just run it from your default terminal and when finished press Ctrl-C just AFTER the xterm window closes.</p> <p>There is NO error detection so steer clear of any special characters in you reminder text.</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> Colo(u)rs Inside Text Mode Python... (Python) 2012-08-21T21:01:57-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578101-colours-inside-text-mode-python/ <p style="color: grey"> Python recipe 578101 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>). Revision 2. </p> <p>A simple DEMO to show how to enhance Python inside a Terminal. This works on Classic AMIGAs, E-UAE, Debian Linux 6.0.0, PCLinuxOS 2009, Windows XP and Vista and WinUAE, from Python 1.4.0 to 3.3A2.</p> <p>Due to a complaint about my _fun_ upload recently I decided to post this so that the MANY can now find out how to manipulate text inside a Python Terminal window so that it looks much better.</p> <p>Read the code for more information...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</p> Obfuscation In Bash Shell. (Bash) 2014-12-19T20:01:30-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578986-obfuscation-in-bash-shell/ <p style="color: grey"> Bash recipe 578986 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/obfuscation/">obfuscation</a>). </p> <p>IMO, the immense power of the shell...</p> <p>Please let me know if there is any other human readable language that can do this...</p> <p>The DEMO code below was an idea I formed to see how to make a bash script very difficult to hack.</p> <p>Everything in it is made easy to read so as to see this idea working.</p> <p>It uses bash variables ONLY and although I have used bash loops to create the variables in this DEMO you could create your own set of variables and 'source' them to the the obfuscated code before running the main body of the code.</p> <p>It also goes without saying that you could obfuscate the changing of any or all the variable allocations at any time AFTER the code runs to make it even more obfuscated and as may times as you wish...</p> <p>I would be seriously difficult to actually write a lsrge bash app' using this method but boy oh boy would it be fun?!?</p> <p>Testbed:- Macbook Pro, OSX 10.7.x and above, using default bash terminal...</p> <p>LBNL, yeah I am aware of 'eval' but as it is obfuscated and can have as many obfuscated variables as I wish allocated to it then why worry... ;o)</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</p> A Function To Create A 1 Second Sinewave WAVE Beep File. (Python) 2014-11-23T19:24:46-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578971-a-function-to-create-a-1-second-sinewave-wave-beep/ <p style="color: grey"> Python recipe 578971 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/amiga/">amiga</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/beep/">beep</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/e_uae/">e_uae</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/sinewave/">sinewave</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/wav/">wav</a>, <a href="/recipes/tags/wave/">wave</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/winuae/">winuae</a>). </p> <p>sinebeep.py</p> <p>Creating an audio file called...</p> <p>beep.wav</p> <p>...that can be played using almost ANY audio player available.</p> <p>This simple snippet of code generates a 1 second sinewave WAVE file. It IS saved inside the CURRENT drawer so that you can find it... ;o)</p> <p>This works on:- Classic stock AMIGA A1200, using Python 1.4.0. WinUAE and E-UAE, AmigaOS 3.0.x using Python 1.4.0 to 2.0.1. Windows, to at least 7, using Python 2.0.1 to 3.3.2. Various Linux flavours using Python 2.4.6 to 3.2.2. Apple OSX 10.7.x and above using Python 2.5.6 to 3.4.1.</p> <p>The file size is 8044 bytes and _IF_ you need to it can be palyed directly without a player on some Linux flavours that have the /dev/dsp device. It is an 8 bit, unsigned integer, mono, 8000Hz sampling speed 8000 byte RAW file with the WAVE header added.</p> <p>It will still work with PulseAudio and OSS using...</p> <p>cat /full/path/to/beep.wav &gt; /dev/dsp</p> <p>...but with a momenatry click due to the 44 header bytes; but hey it is a beep alternative...</p> <p>Enjoy finding simple solutions to often very difficult problems.</p> <p>Bazza.</p> Not Quite So Simple QuickTime Player, Python Audio Capture. (Python) 2014-11-08T19:10:58-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578960-not-quite-so-simple-quicktime-player-python-audio-/ <p style="color: grey"> Python recipe 578960 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/audio_capture/">audio_capture</a>, <a href="/recipes/tags/capture/">capture</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/maccbook_pro/">maccbook_pro</a>, <a href="/recipes/tags/sample/">sample</a>, <a href="/recipes/tags/signal_capture/">signal_capture</a>). </p> <p>Not Quite So Simple QuickTime Player, Python Audio Capture.</p> <p>This DEMO code captures a function to generate a user 5 second Audio sample in Apple *.aifc format. It is then converted to DC quailty *.WAV format.</p> <p>It uses default shell system files to do the task.</p> <p>An AppleScript is created to do the sample but due to the limitations of QT Player there is a 1.5 second delay to allow QuickTine Player to start up. It is not entirely quiet but unobtrusive enough as to be like quiet mode...</p> <p>This is again a means a signal capture for an AudioScope without the need for special tools or installs.</p> <p>Read the code for more information.</p> <p>IMPORTANT!!! This DEMO WILL delete all *.aifc files inside the default $HOME/Movies directory, so be aware.</p> <p>A simple ALSA one is on its way too...</p> <p>It actually works on Python 3.4.1 but I have no idea if it works below Python 2.5.6...</p> <p>Bazza...</p> Simple Bash Text Mode Sine Curve Generator. (Bash) 2014-08-12T20:57:39-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578921-simple-bash-text-mode-sine-curve-generator/ <p style="color: grey"> Bash recipe 578921 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/text/">text</a>). Revision 2. </p> <p>This bash script is a taster for a kids level, audio, text mode, sweep generator. The code just creates a single cycle of a quantised sine curve inside an 80 x 24 bash terminal. This will be the calculator for a sinewave sweep generator from about 50Hz the 12KHz... The code tells you more and the display is in comments at the end...</p> A Bash Beep Command For OSX 10.7+... (Bash) 2014-02-27T19:36:17-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578837-a-bash-beep-command-for-osx-107/ <p style="color: grey"> Bash recipe 578837 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/beep/">beep</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/sound/">sound</a>). </p> <p>This small bash script generates an 8044 byte 1KHz sinewave wave file and immediately plays it. The file created is a _pure_ sinewave and lasts for 1 second. It uses the default "afplay" command to run the generated file.</p> <p>It was designed around an Apple Macbook Pro but using "aplay" it might even work on other *nix flavours from the command line. I have not bothered to try it as this was purely for my MB Pro.</p> <p>The wave file can be found as "/tmp/sinewave.wav" during the working session(s) and can be saved anywhere of your choice.</p> <p>Enjoy...</p> <p>(Watch for word wrapping etc...)</p> <p>Bazza.</p> Simple Text Mode Digital Oscilloscope Graphics DEMO. (Python) 2014-01-21T19:07:49-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578812-simple-text-mode-digital-oscilloscope-graphics-dem/ <p style="color: grey"> Python recipe 578812 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/graphics/">graphics</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>). </p> <p>This is a DEMO to switch a *NIX terminal from text to _graphics_ mode on the fly.</p> <p>The graphics characters are limited to lowercase 'a' through 'z' and this DEMO just prints a small subset to see what a fun, kids level, 8 channel Logic-Analyser/Digital-Oscilloscope might look like.</p> <p>This may not work in every *NIX style terminal but does work on default terminals using bash on OSX 10.7.5, PCLinuxOS 2009 and Debian Linux 6.0.x.</p> <p>Tested on Python 2.5.x to 3.3.2 on the above platforms... (It might work on earlier versions of Python but untested.)</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</p> Pseudo-3D effect in text mode... (Bash) 2013-09-10T21:23:58-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578655-pseudo-3d-effect-in-text-mode/ <p style="color: grey"> Bash recipe 578655 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/text/">text</a>). </p> <p>This is just a simple DEMO to display a pseudo-3D effect using a bash script. It generates a recessed box and a button and writes some thext inside bot.</p> <p>There are two pieces of code, one for Linux, and one for OSX 10.7.5...</p> <p>The Linux version also works on OSX 10.7.5 but is harder to see so a near identical version using the default OSX terminal colours was craeted instead.</p> <p>You will have to split the two code pieces up yourself to run...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza...</p> A Simple Clock, Well Maybe Not That Simple... (Bash) 2013-07-17T17:40:18-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578610-a-simple-clock-well-maybe-not-that-simple/ <p style="color: grey"> Bash recipe 578610 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/clock/">clock</a>, <a href="/recipes/tags/digital/">digital</a>, <a href="/recipes/tags/digits/">digits</a>, <a href="/recipes/tags/display/">display</a>, <a href="/recipes/tags/large/">large</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/readout/">readout</a>, <a href="/recipes/tags/terminal/">terminal</a>). </p> <p>Hi all...</p> <p>Do you remember this little snippet?</p> <p><a href="http://code.activestate.com/recipes/578079-pure-fun-for-text-mode-python/?in=user-4177147" rel="nofollow">http://code.activestate.com/recipes/578079-pure-fun-for-text-mode-python/?in=user-4177147</a></p> <p>Well it was voted down, but who cares? I surely don't! So to those that voted this FUN piece of Python coding down, you are now about to see what the aim was.</p> <p>However although I have subsequently done what I said I would, that is, to create large digits as an _at_a_glance_ digital readout for a project in Python I have decided not to upload it. However I have decided to let this one go as a bash/shell script instead.</p> <p>It is a nothing but a simple clock, well, maybe not that simple; but as I am into shell stuff at the moment I thought I would share this with you.</p> <p>The terminal does have its colours changed and the cursor disabled for the session but I expect you big guns to be able to return back to normal in a jiffy.</p> <p>I am an amateur coder and if that is easy for me then you pros should have no problems.</p> <p>This code is not like most of my other stuff as is NOT Public Domain...</p> <p>It is only a DEMO to see what an at a glance display would look like in a terminal.</p> <p>Move away to a distance and see which of the two time readings you can still read... ;o)</p> <p>It is for a Macbook Pro 13" OSX 10.7.5 and uses bash imode. It will probably work on most Linux machines too but I haven't tested it...</p> <p>This is purely a DEMO only and any other special effects, (e.g. flashing colon every second), alram, etc, I have already experimented with and is easy enough to do...</p> <p>My intention is to use this as a kids level text mode digital voltmeter I am doing.</p> <p>Enjoy...</p> <p>Bazza...</p> A FUN Bash Shell Bomb-Out Error Sound... (Bash) 2013-07-14T19:31:13-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578605-a-fun-bash-shell-bomb-out-error-sound/ <p style="color: grey"> Bash recipe 578605 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/audio/">audio</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/error_beep/">error_beep</a>, <a href="/recipes/tags/error_sound/">error_sound</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/sound_exchange/">sound_exchange</a>, <a href="/recipes/tags/sox/">sox</a>). </p> <p>Do you remember the Bomb-Out icon(s) that appeared on some computers' SW and HW many years ago...</p> <p>Well this is a matching sound to go with it and can be used as a critical error sound.</p> <p>It sounds like a bomb being dropped from an aeroplane and is purely a shell sript only.</p> <p>It is set up to run SOund eXchange, SOX, but just by editing the code "/dev/dsp" can be used instead.</p> <p>Read the code for more informastion.</p> <p>Enjoy...</p> <p>Bazza...</p> DEMO Kids Level Python RF Attenuator... (Python) 2013-02-09T10:21:39-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578451-demo-kids-level-python-rf-attenuator/ <p style="color: grey"> Python recipe 578451 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/attenuator/">attenuator</a>, <a href="/recipes/tags/audio/">audio</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/rf/">rf</a>, <a href="/recipes/tags/sound/">sound</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>This code is a DEMO RF Attenuator for SW listeners.</p> <p>(The code is to show how to generate the same waveform in each channel but in antiphase, as bridge output. The RF Attenuator is just a byproduct...)</p> <p>The circuit has an insertion loss of about 10dB at full gain but that doesn't matter as it IS an attenuator after all.</p> <p>It is another learning tool for kids to build and code for themselves.</p> <p>The only common user I/O on desktops, netbooks, laptops and current MacBooks is/are the Audio Mic and Ear sockets...</p> <p>This goes for "mobiles" too...</p> <p>The circuit inside the code is so easy a 10 year old could have a working unit inisde 2 hours to experiment with...</p> <p>PyAudio IS needed for this to work and although originally designed around a MacBook Pro 13 inch OSX 10.7.5 and Python 2.6.7 has shown itself to be near platform independent...</p> <p>Read the code for much more information...</p> <p>Enjoy finding simple solutions to often very difficult problems... ;o)</p> <p>Bazza, G0LCU...</p> A Building Block, Bash Binary File Manipulation... (Bash) 2013-01-29T22:07:57-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578441-a-building-block-bash-binary-file-manipulation/ <p style="color: grey"> Bash recipe 578441 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/shell/">shell</a>). Revision 2. </p> <p>Apologies for any typos, and IF this has been done before...</p> <p>The code generates a 256 byte binary file of _characters_ 0x00 to 0xFF for general usage and generates another binary file manipulated in a basic way.</p> <p>The for loops in the code are purely for DEMO purposes only.</p> <p>This is Public Domain and you may do with it as you please. I have uploaded it elsewhere too...</p> <p>Watch for wordwrapping, etc and read the code for more information...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza, G0LCU...</p> Colour Bar And Greyscale Generator For Standard Text Mode Python. (Python) 2013-01-18T21:08:21-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578425-colour-bar-and-greyscale-generator-for-standard-te/ <p style="color: grey"> Python recipe 578425 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/color/">color</a>, <a href="/recipes/tags/colour/">colour</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/gray/">gray</a>, <a href="/recipes/tags/grey/">grey</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/scale/">scale</a>). </p> <p>This is just a simple colour bar and combined greyscale generator for standard text mode Python...</p> <p>It relies on the _magic_ of the ANSI Escape sequences to work and does mess with the terminal colours but restores the colours back to the defaults...</p> <p>See the code for the machines tested on. It might need the colours adjusting for some terminals but I am sure that is not beyond the average coder...</p> <p>Written so that anyone can see how it works.</p> <p>To hide the cursor the command "tput" is assumed to be available, if not, try "setterm -cursor off" and "setterm -cursor on" instead...</p> <p>Enjoy...</p> <p>Bazza, G0LCU...</p> A Shell, Binary To Hexadecimal To Decimal Demo... (Bash) 2013-01-11T18:31:03-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578413-a-shell-binary-to-hexadecimal-to-decimal-demo/ <p style="color: grey"> Bash recipe 578413 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/binary/">binary</a>, <a href="/recipes/tags/decimal/">decimal</a>, <a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/hexadecimal/">hexadecimal</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/terminal/">terminal</a>). </p> <p>This little DEMO may be common knowledge to the big guns but not to amateurs like myself, so......</p> <p>This is an Apple Macbbok Shell/Terminal DEMO shell script to show how to:-</p> <p>1) Create a binary file... 2) Save it to your DEFAULT /directory/drwawer/folder/... 3) Display a hexadecimal dump of said binary file to prove that it is binary... 4) Select a single BYTE of that file and save it as an ASCII text decimal _number_, also to your DEFAULT /directory/drawer/folder/... 5) Read this ASCII text decimal number back in again... 6) Add this string representation to a number... 7) Stop...</p> <p>It was intended purely for OSX 10.7.5 and above using the default terminal and shell...</p> <p>It does work on many Linux flavours and shells/terminals also however.</p> <p>Written so the anyone can understand what is going on.</p> <p>The two files generated and saved in this DEMO to your DEFAULT /directory/drawer/folder/ are:-</p> <p>BinaryString.dat BinaryString.txt</p> <p>This WILL lead to something very unusual in the not too distant future...</p> <p>This is Public Domain and you may do with it as you wish...</p> <p>Enjoy finding simple solutions to often very difficult problems...</p> <p>Bazza, G0LCU...</p>