A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label screen. Show all posts
Showing posts with label screen. Show all posts

Show tabs in GNU screen

~/.screenrc

hardstatus string "%{= g} %{= w}%-Lw%{=r}%n%f* %t%{-}%+LW"

(source)

See also byobu, which is one step better than screen.


Enable scrolling in GNU screen

.screenrc: 
termcapinfo xterm* ti@:te@ 


Parse HTML with Ruby and Nokogiri


doc = Nokogiri::HTML(open(filename, 'r'))
puts doc.xpath('//title')[0].inner_html
puts doc.xpath('//h2')

Different files for log4perl levels

log4perl.rootLogger=DEBUG,CONSOLE,ViewableLog,DebugLog,ErrorLog

###################################################################################
# console - what to watch
log4perl.appender.CONSOLE=Log::Log4perl::Appender::Screen
log4perl.appender.CONSOLE.layout=PatternLayout
log4perl.appender.CONSOLE.layout.ConversionPattern=[%d] [%p %c] - %m%n
log4perl.appender.CONSOLE.Filter = ViewableFilter

  log4perl.filter.ViewableFilter        = sub {    \
       my %p = @_;                           \
       $p{log4p_level} eq "FATAL" or          \
       $p{log4p_level} eq "ERROR" or          \
       $p{log4p_level} eq "INFO" or          \
       $p{log4p_level} eq "WARN"           \
                                          }

###################################################################################
# Viewable log - record of CONSOLE
log4perl.appender.ViewableLog=Log::Log4perl::Appender::File
log4perl.appender.ViewableLog.layout=PatternLayout
log4perl.appender.ViewableLog.layout.ConversionPattern=[%d] [%p %c] - %m%n
log4perl.appender.ViewableLog.filename = logs/output.log
log4perl.appender.ViewableLog.Filter = ViewableFilter

###################################################################################
# Error log - warnings and errors
log4perl.appender.ErrorLog=Log::Log4perl::Appender::File
log4perl.appender.ErrorLog.layout=PatternLayout
log4perl.appender.ErrorLog.layout.ConversionPattern=[%d] [%p %c] - %m%n
log4perl.appender.ErrorLog.filename = logs/error.log
log4perl.appender.ErrorLog.Filter = ErrorFilter

  log4perl.filter.ErrorFilter        = sub {    \
       my %p = @_;                           \
       $p{log4p_level} eq "FATAL" or          \
       $p{log4p_level} eq "ERROR" or          \
       $p{log4p_level} eq "WARN"           \
                                          }

###################################################################################
# Debug Log - everything
 log4perl.appender.DebugLog = Log::Log4perl::Appender::File
 log4perl.appender.DebugLog.layout=PatternLayout
 log4perl.appender.DebugLog.layout.ConversionPattern=[%d] [%p %c] - %m%n
  log4perl.appender.DebugLog.filename = logs/debug.log
  log4perl.appender.DebugLog.Filter = AllFilter

  log4perl.filter.AllFilter        = sub {    \
       my %p = @_;                           \
       $p{log4p_level} eq "FATAL" or          \
       $p{log4p_level} eq "ERROR" or          \
       $p{log4p_level} eq "WARN" or          \
       $p{log4p_level} eq "INFO" or          \
       $p{log4p_level} eq "DEBUG" or          \
       $p{log4p_level} eq "TRACE"           \
                                          }

###################################################################################
# To enable DEBUG-level logging for a particular module (and any modules that subclass it),
# un-comment the following and change e.g. 'TempTopicsAdminTools.ModuleManager' to the your own module.

##log4perl.logger.TempTopicsAdminTools.ModuleManager=DEBUG
#log4perl.logger.TempTopicsAdminTools.PageManager=WARN
#log4perl.logger.TempTopicsAdminTools.CategoryManager=WARN

Taking Screenshots in Mac OS X

http://guides.macrumors.com/Taking_Screenshots_in_Mac_OS_X

Shortcuts

* Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop
* Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop
* Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop
* Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard
* Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard
* Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard

In Leopard, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4):

* Space, to lock the size of the selected region and instead move it when the mouse moves
* Shift, to resize only one edge of the selected region
* Option, to resize the selected region with its center as the anchor point

GNU screen


Type 'screen' after you log into a server.

Or type byobu for an enhancement to GNU screen!
"Allows users to quickly switch their .screenrc to any of the available profiles"
See also http://launchpad.net/byobu
byobu version 3.5
Screen version 4.00.03jw4 (FAU) 2-May-06


Byobu features:
  • Visible at bottom of screen at all times:
    • All screen tabs
    • Server welcome message
    • Uptime
    • Load
    • Hardware spec
    • [configurable to display anything you want]
  • Tab names show special characters to provide more info:
    • - (dash) means that window will be switched to with Ctrl-A, A
    • @ (at) means that tab has seen activity since you last saw it

Screen keyboard commands:
  • Ctrl-A, c -- to create a new terminal session
  • Ctrl-A, Ctrl-A -- to alt-tab
  • Ctrl-A, " -- to list the terminals
  • Ctrl-A, A -- to rename the terminal
  • Ctrl-A M -- (monitor for activity) Toggles monitoring of the current window
  • Ctrl-A _ -- (monitor for silence) Toggle
Best screen feature:
  1. Log into the server.
  2. Type screen to start a session.
  3. Work as normal.
  4. When finished, just close/kill the terminal program, don't log off.
  5. Later, on any (other) PC, log into the server again.
  6. Type screen -D -R to retrieve your session, just as you left it.

I don't know of a way to change the order of the tabs.