Skip to content

Instantly share code, notes, and snippets.

View mikevb3's full-sized avatar

Miguel Villarreal mikevb3

View GitHub Profile
@phatnguyenuit
phatnguyenuit / how-to-compose-react-providers-with-typescript.md
Last active October 12, 2024 18:04
How to compose React Providers with TypeScript

How to compose React Providers with TypeScript

Tree and sunset

Photo by Sergei A on Unsplash

Hi guys 😁! Long time no new articles!

Today, I am going to show you how to compose React providers with TypeScript.

@djouallah
djouallah / delta.py
Created October 25, 2023 12:50
write to Onelake using Python
%%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()
@viannaandreBR
viannaandreBR / .wslconfig
Last active November 10, 2024 19:14
.wslconfig
# Settings apply across all Linux distros running on WSL 2
# https://docs.microsoft.com/pt-br/windows/wsl/wsl-config
[wsl2]
# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
#memory=4GB
memory=4GB
# Sets the VM to use two virtual processors
#processors=2
@jramiresbrito
jramiresbrito / wsl2_android_device_via_wifi_or_usb.md
Last active November 4, 2024 17:37
Connect Android Devices to WSL2 with WIFI or USB
@hacker-volodya
hacker-volodya / Dockerfile
Created March 17, 2020 10:04
Dockerfile for poetry project
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
@tshirtman
tshirtman / responsive_example.py
Last active June 23, 2024 01:55
Making a simple responsive app layout.
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>:
@dmfigol
dmfigol / asyncio_loop_in_thread.py
Last active November 14, 2024 08:52
Python asyncio event loop in a separate thread
"""
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
@dolang
dolang / kivy_asyncio_example.py
Created May 28, 2018 15:46
Kivy with an asyncio EventLoop example
"""
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+.
"""
@vxgmichel
vxgmichel / udpproxy.py
Created February 2, 2017 10:05
UDP proxy server using asyncio
"""UDP proxy server."""
import asyncio
class ProxyDatagramProtocol(asyncio.DatagramProtocol):
def __init__(self, remote_address):
self.remote_address = remote_address
self.remotes = {}
@tizmagik
tizmagik / getLastInMap.js
Created August 13, 2016 03:22
ES6 Last Item in Map()
// 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.