My friend spotted a problem with htop configuration. Simply when htop was executed on two different Ubuntu distros (10.04 and 14.04) the config was reset.
After some interrogation, we have spotted that 10.04 stores htop config to ~/.htoprc, while 14.04 to ~/.config/htop/htoprc. It was enough to remove one of them and link another one as below:
ln -s .config/htop/htoprc .htoprc
Creating reference list is always a nightmare. Mendeley and its handy LibreOffice / OpenOffice plugin may be of great help to many. It was for me. Below, I’ll describe how to make it working.
# get & install mendeley from https://www.mendeley.com/download-mendeley-desktop/
# check version of your mendeley
# Help > About Mendeley Desktop
# clone repo and build plugin
git clone firstname.lastname@example.org:Mendeley/openoffice-plugin.git
python build.py 1.15.2 false
# add to LibreOffice
# Tools > Extension Manager > Add...
# and look for `Mendeley-1.15.2.oxt`
After OpenOffice / LibreOffice restart, you should see new bar. Note, in order for the plugin to work, Mendeley has to be running.
What’s great about this plugin, you can adjust citation style by just a few clicks by clicking on `Choose Citation Style`. There is quite extensive database of predefined citation styles, so adjusting the reference style to your favourite journal will take just a few seconds 🙂
More info about the plugin on github.
More weekend oriented tip today;)
I have found downloading videos from youtube super easy with youtube-dl.
# install it
sudo apt-get install youtube-dl
# you can fetch many videos at once
youtube-dl LINK1 [LINK2 LINK3]
This tool provide many useful options, like changing the audio/video compression format and quality. You can read more here.
Gene Cluster is a program for clustering. I wanted to use it to analyse gene expression data. However, I had problems during installation under Ubuntu 14.04. This is how I solved it:
# install dependencies: Motif libraries
sudo apt-get install libxext-dev libmotif-dev
Get GeneCluster3.0 source code and unpack it.
# configure to install in local dir
./configure --prefix=`pwd` --program-prefix=gene_ && make && make install
# add install dir to ~/.bashrc
If you encounter error during pysam installation:
sudo easy_install -U pysam
pysam/csamtools.c:8:22: fatal error: pyconfig.h: No such file or directory
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
try installing python-dev first.
sudo apt-get install python-dev
Solution found on github.
Sometimes, it’s worth to encrypt swap space, especially if you process some privacy-sensitive data.
# install cryptsetup
sudo apt-get install cryptsetup
# generate swap
sudo truncate -s 1GB /cryptswap
sudo mkswap /cryptswap
# add to /etc/crypttab
cryptswap /cryptswap /dev/urandom swap
# add to /etc/fstab
/dev/mapper/cryptswap none swap sw 0 0
# activate encryption and swap
sudo /etc/init.d/cryptdisks reload && sudo swapon -a
Inspired by AskUbuntu.
After rather successful year of using WordPress, I have decided to move my blog to AWS. I was considering the move for long time, motivated by Free Tier and finally I found some time to do it.
At first, I have created WordPress Stack using CloudFormation, but personally I prefer Ubuntu over Amazon Linux and I will focus on configuration of Ubuntu EC2 instance here.
- Export your existing blog
WP-Admin > Tools > Export
- Login to AWS console and Create Key Pair
- Launch EC2 instance
I use Ubuntu HVM. I recommend t2.micro, as it’s free for the first year. You should specify created/uploaded key.
- Login to your EC2 instance using Public DNS or IP and your key
ssh -i .aws/your_key.pem email@example.com
NOTE: you key should be readable only by you. To achieve that, you can do:
chmod 600 .aws/your_key.pem
- Configure Ubuntu
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install apache2 php5 php5-mysql libapache2-mod-php5 libapache2-mod-auth-mysql mysql-server
- Configure MySQL
mysql -uroot -p
CREATE DATABASE wordpress;
CREATE USER 'wordpress' IDENTIFIED BY 'SOMEPASS';
GRANT ALL ON wordpress.* TO 'wordpress';
- Configure wordpress
tar xpfz latest.tar.gz
mv wp-config-sample.php wp-config.php
sudo chown -R www-data:www-data /var/www/html
# edit wp-config.php
- Configure Apache
# edit /etc/apache2/sites-available/wordpress.conf
Allow from all
# enable wordpress in apache2
sudo a2ensite wordpress
sudo service apache2 restart
- Enable HTTP access to your EC2 instance
Go to EC2 console > Instances > Select you instance > Description >
Click on your `Security group` > Select Inbound > Edit > Add rule > HTTP > Save
- Point your webrowser to your EC2 instance: http://ec2xxxxx.compute.amazonaws.com/
- Setup your wordpress account
- Upload dumped wordpress data
WP-Admin > Tools > Import > WordPress > > Upload file import
You will need to install WordPress Importer plugin.
- Assign post to correct user.
Don’t forget to Import Attachments!
- Install your favourite plugins and themes
As for plugins, I strongly recommend: JetPack, SyntaxHighlighter Evolved, Google Analytics Dashboard for WP and BackUpWordPress or ajax-load-more.
- Add favicon
Copy selected favicon.ico to /var/www/html/wordpress
BTW: You may want to increase security of your instance and setup swap just in case memory usage exceeds your EC2 instance size.
I wanted to send email reports from my computers. For that, the easiest is to create additional Gmail account (so your private email is safe) and set-up SSMTP:
sudo apt-get install ssmtp mailutils
Configure SSMTP: comment all lines in /etc/ssmtp/ssmtp.conf and add at the end (replacing HOSTNAME/USER/PASSWORD with your info):
Then, allow access from less secure apps to created Gmail account and enable one-time sign-in for new app without captcha. It’s strongly recommended not to use your private account for that purpose!
And send emails:
echo "email body" | mail -s "Test email from "`hostname` SOMEUSER@gmail.com
Note, this works perfectly fine in Ubuntu, as well as in Raspberry Pi.
The need for manual resize of screen in Ubuntu under VirtualBox is frustrating. There is simple solutions for that:
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
After restart, the screen resolution will adjust automatically to the size of the VirtualBox window.