Stephbul's wiki

Projects

Miscellanous

TIPS

sed -r s/[:space:]//g filename |wc 

nmap -v -sP 10.165.144.0/24

sed -r -e -i 's:WORDTOREPLACE:\
> :'g filename

echo yourbanner > /etc/motd.tail
echo yourbanner > /etc/motd

or also nice

figlet `hostname -s` > /etc/motd.tail
figlet `hostname -s` > /etc/motd

Create a file named config user's .ssh directory with following contents

TCPKeepAlive yes
ServerAliveInterval 60

find DIRECTORY/ -mindepth 1 -type d -print0 | xargs -0 rm -rf

 ldapadd -v -x -H "ldap://127.0.0.1:389" -D "cn=admin,dc=foo,dc=net" -W -f /path/to/foo.ldif

wth the following foo.ldif file

dn: dc=foo,dc=net
objectClass: dcObject
objectClass: organization
dc: foo   
o: foo
description: foo description

dn: cn=admin,dc=foo,dc=net
objectclass: organizationalRole
cn: admin

In slapd.conf, basedn has been set to dc=foo,dc=net

x2x permits to use one keyboard and mouse to use multiple X server. One server X is master (host A), other are slave (host B). On slaves, check that X is alloawed to listen as following:
In /etc/gdm/gdm.conf, you should have:

[security]
DisableallowTCP=false

gdm should be restarted to take this into account.

On slaves, allow master to connect with xhost command:

xhost +A

A is master IP or hostname.

On master, install x2x.
On debian:

apt-get install x2x

Type the following command:

x2x -east -to B:0.0

-east if B screen is on your right.
-west if B screen is on your left.
-north if B screen is above A screen.
-south if B screen is under A screen.

-to B:0.0 permits to use A keyboard-mouse to go to B X server.
-from B:0.0 permits to use B keyboard-mouse to go to A X server.

(cd /SRC_DIR && tar cf - . ) | (cd /TARGET_DIR && tar xvf -)

backup:

mysqldump -uusername -ppassword --all-databases > /path/to/backup/file.sql

restore

mysql database < backup-file.sql

LOG ON
  • Considering you have a CVS server configured in pserver mode, setup your CVSROOT by typing :
CVSROOT=:pserver:user@cvs.server.hostname:/path/to/cvsroot
export CVSROOT
  • Login to the CVS server :
$ cvs login
how to manage a project
  • If you want to create a new project, you must import it :
$ pwd
/home/user/mynewproject
$ cvs import mynewproject BigCorp START
$ cd ~
$ mv mynewproject mynewproject.orig 
$  

where START is the first tag. This tag is up to you.

  • To work on a CVS project, you must checkout its versionned tree :
$ cvs co mynewproject (by typing this, you will check out the last version of all files)
$ cvs co -r yourtag mynewproject (by typing this, you will check out the version that is tagged 'yourtag')
  • To tag a project
$ cvs tag yourtag myproject (will tag yourtag all the last version of the project)
  • Once you've made modification on it, commit the changes :
$ cvs commit modifiedscript.sh
$ cvs commit -r '1.3' modifiedscript.sh (by typing this, you will assign a revision)
  • If you create a new file on the project, add it to the CVS tree :
$ cvs add mynewscript.sh

Then commit it :

$ cvs commit mynewscript.sh

full tree update:

$ cvs update -dP * 

apt-get install nvidia-glx nvidia-settings nvidia-xconfig
  • Execute nvidia-xconfig

At the end, check that /etc/X11/xorg.conf has beedn updated with:

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection
  • /etc/init.d/gdm stop
  • /etc/init.d/gdm start
  • nvidia-settings for configuration

http://localhost:631

PASSWORD=yourpassword
ENCPASSWD=$(perl -e 'print crypt($PASSWORD, "password")' $PASSWORD)

apt-get install smbclient
apt-get install smbfs
# smbfs only needed if you use domain name instead of IP address to mount cifs

Add the following line in /etc/fstab

//server/sharing /mounting/path cifs user,rw,credentials=/etc/.cifscred,gid=1000,uid=1000 0 0

where /etc/.cifscred is a file with this:

username=xxxxxx
password=xxxxx

Type this command to take into account

mount -a

GLOBIGNORE is a comma-separated variable that is used to ignore patterns that should be expanded in a variable

$ BLAH=/home/stephbul/*
$ export GLOBIGNORE='*'
$ echo $BLAH
/home/stephbul/*

Usually full directory is listed.

Example: removing a file called .c

rm -- .c

The – string cancels interpretation of .c

$ blkid

sudo dpkg-reconfigure locales

and reboot.

Bounce email received on joe.pecci@blah.net to joe.pecci@foo.net

fetchmail -d 60 -p POP3 -u joe.pecci -v -D smtp.blah.net --smtpname joe.pecci@foo.net pop.blah.net smtp.blah.net

-d: daemonize each 60 seconds
-p: protocol to retrieve
-u: user name
-v: verbose
-D: domain
–smtpname: destination

find / -type f -name "*.pwet"

On machine (hostname is hostA) where to send data to backup:

$ netcat -l 3869 | tar xfp -

It starts netcat in listenning mode on port 3869, and will send received data to tar stdin.
On machine to backup (hostB)

tar cvfp - source-dir | netcat hostA 3869

where source-dir is the directory you want to backup.

dir(element)

dpkg -S binary

apt-get install linux-manual-2.6.30 manpages-dev

name=${fullpath##*/}
 
start.txt · Dernière modification: 2009/09/17 12:19 par stephbul
 
Sauf mention contraire, le contenu de ce wiki est placé sous la licence suivante:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki