POP Keywords: apache oracle sybase ...

unix – compare folder tree and identify files which are different

Very easy: sources diff -arq folder1 folder2 http://stackoverflow.com/questions/1644593/unix-compare-two-folders-which-has-many-files-inside-contents

unix – use ps and grep to kill processes [solved]

To kill specific processes in one go, use below syntax: kill $(ps aux | grep ‘[m]y_specific_process’ | awk ‘{print $2}’) Note: using ‘[]’ is a hack to prevent grep process from being included in returned output sources http://stackoverflow.com/questions/3510673/find-and-kill-a-process-in-one-line-using-bash-and-regex

oracle – how to dump query output into csv file via cli [solved]

A way to do it is to use sqlplus script. create file to execute with below content (vi my_query.sql): SET ECHO OFF; SET LINESIZE 32767; SET TAB OFF; SET NEWPAGE NONE; SET PAGESIZE 32767; SET LONG 100000000; SET HEADING ON; SET WRAP OFF; SET SCAN OFF; SET FEEDBACK OFF; SET SERVEROUTPUT ON; SET HEADSEP OFF; SET PAGESIZE 0; SET TRIMSPOOL ON; SET COLSEP ‘,’; ALTER SESSION SET NLS_DATE_FORMAT=’YYYYMMDD’; SPOOL /path/to/my_query.out <paste_sql_query_here> COMMIT; EXIT; call sqlplus as per below: $ORACLE_HOME/bin/sqlplus -S -l <user/password@server> @<path/to/my_query.sql> That’s it! Ouptut of run should be available under /path/to/my_query.out as specified in SPOOL variable. Tip: run SPOOL OFF; to turn […]

run process in background and keep it running after ssh exit [done]

To do so, simply use “disown <pid>” command. Proceed as follows: ssh into server run command and put it in background: myprocess.sh & note the id of the command being returned (or run either “jobs -l” or “ps aux | grep myprocess” to find it back) run command: disown <pid> exit ssh ssh into server again run “ps aux | grep <pid>” should return content Alternatively use “nohup”: simply prefix your command with “nohup” example: nohup myprocess.sh & sources http://www.cyberciti.biz/faq/unix-linux-disown-command-examples-usage-syntax/ http://stackoverflow.com/questions/5164985/how-can-i-use-nohup-to-run-process-as-a-background-process-in-linux http://unix.stackexchange.com/questions/3886/difference-between-nohup-disown-and http://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session

python – which site-packages folder are used in my environment [solved]

Log into your python environment and run: import site print(‘\n’.join(site.getsitepackages())) print(‘\n’.join(site.getusersitepackages())) sources http://pythonsimple.noucleus.net/python-install/python-site-packages-what-they-are-and-where-to-put-them

python 3.5 – install oracle mysql driver on ubuntu [solved]

Installing this mysql driver is surprisingly quite a painful experience. Steps Download package relevant for your distribution and python version from oracle website: https://dev.mysql.com/downloads/connector/python/ Install downloaded package: sudo dpkg -i mysql-connector-python-py3 _2.1.3-1ubuntu15.04_all.deb Go into python and run “import mysql” For all virtualenvs, simply symlink: ln -s /usr/lib/python3/dist-packages/mysql <path_to_virtual_env>/lib/pythonX.X/site-packages It should be good by now.

python – which site-packages folder are used in my environment [solved]

Log into your python environment and run: import site print(‘\n’.join(site.getsitepackages())) print(‘\n’.join(site.getusersitepackages())) sources http://pythonsimple.noucleus.net/python-install/python-site-packages-what-they-are-and-where-to-put-them

unix – file cannot be deleted or modified, even by root user [solved]

I had a file that could not be edited / removed / moved, even by root user. Reason for it is that this file was declared immutable. To solve this, run: sudo chattr -i <path/to/file> Now file can be edited/removed/moved. sources http://www.omgubuntu.co.uk/2016/03/fix-failed-to-fetch-google-chrome-apt-error-ubuntu  

how to set up cx_Oracle on ubuntu [solved]

I tried installing oracle client to use it with sqlalchemy and ended up with a nasty error message: distutils.errors.DistutilsSetupError: cannot locate Oracle include files To setup cx_Oracle so that it can be imported from python, proceed as follow: install libaio.so.1 by running: sudo apt-get install libaio1 download instant client appropriate for your platform from oracle website: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html SDK and ODBC packages must be downloaded too. note: on my side i downloaded: oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm oracle-instantclient12.1-odbc-12.1.0.2.0-1.x86_64.rpm convert into .deb package: sudo alien -d *instantcl*.rpm note: you may need to install alien (sudo apt-get install alien) if not already done install created package: […]

python lxml – use absolute xpath to find elements [solved]

When using lxml library, using an absolute xpath such as ‘/root/child/other_child’ end up with a nasty error message: SyntaxError: cannot use absolute path on element Reason for that is that call was performed on an Element using .findall() method. To use an absolute xpath, do not perform call on an Element, rather perform call on an ElementTree and call .xpath() method instead of .findall() Illustration below: etree.parse(fpath).getroot().findall(‘/root/child/’) # => SyntaxError: cannot use absolute path on element etree.parse(fpath).xpath(‘/root/child/’) # => OK sources http://stackoverflow.com/questions/16367504/python-parsing-html-elements-based-on-absolute-xpath http://lxml.de/api/