Programming Tutorials → Commands for dealing with branching
These commands are used to deal with tagging and branching in SVN:
$ cd /path/to/project && svn copy trunk branches/mybranch-N && svn commit -m 'Created new branch'
$ cd /path/to/project/branches/mybranch-N
Read more...
$ cd /path/to/project && svn copy trunk branches/mybranch-N && svn commit -m 'Created new branch'
$ cd /path/to/project/branches/mybranch-N
29-10-2010, 08:31 | Views: 308
Programming Tutorials → Add Line Numbers
Add line numbers to your source code with expand and some quick perl:
expand /etc/motd | perl -pe 's/^/\t=$.=\t/'
Read more...
expand /etc/motd | perl -pe 's/^/\t=$.=\t/'
29-10-2010, 08:30 | Views: 418
Programming Tutorials → Adding Users with Passwords
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
Read more...
(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
29-10-2010, 08:28 | Views: 406
Programming Tutorials → Adding Services
To add a service to boot automatically on startup, do the following:
# chkconfig --level 345 on
Read more...
# chkconfig --level 345 on
29-10-2010, 08:26 | Views: 368
Programming Tutorials → Adding a Database and a User
To create a Postgres user sam and a database samdb that is owned by the sam user:
$ su - postgres
$ createuser -P -A -D sam
$ createdb -O sam samdb
(Change the -A, and -D options to affect the new user's abilities.)
Read more...
$ su - postgres
$ createuser -P -A -D sam
$ createdb -O sam samdb
(Change the -A, and -D options to affect the new user's abilities.)
29-10-2010, 08:26 | Views: 380
Programming Tutorials → Add a Newline to the End of a File
Use sed to add a newline to the end of a file (this will perform an in-place replacement and create a backup file, MYFILE.bak):
$ sed -i.bak '$G' MYFILE
Some programs, such as Emacs, will omit the trailing newline from a file unless configured to add one. Emacs can be configured to add a newline automatically.
Read more...
$ sed -i.bak '$G' MYFILE
Some programs, such as Emacs, will omit the trailing newline from a file unless configured to add one. Emacs can be configured to add a newline automatically.
29-10-2010, 08:25 | Views: 350
