Skip to content

Instantly share code, notes, and snippets.

View njames's full-sized avatar

Nigel James njames

View GitHub Profile
@njames
njames / .bash_aliases
Last active March 10, 2024 04:49
full .bash_aliases
alias dkr-nuke='docker stop $(docker ps -a -q);docker rm $(docker ps -a -q);'
# create a directory and cd into it
mkcdir ()
{
mkdir -p -- "$1" &&
cd -P -- "$1"
}
# helper for jira
@njames
njames / Pretty-comments.txt
Created July 28, 2023 03:51
Pretty Comments
/*
* -----------------------------------------------------------------------------
* 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 March 10, 2024 04:48
.bash_aliases
# This is a small set of aliases on servers I ssh into for cli navigation
# 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 ../.."
@njames
njames / versions.sh
Last active September 6, 2023 03:52
Requirements for BTP Local
#!/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

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 July 18, 2024 02:22 — forked from AvnerCohen/delete_branches_older_than.sh
Script to delete branches older than 6 months old, ignore local vs remote errors.
#!/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
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
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

#Reveal.js Markdown starter (for 10)

Getting started with Reveal.js with an external markdown file


###Grocery List

  • Goat