This file contains 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
-- Table column attributes | |
SELECT | |
c.table_name, | |
c.column_name, | |
c.ordinal_position, | |
c.is_nullable, | |
c.data_type, | |
c.character_maximum_length, | |
c.udt_name | |
FROM information_schema.columns c |
This file contains 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 datetime import datetime, timedelta | |
from dataclasses import dataclass | |
from zoneinfo import ZoneInfo | |
@dataclass(slots=True) | |
class WorkShift: | |
id: int | |
begin: int | |
end: int |
This file contains 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 pyproj import Geod | |
GEOD_WGS84 = Geod(ellps='WGS84') | |
def forward(point: tuple[float, float], az: float, dist: float) -> tuple[float, float]: | |
x, y = point[0], point[1] | |
lon, lat, _ = GEOD_WGS84.fwd(x, y, az, dist, radians=False) | |
return lon, lat |
This file contains 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
# Разделяем импорты пакетов на следующие логические блоки: | |
# блок импортов пакетов, поставляемых с Python | |
import datetime | |
import hmac | |
import json | |
import logging | |
from typing import Union, Type | |
# блок импортов сторонних пакетов |
This file contains 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
# Euclidean distance. | |
def euc_dist(pt1,pt2): | |
return math.sqrt((pt2[0]-pt1[0])*(pt2[0]-pt1[0])+(pt2[1]-pt1[1])*(pt2[1]-pt1[1])) | |
def _c(ca,i,j,P,Q): | |
if ca[i,j] > -1: | |
return ca[i,j] | |
elif i == 0 and j == 0: | |
ca[i,j] = euc_dist(P[0],Q[0]) | |
elif i > 0 and j == 0: |
This file contains 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 | |
# --------------------------------------------------------------------------------- | |
# This script written by Howard Rogers. | |
# | |
# It's purpose is to install Oracle 12c onto 64-bit Ubuntu 16.04. | |
# | |
# See http://www.dizwell.com/wordpress/technical-articles/oracle/install-oracle-12c-on-ubuntu-16-04/ for some details. | |
# | |
# Copyright (c) 2016 Howard Rogers,Dizwell Informatics |
This file contains 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 datetime import datetime as dt | |
from django.conf import settings | |
from django.conf.urls import include, url | |
from dash import BaseDashView, Dash | |
from dash.dependencies import Input, Output | |
import dash_core_components as dcc | |
import dash_html_components as html | |
from pandas_datareader import data as web |
This file contains 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
def metaclass_resolver(*classes, **options): | |
"""Metaclass resolver | |
Example: | |
SomeClass(metaclass_resolver(ClassMixin, BaseClass, SomeActionClass, some_field1=True, some_field2=42)): | |
pass | |
:param classes: | |
:param options: | |
:return: |
This file contains 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 django.urls import RegexURLResolver, RegexURLPattern, get_resolver | |
from django.utils.regex_helper import normalize | |
r = get_resolver() | |
r._up = '' | |
urlpatterns = [r] | |
urls = [] | |
while urlpatterns: | |
u = urlpatterns.pop(0) |
This file contains 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
_CONTENT_TYPES = { '.png': 'image/png', '.gif': 'image/gif', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.jpe': 'image/jpeg' } | |
def _encode_multipart(**kw): | |
''' | |
Build a multipart/form-data body with generated random boundary. | |
''' | |
boundary = '----------%s' % hex(int(time.time() * 1000)) | |
data = [] | |
for k, v in kw.iteritems(): | |
data.append('--%s' % boundary) |
NewerOlder