The Things' Engine – Blog

Table of Contents

Step by Step

<2020-03-17 Tue>

A long journey begins with the first step – Lao Tzu

For paragraph

<2020-07-29 Wed>   Emacs Orgmod notetaking

Paragraphs are separated by at least one empty line. If you need to enforce a line break within a paragraph, use ‘\\’ at the end of a line.

To preserve the line breaks, indentation and blank lines in a region, but otherwise use normal formatting, you can use this construct, which can also be used to format poetry.

Great clouds overhead
Tiny black birds rise and fall
Snow covers Emacs

   —AlexSchroeder

When quoting a passage from another document, it is customary to format this as a paragraph that is indented on both the left and the right margin. You can include quotations in Org documents like this:

Everything should be made as simple as possible, but not any simpler —Albert Einstein

If you would like to center some text, do it like this:

Everything should be made as simple as possible,
but not any simpler

Visual alignment Org tables for GUI Emacs

<2020-07-28 Tue>   Emacs Orgmode

Valign.el

This package provides visual alignment for Org and Markdown tables on GUI Emacs. It can properly align tables containing variable-pitch font, CJK characters and images. Meanwhile, the text-based alignment generated by Org mode (or Markdown mode) is left untouched.

To use this package, load it and add valign-mode to org-mode-hook or markdown-mode-hook:

1: (add-hook ’org-mode-hook #’valign-mode)

Learning Tree

<2020-07-27 Mon>   Research

learningTree.png

DONE The TODO in Emacs Org Mode – I

<2020-07-20 Mon>   Notetaking Emacs Org

This is note-taking of TODO items from The Org Manual.

Introduction

In the Emacs Org mode, TODO items are an integral part of the notes file, which are scattered throughout the notes file. Org mode provides methods to overview all the TODO items which you have scheduled.

Basic TODO Functionality

Any heading becomes a TODO item when it starts with the the phrase "TODO". The most important commands to work with TODO entries are:

  • Rotate the TODO state
  • Cycle the TODO state
  • View TODO items in a sparse tree
  • Show the global TODO items
  • Insert/becomes a TODO entry

Extended Use of TODO Keywords

Org mode allows to specify TODO items in more complex way with TODO keywords stored in org-todo-keywords. With proper setup, the TODO keyword system can work differently in various org files.

Some TODO keywords as work flow states
(setq org-todo-keywords
      '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
Some TODO keywords as types
(setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
Multiple TODO keyword sets in a file, iner-settings
(setq org-todo-keywords
      '((sequence "TODO" "|" "DONE")
        (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
        (sequence "|" "CANCELED")))
Fast access to TODO states
(setq org-todo-keywords
      '((sequence "TODO(t)" "|" "DONE(d)")
        (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
        (sequence "|" "CANCELED(c)")))

If you then press C-c c-t followed by the selection key, the entry will be switch to the state. SPC can be used to remove any TODO key word from an entry.

Setting up TODO keywords for individual files

In-buffer settings for different org files:

#+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED

Or

#+TYP_TODO: Fred Sara Lucy Mike | DONE

A setup for using several sets in parallel:

#+TODO: TODO | DONE
#+TODO: REPORT BUG KNOWNCAUSE | FIXED
#+TODO: | CANCELED

Faces for TODO keywords
(setq org-todo-keyword-faces
      '(("TODO" . org-warning) ("STARTED" . "yellow")
        ("CANCELED" . (:foreground "blue" :weight bold))))
The TODO dependancies

Usually, a parent TODO task should not be marked as done until all TODO subtasks, or children tasks, are marked as done. Sometimes there is a logical sequence to (sub)tasks, so that one subtask cannot be acted upon before all siblings above it have been marked as done. You can customise the option org-enforce-todo-dependencies.

* Parent
:PROPERTIES:
:ORDERED: t
:END:
** TODO a
** TODO b, needs to wait for (a)
** TODO c, needs to wait for (a) and (b)

DONE The TODO in Emacs Org Mode – II

<2020-07-23 Thu>   Notetaking Emacs Org

This is note-taking of TODO items from The Org Manual.

Progress Logging

Emacs Org mode can be set to record timestamps, as well as notes for making changes for the states of TODO items, such as making a TODO item as DONE. This system is highly configurable; settings can be on a per-keyword basis and can be localized to a file or even a subtree.

Closing items

Two settings (setq org-log-done 'time) and (setq org-log-done 'note) for the most basic logging are to keep track of when a certain TODO item was finished.

Each time, you turn an entry from a TODO (not-done) state into any of the DONE state, a line 'CLOSED: [timestamp]' or 'CLOSED Note' will be inserted just after the heading.

  • what happens if state cycling
  • How to display the TODO items with a 'CLOSED' timestamp, giving you an overview of what has been done
Tracking TODO state changes

When TODO keywords are used as workflow states, you might want to keep track of when a state change occurred and maybe take a note about this change. You can either record just a timestamp, or a time-stamped note for a change.

taskState.png

Figure 2: Work Flow: task states

Here are the TODO state keywords and colour settings:

 1: (setq org-todo-keywords
 2:       (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
 3:               (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
 4: 
 5: (setq org-todo-keyword-faces
 6:       (quote (("TODO" :foreground "red" :weight bold)
 7:               ("NEXT" :foreground "blue" :weight bold)
 8:               ("DONE" :foreground "forest green" :weight bold)
 9:               ("WAITING" :foreground "orange" :weight bold)
10:               ("HOLD" :foreground "magenta" :weight bold)
11:               ("CANCELLED" :foreground "forest green" :weight bold)
12:               ("MEETING" :foreground "forest green" :weight bold)
13:               ("PHONE" :foreground "forest green" :weight bold))))

When taking a lot of notes, you might want to get the notes out of the way into a drawer. Customise org-log-into-drawer to get this behaviour – the recommended drawer for this is called LOGBOOK. You can also overrule the setting of this variable for a subtree by setting a LOGINTODRAWER property.

Configuration on a pre-keyword basis

Add special markers in parentheses after each keyword (avoid to record a note for every state):

1: (setq org-todo-keywords
2:       '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)")))

Note:

  • 't', 'w', 'd' and 'c' are the fast access keys for TODO, WAITING, DONE AND CANCELED
  • '!' for a timestamp
  • '@' for a note with timestamp
    • To record a timestamp without a note for TODO keywords configured with ‘@’, just type C-c C-c to enter a blank note when prompted.
  • '/', the setting for ‘WAIT’ is even more special: the ‘!’ after the slash means that in addition to the note taken when entering the state, a timestamp should be recorded when leaving the ‘WAIT’ state, if and only if the target state does not configure logging for entering it. So it has no effect when switching from ‘WAIT’ to ‘DONE’, because ‘DONE’ is configured to record a timestamp only. But when switching from ‘WAIT’ back to ‘TODO’, the ‘/!’ in the ‘WAIT’ setting now triggers a timestamp even though ‘TODO’ has no logging configured

Settings in other ways:

  • setting logging preferences local to a buffer

    +TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
    
  • Settings in entities' profile:
    In order to define logging settings that are local to a subtree or a single item, define a ‘LOGGING’ property in this entry.

    * TODO Log each state with only a time
    :PROPERTIES:
    :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
    :END:
    * TODO Only log when switching to WAIT, and when repeating
    :PROPERTIES:
    :LOGGING: WAIT(@) logrepeat
    :END:
    * TODO No logging at all
    :PROPERTIES:
    :LOGGING: nil
    :END:

Tracking your habits

Scenario: A man wants to shave at most every 2 days and at least every 4 days.

Tracking the consistancy of a specific category of TODOs is called "habits" in org. An example for the given scenario:

** TODO Shave
  SCHEDULED: <2009-10-17 Sat .+2d/4d>
  :PROPERTIES:
  :STYLE: habit
  :LAST_REPEAT: [2009-10-19 Mon 00:36]
  :END:
  - State "DONE" from "TODO" [2009-10-15 Thu]
  - State "DONE" from "TODO" [2009-10-12 Mon]
  - State "DONE" from "TODO" [2009-10-10 Sat]
  - State "DONE" from "TODO" [2009-10-04 Sun]

Note:

  1. The habit module should be enabled by customising org-modules
  2. The habits can be displayed along with a consistancy graph.
  3. Several settings can be configured to change the way habits are displayed in the agenda: org-habit-graph-column, org-habit-preceding-days, org-habit-following-days, and org-habit-show-habits-only-for-today.
  4. Pressing K in the agenda buffer to temporarily disable habits and press again to bring them back.

DONE The TODO in Emacs Org Mode – III

<2020-07-31 Fri>   Emacs Orgmod

Range from A to C and B is the default one.

#+PRIORITIES: A C B

  • Set special faces: Customise org-priority-faces
  • Set the priority of the current heading:

    C-c ,
    
  • Increase/Decrease priority

    S-UP
    S-DOWN

Breaking tasks down into subtasks

To keep an overview of the fraction of subtasks that have already been marked as done, insert either ‘[/]’ or ‘[%]’ anywhere in the headline. These cookies are updated each time the TODO status of a child changes, or when pressing C-c C-c on the cookie.

* Organize Party [33%]
* TODO Call people [1/2]
**
TODO Peter
* DONE Sarah
* TODO Buy food
*
DONE Talk to neighbor

Checkboxes

Every item in a plain can be made into a checkbox by starting it with the string ‘[ ]’.

* TODO Organize party [2/4]
 - [-] call people [33%]
   - [ ] Peter
   - [X] Sarah
   - [ ] Sam
 - [X] order food
 - [ ] think about what music to play
 - [X] talk to the neighbors

Some operations:[1/4]

  • [ ] Toggle checkbox status: C-c C-c or C-c C-x C-b
  • [X] Insert a new item with a checkbox
  • [ ] Toggle the ORDERED priority of the entry: C-c C-x o
  • [ ] Update the statistics cookie in the current outline entry: C-c #

DONE Document structure [12/12]

<2020-08-05 Wed>   Emacs Orgmod

DONE Outlines

Outlines allows a document to be organized in a hierarchical structure, which is one of the best representations of notes and thoughts.

DONE Headings

M-x org-indent-mode

  • An empty line after the end of a subtree
  • At least two empty lines, one empty line will remain visible after folding the subtree,

DONE Visiblity cycling [3/3]

DONE Golobal and local cycling
  • C-u C-u TAB: switch back to the starup visibility of the buffer
  • C-u C-u C-u TAB: Show all, including drawers
  • C-c C-x b: Show the current subtree in an indirect buffer.
  • C-c C-x v: Copy the visible text in the region into the kill ring.
DONE Initial visibility

C-u C-u TAB: Switch back to the startup visibility.

DONE Catching invisible edits

DONE Motion

DONE Structure editing

DONE Sparse trees

DONE Plain lists

  • test
  • [ ] this is a checkbox

DONE Drawers

This is a test drawer.

C-c C-x d

This is a headline

Still outside the drawer

This is inside the drawer.

This is a test drawer.

After the drawer

DONE Blocks

System.out.println("Hello Java World");

DONE The Orgstruct minor mode

DONE Org syntax

New

  • <2019-07-18 Thu> This chapter is important. In future, we should continue to review it to be familiar with the shortcuts, which are helpful to improve the efficiency.

Some Practical TCPdump Examples

<2020-07-19 Sun>   NetworkSecurity

Practical tcpdump examples to lift your network troubleshooting and security testing game. Commands and tips to not only use tcpdump but master ways to know your network.

Knowing tcpdump is an essential skill that will come in handy for any system administrator, network engineer or security professional.

Markdown to Org documenting conversion

<2020-07-19 Sun>   Documenting

To simply convert one file from Markdown to Org the following command can be used:

pandoc -f markdown -t org -o newfile.org original-file.markdown

The solution was to export the VoodooPad document to a folder as text (File > Export Document > Export as Text…). Then call pandoc via the find command to convert them all in one go:

$ find . -name \*.txt -type f -exec pandoc  -f markdown -t org -o {}.org {} \; 
for f in `ls *.md`; do 
  pandoc -f markdown -t org -o ${f}.org ${f}; 
done
(defun markdown-convert-buffer-to-org ()
   "Convert the current buffer's content from markdown to orgmode format and save it with the current buffer's file name but with .org extension."
   (interactive)
   (shell-command-on-region (point-min) (point-max)
                            (format "pandoc -f markdown -t org -o %s"
                                    (concat (file-name-sans-extension (buffer-file-name)) ".org"))))

Linux Cron Job

<2020-05-13 Wed>   Linux

Cron job

How to generate a job just running in lipe year

For example: At 12:00am on February 29th

0 0 29 2 * root /bin/echo "Hello World"

Controlling Access to the crontab Command

You can control access to the crontab command by using two files in the /etc/cron.d directory: cron.deny and cron.allow. These files permit only specified users to perform crontab command tasks such as creating, editing, displaying, or removing their own crontab files. The cron.deny and cron.allow files consist of a list of user names, one user name per line.

These access control files work together as follows:

  • If cron.allow exists, only the users who are listed in this file can create, edit, display, or remove crontab files.
  • If cron.allow does not exist, all users can submit crontab files, except for users who are listed in cron.deny.
  • If neither cron.allow nor cron.deny exists, superuser privileges are required to run the crontab command.

Superuser privileges are required to edit or create the cron.deny and cron.allow files.

Emacs-Table

TODO <2020-05-02 Sat>   Emacs Org

DEADLINE: <2020-05-09 Sat> SCHEDULED: <2020-05-02 Sat> Plan to write an article to talk about "Tables in Emacs with Org-mode"

Tables in Emacs with Org-mode

In Emacs, the Org mode comes with a fast and intuitive table editor. Spreadsheet-like calculations are supported by using the Emacs calc package and Emacs Lisp programming language.

Create a table

Create a 5x5 table:

M-x org-table-create 5x5
Name number cost per item sum incl VAT
name1 3 1500.00 4500.00  
name2 9 4000.00 36000.00  
name3 4 2800.00 11200.00  
total        

note:

  • Reference
    • Field reference @row$column
    • Range reference rows: @2..@4 column: $1..$3
  • Field and range formulas
    • The followings are the same:

      #+TBLFM: @2$4=@2$2*@2$3;%.2f::@3$4=@3$2*@3$3;%.2f::@4$4=@4$2*@4$3;%.2f::@5$4=@2$4+@3$4+@4$4;%.2f
      
      #+TBLFM: @2$4..@4$4=$2*$3;%.2f
      
  • Formatting "%.2f" means to format result to two decimals.
  • Insert or delete rows and a columns
    • When inserting or deleting rows, use "M-up / M-down". It will adapt the formulas synchronously.
    • When moving columns around, use "M-right" and "M-left". It will adapt the formulas to match the changed structure.
  • An advance table feature The column names get defined in the row containing ! in the first column.

    Name number cost per item sum incl VAT
    name1 3 1500.00 4500.00  
    name2 9 4000.00 36000.00  
    name3 4 2800.00 11200.00  
    total        

    Using a column formula instead of the range formula for column 5. In order to use the other advanced features like naming of fields, it is necessary to mark the rows to be affected by the column formula with a "*". All other rows will not be calculated from the column formula.

    Name number cost per item sum incl VAT
    name1 3 1500.00 4500.00  
    varname 2 5 10.00  
    name2 9 4000.00 36000.00  
    name3 4 2800.00 11200.00  

Questions:

  1. how to not calculate one row? or some specific rows

Youth

<2020-04-29 Wed>   Literature

By Samuel Ullman

Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and supple knees; it is a matter of the will, a quality of the imagination, a vigor of the emotions; it is the freshness of the deep springs of life.

Youth means a temperamental predominance of courage over timidity of the appetite, for adventure over the love of ease. This often exists in a man of sixty more than a boy of twenty. Nobody grows old merely by a number of years. We grow old by deserting our ideals.

Years may wrinkle the skin, but to give up enthusiasm wrinkles the soul. Worry, fear, self-distrust bows the heart and turns the spirit back to dust.

Whether sixty or sixteen, there is in every human being's heart the lure of wonder, the unfailing child-like appetite of what's next, and the joy of the game of living. In the center of your heart and my heart there is a wireless station; so long as it receives messages of beauty, hope, cheer, courage and power from men and from the infinite, so long are you young.

When the aerials are down, and your spirit is covered with snows of cynicism and the ice of pessimism, then you are grown old, even at twenty, but as long as your aerials are up, to catch the waves of optimism, there is hope you may die young at eighty.

End – New Beginning

<2020-03-17 Tue>

End is a new beginning – YF Lin

Footnotes:

1

The link is : http://orgmod.org

This is a test of footnote[1]

[1] the test footnote.

2
a definition

Date: 2020-04-28 Tue 00:00

Created: 2020-08-05 Wed 19:49

By YF Lin

Validate