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
set -ex | |
sudo apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates \ | |
curl \ | |
gnupg-agent \ | |
software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
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
void main() { | |
Map<int, String> myIntMap = {5: "hello!"}; | |
print(myIntMap["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
""" | |
Tired of seeing this annoying message - "Waiting for background tasks to complete."? | |
This hack can take care of that for you! | |
Usage - | |
$ python main.py | |
Bonus - easy to attach a debugger now | |
$ python -m pdb main.py |
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
""" | |
Instructions - | |
pip install httpx ipython | |
ipython -i async_vs_threads.py | |
%timeit asyncio.run(test_threads()) | |
%timeit asyncio.run(test_async()) | |
""" |
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
Sentiments of a broken nation | |
Separated by religions and the hesitation | |
Vote banks, industries and corporations | |
Filthy pockets of the rich and famous | |
At the cost of poverty and desperation | |
Facing death and struggling daily | |
Without having a definite solution | |
Death and problems has no religion | |
Respect your neighbour from another nation | |
Fill the hearts with humanity |
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
void main() { | |
List<int> x = createList(); | |
} | |
List<int> createList() { | |
return ["1", "2", "3", "4", "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
void main() { | |
List<int> x = createList(); | |
} | |
createList() { | |
return ["1", "2", "3", "4", "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
# | |
# Adapted from https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html#capture-video-from-camera | |
# | |
import numpy as np | |
import cv2 | |
caps = [cv2.VideoCapture(i) for i in range(2)] # open 2 camera feeds | |
while(True): |
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
var start = DateTime.now() | |
var db = await appSync.getCacheDatabase(); | |
var pages = appSync.paginate( | |
..., | |
priority: CachePriority.cache, // Try cache first, then network | |
cache: db, | |
); |
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
import typing | |
from django.db import models | |
from channels.db import database_sync_to_async | |
M = typing.TypeVar("M", bound=models.Model) | |
class AsyncCrud: |