Skip to content

Instantly share code, notes, and snippets.

simon place splace

  • Cornwall, UK
Block or report user

Report or block splace

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
splace / convert.go
Last active Feb 8, 2019
convert wildcard positional to equivalent regexp string match
View convert.go
// see working example:-
func WildcardRegExp(w string) string {
return "^" + strings.NewReplacer(
".", "\\.", // escape regexp special chars...
"^", "\\^",
"$", "\\$",
"+", "\\+",
"(", "\\(",
")", "\\)",
splace / gist:d7188b9199cf71fad6a3505dd731f40b
Last active Oct 5, 2017
shell; get item from a commands output and use as a parameter in another command.
View gist:d7188b9199cf71fad6a3505dd731f40b
example: test a group of files to see if together their hash is below a specified number;
cat * | sha512sum | tr " " "\n" | head -n 1 | [[ "`xargs echo $1`" < "00000001" ]]
(sha512sum always adds a file name on the same line, making this kind of stuff necessery)
You can’t perform that action at this time.