This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window, document, version, callback) { | |
var j, d; | |
var loaded = false; | |
if (!(j = window.jQuery) || version > j.fn.jquery || callback(j, loaded)) { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = "/media/jquery.js"; | |
script.onload = script.onreadystatechange = function() { | |
if (!loaded && (!(d = this.readyState) || d == "loaded" || d == "complete")) { | |
callback((j = window.jQuery).noConflict(1), loaded = true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker-compose -f local.yml run --rm django coverage run --source . -m py.test | |
docker-compose -f local.yml run --rm django coverage report | |
docker-compose -f local.yml run --rm django coverage html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stop all containers | |
docker stop $(docker ps -a -q) | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="base"> | |
<div class="btn-group" :class="{show : dropDown}"> | |
<input class="form-control mr-sm-2" placeholder="{% trans 'Search' %}" v-model="q" data-toggle="dropdown" aria-haspopup="true" :aria-expanded="{true : dropDown}"> | |
<div class="dropdown-menu"> | |
<search-item | |
v-for="item in search" | |
:item="item" | |
:key="item.id"> | |
</search-item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cities_light.models import City | |
import idna | |
file = open('/tmp/domains.txt', 'w') | |
cities = City.objects.all() | |
for city in cities: | |
file.write(str(idna.encode((city.alternate_names).lower().replace(' ','-') + str('.домен.рф')))+str('\n')) | |
file.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from urllib.request import urlopen, Request | |
import csv | |
from selenium import webdriver | |
import time | |
import math | |
import ast | |
from sqlalchemy.exc import IntegrityError, InterfaceError, InvalidRequestError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [11]: #!/usr/bin/python | |
...: from PIL import Image | |
...: import os, sys | |
...: | |
...: path = "/var/www/gglobal/media/images/" | |
...: dirs = os.listdir( path ) | |
...: | |
...: def resize(): | |
...: for item in dirs: | |
...: if os.path.isfile(path+item): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [11]: import os | |
...: for root, dirs, files in os.walk('/var/www/gglobal/media/images/'): | |
...: for fn in files: | |
...: path = os.path.join(root, fn) | |
...: size = os.stat(path).st_size | |
...: print('{} {} bytes'.format(path.split('/')[-1], size)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from myapp.models import User | |
...: | |
...: users = [] | |
...: | |
...: for i in range(1000): | |
...: user = User(first_name='User%dFirstName' % i, | |
...: last_name='User%dLastName' % i, | |
...: username='user%d' % i, | |
...: email='user%[email protected]' % i, | |
...: password='hashedPasswordStringPastedHereFromStep1!', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo lsof -t -i tcp:8000 | xargs kill -9 |