Skip to content

Instantly share code, notes, and snippets.

Coding mode

Kirill Pavlov pavlov99

Coding mode
Block or report user

Report or block pavlov99

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am pavlov99 on github.
  • I am p99 ( on keybase.
  • I have a public key whose fingerprint is 247B E451 E71C 8AAD 6AF2 7842 5849 1A6C A92B 0F59

To claim this, I am signing this object:

pavlov99 /
Last active Sep 12, 2019
Pandas cross-join
from functools import reduce
def crossjoin(*dfs, **kwargs):
"""Calculate a cartesian product of given dataframes.
Subsequently join each dataframe using a temporary constant key and then remove it.
Also set a MultiIndex - cartesian product of the indices of the input dataframes.
pavlov99 /
Created Aug 24, 2018
Visualize JavaScript dependencies
# Install madge ( and graphviz first
madge --dot --layout neato --include-npm src/ | dot -Tpng > dependencies.png
pavlov99 /
Created Aug 24, 2018
Find all *.spec.js testing files in src/ folder and execute with node.js
# This command line executes all test files with NodeJS.
# Test files are located in ./src folder and have *.spec.js
# In order to use ES6 import/export syntax, reify is required:
# `find` command generates a "test file" which require() every actual test.
# If the output is TAP-compatible, one could pipe it to ./node_modules/.bin/tap-mocha-reporter spec
node --require reify -e "$(find ./src -name '*\.spec\.js' -type f -exec echo "require('{}');" \; | paste -s -d' ' -)"
pavlov99 /
Created Jul 22, 2018
Update incorrectly set image metadata in batch. Set geo location (latitude, longitude) and time.
#!/usr/bin/env bash
# Update photo information: time and location.
# After photo editing by agency, all of the meta tags were changed. This script fixes it.
# Photos are ordered by filename, e.g. 001.jpg, 002.jpg, etc. The whole event happened
# between 16:30 and 21:00 Moscow time on 30th June. Set time to every picture as if they were
# taken uniformly during the event.
# See also:
# exiftool (allows batch editing as well).
# to find your location and get latitude and longitude info.
pavlov99 /
Created Jun 6, 2018
Python helpers
class Choices(object):
""" Choices."""
def __init__(self, *choices):
self._choices = []
self._choice_dict = {}
for choice in choices:
if isinstance(choice, (list, tuple)):
pavlov99 /
Created May 19, 2018
Combine multiple PDF files into one with dockerized PDFtk
docker run -v "$(pwd)":/work mnuessler/pdftk *.pdf cat output combined.pdf
# Install linux pipe viewer and optional dialog
sudo apt-get install dialog
# Archive:
tar cf - /folder-with-big-files -P | pv -s $(du -sb /folder-with-big-files | awk '{print $1}') | gzip > big-files.tar.gz
# OSX:
tar cf - /folder-with-big-files -P | pv -s $(($(du -sk /folder-with-big-files | awk '{print $1}') * 1024)) | gzip > big-files.tar.gz
# Unarchive:
pv file.tgz | tar xzf - -C target_directory
pavlov99 /
Created Apr 2, 2017
GnuPG key management
# Add gpg key:
# Install GnuPG from
gpg2 --full-generate-key
# Delete gpg key
gpg --delete-secret-key "User Name"
gpg --delete-key "User Name"
pavlov99 /
Created Mar 27, 2017
Find your role's id in ansible-galaxy
$ ansible-galaxy info YourUser.RoleName | grep -E 'id: [0-9]' | awk {'print $2'}
You can’t perform that action at this time.