Skip to content

Instantly share code, notes, and snippets.

@reanimat0r
Forked from mak/x.sh
Created October 28, 2018 21:10
Show Gist options
  • Save reanimat0r/802fd1b4359309e98aa7884c1a51f30c to your computer and use it in GitHub Desktop.
Save reanimat0r/802fd1b4359309e98aa7884c1a51f30c 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