суббота, 16 апреля 2016 г.

Pelican notes

Extensions
  • If Typogrify library is installed, typographical enhancements may be enabled in the settings file
  • pygments for syntax highlightning
  • Pelican also supports Markdown Extensions, which might have to be installed separately if they are not included in the default Markdown package and can be configured and loaded via the MD_EXTENSIONS setting
  • pelican-plugins repository contains more additional plugin
Metadata
Note that, aside from the title, none of this article metadata is mandatory: if the date is not specified and DEFAULT_DATE is set to 'fs', Pelican will rely on the file’s “mtime” timestamp, and the category can be determined by the directory in which the file resides. A file located at python/foobar/myfoobar.rst will have a category of foobar. If you would like to organize your files in other ways where the name of the subfolder would not be a good category name, you can set the setting USE_FOLDER_AS_CATEGORY to False.

Caching
When experimenting with different settings (especially the metadata ones) caching may interfere and the changes may not be visible. In such cases disable caching with LOAD_CONTENT_CACHE = False or use the --ignore-cache command-line switch.

 

пятница, 15 апреля 2016 г.

Prepare for an interview

Study
  • horizontal vs vertical scaling
  • sql vs nosql
  • strace, gdb, profiling
  • python basics
  • multiprocessing & multithreading
  • python datastructures internals: dicts 
Tune self
  • дослушиваю до конца и задаваю вопрос
  • структурирую проблему и разрабатываю основу ее решения
  • думаю прежде, чем говорю
  • акцентирую внимание на особо важных вопросах
  • обсуждаю ход своих мыслей 

среда, 16 марта 2016 г.

Pytest configuration

List fixtures for the given path
py.test --fuxtures [testpath]
Enable external pytest plugin
Add pytest_plugins variable to conftest.py
pytest_plugins = ['path.to.external.pytest.plugin']

суббота, 20 февраля 2016 г.

Study npm

Change npm global prefix
npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH
Install package locally (to node_modules/). Add -g to install globally.
npm install package
Update local packages
npm update
List outdated packages
npm outdated

вторник, 16 февраля 2016 г.

Configure Django application

Configure application
  • To configure an application, subclass django.apps.AppConfig and put the dotted path to that subclass in INSTALLED_APPS.
  • When INSTALLED_APPS simply contains the dotted path to an application module, Django checks for a default_app_config variable in that module.
  • If it’s defined, it’s the dotted path to the AppConfig subclass for that application.
  • If there is no default_app_config, Django uses the base AppConfig class.

вторник, 19 января 2016 г.

Progression sums

Arithmetic progression sum
S(n, p) = sum(i**p for i in range(1, n)) = Theta(n ** (p + 1)), where p >= 1
Geometric progression sum
G(n, a) = sum(a ** i for i in range(1, n)) = a * (a ** (n+1) - 1) / (a - 1)
If n -> Infinity
G(n, a) = 1 / (1 - r)

вторник, 12 января 2016 г.

Manage GnuPG keys

Create GnuPG key pair
gpg --gen-key
List keys
gpg --list-keys
gpg --list-public-keys
gpg --list-secret-keys
Export keys
gpg --armor --output <keyid>-public.key --export <keyid>
gpg --armor --output <keyid>-secret.key --export-secret-keys <keyid>
Import keys
gpg --import  <keyid>-public.key
gpg --import  <keyid>-secret.key
 Delete keys
gpg --delete-secret-keys <keyid>
gpg --delete-keys <keyid>

вторник, 5 января 2016 г.

пятница, 1 января 2016 г.