Skip to content

Instantly share code, notes, and snippets.

@npero
npero / unzip.tgz
Last active January 4, 2016 13:39
Unzip filename.tgz
gzip -cd <filename.tgz> | tar xvf -
tar -zcvf archive-name.tar.gz directory-name
@npero
npero / gist:6623260
Created September 19, 2013 13:10
DB script to add missing UTG_THRESHOLDUNIT codedetail to Municipality. (cfr Henk and Rita request from Nova signet)
INSERT into DICCODEDETAIL (IDDICCODE,IDSYSNOVAINSTANCE,IDDICMUNICIPALITY,CODEDETAIL,DESCRIPTION,LANGUAGE,RANKING,LASTUPDATE)
select * from (select IDDICCODE,2,IDDICMUNICIPALITY,CODEDETAIL,DESCRIPTION,LANGUAGE,RANKING, count(*) over ( partition by codedetail, language) total from diccodedetail a where iddiccode = 'UTG_THRESHOLDUNIT' ) where total = 1
;
@npero
npero / Ubuntu Shared Folder
Created August 17, 2013 15:06
This is the scenario that you run Windows as your host operating system and Ubuntu in a VirtualBox, and that you want to access a specific Windows folder from Ubuntu.
First you have to make sure that have install Guest Additions. From the VirtualBox's menu go to Devices → Install Guest Additions... This will mount a virtual CD on your /media/cdrom. Normally this folder's window will show up. As root run the program VBoxLinuxAdditions.run. When the program completes reboot your VirtualBox.
With Guest Additions installed you may now go ahead and define the shared folder(s). From the VirtualBox's menu go to Devices → Shared Folders. A dialog will show up. In this dialog you can specify which folder from your Windows system you want to share with your Ubuntu. Press the button with the + symbol to add a new shared folder in the list. You will have to specify a Folder Name for each folder you add. Make sure you memorize that name because you will need it very soon.
When done with you shared folder(s) specification, you may now go ahead and actually mount these folders from Ubuntu. First you have to create a mounpoint, that is, a directory in your Ubuntu which will reflect the
@npero
npero / ViewObject Attributes
Last active December 19, 2015 16:29
Retrieve list of all ADF ViewObject attributes.
sed -n 's/.*AliasName="\([^"]*\)"/\1/p' anyViewObject.xml > file1;
sed -n 's/.* Name=\("[^"]*"\)/\1/p' SearchtgudossierView.xml > file2;
awk 'BEGIN {OFS=" "}{
getline line < "file2"
print $0,"=",line,","
} ' file1;
rm file1 file2;
@npero
npero / gist:4627836
Created January 24, 2013 21:16
Robot Framework : How to make a FOR LOOP
:FOR ${a} IN @{as}
\ Do something with ${a}
What you need to remember:
1. After the line with FOR every line that relates to loop should start with \ (backslash)
2. After the backslash you need to make 2 spaces at least!
@npero
npero / gist:4473917
Last active December 10, 2015 18:18
Git svn : Start-up
.Create and prepare local git repository from svn repository
$git svn init https://.../trunk Nova
$git svn fetch -rHEAD (without all previous history) or $git svn fetch -r<revision>:HEAD (consider all previous history from any svn revision)
.Update from svn repository or commit to it
$git svn rebase
$git svn dcommit
@npero
npero / gist:4453544
Created January 4, 2013 15:40
Batch script to replace spaces by underscore in list of filenames (recursively).
find . -name "*.doc" | while read file; do new_file=$(echo $file | sed s/\ /_/g); mv "$file" "$new_file"; done
@npero
npero / gist:4176519
Created November 30, 2012 15:43
Git revert from all changes(untracked, unversionned, staged)
git reset --hard # removes staged and working directory changes
git clean -f -d # remove untracked files
git clean -f -x -d # CAUTION: as above but removes ignored files like config.
http://www.kernel.org/pub/software/scm/git/docs/git-clean.html
@npero
npero / gist:4153923
Created November 27, 2012 12:11
Setting global git ignore
git config --global core.excludesfile '~/.gitignore'
@npero
npero / gist:4085347
Created November 16, 2012 08:07
svn helpful command
$ svn status --no-ignore
$ svn propget svn:ignore
$ svn propset svn:ignore "*.xml" dir_name