#tips

How to remove accentuated characters from a string with Python

Published 31st Aug 2011 // #python #tips

How to remove accentuated characters from a string with Python Easy : output = unicodedata.normalize('NFKD', input).encode('ASCII', 'ignore') If your input string is not unicode, you'll have to convert it first : output = unicodedata.normalize('NFKD', unicode (input, 'utf-8')).encode('ASCII', 'ignore')

How to remove accentuated characters from a string with C#

Published 31st Aug 2011 // #dotnet #tips

How to remove accentuated characters from a string with C public string RemoveAccentuatedCharacters(string input) { byte[] aOctets = System.Text.Encoding.GetEncoding(1251).GetBytes(input); return System.Text.Encoding.ASCII.GetString(aOctets); }

How to get all download links from a web page

Published 24th Aug 2011 // #javascript #tips

How to get all download links from a web page Here is a solution using GreaseMonkey (the page is in French but the code is understandable) : Comment récupérer tous les liens de téléchargement d'un page web

How to stop the startup beep with Debian Squeeze

Published 1st Jul 2011 // #debian #tips

How to stop the startup beep with Debian Squeeze By googling for an answer, I found out that the most popular way was to blacklist the module pcspkr : echo "blacklist pcspkr" >> /etc/modprobe.d/blacklist.conf Unfortunately it hasn't worked for me. In mt case I had to execute my favorite mixer (xfce-mixer) et mute

Install Oracle 10g on Centos 5.6

Published 17th Jun 2011 // #centos #oracle #tips

Install Oracle 10g on Centos 5.6 See : http://ivan.kartik.sk/oracle/install_ora10gR2_redhat.html The only thing you have to change is the startup scripts that does not correctly stop the service. With Centos it seems that the Kill script is not called if there is no file in /var/lock/subsys/. Instead you can use this one :…

Alternative to update-rc.d with Centos

Published 17th Jun 2011 // #centos #tips

Alternative to update-rc.d with Centos Add you file to /etc/init.d Make it executable : chmod +x /etc/init.d/YourFile Magic ... chkconfig --add YourFile --level 0356

How to install a new dictionnary in TortoiseSVN without installing the language pack

Published 17th Jun 2011 // #subversion #tips

How to install a new dictionnary in TortoiseSVN without installing the language pack Why ? I'm french but I'm so used to the english interface that I don't wan't to install the french language pack. But I like my commit messages to be easy to read so a spell checker is welcome. How

Windows 2008 R2 default FTP firewall rule don't work

Published 15th Jun 2011 // #tips #windows

Windows 2008 R2 default FTP firewall rule don't work If you just installed the FTP server on your new Windows Server 2008 R2 and begin to loose patience.... The default firewall rules don't work. The cleanest (IMHO) solution so far is to execute the following commands : sc sidtype ftpsvc unrestricted net stop

How to modify your firewall (iptables) setting with Centos

Published 11th Jun 2011 // #centos #tips

How to modify your firewall (iptables) setting with Centos With GUI Yes it's easy but you can only have very simple rules. File modification You can directly modify the file generated by the GUI but beware never use the gui after or you'll loose everything. So to sum up : Modify the following file :

How to install a SMP aware bzip2 with Centos

Published 10th Jun 2011 // #centos #tips

How to install a SMP aware bzip2 with Centos Two alternatives PBZIP2 lbzip2 My choice Get the rpm : wget http://img.cs.montana.edu/linux/centos/5.6/dag/x86_64/lbzip2-0.23-1.el5.rf.x86_64.rpm Install it : rpm -ivh lbzip2-0.23-1.el5.rf.x86_64.rpm Enjoy (the usage is the same as bzip2)

Handle ODBC sources with Windows

Published 10th Jun 2011 // #tips #windows

Handle ODBC sources with Windows Execute the following command : odbcad32

Install Zabbix agent on Centos 5.6

Published 10th Jun 2011 // #centos #tips

Install Zabbix agent on Centos 5.6 get the rpms from here. In my case (x64 Centos) : wget http://repo.andrewfarley.com/centos/5/x86_64/zabbix-1.8.3-1.x86_64.rpm wget http://repo.andrewfarley.com/centos/5/x86_64/zabbix-agent-1.8.3-1.x86_64.rpm Install the dependencies : yum install openssl-devel Install the rpms : rpm -ivh zabbix-1.8.3-1.x86_64.rpm rpm -ivh zabbix-agent-1.8.3-1.x86_64.rpm Edit your configuration file (at least to change the server IP) : vi /etc/zabbix/zabbix_agentd.conf In my case I also had to change the

How to download a file on a SFTP / SCP Linux server with Windows

Published 10th Jun 2011 // #tips #windows

How to download a file on a SFTP / SCP Linux server with Windows Get pscp.exe : http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Create a batch file like this : pscp.exe -P PORT -batch -pw PASSWORD USER@HOST:DIRECTORY/FILE . Note that the directory is relative to the home directory of the user used.

Scripting with Sql Server 2005

Published 28th May 2011 // #sqlserver #tips

Scripting with Sql Server 2005 Easiest way to go is to get sqlcmd from here, you'll have to get : sqlncli.msi : Microsoft SQL Server Native Client SQLServer2005_SQLCMD.msi There is many good tutorials around but to be quick the standard command line is sqlcmd -SServer -UUser -PPassword -dDatabase -iMyFile.sql You can also add -b to error

How to get your command history in Sqlplus with Linux

Published 19th May 2011 // #oracle #tips

How to get your command history in Sqlplus with Linux Install rlwrap aptitude install rlwrap Add an alias to your profile alias sqlplus='rlwrap sqlplus' Reload your profile and enjoy

How to get the day of week with bash/sh

Published 19th May 2011 // #tips

How to get the day of week with bash/sh Localized day of week : #!/bin/sh DOW=$(date +"%a") echo $DOW In english : #!/bin/sh LANG=C DOW=$(date +"%a") echo $DOW If you want to get current month, year, ... replace %a by anything found here

How to change the listening port of Sshd

Published 18th May 2011 // #tips

How to change the listening port of Sshd Modify /etc/ssh/sshd_config to change the line : Port 22 If you want to waste time .... update /etc/ssh/ssh_config :(

Failed to auto-start Oracle Net Listener using /ade/vikrkuma_new/oracle/bin/tnslsnr

Published 17th May 2011 // #oracle #tips

Failed to auto-start Oracle Net Listener using /ade/vikrkuma_new/oracle/bin/tnslsnr Edit the file $ORACLE_HOME/bin/dbstart to change this line ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle to ORACLE_HOME_LISTNER=$ORACLE_HOME More info here.

Error when starting Oracle Db Console (EMCTL)

Published 17th May 2011 // #oracle #tips

Error when starting Oracle Db Console (EMCTL) Error : OC4J Configuration issue. /opt/oracle/102/oc4j/j2ee/OC4J_DBConsole_oracle_NET not found. My SID is NET but the previous file does not exist and is replaced by OC4J_DBConsole_oracle_net. So simply rename the file to what he wants. More information here.

Slow write with Perc H200 and VMWare ESXi

Published 16th May 2011 // #tips #vmware

Slow write with Perc H200 and VMWare ESXi Problem I just bought a small Dell server Poweredge 110 II. I was all about saving money and keeping ESXi compatibility so I choose the Perc H200 as the raid card with 2 SATA drives. The installation works perfectly to the point where it feeled…

How to execute a perl instruction in a sh/batch file

Published 12th May 2011 // #perl #tips

How to execute a perl instruction in a sh/batch file perl -e "Your command here" Source : http://www.softpanorama.org/Scripting/Perlorama/perl_in_command_line.shtml

Things to check when an Asp.Net site is not working correctly

Published 6th May 2011 // #dotnet #tips

Things to check when an Asp.Net site is not working correctly TODO Framework Check that your .Net framework are correctly installed Check that your .Net framework are correctly linked with IIS In case of XP : use regiis to relink your framework with IIS In case of IIS6 or newer : don't forget to enable your…

How to start an Asp.Net application with Windows Seven x64 and Oracle 10g 32bits

Published 6th May 2011 // #dotnet #tips

How to start an Asp.Net application with Windows Seven x64 and Oracle 10g 32bits Problem I had a problem with a Windows Seven x64 with Oracle 10g 32Bits. My Asp.Net application didn't start because of Oracle. Full error : System.InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when…

How to get the list of locks with Oracle

Published 15th Mar 2011 // #oracle #tips

How to get the list of locks with Oracle Detection To be executed as SYSTEM : select session_id , serial# , c.status , substr(oracle_username,1,20) User_ORA , os_user_name User_os , substr(object_name,1,20) Objet ,…

How to get the list of open session for an username

Published 15th Mar 2011 // #oracle #tips

How to get the list of open session for an username To be executed as SYSTEM : select username, osuser, machine, terminal, status from v$session where username = 'MYUSER'

How to delete a service with Windows Server 2008

Published 11th Mar 2011 // #tips #windows

How to delete a service with Windows Server 2008 sc delete ServiceName

How to count the number of files in a directory

Published 8th Feb 2011 // #debian #tips

How to count the number of files in a directory Non recursive find targetdir -type f -maxdepth 1 | wc -l Recursive find targetdir -type f | wc -l Recursive and follow symlink find targetdir -type f -follow | wc -l

How to split a big XML file without running out of RAM

Published 7th Feb 2011 // #debian #tips

How to split a big XML file without running out of RAM aptitude install xml-twig-tools xml_split -s 5Mb MyBigXmlFile.xml More informations : http://search.cpan.org/~mirod/XML-Twig-3.35/tools/xml_split/xml_split

How to create a dvd structure with a mpg file

Published 7th Feb 2011 // #multimedia #tips

How to create a dvd structure with a mpg file First, you'll need dvdauthor : aptitude install dvdauthor Next, you'll have to create an xml (file.xml) file for dvdauthor : <dvdauthor> <vmgm /> <titleset> <titles>…

Extract the soundtrack of a DVD

Published 7th Feb 2011 // #multimedia #tips

Extract the soundtrack of a DVD Get the aid (audio id) of the wanted soundtrack mplayer -vc null -vo null -identify VTS_01_0.IFO Get a stream.dump file (or use -dumpfile to specify the filename) mplayer -vc null -vo null -aid 129 -dumpaudio VTS_01_0.IFO

Convert file to/from DOS format

Published 7th Feb 2011 // #debian #tips

Convert file to/from DOS format The point is to replace \r\n -> \n. Install aptitude install tofrodos Usage dos2unix unix2dos

Display GUI to an open X session with putty

Published 7th Feb 2011 // #debian #tips

Display GUI to an open X session with putty export DISPLAY=:0.0 yourCommand

Basic use of rsync

Published 7th Feb 2011 // #debian #tips

Basic use of rsync Mirror two directories : rsync -av --progress SourceDir/ DestinationDir/ Mirror two directories with compression : rsync -avz --progress SourceDir/ DestinationDir/ Mirro two directories and delete in destination what's been deleted in source (real mirroring) : rsync -avz --progress --delete --delete-after SourceDir/ DestinationDir/

How to create an iso of a CD / DVD

Published 7th Feb 2011 // #debian #tips

How to create an iso of a CD / DVD With dd dd if=/dev/cdrom of=myImage.iso bs=4096k or dd if=/dev/dvd of=myImage.iso bs=4096k With readcd aptitude install cdrecord umount /media/cdrom0 readcd dev=/dev/dvd f=myImage.iso If you want to have an idea of the speed of readcd, you can add "meshpoints=20 -factor" to your command line. It will output the speed each 5

How to add a new disk to an existing array

Published 7th Feb 2011 // #debian #tips

How to add a new disk to an existing array After a crash of one disk of my RAID 1 array I had to replace it : mdadm --add /dev/md0 /dev/hdb4 mdadm --grow /dev/md0 --raid-devices=1

How to remove trailing whitespace from a bunch of files

Published 7th Feb 2011 // #debian #tips

How to remove trailing whitespace from a bunch of files Linux files (and also Mac) find . -name '*.js' -exec sed -i 's/[[:blank:]]*\n$/\n/g' '{}' \; Windows files find . -name '*.js' -exec sed -i 's/[[:blank:]]*\r$/\r/g' '{}' \; Sed oneliners http://sed.sourceforge.net/sed1line.txt

Optimize PNG's size lossless

Published 7th Feb 2011 // #tips

Optimize PNG's size lossless Pngcrush http://pmt.sourceforge.net/pngcrush/ Usage : pngcrush -brute -e _small.png MyPngFile.png PNGOUT http://www.advsys.net/ken/util/pngout.htm

How to enable shutdown and reboot as a normal user with XFCE and Lenny

Published 7th Feb 2011 // #debian #tips

How to enable shutdown and reboot as a normal user with XFCE and Lenny Add yourself to the powerdev group gpasswd -a myFavoriteUser powerdev

How to start a program in background with screen

Published 7th Feb 2011 // #debian #tips

How to start a program in background with screen screen : http://www.gnu.org/software/screen/ Install aptitude install screen start a program in background screen -d -m <YourProgram> check the program screen -R And CTRL+A D to detach.

How to encode an existing audio track to aac

Published 7th Feb 2011 // #multimedia #tips

How to encode an existing audio track to aac #!/bin/sh mkfifo temp.wav screen -d -m mplayer "$1" -vc null -vo null -ao pcm:fast:waveheader:file=temp.wav ./neroAacEnc -ignorelength -q 0.30 -if temp.wav -of "$1.aac" rm temp.wav I use screen but you can also use & or two terminals. Sometimes mplayer is too worried about seeks and don't work

How to convert a file from ISO-8859-P1 to UTF-8

Published 7th Feb 2011 // #debian #tips

How to convert a file from ISO-8859-P1 to UTF-8 iconv --from-code=ISO-8859-1 --to-code=UTF-8 ./oldfile.txt > ./newfile.txt

Update a Dockstar uImage/uInitrd after a kernel update

Published 7th Feb 2011 // #dockstar #tips

Update a Dockstar uImage/uInitrd after a kernel update /usr/bin/mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.32-5 -d /boot/vmlinuz-2.6.32-5-kirkwood /boot/uImage /usr/bin/mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d /boot/initrd.img-2.6.32-5-kirkwood /boot/uInitrd

How to clone all the partitions of a disk

Published 7th Feb 2011 // #debian #tips

How to clone all the partitions of a disk If you want to create the same partitions as an existing disk and if those disks are exactly the same, then you can use the following command : sfdisk -d /dev/hda | sfdisk /dev/hdb

Copy/Paste with PuTTY on Linux

Published 7th Feb 2011 // #debian #tips

Copy/Paste with PuTTY on Linux Paste : middle click Copy : select with the right click http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter3.html#using-selection

How to use Neroaac with amd64

Published 7th Feb 2011 // #multimedia #tips

How to use Neroaac with amd64 aptitude install lib32stdc++6 aptitude install lib32gcc1

Access system menu with PuTTY on Linux

Published 7th Feb 2011 // #debian #tips

Access system menu with PuTTY on Linux CTRL + Right click. http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter3.html#using-sysmenu

How to make output of df/du readable

Published 7th Feb 2011 // #debian #tips

How to make output of df/du readable Use du -h --max-depth 1 df -h also applicable to many other linux programs : ls,...

Free VMWare virtual machine generator

Published 7th Feb 2011 // #tips #vmware

Free VMWare virtual machine generator http://www.easyvmx.com/

How to iconize an active remote desktop session

Published 7th Feb 2011 // #debian #tips

How to iconize an active remote desktop session Press Ctrl + Alt + Enter and reduce to icon.

How to install Oracle 10g with Windows Server 2008 R2 x64

Published 7th Feb 2011 // #oracle #tips #windows

How to install Oracle 10g with Windows Server 2008 R2 x64 Be sure to first start a command prompt with Administrator privilege and start the Oracle installer within this command prompt.

Use Excel VLOOKUP and HLOOKUP

Published 7th Feb 2011 // #tips

Use Excel VLOOKUP and HLOOKUP Link http://www.timeatlas.com/5_minute_tips/general/learning_vlookup_in_excel French translation VLOOKUP = RECHERCHEV HLOOKUP = RECHERCHEH

How to join two AVI files

Published 7th Feb 2011 // #multimedia #tips

How to join two AVI files mencoder -oac copy -ovc copy -noodml -idx part1.avi part2.avi -o complete.avi

How to get the numlock on startup with SLiM

Published 7th Feb 2011 // #debian #tips

How to get the numlock on startup with SLiM Edit the file /etc/slim.conf and change (and uncomment if necessary) numlock off with numlock on

How to install and configure ftp-proxy

Published 7th Feb 2011 // #debian #tips

How to install and configure ftp-proxy http://justnotes.co.cc/2010/01/13/ftp-proxy-in-ubuntu-installation-and-configuration/

How to "nice" the I/O

Published 7th Feb 2011 // #debian #tips

How to "nice" the I/O ionice : http://linux.die.net/man/1/ionice|ionice Install aptitude install util-linux Extreme case : only run a program when I/O is idle (root mandatory) : ionice -c3 xfs_fsr -t 600 An addition to my .bashrc to ensure my niced program also preserve my I/O alias nice='ionice -c2 -n7 nice' My source : http://gentoo-wiki.com/HOWTO_Light_Gentoo_Installation#Extra:_ionice

How to create an iso with a dvd structure

Published 7th Feb 2011 // #multimedia #tips

How to create an iso with a dvd structure You'll have to install mkisofs : aptitude install mkisofs and then use it : mkisofs -dvd-video -udf -o file.iso file

My swap is used a lot but I have ton of free RAM

Published 7th Feb 2011 // #debian #tips

My swap is used a lot but I have ton of free RAM There's a parameter called swappiness which control the way the kernel will use swap. It's a value between 0 (only use the swap when there is no memory left) and 100 (try to often offload the memory to

fusesmb doesn't find all my network shares

Published 7th Feb 2011 // #debian #tips

fusesmb doesn't find all my network shares You can force a scan of fusesmb with the following command : fusesmb.cache --

How to defrag an XFS partition

Published 7th Feb 2011 // #debian #tips

How to defrag an XFS partition Install aptitude install xfsdump Usage xfs_fsr -t 600 It will try to defrag all you XFS partition for 600 seconds (10 minutes).

How to reboot or shutdown within SLiM

Published 7th Feb 2011 // #debian #tips

How to reboot or shutdown within SLiM You can use magic username with root password to do magic things : halt : no comment ... reboot : still no comment ... suspend : suspend to RAM console : start a console exit : exit to the shell

How to rebuild the index of an AVI file

Published 7th Feb 2011 // #multimedia #tips

How to rebuild the index of an AVI file mencoder BadSource.avi -noskip -mc 0 -idx ovc copy -oac copy -o GoodOutput.avi

How to force fsck on the next reboot

Published 7th Feb 2011 // #debian #tips

How to force fsck on the next reboot su - cd / touch /forcefsck reboot