Friday, June 17, 2011

conditional authentication in apache

Just so I can find it later..


AuthType basic
AuthName "Sub Domain authentication"
AuthUserFile /var/www/virtual/.passwd
Require valid-user

Satisfy any
Order deny,allow
Deny from all
Allow from 192.168.100.0/24

Wednesday, May 25, 2011

ssh port forwarding

At home I have dnated port ssh to my trusty old PC. From time to time, while at work, I need to access services I run on that machine. For a while I used to use a OpenVPN vpn to gain access but lately I've had some forewall issues.

So I went back to the good old openssh. To bind port 8080 at my notebook to port 8080 at home I just run the following command:

ssh artista@frustrado.no-ip.org -L 8080:127.0.0.1:8080

Saturday, April 16, 2011

Xorg + Wacom Tablet - configuring dual monitor with tablet working on only one

I must admit: I love my dual display setting, a 2880x900 virtual display composed of 2 19" monitors alamost as much I love sketching with my tablet. If you have seen any recent posts at pincel quebrado (broken brush) you can see how much I've been toying around with my tablets and Gimp and Krita.

But dual display and tablet configurations always had one huge problem: the x-server only uses half of the height of the tablet so it can set the right width. It is a pain to use only half of the tablet so for many years I've disabled dual head and lately created a user for only this purpose that I'd start in another x-session.

Digging through the piles of senseless info available in the web I finally found the solution to the problem, which now seems stupidly obvious: xsetwacom

For setting dual display on my desktop I use:


xrandr --output DVI-0 --right-of VGA-0


Which puts my DVI monitor at the right of my VGA monitor. Then use xset wacom to restrict my tablet to my DVI, right, monitor:


xsetwacom set "Wacom Intuos2 9x12 stylus" "MapToOutput" DVI-0
xsetwacom set "Wacom Intuos2 9x12 eraser" "MapToOutput" DVI-0
xsetwacom set "Wacom Intuos2 9x12 cursor" "MapToOutput" DVI-0

Thursday, March 17, 2011

reset redmine password throught the commmand line

Copied and pasted form http://bitnami.org/forums/forums/redmine/topics/lost-redmine-adminstrator-password

$ cd ${installdir}
$ ./use_redmine
$ cd ${installdir}/apps/redmine
$ ruby script/console production

>> u = User.first
>> u.password = u.password_confirmation = "newpassword"
>> u.save
>> exit

Saturday, October 24, 2009

Compile Scribus from SVN

I've made another script for compiling Scribus desktop publishing app from it's SVN repository.

As all my scripts for compiling stuff, I've published it at my github account.

Do clone the git repository go here. To download the script click here.

Compile cinepaint from CVS

Cinepaint is a fork of GIMP version 1.0.4 that emerged from the needs of the movie industry which were not being considered by the GIMP developers at the time. It's main purpose is to be a tool for frame-by-frame retouching, dirt removal, wire rig removal, render repair, background plates, and painting 3D model textures .It is widely used in the movie making industry, Hollywood, and has been used by the following companies for their movies:


  • Amalgamated Pixels (Elf, Looney Tunes)

  • Computer Cafe (League of Extraordinary Gentlemen)

  • Flash Film Works (Duplex, The Last Samurai)

  • Hammerhead (Showtime, Blue Crush, 2 Fast, 2 Furious)

  • Rhythm & Hues (Harry Potter, Cats & Dogs, Dr. Dolittle 2, Little Nicky, Grinch, Sixth Day, Stuart Little, Planet of the Apes)

  • Sony Pictures Imageworks (Stuart Little II, Spider-Man)



Since there is no version of Cinepaint packaged for Debian anymore, since it used to rely on GTK 1, I've decided to create another script for compiling it. It is based on Robin Rowe's ubuntu-cvs.sh script

I've published it with my other scripts for compiling Apps at my acount at github.com. To visit the project page at github click here. To download the latest version click here.

Tuesday, August 4, 2009

Compiling the GIMP from GIT

As the GIMP, as well as all gnome packages, have switched from SVN to GIT I've updated my compiling script to use the GIT sources.

You can download the script form here

Below is the listing of the script


#!/bin/bash

co_compile_install()
{
DIR=$1
PARAMS=$2
COMMAND=$3
echo "Installing $DIR"

# bash check if directory exists
if [ -d $DIR ]; then
echo "Directory exists - UPDATING"
cd $DIR
#svn update
git pull
else
echo "Directory does not exists - CHECKING OUT"
#svn checkout "http://svn.gnome.org/svn/$DIR/trunk" "$DIR"
git clone git://git.gnome.org/$DIR
cd $DIR
fi

if [ -n $COMMAND ]
then
eval $COMMAND
fi

./autogen.sh
pwd
./configure --prefix=/opt/gimp-svn $PARAMS && make && make install
cd ..
}

# GLIB
co_compile_install "glib"

export PATH=/opt/gimp-svn/bin:$PATH
export LD_LIBRARY_PATH=/opt/gimp-svn/lib
export PKG_CONFIG_PATH=/opt/gimp-svn/lib/pkgconfig

# GTK
co_compile_install "gtk+" "--with-xinput=yes --disable-gtk-doc" "sed -r 's#(automake|aclocal)-1.7#\1#g' -i autogen.sh"
#co_compile_install "gtk+" "--with-xinput=yes --disable-gtk-doc"
# BABL
co_compile_install "babl"
# GEGL
co_compile_install "gegl" "" "sed -r 's:#include :#include :g' -i operations/external/ff-load.c"

export PATH=/opt/gimp-svn/bin:$PATH
export LD_LIBRARY_PATH=/opt/gimp-svn/lib
export PKG_CONFIG_PATH=/opt/gimp-svn/lib/pkgconfig

# GIMP
co_compile_install "gimp" "--enable-gimp-remote --prefix=/opt/gimp-svn/ --with-gimpdir=.gimp-svn"

Compiling Sane from GIT

My trusty old scanjet 4c just gave up a few months ago and all I was left with was a crappy Scanjet ScanJet G2710, which has a really basic driver. And basic I mean it can only be trusted to scan BW drawings, not even grayscale gets a decent result.

But that was not the only problem. Even though I use Debian SID (unstable) in all my workstations the sane backends were not detecting my scanner so I've had to compile from the sources. Being lazy, one of the big virtues of a hacker according to Eric Raymond, I've created a bash script to fetch the sources from CVS, compile and install sane.

Now that sane has switched to GIT I've rewrote the script and added a patch to xsane so I would not have to manually declare the SANE_CAP_ALWAYS_SETTABLE constant, which has been removed by sane but is still used by xsane. I seems Oliver Rauch has some problems with the way the sane development is going and is not updating xsane to conform to the changes made to the sane backends.

You can download the script form here

Below is the listing of the script

#!/bin/bash

co_compile_install()
{
DIR=$1
PARAMS=$2
COMMAND=$3
if [ -d $DIR ]; then
echo "Directory exists - UPDATING"
cd $DIR
#svn update
git pull
else
echo "Directory does not exists - CHECKING OUT"
git clone git://git.debian.org/sane/$DIR
cd $DIR
fi

if [ -n $COMMAND ]
then
eval $COMMAND
fi

./autogen.sh
pwd
./configure --sysconfdir=/etc --prefix=/usr && make && make install
cd ..
}

co_compile_install sane-backends.git
co_compile_install sane-frontends.git

wget ftp://ftp.sane-project.org/pub/sane/xsane/xsane-0.996.tar.gz
tar -zxvf xsane-0.996.tar.gz
cd xsane-0.996

rm -f /tmp/xsane-back-gtk.h.diff
cat >> /tmp/xsane-back-gtk.h.diff << EOF
55a56
> #define SANE_CAP_ALWAYS_SETTABLE 7
EOF
patch src/xsane-back-gtk.h /tmp/xsane-back-gtk.h.diff
rm -f /tmp/xsane-back-gtk.h.diff

./configure --sysconfdir=/etc --prefix=/usr && make && make install

Monday, June 1, 2009

TRIP-SL - FISL 10

According to Ricardo Soares GuimarĂ£es there are only a few spots on the bus. Below is the logo I developed for the trip.

For more information about the trip check TRIP-SL.

Sunday, March 15, 2009

Compile Inkscape from svn - packaged

As it my seem obvious to anyone who know me, I do not like to wait for new features to fall into the stable releases of debian, especially when the subject are ilustration and design apps. I've been compiling and running paralell versions of gimp, inkscape and scribus for a quite a few years now. Today, while compiling inkscape into my notebook, 'cause my desktop is "in mantainance" provenient of a font failure, I decided to package the script into a debian package which will install all the dependencies for compiling, check out inkscape from it's SVN repository and compile it with inkboard, python and perl suport.

The package is at: inkscape-frustrado-svn_0.0.1-1_all.deb

To install it run:

wget http://www.frustrado.com.br/download/inkscape-frustrado-svn_0.0.1-1_all.deb
dpkg -i http://www.frustrado.com.br/download/inkscape-frustrado-svn_0.0.1-1_all.deb


Be patient. It may take quite a while.

Wednesday, March 11, 2009

Installing GIMP from SVN

I've been a great fan o the GIMP for many years now. The problem is that I'm not patient enough to wait until the new features apear on he stable versions so I've been running 2 versions of GIMP on my computer: the debian packaged one and one compiled from the project SVN repository.

Below is my bash script to install/update. If you want to download the shell script I have uploaded it here.



#!/bin/bash

co_compile_install()
{
DIR=$1
PARAMS=$2
COMMAND=$3
echo "Installing $DIR"

# bash check if directory exists
if [ -d $DIR ]; then
echo "Directory exists - UPDATING"
cd $DIR
svn update
else
echo "Directory does not exists - CHECKING OUT"
svn checkout "http://svn.gnome.org/svn/$DIR/trunk" "$DIR"
cd $DIR
fi

if [ -n $COMMAND ]
then
eval $COMMAND
fi

./autogen.sh
./configure --prefix=/opt/gimp-svn $PARAMS && make && make install
cd ..
}

apt-get install automake1.7

# GLIB
co_compile_install "glib"

export PATH=/opt/gimp-svn/bin:$PATH
export LD_LIBRARY_PATH=/opt/gimp-svn/lib
export PKG_CONFIG_PATH=/opt/gimp-svn/lib/pkgconfig

# GTK
co_compile_install "gtk+" "--with-xinput=yes --disable-gtk-doc" "sed -r 's#(automake|aclocal)-1.7#\1#g' -i autogen.sh"
co_compile_install "gtk+" "--with-xinput=yes --disable-gtk-doc"

# BABL
co_compile_install "babl"

# GEGL
co_compile_install "gegl" "" "sed -r 's:#include :#include :g' -i operations/external/ff-load.c"

export PATH=/opt/gimp-svn/bin:$PATH
export LD_LIBRARY_PATH=/opt/gimp-svn/lib
export PKG_CONFIG_PATH=/opt/gimp-svn/lib/pkgconfig

# GIMP
co_compile_install "gimp" "--enable-gimp-remote --prefix=/opt/gimp-svn/ --program-suffix=-svn --with-gimpdir=.gimp-svn"

Monday, March 9, 2009

Web Services Tutorial

Uzed asked me to write a tutorial about SOAP using languages other than PHP. After much thought I decided to do a Introduction to Web Services tutorial as I think many of the people he was trying to explain soap do not have a good grasp on the basics of web servrices.

OBS: The tutorial is in Portuguese (pt_BR)

Friday, February 27, 2009

Create ISO images from cd and dvd

Just a quick one

dd if=/dev/dvd of=dvd.iso # for dvd
dd if=/dev/cdrom of=cd.iso # for cdrom
dd if=/dev/scd0 of=cd.iso # if cdrom is scsi

Sunday, November 16, 2008

Launching an application at the begining of the desktop session

I've been searching for a way to launch an application when the user logs in the desktop for quite a while now. After a few weeks looking into gconf I've stumbled on a simple and powerfull solution to my problem: the Desktop Application Autostart Specification.

The solution is quite simple: just create an .desktop file at /etc/xdg/autostart/ and the application will be launched when the desktop session in any freedesktop.org compliant desktop.

Wednesday, October 29, 2008

Autostart application on desktop session startup (GNOME|KDE)

I've being needing a way to launch applications on the start of a user desktop session for a academic lab management system I've been toying around with for the last few weeks. I've search the web, asked on the propper IRC channels and most of what I had found wasn't enough for my needs: gnome-session can only register app launching for earch user and I needed something system wide.

I do not even remember where I've found info about it but the freedesktop.org has a spec for just this kind o thing: Desktop Application Autostart Specification. THe main idea is to just place a .desktop file in a specific directory: /etc/xdg/autostart/.

Friday, April 25, 2008

Installing Virtualbox in debian etch using backports.org

Add the the following respository to /etc/apt/sources.list

deb http://www.backports.org/debian etch-backports main contrib non-free

run

apt-get update
apt-get -t etch-backports install virtualbox-ose virtualbox-ose-source

to install VirtualBox

apt-get install module-assistant
module-assistant update
module-assistant unpack virtualbox-ose
module-assistant auto-install virtualbox-ose

to compile and install the kernel module

modprobe vboxdrv

to load the kernel module

adduser yourlogin vboxusers

to add your user to the vboxusers group


Wednesday, March 5, 2008

WinFF - Multiplattaform video converter



Just happens that my girlfriend needed a video conversion app. After testing many of the available ones I found WinFF, a free (as in freedom) front end to ffmpeg writen in Free Pascal.



It's interface is quite simplistic and was designed to be a bach converter.

The project home is at http://biggmatt.com/winff/ and the debian package is at http://biggmatt.com/files/winff-0.33-i386.deb and the MS Windows installer is at http://biggmatt.com/files/winffsetup.exe

I hope it is usefull

Monday, February 11, 2008

Installing virtualbox on debian etch

I've being using virtualbox on my debian sid boxes for almost an year now. The problem is that debian stable (etch) does not have the packages for virtualbox and I've been asked to explain how to install it.

here it goes:

1 - install dependencies:

apt-get install libqt3-mt libxalan110 libxerces27

2 - add the virtualbox repository to your list:

echo "deb http://www.virtualbox.org/debian etch non-free" >> /etc/apt/sources.list
wget -q http://www.virtualbox.org/debian/innotek.asc -O- | sudo apt-key add -
apt-get update

3 - install kernel headers so you can compile the vbox kernel module

apt-get install linux-headers-$(uname -r)

4 - install virtual box:

apt-get install virtualbox

5 - compile the kernel module:

/etc/init.d/vboxdrv setup

6 - Add the users to the vboxusers group (change for the user login)

adduser vboxusers

7 - Create an virtual machine folowing the steps of the tutorial at:

http://opencomputer.net/2008/02/11/virtualization-done-easily-with-virtualbox/

Saturday, January 26, 2008

Magick from the command line

Last night my girlfriend told me that she needed to convert an PDF file into a PNG sequence, crop it and regenerate the PDF. She, a biology teacher, was planning on taking screenshots of the PDF files and crop it using the Gimp. She never told me how she was going to recreate the PDF file though.

Being an true hacker, in the sense that I can't see an unsolved problem, I decied to post a better way of doing it so she can read it from anywhere she is, as long as internet access is not a problem.

Here it goes:
We will be using the folowing plataform:
And the simple steps:

1 - install imagemagick if not already installed.

If the command "dpkg --list | grep imagemagick" returns anything ImageMagick is already installed and you can skip this part.
Use synaptic, aptitude or apt-get to install. In the example I'll use apt-get because it is what I usually use (old habits die hard)
apt-get install imagemagick

2 - convert PDF file into an sequence of PNG files

convert BrOoZine006.pdf pg-%03d.png

3 - crop the images:

Since I'll be croping the image to half it's size I'll ask for the image size:
identify -format "%wx%h" pg-000.png
convert -crop 595x421+0+0 pg-000.png out.png

4 - reasemble the pdf file from it's parts

convert *.png final.pdf

5 - Script

And here we have a functional script that takes as parameters the name of the original PDF and the new PDF file.
#!/bin/bash

PDF_IN=$1
PDF_OUT=$

mkdir imgs croped

convert $PDF_IN imgs/pg-%03d.png

WIDTH_ORI=$(identify -format "%w" imgs/pg-000.png)
HEIGHT_ORI=$(identify -format "%h" imgs/pg-000.png)

WIDTH_NEW=$(echo "$WIDTH_ORI / 2" | bc)

COUNTER=0

for FILE in $(ls imgs/*.png|sort)
do
NEWFILE=$(printf "%03d" $COUNTER)
DESTFILE=$(echo $FILE| sed -r "s#imgs/.*\$#croped/$NEWFILE.png#g")
convert -crop $WIDTH_NEW"x"$HEIGHT_ORI"+0+0" $FILE $DESTFILE
COUNTER=$(echo "$COUNTER + 1" | bc)
NEWFILE=$(printf "%03d" $COUNTER)
DESTFILE=$(echo $FILE| sed -r "s#imgs/.*\$#croped/$NEWFILE.png#g")
convert -crop $WIDTH_NEW"x"$HEIGHT_ORI"+"$WIDTH_NEW"+0" $FILE $DESTFILE
COUNTER=$(echo "$COUNTER + 1" | bc)
done

convert croped/*.png $PDF_OUT.pdf

rm -fr imgs croped

Copy the script above, paste it into a text file and then execute:
bash scriptname pdf_file new_pdf_file


resources:

Friday, January 25, 2008

New project - DDREditor

I've created a project on SourceForge.net to host an app I've being toying since the new year break.

When it get to a point where it actually work it is supposed to be an Digital Didatic Resource Editor which aims to create and edit digital (and pre-press) cources using an integrated Learning Objects repository.

I'm using a small subset of docbook as my storage format and the app is being written in python with a gtk interface.

for more information go the the project's website or the project's Project Page at SF.

If anyone is interest on the subject please contact me.