Skip to content

Instantly share code, notes, and snippets.

View njames's full-sized avatar

Nigel James njames

View GitHub Profile
@njames
njames / Pretty-comments.txt
Created July 28, 2023 03:51
Pretty Comments
View Pretty-comments.txt
/*
* -----------------------------------------------------------------------------
* A sample comment
* -----------------------------------------------------------------------------
*
* This poetic style of comment has three features: Firstly the title is
* between two lines of dashes that extend to character eighty. Three lines
* of text describing the intent that extend out characters 73, 76 and then 79
*
* -----------------------------------------------------------------------------
@njames
njames / .bash_aliases
Last active August 14, 2023 03:09
.bash_aliases
View .bash_aliases
# up & down map to history search once a command has been started.
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
alias e="echo $1"
alias ..="cd .."
alias ...="cd ../.."
alias ll='ls -alh'
alias vi=vim
@njames
njames / versions.sh
Last active September 6, 2023 03:52
Requirements for BTP Local
View versions.sh
#!/usr/bin/bash
echo -e "\nNode version --------";
node -v ;
echo -e "\nGit version ---------";
git --version;
echo -e "\nui5 cli version -----";
ui5 --version;
echo -e "\ncf cli version ------";
cf --version;
echo -e "\nCAP version ---------";
@njames
njames / dslr-webcam.md
Created January 18, 2023 05:18 — forked from jessarcher/dslr-webcam.md
Using my Canon 70D DSLR camera as a web cam on Linux
View dslr-webcam.md

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: https://github.com/umlaeute/v4l2loopback (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using https://github.com/danielkza/v4l2loopback-fedora/)
  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
njames / delete_branches_older_than.sh
Last active January 29, 2024 12:04 — forked from AvnerCohen/delete_branches_older_than.sh
Script to delete branches older than 6 months old, ignore local vs remote errors.
View delete_branches_older_than.sh
#!/bin/sh
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
ECHO=""
fi
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///')
$ECHO git branch -d "${local_branch_name}"
@njames
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
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
njames / markdown.md
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
View markdown.md

#Reveal.js Markdown starter (for 10)

Getting started with Reveal.js with an external markdown file


###Grocery List

  • Goat
@njames
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>
<html>
<head>
<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>