Friday, March 2, 2018

VIM commands and tidbits


Stop auto-indenting dammit!
http://vim.wikia.com/wiki/How_to_stop_auto_indenting


Search it
http://vim.wikia.com/wiki/Search_and_replace


change font size
:set guifont=Menlo:h12

Install amsmath support for vim
https://tex.stackexchange.com/questions/416030/how-do-i-make-vim-highlight-math-properly-in-the-align-environment


search and replace:
s/foo/bar/g
Find each occurrence of 'foo' (in the current line only), and replace it with 'bar'.
:%s/foo/bar/gc
Change each 'foo' to 'bar', but ask for confirmation first.
https://vim.fandom.com/wiki/Search_and_replace





Tuesday, May 9, 2017

Python links

http://sthurlow.com/python/lesson08/

http://mathesaurus.sourceforge.net/idl-numpy.html

https://docs.python.org/2/tutorial/


Wednesday, March 22, 2017

Wednesday, March 15, 2017

IDL column width in output

Extend IDL's default column limit in output:

   OpenW, lun, 'myfile.txt', /Get_LUN, WIDTH=250
   PrintF, lun, mydata, FORMAT='(25(F9.2,x))'
   Free_LUN, lun


http://www.idlcoyote.com/fileio_tips/width.html


Monday, November 2, 2015

Formatted print in for loop in bash

for ((i=000; i<010; i++)) do echo "$(printf '%04d' $i)"; done

for FILE in *.pdf; do pdfcrop $FILE; done



To work with arrays in a list
file=(hah1 hah2 hah3)
for list in "${file[@]}"; do echo $list; done


for ((i=28; i<243; i++)) do ((var= $i-$ii)); mv pv_"$(printf '%04d' $i)".jpg pv_"$(printf '%04d' $var)".jpg; done 

http://mywiki.wooledge.org/BashGuide/Arrays


Call list using loop variable


dirlist=(p45 p46 p46_highGam sigma0.01)
numlist=(0036 0033 0021 0060)
for i in "${!dirlist[@]}"; do 
dir=${dirlist[$i]}
num=${numlist[$i]}
echo $dir $num
cd $dir/postprocess_20May2021
mv phi045deg045deg45deposit_2keV.$num.flt phi045deg0deposit_2keV.$num.flt
mv phi045deg045deg45deposit_2keV.$num.flt.StQ.flt phi045deg045deposit_2keV.$num.flt.StQ.flt
mv phi045deg045deg45deposit_2keV.$num.flt.StU.flt phi045deg045deposit_2keV.$num.flt.StU.flt
cd ../../
done

Wednesday, August 26, 2015