PostgreSQL
coub
express.js
freeware
git
jquery
laravel
links
linux
macos
mysql
node.js
php
powershell
python
ubuntu
vim
virtualbox
анекдот
блог
игры
интересно
стихи
цитаты
Nginx: how to set default server
August 01, 2016
Sometimes it's conveniently to set up default server, that gonna try to serve request by default. Originally, if your server got a request by IP address (for example) and can't get any requested hostname, it takes first server description from your config and tries to serve request with this server.
You can change this behavior. It's really easy. Just use default_server parameter, like this.
You can change this behavior. It's really easy. Just use default_server parameter, like this.
server {
listen 80 default_server;
server_name example.net www.example.net;
...
}
How to check GMail inbox from command line
August 01, 2016
First of all we have to create an application password here.
Then, create bash script like this one:
Original note here.
Then, create bash script like this one:
#!/bin/bash
# crontab example line
# */4 * * * * /home/username/check-gmail.sh
export DISPLAY=:0
username="your-email@gmail.com"
password="your-app-password"
/usr/bin/curl -u $username:$password --silent "https://mail.google.com/mail/feed/atom" | \
grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | \
while read line; do
/usr/bin/notify-send -i xfce-newmail "You've got new mail!" "$line" -t 5000
done
After that, you can add this script to your cron using crontab -e. As you see, notify-send is used here to display system notification (XFCE, in my case) for each new mail received, in your case you can change that in the way you like.
Original note here.
Два столпа JavaScript
July 03, 2016
Часть 1: наследование через прототипы
Часть 2: функциональное программирование
Часть 2: функциональное программирование
JavaScript является одним из наиболее важных языков программирования всех времен не просто из-за своей популярности, а потому что он популяризует две черезвычайно важные для развития всей науки программирования парадигмы:
- Наследование через прототипы (объекты не содержащие классов, делегирование прототипов более известное как OLOO — Objects Linking to Other Objects)
- Функциональное программирование (с помощью лямбда-выражений и замыканий)
Git: remove untracked files
June 09, 2016
Preview files that will be deleted (dry-run)
git clean -fnReal forced cleanup
git clean -fHelp
git help cleanOriginal solution is here
Debian + XFCE xscreensaver alternative screen lock
April 06, 2016
Step one
Bind global hotkey (keyboard settings for XFCE case) for command /usr/bin/light-locker-command -l
Based on this solution
sudo apt-get purge xscreensaver xscreensaver-dataStep two
sudo apt-get install light-lockerStep three
# which light-locker-command /usr/bin/light-locker-commandStep four
Bind global hotkey (keyboard settings for XFCE case) for command /usr/bin/light-locker-command -l
Based on this solution