Wednesday, September 15, 2010

Ear phone not working in HP Pavillion

Here is what I had do add to my /etc/modprobe.d/alsa-base.conf so my ear phones start working, without it when I plugged it nothing changes, the sound keep going out only by the speakers.

Those are the magic lines:

alias snd-card-0 snd-hda-intel
alias snd-card-1 snd-usb-audio
alias sound-slot-0 snd-hda-intel
options snd-hda-intel index=0 model=hp-dv5 enable-msi=1 position-fix=1
options snd-usb-audio index=1

Peace!

Things I usually add to my bashrc

Here are some little things I usually like to add to my bash configuration, since I used debian the file is /etc/bash.bashrc, but could also be ~/.bashrc:

readonly HISTTIMEFORMAT="%d/%m/%Y at %T: "
readonly HISTFILESIZE=5000
export HISTCONTROL="erasedups"
readonly command_oriented_history=1
export HISTTIMEFORMAT HISTFILESIZE HISTCONTROL command_oriented_history
source /usr/bin/funcoeszz
shopt -s histappend
shopt -s cdspell
shopt -s dirspell
history -a
set -o vi
if [ -x /usr/games/fortune ]; then
        echo
        /usr/games/fortune -a
        echo
fi

Much funnier than default!

Monday, September 13, 2010

Backup Files Bigger than 4Gb in FAT Filesystems

Sometimes we need to copy files to Fat filesystem that are larger than 4Gb, which this filesystem do not support, if I need to do that just for some period (as backup), I use the following:

$ rar a -m0 -v500M -R <rar-file-name> <original-file>

It won't compress the file (-m0 parameter) and will divide the file into smaller 500M file (-v500M parameter).

I already used it in a lot of situations where I really needed to free some space in a more decent filesystem (usually my XFS home or root partitions).

Peace!

Backup with rsync

Millions of years after the last post I decided to make it come to live again, lets see for how long.

Simple, simple thing to start the new era, that's how I am usually making the backups from my work directory in my machine to the external disk:

rsync -av --link-dest=/Backups/2010-09-07/ ~/Work/ /Backups//2010-09-08/

This way everything that already exists in the previous backup (2010-09-10 directory) will be hard linked to the new backup, so my space is not all wasted and I can keep track of what was changed from backup to backup.

That's funny how the size is shown when you use those hard links:

$ mkdir 1 2
$ dd if=/dev/zero of=./1/somefile bs=1k count=5120
5120+0 records in
5120+0 records out
5242880 bytes (5.2 MB) copied, 0.0218812 s, 240 MB/s

$ ls -lrth *
2:
total 0

1:
total 5.0M
-rw-r--r-- 1 andre wheel 5.0M Sep 13 17:32 somefile

$ ln 1/somefile 2/somefile-hard-link
$ ls -lrth *
1:
total 5.0M
-rw-r--r-- 2 andre wheel 5.0M Sep 13 17:32 somefile

2:
total 5.0M
-rw-r--r-- 2 andre wheel 5.0M Sep 13 17:32 somefile-hard-link

$ du -ksh *
5.0M    1
0       2

$ rm 1/somefile

$ ls -lrth *
2:
total 5.0M
-rw-r--r-- 1 andre wheel 5.0M Sep 13 17:32 somefile-hard-link

1:
total 0

$ du -ksh *
0       1
5.0M    2

Nice, hm?

Wednesday, February 13, 2008

Configurando Nail para conta do Gmail

Complementando o e-mail anterior, segue descrição de como configurar o comando "nail" para enviar e-mails através de uma conta do gmail.

Adicione as seguintes linhas no arquivo ~/.mailrc (dependendo da configuração do nail pode ser ~/.nailrc):

account |NOME DA CONTA| {
set imap-use-starttls
set smtp-use-starttls
set folder=imap://|SEU USUARIO|@gmail.com
set smtp=smtp://smtp.gmail.com:587
set from="|SEU USUARIO|@gmail.com (|SUA SENHA|)"
set smtp-auth=login
set smtp-auth-user=|SEU USUARIO|
set smtp-auth-password=|SUA SENHA|
set MBOX=~/.maildir
}

Onde os valores entre "|" são variáveis que devem ser alteradas com os dados particulares de cada um.

Saturday, February 9, 2008

getIP: Enviando seu IP via e-mail

Eu sempre acesso o meu micro remotamente. Sempre. Tenho IP dinâmico e uma conta no DynDns.org que o meu roteadorzinho está sempre atualizando, porém essa semana ele não atualizou o endereço, deu uma mensagem que não conseguiu e só! O router não é aberto o suficiente para que eu possa debugar melhor.

Resultado, escrevi esse script para verificar meu ip no site http://whatismyip.com, e, se ele tiver sido alterado, ele envia um e-mail para mim com o novo IP.

Bem simples, já devem ter milhares de scripts assim mundo afora.

De qualquer forma deixo ele aqui para quem quiser.

Pré Requisitos:
Navegador modo texto (recomendado: links)
E-mail modo texto (recomendado: nail)

E aqui está o script:

http://www.dc.ufscar.br/~andre_saunite/scripts/getIP.sh

Friday, January 11, 2008

Engraçado...

Engraçado como ninguém quer morrer mas todos querem que as semanas passem rápido...