Skip to content

Instantly share code, notes, and snippets.

View nikitagruia-dev's full-sized avatar
🎯
Focusing

Nikita nikitagruia-dev

🎯
Focusing
View GitHub Profile
from dateutil.relativedelta import relativedelta
from django.http.response import HttpResponse
from datetime import datetime
import requests
import re
from ipware.ip import get_real_ip
@nikitagruia-dev
nikitagruia-dev / licenses.py
Created September 16, 2019 14:35
saving licenses from JSON file(built using pip-licenses) in excel
import json
import xlsxwriter
def main():
"""
for exporting licenses in json file execute
pip-licenses --order=license --format=json > licenses.json
Note! pip-licenses must be installed in the environment
@nikitagruia-dev
nikitagruia-dev / parse_data.html
Last active July 26, 2019 14:16
regex for parsing hph vars from html
<!-- Regex below -->
<!-- [\$\{]([^}]+)\} -->
<body>
<p style="margin-top: 0; margin-bottom: 0;"><span style="font-family: 'Arial';">MODEL ADEVERINb ANGAJATOR</span></p>
<p>&nbsp;</p>
<p style="margin-top: 0; margin-bottom: 0;"><span style="font-family: 'Arial'; color: #000000;">Antetul unitc</span></p>
<p style="margin-top: 0; margin-bottom: 0;"><span style="font-family: 'Arial'; color: #000000;">ii (${Societa</span></p>
<p style="margin-top: 0; margin-bottom: 0;"><span style="font-family: 'Arial'; color: #000000;">te</span></p>
<p style="margin-top: 0; margin-bottom: 0;"><span style="font-family: 'Arial'; color: #000000;">a}, ${Adresa S</span></p>
@nikitagruia-dev
nikitagruia-dev / test_runner.py
Created July 10, 2019 15:07
Django, MongoDB, and MongoEngine: A custom TestRunner managing mongo test database creation and cleanup.
# coding: utf-8
from django.conf import settings
from django_nose import NoseTestSuiteRunner
class MongoTestRunner(NoseTestSuiteRunner):
"""
A test runner that can be used to create, connect to, disconnect from,
and destroy a mongo test database for standard django testing.
Redefine TEST_RUNNER in settings