My favorite text editor is Geany. It is very minimalist HERE it supports a huge range of languages – shell, php, python, C … etc. Have their autocomplete and at the same time, bloody well. He lacks one and another nice opportunity, but at the moment, for me, it's more than enough. I online course Python Programming at SoftUni – to refreshing knowledge and will update as I have not followed adequately, what happens to python 3. Speakers of course recommend PyCharm as IDE for programming pyton, but I not my taste, of course, I use Geany for exercise.

During the lecture, felt painful 2 shortage

  1. python autocomplete and you highlight from the documentation, functions and methods
  2. you will never for pep8 standard

The fact that Geany is quite flexible than configuration and can be easily supplemented than missing such. Let's add the python documentation on our IDE:

  • dyble it the following script somewhere on our PATH, for example /usr/bin, and don't forget to make it executable
  • edit the file ~/.config/geany/filedefs/filetypes.python, like in settings, add the following lines context_action_cmd=pydocw %s. If there is only add the name of Bearcat from the previous step. ReWire Geany, if you work.
  • We already have a context action that will allow you to get information about the function. I added a shortcut to me is more comfortable as I do not understand any functionality. Leach me this approach very much because I like annoys me netbeans approach.

So far so good. Then I'll wish I never code that I write – if you write it according to General accepted standards, or write any gattii. In General, I found again tutorialon as things happen, but it's a little outdated – Geany has all of this built into itself, just need to install pep8 package. In Debian apt-get install pep8 does work in other destrot themselves need to learn how the magic happens. On the Build menu, the second button (at least I have) - Lint, by clicking it you will see how ugly code you have created 😀

Screenshot from 2016-01-11 20-42-21

It outlines how to make your Geany works well with Python and still be fast, not CPU makes you want to pull bullets.

Certification in there are daily tests that give 1 the extra point after passed the basic tests. You should do 100 such tests for maximum results 😐 . The tests themselves were completely trivial

  • Traceroute
  • Ping
  • Whois

The most unpleasant that the tests themselves must be unique, so cannot use a single domain dayti 🙂 among other things, and a bit annoying 🙄 – any call, just pluses 5 command in the cli is and copy/paste in their web site.

As a lazy admin who likes to make life easier madrasah quickly a mess to beat that, to do the dirty work instead of me


hr() {
  local start=$'\e(0' end=$'\e(B' line='qqqqqqqqqqqqqqqq'
  local cols=${COLUMNS:-$(tput cols)}
  while ((${#line} < cols)); do line+="$line"; done
  printf '%s%s%s\n' "$start" "${line:0:cols}" "$end"

if [ -z $1 ]
  echo "Append domain afert the script name!!!"

IP=$(dig $1 AAAA +short)

if [ -z ${IP} ]
  echo "$1 dont have valid IPv6 record"
  traceroute6 $1
  dig $1 AAAA
  dig -x ${IP}
  ping6 -c3 ${IP}
  whois ${IP}

As you can see, the script is insanely elementary. Poduval domain name, what is it to check if there are IPv6 records and if so, to conduct daily tests for him. Top chic part – function hr which prints a line across the width of the screen, taken from bash-hackers.

A shell script wants your job

Today while I was working I saw that one of the machines very cruel lagna. Enter in it look a hell of a lot of zombie nabl″skal cron processes (rough around 50-60). There was no way to kill them all with killall so I had to do a little more literate solution to the problem – to start a clutter 猛击 script to find and kill processes. 50-Tina PID-not write easy by hand :D. The script for a minute and scratched it's hyped rudimentary but still deserves attention 🙂

At its base is sitting the conveyor belt

ps ax | grep -v grep | grep process_name | awk '{print $1}')

Here we get a list of all PID-s of the process that should kilnem as grep is ruled out from this list. As we have already listed the things become easy everything is rotated in a for. Here's the final result


PR=$(ps ax | grep -v grep | grep process_name | awk '{print $1}')

for PID in $PR
echo "$PID will be killed"
kill -9 $PID

Can be “tuned” as the name is taken as the argument after the script name and thus called as executable binary. However, it is not very good practice to have many such frequent cases 😀 but it never hurt to be protected from any šitni

Enhanced by Zemanta

Today I played to optimize a slow SQL request type

SELECT * FROM 'table' WHERE `field` LIKE '%word%'

Where is the troublesome one moment here – the last part word% ‘%’ and in even greater concreteness characters % before the word, for that we do. Wildcard symbol % ,before any value, our application directly translates directly into a slow, because in this way the application stops us to use the indexes of the. As always there are solutions, but are not always clear 😆 generally MySQL you have a solution to this problem with fulltext search Indexing of the. How is the change of the field there is a lot written in the documentation, but in a hurry I will describe how I change the top request, because we will get to a little drama finally. Make a cute as applicable to fulltext field up, the query needs to be changed in the form:

SELECT * FROM `table` WHERE MATCH (field) AGAINST ('word')

So the structure is obvious and there is no need for unnecessary discussion. The above query will enter into force, If the word, for which you are making a request at least 4 the symbol, This is the default value, If you want to modify it, you must specify the value, you want to my.cnf in part [mysqld] with the Declaration ft_min_word_len= 3 or 2, 1 not a good choice obviously 😉 . After you change the value and restart the mysql server-need to do a repair of tables, in order for the new indexing enters into force. Here all clear: do you change, I reset, rebildvam indices and make my request and returns 0 Checking line with 😀


I see that the values, I've asked have entered into force, rebildvam indexes again – same result. 🙄 Hate, very uncomfortable. From here on began a large cursing and scratching the key to the shed 😀 who was quite, pretty interesting. Generally, I started reading documentation do not know which road and came to an interesting passage

Such a technique works best with large collections (in fact, it was carefully tuned this way). For very small tables, word distribution does not adequately reflect their semantic value, and this model may sometimes produce bizarre results. For example, although the word "MySQL" is present in every row of the articles table shown earlier, a search for the word produces no results

BEAM 😳 Dame tray I was small – It was still a test. In a large application Naših table with over 2 000 000 order and there things are asleep. Well it's already clear the problem. To make it clear the solution, I will mention briefly, that full text search support 3 Advanced modes BOOLEAN , EXPRESSIONS and NATURAL LANGUAGE as the last works by default. About the different modes you can check the documentation, I'll explain with 2-3 words to BOOLEAN because it is the key. It supports logical operators of the type AND, OR , NOT and so on and can make some magic with the search phrases, to have a, is there another, etc.. Supports and symbol *, that is the equivalent of wildcard characters % 😉 It is useful, When the search term is in the length of the ft_min_word_len or small trays ;). At least to me at the table with about 100 the line is doing a perfect job. The only thing left to see and the finished application:

SELECT * FROM `table` WHERE MATCH (field)

Now here comes a time indexing works with us wildcard characters – the answer is I don't know. Basically I, to, because otherwise indicated in the documentation, but the documentation is clearly not say or show much 😀

Enhanced by Zemanta

One project that lead to the gitweb annoyed me, There is no code coloring in the tree. Easy way to color syntax tree in the part of gitweb is installing the package highlight and add the following line to /etc/gitweb.conf or where you are located configuration file gitweb

$feature{‘highlight’}{‘default’} = [1];

For Debian package in the package system for other distributions haven't checked.

ps There is an alternative option to make changes to files gitweb but it seemed pointless as there is a simple option 🙂