Not to forget: ugly font and the Opera Browser

Might be interesting for non-English speaking users of the Opera: some font on some sites are really ugly and there is no way in the interface to disable them, because they’re not system fonts, but one that web page get downloaded. –disable-remote-fonts is the option to fix them forever. Such fonts usually contain normal English glyphs, bot other are ugly. To fix it in the Gnome Shell:

  1. cp /usr/share/applications/opera.desktop ~/.local/share/application
  2. Add –disable-remote-fonts to every “Exec”. Don’t touch “TryExec”

Not to forget useful vi and bash settings

.bash_profile

alias opera=opera --disable-remote-fonts
alias grep='grep --color=auto'
alias unigrep='grep -P "[^\x00-\x7F]"'
alias mkdir="mkdir -p"
alias ls='ls -lh --color=auto'
HISTCONTROL=ignoredups:ignorespace
HISTSIZE=100000
HISTFILESIZE=200000

.vimrc

set mouse=r
syntax enable
set tabstop=4
set softtabstop=4
set expandtab
set number
set cursorline
set hlsearch
set incsearch  
set showmatch
nmap <F1> <Esc>:set nonumber<cr>                                                                                                                                             
nmap <F2> <Esc>:set number<cr>
nmap <F5> <Esc>yy<cr>
nmap <F6> <Esc>p<cr>
nmap <F8> <Esc>dd<cr>
nmap <F10> <Esc>:wq!<cr>
nmap <F12> <Esc>:q!<cr>

Not sure about ‘number’ setting, if interferes with the clipboard annoyingly, so I can turn them off.

Evolution mail signature workaround

Evolution mail application in the Fedora 25 has annoying bug: it freezes when trying to add/edit signature (although, you can delete old one). It’s a known bug fixed in upstream and you can actually edit signature files (it’s quite tricky), but you can add shell script that would generate signature for you.

UPD: need to use “cowsay `fortune`”

Today I’ve learned…

My colleagues from the linux.org.ru board have found out one small flaw, so everyone including me stared to dance around PGP/GPG. So far I have found that among my systems:

  • Linux works as it should: two mouse clicks and you are ready. Covers 100% of my work mail, 75% of my personal mail.
  • Mac OS Sierra is not ready: GPG Suite has no support for the mail.app yet, just a workaround (yet). Hopefully we will see the solution in days.
  • iOS has only S/MIME out of the box, but GPG/PGP solution is ugly (due to restrictions).

And I don’t like install software that does not come with the operating system, for a reason 🙂

Interesing “feature” of the Mediawiki

Just have a bit digged in the Mediawiki, that is quite popular Wiki engine 🙂 Found out that the  articles are located in the “prefix_text” table, with all the changes, obviously. So changes are being stored as a new copy of the article: if you have 100kb article and you need to save a change in 1 symbol, there would be 100kb growth (plus additional data) of the table. No wonder that the Wikipedia need new servers all the time! Cannot imagine size of their DBs.

E-mail notification on every login


It’s useful sometimes to get notifications on every ssh login that is happen on the server (though, could be used to monitor logins made by other means). First method is based on the /etc/profile, but it should not be used because user can override it with setting own variables if home directory is writable for him. Most convenient is to use PAM, putting in the /etc/pam.d/sshd execution of the script that whould send the mail in the session section:

session optional pam_exec.so seteuid  /usr/local/bin/send_mail.sh

I would not recommend to set “required” here because the fail of the scrip should not be critical. The script just sends notification mail:

#!/bin/sh
if [ "$PAM_TYPE" != "open_session" ]
then 
	exit 0

else
  {
    echo "User: $PAM_USER"
    echo "User: $PAM_TYPE"
    echo "Remote Host: $PAM_RHOST"
    echo "Service: $PAM_SERVICE"
    echo "TTY: $PAM_TTY"
    echo "Date: `date`"
    echo "Server: `uname -a`"
 } | mail -s "$PAM_SERVICE login on `hostname -s` for account $PAM_USER" admin@example.com
fi

exit 0

Don’t forget to put +x permissions on it with:

chmod +x  /usr/local/bin/send_mail.sh

Backuping mysql

Recently I have to backup mysql database on quite heavily loaded server and I wanted to make backup daily on one hand and I wanted them not to affect production on the other. DB size is more than 150 Gb, about 50k users daily.

First approach was ty try to simply run musqldump and see what would happen. Site was down right after the backup has begun. Then I have tried to nice the mysqldump with

/usr/bin/nice -n 10 ionice -c2 -n 7

The result was better, site was down at about 10% of the job. Next I add –single-transaction, that have solved about 95% of problems, still some time site was down, so I had to add -q option. The final command was:

/usr/bin/nice -n 10 ionice -c2 -n 7 /usr/bin/mysqldump --plugin-dir=/usr/lib/mysql/plugin --user=dbuser -h bd.lxc --port=3306 --all-databases --single-transaction -q|/bin/gzip >  /var/bcp/backup-db-`/bin/date -I`.sql.gz

DNSBL checkers list

Since I am now running my own smtp-server, I have to deal with different black list servers myself and check my IP from time to time if it’s there or not.To cover pretty much everything valuable:

https://www.whatismyip.com/blacklist-check/http://whatismyipaddress.com/blacklist-checkhttp://mxtoolbox.com/SuperTool.aspx?action=blacklist%3a85.17.249.170&run=toolpage

My IP was in 2 lists, DAN ME, APEWS and Barracuda.

DAN ME is a list maintained by some loser, who lists there all TOR-related IP addresses he can find. Unfortunately he lists not only the exit-points, but relays as well. Fortunately, his list is automated, but I had to shut down the TOR node.

Barraccuda removes by request, however, sells “subscription” for $20, so you will not be in the list again. That’s low!

At the moment it’s in the APEWS for 3(!) years and the owner has a long faq where he is explaining why he would not remove you ever.

Thinking of extra VPS for the additional MX.