Skip to content

Instantly share code, notes, and snippets.

View mark-ingenosity's full-sized avatar

Mark Vlach mark-ingenosity

  • Ingenosity
  • United States
View GitHub Profile
@mark-ingenosity
mark-ingenosity / RegEx Negated Search.md
Created October 1, 2021 20:11
match "does NOT contain EXPRESSION"

matches does NOT contain EXPRESSION

^((?!EXPRESSION.)*$

Explanation:

  • ^the beginning of the string, ( group and capture to \1 (0 or more times (matching the most amount possible)),
  • (?! look ahead to see if there is not, hede your string,
  • ) end of look-ahead, . any character except \n,
  • )* end of \1 (Note: because you are using a quantifier on this capture, only the LAST repetition of the captured pattern will be stored in \1)
  • $ before an optional \n, and the end of the string
@mark-ingenosity
mark-ingenosity / Bash File Name Parsing #1
Last active December 3, 2019 04:37
[BASH: Command Line FileSpec Parsing]Example script snippets for parsing complex file extensions passed on to a bash script command line #stack_overflow #bash #parse #command_line #arguments
#!/bin/env bash
https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash
filename=$(basename -- "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"
altername that focusses on the last '/' rather than '.'
filename="${fullfile##*/}"
@mark-ingenosity
mark-ingenosity / Useful Wingdings.txt
Last active December 3, 2019 04:44
[MISC: Useful Wingdings]I'm always looking for the bullet symbol so thought I'd geek out for a bit. #resource #productivity #writing #wingding #text
• ● ▪ ■ ▲ ▴
◄ ► ← ↑ → ↓ ↔ ↕
± ≤ ≥ ≠ ≈ ≡ ∑ √ ∞ ∫ ∏ ∆ Ω
¢ © ℗ ® ™ ℅
♠ ♣ ♥ ♦ ♪ ♫ ♯
₁₂₃₄₅₆₇₈₉₀
⓿ ❶ ❷ ❸ ❹ ❺ ❻ ❼ ❽ ❾ ❿ ⓫ ⓬ ⓭ ⓮ ⓯ ⓰ ⓱ ⓲ ⓳ ⓴
⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳
¼ ½ ¾ ⅍ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞
@mark-ingenosity
mark-ingenosity / CmdShellStartup.cmd
Last active December 3, 2019 04:37
[WINDOWS: Default CMD Environment] #windows #cmd_shell #default #startup #alias
@echo off
:: Load default aliases outside the CMDER environment
doskey /macrofile=D:\Admin\conf\default.aliases
@mark-ingenosity
mark-ingenosity / Command Processor.reg
Last active December 3, 2019 04:43
[ENV: Cmder/ConEmu: Init Session]Simplified formatting for doskey macros #windows #batch #doskey #macro #alias
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"CompletionChar"=dword:00000009
"DefaultColor"=dword:00000000
"EnableExtensions"=dword:00000001
"PathCompletionChar"=dword:00000009
"AutoRun"="%ADMIN%\\bin\\CmdShellStartup.cmd"
@mark-ingenosity
mark-ingenosity / tabbedlist2dirs.py
Last active December 3, 2019 04:42
[PYTHON: File Management: Tabbed List to Hierarchical Folder Structure]Reads a tabbed text file and maps text entries to the creation of a structured folder hierachy. #textfile #process #filesystem #create
import os, sys
with open(sys.argv[1]) as f:
res=[]
s=[]
for line in f:
line=line.rstrip()
x=len(line)
line=line.lstrip()
indent=2*(x-len(line))
@mark-ingenosity
mark-ingenosity / svg2png.cmd
Last active December 3, 2019 04:40
[WINDOWS: Image Conversion: SVG to PNG] #image #conversion #windows #file_type
@echo off
for %%f in (%*) do (
echo %%~f
"inkscape.exe" ^
-z ^
--export-background-opacity=0 ^
--export-height=32 ^
--export-png="%%~dpnf.png" ^
--file="%%~f"
@mark-ingenosity
mark-ingenosity / cmdline-parser.cmd
Last active December 3, 2019 04:39
[WINDOWS: Command Line Argument Parsing] #windows #parse #command_line #arguments #cmd_shell
rem Command Line Parser
@echo off
setlocal enableDelayedExpansion
set opt_1=default value for option one
set opt_2=default value for option two
set opt_3=default value for option three
set flag_1=n
@mark-ingenosity
mark-ingenosity / svg2icns.sh
Last active March 31, 2026 12:15
[BASH: Image Conversion: SVG to Mac ICNS] #convert #image #file_type #bash #script #icon
#!/bin/bash
# iterate over the svg files fed into on the command line
for svgfile in "$@"
do
name=${f%.*}
ext=${f##*.}
echo "Processing $name ..."
set -e
@mark-ingenosity
mark-ingenosity / text2dialog.py
Last active December 3, 2019 04:44
[WRITING: Python: Extract Dialog from Story Text] Strips all text not enclosed in double quotes leaving only dialog text (ex. "Some dialog text..."). #dialog #book #story #scrubbing
#!/usr/bin/env python3
#
# text2dialog.py
# Python script to strip dialog from story text, discarding all other narrative text.
# Uses open-close double quotes as delimeters.
#
import re, sys
with open(sys.argv[1]) as f:
reg = re.compile(r'"[^"]*"|\([^)]*\)')
for line in f: