I am pleasantly surprised...

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

I am pleasantly surprised...

Postby Bazza » Sun Oct 20, 2013 8:19 pm

Hi guys...

I uploaded this ultra simple piece of Python code to here, about a month ago:-

http://code.activestate.com/recipes/578 ... -python-t/

It has been at No1 from day 1 of upload and has now been voted up yet again to 7 today.

How can something so simple get rated so high?

I am pleasantly surprised...
73...

Bazza, G0LCU...

Team AMIGA...
User avatar
Bazza
LXF regular
 
Posts: 1476
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Postby lok1950 » Sun Oct 20, 2013 11:44 pm

Perhaps it's the simple things that are the hardest to understand completely :wink: That and you may have made that little snippet generalized enough that it falls into that category of code of wheels not to reinvent 8)

Enjoy the Choice :)
User avatar
lok1950
LXF regular
 
Posts: 1032
Joined: Tue May 31, 2005 5:31 am
Location: Ottawa

Postby Ram » Mon Oct 21, 2013 10:48 am

Hi Bazza,

Works on LXDE 13.10, handy when having multi tabs open.

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1676
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Postby Bazza » Mon Oct 21, 2013 4:53 pm

Hi guys...

Thanks for the replies...

And Ram, can I quote you on that and put it in the comments section of the pointer?
73...

Bazza, G0LCU...

Team AMIGA...
User avatar
Bazza
LXF regular
 
Posts: 1476
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Postby Ram » Mon Oct 21, 2013 7:14 pm

You can Bazza,

An to be more precise, multi tabs in LXTerminal

Python version " Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2 "

lubuntu LXDE 13.10 running on AMD Phenom II*4; ASUS Crosshair III Formula MB; 4 GB Ram.....
User avatar
Ram
LXF regular
 
Posts: 1676
Joined: Thu Apr 07, 2005 9:44 pm
Location: Guisborough

Postby Bazza » Mon Oct 21, 2013 9:16 pm

Thanks Ram...

Done!

That has pleased me even more...

I have almost dumped Python in preference to shell scripting ATM.

I am really enjoying doing unusual shell stuff especially in text mode...

Here is summat I am working on ATM:-
Code: Select all
#!/bin/bash --posix
clear
echo ""
echo "Graphics characters and Logic Analyser display DEMO."
# Enable _extended_ graphics characters.
echo -e "\x1B(0"
echo -e "abcdefghijklmnopqrstuvwxyz\n"
echo "lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"
echo "j                                                               "
echo "lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk                               "
echo "j                               mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"
echo "lqqqqqqqqqqqqqqqk               lqqqqqqqqqqqqqqqk               "
echo "j               mqqqqqqqqqqqqqqqj               mqqqqqqqqqqqqqqq"
echo "lqqqqqqqk       lqqqqqqqk       lqqqqqqqk       lqqqqqqqk       "
echo "j       mqqqqqqqj       mqqqqqqqj       mqqqqqqqj       mqqqqqqq"
echo "lqqqk   lqqqk   lqqqk   lqqqk   lqqqk   lqqqk   lqqqk   lqqqk   "
echo "j   mqqqj   mqqqj   mqqqj   mqqqj   mqqqj   mqqqj   mqqqj   mqqq"
echo "lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk lqk "
echo "j mqj mqj mqj mqj mqj mqj mqj mqj mqj mqj mqj mqj mqj mqj mqj mq"
echo "x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x "
echo "vqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvqvq"
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"
# Disable _extended_ graphics characters.
echo -e "\x1B(B\x1B[0m"
echo "Graphics characters DEMO end."
echo ""

Results on Macbook Pro, OSX 10.7.5, default bash terminal.
(Note I have a Python version too...)
Code: Select all
Last login: Mon Oct 21 17:42:23 on console
AMIGA:barrywalker~> ./Logic_Analyser.sh

Graphics characters and Logic Analyser display DEMO.

▒␉␌␍␊°±␤␋┘┐┌└┼⎺⎻─⎼⎽├┤┴┬│≤≥

┌───────────────────────────────────────────────────────────────
┘                                                               
┌───────────────────────────────┐                               
┘                               └───────────────────────────────
┌───────────────┐               ┌───────────────┐               
┘               └───────────────┘               └───────────────
┌───────┐       ┌───────┐       ┌───────┐       ┌───────┐       
┘       └───────┘       └───────┘       └───────┘       └───────
┌───┐   ┌───┐   ┌───┐   ┌───┐   ┌───┐   ┌───┐   ┌───┐   ┌───┐   
┘   └───┘   └───┘   └───┘   └───┘   └───┘   └───┘   └───┘   └───
┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐
┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─
││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴

Graphics characters DEMO end.

AMIGA:barrywalker~> _

I am thinking of using this idea as an 8 channel Logic_Analyser project using purely text mode shell scripting...

Enjoy...
73...

Bazza, G0LCU...

Team AMIGA...
User avatar
Bazza
LXF regular
 
Posts: 1476
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough

Postby nelz » Mon Oct 21, 2013 10:20 pm

Bazza wrote:
Code: Select all
#!/bin/bash --posix



Use /bin/sh to run bash in posix compatible mode, since this works for other shells too. Doing it the bash --posix way means you still require bash to be installed even though you are not using any of its features.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8497
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Postby Bazza » Tue Oct 22, 2013 1:42 pm

just tested the pointer from the OP inside a default CygWin terminal install and it works a treat.

Way cool...
73...

Bazza, G0LCU...

Team AMIGA...
User avatar
Bazza
LXF regular
 
Posts: 1476
Joined: Sat Mar 21, 2009 11:16 am
Location: Loughborough


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron