-
Single-line comments are started with
//
. Multi-line comments are started with/*
and ended with*/
. -
C# uses braces (
{
and}
) instead of indentation to organize code into blocks. If a block is a single line, the braces can be omitted. For example,
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
%%time | |
!pip install -q duckdb | |
!pip install -q deltalake | |
import duckdb | |
from deltalake.writer import write_deltalake | |
from trident_token_library_wrapper import PyTridentTokenLibrary | |
aadToken = PyTridentTokenLibrary.get_access_token("storage") | |
sf =1 | |
for x in range(0, sf) : | |
con=duckdb.connect() |
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 python:3.8 | |
RUN mkdir /app | |
WORKDIR /app | |
RUN pip install poetry | |
RUN poetry config virtualenvs.create false | |
COPY poetry.lock pyproject.toml /app/ | |
RUN poetry install -n --no-root --no-dev | |
# poetry dependencies installed, here you may want to copy your project package, set command for container, etc. | |
# all dependencies was installed without virtualenv, so you don't have to use `poetry run` in container |
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 kivy.app import App | |
from kivy.lang import Builder | |
from kivy.properties import OptionProperty | |
from kivy.core.window import Window | |
from kivy.factory import Factory | |
KV = ''' | |
#:import A kivy.animation.Animation | |
<RLabel@Label>: |
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
""" | |
This gist shows how to run asyncio loop in a separate thread. | |
It could be useful if you want to mix sync and async code together. | |
Python 3.7+ | |
""" | |
import asyncio | |
from datetime import datetime | |
from threading import Thread | |
from typing import Tuple, List, Iterable |
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
""" | |
Kivy asyncio example app. | |
Kivy needs to run on the main thread and its graphical instructions have to be | |
called from there. But it's still possible to run an asyncio EventLoop, it | |
just has to happen on its own, separate thread. | |
Requires Python 3.5+. | |
""" |
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
"""UDP proxy server.""" | |
import asyncio | |
class ProxyDatagramProtocol(asyncio.DatagramProtocol): | |
def __init__(self, remote_address): | |
self.remote_address = remote_address | |
self.remotes = {} |
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
// Since ES6 Map()'s' retain their order of insertion, it can sometimes be useful to get the last item or value inserted: | |
export const getLastItemInMap = map => Array.from(map)[map.size-1] | |
export const getLastKeyInMap = map => Array.from(map)[map.size-1][0] | |
export const getLastValueInMap = map => Array.from(map)[map.size-1][1] | |
// Obviously getLastKey and getLastValue can reuse getLastItem, but for maximum portability I opted for verbosity. |
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 dronekit import connect, VehicleMode, LocationGlobalRelative | |
from pymavlink import mavutil | |
import time | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--connect', default='127.0.0.1:14550') | |
args = parser.parse_args() | |
# Connect to the Vehicle |
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
# coding:utf-8 | |
from kivy.app import App | |
from kivy.uix.image import Image | |
from kivy.clock import Clock | |
from kivy.graphics.texture import Texture | |
import cv2 | |
class KivyCamera(Image): | |
def __init__(self, capture, fps, **kwargs): |
NewerOlder