Skip to content

Instantly share code, notes, and snippets.

@mak
Created March 7, 2017 12:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mak/63a953cbc7b1cd5e1f47d3c6e195b583 to your computer and use it in GitHub Desktop.
Save mak/63a953cbc7b1cd5e1f47d3c6e195b583 to your computer and use it in GitHub Desktop.
one-liner to extract powershell command in recent nymaim's documnets
( olevba $document | grep ' = ' | \
sed -e's/&/+/g' -e's/NaN/None/g' -e's/ = [^A].*(\(A.*)\))/= \1/' -e 's/Array//' \
-e's/(/[/g' -e's/)/]/g' -e "s#\"\([^\"]*\)\"\([^\"]*\)\"#\"\1'\2#" | \
grep '\[\|\+'; \
echo 'print globals()[sorted(globals(),key=lambda x: type(globals()[x]) == str and len(globals()[x]))[-1]]'
) \
| python2 - | tr -d '^' | tr '[:upper:]' '[:lower:]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment