This file contains hidden or 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 asyncio | |
async def eternity(): | |
await asyncio.sleep(2) # Sleep asynchronously | |
print("I should've timed out") | |
async def main(): | |
# Wait for at most 1 second | |
try: | |
await asyncio.wait_for(eternity(), timeout=1.0) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 the logging level | |
logging: | |
level: info | |
## Show welcome message | |
welcome-message: true | |
## Connector modules | |
connectors: | |
homeassistant: |
This file contains hidden or 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 opsdroid_homeassistant import HassSkill, match_sunrise, match_sunset | |
class SunriseSkill(HassSkill): | |
@match_sunset | |
async def lights_on_at_sunset(self, event): | |
await self.turn_on("light.outside") | |
@match_sunrise |
This file contains hidden or 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 asyncio import sleep | |
from opsdroid_homeassistant import HassSkill, match_hass_state_changed | |
class MotionLights(HassSkill): | |
@match_hass_state_changed("binary_sensor.drive", state="on") | |
async def motion_lights(self, event): | |
"""Turn the outside light on with motion if after sunset.""" | |
if await self.sun_down(): |
This file contains hidden or 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 gpu(doc): | |
fig = figure(title="GPU Utilization", sizing_mode="stretch_both", x_range=[0, 100]) | |
def get_utilization(): | |
return [ | |
pynvml.nvmlDeviceGetUtilizationRates(gpu_handles[i]).gpu | |
for i in range(ngpus) | |
] | |
gpu = get_utilization() |
This file contains hidden or 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 | |
PATH="/path/to/your/miniconda3/bin:<rest of your path>" | |
eval "$(conda shell.bash hook)" | |
conda activate jupyter | |
cd ~ && /path/to/your/miniconda3/envs/jupyter/bin/python -m jupyter lab --port 8888 --no-browser |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>jupyter-startup</string> | |
<key>ProgramArguments</key> | |
<array><string>/path/to/my/jupyter/startup/script.sh</string></array> | |
<key>RunAtLoad</key> | |
<true/> |
This file contains hidden or 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
--- | |
layout: default | |
--- | |
## Getting Started | |
{{ site.description }} | |
You can add this repository to your local helm configuration as follows : |