Compile-n-run in jed

In jed’s maling-list someone asked about how to compile and run from it without leave it. (Most of GUI IDEs do it.)
And you can automaticed it with a function that gets information about the buffer in which you are, runs the command and displays it on new buffer:

define compile_and_run ()
{
% declare variables
variable FORMAT = “cd %s && gcc -o %s %s && ./%s”;
variable filename, exe, dir, cmd, buffer;

% get file info and create command string
(filename, dir, , ) = getbuf_info ();
exe = path_basename_sans_extname (filename);
buffer = exe + “_output”;
cmd = sprintf (FORMAT, dir, exe, filename, exe);

% set output buffer, run command and move to that buffer
setbuf (buffer);
run_shell_cmd (cmd);
pop2buf (buffer);
}

Made it with charm and jed from a rxvt-unicode terminal.

Anuncios

My default Charm’s template

This’ my default Charm’s template I use with jed to post in my wordpress.
(I actived “no_mode” in jed because wordpress pick up return lines as new paragraph.)

<p style=”text-align:justify;”>
Write here :)
</p>
<p style=”text-align:right;font-size:xx-small;”>Made it with <em>charm</em> and <em>jed</em> from a <em>rxvt-unicode</em> terminal.</p>

Enjoy your console experince!

Made it with charm and jed from a rxvt-unicode terminal.

Bloqueo de pantalla con X lanzada desde la consola


Donde trabajo los empleados, cuando salen a almorzar o están en una reunión, siempre bloquean sus equipos. Yo utilizaba slock[0] que cumplia con esa función: poner la pantalla en negro y esperar se ingrese nuestra contraeña.
Estaba muy contento con esa herramienta hasta que un amigo me contó de un “bug” que tenemos aquellos que lanzamos el entorno gráfico desde la consola: basta con volver a la TTY donde lanzamos la X, presionar Ctrl+Z y el startx o xinit se manda a segundo plano dejándonos una bonita tty esperando que se ingresen comandos. Él paso una solución[1] que, si bien es efectiva, no me gustaba que me devuelva la tty cuando mato el startx y ese método no me reconocía las tildes ni “ñ” de mi teclado. Y para colmo, slock solo funciona en la X.
Buscando encontré a vlock[2] que cumple con todo lo que espero. Me gusto el que muestre un lindo texto informando que la pantalla esta bloqueada (ver screenshots en el sitio) y registre los logins fallidos. Pero además tiene la funcionalidad de bloquear todas las sesiones e impedir nos desplacemos entre TTYs.
Para lanzarlo hay que estar en una TTY (no sirven las virtuales como las de X o screen) pero aquí es donde lo uso con ese supuesto “bug”: Voy a la TTY donde lancé el startx, con Ctrl+Z mando a segundo plano el startx y tipeo “vlock -a” impidiendo así que cualquiera pueda hacer uso de mi equipo. Luego salgo a almorzar, vuelvo, ingreso mi constraseña y con “fg” reclamo de nuevo el proceso que dejé en segundo plano.

0. http://tools.suckless.org/slock
1. https://gbe.ring0.de/crap/display_managers
2. http://cthulhu.c3d2.de/~toidinamai/vlock/vlock.html

Made it with charm and jed from a rxvt-unicode terminal.

Play it again, Sam

The next is an extract from the book “BSD Unix Toolbox” by Christopher Negus and Francois Caen[1], and it’s about to working with commands you’ve typed.

To list the entire history, type

history

To list a previous number of history commands, follow history with a number. This lists the previous five commands in your history:

$ history 5
975 mkdir extras
976 mv *doc extras/
977 ls -CF
978 vi house.txt
979 history

To move among the commands in your history, use the up arrow and down arrow. When a command is displayed, you can use the keyboard to edit the current command like any other command: left arrow, right arrow, Delete, Backspace, and so on. Here are some other ways to recall and run commands from your bash history:

Run the previous command

$ !!

Run command number 997 from history

$ !997 ls -CF

Append *doc to command 997 from history

$ !997 *doc ls -CF *doc

Run previous command line containing the CF string

$ !?CF? ls -CF *doc

Run the previous ls command

$ !ls ls -CF *doc

Run previous ls command, replacing CF with l

$ !ls:s/CF/l ls -l *doc

Another way to edit the command history is using the fc command. With fc, you open the chosen command from history using the vi editor. The edited command runs when you exit the editor. Change to a different editor by setting the FCEDIT variable (for example, FCEDIT=gedit) or on the fc command line. For example:

Edit command number 978, then run it

$ fc 978

Edit the previous command, then run it

$ fc

Use nano to edit command 989

$ fc -e /usr/local/bin/nano 989

Use Ctrl+r to search for a string in history. For example, typing Ctrl+r followed by the string ss resulted in the following:

(reverse-i-search)`ss’: sudo /usr/bin/less /var/log/messages

Press Ctrl+r repeatedly to search backward through your history list for other occurrences of the ss string.

____________________________________
1. Wiley Publishing, Inc., 2008, ISBN: 978-0-470-37603-4. Buy it in Amazon or download it from Rapidshare.

Charm has problems with non-english letters

I read in LiveJournal’s forum that Charm has an error to use non-english letters. I had the same problem but not in text on entry or subject, my problem were on category tags. I solved it changing, for example, the word “Opinión” to “Opinion” (without “ó” letter).
Oh, no! my tea is cooled…

Probando charm

Hola mundo

¿aceptará blockquote?