Skip to main content

Posts

bash substring

  NAME= ${MYVAR%:*} # retain the part before the colon NAME= ${NAME##*/} # retain the part after the last slash   ${MYVAR#pattern} # delete shortest match of pattern from the beginning ${MYVAR##pattern} # delete longest match of pattern from the beginning ${MYVAR%pattern} # delete shortest match of pattern from the end ${MYVAR%%pattern} # delete longest match of pattern from the end           So # means match from the beginning (think of a comment line) and % means from the end. One instance means shortest and two instances means longest.   ${MYVAR:3} # Remove the first three chars (leaving 4..end) ${MYVAR::3} # Return the first three characters ${MYVAR:3:5} # The next five characters after removing the first 3 (chars 4-9)     ${MYVAR/search/replace}          
Recent posts

gentoo test

gentoo install doc from handbook  mount rootfs mount /dev/sdaX /mnt/   dl stage 3  rootfs https://www.gentoo.org/downloads/  https://distfiles.gentoo.org/releases/amd64/autobuilds/  to get list of tarballs from terminal only :  curl https://distfiles.gentoo.org/releases/amd64/autobuilds/latest-stage3.txt  20230917T164636Z/stage3-amd64-hardened-nomultilib-openrc-20230917T164636Z.tar.xz 239532616   curl https://distfiles.gentoo.org/releases/amd64/autobuilds/20230917T164636Z/stage3-amd64-hardened-nomultilib-openrc-20230917T164636Z.tar.xz > stage3.tar.xz     extract  rootfs sudo tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt or sudo tar xpvf stage3-amd64-hardened-nomultilib-openrc-20230917T164636Z.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt    nano -w /mnt/etc/portage/make.conf COMMON_FLAGS="-march=native -O2 -pipe" ##our nproc is 4 so j4  MAKEOPTS="-j4"   ACCEPT_LICENSE="*" VIDEO_CARDS="intel "

gimp

basic resolution, defined as the ratio between an image's size in pixels and its physical size (usually in inches) when it is printed on paper. expressed as ppi—pixels per inch The resolution is usually 72 or 96ppi      Physical size: 340x190 mm diag size=10 sqrt(1517) mm =389.487=15.3341 inch    resolution: 1920x1080 px  diag res  = 120 sqrt(337) = =2202.907 px   dpi = 120 sqrt(337) *25.4 /10 sqrt(1517) = 143.66 dpi  for wolfarm  Sqrt[1920^2+1080^2]*25.4 /Sqrt[190^2+340^2] 1 inch=25.4 mm   dpi=diagonal res in px / diagonal physical size in inches    windows > single-window Mode file>new or ctrl+n adjust:  width,height,unit advance: x,y-res,colorspace,precision(bit),gamma,color-profile,fill with,comment tools groups: selection tools : rectangular(R),ellipse(E),free(F),foreground,fuzzy(U),by color select(shift+O),intelligent Scissors(I)   paint tools: bucket fill(shift+b),gradient(g),pencil(p),eraser(shift+e),airbrush(a) ink(i),mypaintbrush(y),clo

graphicsmagick / linux

gm identify  Monterey.jpg Monterey.jpg JPEG 1920x1080+0+0 DirectClass 8-bit 535.4Ki 0.000u 0m:0.000001s   display  animate=show animation eg gif composite=blend/merge image togather conjure = interprets MSL convert import=read image from window mogrify= image scaling, image rotation, color reduction etc overwrites original montage =tiled image options -adjoin = join images into a single multi-image file image%02d.miff -affine <matrix> This option provides a transform matrix {sx,rx,ry,sy,tx,ty} for use by subsequent -draw or -transform options. -antialias remove pixel aliasing -append  creates a single image where the images in the original set are stacked top-to-bottom.  -asc-cdl <spec> -authenticate <string> password for pdf   -auto-orient   -average average a set of images    -backdrop    -colorspace <value>               the type of colorspace               Choices are: CineonLog, CMYK, GRAY, HSL, HWB, OHTA, RGB,               Rec601Luma, Rec709Luma, Rec601YC

nvim tutorial/cheatsheet

nvim  :Tutor modal editor = various modes normal,visual  normal=nav,comands lesson 1 h=left  j=down k=up l=right u=undo K=documendation :q=close :q!=quit without saving x=delete character under cursor i=insert a text before cursor A=append text after line (end) / insert after cursor :wq= write and exit   lesson 2 dw=delete word (after cursor to space) d$=delete to the end of line d=delete operator with  motions w=to start of next word ,  e=to end of current word, $=end of line,0=start of line pressing just motions moves cursor as specified typing number before motion repeats it that many times 2w=move 2 word forward 3e=end of third word 0=start of word d2w=delete 2 word  dd=delete and copy whole line 2dd= delete 2 line   u=undo last command U=fix whole line to its original state/undo changes on line <C-r>=redo   lesson 3 p=put previously deleted text after cursor /line below cursor (paste) P=put text before the cursor /line above cursor r=replace text in cursor   ce=change until