Obsah

Tipy & triky s Linuxem

Nethack

.nethackrc
OPTIONS=autodig, color, menucolors, extmenu, hilite_pet, lit_corridor, !legacy, DECgraphics, hpmon
#OPTIONS=menustyle:full
OPTIONS=name:Pitel
OPTIONS=align:lawful
OPTIONS=catname:Schroedinger
OPTIONS=gender:male
OPTIONS=fruit:pivo
OPTIONS=pettype:cat
OPTIONS=race:human
OPTIONS=role:knight
OPTIONS=horsename:Hatatytla
MENUCOLOR=" blessed"=cyan
MENUCOLOR=" cursed"=red
MENUCOLOR=" uncursed"=green

Jak stáhnout více souborů v řadě zároveň

seq -f 'http://www.domena.cz/soubor%02g.txt' 1 10 | wget -c -i -

A jak to pak bzipovavat

tar cvjf soubor.tar.bz2 *.txt

Cizí rady

SSH tunel na newsy

ssh -L 6969:news.domena.cz:119 login@ssh.domena.cz

mc

Když nejde umount

fuser -kim /media/cdrom

Wine

[HKEY_CURRENT_USERSoftwareWineDirect3D]
"UseGLSL"="enabled"
 
[HKEY_CURRENT_USERSoftwareWineOpenGL]
"DisabledExtensions"="GL_ARB_vertex_buffer_object"
GLSL nepoužívat, spíš to nefunguje než jo!

Hamachi & Firestarter

DVB-T

Leadtek Winfast DTV Dongle, Ubuntu 7.04 Feisty Fawn, Brno – Husovice, MPlayer

Novější Ubuntu už pravděpodobně mají firmware a v4l v sobě, ale pro jistotu to zde nechávám
#Nejdřív firmware, to je easy
cd /lib/firmware
sudo wget http://thadathil.net:8000/dvb/fw/dvb-usb/dvb-usb-dib0700-01.fw
#Ted kdyz se zasune usb, melo by se to v dmesg hezky nacist
 
#Pak v4l
sudo apt-get install mercurial linux-headers-$(uname -r) build-essential
hg clone http://linuxtv.org/hg/v4l-dvb #Pozor, vytvoří podadresář!
cd v4l-dvb
make
sudo make install
sudo make reload
 
#Ladění
sudo apt-get install dvb-utils
echo 'T 626000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE' > cz-Brno #ČT, n@va, rádia
echo 'T 778000000 8MHz 2/3 NONE QAM64 8k 1/4 NONE' >> cz-Brno #Prima, Óčko, Z1
scan cz-Brno>~/.mplayer/channels.conf
channels.conf
ct1:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:257:273:257
ct2:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:513:529:258
ct24:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:769:785:259
ct4:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:1025:1041:260
radiozurnal:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:4113:16641
praha:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:4369:16642
vltava:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:4625:16643
wave:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:4881:16644
ddur:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:5137:16645
leonardo:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:5393:16646
cesko:538000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:5649:16647
nova:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_2_3:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:101:111:513
cinema:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_2_3:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:401:411:514
prima:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_2_3:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:201:211:769
cool:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_2_3:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:501:511:770
barrandov:626000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_2_3:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:301:311:2049
public:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:769:770:1537
z1:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:1025:1026:1793
proglas:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:0:4097:17153
EPG:778000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:257:258:33026
mplayer -profile DVB dvb://ct24
[DVB]
cache=1024
vf=pp=fd

Duální vysílání

-af channels=1:1:1

Mount ISO

mount -t iso9660 -o ro,loop=/dev/loop0 image.iso /cdrom

mplayer.conf

mplayer.conf
subcp=enca:cs:cp1250
#subcp=cp1250
ao=pulse
#fontconfig=1
vo=gl:osdcolor=0xffff00:lscale=1:yuv=4:cscale=1:swapinterval=-1
font="DejaVu Sans"
srate=48000
subfont-text-scale=3
stop-xscreensaver=yes
cache=8192
cache-min=50
fixed-vo=1
double=1
dr=1
softvol=1
softvol-max=1000
vf=pp=ac
af=resample=48000:0:2
lavdopts=threads=2
framedrop=1
prefer-ipv4=1
vf-add=screenshot
nolirc=yes
sws=9
spuaa=4
spugauss=0.5
 
[DVD]
channels=6
slang=cs
alang=en
vf-add=yadif
 
#vf=pp=ac/ci
#vo=xvmc:bobdeint
#vc=ffmpeg12mc
 
[DVB]
vf-add=yadif
cache=1024
 
#vf=pp=ac/ci
#vo=xvmc:bobdeint
#vc=ffmpeg12mc
 
[HD]
vf-clr=1
vo=vdpau
vc=ffh264vdpau
channels=6

Když se něco hodně zasekne

Magic SysRq key

  1. Alt + SysRq + R
  2. Alt + SysRq + E
  3. Alt + SysRq + I
  4. Alt + SysRq + S
  5. Alt + SysRq + U
  6. Alt + SysRq + B

K3b (growisofs)

System
-----------------------
K3b Version: 1.0.3

KDE Version: 3.5.6
QT Version:  3.3.7
Kernel:      2.6.20-16-generic
Devices
-----------------------
HL-DT-ST DVDRAM GSA-4160B A302 (/dev/hdb, ) [CD-R, CD-RW, CD-ROM, DVD-ROM, DVD-R, DVD-RW, DVD+R, DVD+RW, DVD+R DL] [DVD-ROM, DVD-R sekvenční, DVD-RAM, DVD-RW omezené přepisování, DVD-RW sekvenční, DVD+RW, DVD+R, DVD+R dvojvrstvé, CD-ROM, CD-R, CD-RW] [SAO, TAO, RAW, SAO/R96P, SAO/R96R, RAW/R16, RAW/R96P, RAW/R96R, Omezené přepisování]

Burned media
-----------------------
DVD-RW sekvenční

Used versions
-----------------------
growisofs: 7.0.1

growisofs
-----------------------
Executing 'builtin_dd if=/dev/fd/0 of=/dev/hdb obs=32k seek=0'
/dev/hdb: "Current Write Speed" is 2.0x1352KBps.
:-[ WRITE@LBA=0h failed with SK=5h/ASC=21h/ACQ=02h]: Invalid argument
:-( attempt to re-run with -dvd-compat -dvd-compat to engage DAO or apply full blanking procedure
:-( write failed: Invalid argument

growisofs command:
-----------------------
/usr/bin/growisofs -Z /dev/hdb=/dev/fd/0 -use-the-force-luke=notray -use-the-force-luke=tty -use-the-force-luke=tracksize:2285913 -dvd-compat -speed=2 -use-the-force-luke=bufsize:32m
dvd+rw-format -blank /dev/dvd

Rekurzivní odstranění .svn adresářů

find . -name .svn -print0 | xargs -0 rm -rf

Prohlížení .nfo souborů

iconv -f cp437 -t utf8 *.nfo | less

Adresář ve kterém je skript

dirname `readlink -f `

Zakódování série PNGů do MPEG2 na DVD

http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-vcd-dvd.html

mencoder -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:vqmin=1:lmin=1:dc=10:vstrict=0 -ofps 25 -o movie.mpg mf://*.png

ČT24

mplayer -cache 1920 -cache-min 80 -playlist $(wget 'http://www.ct24.cz/embed/iFramePlayer.php?live=3&channel=CT24&template=vysilaniCT24&ct24=true&streamtype=WM3' -o /dev/null -O - | grep 'param name="url"' | sed -r 's/.*value="(.*)".*/\1/')

Highpass filtr v Gimpu

  1. Duplikovat vrstvu
  2. Gauss blur: síla asi 1/10 rozměru obrázku, IIR (rychlejší)
  3. Invertovat barvy
  4. Režim vrstvy: overlay (překrytí)

Kódování hudby

oggenc -q 5 track.wav
lame --alt-preset standard track.wav
parallel lame {} --alt-preset standard -o {.}.mp3 ::: *.wav
for wma in *.wma ; do mplayer -ao pcm:file=/tmp/wav -novideo "$wma" ; lame --alt-preset standard /tmp/wav "`basename "$wma" .wma`.mp3" ; done

Dropbox, LAN sync & ufw

sudo ufw allow to any port 17500 from 192.168.0.0/24

GCC

gcc -O2 -pipe -pedantic-errors -Wall -Wextra -march=native -fomit-frame-pointer -std=gnu99 -Wl,-O1 -Wl,-Bdirect #Pro debug odstranit fomit-frame-pointer

FLV → MKV

ffmpeg -i file.flv -vcodec copy -acodec copy file.mkv

Zobrazení CSV

column -s';' -t < somefile.csv | less -#2 -N -S

Obrázky v ELinksu

elinks.conf
set mime.extension.jpg = "image/jpeg"
set mime.extension.jpeg = "image/jpeg"
set mime.extension.png = "image/png"
set mime.extension.gif = "image/gif"
set mime.extension.bmp = "image/bmp"
set mime.handler.image_viewer.unix.ask = 0
set mime.handler.image_viewer.unix-xwin.ask = 0
set mime.handler.image_viewer.unix.block = 1
set mime.handler.image_viewer.unix-xwin.block = 0
set mime.handler.image_viewer.unix.program = "cacaview %"
set mime.handler.image_viewer.unix-xwin.program = "cacaview %"
set mime.type.image.jpg = "image_viewer"
set mime.type.image.jpeg = "image_viewer"
set mime.type.image.png = "image_viewer"
set mime.type.image.gif = "image_viewer"
set mime.type.image.bmp = "image_viewer"

DD-WRT flash over SSH

scp factory-to-ddwrt.bin root@192.168.0.2:/tmp/
cd /tmp
dd if=/dev/mtdblock7 of=boot.bin bs=1 count=131072
cat factory-to-ddwrt.bin >> boot.bin
mtd -f write boot.bin fullflash
reboot

PPA