DN42 is a wonderful project that enables you to develop your skills without scraping the BGP product environment, without you having to have expensive devices with which to make your lab to do simulations with GNS3. At the same time is not a pure laboratory environment where there is no real world problems. Participate with 1 node in the project for about a year. One of the problems in the project is 1:1 with the real world – When someone announced prefixes that do not need to declare. Because I'm lazy and don't feel like typing on hand time filters, I thought the problem with a simple bash script that generates a prefix-list with name dn42 and pour the valid prefixes.

vtysh -c 'conf t' -c "no ip prefix-list dn42"; #drop old prefix list

while read pl
vtysh -c 'conf t' -c "$pl"; #insert prefix list row by row
done < <(curl -s https://ca.dn42.us/reg/filter.txt | grep -e ^[0-9] | awk '{ print "ip prefix-list dn42 seq " $1 " " $2 " " $3 " ge " $4 " le " $5}' | sed "s_/\([0-9]\+\) ge \1_/\1_g;s_/\([0-9]\+\) le \1_/\1_g");
vtysh -c 'wr' #write new prefix list

The list of valid prediksi into https://ca.dn42.us/reg/filter.txt from the main conveyor + little mods on my part to be able to generate a prefix list. The commands are executed in vtysh.

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.

To change your domain in WordPress is some pain. Recently I had to do several things already happening fast sports 😀 . If I can sumariziram steps are 2 – naturally without moving files, settings if changes entirely hosting.

1. Changing the old URL to the new – Things I here with trivial. Open your wp-config.php file and place it in these 2 row


As replace http://example.com with your new.

2. So far so good now site opens url-th work but uploaded content such as pictures, documents and so not visible. Here it already has a nasty challenge. They must replace the old url-th in a new database. It was terribly troublesome process especially for beginners, who do not do well with SQL syntax, but there is already a pretty nice script searchreplacedb2, which makes it uncomfortable for you. Use is trivial – upload it to the root directory where the wordpress your page and open it in the browser-your. Then follow the steps as you will first prompt you for a username and password which is taken from your URwp-config.php, and then will ask for the old and the new url. After the last step you'll need to take with me poizčakate average 40sek-50 sec.

This is in General, nothing hard or Super complicated.

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

Image representing MySQL as depicted in CrunchBase

Some time ago I wrote about MySQL Full Text Search 🙂 Today I had a very interesting experience with a query. In General, the query is looking for results that are missing another table. A Select a sub osnovne and select in the part WHERE the application. In General, the skeleton and is

FROM `table1`
WHERE `someID` =44
AND `firsTextField` NOT
IN (

FROM `table2`
WHERE `otherID` =44

In General, a simple request. I wrote it for 30 SEC release her and stuck the machine. After a long and patiently waiting on my part or just ~ 43 sec . Spit my score lol . Pfff Madhouse. Enter in the machine looking CPU is normally loaded almost at idle condition. Shock and awe. Run the query again still the same result. Fuck WTF. Run the query and explain everything I – the second field is only secondTextField full text search No index, and there is a modest tray of about 35 k line. What to read – full text search index is not. It is already clear the problem real quick one

ALTER TABLE `links` ADD INDEX ( `linkUrlID` ) 

And things turned places Query took 0.0005 sec 😀

Be careful how you put the indices of them depends on your marginal rate of application.

p.s Overall I'm hooked on the upper situation not only because there is no index but because not using full text search method 😀

Enhanced by Zemanta