parsed.org

Tips by tag: neat

Adding Users with Passwords by xinu on Sep 10, 2005 12:13 AM

BSD is a little paranoid about where your passwords come from, so they'll insist on getting it from a stream. Here's an example:

(edit the file '/tmp/pass' and deposit the password there)            
% su root -c sh
Password:
# pw useradd -n test -c "Test User" -m -h 3 3< /tmp/pass
# grep test /etc/master.passwd
test:$1$T2tu0BET$UGPrNB1FavzjlzhTwUWRN.:1002:1002::0:0:Test User:/home/test:/bin/sh
# exit
% su test
Password: [typed "foobar" here...]
$ exit
bsdcommandsfreebsdneatparanoidpasswordspwsecurity
Border Radius by xinu on Dec 31, 2005 03:56 PM

This is a Mozilla-specific option, but it makes for some nice edges on interfaces and IE will roll to square edges without any problem:

.mybox {
    -moz-border-radius: 10px;
    border: 1px solid black;
    background: lightblue;
}

See this handy URL for some other tips and tricks:

http://www.eightlines.com/neil/mozskin/csscommands.html

cssmozillaneatproprietaryui
Correcting Command by xinu on Feb 03, 2005 03:30 PM

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=#
bashcommandsneat
Creating a Table from a Query by cygnus on Feb 10, 2005 02:12 PM

If you want to create a table that has the same structure as the result set of a query, run:

mydb> CREATE TABLE foobar AS SELECT ...;
neatpostgresqlsql
Find Out Which Package Contains a File by cygnus on Sep 19, 2005 08:18 AM

The apt-file program allows you to search the contents of all debian packages (installed and not installed) for files that you may need. For example, if you're compiling a program and need a header file but don't know which package provides the file, you can use apt-file to find out which package you should install to fix the problem:

# apt-get install apt-file
# apt-file update
# apt-file search foo.h

Be sure to run apt-file update periodically to update the file listing cache just as you also run apt-get update. The last command above will list any packages whose files match the specified search string, as well as the files that matched:

$ apt-file search bin/lsof
lsof: usr/bin/lsof
lsof: usr/sbin/lsof
aptapt-fileapt-getcommandsdebianlsofneatutilities
Generating Strong Passwords by cygnus on Apr 05, 2005 10:35 AM

Use the apg utility to generate strong mnemonic passwords:

$ apg -st

Please enter some random data (only first 8 are significant)
(eg. your old password):>
Coydgoceuk6 (Coyd-goc-euk-SIX)
Caculpyep7 (Cac-ulp-yep-SEVEN)
otevDet6 (ot-ev-Det-SIX)
Jiwacwarj6 (Ji-wac-warj-SIX)
gurkOnRyet1 (gurk-On-Ryet-ONE)
EbTarIv0 (Eb-Tar-Iv-ZERO)
apgcommandsgeneratemnemonicneatpasswordsecurityutilities
Installing a Specific Package Version by cygnus on Dec 20, 2005 02:04 PM

To use apt-get to install a specific (perhaps older) version of a package, follow the package name with an equals sign and the exact version number. For example:

# apt-get install bash=3.0-17
apt-getcommandsdebianneatpackagetroubleshootingversion
Mouse avoidance mode by cygnus on May 03, 2006 02:59 PM

Emacs features a minor mode, mouse-avoidance-mode, which causes the mouse to move away from the Emacs point when the point gets too close. This can be really helpful if you're used to moving your mouse away from the cursor to avoid typing "underneath" the mouse. In your custom-set-variables section in ~/.emacs, add the appropriate elisp:

(custom-set-variables
 .
 .
 '(mouse-avoidance-mode (quote animate) nil (avoid))
 .
 .

The animation parameters of mouse-avoidance-mode can be customized with M-x customize.

configurationeditorselispemacsmouseneat
Virtual Mapping by xinu on Jan 13, 2005 08:23 AM

Some virtual mapping goodness:

<VirtualHost *>
  ServerName cprogrammer.org
  ServerAlias cprogrammer.org *.cprogrammer.org

  # See the docs for the %-specs; %1 maps to the first part of the
  # domain (a.b.c.d.e -> a, a.b.c -> a)
  VirtualDocumentRoot /users/%1/public_html
  VirtualScriptAlias /users/%1/public_html/cgi-bin/
</VirtualHost>
apacheconfigurationmappingneatvirtualhost
RSS