Sponsored Content
Full Discussion: Campimeter.sh for macOS
Top Forums Programming Campimeter.sh for macOS Post 303043482 by wisecracker on Wednesday 29th of January 2020 12:39:09 PM
Old 01-29-2020
Campimeter.sh for macOS

Hi Neo...
Quote:
I tend to have a low attention span, so when I get a proof-of-concept like this up and running (and prove it works), even if the final results are not "polished", I then want to "call it good enough" and quickly move on to the next project.
This is me too except for the attention span. As soon as I find a solution to something I let others better it.
And as for doing something different I have done some bizarre stuff on here... <wink> /Me awaits the mickey take... ;oD
OT: Here is a small snippet for a terminal window you might like under OSX 10.14.6 on this MBP, solved and going into the Campimeter code.
Code:
#!/bin/bash
# Campimeter.sh

clear

# Set terminal to full screen and default sizes.
set_size()
{
    osascript << "FULL_SCREEN"
        tell application "Terminal" to activate
        tell application "System Events" to keystroke "f" using { command down, control down }
        delay 3
FULL_SCREEN
}

initialise()
{
    clear
    printf "%b" "\033[0;30;47m"
    clear
    SIZE=( $( stty size ) )
    VERT_CENTRE=$(( ${SIZE[0]} / 2 ))
    HORIZ_CENTRE=$(( ${SIZE[1]} / 2 ))
    printf "%b" "\033[${VERT_CENTRE};${HORIZ_CENTRE}f\033[0;30;42m  \033[0;30;47m\033[1;1f"
}

set_size

initialise

printf "\033[33;33f\033[1;31;47m*\033[0;30;47m\033[1;1f"

sleep 3

set_size

Enjoy...

Last edited by wisecracker; 01-30-2020 at 03:29 AM.. Reason: Corrected the "shebang", 30-01-2020. Thanks Ravinder...
These 2 Users Gave Thanks to wisecracker For This Post:
 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

UNIX on MacOS X

I am interested in knowing if anyone out there has been using the BSD UNIX that underlies MacOS X. Is this an "industrial strength" version of UNIX? Can I run X-Windows on such a machine? How about TeXing, pythoning, PERLing or using other useful UNIX goodies near and dear to my shrunken... (1 Reply)
Discussion started by: ncmathsadist
1 Replies

2. UNIX for Dummies Questions & Answers

Vuze/MacOS X: Too many open files

1) How can I stop Vuze from reporting the following error: "Too many open files" ? 2) What directory do I need to be in to effectively utilize this command: sudo bash -c 'ulimit -n 8192; sudo -u username ./azureus' ? 3) Is this the maximum number of files that I can allot to Vuze on OS X... (1 Reply)
Discussion started by: JFraser1
1 Replies

3. UNIX for Beginners Questions & Answers

Memory leak with awk on MacOs

Dear all, I use awk quite a bit for data wrangling ... today I find weird behavior that I cannot wrap my head around. if I execute the following command (simplified to illustrate the behavior ... nothing to do with the real command) bash-3.2$ awk... (3 Replies)
Discussion started by: comm|getline
3 Replies

4. UNIX for Beginners Questions & Answers

Macos is the UNIX?

why,just beacuse that its the bottom layer uses a small amount of bsd code? In my opinion, macos and Unix are completely different. The directories are long directory structures. For example, /application, /system, /user, /volumes, etc. are completely different from the traditional /bin/ /sbin... (5 Replies)
Discussion started by: malaizhichun
5 Replies

5. OS X (Apple)

MacOS 10.15 (Catalina) switches from bash to zsh

Interestingly Apple has decided to switch the default shell for new users from bash to zsh in MacOS Catalina (10.15) Use zsh as the default shell on your Mac - Apple Support Another interesting fact is that Catalina also comes with /bin/dash (5 Replies)
Discussion started by: Scrutinizer
5 Replies

6. OS X (Apple)

My original Python Campimeter code, originall for OSX 10.7.5.

Hi all... This was the original code I created to expand a terminal on the fly using Python 2.6.x to the now 3.8.0 without modification under OSX 10.7.5. I had no idea at the time that the MBP terminal could be full screen until here:... (0 Replies)
Discussion started by: wisecracker
0 Replies
Syntax::Highlight::Engine::Simple::HTML(3pm)		User Contributed Perl Documentation	      Syntax::Highlight::Engine::Simple::HTML(3pm)

NAME
Syntax::Highlight::Engine::Simple::HTML - (EXPERIMENTAL)HTML code highlighting class VERSION
This document describes Syntax::Highlight::Engine::Simple::HTML version 0.2 SYNOPSIS
Constructor use Syntax::Highlight::Engine::Simple::HTML; $highlighter = Syntax::Highlight::Engine::Simple::HTML->new(); or use Syntax::Highlight::Engine::Simple; $highlighter = Syntax::Highlight::Engine::Simple->new(type => 'HTML'); Highlighting stage $highlighter->doStr( str => $str, tab_width => 4); $highlighter->doFile( file => $name, tab_width => 4, encode => 'utf8'); DESCRIPTION
This is a subclass of Syntax::Highlight::Engine::Simple. A working example of This module is at bellow. http://jamadam.com/dev/cpan/demo/Syntax/Highlight/Engine/Simple/ INTERFACE
new type File type. This argument causes specific subclass to be loaded. setParams html_escape_code_ref HTML escape code ref. Default subroutine escapes 3 characters '&', '<' and '>'. appendSyntax Append syntax by giving a hash. $highlighter->setSyntax( syntax => { class => 'quote', regexp => "'.*?'", container => 'comment', } ); doStr Highlighting strings. $highlighter->doStr( str => $str, tab_width => 4 ); str String. tab_width Tab width for tab-space conversion. -1 for disable it. -1 is the default. doFile Highlighting files. $highlighter->doStr( file => $name, tab_width => 4, encode => 'utf8' ); file File name. tab_width Tab width for tab-space conversion. -1 to disable it. -1 is the default. encode Set the encoding of file. utf8 is the default. array2regexp This is a utility method for converting string array to regular expression. getClassNames Returns the class names in array. setSyntax This is a method for initializing the syntax. It is called by the constructor so you may not have to call it manually. Example Here is a sample of CSS. pre.program_code span.keyword {color: #00f} pre.program_code span.keyword2 {color: #808} pre.program_code span.number {color: #f00} pre.program_code span.identifier {color: #a66} pre.program_code span.function {color: #a66; text-decoration: underline} pre.program_code span.method {color: #a66; text-decoration: underline} pre.program_code span.variable {color: #f80} pre.program_code span.statement {color: #00f} pre.program_code span.comment {color: #080} pre.program_code span.perlpod {color: #080} pre.program_code span.quote {color: #a66} pre.program_code span.wquote {color: #600} pre.program_code span.value {color: #a66} pre.program_code span.regexp_statement {background: #ffa} pre.program_code span.tag {color: #00f} pre.program_code span.url {color: #00f; text-decoration: underline} DIAGNOSTICS
"doStr method got undefined value" "File open failed" CONFIGURATION AND ENVIRONMENT
Syntax::Highlight::Engine::Simple::HTML requires no configuration files or environment variables. Specific language syntax can be defined with subclasses and loaded in the constructor if you give it the type argument. DEPENDENCIES
UNIVERSAL::require Syntax::Highlight::Engine::Simple INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. Please report any bugs or feature requests to "bug-syntax-highlight-engine-Simple@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. SEE ALSO
Syntax::Highlight::Engine::Simple AUTHOR
Sugama Keita "<sugama@jamadam.com>" LICENCE AND COPYRIGHT
Copyright (c) 2008, Sugama Keita "<sugama@jamadam.com>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.10.0 2009-06-06 Syntax::Highlight::Engine::Simple::HTML(3pm)
All times are GMT -4. The time now is 10:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy