Tuesday, August 26, 2014

Create a database and grant all priviliges to a new user with mysql

Log in with password :

  mysql -u root -p

Create a database:

  create database mydatabasename;

Create a user with full privilege on that database :

  grant all on mydatabasename.* to mydatabaseuser@localhost identified by 'somepassword';

That's all folks.

Monday, July 21, 2014

Windows 7 : how to script hibernation with cygwin

This will create a command for bash in cygwin, which will put your PC in hibernate state.
    alias hibernate='/cygdrive/c/Windows/System32/rundll32.exe powrprof.dll,SetSuspendState Hibernate'
So now you can launch a compilation or a test, launch the following command, lock your screen and go home.
    sleep 3600; hibernate
After one hour, the PC will dump his memory to the hard disk and turn the power off.

The next morning, turn the PC on, it will restore his state, and you can review the result of your last task.

Maven lifecycle

  • validate
  • compile
  • test
  • package
  • integration-test
  • verify
  • install
  • deploy

How to use git-svn

Installation :

For debian or ubuntu :
    apt-get install git-svn

First use :

    git svn clone http://svn.your_company.com/your_project/trunk/
    cd trunk
    ls -l
The match between the revision numbers of git dans svn is in ".git/logs/refs/remotes/git-svn"

To "compress" git :

    git gc

The following uses :

    git svn fetch
    git svn rebase

How to preserve local changes (à la "svn update") :

    git svn fetch

    git stash
    git svn rebase
    git stash pop

Simple test :

This will delete local files and restore them from the local git repository.
    rm -rf some_directories_or_files
    git checkout .
    ls -l

SVN - change file properties

Here is how to set a file as executable :
     svn propset svn:executable ON nom_du_fichier
and reverse it :
     svn propdel svn:executable nom_du_fichier
Here is how to indicate that a file is a text (in order to "svn diff" and automatic conflict resolution to work) :
     svn propset svn:mime-type text/plain nom_du_fichier
and how to indicate a is "binairy" :
     svn propset svn:mime-type application/octet-stream nom_du_fichier

Thursday, July 17, 2014

Compile Mksquashfs 4.3 for Windows with Cygwin

Here is a way to compile the squashfs-tools, to produce squashfs from windows.

You must install cygwin with those packages :

  • gcc-core
  • make
  • zlib-devel (which is in the "Libs" section, but not in "devel" section)

Then download squashfs-tools from sourceforge.

Here is the simple procedure :

    tar xvzf squashfs4.3.tar.gz

    cd squashfs4.3/squashfs-tools

    make EXTRA_CFLAGS="-Dlinux -DFNM_EXTMATCH='(1<<5)' -D'sigtimedwait(a,b,c)=sigwaitinfo(a,b)'"
...et voilà !

I did not found any problem, but this trick replaces "sigtimedwait" with "sigwaitinfo". Those two functions does the same except that sigtimedwait has a timeout. So you may expect some lock up, in some conditions.

Happy squashing with that !