Monday, January 24, 2022

dic

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#
# dic -- search TheFreeDictionary.com for a word using ddgr
#
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR FRIENDLY USE
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
_path=$0
_name="${_path##*/}"
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#fxn(vim
  # NO FUNCTIONS
#}
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
if [ $BASH_SOURCE = "$_path" ] ; then  # script called directly
  ddgr -w www.thefreedictionary.com $1
fi
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF dic (it ain't much, but it's honest work) — 220124.1501
#//////////////////////////////////////////////////////////////////////

Thursday, January 20, 2022

list

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#
# list — mnemonic implementation of ls for quick listing action
#         (all lists are long and sorted by extension or time)
#
# last update 220124.1546
#  
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR FRIENDLY USE
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
_path=$0
_name="${_path##*/}"
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#fxn() {

  # this script has no functions

#}
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------

if [ $BASH_SOURCE = "$_path" ] ; then  # script called directly

  if [[ $# -eq 0 ]] ; then # by extension

    ls -Xl
    exit 0
  fi

  if [[ "$1" = "all" ]] ; then # all files, by extension
                                
    ls -Xla
    exit 0
  fi

  if [[ "$1" = "time" ]] ; then # by time

    ls -lt
    exit 0
  fi

  if [[ "$1" = "eat" ]] ; then # all files, by time
                       
    ls -lta
    exit 0
  fi

  if [[ "$1" = "thor" ]] ; then # thorough, by extension
                                
    ls -RXl
    exit 0
  fi                         

  if [[ "$1" = "thar" ]] ; then # thorough, all files, by extension
                                
    ls -RXla
    exit 0
  fi

  if [[ "$1" = "loki" ]] ; then # thorough, by time
                                
    ls -Rlt
    exit 0
  fi

  if [[ "$1" = "laki" ]] ; then # thorough, all files, by time
                       
    ls -Rlta
    exit 0
  fi

  echo >&2
  echo $_name "    "  — by extension
  echo $_name all" "  — all files, by extension
  echo $_name time — by time
  echo $_name eat" " — all files, by time
  echo $_name thor — thorough, by extension
  echo $_name thar — thorough, all files, by extension
  echo $_name loki — thorough, by time
  echo $_name laki — thorough, all files, by time
  echo
  exit 1

fi

#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF list — 220120.1400
#//////////////////////////////////////////////////////////////////////

Friday, January 22, 2021

mp3

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#
# mp3 -- download audio from a youtube video as mp3 using youtube-dl
#
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR EASE OF USE
#//////////////////////////////////////////////////////////////////////
_path=$0
_name="${_path##*/}"
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
# (NO FUNCTIONS IN THIS SCRIPT)
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
if [ $BASH_SOURCE = "$_path" ] ; then # script called directly
youtube-dl -x --audio-format mp3 --prefer-ffmpeg $1
fi
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF mp3 — 210121.2257
#//////////////////////////////////////////////////////////////////////

Sunday, January 5, 2020

My Cousin Vimmy

Digraph List
 
Digraphs            SymbolKey   combination
 
Non-breaking space   Ctrl+K Space Space
Euro currency Ctrl+K Eu or Ctrl+K =e
En dash Ctrl+K -N
Em dash Ctrl+K -M
Quotation marks Guillemet « » Ctrl+K << and Ctrl+K >>
Paragraph sign § Ctrl+K SE
Number symbol Ctrl+K N0
Copyright © Ctrl+K Co
Registered trade mark ® Ctrl+K Rg
Grad Celsius Ctrl+K oC
Grad ° Ctrl+K ~o
Greek µ letter1 µ Ctrl+K My
Approximately equal Ctrl+K ?2 or Ctrl+K 2?
Not equal Ctrl+K !=
Left single line arrow Ctrl+K <- or Ctrl+K -<
Right single line arrow Ctrl+K >- or Ctrl+K ->
Double single line arrow Ctrl+K <>
Left dual line arrow Ctrl+K <=
Right dual line arrow Ctrl+K =>
Double dual line arrow Ctrl+K ==
Less or equal than Ctrl+K =<
More or equal than Ctrl+K >=
Is much less than Ctrl+K <*
More or equal than Ctrl+K >*
Plus minus±Ctrl+K +-

 

TO REMOVE ALL INDENTS ON A SELECTION :le

Cut and paste:

  1. Position the cursor where you want to begin cutting.
  2. Press v to select characters (or uppercase V to select whole lines).
  3. Move the cursor to the end of what you want to cut.
  4. Press d to cut (or y to copy).
  5. Move to where you would like to paste.
  6. Press P to paste before the cursor, or p to paste after.
Copy and paste is performed with the same steps except for step 4 where you would press y instead of d:
d = delete = cut
y = yank = copy

________________________________________________________________________________________

Another option which may be easier to remember would be to place marks on the two lines with ma and mb, then run :'a,'byank.

Many different ways to accomplish this task, just offering another.


........................................................................................

I had never found a satisfactory and re-callable way of doing copy-paste in vi, but this solution is really topnotch. Also, I added this to .vimrc "command! P :'a,'byank" to allow the "P" key to function as a shortcut
_______________________________________________________________________________________

just use V to select lines or v to select chars or Ctrlv to select a block.
When the selection spans the area you'd like to copy just hit y and use p to paste it anywhere you like...
_______________________________________________________________________________________


It sounds like you want to place marks in the file.
mx places a mark named x under the cursor
y'x yanks everything between the cursor's current position and the line containing mark x.
You can use 'x to simply move the cursor to the line with your mark.
You can use `x (a back-tick) to move to the exact location of the mark.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

One thing I do all the time is yank everything between the cursor and mark x into the clipboard.
You can do that like this:
"+y'x
NOTE: In some environments the clipboard buffer is represented by a * in stead of a +.

_______________________________________________________________________________________

You can copy/paste by using the + register (read more: Accessing the system clipboard)
"+gyywill yank a line, and put it into the + register. You can paste in your other window with "+p in normal mode, or Ctrl+r + while in insert mode.
If you don't wish to use split windows, there really is no other way to paste between windows apart from using the system clipboard.


  • 1
    You can use vim tabs as well as split windows. – ostler.c May 30 '12 at 21:26
  • 4
    It should also be noted that on Linux there are two clipboards - the regular clipboard - the one you access with CTRL+C and CTRL+V - is mapped to the + register. The other clipboard stores the last selected text and can be pasted with middle-click - and in Vim it's mapped to the * register. – Idan Arye May 31 '12 at 14:35
_______________________________________________________________________________________
_______________________________________________________________________________________

Since you already know how to cut/yank text, here are a few ideas for pasting it back into another file:
  • Edit the first file, yanking the text you want. Then open your second file from within vi (:e /path/to/other/file) and paste it
  • Open both files together in a split window and navigate between them using Ctrl + w, Up/Down either by:
    • vi -o /path/to/file1 /path/to/file2
    • From within the first file, Ctrl + w, s


Saturday, January 4, 2020

radio

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#
# radio -- using rfkill, quek style
# (designed for use with antiX-19)
#
# By E. Katzenjammer, 24 Dec 2019
#
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR FRIENDLY USE
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
_path=$0
_name="${_path##*/}"
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
freeEurope() {

  rfkill unblock 0

}
#----------------------------------------------------------------------
freeWorld() {

  rfkill unblock all

}
#----------------------------------------------------------------------
#----------------------------------------------------------------------
deadAirSpace() {

  rfkill block all

}
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
if [ $BASH_SOURCE = "$_path" ] ; then  # script called directly

  if [[ $# -eq 0 ]] ; then # unblock default

    freeEurope
    echo 10-4
    exit 0
  fi

  if [[ "$1" = "off" ]] ; then # block all radio

    deadAirSpace
    echo All quiet on the antiX front...
    exit 0
  fi

  echo Ahem: $_name "(off)" >&2
  exit 1
 
fi
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF script — 200104.1602
#//////////////////////////////////////////////////////////////////////

bash script template

#//////////////////////////////////////////////////////////////////////
#!/bin/bash
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#
# scriptName -- description
#
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# PATH AND NAME FOR FRIENDLY USE
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
_path=$0
_name="${_path##*/}"
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# FUNCTIONS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------
#fxn() {

  # function

#}
#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# INTERNAL AFFAIRS
#//////////////////////////////////////////////////////////////////////
#----------------------------------------------------------------------

if [ $BASH_SOURCE = "$_path" ] ; then  # script called directly

  # this is what happens when you call the script directly

fi

#----------------------------------------------------------------------
#//////////////////////////////////////////////////////////////////////
# END OF script — 190315.1547
#//////////////////////////////////////////////////////////////////////

Saturday, December 14, 2019

Patrick Winston - How to Speak

 [from youtube comments section; notes by 'GRIG', edited by ek]

Start 

1. Do not start a talk with a joke.
2. Promise - Tell them what they gonna learn at the end of your talk.
3. Cycle – make your idea repeated many times in order to be completely clear for everyone.
4. Make a “Fence” around your idea so that it can be distinguished from someone else’s idea.
5. Verbal punctuation – sum up information within your talk some times to make listeners get back on.
6. Ask a question - intriguing one Place and Time
7. Best time for having a lecture is 11 am. (not too early and not after lunch)
8. The place should be well lit.
9. The place should be seen and checked before the lecture.
10. The place should not be full less than a half, it must be chosen according to the amount of listeners.

Tools 

For Teaching 
1. Board – it’s got graphics, speed, target. Watch your hands! Don’t hold them behind your back, it’s better to keep them straight and use for pointing at the board.
2. Props – use them in order to make your ideas visual. Visual perception is the most effective way to interact with listeners.

For Job Talk. Exposing, Slides 
3. Don’t put too many words on a slide. Slides should just reflect what you’re saying, not the other way around. Pictures attracts attention and people start to wait for your explanation – use that tip.
4. Make slide as easy as you can – no title, no distracting pictures, frames, points and so on.
5. Do not use laser pointer – due to that you lose eye contact with the audience. Instead you can make the arrows just upon a slide.

[notes here change in style, despite "hours" of work on GRIG's part(?)]

Informing

Show to your listeners your stuff is cool and interesting.
You have to be able to:

-show your vision of that problem
-show that you’ve done particular things (by steps) All of that should be done real quick in no more than 5 min.

Getting Famous

If you want your ideas to be remembered, Winston's Star:

* Symbol
* Slogan
* Surprise
* Salient
* Story

- Symbol (visual key to chest of information)
- Slogan (encapsulating idea engraved on chest)
- Surprise (common fallacy that is now no longer true--awe of opening chest)
- Salient idea (the one that sticks out--shiniest artifact)
- Story (how you did it, how it works, why it's important--where, what, why)


How to End

- Don’t put collaborators at the end, do that at the beginning.
- Question’s the worst way to end a talk.
- It’s good to end with a Contribution slide – what did you do in the talk? recap.
- At the very end you could tell a joke since people then will leave the event feeling fun and thus keep a good memory of your talk.
- Don't say "Thank you (for enduring this nonsense)." "I'm glad [reason]..." Offer praise for attention and a wish of well-being and benefit from the talk.