Monthly Archives: February 2023
Emacs on MAC OS X
Get Homebrew, then, in the terminal, install emacs-plus:
brew install d12frosted/emacs-plus/emacs-plus@28
Link to emacs in “/Applications” with:
rm -rf /Applications/Emacs.app && ln -s /usr/local/opt/emacs-plus@28/Emacs.app /Applications
Emacs For the Dummies
To run emacs, just type:
where filename is the file you want to edit.
On PowerPC desktop or any workstations with X windows, you may want to put the emacs session into background so that you can still use the current xterm window, just type
emacs filename &
Once you are in emacs, the top menu bars offer the four sub-menus:
Buffer File Edit Help
The sub-menu Buffer allows you to switch between different files that you are editing. The sub-menu File contains commands on how to open another file, save files, exit emacs, etc. For example, to open a new file, just click the File button and the Open File… option, the cursor will then jump to the minibuffer at the bottom of the screen; you can type in the file name, the one which you want to open, and type the “return” key.
Alternatively (preferred by most people), you can use the key bindings to do most of these and more.
Use the arrow keys to move the cursor C-x C-f open a new file C-x C-s save the current file C-x C-c exit the emacs (but save files first)
Here, the prefix C- refers to the CONTROL key, the prefix ESC- refers to the ESCAPE pkey. For example, C-x means to simultaneously press the CONTROL key and the “x” key.
In the following, the prefix C- refers to the CONTROL key, the prefix ESC- refers to the ESCAPE key. For example, C-n means to simultaneously press the CONTROL key and the key “n”. Lines
C-a go to the beginning-of-line C-e go to the end-of-line C-n go to next-line C-p go to previous-line C-k kill the current line C-o open-line The following two bindings are CS210 specific: C-x C-g go to a specific line numbered x C-x C-w show (in the minibuffer ) the current line number
ESC f forward-word ESC b backward-word ESC d kill-word ESC DEL backward-kill-word
C-f forward-char C-b backward-char C-d delete-char DEL delete-backward-char C-q quoted-insert C-t transpose-chars
C-space set a region mark C-w kill-region (between cursor and mark) ESC-w memorize the contents of the region (without kill) C-y yank (i.e., insert text last killed or memorize)
C-l recenter C-v scroll-up (forward) ESC-v scroll-down (backward) ESC < beginning-of-buffer ESC > end-of-buffer
C-s isearch-forward C-r isearch-backward
C-x C-f find-file C-x C-r find-file-read-only C-x C-s save-current-file
C-x 1 delete-other-windows C-x 2 split-window-vertically C-x 4 f find-file-other-window C-x o other-window
ESC ! shell-command ESC x compile compile ("make -k" is default) C-x ` next-error (used after "compile" to find/edit errors)
C-x C-c save-buffers-kill-emacs C-u universal-argument C-x C-z suspend-emacs (resume by typing "fg" to unix)
C-g keyboard-quit C-h help-command C-h t help-with-tutorial C-h b describe-bindings (complete list of emacs commands)
Commands for Compiling
Runs the compiler, linker, etc.
If this is the first time you have issued this command since entering emacs, the minibuffer at the bottom of the screen appears filled with make -k. If you’re not using make -k erase the minibuffer line (e.g., using DEL) and type in the compiler command of your choice, e.g., gccx hello.c. This command is remembered for subsequent executions of ESC-x compile. When you type RETURN, if there are unsaved buffers, you will be given the opportunity to save each one. The screen then splits into two windows, and the output from the compilation command appears in one of the two windows. If there are parse errors, use the following command.
Finds the locations of errors. Each time this command is given after a compilation that found errors, another line of parse errors is located. The compilation window is scrolled up, so that the topmost line displays the a new parse error. The other window changes buffers, if necessary, and displays the source line associated with the error. Note that if your program consists of several files, this command locates the file and loads it into the buffer. The cursor is placed at the line containing the error. You may edit the file to correct the source of the error and repeat the command again to find additional errors. When you have done the most you can with this batch of parse errors, give the ESC-x compile command again.
Commands for Debugging
Runs gdb, the GNU interactive debugger.
The minibuffer at the bottom of the screen prompts you for the name of your executable file. Unless you compiled with the -o option to name the output file, the name of your executable file is a.out. When you type in the file name followed by RETURN, the screen splits into two windows (or remain split if it is split already). One window is used for interactive input and output to gdb. The other will eventually display your program files for you to examine and edit. Sometimes the screen doesn’t divide immediately after ESC-x gdb, but gdb takes over the whole window where it was executed from; the screen divides the first time you run the program and it stops because of a breakpoint or an error caught by the debugger. So, if the window doesn’t split and you want to follow the behaviour of the running program, just type break main before you run it the first time. When execution reaches main, the window splits as described above, an arrow points to the current position in the code, which is the first line of main.
The cursor initially is placed after the gdb prompt (gdb). Whenever you want to issue a command to gdb, position the cursor at the end of the buffer, i.e., after the (gdb), and type the command as usual. The command ESC-> gets you to the end of the buffer. To examine previous input or output to gdb, use the usual emacs commands to move around the buffer.
Whenever your program, which was running under gdb, stops because of a breakpoint an interrupt, etc., the source code associated with the current locus of execution is displayed automatically in the other window. A marker, =>, points to the specific line. If you use the frame command to change frames, the source for the new frame is displayed and the marker is placed accordingly.
When you find an error, you may change the source code and save the file. However, before recompiling, give gdb the command kill to cancel your running program. Otherwise, when the compiler runs the linker to link your program you’ll get the error `text file busy’ and a new executable file will not be written.
After recompiling a program, you should reload the symbol table and the executable, otherwise you’ll be running the previous program. To do so, execute
(gdb) exec-file program-name
(gdb) symbol-file program-name
The symbol-file command will request confirmation before reloading the symbol table; just answer yes.
Sets a gdb breakpoint at the source line on which the cursor appears.
Commands for Controlling Windows
Windows in emacs usually refer to subdivisions.
Reformats screen into one window, retaining only the window in which the cursor appears.
C-x 4 f
Finds a file and displays it in the other window (the window in which the cursor does not appear). If the screen has only one window, split it into two. The C-x 4f command prompts for the file name.
Moves the cursor to another window.
Windows in the usual sense are called frames in emacs. You can use frames only if you are using PowerPC desktops or any workstations with X window systems. Frames give you true separate emacs windows at the same time. Clearly, you can not use frames if you are using a text-based terminal (e.g., via remote telnet or remote login).
C-x 5 2
Creates a new frame.
C-x 5 f
Finds a file and displays it in the other frame (the frame in which the cursor does not appear).
C-x 5 0
Deletes the selected frame. This is not allowed if there is only one frame.
Cua-mode is part of GnuEmacs versions 22.1.1 and later (at least).Cua-mode allows one to use
‘C-x’ to paste, copy, and cut the region.
ChatGPT coding skills… can you?
Hey ChatGPT, can you write code without “copying” it from others?
Linux Kernel Tuning: task blocked for more than 120 seconds
One of the most viewed posts in 2022… I hope it helped resolving some linux performance issues…
This might be old school, and maybe even boring reading. But, if you concern about performance on Linux servers, at some point, you will have to have a look to the kernel messages.
When we run very stressful jobs running on large servers (large number of CPU’s and RAM memory), where IO activity is very high. It is pretty common to start seeing these messages on the ‘dmesg’ kernel output:
[24169.372862] INFO: task kswapd1:1140 blocked for more than 120 seconds. [24169.375623] Tainted: G E 4.9.51-10.52.amzn1.x86_64 #1 [24169.378445] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [24169.382533] kswapd1 D 0 1140 2 0x00000000 [24169.385066] ffff8811605c5a00 0000000000000000 ffff8823645dc900 ffff882362844900 [24169.389208] ffff882371357c00 ffffc9001a13ba08 ffffffff8153896c ffffc9001a13ba18 [24169.393329] ffff881163ac92d8 ffff88115e87f400 ffff882362844900 ffff88115e87f46c [24169.445313] Call Trace: [24169.446981] [<ffffffff8153896c>] ? __schedule+0x23c/0x680 [24169.449454] [<ffffffff81538de6>] schedule+0x36/0x80 [24169.451790] [<ffffffff8153907e>] schedule_preempt_disabled+0xe/0x10 [24169.454509] [<ffffffff8153a8d5>] __mutex_lock_slowpath+0x95/0x110 [24169.457156] [<ffffffff8153a967>] mutex_lock+0x17/0x27 [24169.459546] [<ffffffffa0966d00>] xfs_reclaim_inodes_ag+0x2b0/0x330 [xfs] [24169.462407] [<ffffffffa0967be3>] xfs_reclaim_inodes_nr+0x33/0x40 [xfs] [24169.465203] [<ffffffffa0978f59>] xfs_fs_free_cached_objects+0x19/0x20 [xfs] ...
View original post 374 more words
Video homenaje para Jorge Pironio – 1968 Chevrolet Camaro SS – arranque en frio
Aca un video en español en homenaje mi tio Jorge Jorge Pironio, quien me enseño todo lo que se de mecanica.
Puesta en marcha en frio de un Camaro SS 1968 y una pasada rapida por un Tesla Model 3 Dual Motor. Nada que ver uno con el otro, pero vale la pena mostrar el contraste.
Puesta en marcha minuto 7:17.
La calidad de sonido no es la mejor (con auriculares se aprecia mejor), pero espero que se aprecie un poco la historia de este auto.
Morning run with Bella…
Check out my run on Strava.
Hills are killing us!!!
Christiaan Barnard y René Favaloro
Here is a memory of a time when we went to the Christiaan Barnard hospital (who performed the world’s first human-to-human heart transplant operation) in Cape Town, South Africa, where, I immediately remembered Rene Favaloro, the great Argentinian surgeon who invented the coronary artery bypass surgery.
Did you know both where contemporary?
Here is a photo I’ve found on the internet.
I feel a deep admiration for these two heart scientists…. they are inspiring leaders for new generations.
Here is a summary of 2019’s Google Doodle:“‘We’ is more important than ‘I.’ In medicine, the advances are always the result of many efforts accumulated over the years,” wrote Dr. René Favaloro, the Argentinian surgeon who introduced coronary artery bypass surgery into clinical practice and is celebrated in today’s Doodle. Born in the city of La Plata on this day in 1923, René Gerónimo Favaloro spent the first 12 years of his medical career as a country doctor in the farming community of Jacinto Arauz. He built an operating room, trained his own nurses, set up a local blood bank, and educated patients on how to prevent common ailments. The experience left him with a lifelong conviction that healthcare was a basic human right, regardless of economic circumstances. In 1962, he traveled to the United States to practice at the Cleveland Clinic, where he worked alongside Mason Sones, a pioneer of cineangiography—the reading and interpreting of coronary and ventricular images. After studying angiograms in the Sones Library, Dr. Favalaro was convinced that coronary artery bypass grafting could be an effective therapy. On May 9th, 1967, Dr. Favaloro operated on a 51-year-old woman with a blockage in her right coronary artery. Attaching her to a heart-lung machine, he stopped her heart and used a vein from her leg to redirect blood flow around the blockage. The historic operation was a success, and since then, the procedure has saved countless lives during the past half-century. Returning to Argentina in the early 1970s, Dr. Favaloro established the Favalaro Foundation in Buenos Aires. The center serves patients based on their medical needs rather than their ability to pay and teaches Dr. Favaloro’s innovative techniques to doctors all over Latin America.
Hoy fuimos al Christiaan Barnard Memorial Hospital, e inmediatamente me acordé de René Favaloro, pensando si esas dos eminencias de la cardiología serían contemporáneos…
Revolviendo en internet encontré esta foto.
Comparto una profunda admiración por estos dos científicos del corazón (en todo el sentido de la palabra).