Skip to content

Instantly share code, notes, and snippets.

View dlong500's full-sized avatar

Davison Long dlong500

  • Next Generation Technologies
  • Richmond, VA
View GitHub Profile
@dlong500
dlong500 / highlightJSX.js
Created February 14, 2024 00:54
regex text/JSX highlighters
// quick and dirty
highlightJSX(stringToEvaluate, searchTerm) {
const regex = new RegExp(searchTerm, 'gi');
const resultText = stringToEvaluate.replace(regex, `<mark class="highlight">$&</mark>`);
return <span dangerouslySetInnerHTML={{ __html: resultText }} />;
}
// highlightJSX('this is a string to search and to evaluate', 'to')
// expected output
// <>this is a string <mark class="highlight">to</mark> search and <mark class="highlight">to</mark> evaluate<>
@dlong500
dlong500 / intercept-stdout.js
Created September 7, 2023 20:06 — forked from benbuckman/intercept-stdout.js
Hooking into Node.js stdout, pipe stdout to telnet
var _ = require('underscore'),
util = require('util');
// intercept stdout, passes thru callback
// also pass console.error thru stdout so it goes to callback too
// (stdout.write and stderr.write are both refs to the same stream.write function)
// returns an unhook() function, call when done intercepting
module.exports = function interceptStdout(callback) {
var old_stdout_write = process.stdout.write,
old_console_error = console.error;
@dlong500
dlong500 / ffmpeg.md
Created March 19, 2023 21:43 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
/*
* add-profile.c ... paste an ICC profile into a JPG file, without
* decompress/recompress.
*
* Adapted from wrjpgcom.c
*
* compile with:
*
* gcc -g -Wall add-profile.c `pkg-config glib-2.0 --cflags --libs`
*/
@dlong500
dlong500 / copy-from-time-machine.sh
Created June 27, 2022 16:45 — forked from magicoli/copy-from-time-machine.sh
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
@dlong500
dlong500 / shell-setup.ps1
Created June 23, 2022 00:34 — forked from mikepruett3/shell-setup.ps1
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@dlong500
dlong500 / gist:d9612cc5da200218c1c23e67fe2d613b
Created July 31, 2018 20:29
vips/glib diagnostic output (attempt 1)
to be executed: node entry.js deepzoom
vips_init: starting
vips_init: done
vips_init: starting
vips_init: starting
vips_init: starting
vips_init: starting
vips_init: starting
vips_init: starting
vips_init: starting
@dlong500
dlong500 / build_attempt1.txt
Created September 9, 2017 20:20
libvips Docker image build attempt
I've tried several times and also with both 8.4 and 8.5 libvips versions. The below output is from an attempt to build the 8.4 version:
root@voyager:/opt/nodejs/build-win64# ./build.sh 8.4
xenial: Pulling from library/ubuntu
Digest: sha256:34471448724419596ca4e890496d375801de21b0e67b81a77fd6155ce001edad
Status: Image is up to date for ubuntu:xenial
Sending build context to Docker daemon 2.56 kB
Step 1 : FROM ubuntu:xenial
---> ccc7a11d65b1
Step 2 : MAINTAINER Lovell Fuller <npm@lovell.info>
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.