Recent Updates Page 2 Toggle Comment Threads | Keyboard Shortcuts

  • harlekwinblog 12:27 pm on May 17, 2011 Permalink | Reply
    Tags: Awk,   

    In awk you can run a command using variables from awk by saving the command to a variable first, then get line can be used to retrieve the result.
    /condition/ {
        myVariable = "some value"
        CMDFILE = "echo "myVariable" | head"
        CMDFILE | getline myAnswer
        close(CMDFILE)
        print myAnswer
    }

    don’t forget the close statement!!,.

    Advertisement
     
  • harlekwinblog 3:36 pm on March 30, 2011 Permalink | Reply
    Tags: file descriptors, , proxy, Redhat, resources   

    Squid by default on RedHat only uses a maximum number of file descriptors of a meagre 1024.
    To increase this:

    • Add lines in the /etc/security/limits.conf file:
      squid soft nofile 20480
      squid hard nofile 20480

    • Add line in the /etc/squid/squid.conf file:
      max_filedesc 20480

    • Add line in the /etc/init.d/squid file:
      ulimit -HSn 20480

    • Restart the squid service:
      service squid restart

    This will DEFAULT to the COMPILED setting of 16k file descriptors rather than our selected value of 20K.

     
  • harlekwinblog 4:51 pm on February 28, 2011 Permalink | Reply
    Tags: , e-mail, , mutt   

    Using the file ~/.muttrc you can set the FROM address in outbound messages from the root user to an arbitrary but more appropriate value:
    vim ~/.muttrc
    Add the lines:

    set from=noreply@my.domain
    set envelope_from=yes
    set realname=NoReply

    Or as you see fit – Envelope Sender is also controlled with this setting

     
  • harlekwinblog 3:06 pm on February 21, 2011 Permalink | Reply
    Tags: , , screen   

    To share the same interface when on a Linux server you can use screen
    To start a session:
    screen -S {session-name}
    To join a session:
    screen -x {session-name}
    Both administrators will then be able to type commands fully visible to each other.

     
  • harlekwinblog 3:03 pm on February 21, 2011 Permalink | Reply
    Tags: ,   

    In Vim you can find valid e-mail addresses with the command:
    /^[a-z0-9][a-z0-9_\.-]*@[a-z0-9][a-z0-9-]*\(\.[a-z0-9][a-z0-9-]*\)*$
    Requires that the e-mail address is on a line on it’s own.
    Alternatively:
    /[a-z0-9][a-z0-9_\.-]*@[a-z0-9][a-z0-9-]*\(\.[a-z0-9][a-z0-9-]*\)*
    Will find such addresses anywhere on a line.

     
  • harlekwinblog 2:58 pm on February 21, 2011 Permalink | Reply
    Tags: ,   

    In Vim you can delete empty lines with the command:
    :g/^$/d

     
  • harlekwinblog 2:56 pm on February 21, 2011 Permalink | Reply
    Tags: ,   

    In Vim you can remove duplicate lines with the command:
    :%s/^\(.*\)\n\1$/\1/

     
  • harlekwinblog 2:53 pm on February 21, 2011 Permalink | Reply
    Tags:   

    Vim can lowercase all lines with the command: ggguG
    Similarly to uppercase them use: gggUG

     
  • harlekwinblog 2:24 pm on February 21, 2011 Permalink | Reply
    Tags: , , tcpdump   

    When using TCPDUMP you can use -s 0 to not limit the size of the packets retrieved by the -w {Filename} option.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel