Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

I am pleasantly surprised...

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1476
Location: Loughborough

PostPosted: Sun Oct 20, 2013 9:19 pm    Post subject: I am pleasantly surprised... Reply with quote

Hi guys...

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

http://code.activestate.com/recipes/578662-a-demo-to-show-how-to-write-text-into-the-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...
Back to top
View user's profile Send private message
lok1950
LXF regular


Joined: Tue May 31, 2005 6:31 am
Posts: 1030
Location: Ottawa

PostPosted: Mon Oct 21, 2013 12:44 am    Post subject: Reply with quote

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 Cool

Enjoy the Choice Smile
Back to top
View user's profile Send private message
Ram
LXF regular


Joined: Thu Apr 07, 2005 10:44 pm
Posts: 1674
Location: Guisborough

PostPosted: Mon Oct 21, 2013 11:48 am    Post subject: Reply with quote

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.....
Back to top
View user's profile Send private message MSN Messenger
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1476
Location: Loughborough

PostPosted: Mon Oct 21, 2013 5:53 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
Ram
LXF regular


Joined: Thu Apr 07, 2005 10:44 pm
Posts: 1674
Location: Guisborough

PostPosted: Mon Oct 21, 2013 8:14 pm    Post subject: Reply with quote

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.....
Back to top
View user's profile Send private message MSN Messenger
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1476
Location: Loughborough

PostPosted: Mon Oct 21, 2013 10:16 pm    Post subject: Reply with quote

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:
#!/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:
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...
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8467
Location: Warrington, UK

PostPosted: Mon Oct 21, 2013 11:20 pm    Post subject: Reply with quote

Bazza wrote:

Code:
#!/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)
Back to top
View user's profile Send private message
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1476
Location: Loughborough

PostPosted: Tue Oct 22, 2013 2:42 pm    Post subject: Reply with quote

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...
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast