A clever trick to improve the speed of your firefox browser is by vacuuming its sqlite database. The VACUUM process rebuilds the database, thus defragmenting it, reduces the size and makes searching in it faster, using disk more efficiently may also reduce the load on your disk as it reads in sequence from my sectors. In general, this applies to any database that does not automatically perform vacuum / defrag on itself.

The process of defragmenting the Firefox database itself is quite trivial – we perform sqlite3 db-file VACUUM in the firefox profile directory. In linux, the path to it is usually ~ / .mozilla / firefox / random-name.default. In principle, you should only have 1 directory in .mozilla / firefox if you have more you can check ~ / .mozilla / firefox / profiles.ini for the correct directory in your browser's profile. Since I don't care about doing the process by hand, I wrote an elementary script to defragment the databases.:

for db in $(find ~/.mozilla/firefox/$(grep Path ~/.mozilla/firefox/profiles.ini | cut -d'=' -f2) -maxdepth 1 -name "*.sqlite" -type f)
do
   echo "VACUUM ${db}"
   sqlite3 ${db} VACUUM
   sqlite3 ${db} REINDEX
done

After executing the script, the search in the history and the loading of the fox itself is significantly faster. I guess the script can be used in Mac OS with small modifications.

p.s Here is the option for Mac OS X. – tested on Mac OS X Sierra. We have to force the delimiter to be a new line because of space in the path to the folder that contains the firefox profile

OIFS="$IFS"
IFS=$'\n'
for db in $(find ~/Library/Application\ Support/Firefox/$(grep Path ~/Library/Application\ Support/Firefox/profiles.ini | cut -d'=' -f2)  -maxdepth 1  -name "*.sqlite" -type f)
do
echo "VACUUM && REINDEX ${db}"
sqlite3 "${db}" VACUUM;
sqlite3 "${db}" REINDEX;
done

A few days ago they were over 25 years of Linux. Whenever I read the letter of Linus I fall into such a very fun mood. I have no intention of explaining how important Linux is and what role it plays in our lives. Rather, I wondered what role he had played in my life. Then many questions came up

  • If it weren't for linux, would I be BSD or, God forbid, a Windows administrator ?
  • Would I be an administrator at all
  • What would I do if I wasn't an administrator – programmer (he protected me….)
  • What OS would I use
  • What technique would I use – phone computer – I would probably be another apple fan boy

I experienced a little drama with the disk on my laptop. After fixing the problem with apt-get update, the following extremely unpleasant end of the process was shining

E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/debian.ipacct.com_debian_dists_sid_contrib_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

As usual the problem is extremely obvious /var/lib/apt/lists/debian.ipacct.com_debian_dists_sid_contrib_binary-i386 cannot be read correctly. The fix is ​​as simple as the diagnosis of the problem itself:

 rf -f /var/lib/apt/lists/*

In the end, the result is forced synchronization of apt.

I had to make a bootable USB under OS X. To my great surprise, I found that the copy speed with DD is disgustingly low ~ 600KB / s 😕 . After a short search I found, that I should use rdiskX instead of diskX. The idea is that rdisk is synonymous with raw device. So far, I immediately added an r to the block device to which I copied the ISO and then found that the speed is even lower ~ 150-200KB / s 😡 . The mystique is now complete and previous information has been confirmed by many sources!!!! Everything fell into place after I put the bs directive.

bs=n Set both input and output block size to n bytes, superseding the ibs and obs operands. If no conversion values other than noerror, notrunc or sync are specified, then
each input block is copied to the output as a single block without any aggregation of short blocks.

After I put 1M for the size of bs I achieved the speeds I expected from my USB. Then I tested and the difference between disk and rdisk definitely the difference was about 10-12 times in speed in favor of rdisk. A very cultural way to monitor the speed and progress of dd can be achieved with the following pipeline

sudo dd if=Downloads/path.to.iso bs=1M | pv | sudo dd of=/dev/rdisk2 bs=1M

My favorite text editor is Geany. It is very minimalist HERE which supports a huge set of languages – shell, php, python, C … etc. It has automatic finishing and at the same time it is very agile. It lacks some other pleasant opportunity, but at the moment it is more than enough for me. I started an online course Python Programming на SoftUni – to refresh my knowledge and upgrade it because I have not adequately monitored what is happening with python 3. The lecturers of the course recommend PyCharm as an IDE for pyton programming, but I do not like it, of course I use Geany for the exercises.

During the lectures I felt painfully 2 lacks

  1. python autocomplete exhales from documentation of functions and methods
  2. no validation for pep8 standard

The good thing is that Geany is flexible enough to configure and can be easily supplemented by missing ones.. Sometimes add python documentation to our IDE:

  • we pull the following script somewhere in our PATH for example / usr / bin and don't forget to make it executable
  • edit the file ~ / .config / geany / filedefs / filetypes.python by adding the following line in the settings section context_action_cmd=pydocw %s. If there is only add the name of the binary from the previous step. We restart Geany if it is released.
  • We already have a context-action that will get you information about the function. I added a shortcut to make it more convenient as I do not understand any functionality. I like this approach a lot because I am very annoyed by the netbeans approach.

So far so good. Then I really want to have validation of the code I write – whether I write it according to generally accepted standards or I write some ugliness. Basically I found it again tutorials how things happen but it's a bit outdated – Geany has everything built into it, you just need to install the pep8 package. In Debian apt-get install pep8 works in the other distros you have to find out for yourself how the magic happens. In the Build menu, the second button (at least for me) is Lint after clicking it you will find how ugly code you have created 😀

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

Here's a general outline of how to make your Geany work better with Python while still being fast without making your CPU want to pull the bullet.