Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

David www.planetargon.com

« Newer Snippets
Older Snippets »
Showing 1-5 of 5 total  RSS 

Always be screened

This tip originally by Cygnus at http://www.parsed.org
You can use this in your shell dotfile (e.g. ’/.bash_profile’, ’/.zshrc’) to create a ‘screen’ session when you log in or reattach to an existing screen:


if [[ $TERM != 'screen' ]] ; then
    if [[ `screen -list | grep -v "No" | awk '$2 { print }' | wc -l` == 0 ]] ; then
        screen
    else
        screen -dr
    fi
fi

Quick aliases for common searches in firefox

Badly formatted post broke our parser. Please edit!

Eliminating sites from searches

You can eliminate matches on queries based on the name of the site. For example, to search on all sites except 'experts-exchange.com', use the following hyphen-prefixed 'site' string:

-site:experts-exchange.com "convert cstring to int "


Or you can only seach a specified site by removing the dash
site:planetargon.com "rails hosting"


Tip by xinu

Bandwidth Monitoring From the Console Using 'pktstat'

Pktstat, http://www.adaptive-enterprises.com.au/~d/software/pktstat/, displays a real-time summary of packet activity on an interface. Each line displays the data rate associated with a particular class of packets. The class is determined by the packet header.

For example, 'pktstat -w1' will refresh once per second showing the average bandwidth usage and active connections:

# pktstat -w1

  interface: eth0 
  load averages: 285.9k 167.3k 67.3k bps 

    bps    % desc 
  466.8   0% arp 
             tcp 205.188.1.192:5190 <-> c-24-21-74-176:1472 
   6.0k   0% tcp c-24-21-74-176:3933 <-> host75:3724 
  63.5k   1% tcp c-24-21-74-176:4662 <-> p50906304:61951 
  27.4k   0% udp 10.141.192.1:bootps <-> 255.255.255.255:bootpc

Correcting a command

If you've run a command that you discover needs a path, you can do something like this on the following line:
$ psql -U postgres mydb_here
bash: psql: command not found

$ /usr/local/pgsql/bin/!!
/usr/local/pgsql/bin/psql -U postgres mydb_here

Welcome to psql 7.3.5, the PostgreSQL interactive terminal.
mydb_here=#


Or if you mistyped the path:
$ /usr/loca/pgsql/bin/psql -U postgres mydb_here
-bash: /usr/loca/pgsql/bin/psql: No such file or directory

$ ^loca^local
usr/local/pgsql/bin/psql -U postgres mydb_here

Welcome to psql 7.3.5, the PostgreSQL interactive terminal.
mydb_here=#
« Newer Snippets
Older Snippets »
Showing 1-5 of 5 total  RSS