from Stack Exchange
Select target pane and enter Prefix
-:
break-pane -dP
# from https://www.linuxquestions.org/questions/programming-9/removing-duplicate-lines-with-sed-276169/ | |
# $!N | |
# if not in the last line, append the next line of input | |
# pattern space (no duplicates): line1\nline2 | |
# stdout: null | |
# | |
# /^\(.*\)\n\1$/ | |
# does the pattern space (eg. line1\nline2) contains duplicate lines (eg. line1 == line2)? | |
# | |
# /<REGEX>/!P |
set aw | |
" There are two different approaches for finding the target files | |
" execute "args" join(systemlist("ag -l pattern path/to/files"), " ") | |
args `ag -l pattern path/to/files` | |
argdo %s/pattern/new/g | w |
// Before proceeding add an ID `target` to the table you want to perform the analysis on | |
// Google Chrome intercepts $ as a shortcut for document.querySelector() and | |
// $$() as a shortcut for document.querySelectorAll() | |
items = [] | |
$$('#target tr').forEach( | |
(row) => items.push( | |
parseFloat( |
docker inspect container | jq -r '..|.Mounts? |select(.!=null) | map(.Source)[]' |
" from https://github.com/suy/vim-context-commentstring/blob/master/doc/context-commentstring.txt | |
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') |
from Stack Exchange
Select target pane and enter Prefix
-:
break-pane -dP
The expression below captures the first group match and adds its to a list for later use.
let t =[] | '<,'>s/\v\\code\{([^}]+)}\zs/\=add(t, submatch(1))[1:0]/g
We can then place the list into another section of the file with.
put = t
function! VimtexLabelRename(oldtag, newtag) | |
" Change figure tag in tex and move the corresponding | |
" file. | |
exe '%s/\v\{(fig:)?' . a:oldtag . '\}/{fig:' . a:newtag . '}/g' | |
exe '%s/\v\{' . a:oldtag . '(_.*)?\.png\}/{' . a:newtag . '\1.png}/g' | |
exe '!for i in `find assets -name 'a:oldtag.'*`; do mv $i ${i/'.a:oldtag.'/'.a:newtag.'}; done' | |
"exe '!mv' 'assets/'.a:oldtag.'.png' 'assets/'.a:newtag.'.png' | |
endfunction | |
command! -nargs=* VimtexLabelRename call VimtexLabelRename(<f-args>) |
docker run --name <container_name> --rm -i -t <image> <shell, eg. /bin/bash> |
On a recent grails project, we're using a git repo that was originally converted from a SVN repo with a ton of large binary objects in it (lots of jar files that really should come from an ivy/maven repo). The .git
directory was over a gigabyte in size and this made it very cumbersome to clone and manipulate.
We decided to leverage git's history rewriting capabilities to make a much smaller repository (and kept our previous repo as a backup just in case).
Here are a few questions/answers that I figured out how to answer with git and some shell commands: