This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:%s/\("Key": "\({[^}]*}\)"\)/\=join(map(split(submatch(2), ',\zs'), 'printf("json_extract(Key, ''$.%s'') AS %s", matchstr(v:val, ''"\zs[^"]\+''), matchstr(v:val, ''"\zs[^"]\+''))'), ",\r ")/g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## create empty environment | |
conda create -n py39 | |
## activate | |
conda activate py39 | |
## use x86_64 architecture channel(s) | |
conda config --env --set subdir osx-64 | |
## install python, numpy, etc. (add more packages here...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
envsubst < deploy.yml | kubectl apply -f - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(_dynamic\s*)\{((?:\n(?!\}|.*type).*)*?)\}\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json.loads(json_str.replace("'(?=[:,\}])", '"').replace("?<=(:\s))'", '"').replace("(?<=\{)'", '"')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git reset --hard #commit | |
git reset --soft @{1} # (or ORIG_HEAD) | |
git commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -n '52p' # method 1 | |
sed '52!d' # method 2 | |
sed '52q;d' # method 3, efficient on large files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -e 's/[^\t]//g' test_rnd.tsv | awk '{ print length }' | grep -nr '3[1-9]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:%s#\C\(\<\u[a-z0-9]\+\|[a-z0-9]\+\)\(\u\)#\l\1_\l\2#g |