index.org 14.4 KB
Newer Older
Sachin Patil's avatar
Sachin Patil committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#+REVEAL_THEME: moon
#+REVEAL_TRANS: linear
#+REVEAL_SPEED: default
#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/
#+REVEAL_TITLE_SLIDE_BACKGROUND:
#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:nil reveal_control:t
#+OPTIONS: num:nil toc:nil
#+OPTIONS: timestamp:nil, email:nil
#+LANGUAGE: en

#+LaTeX_CLASS_OPTIONS: [bigger, presentation]
#+BEAMER_FRAME_LEVEL: 1
# #+OPTIONS: H:2
#+BEAMER_COLOR_THEME:
#+BEAMER_FONT_THEME: serif
#+BEAMER_HEADER: \usecolortheme[RGB={0,104,139}]{structure}%deepskyblue
# #+BEAMER_HEADER: \usecolortheme[RGB={204,0,0}]{structure}%Red Hat
#+BEAMER_INNER_THEME: rounded
#+BEAMER_OUTER_THEME:
#+BEAMER_THEME: Frankfurt
#+LATEX_CLASS: beamer
#+LATEX_CLASS_OPTIONS: [10pt]
#+LaTeX_HEADER: \setbeamertemplate{navigation symbols}[horizontal]
# #+LaTex_HEADER: \setbeamertemplate{footline}{\color{gray}Proprietary and Confidential}
#+LaTeX_HEADER: \usepackage{pxfonts}
#+LaTeX_HEADER: \usepackage{hyperref}
#+LaTeX_HEADER: \hypersetup{colorlinks=true, linkcolor=red, filecolor=magenta, urlcolor=cyan}
#+LaTeX_HEADER: \urlstyle{same}
#+LaTeX_HEADER: \usepackage{minted}
#+LaTeX_HEADER: \usepackage[utf8]{inputenc}
#+LaTeX_HEADER: \usepackage[english]{babel}
# #+LaTeX_HEADER: \usepackage{listings}
# #+LaTex_HEADER: \lstset{numbers=left,numbersep=6pt,numberstyle=\tiny,showstringspaces=false,aboveskip=-50pt,frame=leftline,keywordstyle=\color{green},commentstyle=\color{orange},stringstyle=\color{black},}
#+LaTeX_HEADER: \setbeamertemplate{caption}[numbered]
#+LaTeX_HEADER: \setbeamercovered{invisible}

#+Title: GNU Emacs for all
#+Author: Sachin Patil (psachin)
#+Email: psachin@redhat.com
#+Date: [[https://www.gnu.org/savannah-checkouts/gnu/ghm/2019/index.html][GNU Hacker's Meeting, 2019]]


#+BEGIN_NOTES
Why I use Emacs?
- I want my life in plain text
- I need other applications for IRC, TODO/tasks, Agenda, CLI
- Emacs is a system which understands Lisp and we can use Lisp to customize as
  we need.

STORY:
- Built the context/set a stage


Show what use Emacs for in snapshots, pictures,
video frames, then then show the title "GNU Emacs for all"
#+END_NOTES


* IRC
  #+BEGIN_NOTES
Sachin Patil's avatar
Sachin Patil committed
61
    - Lets start with IRC itself
Sachin Patil's avatar
Sachin Patil committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
    - 30 years of IRC
    - We at redhat use IRC a lot!!
    - Show conf:
      - Configure nick
      - autojoin
      - configure channels and servers
      - Configure smiley (show demo)
      - Configure notify
      - logging
      - turn of linenum mode for irc
      - start server
    - Finally show ERC demo:
      - C-c e: use ido to search channels
      - ping
  #+END_NOTES
** ERC config: User configuration
   #+BEGIN_SRC emacs-lisp -n
     (setq erc-user-full-name user-full-name
	   erc-nick user-login-name
	   erc-keywords (quote("training" "session" "swift" "emacs"))
	   erc-current-nick-highlight-type 'all
	   erc-notify-list erc-pals
	   erc-autojoin-enable t
	   erc-autojoin-channels-alist
   #+END_SRC

** ERC config: Channels
   #+BEGIN_SRC emacs-lisp -n
     erc-autojoin-enable t
     erc-autojoin-channels-alist
     (quote
      (("oftc" "#tor" "#kernelnewbies" "#kernel-outreachy")
       ("freenode.net" "#emacs" "#emacs-beginners" "#linuxjournal" "#live")
       ("GIMPNet" "#outreachy")))
   #+END_SRC

** ERC config: Modules
   #+BEGIN_SRC emacs-lisp -n
     erc-modules
     (quote
      (autojoin smiley notify))
   #+END_SRC

** ERC config: Logging
   #+BEGIN_SRC emacs-lisp -n
     ;; Logging
     erc-enable-logging t
     erc-log-mode t
     erc-log-channels-directory "~/.erc/logs/"
     ;; Timestamp position
     erc-insert-timestamp-function 'erc-insert-timestamp-left

     ;; Show channel name in notification.
     ;; Please apply: https://gitlab.com/snippets/1790218
     erc-notifications-show-channel t)
   #+END_SRC

** ERC config: Extra config
   #+BEGIN_SRC emacs-lisp -n
     ;; Turn off linum for ERC buffer
     (defun psachin/turn-off-linum ()
       "Turn off linum for ERC buffers."
       (interactive)
       (display-line-numbers-mode 0))

     (add-hook 'erc-mode-hook 'psachin/turn-off-linum)
   #+END_SRC

** ERC config: Start server
   #+BEGIN_SRC emacs-lisp -n
     (defun erc-start()
       "Start ERC."
       (interactive)
       (erc :server "irc.freenode.net")
       (erc :server "irc.oftc.net")
       (erc :server "irc.gnome.org"))
   #+END_SRC

Sachin Patil's avatar
Sachin Patil committed
140
   - https://gitlab.com/psachin/emacs.d/blob/master/irc.org
Sachin Patil's avatar
Sachin Patil committed
141
142
143
* Documents
  #+BEGIN_NOTES
    - Start by inserting a default template in an empty file: C-c C-e #
Sachin Patil's avatar
Sachin Patil committed
144
      document.org
Sachin Patil's avatar
Sachin Patil committed
145
146

    - Insert two sections: Para 1 & Para 2
Sachin Patil's avatar
Sachin Patil committed
147
    - Insert content from para.txt
Sachin Patil's avatar
Sachin Patil committed
148
149
150
151
    - Generate PDF using C-x C-e l p (or org-latex-export-to-pdf)
    - Use Emacs window to show the rendered PDF

    - Insert new section: Image and and a title "A logo"
Sachin Patil's avatar
Sachin Patil committed
152
    - Insert caption: #+CAPTION: A logo
Sachin Patil's avatar
Sachin Patil committed
153
154
155
156
157
    - and image from ./assets/gnome-x-office-presentation.png
    - Render PDF
    - Adjust image size #+ATTR_LATEX: :width 5cm
    - Render PDF again

Sachin Patil's avatar
Sachin Patil committed
158
    - Insert new section "Table" & insert a table of 4x2 (org-table-create)
Sachin Patil's avatar
Sachin Patil committed
159
160
161
162
163
164
165
166
167
168
169
    - Start writing table name, |   | Replica # 2| Replica # 2 |
      ....you got an idea how Emacs or the org mode is table aware I'd
      say
    - Let me insert a table which I prepared for this demo C-x i
      table.txt
    - Render PDF
    - align column: #+ATTR_LaTeX: :align |c|c|c|c|

    - source code
      - New section: "Source code"
      - python
Sachin Patil's avatar
Sachin Patil committed
170
      - Dedicated language specific buffer: C-c '
Sachin Patil's avatar
Sachin Patil committed
171
      - Insert from code.txt: M-x i code.txt
Sachin Patil's avatar
Sachin Patil committed
172
      - Visit Language specific mode
Sachin Patil's avatar
Sachin Patil committed
173
174
175
176
177
178
      - Render ... bad indentation
      - Insert minted or listings from file latex_minted_header.txt
      - Render
      - add line number using `-n`
      - Render

Sachin Patil's avatar
Sachin Patil committed
179
180
181
182
183
      - Import code to file:
	- #+BEGIN_SRC python -n :tangle foo.py
        - C-c C-v t (org-bable-tangle)


Sachin Patil's avatar
Sachin Patil committed
184
185
186
187
188
189
190
    - Flow diagram
      - New file image.txt
      - M-x artist-mode
      - Draw two rectangles
      - Join by line
      - first rectangle: {d} cFF3
      - second rectangle: cGRE
Sachin Patil's avatar
Sachin Patil committed
191
      - copy content from ditaa.txt
Sachin Patil's avatar
Sachin Patil committed
192
193
      - M-! ditaa image.txt image.png
      - M-! eog image.png
Sachin Patil's avatar
Sachin Patil committed
194
195
196
197
198
199
200

      #+BEGIN_SRC bash :results none
        ditaa image.txt
      #+END_SRC

      #+CAPTION: Ditaa
      ./image.png
Sachin Patil's avatar
Sachin Patil committed
201
  #+END_NOTES
Sachin Patil's avatar
Sachin Patil committed
202

Sachin Patil's avatar
Sachin Patil committed
203
204
205
206
207
  - LaTeX document
  - Image
  - Table
  - Source code
  - Flow diagram(ditaa)
Sachin Patil's avatar
Sachin Patil committed
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
    - Note(need to copy ditaa.jar in ~/.emacs.d/elpa/contrib/scripts/ditaa.jar)
    - C-c C-c (execute below code block)
    #+BEGIN_SRC ditaa :file foo.png
          +--------+   +-------+    +-------+
          |        | --+ ditaa +--> |       |
          |  Text  |   +-------+    |diagram|
          |Document|   |!magic!|    |       |
          |     {d}|   | cFF3  |    | cGRE  |
          +---+----+   +-------+    +-------+
          :                         ^
          |       Lots of work      |
          +-------------------------+
    #+END_SRC

    #+RESULTS:
    [[file:foo.png]]
Sachin Patil's avatar
Sachin Patil committed
224
225


Sachin Patil's avatar
Sachin Patil committed
226
227
228
229
230
231
232
233
234
235
236
237
238
239
* Trello
  #+BEGIN_NOTES
    - I'm not very good at managing content using UI and trello is
      really a pain for me
    - I use org-trello
    - The setup is quick and documented
      - first you have to setup a key and token for trello
      - Then for each trello board, you have to connect the org file
        to install the metadata
    - Demo:
      - Open firefox tab for trello baord
        https://trello.com/b/zQ2u4Atz/test-org-trello
      - Open a file ~/trello/insights/rules/osp.org
      - Create a new entry:
Sachin Patil's avatar
Sachin Patil committed
240
	* virt: Callback remains even after the client exit
Sachin Patil's avatar
Sachin Patil committed
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
      - `C-c t` to change status to To-Do-Groomed
      - sync card: org-trello-sync-card
      - show web
      - Insert description from ~/github/slides/freenode.live2018/trello.txt
      - sync card:
      - Add checklist:
	- [ ] Checklist
	  - [ ] Backend
	  - [ ] Frontend
	  - [ ] Playbook
      - sync again and show web
      - Assign the card: `org-trello-assign-me` and sync:
        `org-trello-sync-card`
      - Add card comment `org-trello-add-card-comment`. (NO NEED TO SYNC)
      - Archive card: `org-trello-archive-card`
  #+END_NOTES

  #+ATTR_HTML: :width 50% :height
  [[./assets/trello-logo-blue.svg]]

** org-trello
** Setup key and token
   #+BEGIN_SRC emacs-lisp -n
     ;; ~/.emacs.d/.trello/username.el
     (setq org-trello-consumer-key "abc..."
	   org-trello-access-token "def...")
   #+END_SRC

   http://org-trello.github.io/trello-setup.html

** Connect to the Trello board
   #+BEGIN_SRC emacs-lisp -n
     (use-package org-trello
       :ensure t
       :config
       (custom-set-variables '(org-trello-files
			       '("~/trello/myboard.org"))))
   #+END_SRC

* Presentation
Sachin Patil's avatar
Sachin Patil committed
281
282
  #+ATTR_HTML: :width 60% :height
  #+ATTR_HTML: :align "center"
Sachin Patil's avatar
Sachin Patil committed
283
284
285
286
287
288
289
290
291
  [[./assets/presentation.svg]]
** LaTeX Beamer
   [[https://opensource.com/article/18/4/how-create-latex-documents-emacs][how-create-latex-documents-emacs]]
   #+BEGIN_NOTES
     - start by creating an empty org file: demo_presentation.org
     - Insert empty template using C-c C-e #
     - Insert content from content.txt using C-x i

     - Let me transform this into a presentation using LaTeX beamer
Sachin Patil's avatar
Sachin Patil committed
292
293
294
295
296
297
       - org-beamer-export-to-pdf

     - Let me insert default beamer templates C-c C-e #
       - org-beamer-export-to-pdf

     - Insert beamer teamplate from beamer.txt & run `M-x org-beamer-export-to-pdf`
Sachin Patil's avatar
Sachin Patil committed
298
299
300
301
   #+END_NOTES

** reveal.js
   - https://github.com/yjwen/org-reveal
Sachin Patil's avatar
Sachin Patil committed
302
   - [[https://opensource.com/article/18/2/how-create-slides-emacs-org-mode-and-revealjs][https://opensource.com/article/18/2/how-create-slides-emacs-org-mode-and-revealjs]]
Sachin Patil's avatar
Sachin Patil committed
303
   #+BEGIN_NOTES
Sachin Patil's avatar
Sachin Patil committed
304
     - (Keep the file:///home/psachin/github/slides/ghm_2019/ open in the browser)
Sachin Patil's avatar
Sachin Patil committed
305
306
307
308
309
310
311
312
313
314
315
316
317
318
     - Lets how the same slide can be transformes into reveal.js presentation
     - Insert template from reveal.txt
     - convert using C-c C-e R R or org-reveal-export-to-html
     - Change REVEAL_TRANS from default to linear
   #+END_NOTES
** org-tree-slide
   https://github.com/takaxp/org-tree-slide
   #+BEGIN_NOTES
     - M-x org-tree-slide-mode
     - C->   &  C-<
   #+END_NOTES

* Version control
** magit
Sachin Patil's avatar
Sachin Patil committed
319
320
   - https://magit.vc/
   - https://opensource.com/article/19/1/how-use-magit
Sachin Patil's avatar
Sachin Patil committed
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
** git-timemachine
   https://gitlab.com/pidu/git-timemachine

    #+BEGIN_NOTES
      magit: Visit github/insights/insights-core and st
      git-timemachine: Visit github/manly and M-x git-timemachine, n, p, q
    #+END_NOTES

* Agenda
** org-agenda
   #+BEGIN_SRC emacs-lisp -n
     (setq org-agenda-files '("~/agenda/work/work.org"
			      "~/agenda/todo/read.org"
			      "~/agenda/todo/todo.org"))

     (setq org-capture-templates
     '(("t" "Todo" entry
	      (file+headline "~/agenda/todo/todo.org" "Tasks")
	      "* TODO %i%?\n %U\n %a")
	     ("n" "Notes" entry
	      (file+headline "~/agenda/notes.org" "Notes")
	      "* %A%?\n %U")
	     ("i" "Insights" entry
	      (file+headline "~/agenda/work/work.org" "Insights")
	      "* %u%?")))
   #+END_SRC

Sachin Patil's avatar
Sachin Patil committed
348
349
   - https://gitlab.com/psachin/emacs.d/blob/master/mytime.org

Sachin Patil's avatar
Sachin Patil committed
350
351
352
353
354
   #+BEGIN_NOTES
     I mostly use org mode to manage my notes and tasks. Time tracking
     is simple using org-agenda. This is all the configuration I have
     in my Emacs config.

Sachin Patil's avatar
Sachin Patil committed
355
356
357
     - Add notes: C-c c n
       - Create a file foo_bar
     - Add task: M-x org-capture (C-c c w) and show how to add tasks
Sachin Patil's avatar
Sachin Patil committed
358
359
360
361
362
363
364
365
366
     - Show clockin/clockout:
       - Add subtasks for the day:
	 *** Write a parser
	 *** Review playbook
	 *** Review a blog
       - clock in (C-c C-x i)
       - clock out (C-c C-x o)
       - Hack the timestamp
       - Show time for each day in column view C-c C-x C-c
Sachin Patil's avatar
Sachin Patil committed
367
       - q to quit
Sachin Patil's avatar
Sachin Patil committed
368
369
370
371
       - Go to "* Insigts" and show tabular report C-c C-x C-r
   #+END_NOTES
** Orgmode for GTD
   https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html
Sachin Patil's avatar
Sachin Patil committed
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386

* Diary
** The Diary file
   #+BEGIN_SRC
     Friday
        20:10 to 20:30 Meeting with Rey
	21:30 to 24:30 FSF IRC meeting | #fsf@freenode
   #+END_SRC

** Desktop Notification
   #+ATTR_HTML: :width 100% :height
   [[./assets/notification.png]]

   https://psachin.gitlab.io/emacs_diary_desktop_notification.html

Sachin Patil's avatar
Sachin Patil committed
387
388
389
* System
** Terminal
   #+BEGIN_NOTES
Sachin Patil's avatar
Sachin Patil committed
390
     - Open a new window and type M-x shell
Sachin Patil's avatar
Sachin Patil committed
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
     - You don't really get out of Emacs to perfom shell activities
       - M-p, M-n
   #+END_NOTES
** Man pages
   #+BEGIN_NOTES
     - Man pages is something I definetly like to browse within Emacs
     - Open a new terminal and type M-x man <ENTER> lsof <ENTER>
   #+END_NOTES
** File browser
   #+BEGIN_NOTES
     - Emacs has this dir-ed mode to to file operations like file &
       directory browsing.
     - Directory listing is like ls -l
     - You can mark, and unmark and do file operations, and do copy,
       paste like operations.
     - Go to directory ~/tmp/sos and select multiple file and mark
       them with `m`, then unmark with `u`

     - Another feature I use is tramp, to access file over ssh,
       secure-FTP
Sachin Patil's avatar
Sachin Patil committed
411
412
       - Start rhel7.4 VM
     - Demonstrate tramp using /ssh:root@192.168.100.150:~
Sachin Patil's avatar
Sachin Patil committed
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
     - Create a python file and show `import os`
     - "Sysadmins have no excuse that they have to install Emacs on
       all the servers."
   #+END_NOTES
** grep
   #+BEGIN_NOTES
     - Just one more tool which I use within Emacs that is `grep`
     - go to ~/tmp/sos/ and
     - M-x grep RET
     - grep --color -nH --null -e dovecot * -r
     - The cool this is Emacs highligts the line for you. I think is
       pretty wonderful to have this kind of tool.
   #+END_NOTES
* Blogging
  #+BEGIN_NOTES
    - Option such as [[https://orgmode.org/worg/org-tutorials/org-jekyll.html][org-jekyll]]
    - Plain HTML export
    - I use org-publish
  #+END_NOTES

** [[https://orgmode.org/worg/org-tutorials/org-jekyll.html][org-jekyll]]
** org-publish
   #+BEGIN_SRC emacs-lisp -n
     (require 'ox-publish)
     (setq org-publish-project-alist
	   '(

	     ;; ... add all the components here (see below)...

	     ))
   #+END_SRC
Sachin Patil's avatar
Sachin Patil committed
444
   - [[https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html][https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html]]
Sachin Patil's avatar
Sachin Patil committed
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
   - https://gitlab.com/psachin/psachin.gitlab.io
* Games
* Programming?
  - Support to all major programming languages
  - Syntax coloring etc.
    #+BEGIN_NOTES
      - Open an empty py file prog file and start typing `import os`
      - and then `os.sys.` till the pop up
      - Delete the content
      - Now insert content from code.txt
      - "class Foo:" will have error-red mark. Show what is wrong in
        the minor mode. Correct it.
      - Execute the code in minor mode using `M-! python3 prog.py`
    #+END_NOTES
* Questions
* Thank you

  https://psachin.gitlab.io

  [[mailto:psachin@redhat.com][psachin@redhat.com]]

  Made with Love, [[https://www.gnu.org/software/emacs/][GNU Emacs]] & [[https://orgmode.org/][orgmode]]