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
| API_URL = 'https://api.ocr.space/parse/image' | |
| API_KEY = '6c8f8b69c988957' | |
| image_content_class = 'captcha-image-dimension' | |
| IMAGE_URL = self.browser.find_element_by_class_name( | |
| image_content_class).get_attribute("src").replace('blob:', '') | |
| ic(IMAGE_URL) | |
| captcha_content = requests.get(IMAGE_URL, timeout=5).content | |
| image_64_encode = str(base64.encodestring(captcha_content)) | |
| ic(image_64_encode) |
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
| class ProductVariantViewset(DestroyMixin, ModelViewSet): | |
| ''' REST Endpoint for ProductVariant. ''' | |
| queryset = ProductVariant.objects.all() | |
| serializer_class = ProductVariantSerializer | |
| def create(self, request, *args, **kwargs): | |
| serializer = self.get_serializer(data=request.data) | |
| serializer.is_valid(raise_exception=True) | |
| variant = serializer.save() |
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 apt install libgraphviz-dev | |
| pip install python3-pygraphviz graphviz | |
| pip install --global-option=build_ext --global-option="-I/usr/local/Cellar/graphviz/2.38.0/include/" --global-option="-L/usr/local/Cellar/graphviz/2.38.0/lib/" pygraphviz |
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 groupadd docker | |
| sudo gpasswd -a $USER docker | |
| newgrp docker |
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
| {% load i18n %} | |
| {% load admin_urls %} | |
| {% if has_export_permission %} | |
| <li><a href="{% url opts|admin_urlname:'export' %}{{cl.get_query_string}}" class="export_link">{% trans "Export" %}</a></li> | |
| {% endif %} |
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
| # ModelAdmin.get_urls()[source] | |
| # The get_urls method on a ModelAdmin returns the URLs to be used for that ModelAdmin in the same way as a URLconf. Therefore you can | |
| # extend them as documented in URL dispatcher: | |
| from django.contrib import admin | |
| from django.urls import path | |
| class MyModelAdmin(admin.ModelAdmin): |
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
| <!-- TOP BAR --> | |
| <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | |
| <a class="navbar-brand" href="#">{{ blog.author }}</a> | |
| <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | |
| <span class="navbar-toggler-icon"></span> | |
| </button> | |
| <div class="collapse navbar-collapse" id="navbarSupportedContent"> | |
| <ul class="navbar-nav mr-auto"> | |
| <li class="nav-item social_links"><a href="" class="nav-link"><span class="fa fa-twitter"></span></a></li> |
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/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # | |
| # Complete the 'validate' function below. |
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/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # | |
| # Complete the 'classifySignals' function below. |
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
| import java.io.*; | |
| import java.util.*; | |
| public class Solution { | |
| static long matches(long num, long k){ | |
| long under = num*num-4*k*num; | |
| if(under<=0) | |
| return num-1; | |
| double rad = Math.sqrt(under); |