Top-rated Bash recipes tagged "macbook_pro"http://code.activestate.com/recipes/langs/bash/tags/macbook_pro/top/2014-12-19T20:01:30-08:00ActiveState Code RecipesA 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> 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 Fun Perfect Square Checker Using Integer Arithmetic Only... ;o) (Bash) 2014-09-16T22:27:04-07:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578934-a-fun-perfect-square-checker-using-integer-arithme/ <p style="color: grey"> Bash recipe 578934 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/arithmetic/">arithmetic</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/check/">check</a>, <a href="/recipes/tags/checker/">checker</a>, <a href="/recipes/tags/cygwin/">cygwin</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/perfect/">perfect</a>, <a href="/recipes/tags/root/">root</a>, <a href="/recipes/tags/square/">square</a>). </p> <p>A recent Python upload here gave me the inspiration to do a bash version... This is a little tongue-in-cheek but an enjoyable bit of fun.</p> <p>It took around 11 seconds to prove 90000000000 had a perfect square of 300000...</p> <p>It is a stand alone program and has a degree of INPUT error correction...</p> <p>It was done on a MacBook Pro, OSX 10.7.5, default bash terminal and should work on Linux flavours but it is untested...</p> <p>Enjoy finding simple solutions to often very difficult problems...</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> 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> 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> 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> A DEMO 6 Bit At A Glance Colouerd Bargraph Generator. (Bash) 2013-01-16T12:26:55-08:00Barry Walkerhttp://code.activestate.com/recipes/users/4177147/http://code.activestate.com/recipes/578391-a-demo-6-bit-at-a-glance-colouerd-bargraph-generat/ <p style="color: grey"> Bash recipe 578391 by <a href="/recipes/users/4177147/">Barry Walker</a> (<a href="/recipes/tags/analogue/">analogue</a>, <a href="/recipes/tags/anim/">anim</a>, <a href="/recipes/tags/apple/">apple</a>, <a href="/recipes/tags/bargraph/">bargraph</a>, <a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/beep/">beep</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/generator/">generator</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/macbook_pro/">macbook_pro</a>). Revision 2. </p> <p>This code generates a horizontal coloured real time bargraph generator anim for a Macbook Pro 13 inch, OSX 10.7.5, using the default standard Terminal only.</p> <p>It is UNTESTED on Linux variants but I would like any successful Linux tryers to make a comment in the comments section and tags will be added accordingly otherwise I will assume it does NOT work on other UNIX like variants.</p> <p>It is a derivative of my 7 bit bargraph generator for Python on this site elsewhere.</p> <p>The Terminal colours WILL be changed on running but it is simple to return it back to its original state.</p> <p>Read the code for more information.</p> <p>Enjoy, (and a Happy New Year)...</p> <p>Bazza, G0LCU...</p>