Skip to content

Instantly share code, notes, and snippets.


Nigel James njames

View GitHub Profile
njames /
Created January 18, 2023 05:18 — forked from jessarcher/
Using my Canon 70D DSLR camera as a web cam on Linux

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using
  2. gPhoto2 - this is what allows you to access your cameras live feed over USB - this was available in Fedora's repos.
  3. GStreamer or ffmpeg - this is what lets you stream the output from gPhoto2 into the loopback device.

It's been a little while since I set it all up so I can't remember all of the installation details, which will probably be different for your distro anyway unless you're using Fedora. Apologies if I have forgotten something as wel.

Running the stream

njames /
Last active May 13, 2023 18:44 — forked from AvnerCohen/
Script to delete branches older than 6 months old, ignore local vs remote errors.
ECHO='echo '
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'main$\|develop$'); do
if ! ( [[ -f "$branch" ]] || [[ -d "$branch" ]] ) && [[ "$(git log $branch --since "1 month ago" | wc -l)" -eq 0 ]]; then
if [[ "$DRY_RUN" = "false" ]]; then
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///')
$ECHO git branch -d "${local_branch_name}"
njames / get_caller_id.abap
Created August 14, 2019 05:03
example determining user from service now
View get_caller_id.abap
method get_caller_id.
data: uri type string
, body type string
, token type string
, agreements type string
, lo_response type ref to if_rest_entity
* , parser TYPE REF TO /ui5/cl_json_parser
, user type ref to data
, user_row type ref to data
njames / get_assignement_group.abap
Created August 14, 2019 05:02
example code for integrating into service now from fiori
View get_assignement_group.abap
method get_assignment_group.
data: uri type string
, group type ref to data
, group_row type ref to data
, group_name type string
, response type ref to if_rest_entity
* read the group name from config * hard coded from now
njames /
Created December 10, 2015 23:26
Example markdown file to use with Reveal.js showing horizontal and vertical transitions and builds and formatting with html comments

#Reveal.js Markdown starter (for 10)

Getting started with Reveal.js with an external markdown file

###Grocery List

  • Goat
njames / base-reveal.js.html
Last active December 10, 2015 23:31
Base file for Reveal.js presentation using markdown
View base-reveal.js.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Using reveal.js with external markdown</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="/js/reveal.js/css/reveal.css"/>
<style type="text/css">code{white-space: pre;}</style>
njames / handleError.js
Created November 29, 2015 06:44
function for handling odata error calls
View handleError.js
function(oError) {
// var msg = $(oError.response.body).find('message').first().text();
try {
var msg = JSON.parse( oError.response.body).error.message.value;
msg = msg.split("|")[1];
} finally {
msg = "An error occurred on requesting access.";
njames / ModelData.js
Created November 29, 2015 03:13
Get data from the Model for a event (sim for a control)
View ModelData.js
// get data from the Model for a event (sim for a control)
var path = oEvent.getSource().getBindingContextPath(),
data = this.getView().getModel().getProperty( path );
njames / forloops.js
Last active November 28, 2015 23:55
Favorite for loops
View forloops.js
for (var i = 0, m = array.length; i < m; i++){ /// ... }
/// this pattern reduces the cost of counting the array or other object more than once