POP Keywords: apache oracle sybase ...

add self signed certificate

Here are steps to add a new self-signed certificate. log into server run below command sudo openssl reg -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/<fulldomain>-selfsigned.key -out /etc/ssl/certs/<fulldomain>-selfsigned.crt while being asked to feed details, make sure to fill QNAME with your full (sub)domain name for which this certificate is going to be used once certificate is generated, edit /etc/apache2/sites-available/<mysite-config-file>.conf Link the certificate there as in below: SSLCertificateKeyFile /etc/ssl/private/<fulldomain>-selfsigned.key SSLCertficateFile /etc/ssl/private/<fulldomain>-selfsigned.crt restart apache sudo /etc/init.d/apache2 restart Done!

unix – run/send process in the background

Below are a few ways of achieving that Option1: nohup With nohup (no-hangup): nohup <command-line> > <to_file.out> & (use >> to append) Option 2: pause/restart as background process Issue is when you need to provide some user inputs. In that case, proceed as follows: Run CLI as per normal and provide required user input Once no more input is required, hit ctrl+Z to stop/pause the job Run following command to identify your job id (different from pid): jobs Note: in above screenshot my job_id would be “1” Disown the process: disown -h %<job_id> Note: “%” is required Resume process: bg […]

word 2010 – create custom numbered fields and create a table of content out of them

Below are the steps to number TODO items automatically inside a word document and create a list of all the TODO entries existing. Numbering of fields Numbering of fields is called creating a “SEQuence” in words language. Click on “Insert” tab > “Quick Parts” down arrow > in field names list, select SEQ > create entry SEQ TODO Click on File tab > Options > Advanced > scroll to section “Show document content” > tick”Show field codes instead of their values”This will actually allow to see the code behind those fields. Go back to the word document and type the […]

how to use xmlns prefix with xsl transformation

XSL transformation was working with an xml file without any explicit xmlns namespace, but failed on file with explicit namespace such as in below code: <FpML xmlns=”http://www.mynamespace” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”> Reason is because by default, XSL version 1.0 is considering default namespace to be blank. As such, in order to match a file with explicit namespace, possibilities are: remove namespace from input file change xsl by: adding a namespace prefix in header that is matching the input namespace <xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” version=”1.0″> now becomes: <xsl:stylesheet xmlns:t=”http://www.mynamespace” xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” version=”1.0″> prefix all nodes used in xpath requests with previously defined prefix <xsl:param name=”data” select=”/FpML/dealEntry/eventAction” /> […]

plymouthd crashed with sigsegv in script_obj_deref_direct() [SOLVED]

I had this crash report upon booting my up-to-date ubuntu. In order to remove this: edit /etc/default/grub: sudo vi /etc/default/grub comment out line: #GRUB_CMDLINE_LINUX_DEFAULT=”splash plymouth:debug” add new line: GRUB_CMDLINE_LINUX_DEFAULT=”splash plymouth:debug” reboot grub: sudo update-grub That’s it. It is supposed to activate debugging and log info into /var/log/plymouth-debug.log. Which it does, but it also got rid of the error. sources https://askubuntu.com/questions/864242/plymouth-error-logging https://wiki.ubuntu.com/Plymouth#Debugging https://bugs.launchpad.net/ubuntu/+source/ubuntu-gnome-default-settings/+bug/1536771

flask + apache + mod_wsgi – not working [solved]

Gosh! it took me a whole day to identify what the issue was…. Basically what is happening: when using WSGIScriptAlias directive on non-root url (i..e you’re not matching “/”), mod_wsgi strip the url of the matched part Here is an example: in htttpd.conf: WSGIDaemonProcess credmanager user=myuser group=mygroup threads=5 python-home=/path/to/virtualenv WSGIScriptAlias /api /var/www/credmanager/api/credmanager.wsgi WSGIProcessGroup credmanager WSGIApplicationGroup %{GLOBAL} WSGIPassAuthorization On <Directory /var/www/credmanager> Options FollowSymLinks Require all granted </Directory> In above example, we are only handling via python uris starting with “/api”. Let’s say requested url: http://www.mydomain.com/api/toto => url is starting with “/api” so it is matched and handled by mod_wsgi => python […]

angular2 – ‘this’ binding context lost in .catch call

I noticed that “this” was undefined when calling .catch method: return this.http .get(‘/api/misc-url’) .toPromise() .then(response => response.json()) .catch(this.handleError); It happens that this is happening because of the way function is called in .catch. By providing directly the method, we are losing context. By wrapping call into arrow function we can restore it! (better than .bind(this) :)) return this.http .get(‘/api/misc-url’) .toPromise() .then(response => response.json())         .catch(error => {this.handleError(error); }); Easy 🙂 sources http://stackoverflow.com/questions/36227996/angular2-getting-confused-with-observable-catch-closure-scope  

unix – list content of tar file and extract specific file

To list content of tar.gz file: tar -tvf my-data.tar.gz ‘<looked-for-file-or-path-name>’ To extract specific cotnent from tar.gz file: tar -xvpBf my-data.tar.gz ‘<path-name>’ sources https://www.cyberciti.biz/faq/list-the-contents-of-a-tar-or-targz-file/

creating a python virtual environment

When starting a new python project, it is usually sound practice to use a dedicated virtual environment. By doing so your project is isolated from other applications using python and all dependencies can be properly tracked. ensure python is installed ensure pip is installed (note: starting python3.4, pip is installed by default) ensure virtualenv is installed (note: starting python3.3, venv is installed by default) In a nutshell, if you have python >= python3.4, nothing to install!! Easy 🙂 Run below commands: cd <path/to/my/project> python3 -m venv ./virtualenv Done. Run source ./virtualenv/bin/activate to activate your virtual environment sources https://docs.python.org/3/library/venv.html#module-venv

Feed unix pipe into ls / feed ls with pipe

To feed “ls” instruction with pipe, simply use xargs as per below: find . -type f -name mypattern* | xargs ls -l sources http://stackoverflow.com/questions/18210956/unix-pipe-into-ls