суббота, 23 февраля 2013 г.

sed: неожиданно

Неожиданно для себя узнала , наверное, многим известную особенность sed
А именно:
echo 12481248| sed 's/1/0/g'
echo 12481248| sed 's%1%0%g'
echo 12481248| sed 's$1$0$g'
echo 12481248| sed 's|1|0|g'
Тоесть, вместо слеша (/) вполне допустимо использовать процент, доллар и конвеер (%, $, |)

четверг, 21 февраля 2013 г.

pacman : kde, gnome, xfce

To install:
# pacman -S kde
# pacman -S gnome
# pacman -S xfce4
To remove:
# pacman -Rnsc kde
# pacman -Rnsc gnome
# pacman -Rnsc xfce4

ArchLinux: kexec

# vim /etc/systemd/system/kexec-load@.service
[Unit]
Description=load %I kernel into the current kernel
Documentation=man:kexec(8)
DefaultDependencies=no
Before=shutdown.target umount.target final.target

[Service]
Type=oneshot
ExecStart=/sbin/kexec -l /boot/vmlinuz-%I --initrd=/boot/initramfs-%I.img --reuse-cmdline

[Install]
WantedBy=kexec.target
# systemctl enable kexec-load@linux
# systemctl kexec
frm

пятница, 15 февраля 2013 г.

"ssh -X ... " & Firefox

Поключаемся к удаленному хосту с "пробросом Х-ов"
local $ ssh -X user@host
При попытке запустить firefox получаем приблизительно такое:
remote $ firefox
The program 'firefox' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
  (Details: serial 515 error_code 10 request_code 18 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
remote $
Решается запуском firefox с ключом -no-remote
remote $ firefox -no-remote

среда, 13 февраля 2013 г.

~/bin/lang

Пишем маленький скрипт:
vi ~/bin/lang
#!/bin/bash

setxkbmap -layout "us,$1" -variant winkeys -option grp:caps_toggle,grp_led:caps  terminate:ctrl_alt_bksp
Делаем его исполняемым
$ chmod +x ~/bin/lang
Выполняем:
  • Для Англ-Русс
    $ lang ru
  • Для Англ-Укр
    $ lang ua