Usually when I needed to paste stuff from a text file into a GUI program (most commonly, the browser), I resorted to opening the text file in gedit and copying/pasting from there. Using the X clipboard by selecting text with the mouse kinda worked, but it’s subject to Vim’s visual representation of the text, which may include unwanted display-related breaks. So using gedit was the easiest, but also awfully kludgy solution.
I did some research and learned that vim does have direct access to the X clipboard. I tried the commands they mention (basically "+y
to yank selected text, then I tried to paste in a GUI application; or "+p
to paste from the current X clipboard). They didn’t work. My installed version of Vim in Ubuntu lacked the xterm_clipboard setting. I was in despair!
Then I came across this bug report in Launchpad. Upon reading it I realized that it was as simple as installing vim-gtk. I had never considered this, as it includes a graphical Vim version which I have absolutely no use for. However the bug report mentions that it also includes a text version of vim compiled with X clipboard support. So I installed, fired up Vim, and the feature works well!
I can now have a buffer with long lines, with :set wrap
and :set linebreak
, which would be afwul if I cut/pasted it with the mouse. I can select text using vim commands and just yank it into the +
register, and it’s instantly available in the X clipboard. Bliss!
¿Aún no sabes por quién votar?
Recomiendo una leidita a esta nota de René Drucker:
http://www.jornada.unam.mx/2012/06/12/opinion/020a1pol
¿Quién diablos es René Drucker?
Antes de ir a votar por Peña Nieto, acuérdense del desprecio que le merecemos a su familia, con este bonito episodio de prepotencia:
http://www.jornada.unam.mx/2011/12/06/politica/013n1pol
A la hora de votar acuérdense de cómo en los dos últimos sexenios (PAN) simplemente el dinero se tira a la basura, con resultados enteramente dudosos (Estela de Luz, sede del Senado) o de plano sin absolutamente nada qué mostrar (RENAUT, simplemente se va a “destruir la base de datos”, es decir que el gasto se hizo y no se tiene ningún producto como reusltado).
Recuerden cómo los panistas dijeron que la manera de eficientar al gobierno era manejarlo como una “empresa” y enfocarse en costo-beneficio, eficiencia y otras “medidas”. Ahora piensen lo que les pasaría a ustedes si toman el dinero de su empresa y lo QUEMAN simplemente. Ninguna empresa puede aguantar así, y ningún ejecutivo que hiciera eso conservaría su trabajo.
Cuando sea hora de votar, acuérdense de esto:
http://www.jornada.unam.mx/2012/02/28/politica/014n1pol?partner=rss
Josefina Vázquez Mota, afirmó que cuando ve a otro aspirante que nombra a su gabinete, pienso que suman como mil 500 años de edad
, y que al observar cómo en otro partido se integra a su consejo político a ex gobernadores, algunos con historias terribles, pienso que suman como mil 500 años de prisión
.
Acuérdense de estos comentarios a la hora de ir a votar, acuérdense de cómo desprecia a la gente simplemente por su edad, cómo para ella la experiencia no vale nada, y piensen si así descalifica y menosprecia a sus colegas políticos, ¿qué hará con los planes de apoyo a la tercera edad?.
¿Por quién prefieres votar? ¿Por Vázquez Mota y su equipo de “desconocidos” que van a seguir hundiendo al país tratándolo como si fuera una empresa?
¿O por este equipo de superestrellas de la ciencia, el arte, la política y la economía?
Y la neta, si no los conoces, ve investigando quienes son. La decisión es tuya.
http://www.jornada.unam.mx/2012/02/17/economia/008o1eco
( I’ve removed this post since the instructions are obsolete - visit https://juju.is to get more)
Ever wonder why this doesn’t work to rename all your isos to .nrg?
find ./ -iname *iso -exec rename {} `basename {} .iso`.nrg \;
The thing is, the backticks are a bash construct, and whatever you specify to -exec does *not* get shell-expanded. So it’s being passed verbatim, with the only substitution being the {} for the found filenames.
But this works! (though quoting may pose some challenges). This works because it *is* being processed through bash, so all the normal expansion and shell tricks will work.
find ./ -iname *iso -exec bash -c "rename {} `basename {} .iso`.nrg" \;
When I launch a long-running process I like to forget about it, but how do I know when it’s finished?
You can of course have it send an email after it finishes:
long_process; echo "finished" |mail -s "finished" you@somewhere.com
For this to work, it’s very useful to have ssmtp or msmtp configured, so you have a sane, working local SMTP agent.
You can also send the notification only if the command succeeds:
long_process && echo "finished" |mail -s "finished" you@somewhere.com
OK, so you forgot to add the notification to your initial command line. You can use a loop to monitor a particular process and notify you when it’s done.
In this case I’ll be monitoring an instance of netcat. Determining the process name is up to you 🙂 The delimiters $ and ^ look for the executable names only.
The while loop will run while the process exists; once the process disappears the loop continues with the next instruction in the line, which is popping up an alert on the desktop and then sending an email. So if I’m not glued to the desktop, I’ll still get an email when this is done.
while pgrep $nc^; do sleep 5; done; alert; (echo "finished" |mail -s "finished" you @somewhere.com)
If you use find, it outputs full paths, which may not always be desirable. Turns out find has a -printf action with which you can do niceties such as outputting plain filenames (as if you’d used basename on them, but this means one less command on your pipeline):
find data/{audio,documents,images,video,websites}/ -type f -printf "%f\n"
The -printf command has a lot of formatting variables and possibilites! give it a try, look at the man page for more information.