Tag Archives: OSX

Arduino Diecimila Board Access…

By wisecracker

This is a very simple starter DEMO to access Arduino Diecimila Board for the
Macbook Pro 13″ OSX 10.7.5…
A potentiometer is connected between 5V and Gnd with the wiper connected to
ANALOG IN 0 on the Arduino. This was adjusted to give the Ms and Ls as seen…

I now have DC in for this machine AND Linux too as on my Linux tools the device
becomes /dev/ttyUSB0 …

NOTE:- The device below is for MY machine and WILL be different for yours…

It is assumed that you have a Terminal up and running AND you have NOT
plugged in your USB Arduino Board yet…

Enjoy finding simple solutions to often very difficult problems…

Public Domain and you may do with it as you please…

Code:

Last login: Thu Jul 18 21:58:14 on ttys000
AMIGA:barrywalker~> # Find the USB device first.
AMIGA:barrywalker~> ls /dev/*usb*
ls: /dev/*usb*: No such file or directory
AMIGA:barrywalker~> # Now plug in the Arduino Diecimila Board...
AMIGA:barrywalker~> ls /dev/*usb*
/dev/cu.usbserial-A7007cvs /dev/tty.usbserial-A7007cvs
AMIGA:barrywalker~> # USE the /dev/cu.usbserial-A7007cvs device...
AMIGA:barrywalker~> cat < /dev/cu.usbserial-A7007cvs
MLMMLMMMMMMLMMMMLMLMMLLLLLLMLLMMMMMLMMMLMLLMLMLMMMMMMMMMMMLLMLLLMLLLLLLMLLLMLLM
MMMLMLLMLMMMLMMMMMLMLMLMLMMMLLLMMLLMMMMMMLLLMLLMMLMLLLLLMMMMLMLLLLMMMMMMMLLLMML
MMLMMMLLMLMLMLLMMMMLLLMLMMMMMLLMMLMMMLLMMMLLMMMMMMMMMMLLMLLLMMLLLMLMLMMLMMLMLML
MMMMMLLMMMMLLLLLLMMMMMMLLMLMMMMMLMMMLLMLMLMLLMLMLLLLMMMLMMLMMMMLMLMLMMLMMLMLMML
MLMLLLMLLLLLLMLLMMLMMMLMMMLMMLMLMMLMLMLMMLMLMMMLLLMLMLLLMMLLLMLMLMLLLLLLLMLMMML
LMcMMLLLLMLMMMMLMMMMMLMMLLMLMMMMMMLMLLMMMMMLMMMMLMLLMLMMMLLLMMMMMLLLMLMMLMLMMLM
MLMLLMLMMMMMLLLMMMMLLLMLMMLLMMLLMLLLMMMLLMMMLLMLLLLMMLLMMMMLLMMMMMLLLLLMMLLMMML
MLMMLLLMLLLLM^C
AMIGA:barrywalker~> _


The .PDE file for the Arduino as a test piece, this uses an early version of the
programming SW and I know it won’t compile on current versions so you will have
to modify slightly as required…

Code:

/* Using the Arduino as a DEMO single channel ADC for Windows (TM), Linux, */
/* AMIGA, WinUAE and now the Macbook Pro 13 inch OSX 10.7.5... */

/* Set up a variable for basic analogue input. */
int analogue0 = 0;

void setup() {
/* Open the serial port at 9600 bps. */
Serial.begin(9600);

/* Set the analogue voltage reference, DEFAULT is 5V in this case. */
analogReference(DEFAULT);
}

void loop() {
/* Read the 10 bit analogue voltage on analogue input 0. */
analogue0 = analogRead(0);
/* Convert to a byte value by dividing by 4. */
analogue0 = analogue0/4;

/* Send to the Serial Port the byte value. */
Serial.print(analogue0, BYTE);
}


…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

When is a _function_ not a _function_?

By wisecracker

For a starter I know the braces are NOT in the code…

Consider these code snippets:-

Code:

#!/bin/bash --posix
x=0
somefunction()
if [ $x = 0 ]
then
echo "I am here."
fi
# somefunction

#!/bin/bash --posix
x=0
somefunction()
if [ $x = 0 ]
then
echo "I am here."
fi
somefunction

#!/bin/bash --posix
x=0
somefunction()
echo "Why does this crash?"
if [ $x = 0 ]
then
echo "I am here."
fi
somefunction


Now using OSX 10.7.5 and bash here is the result:-

Code:

Last login: Fri Jul 12 18:41:45 on ttys000
AMIGA:barrywalker~> ./func.sh
AMIGA:barrywalker~> ./func.sh
I am here.
AMIGA:barrywalker~> ./func.sh
./func.sh: line 4: syntax error near unexpected token `echo'
./func.sh: line 4: `echo "Why does this crash?"'
AMIGA:barrywalker~> _


Why do the first two snippets work as predicted, (although without the braces), yet the third crashes out with the error report?
What is going on?

Can someone explain what is going on?

Many thanks…

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

SimCity Comes to Mac June 11, Players Receive Both Mac and PC with One Purchase

By Business Wirevia The Motley Fool

Filed under:


SimCity
Comes to Mac June 11, Players Receive Both Mac and PC with One Purchase

Maxis Unites the World As Mac and PC Players Play Together Seamlessly Across Servers

REDWOOD CITY, Calif.–(BUSINESS WIRE)– For more than 23 years, SimCity™ has entertained over 30 million fans worldwide and it returns to the platform that started it all on June 11. Electronic Arts Inc. (NAS: EA) today announced that SimCity will be coming to the Mac on June 11 exclusively as a digital release via Origin™ and other online retailers. Fans who purchase SimCity will be able to play the game on Mac and PC, regardless of which version they buy, as well as access their cities from across both platforms. Players who have previously purchased SimCity for PC, either as a physical or a digital copy will receive the Mac version as a free digital download on Origin* on June 11.

SimCity is coming to Mac on June 11 and one purchase will give you both the Mac and PC versions. You only need to buy SimCity once to play together across the same servers, regardless of which version you’re playing,” said Lucy Bradshaw, Senior Vice President and General Manager of EA’s Maxis Label. “We didn’t want to make any compromises when it came to the Mac so we created a native version that is optimized for the hardware and OSX.”

With more than 1.3 million units sold on PC since launch, the beloved city-building simulator is back with the series creators at Maxis™ and it delivers the most immersive and personal SimCity experience ever, where players can create and destroy the cities of their imaginations. SimCity runs natively on Mac and its entire software renderer was rewritten for OpenGL, ensuring the best performance for the platform. Via Origin, SimCity is cross-platform compatible, so all players will be able to play together across the same servers. Players will be able to play both versions with the same Origin account, allowing them to seamlessly continue their cities, achievements and leaderboard progress across the PC and Mac.

SimCity has been rated E10+ by the ESRB and is currently available for PC and will be available for Mac on June 11. For more information regarding SimCity, please visit www.SimCity.com. Press assets for SimCity are available at www.info.ea.com.

Source: FULL ARTICLE at DailyFinance

Join Krita

Krita has been developing quite fast, so you may be surprised to know that Krita’s core team is actually quite small, not to mention severely overworked. We need your help! Whether you are a developer or non-developer, there are many things that need to be done to improve the Krita experience! In particular, Krita urgently needs:

  • A maintainer for Krita’s merchandise shop: Krita has a mostly unused merchandise shop on zazzle.com . A volunteer is needed to properly set up and maintain it. Create cool new merchandise, keep a choice selection of t-shirt designs available — All proceeds will be used to fund the Krita Foundation.
  • Developers: You’ll be able to work on one of the coolest and fastest-growing open source painting programs out there. Krita also benefits from a modular architecture and the use of the Calligra and Qt libraries, which makes it easier to focus on new features instead of reinventing the wheel. And it makes coding fun!
  • Maintainers for Windows and OSX versions: Do you have experience porting and maintaining programs from Linux to Windows or OSX? As we all know, the current Windows version of Krita needs a lot of work. Please help us bring Krita to a wider audience!
  • Writers: The website, user documentation wiki and developer wiki are all in need of new content!
  • Marketing: Krita needs to regularly announce new releases or fundraising efforts on a variety of websites/blogs/social networks. This requires a lot of coordination work and perhaps a smart strategist.
  • Many more: Krita’s community is very friendly and supportive. We welcome all types of contributors!

If you’ve always hoped to contribute back to the project, please don’t hesitate to join us at our new Join page, or help us spread the word! You can also support Krita’s development through donations. The Krita team thanks you for all the support you have shown us until now!

…read more
Source: FULL ARTICLE at Planet KDE

Marble 1.5 for Mac OSX!

I was trying to produce a Marble DMG for Mac OSX since February and as all of you know that OSX has its own banana skins to slip you off, especially when you have upgraded to OSX Mountain Lion ( the decision which I am already regretting ). But, finally I have succeeded in producing a Marble DMG.

Henceforth, I would be privileged if all the KDE developers and users who use OSX gave a try to this DMG on their Macs. Here’s the link to the DMGhttps://dl.dropbox.com/u/50262219/Marble-1.5.0.dmg. Also, it would be very helpful if you give me your feedback via the Comments, be it criticism or suggestion, so that I can improve upon my work.

Thank You 🙂

…read more
Source: FULL ARTICLE at Planet KDE

OSX bash & expect

By jnojr

I have a script that must perform a ‘sudo’ operation on each of a number of hosts. I’m trying to get expect working so I only have to enter it once, and have run into a couple of issues.

First, several examples suggest to use:

Code:

/usr/bin/expect <<EOD
spawn ssh -t $host /usr/bin/sudo -v
expect "Password:"
send "$SUDOPASSn"
EOD


However, as soon as I enter the second ‘<', all of the quoting gets screwed up, and my script will terminate with an unexpected end of file. This is really strange, as I use the same mechanism with cat to write out files in other scripts.

Other examples suggest:

Code:

/usr/bin/expect -c "
spawn ssh -t $host /usr/bin/sudo -v
expect "Password:"
send "$SUDOPASSn"
"


Doing it this way (and adding -d to expect), I get errors about no tty and a repeat of my password with an ‘n’ appended to the end, so it isn’t sending a newline (I’ve tried ‘r’ as well), but instead appears to be escaping the ‘n’

Since most of the examples I’m finding are from Linux, I expect (ha, ha, pun not intended!) that they’re using a GNU expect, and I’m using a BSD expect. I am reading through the man page, but the word “spawn” appears so many times, it could be quite a while before I stumble across the correct instance.

I’ve been monkeying around with different quoting and can get some slightly different results, but I just don’t know exactly what expect is expecting to see 🙂

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Flash And Fade DEMO For Mac OSX 10.7.5, (And Linux?).

By wisecracker

This is an AT A GLANCE shell DEMO that does:-

1) 10 centred greyscale fades without warning beeps.

2) 5 centred yellow “WARNING!” flashes with beeps every ON state.

3) 5 FULL widowed red “DANGER!!!” flashes with beeps in the ON and OFF states.

It assumes that the warning bell is enabled inside the terminal.

It is primarily for OSX 10.7.5 and above but it could just as easily work in Linux or other UNIX like systems. It is issued as Public Domain and you my do with it as you please…

READ THE CODE FOR MORE INFO…

(Watch for wordwrapping, etc…)

Bazza, G0LCU…


#!/bin/bash
#
# Flash and fade for a Macbook Pro OSX 2.7.5 Terminal...
# A DEMO to show how to give an AT A GLANCE, and, audible warning of impending doom in a shell script.
# It is for something like an analogue Data Logger input say from an Arduino analogue source.
#
# It may well work on other Linux and Unix like machines but is untested and uses the "tput" command
# to hide and unhide the terminal cursor. The command "setterm" is commented out and could be used
# in place of the above depending on the *NIX flavour...
#
# Written in such a way that anyone can understand how it works.
#
# It starts with 10 cycles of grey/gray scale fading on a black background without any beeps then next
# 5 yellow warning flashes with a beep every full flash and finally 5 FULL screen red flashes with beeps
# on every ON and OFF state.
#
# Clear a screen to white on black...
printf "33[0;37;40m"
clear
printf "n Flash and fade for a default Macbook Pro OSX 2.7.5 Terminal.n"
# Turn the cursor off...
#setterm -cursor off
tput civis
# Fade on and off 10 times, grey/gray scales on black.
for fade in $(seq 1 10)
do
printf "33[12;23f33[1;30;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;90;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;37;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;97;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;37;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
printf "33[12;23f33[1;90;40mFading using four _shades_ of grey...33[0m"
sleep 0.1
done
# Over-write the above with the ...read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Sshfs script

By macpc

Hi, I am new to this forum.

I want to setup my personal Dropbox between my home server and the work station in the office.

I followed this tutorial

danbishop.org/2011/09/10/…-in-os-x-lion/and it works great. 🙂

The trouble now is I am not sure how I can make it to start on boot.

I have to enter this command every time after a reboot.
sshfs user@xxx.xxx.xxx.xxx:/Volumes/data/myDropbox /Volumes/data/Desktop/myDropbox
then enter the password.

After some research I made this script called myDropbox.sh

#!/usr/bin/myDropbox
spawn sshfs user@xxx.xxx.xxx.xxx:/Volumes/data/htdocs/myDropbox /Volumes/data/Desktop/myDropbox
expect “Password”
send “myPwdr”
interact

When I run it in Terminal, it seems like it was going to mount because after the password it returns to the $ prompt.
but it doesn’t mount. 🙁

Can someone tell me what I did wrong?

Thanks in advance.

P.S. I am on OSX 10.8.2

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums

Jorge Castro: Juju core 1.9.8 released

David Cheney passes along that Juju core 1.9.8 has now been released.

For those not familiar with Juju core, it is the rewrite branch of Juju in golang. The team is now close to feature parity with the Python version, we expect to have something real nice for you by 13.04. 🙂

My favorite feature here is a real small one, an idea passed along to the team by Rick Spencer. juju generate-config -w will now spit out a configuration file for you. We’ve documented a bunch of providers in there, so out of the box you’ll get AWS, OpenStack, HP Cloud, and the local provider in the config file all commented out, you’ll be able to just paste in your creds and go. This is much nicer than trading snippets with friends.

Here’s the changelog, make sure you check it out, there are still some limitations, like lack of constraints, so be aware. Expect a summarized report on the Go version soon, we’ve inherited some great new features, including better multiplatform support, you’ll find 1.9.8 is working for OSX now.

…read more
Source: FULL ARTICLE at Planet Ubuntu

Very Important Update for Calligra 2.4 and 2.5 Released

Attention, this is a crucial update!

The Calligra team releases updates to the 2.4 and 2.5 series at the same time: versions 2.4.4 and 2.5.5. These releases include fixes for two major bugs in the Sheets application which made recalculations of spreadsheet contents go wrong under certain conditions. We urge all users of Calligra Sheets to update immediately.

In addition these releases contain a number of other important bug fixes.

Bugfixes in This Release

Here is an overview of the most important fixes that are in 2.4.4 and 2.5.5. There are several others that are not mentioned here.

General:

  • 2.5.5: A few build issues on Windows.

Sheets:

  • 2.4.4 and 2.5.5: A very nasty bug which made recalculations of spreadsheet contents go wrong under some circumstances (BUGS: 312981, 313010)

Kexi:

  • Kexi Forms:
    • 2.5.5: Description was ignored in Command Link button
    • 2.4.4: Make palette background color property in text editor work (BUG: 309274)
    • 2.4.4: Fix “data source tag” for text box (regression because of changes in KDE libraries’ line editor)
  • 2.4.4: SQLite Driver: Fix possible data loss of compacted file (when process tools crash or fail for any reason)
  • 2.4.4: Remove limit of 101 fields in Kexi Table Designer (BUG: 309116)
  • 2.4.4 and 2.5.5: Fix MySql login failure when not saving password – fix for case 3.1 (BUG: 313025)
  • 2.4.4 and 2.5.5: Fix possible crash when pressing tab in the global search box
  • 2.5.5: Property editor: make items are always sorted by key

Try It Out

The source code of this version is available for download from download.kde.org. Also many binary packages are available for various operating systems and distributions. This release is packaged for Windows by KO GmbH, and you can find it on their download page. There is also a separate package or Krita only.

We would welcome volunteers who want to build and test the Calligra Suite on OSX.

About Calligra

Calligra is part of the applications from the KDE community. See more information at the website http://www.calligra.org/.

Source: FULL ARTICLE at Planet KDE

Script to find line in one file and replace in another

By padgo

Hey Guys, im looking for a script that will work under OSX.

What i want to do is copy information from one file (Specific LIne) and write it to a certain line in another. To be more specific…

I want the hostname of a mac to be gathered ( i assume its stored in a .plist file somewhere) and that hostname value to be written to another pslist file:

The source could be a .plist file

The pslist file that i want it WRITTEN to looks like this:

bgPath
/logo.jpg
defaultBootOS
Mac OS X
linJustification

linuxPartition

mosxJustification
VALUE TO GO HERE

timeLimit
0
title
School of Architecture
userChoosesBootOS

winJustification

windowsPartition
/dev/disk0s3

I have no idea how to do this, any guidance would be appreciated.

Cheers 🙂

Source: FULL ARTICLE at The UNIX and Linux Forums

Python, Platform Independent, Pure Audio Sinewave Generator…

By wisecracker

IKHz_SW_OSX.py

A DEMO mono _pure_ sinewave generator using standard text mode Python 2.6.7 to at least 2.7.3.

This code is EASILY modifyable to Python version 3.x.x…

This DEMO kids level 1KHz generator is mainly for a MacBook Pro, (13 inch in my case), OSX 10.7.5 and above. See below…

It is a simple piece of testgear for the young amateur electronics enthusiast and uses pyaudio fully installed for it to work.

PyAudio pointer can be obtained from inside the comments in the code…

Macbook Pro hardware earphone plug modifications pointer inside the code too…

(I am not sure if the moderators will delete those lines from the code so search the WWW instead if they are…)

This was primarily for a MacBook Pro 13 inch, but works on at least 2 Linux flavours and Windows Vista 32 bit…

The sinewave generated is near excellent…

Enjoy finding simple solutions to often very difficult problems… Bazza, G0LCU…

(This was uploaded elsewhere and has had a lot of hits.)

Issued as GPL3…

Code:

# 1KHz_SW_OSX.py
#
# A mono _pure_ sinewave generator using STANDARD text mode Python 2.6.7 to at least 2.7.3.
# This DEMO kids level 1KHz generator is mainly for a MacBook Pro, (13 inch in my case), OSX 10.7.5 and above.
# It is another simple piece of testgear for the young amateur electronics enthusiast and
# uses pyaudio fully installed for it to work. Enjoy... ;o)
# PyAudio can be obtained from here:- http://people.csail.mit.edu/hubert/pyaudio/
#
# It also works on Windows Vista, 32 bit, on various machines with Python 2.6.x to 2.7.3.
# It also works on Debian 6.0.0 using Python 2.6.6 on an HP dv2036ea notebook.
# It also works on "Ubuntu 12.04, Python 2.7, Dell built-in soundcard", with many thanks to Hubert Pham, author
# of pyaudio itself, for testing...
#
# The hardware modifictions can be found here:-
# http://code.activestate.com/recipes/578282-for-macbook_pro-heads-only-simple-lf-audio-oscillo/?in=lang-python
#
# Ensure the sound is enabled and the volume is turned up. Use the volume control to vary the amplitude...
#
# Copy the file to a folder/drawer/directory of your choice as "1KHz_SW_OSX.py" without the quotes.
#
# Start the Python interpreter from a Terminal/CLI window.
#
# To run the sinewave generator, (depending upon the platform), just use at the ">>>" prompt:-
#
# >>> execfile("/full/path/to/1KHz_SW_OSX.py")
#
# And away you go...
#
# This code is issued as GPL3...
#
# Connect an oscilloscope to the earphone socket(s) to see the sinewave waveform(s) being generated.
#
# $VER: 1KHz_SW_OSX.py_Version_0.00.10_(C)2012_B.Walker_G0LCU.

# The only import required...
import pyaudio

# Initialise the only _variable_ in use...
n=0

# Set up a basic user screen...
# This assumes the minimum default 80x24 Terminal window size...
print("nnnnnnnnnnnnnnnnnnnnnnnnn$VER: 1KHz_SW_OSX.py_Version_0.00.10_(C)2012_B.Walker_G0LCU.n")
print("A DEMO kids level, platform independent, 1KHz _pure_ sinewave generator.nnnnnnnnnnnnnnnnnn")

# Open the stream required, mono mode only...
stream=pyaudio.PyAudio().open(format=pyaudio.paInt8,channels=1,rate=16000,output=True)

# Now generate the 1KHz signal at the speakers/headphone output for about 10 seconds...
# Sine wave, to 8 bit depth only...
for n in range(0,10000,1): stream.write("x00x30x5ax76x7fx76x5ax30x00xd0xa6x8ax80x8axa6xd0")

# Close the open _channel(s)_...
stream.close()
pyaudio.PyAudio().terminate()

# End of 1KHz_SW_OSX.py program...
# Enjoy finding simple solutions to often very difficult problems... ;o)


Source: FULL ARTICLE at The UNIX and Linux Forums

The Nightmare That Keeps Microsoft Awake… Android On The Desktop

By Ewan Spence, Contributor A big part of Microsoft’s income is derived from Windows. While Apple are slowly making inroads with OSX (especially in the latop market), there is a bigger worry for the Redmond company. Flying around in the wings is Android OS. Right now it rules the mobile market and is pushing into tablets… but what if Google serious pushed it towards the desktop?
Source: FULL ARTICLE at Forbes Latest

At A Glance Coloured Real Time Bargraph Generator…

By wisecracker

Not sure if anyone is interested but I am just getting into UNIX like shell scripting…

I have great interest in pseudo-animations in text mode and accessing HW like /dev/dsp for example…

All the information is inside the code and this has been uploaded to code.activestate.com…

Have fun, I do… ;o)

Code:


# !/bin/sh
#
# Bargraph_Generator.sh
#
# A DEMO 6 bit coloured bargraph animation for a default Bash and Terminal window on OSX 10.7.5...
# A simple Shell script to display an _AT_A_GLANCE_ real time analogue bargraph generator. It
# starts off with GREEN for OK, then YELLOW for warning and finally ending with RED for danger
# with a critical beep for values 61 to 63 inclusive.
# It assumes an 8 bit value being injected into the script which is then divided by 4 to give
# a 6 bit value which is 64 spaces width inside the Terminal. The DEMO uses a random number
# generator to give a representation of an 8 bit value so you can see it working...
#
# A shell derivative of my Python code:-
# http://code.activestate.com/recipes/577612-seven-bit-colored-analogue-bar-graph-generator-dem/?in=user-4177147
#
# To run, ensure the script is executable and change if required, then type from a Terminal:-
#
# xxxxx$ /full/path/to/Bargrapth_Generator.sh
#
# And away you go...
#
# Written in such a way that kids and newbies can understand what is going on.
#
# Originally written for a Macbook Pro 13 inch, OSX 10.7.5 using the default Terminal.
# It MIGHT work on some Linux variants but WAS intended for MacOS OSX 10.7.x and above only.
#
# The Terminal colours WILL be changed to Black background and Various foreground colours.
# It will NOT be returned back to its original state although it can be easily. If you
# need to rerturn back to default state then there are a couple of easy methods the
# simplest being type:-
#
# xxxxx$ reset
#
# And all will be corrected...
#
# Issued entirely as Public Domain and you may do with it as you please
#
# $VER Bargraph_Generator.sh_Version_0.00.10_(C)2012_B.Walker_G0LCU.
#
# Enjoy finding simple solutions to often very difficult problems...

# The required _varibales_ for ease of coding, these are the colours...
# White On Black.
WOB="x1B[1;37;40m"
# Black On Green.
BOG="x1B[1;30;42m"
# Black On Yellow.
BOY="x1B[1;30;43m"
# Black On red.
BOR="x1B[1;30;41m"
# Green On Black.
GOB="x1B[1;32;40m"
# Yellow On Black.
YOB="x1B[1;33;40m"
# Red On Black.
ROB="x1B[1;31;40m"

# Set the pseudo 6 bit value to zero.
SIX_BIT_DEPTH=0

# Do a clear screen to White On Black.
printf $WOB
clear

while true
do
# Set up the screen per scan and prepare for the bargraph.
clear
printf $WOB"n $VER: Bargraph_Generator.sh_Version_0.00.10_(C)2012_B.Walker_G0LCU.nn"
printf " A horizontal, at a glance, coloured, analogue bargraph display forn"
printf " a default Terminal inside OSX 10.7.5..nnnnn"
printf " 0 10 20 30 40 50 60"
printf $GOB"n +----+----+----+----+----+----+----+----+----+"$YOB"----+----+"$ROB"----+--n"
printf $GOB" (| "$ROB")n"
printf $GOB" +----+----+----+----+----+----+----+----+----+"$YOB"----+----+"$ROB"----+--nnnn"
# If the 6 bit value is 0, zero, do no more until printing the 6 bit value and generating another 6 bit value...
# Anything greater than or equal to 1 enters this conditional branch.
if [ "$SIX_BIT_DEPTH" -ge "1" ]
then
# If the 6 bit value is less than or equal to 46 then _plot_ the green section only.
# The 'x1B[12;8f' is the ANSI 'Esc' code that forces the print position to 12 lines by 8 columns.
if [ "$SIX_BIT_DEPTH" -le "46" ]
then
BARGRAPH=$GOB"x1B[12;8f("$BOG
for green in $(seq 1 "$SIX_BIT_DEPTH")
do
BARGRAPH=$BARGRAPH" "
done
fi
# If the 6 bit value is greater than or equal to 47 then print the green section and _plot_ the yellow section.
if [ "$SIX_BIT_DEPTH" -ge "47" ]
then
BARGRAPH=$GOB"x1B[12;8f("$BOG" "$BOY
for yellow in $(seq 47 "$SIX_BIT_DEPTH")
do
BARGRAPH=$BARGRAPH" "
done
fi
# If the 6 bit value is greater than or equal to 57 then print the green and yellow section and _plot_ the red section.
if [ "$SIX_BIT_DEPTH" -ge "57" ]
then
BARGRAPH=$GOB"x1B[12;8f("$BOG" "$BOY" "$BOR
for red in $(seq 57 "$SIX_BIT_DEPTH")
do
BARGRAPH=$BARGRAPH" "
done
fi
printf "$BARGRAPH"$GOB"nnnnn"
fi
# When the 6 bit value is greater than or equal to 61 sound a system error beep.
if [ "$SIX_BIT_DEPTH" -ge "61" ]
then
printf "a"
fi
# Print the 6 bit value in White On Black...
printf $WOB" Random number generated "$SIX_BIT_DEPTH"...nn"
printf " Press Ctrl-C to stop the program...nn"
# Generate another 6 bit value as though from an 8 bit value...
SIX_BIT_DEPTH=$[($RANDOM % (256/4))]
# A practical lower limit for the sleep command is 'sleep 0.05'...
sleep 1
done

# End of Bargraph_Generator.sh DEMO.
# Enjoy finding simple solutions to often very difficult problems... ;o)


Source: FULL ARTICLE at The UNIX and Linux Forums

OSX verify username and password in one line

By TheDrizzleI’m writing a script that has the need to verify the current user’s username and password. I’m not entirely sure how to do this. I’ve read some things on “dscl” but am not sure that’s the correct route for me to go.

The one condition i have is that i really need to have the verification happen in one line of code. I’m using a different scripting language (MEL) to execute the bash terminal command, so being prompted to enter a password doesn’t really help me.

Appreciate any help!!Thanks!!

-drizzle

(I should mention Unix is not my native scripting language. I’m not a complete idiot when it comes to unix, but elaboration on any answers would be more than appreciated!)
Source: The UNIX and Linux Forums