More Examples: New section

This is the last section of the talk.  It will be augmented slightly once I
have a better idea of where I stand with the earlier sections.

I wasn't able to fit in even close to everything that I wanted to, but I
didn't expect to.
master
Mike Gerwitz 2019-03-16 23:45:57 -04:00
parent 3cae7683d2
commit 444d9e87b9
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 306 additions and 84 deletions

View File

@ -21,19 +21,19 @@
- GUIs /are/ sometimes the most efficient means of melding mind and machine.
- De-emphasize doing everything on a terminal just because its "cool".
** Concepts [8/27]
** Concepts [15/27]
- [ ] =/sys= and such
- [ ] Automating multi-step workflows with GNU Make
- [ ] Concurrency
- [-] Connecting graphical and command line (X11 integration) [1/4]
- [ ] Clipboard (image)
- [X] Concurrency ([[*Program Composition]])
- [X] Connecting graphical and command line (X11 integration) [4/4]
- [X] Clipboard (image) ([[*More Examples]])
- [X] Clipboard (text) ([[*Program Composition]])
- [ ] X11 commands
- [ ] Interesting example idea: =import=, =tesseract ss.png - | xsel -ib=
- [X] X11 commands
- [X] Interesting example idea: =import=, =tesseract ss.png - | xsel -ib=
so that you can select an area of text on the screen and perform
OCR, then have the result on your clipboard
- I've never done this, but it goes to show how trivial it is to
create something that is seemingly novel.
OCR, then have the result on your clipboard ([[*More Examples]])
- I've never done this, but it goes to show how trivial it is to
create something that is seemingly novel.
- [ ] Discoverability
- Example: I used GIMP for editing some images for this talk because I
thought it'd be faster to discover how to that way vs. ImageMagick docs.
@ -47,9 +47,9 @@
- [ ] Emphasize free software community and how OS is built by so many
contributors
- Symbiosis is not only with machine, but community
- [ ] Globbing
- [ ] GnuPG and smart cards
- [ ] Incremental, iterative, interactive development ([[*Program Composition]])
- [X] Globbing
- [X] GnuPG and smart cards ([[*More Examples]])
- [X] Incremental, iterative, interactive development ([[*Program Composition]])
- [X] Looping ([[*Perspective Topics][Perspective Topics]])
- [ ] McIlroy and Knuth
- [X] Mouse has dependency on positioning of UI elements ([[*Browser Topics][Browser Topics]])
@ -60,15 +60,15 @@
and sacrifices practical freedom.
- Requires specialized knowledge and is inconvenient to work with.
- [X] Pipelines instead of intermediate files ([[*Perspective Topics][Perspective Topics]]).
- [ ] Practically exercising software freedom [0/2]
- [ ] Users need to be able to convey their thoughts to the computer
- [X] Practically exercising software freedom [2/2]
- [X] Users need to be able to convey their thoughts to the computer
without being programmers
- [ ] Concise primitives / building blocks
- [X] Concise primitives / building blocks
- [ ] Readline (history and editing) [0/2]
- [ ] Develop as you go, perhaps just referencing history early on
- [ ] Transfer commands from history into scripts and aliases for re-use
- [X] Regular expressions ([[*Perspective Topics][Perspective Topics]])
- [ ] Remote commands via SSH
- [X] Remote commands via SSH
- [X] Text as a universal interface
- [X] All programs can work with one-another ([[*Perspective Topics][Perspective Topics]])
- [X] Can replace any part of the process with a human---no difference
@ -80,34 +80,35 @@
- [ ] Version control
** Programs [0/4]
- [-] Coreutils / Common [7/14]
- [-] Coreutils / Common [12/15]
- [X] =cut=
- [ ] =column=
- [ ] =diff=
- [X] =echo=
- [ ] =find=
- [ ] =gpg=
- [X] =find=
- [X] =gpg=
- [X] =grep=
- [ ] =make= / Makefiles
- [ ] =man=
- [X] =man= and =info=
- [X] =sort=
- [ ] =ssh=
- [X] =ssh=
- [X] =uniq=
- [X] =watch=
- [X] =wc=
- [X] =wget= / =curl=
- [-] Miscellaneous [4/8]
- [-] Miscellaneous [5/8]
- [ ] =awk=
- [ ] =cowsay=
- [X] =cowsay= / =figlet=
- [ ] =dict=
- [X] =espeak=
- [ ] =git=
- [X] =mail=
- [X] =torify=
- [X] =sed=
- [-] X11 / Graphical [1/5]
- [ ] =convert=
- [-] X11 / Graphical [3/5]
- [X] =convert=
- [ ] =i3= / =xmonad= / etc
- [ ] =import=
- [X] =import=
- [ ] =setxkbmap=
- [X] =xclip= / =xsel=
- [ ] Editors / Multiplexing [0/4]
@ -116,70 +117,82 @@
- [ ] =vim=
- [ ] =screen=
* LACKING Slides [0/6]
* LACKING Slides [0/7]
:PROPERTIES:
:ID: slides
:END:
** Summary :noexport:
#+BEGIN: columnview :hlines 2 :maxlevel 3 :indent t :id slides
| ITEM | DURATION | TODO | ENVIRONMENT |
|-------------------------------------------------------+----------+--------+-------------|
| Slides | 0:36:19 | DEVOID | |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Summary | | | |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Introduction | | RAW | note |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Choreographed Workflows | | DEVOID | fullframe |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Practical Freedom | | DEVOID | fullframe |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Practical Example: Web Browser | 0:09:32 | DRAFT | |
| \_ Browser Topics | | | |
| \_ Example: Web Browser | 0:00:40 | DRAFT | frame |
| \_ Finding Text (Mouse-Driven GUI Interaction) | 0:01:39 | DRAFT | frame |
| \_ GUIs Change Over Time | 0:00:45 | DRAFT | frame |
| \_ Ctrl+F---Just Works | 0:00:25 | DRAFT | frame |
| \_ Muscle Memory | 0:00:40 | DRAFT | fullframe |
| \_ A Research Task | 0:00:25 | DRAFT | fullframe |
| \_ Executing the Research Task | 0:03:00 | DRAFT | frame |
| \_ GUIs of a Feather | 0:00:40 | DRAFT | fullframe |
| \_ Macro-Like Keyboard Instructions | 0:01:19 | DRAFT | fullframe |
|-------------------------------------------------------+----------+--------+-------------|
| \_ A New Perspective | 0:14:22 | DRAFT | |
| \_ Perspective Topics | | | |
| \_ Secrets? | 0:01:19 | DRAFT | fullframe |
| \_ Lifting the Curtain | 0:01:00 | DRAFT | frame |
| \_ Web Page Source Code | 0:00:35 | DRAFT | block |
| \_ Text | 0:00:35 | DRAFT | fullframe |
| \_ Text is a Universal Interface | 0:01:19 | DRAFT | fullframe |
| \_ The Shell Command Prompt | 0:00:45 | DRAFT | frame |
| \_ Eliminating the Web Browser | 0:01:00 | DRAFT | frame |
| \_ Browser vs. =wget= Comparison | 0:00:40 | DRAFT | frame |
| \_ Finding Text on the Command Line | 0:01:00 | DRAFT | frame |
| \_ A More Gentle Reply | 0:01:00 | DRAFT | frame |
| \_ Writing to Files (Redirection) | 0:00:55 | DRAFT | frame |
| \_ Starting Our List | 0:01:10 | DRAFT | fullframe |
| \_ Command Refactoring | 0:02:00 | DRAFT | fullframe |
| \_ Again: Text is a Universal Interface | 0:00:20 | DRAFT | againframe |
| \_ Pipelines | 0:00:15 | DRAFT | fullframe |
| \_ Summary of the Unix Philosophy | 0:00:30 | DRAFT | fullframe |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Program Composition | 0:12:25 | DRAFT | |
| \_ Composition Topics | | | |
| \_ Clarifying Pipelines | 0:00:45 | DRAFT | fullframe |
| \_ Tor | 0:00:20 | DRAFT | fullframe |
| \_ LP Sessions | 0:02:50 | DRAFT | fullframe |
| \_ Interactive, Incremental, Iterative Development | 0:01:10 | DRAFT | fullframe |
| \_ Discovering URLs | 0:02:50 | DRAFT | fullframe |
| \_ Go Grab a Coffee | 0:00:15 | DRAFT | fullframe |
| \_ Async Processes | 0:01:00 | DRAFT | fullframe |
| \_ Executable Shell Script and Concurrency | 0:01:50 | DRAFT | fullframe |
| \_ Again: A Research Task | 0:00:15 | DRAFT | againframe |
| \_ A Quick-n-Dirty Solution | 0:01:10 | DRAFT | frame |
|-------------------------------------------------------+----------+--------+-------------|
| \_ Thank You | 00:00:01 | | fullframe |
| ITEM | DURATION | TODO | ENVIRONMENT |
|-------------------------------------------------------+----------+---------+-------------|
| Slides | 0:36:19 | LACKING | |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Summary | | | |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Introduction | | RAW | note |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Choreographed Workflows | | DEVOID | fullframe |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Practical Freedom | | DEVOID | fullframe |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Practical Example: Web Browser | 0:09:32 | DRAFT | |
| \_ Browser Topics | | | |
| \_ Example: Web Browser | 0:00:40 | DRAFT | frame |
| \_ Finding Text (Mouse-Driven GUI Interaction) | 0:01:39 | DRAFT | frame |
| \_ GUIs Change Over Time | 0:00:45 | DRAFT | frame |
| \_ Ctrl+F---Just Works | 0:00:25 | DRAFT | frame |
| \_ Muscle Memory | 0:00:40 | DRAFT | fullframe |
| \_ A Research Task | 0:00:25 | DRAFT | fullframe |
| \_ Executing the Research Task | 0:03:00 | DRAFT | frame |
| \_ GUIs of a Feather | 0:00:40 | DRAFT | fullframe |
| \_ Macro-Like Keyboard Instructions | 0:01:19 | DRAFT | fullframe |
|-------------------------------------------------------+----------+---------+-------------|
| \_ A New Perspective | 0:14:22 | DRAFT | |
| \_ Perspective Topics | | | |
| \_ Secrets? | 0:01:19 | DRAFT | fullframe |
| \_ Lifting the Curtain | 0:01:00 | DRAFT | frame |
| \_ Web Page Source Code | 0:00:35 | DRAFT | block |
| \_ Text | 0:00:35 | DRAFT | fullframe |
| \_ Text is a Universal Interface | 0:01:19 | DRAFT | fullframe |
| \_ The Shell Command Prompt | 0:00:45 | DRAFT | frame |
| \_ Eliminating the Web Browser | 0:01:00 | DRAFT | frame |
| \_ Browser vs. =wget= Comparison | 0:00:40 | DRAFT | frame |
| \_ Finding Text on the Command Line | 0:01:00 | DRAFT | frame |
| \_ A More Gentle Reply | 0:01:00 | DRAFT | frame |
| \_ Writing to Files (Redirection) | 0:00:55 | DRAFT | frame |
| \_ Starting Our List | 0:01:10 | DRAFT | fullframe |
| \_ Command Refactoring | 0:02:00 | DRAFT | fullframe |
| \_ Again: Text is a Universal Interface | 0:00:20 | DRAFT | againframe |
| \_ Pipelines | 0:00:15 | DRAFT | fullframe |
| \_ Summary of the Unix Philosophy | 0:00:30 | DRAFT | fullframe |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Program Composition | 0:12:25 | DRAFT | |
| \_ Composition Topics | | | |
| \_ Clarifying Pipelines | 0:00:45 | DRAFT | fullframe |
| \_ Tor | 0:00:20 | DRAFT | fullframe |
| \_ LP Sessions | 0:02:50 | DRAFT | fullframe |
| \_ Interactive, Incremental, Iterative Development | 0:01:10 | DRAFT | fullframe |
| \_ Discovering URLs | 0:02:50 | DRAFT | fullframe |
| \_ Go Grab a Coffee | 0:00:15 | DRAFT | fullframe |
| \_ Async Processes | 0:01:00 | DRAFT | fullframe |
| \_ Executable Shell Script and Concurrency | 0:01:50 | DRAFT | fullframe |
| \_ Again: A Research Task | 0:00:15 | DRAFT | againframe |
| \_ A Quick-n-Dirty Solution | 0:01:10 | DRAFT | frame |
|-------------------------------------------------------+----------+---------+-------------|
| \_ More Examples | | LACKING | |
| \_ More Example Topics | | | |
| \_ Weather Every 60s | | LACKING | frame |
| \_ Resize Images | | LACKING | frame |
| \_ Password Generation | | LACKING | frame |
| \_ Password Manager | | LACKING | frame |
| \_ Remote Password Manager With 2FA | | LACKING | frame |
| \_ Taking Screenshots | | LACKING | frame |
| \_ Screenshot OCR | | LACKING | frame |
| \_ Full Circle | | LACKING | fullframe |
| \_ Getting Help | | LACKING | frame |
|-------------------------------------------------------+----------+---------+-------------|
| \_ Thank You | 00:00:01 | | fullframe |
#+END:
** RAW Introduction :B_note:
@ -2571,6 +2584,215 @@ This is certainly an efficient means of communicating with the machine.
We've come a long way from using the web browser and a mouse.
** LACKING More Examples
*** More Example Topics [7/7] :noexport:
- [X] Screenshots with =import=.
- Including copying to clipboard.
- [X] Using =import= and =tesseract= for screenshot OCR.
- See if we can demo on the LP laptop.
- It works very well with the [[https://static.fsf.org/nosvn/libreplanet/2019/assets/keynote_banner.png][LP2019 keynote speakers image]].
- [X] Checking the weather
- [X] Resizing images
- [X] Password management [3/3]
- [X] =pwgen=.
- [X] Diceware/EFF word list with POSIX tools.
- [X] GPG-encrypted password list over SSH with smart card.
- [X] Full circle: automating with =xdotool=.
- Use =tesserac= to detect matches from =Ctrl+F=.
- [X] Finding documentation with =info= and =man=.
*** LACKING Weather Every 60s :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
#+BEGIN_SRC sh
$ watch -n60 'weather | grep Temp | cut -d: -f2 | figlet'
Every 60.0s: weather | grep Temp... Sat Mar 16 23:18:56 2019
____ ___ ___ _____ __ ____ ____ ______
|___ \( _ ) / _ \ | ___| / / |___ \ |___ \ / ___\ \
__) / _ \| | | | | |_ | |_____ __) | __) | | | | |
/ __/ (_) | |_| | | _| | |_____/ __/ _ / __/ | |___ | |
|_____\___(_)___/ |_| | | |_____(_)_____| \____|| |
\_\ /_/
#+END_SRC
*** LACKING Resize Images :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
#+BEGIN_SRC
$ for img in *.png; do
convert "$img" -resize 50% "sm-$img"
done
# nested directories
$ find . -name '*.png' -exec convert {} -resize 50% sm-{} \;
#+END_SRC
*** LACKING Password Generation :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
#+BEGIN_SRC
# generate a random 32-character password
$ pwgen -ysn1 32
!Wd\%Hhg5j-{c2GY(p1Y}TkQJM#{1LUA
# generate passphrase from EFF's large dice wordlist
# (https://www.eff.org/dice)
$ cut -f2 eff_large_wordlist.txt \
| sort -R --random-source=/dev/urandom \
| head -n6 \
| tr '\n' ' '
oppressor roman jigsaw unhappy thinning grievance
#+END_SRC
*** LACKING Password Manager :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
#+BEGIN_SRC sh
$ gpg --decrypt password-db.gpg | head -n3
https://foo.com
user mikegerwitz
pass !({:pT6DcJG.cr&OAco_EC63r_*xg|uD
#+END_SRC
#+BEAMER: \begin{uncoverenv}<2>
#+BEGIN_SRC sh
$ gpg --decrypt password-db.gpg \
| grep -A2 ^https://foo.com \
| tail -n2 \
| while read key value; do
echo "paste $key..."
printf %s "$value" \
| xclip -o -selection clipboard -l 1 -quiet
done
#+END_SRC
#+BEAMER: \end{uncoverenv}
*** LACKING Remote Password Manager With 2FA :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
- Add =extra-socket= to =.gnupg/gpg-agent.conf=
- Add =RemoteForward= in =.ssh/config= for host
- Save script on previous slide as =get-passwd=
#+BEAMER: \subskip
#+BEGIN_SRC sh
$ ssh -Y mikegerwitz-pc get-passwd https://foo.com
#+END_SRC
*** LACKING Taking Screenshots :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
#+BEGIN_SRC sh
# draw region on screen, output to ss.png
$ import ss.png
# screenshot of entire screen after 5 seconds
$ import -pause 5 -window root ss.png
# screenshot to clipboard
import png:- | xclip -i -selection clipboard -t image/png
#+END_SRC
*** LACKING Screenshot OCR :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
#+BEAMER: \begin{onlyenv}<+>
#+BEGIN_SRC sh
$ import png:- | tesseract -psm 3 - - | cowsay
__________________________________
/ Keynote Speakers \
| |
| i |
| |
| Bdale Garbee Micky Metts Richard |
\ Stallman Tarek Loubani /
----------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
#+END_SRC
#+BEAMER: \end{onlyenv}
#+BEAMER: \begin{onlyenv}<+>
#+BEGIN_SRC sh
# OCR at URL
$ wget -qO- https://.../keynote_banner.png \
| tesseract -psm 3 - -
# perform OCR on selected region and speak it
$ import png:- | tesseract -psm 3 - - | espeak
# perform OCR on clipboard image and show in dialog
$ xclip -o -selection clipboard -t image/png \
| tesseract -psm 3 - - \
| xargs -0 zenity --info --text
#+END_SRC
#+BEAMER: \end{onlyenv}
*** LACKING Full Circle :B_fullframe:
:PROPERTIES:
:BEAMER_env: fullframe
:END:
#+BEGIN_SRC sh
$ xdotool search --name ' GNU IceCat$' windowactivate --sync \
&& xdotool getactivewindow windowsize 1024 600 \
key ctrl+t \
&& while read url; do
xdotool getactivewindow \
key ctrl+l type "$url" \
&& xdotool getactivewindow \
key Return sleep 5 \
key ctrl+f sleep 0.5 \
type 'free software' \
&& import -window "$( xdotool getactivewindow )" \
-crop 125x20+570+570 png:- \
| tesseract -psm 3 - - \
| grep -q ^Phrase && echo "$url" \
done < url-list | tee results.txt
#+END_SRC
*** LACKING Getting Help :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
- All GNU packages have Info manuals
- Most programs (including GNU) have manpages
#+BEAMER: \subskip
#+BEGIN_SRC sh
# manpage for grep
$ man grep
# full manual for grep
$ info grep
# bash help
$ help
$ man bash
#+END_SRC
** Thank You :B_fullframe:
:PROPERTIES:
:BEAMER_env: fullframe