User Tools

Site Tools


linux:sabayon

Linux (Sabayon)

Sub-pages

Jak zamienić przecinek na kropkę?

W pliku /usr/share/X11/xkb/symbols/pl należy usunąć wszystkie linie z wpisem:

include "keypad(comma)"

Teraz wystarczy wydać komendę:

# setxkbmap

i wszsytko działa.

Gentoo za firewallem?

Jeżeli z dziwnych powodów rsync został zablokowany w Twojej firmie, zamiast emerge –sync możesz użyć:

# emerge-webrsync -v

Zmień również sekcję GENTOO_MIRRORS= w pliku /etc/make.conf tak, aby nie korzystać z mirrorów rsync'owych. Np.:

GENTOO_MIRRORS="http://ftp.swin.edu.au/gentoo/ http://archive.mmu.edu.my/gentoo http://ftp.cc.uoc.gr/mirrors/linux/gentoo/"

Cluster-ssh

problem

Jeśli za każdym razem dostajesz błąd, który wygląda mniej więcej tak:

30f17d0 is not a hash at /usr/lib64/perl5/vendor_perl/5.12.4/x86_64-linux-thread-multi/Tk/MainWindow.pm line 53.
Aborted

wystarczy zastosować taką oto łatkę:

Stwórz plik ~/.Xresources z zawartością:

*.background: gray75

Uruchom:

$ xrdb -load ~/.Xresources

cssh powinien zacząć działać poprawnie.

konfiguracja

Jeśli chcesz, aby cssh ładnie rozkładał okienka, wystarczy, że poeksperymentujesz z ustawieniami w tym pliku: ~/.clusterssh/config. Ustawienia, które najbardziej mi odpowiadają:

# Configuration dump produced by 'cssh -u'
auto_quit=yes
command=
comms=ssh
console_args=
console_position=
extra_cluster_file=
history_height=10
history_width=40
key_addhost=Control-Shift-plus
key_clientname=Alt-n
key_history=Alt-h
key_paste=Control-v
key_quit=Control-q
key_retilehosts=Alt-r
max_addhost_menu_cluster_items=6
max_host_menu_items=30
menu_host_autotearoff=0
menu_send_autotearoff=0
method=ssh
mouse_paste=Button-2
rsh_args=
screen_reserve_bottom=10
screen_reserve_left=70
screen_reserve_right=0
screen_reserve_top=0
send_menu_xml_file=/home/<user-name>/.csshrc_send_menu  <-- Change this
show_history=0
ssh=/usr/bin/ssh
ssh_args= -x -o ConnectTimeout=10
telnet_args=
terminal=/usr/bin/xterm
terminal_allow_send_events=-xrm '*.VT100.allowSendEvents:true'
terminal_args=
terminal_bg_style=dark
terminal_colorize=1
terminal_decoration_height=10
terminal_decoration_width=8
terminal_font=6x12
terminal_reserve_bottom=25
terminal_reserve_left=40
terminal_reserve_right=0
terminal_reserve_top=10
terminal_size=80x24
terminal_title_opt=-T
title=CSSH
unmap_on_redraw=no
use_all_a_records=0
use_hotkeys=yes
window_tiling=yes
window_tiling_direction=right

PDF

Konwersja *.html do *.pdf

Najwygodniej jest użyć narzędzia wkhtmltopdf.

$ wkhtmltopdf www.myhomepage.com myhomepage.pdf

Join multiple pdf files

$ pdfunite in1.pdf in2.pdf in3.pdf out.pdf

Instalacja java-oracle w systemie 64-bit.

Zaczynamy od zainstalowania oracle-jdk:

# equo install dev-java/oracle-jdk-bin

Następnie ustawiamy domyślny “silnik”:

# eselect java-nsplugin set 64bit oracle-jdk-bin-1.7

Jeszcze jeden test:

# java-config --list-available-vms

i upewniamy się, że domyślny system-vm to właśnie oracle-jdk-1.7:

# java-config --set-system-vm oracle-jdk-bin-1.7

Lightscribe w Sabayonie.

Dodać wpis:

http://ftp.disconnected-by-peer.at/pub/overlay/geos_one-overlay.xml

w /etc/layman/layman.cfg w sekcji “overlays:”

Następnie wywołać:

# layman -f -a lightscribe

Teraz pozostaje zainstalować lightscribe:

# emerge lightscribe-lacie
# emerge lightscribe-simplelabeler

Teraz linkujemy biblioteki:

# ln -s /opt/lightscribe/lib32/liblightscribe.so.1 /usr/lib32/
# ln -s /opt/lightscribe/lib32/liblightscribe.so /usr/lib32/

i aktualizujemy zmiany:

# ldconfig
 

Brak czcionek i/lub ikon w aplikacjach GTK

Reinstalujemy:

# equo install x11-libs/gdk-pixbuf

SSH

How to disable SSH strict host key checking?

  • Info file ~/.ssh/config add:
Host *
  StrictHostKeyChecking no
  ServerAliveInterval 10

VPN

PPTP Client Setup

Open /etc/ppp/chap-secrets file:

# vi /etc/ppp/chap-secrets

and input your credentials:

username    PPTP    VpnPassword    *

Create a connection file called /etc/ppp/peers/myvpn:

pty "pptp my.vpn.server.address --nolaunchpppd"
name username # <-------- change this with your username
remotename PPTP
#require-mppe-128 # <---- you may need to un-comment this line...
file /etc/ppp/options.pptp
ipparam myvpn

Now you need to fix routing. Create two files:

  • /etc/ppp/ip-up.d/vpn-up.sh
#!/bin/bash
NET="192.168.1.0/24" 
GW="<gateway>"
IFACE="ppp0"
route add -net ${NET} gw ${GW} ${IFACE}
  • /etc/ppp/ip-down.d/vpn-down.sh
#!/bin/bash
NET="192.168.1.0/24" 
IFACE="ppp0"
GW="<gateway>"
route del -net ${NET} gw ${GW} ${IFACE}

Make them executable:

# chmod +x /etc/ppp/ip-up.d/vpn-up.sh
# chmod +x /etc/ppp/ip-down.d/vpn-down.sh

And you are ready to connect to your PPTP server:

# pppd call myvpn

After a while you can check if your new ppp0 interface came up:

# ifconfig 

ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
inet 192.168.1.50  netmask 255.255.255.255  destination 192.168.0.254

check routing table:

# netstat -anr

192.168.1.0     192.168.0.254   255.255.255.0   UG        0 0          0 ppp0
192.168.1.254   0.0.0.0         255.255.255.255 UH        0 0          0 ppp0
# ip route show

192.168.1.0/24 via 192.168.0.254 dev ppp0 
192.168.1.254 dev ppp0  proto kernel  scope link  src 192.168.1.50

To close your VPN connection:

# killall pptp

VIM

Configure

Spell cheking

Install vim-spellcheckers:

# equo install vim-spell-pl vim-spell-en

Activate spell checking in vim by command:

:setlocal spell spelllang=pl

or add the line to ~/.vimrc (or create /etc/vim/vimrc if you want to have same settings for everybody):

map     <silent><F7>    :setlocal spell!        spelllang=en,pl<CR>
imap    <silent><F7>    <ESC>:setlocal spell!<CR>i<right>

Comment-out multiple lines

  • Select your lines with VISUAL BLOCK (Ctrl+v);
  • press I (Shift+i) to insert before all highlighted lines;
  • type comment character (#);
  • press ESC.

Uncomment multiple lines

  • Select your lines with VISUAL BLOCK (Ctrl+v);
  • press d.

TAR

Create Tarball

$ tar -cvf myfile.tar .

Note:
c - create (an archive)
v - verbose (just because)
f - filename (the name of our tarball)
. - current directory (what's going to be backed up)

Create tar.gz

$ tar -pczvf <filename>.tar.gz *

Note:
p - preserve-permissions
c - create (an archive)
z - gzip compression
f - filename
v - verbose (just because)

Extracting files from Tarball

from .tar

$ tar -xvf myfile.tar

from .tgz or .tar.gz

$ tar -xzf <myfile.tgz> 

or

$ tar -xzf <myfile.tar.gz>

from tar.bz2

$ tar -xjf myfile.tar.bz2

Note:
x - extract
v - verbose
f - filename (backup.tar)

Extract to different location

$ tar -zxvf tarball.tgz -C /my/location

Note:
z - gzip compression
x - extract
v - verbose
f - filename (backup.tgz)
-C - extract to /my/location

Solid State Drive

Aktywować TRIM

Aktywowanie TRIM zwiększa wydajność dysku oraz wydłuża jego żywotność.

Można wykonać to na dwa sposoby:

Na stałe (realtime)

Dodaj opcję discard w swoim pliku /etc/fstab:

/dev/sda1    /mountpoint    xfs    defaults,discard    0 1

Jeśli montujesz udział ręcznie, możesz posłużyć się opcją -o discard:

# mount -o discard /dev/sda1 /mountpoint

Na życzenie (batch mode)

Możesz również użyć komendy fstrim aby usunąć nieużywane przez system bloki dysku:

# fstrim /mountpoint

Wyłączyć swap

Dopisać w pliku /etc/sysctl.conf:

vm.swappiness = 0

Można też posłużyć się komendą:

sysctl -w vm.swappiness=0

Tips and tricks

Improve Entropy on your system by using haveged

Check the current entropy level on your system. Just call:

# cat /proc/sys/kernel/random/entropy_avail

or continuously:

watch -n1 cat /proc/sys/kernel/random/entropy_avail

This command shows you how much entropy your server has collected. If it is rather low (<1000), you should probably install haveged. Otherwise cryptographic applications will block until there is enough entropy available. It can result in slow WLAN speed, if your server is a Software access point.

The haveged project is an attempt to provide an easy-to-use, unpredictable random number generator based upon an adaptation of the HAVEGE algorithm. Haveged was created to remedy low-entropy conditions in the Linux random device that can occur under some workloads, especially on headless servers.

You should use this command again to verify how much haveged boosted your entropy pool after the installation. Installation

Install the haveged package from the official repositories.

# emerge sys-apps/haveged

Activate the daemon:

# systemctl enable haveged.service
# systemctl start haveged.service

Check entropy level again. It should be above 1000 in no time.

Ładne czcionki terminalowe

Inconsolata:

# equo i inconsolata

Terminus:

# equo install terminus-font

Fix blue tint on Youtube video (flash problem)

Created the file /etc/adobe/mms.cfg and added the following contents :

#Hardware video decoding
EnableLinuxHWVideoDecode=1
OverrideGPUValidation=true

Remove "debuglog.txt" from you home directory

The C:\nppdf32Log\debuglog.txt is a result of nasty bug in Adobe PDF plugin. In order to stop the plugin to recreate the debuglog.txt file you need to do this:

  • Install hexedit
# equo install hexedit
  • Edit nppdf.so file
# hexedit /opt/Adobe/Reader9/Browser/intellinux/nppdf.so
  • TAB (in order to change to ASCII view)
  • CTLR + S and search for “debuglog.txt”
  • replace the path “C:\nppdf32Log\debuglog.txt” with the characters “/dev/null”, followed by as many null characters (0x00) as are needed to pad the string to the original length.
    Note: In order to type “/” you need to press CTRL+Q and then press “/”.
  • Save and exit by pressing CRTL+X
  • copy files:
# cp /opt/Adobe/Reader9/Browser/intellinux/nppdf.so  /usr/lib/mozilla/plugins/nppdf.so
# cp /opt/Adobe/Reader9/Browser/intellinux/nppdf.so  /opt/netscape/plugins/
  • Restart browser.UP,POINTOPOINT,RUNNING,NOARP,MULTICAST

vim gives "No protocol specified"

This happens when Vim is trying to talk to the X server and failing. The easy fix to this problem is to add this code to /root/.bashrc file:

if [[ ${EUID} -eq 0 ]] ; then
   [[ -n ${DISPLAY} ]] && unset DISPLAY
fi 

and reload bash.

Alternative take

Add xhost +SI:localuser:root at the end of /etc/profile file. Add Defaults env_keep += “DISPLAY HOME XAUTHORITY” to /etc/sudoers file.
Add session optional pam_xauth.so to /etc/pam.d/su and to /etc/pam.d/sudo files.

Simple HTTP server

Just use python module to serve your current directory via HTTP:

$ python -m SimpleHTTPServer
linux/sabayon.txt · Last modified: 2016/05/01 00:35 by abadonna