Skip to content

Instantly share code, notes, and snippets.

View robcowie's full-sized avatar

Rob Cowie robcowie

  • Recycleye
  • Leeds/London, United Kingdom
View GitHub Profile
@robcowie
robcowie / asyncio_loop.py
Created August 18, 2024 18:18
Asyncio loop with example long-running tasks, signal handlers and graceful clean up on termination
"""Asyncio loop example.
* Long running tasks
* Graceful shutdown with task cancellation
* Signal handling (SIGTERM, SIGINT)
* Use uvloop for better performance
"""
import asyncio
import signal
@robcowie
robcowie / install.sh
Created July 19, 2023 11:38
Coming Gstreamer in Nvidia l4t Deepstream 6.2 Container (non-functional)
cd ~
# Copy nv* gstreamer elements
mkdir nvgst
cp /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnv* ./nvgst/
# Dependency dir
mkdir -p /build
# Upgrade packages and install missing dependencies
@robcowie
robcowie / gstreamer_examples.md
Last active June 16, 2023 19:27
Gstreamer Pipeline Examples

Gstreamer Examples

Videotest Source

gst-launch-1.0 -e videotestsrc pattern=ball num-buffers=300 \
! video/x-raw,width=640,height=480,framerate=30/1 \
! nvvideoconvert \
! nvv4l2h265enc \
! mp4mux \
@robcowie
robcowie / README.md
Last active June 9, 2024 15:39
Create IoT Edge device certificates

Device Certificate Creation

Procedure

  1. Download create_device_certs.sh and openssl_root_ca.cnf into the same directory
  2. Create a dir ROOTS and download the required root certificates into it. Search for IoT CA Certificates in 1Password and download all 3 attached files.
  3. Run the script with the device name for example sh create_device_certs.sh mssdaq01
  4. 4 files are needed on the device. Find them in certificates/deviceid-certificates/to-device. For example
@robcowie
robcowie / agx_xavier_tips-and-tricks.md
Created May 4, 2023 21:28 — forked from andrewssobral/agx_xavier_tips-and-tricks.md
Tips and Tricks for Jetson AGX Xavier
@robcowie
robcowie / nvidia_docker_package_summary.txt
Created February 4, 2023 20:12
A summary of the Nvidia Docker-related packages from one of the Nvidia devs
I originally posted a similar answer here, but hopefully this clears things up:
NVIDIA/k8s-device-plugin#168 (comment)
The set of packages collectively referred to as nvidia-docker consists of the following components (and their dependencies from top to bottom):
nvidia-docker2
nvidia-container-runtime
nvidia-container-toolkit
libnvidia-container
Unfortunately, the documentation across the repos that host code for these projects is inconsistent and misleading at times.
@robcowie
robcowie / stub_event_source.py
Last active May 18, 2022 11:42
Stub event sources for consumption by stream processing code
# loop = asyncio.get_event_loop()
# loop.run_until_complete(event_source_async(your_handler))
import asyncio
import random
import time
def randint():
return random.randint(-100, 100)
@robcowie
robcowie / gh_dependabot.sh
Last active May 15, 2024 21:37
gh cli commands to work with Dependabot PRs
# Github CLI commands to work with dependabot PRs
# List dependabot PRs that need review
gh pr list -l dependencies --search "status:success review:none"
gh pr list -A app/dependabot --search "status:success review:none"
# Instruct dependabot to merge all reviewed PRs, oldest first
gh pr list \
-A app/dependabot \
--search "status:success review:approved" \
@robcowie
robcowie / foreign_keys_without_indexes.sql
Created October 15, 2021 15:33
Find foreign keys that do not have an index on them in Postgresql
-- Show all foreign keys that do not have an index on them
-- Potential performance problem if the join is performed often
SELECT
tc.table_name,
kcu.column_name,
tc.constraint_name
FROM
information_schema.table_constraints AS tc
JOIN