Skip to content

Instantly share code, notes, and snippets.

View ivlevdenis's full-sized avatar
🏠
Working from home

Ivlev Denis ivlevdenis

🏠
Working from home
View GitHub Profile
@ivlevdenis
ivlevdenis / androidvideoview
Last active August 16, 2022 16:05
kivy android native videoview
import os
import re
from kivy.logger import Logger
from kivy.properties import (ObjectProperty, BooleanProperty, StringProperty,
OptionProperty, NumericProperty, ReferenceListProperty)
from kivy.uix.widget import Widget
from kivy.utils import platform
# -*- coding: utf-8 -*-
from base64 import b64encode
from datetime import datetime
from os.path import join
try:
import json
except ImportError:
import simplejson as json
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.lang import Builder
from kivy.properties import StringProperty
kv = '''
<MyWidget>:
canvas:
Rectangle:
size: self.size
@ivlevdenis
ivlevdenis / autoscrollablelabel.py
Created November 28, 2015 14:23
Kivy oriented auto scrollable label
from kivy.animation import Animation
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import (BooleanProperty, ListProperty, NumericProperty,
OptionProperty, ObjectProperty, StringProperty)
from kivy.uix.label import Label
from kivy.uix.scrollview import ScrollView
Builder.load_string("""
<AutoScrollableVLabel>:
@ivlevdenis
ivlevdenis / args.py
Created January 27, 2016 15:27 — forked from dcramer/args.py
Python Standards (that I would change and enforce if I could)
# dont do this
this_function_name(foo, bar
baz)
# do this
cramers_version(
foo, bar, baz)
# allow this
cramers_version(foo, bar,
@ivlevdenis
ivlevdenis / fast_xml2cvs.py
Last active July 24, 2017 15:34
Fast convert big xml to cvs.
from lxml import etree
from time import time
st = time()
c = 0
order_pattern = [
'1st_column',
'2nd_column',
'3rd_column',
@ivlevdenis
ivlevdenis / aio_websocket.py
Created November 18, 2016 11:28
Simple autobahn websocket server with asyncio loop.
# ! /usr/bin/env python3
import asyncio
from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory
class MyServerProtocol(WebSocketServerProtocol):
def processHandshake(self):
hand = super().processHandshake()
print(self.http_headers)
return hand
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server 127.0.0.1:8888;
}
upstream backend_PROJ {
server unix:///opt/PROJ/socket;
@ivlevdenis
ivlevdenis / socket_client_1c.pyw
Created February 7, 2017 13:09
Интеграция 1С
import os
import json
import asyncio
from datetime import datetime
from sys import platform
from autobahn.asyncio.websocket import WebSocketClientProtocol, WebSocketClientFactory
loop = asyncio.get_event_loop()
@ivlevdenis
ivlevdenis / django_graphene_orderBy.py
Last active September 14, 2023 17:58
Django graphene orderBy
from graphene import relay, String, List
from graphene_django.filter import DjangoFilterConnectionField
from graphene_django.fields import DjangoConnectionField
from app.models import Model
class Object(DjangoObjectType):
class Meta:
model = Model