bash

Analysing gigapixel images online is possible with Cytomine

Posted on

We have a collaborating project between Norway, Moldova, Armenia and Belarus in Oral Pathology. In order to view slides online we installed a software called Cytomine. This software, or multiple combined software/applications, is developed in Belgium by a cooperating team. All about Cytomine can be read here: https://cytomine.coop/ This is an open source software. It is […]

bash

Use a variable counter in a bash one-liner

Posted on

I had 70 different domain names that I need to add in a ssl cnf file for creating a certificate request. The 70 different domain names was in a text file, one per line: domainname1.something.com domainname2.somehing.com … In order to create the alternative names list, I used this bash oneliner: teller=1; for i in cat […]

bash

Cron every last Friday of month

Posted on

We wanted to run a script every last Friday of the month. The script was set to remind people about certain issues. Friday is a nice day to be reminded of things, right? Anyway, by putting this in the /etc/crontab file, one can achieve the request: 59 11 * * 5 username [ $(date +”\%m”) […]

bash

Downgrade to previous version: yum

Posted on

Sometime yum update just breaks everything. We experienced this, and had to go backup to previous versions. In RHEL6 and RHEL7 you can run this command:

which will give you a list of transactions ID’s. Now you just need to figure out how far you want to go back in the history, and do […]

bash

Convert multiple files from latin1 to utf8 with vim

Posted on

If you have several files that need to be converted to utf8, you can do it with vim. First start vim with:

Which will find all .htm and .html files from the current directory. Then in vim, use : to go into command mode. Run these two commands: :set nomore :bufdo set fileencoding=utf8 | […]

bash

Use Curl to read your imap emails

Posted on

You can use the bash command “curl” to read your imap emails like this:

Note: your password will be visible on the command line, so don’t use this on a public server. So it is actually better to create a file, for instance called secret, then write your password in it, and protect it […]

bash

Get url’s from website with wget

Posted on

which will give something like: https://website.of.interest.com/en/Category:BRA https://website.of.interest.com/en/Category:Free_software https://website.of.interest.com/en/Category:Freeware https://website.of.interest.com/en/Special:RecentChangesLinked/Software_overview https://website.of.interest.com/en/Special:WhatLinksHere/Software_overview https://website.of.interest.com/en/Talk:Software_overview https://website.of.interest.com/ithelp/index.php?title=Software_overview&action=edit https://website.of.interest.com/ithelp/index.php?title=Software_overview&action=history https://website.of.interest.com/ithelp/index.php?title=Software_overview&action=info https://website.of.interest.com/ithelp/index.php?title=Software_overview&oldid=2586 https://website.of.interest.com/ithelp/index.php?title=Special:Pdfprint&page=Software_overview https://website.of.interest.com/ithelp/index.php?title=Special:UserLogin&returnto=Software+overview https://website.of.interest.com/ithelp/index.php?title=Talk:Software_overview&action=edit&redlink=1

bash

Match email address

Posted on

If you have a file with several lines that contains email addresses that you like to extract, you can do that with Linux grep command: File “emails.txt”: somestreng anotherstring 342345 somename.lastname@domain.com where somename.lastname@domain.com is the string you like to extract: you can do this with: grep -EiEio ‘\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b’ emails.txt Result: somename.lastname@domain.com

Apache

Idle in transaction – DELETE waiting

Posted on

We have a Linux server (Redhat Enterprise 6) running a multi-site installation of Mediawiki. In total, we have today 120 unique wiki’s, each having its one Postgresql 9.1 database. Suddenly the server stopped responding. In Apache webserver, the total number concurrent apache processes went up to Apache’s max-client setting in httpd.conf, and people couldn’t log […]

bash

Random numbers with bash

Posted on

I needed to get some quick random numbers that would represent a time on the form HH:SS. In my case the time should be between 10:00 and 12:55. I did this in bash with:

bash

Searching in Excel files

Posted on

I had to find a specific Microsoft Spreadsheet among thousands of files on a mapped network drive O: on a Windows 7 Computer. The problem was that searching and indexing was only performed on local disk like C: and D: so I could only search for keyword in local Excel files. It is not optimal, […]