Skip to content

Instantly share code, notes, and snippets.

@barseghyanartur
barseghyanartur / imagemagick_convert_docx_pdf_odt_to_png.md
Last active Mar 18, 2021
ImageMagick convert DocX, PDF or ODT to PNG
View imagemagick_convert_docx_pdf_odt_to_png.md

DocX

convert -verbose -quality 100 -fill "rgba(255,255,255,1.00)" -density 300 -alpha off test.docx test_docx.png

PDF

convert -verbose -quality 100 -fill "rgba(255,255,255,1.00)" -density 300 -alpha off test.pdf test_pdf.png
@barseghyanartur
barseghyanartur / git-pushing-multiple.rst
Created Feb 17, 2021 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.
View git-pushing-multiple.rst

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@barseghyanartur
barseghyanartur / intr.md
Created Jul 20, 2020
Show line numbers in nano
View intr.md

Open the nanorc file:

nano ~/.nanorc

Turn on line-numbers feature by pasting the following into the nanorc:

set linenumbers
View convert_mysql_dump_to_postgresql_dump.md

Prepare database dump using mysqldump:

mysqldump -u [username] -p [databaseName] --compatible=postgresql --default-character-set=utf8 > database.sql

Clone mysql-postgresql-converter project:

git clone git@github.com:lanyrd/mysql-postgresql-converter.git
View generate_random_password.md
openssl rand -base64 12 | cut -c1-12
View podman_install_reqs_in_all_running_containers.md
for cont in $(podman ps -q); do podman exec -it ${cont} /bin/bash -c "pip install django-request-logging"; done
@barseghyanartur
barseghyanartur / django_db_logging.md
Created Apr 22, 2020
Patch logging for django.db on the fly from terminal
View django_db_logging.md

Patch:

import logging
logger = logging.getLogger('django.db')
logger.level = logging.DEBUG

Now we can:

@HerrPi
HerrPi / hg-to-git-conversion.md
Last active Feb 8, 2020
Mercurial to Git repo conversion (hg-to-git)
View hg-to-git-conversion.md
@shaypal5
shaypal5 / .travis.yml
Last active Apr 7, 2021
Comprehensive Python testing on Travis CI
View .travis.yml
language: python
# ===== Linux ======
os: linux
dist: xenial
python:
- 2.7
- 3.6
- 3.7
- 3.8
- 3.9
View debugging_python_within_docker.md

Debugging Python within Docker

Often you need to run debugger within docker. It many cases it looks like this:

import pdb; pdb.set_trace()

Or: