bash

Use ‘mutt’ to send email with attachment

Posted on

The unix ‘mutt’ command can be used to send an email with attachment: mutt -s “Test message” name@something -a files.tar < message.txt where files.tar is the attached file, and message.txt is the file containing the message. Subject to the email is added with the -s option. In this case: -s “Test message” name@something is the […]

Database

Postgresql 8.1 database bash dump script

Posted on

I’ve wrote a simple bash script to dump databases from a Postgresql 8.1 database server which uses the pg_dump and pg_dumpall.

bash

tar

Posted on

Create a tar file of files located in a folder: tar -cvf filname.tar foldername/ where: c = create v = verbose f = file filname.tar = the created file ———- To show the content of a tar’ed file: tar -tvf filname.tar ———- extract a file with tar: tar -xvf filname.tar where x = extract v […]

PHP

Extract img url links from HTML document

Posted on

I needed to find and get a webpage’s img src url links. I wanted to do this with a script on a regular basis. The solution I found was to use PHP domdocument: http://stackoverflow.com/questions/138313/how-to-extract-img-src-title-and-alt-from-html-using-php

After spending some time using wget, cat, grep and so on to solve my problem, this little php code made […]

bash

ldapsearch users and places that contains æ, ø and å

Posted on

We needed to collect “Place” information per user from our LDAP server. The problem was that the description of the “Place” came out strangely encoded whenever it contained one of the norwegian characters æ,ø or å. The ldap command: ldapsearch -x -H ldap://ourldapserver.uib.no x121Address=XXXXXX where XXXXXX is the “place” code, gave a place description that […]

Ldap

Simple ldapsearch

Posted on

Search for information from a ldap server: Log in to server with: ssh servernavn Then type the command: ldapsearch -x -H ldap://ldapservername.uib.no uid=userid ldapsearch -x -H ldap://ldapservername.uib.no departmentnumber=XXXXXX where XXXXXX is placecode

Me "blogging"

Slette alle data på en harddisk

Posted on

Forfatters kommentar: Teksten under skrev jeg 3. april 2007 så verdenen kan ha endret seg siden den gang. Hvordan kan man fjerne alle dataene på en harddisk, og være sikker på at ingen kan rekonstruere dataene? Dessverre tror mange at det å formatere en harddisk fjerner dataene på disken. Formatering sletter kun referansene til filene […]