Skip to content

Instantly share code, notes, and snippets.

View grmartin's full-sized avatar
🐧
9780198811701

Glenn R. Martin grmartin

🐧
9780198811701
View GitHub Profile
@grmartin
grmartin / Example.md
Last active October 28, 2022 18:57
Execute Piped Scripts in a Docker Container with Content from the Host

Overview

There are many times we have Bootstrapping scripts to manage a highly custom docker setup, while tools like docker-compse and Dockerfile are good for many things, and even when we can just rely on those tools, we often find ourselves writing scripts for repeated actions during development.

These often contain complex one-liners in the form of docker exec commands. I was hoping to find a more legible way to write these without condensing things in to one line or across multiple exec commands. What I found was I could not only solve for that, but I could include information from the Host computer in to the environment and even stack these Heredoc commands for more advanced usages. I will show a simple one where wed like to inject a simple variable in to the Container's environment (for this one run) as well as execute a Python command within [Djangos Admin (manage.py)](https://docs.dja

@grmartin
grmartin / LaunchFirefoxProfile.applescript
Created May 11, 2019 01:54
Launch Firefox Profile Droplet
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"
on open theFiles
repeat with aFile in theFiles
processAFile(contents of aFile)
end repeat
end open
@grmartin
grmartin / CMakeLists.txt
Created April 30, 2019 16:34
Setting Debugger Arguments for Subtarget of CMake project in Visual Studio 2019
cmake_minimum_required(VERSION 3.13)
project(CVPlay)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
find_package(OpenCV REQUIRED)
add_executable(CVPlay main.cpp)
add_executable(CVPlayAnnotator annotation/main.cpp)
@grmartin
grmartin / 1-convert-trello.xsl
Last active April 22, 2019 13:06
Convert Trello JSON to Excel Document via XSLT
<?xml version="1.0" encoding="UTF-8"?>
<!-- The output of this XSLT is the MS Excel 2003-2004 XML File Format, simply open in Excel to utilize. -->
<!-- This script was built in Oxygen and was tested on Saxon PE 9.8 -->
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:local="urn:grmartin:locally-scoped-functions:01D92EAAG3HKHKARK5B3E0Z04Z"
@grmartin
grmartin / First level directory to JSON.quokka.es6
Created February 27, 2019 03:54
Store Directory Data for Mocking
// For Node.js
import fs from 'fs';
import path from 'path';
import vm from 'vm';
const vm_eval = (x)=>{
return vm.runInNewContext(x);
};
const lambda = 'λ';
@grmartin
grmartin / DontEverDoThis...ItsMonumentallyStupid.js
Created February 14, 2019 23:47
Evaling in Node... on a server...
const express = require('express');
const bodyParser = require('body-parser');
const vm = require('vm');
const app = express();
const port = 3000;
app.use(bodyParser.text({type: 'bloody-insane/javascript'}));
app.post('/unsafe', (req, res) => {
@grmartin
grmartin / readme.md
Created April 17, 2018 00:27
Basic Rsync sync with Password Entry

Basic Rsync sync with Password Entry

Tested on MacOS against a Linux Mint Server with an rsyncd share.

Server Side

The Configuration for the (Linux server) Daemon once can be found in rsyncd.conf, and requires you create /etc/rsyncd.scrt containing the username and password pairs... The secrets file must not be world readable and only accessible by the daemon that runs rsync.

On Mint, You can start rsync via Systemd using:

@grmartin
grmartin / keybase.md
Created April 19, 2017 14:50
Keybase GitHub Proof

Keybase proof

I hereby claim:

  • I am grmartin on github.
  • I am grmartin (https://keybase.io/grmartin) on keybase.
  • I have a public key ASCZ8rpwh50defaq1T5Szo_kZ8CMYR1H4w6macbPiMVIsQo

To claim this, I am signing this object:

function Invoke-Batch {
param (
[Parameter(Mandatory=$True)]
[String] $BatName
)
$psi = New-object System.Diagnostics.ProcessStartInfo
$psi.CreateNoWindow = $true
$psi.UseShellExecute = $false
@grmartin
grmartin / build_enlight.sh
Last active March 27, 2016 23:54
E19 - Debian 8
#!/bin/bash
set -e
# Target directory
PREFIX="/usr/local"
# List of the needed packages
# To adapt to your needs
PROJECTS="efl emotion_generic_players evas_generic_loaders elementary enlightenment"