Wednesday, April 27, 2022

Add watermark using imagemagick

 Link1: 

https://amytabb.com/til/photography/2021/01/23/image-magick-watermark/


Link2: 

https://www.the-art-of-web.com/system/imagemagick-watermark/

Tuesday, January 28, 2020

Change log in prompt



$ open -e .bash_profile
If this is the first time you’re editing this file, it should be empty. Add this line to the file and save.
$ export PS1="\u$ "

Options for customising the prompt

Here are a few common flags you can use to customize your Terminal prompt:
  • \d – Current date
  • \t – Current time
  • \h – Host name
  • \# – Command number
  • \u – User name
  • \W – Current working directory (ie: Desktop/)
  • \w – Current working directory with full path (ie: /Users/Admin/Desktop/)

https://medium.com/@ajaykarwal/edit-the-terminal-prompt-name-on-macos-4d80163be6a1


Add colors:https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/

Add bold font: Bold is set by 01 so you need to add 01; before each color specification:

Tuesday, August 13, 2019

IDL resolve_routine

http://www.idlcoyote.com/tips/compile.html

nohup:


 nohup idl < bhistory.pro > out.txt &

Tuesday, April 10, 2018

Linux stuff

Change bash prompt

https://wiki.centos.org/TipsAndTricks/CustomizeBash
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
https://superuser.com/questions/60555/show-only-current-directory-name-not-full-path-on-bash-prompt



bash newline:

printf "hi \n there \n"

echo $'hi \nthere'
Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard.


Check if directory exists (or not)
https://stackoverflow.com/questions/59838/check-if-a-directory-exists-in-a-shell-script


if [ ! -d "$DIRECTORY" ]; then
  # Control will enter here if $DIRECTORY doesn't exist.
fi

If symbolic links are present:

if [ -d "$LINK_OR_DIR" ]; then 
  if [ -L "$LINK_OR_DIR" ]; then
    # It is a symlink!
    # Symbolic link specific commands go here.
    rm "$LINK_OR_DIR"
  else
    # It's a directory!
    # Directory command goes here.
    rmdir "$LINK_OR_DIR"
  fi
fi



Sunday, April 1, 2018

Passless ssh

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa


Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last 
time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
b@B's password: 
From now on you can log into B as b from A as a without password.

http://www.linuxproblem.org/art_9.html


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