Skip to content

Instantly share code, notes, and snippets.

View kbingham's full-sized avatar

Kieran Bingham kbingham

View GitHub Profile
@kbingham
kbingham / rpi4-usb.sh
Last active February 25, 2021 14:44 — forked from ianfinch/rpi4-usb.sh
Raspberry Pi 4 USB Gadget
#!/bin/bash
# Set up a Raspberry Pi 4 as a USB-C Ethernet Gadget
# Based on:
# - https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/
# - https://pastebin.com/VtAusEmf
if ! $(grep -q dtoverlay=dwc2 /boot/config.txt) ; then
echo "Add the line dtoverlay=dwc2 to /boot/config.txt"
exit
fi
#!/bin/sh
# Requires 'media-ctl' to parse the media devices
# Requires 'dot' to generate the media-graph png files.
# Identify all V4L2 devices
for v in /sys/class/video4linux/{v4l,video}*;
do
vn=`basename $v`
name=`cat $v/name`
@kbingham
kbingham / vimc-capture.sh
Last active August 11, 2020 10:34
Configure and capture multiple streams from VIMC
#!/bin/bash
MEDIA=/dev/$(grep VIMC /sys/bus/media/devices/media*/model | sed 's/.*\(media[0-9]*\).*/\1/g')
function v4l2_dev() {
grep "$1" /sys/class/video4linux/video*/name | sed 's#.*\(video[0-9]*\)/.*#\1#g'
}
RAW0=/dev/$(v4l2_dev "Raw Capture 0")
RAW1=/dev/$(v4l2_dev "Raw Capture 1")
@kbingham
kbingham / build-all.sh
Created June 9, 2020 11:19
Multiple build script for libcamera
#!/bin/bash
# Stop on errors
set -e
function build() {
echo "Building for $1"
export BUILDDIR=build-$1
export CC=$2
@kbingham
kbingham / lcdebug
Created April 22, 2020 15:57
lcdebug wrapper helper
#!/bin/bash
# We default to enabling the most debug
# (that's why we're being used right)
FILTER="*"
LEVEL="0"
while [[ $# -gt 0 ]]
do
#!/bin/sh
TARGETIP=$1
DEV=${2:-/dev/media0}
ssh $TARGETIP -o StrictHostKeyChecking=no \
-tC \
media-ctl -d $DEV --print-dot 2>/dev/null | \
grep -v bash | \
tee /tmp/$TARGETIP-mc.dot | \
#!/bin/sh
CONTAINER="$1"
shift
XFORWARD="-e DISPLAY=$DISPLAY.0 -v /tmp/.X11-unix:/tmp/.X11-unix"
#
# We can now run in 'arm64' containers:
# docker run -it --rm multiarch/alpine:aarch64-edge
From:
https://github.com/zephyrproject-rtos/zephyr/blob/master/boards/arm/96b_wistrio/96b_lscon.dtsi
/*
* Copyright (c) 2019 Linaro Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
#/bin/bash
CONFIG_HZ=$1
# The output of timeconst.sh is parsed by sed to remove the
# following diff from each comparison
# --- BC
# +++ SH
# @@ -1,4 +1,4 @@
@kbingham
kbingham / noscript-tracking.go
Created May 7, 2019 08:18 — forked from wybiral/noscript-tracking.go
Tracking cursor position in real-time with remote monitoring (without JavaScript)
// Tracking cursor position in real-time without JavaScript
// Demo: https://twitter.com/davywtf/status/1124146339259002881
package main
import (
"fmt"
"net/http"
"strings"
)