Added tag 0.3-21 for changeset 348d2ce0f373b7ee4d49851c676f2576a65d83f2
[grml-tips.git] / grml_tips
index 997954e..fa19336 100644 (file)
--- a/grml_tips
+++ b/grml_tips
@@ -413,13 +413,17 @@ Test sound:
 Improved grep version:
 
 % glark
+-- 
+Grep with highlighting:
 
-glark grep extract-matches
+% grep --color=auto ...
+% hgrep ...
 -- 
-Highlith
+Extract matches when grepping:
 
-grepc
-hgrep
+Usage examples:
+% ifconfig | grepc 'inet addr:(.*?)\s'
+% ifconfig | glark --extract-matches 'inet addr:(.*?)\s'
 -- 
 Output text as sound:
 
@@ -573,9 +577,9 @@ vim -c "se ff=dos|x" file                # ... and even shorter ;)
 recode ibmpc..lat1 file                  # convert using recode
 echo -e "s/\r//g" > dos2unix.sed; sed -f dos2unix.sed < dosfile > unixfile
 -- 
-Save live stream to file:
+Save live audio stream to file:
 
-% mplayer -ao pcm -aofile $FILE
+% mplayer -ao pcm:file=$FILE
 
 or
 
@@ -855,6 +859,14 @@ local host:
 remote host:
 % netcat 192.168.0.1 3333
 -- 
+Reverse Shell via SSH:
+
+local host (inside the network):
+% ssh -NR 1234:localhost:22 remote_host
+
+remote host (outside the network):
+% ssh localhost -p 1234
+-- 
 Remove empty directories with zsh:
 
 % rmdir ./**/*(/od) 2> /dev/null
@@ -1166,7 +1178,17 @@ Check self signed certificate:
 Estable OpenSSL-connection using self-signed-certificate.pem and display certificate:
 # openssl s_client -showcerts -CAfile self-signed-certificate.pem -connect www.example.com:443
 
-Also take a look at make-ssl-cert (debconf wrapper for openssl)
+Generate ssl-certificate for use with apache2:
+
+export RANDFILE=/dev/random
+mkdir /etc/apache2/ssl/
+openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem
+chmod 600 /etc/apache2/ssl/apache.pem
+
+Also take a look at make-ssl-cert (debconf wrapper for openssl):
+
+# /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/apache.pem
+
 and mod-ssl-makecert (utility to create SSL certificates in /etc/apache/ssl.*/).
 -- 
 Change Windows NT password(s):
@@ -1636,7 +1658,8 @@ Setup an HTTPS website:
 
 Create a certificate:
 
-# make-ssl-cert
+# mkdir /etc/apache2/ssl
+# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
 
 Create a virtual host on port 443:
 
@@ -1652,6 +1675,10 @@ SSLCertificateFile /etc/apache2/ssl/apache.pem
 Enable listening on the HTTPS port (/etc/apache2/ports.conf):
 
 Listen 443
+
+and make sure the SSL module is used:
+
+# a2enmod ssl
 -- 
 Useful Apache / Apache2 stuff
 
@@ -1688,7 +1715,7 @@ GET http://www.google.com HTTP/1.0 [press enter twice]
 Adjust system for use of qemu with kqemu:
 
 Make sure you have all you need:
-# apt-get update ; apt-get install qemu grml-kerneladdons
+# apt-get update ; apt-get install qemu grml-kerneladdons-$KERNELVERSION
 
 Then set up kqemu:
 
@@ -1711,7 +1738,7 @@ dstat   # versatile tool for generating system resource statistics
 
 Usage examples:
 
-# mptstat -P ALL
+# mpstat -P ALL
 # iostat -x 1
 # iostat -xtc 5 3
 # vmstat 1
@@ -2237,6 +2264,12 @@ Download binary codecs for mplayer:
 
 # /usr/share/mplayer/scripts/win32codecs.sh
 
+or
+
+# /usr/share/mplayer/scripts/binary_codecs.sh install
+
+(depending on the mplayer version you have).
+
 To play encrypted DVDs and if you are living in a country where using
 libdvdcss code is not illegal can install Debian package libdvdread3
 and use the script /usr/share/doc/libdvdread3/install-css.sh.
@@ -2319,4 +2352,107 @@ xm shutdown 1
 
 This HowTo is also available online at http://grml.org/xen/
 -- 
+Play tetris with zsh:
+
+autoload -U tetris
+zle -N tetris
+bindkey "^Xt" tetris
+
+Now press 'ctrl-x t'.
+-- 
+Set up a router with grml
+
+Run grml-router script:
+# grml-router
+
+Install dnsmasq if not already present:
+# apt-get update ; apt-get install dnsmasq
+
+Adjust /etc/dnsmasq.conf according to your needs:
+# cat >> /etc/dnsmasq.conf << EOF
+domain-needed
+bogus-priv
+dhcp-range=19.168.0.124,192.168.0.254,1m # dhcp range
+dhcp-option=3,192.168.0.1   # dns server
+dhcp-option=1,255.255.255.0 # netmask
+EOF
+
+Start dnsmasq finally:
+# Restart dnsmasq
+-- 
+Find out which process(es) cause the disk to spin up:
+
+# echo 1 > /proc/sys/vm/block_dump
 
+The command sets a sysctl to cause the kernel to log all disk
+writes. Please notice that there is a lot of data.
+
+See: $KERNEL-SOURCE/Documentation/laptop-mode.txt
+
+Also take a look at event-viewer(8).
+-- 
+Display stats about memory allocations performed by a program:
+
+Usage example for 'ls':
+
+% LD_PRELOAD=/lib/libmemusage.so ls > /dev/null
+-- 
+Use KVM (Kernel-based Virtual Machine for Linux):
+
+Make sure to install the relevant tools:
+# apt-get update ; apt-get install kvm
+# modprobe kvm
+
+Test it with a minimal system like ttylinux:
+# wget http://www.minimalinux.org/ttylinux/packages/bootcd-i386-5.3.iso.gz
+# gzip -d bootcd-i386-5.3.iso.gz
+# kvm -cdrom bootcd-i386-5.3.iso
+-- 
+EEPROM data decoding for SDRAM DIMM modules:
+
+# modprobe eeprom
+# /usr/share/doc/lm-sensors/examples/eeprom/decode-dimms.pl
+-- 
+Set up and use DVB:
+
+Make sure your device is supported by Linux and running.
+See http://www.linuxtv.org/ for more details.
+
+If the DVB device works on your system (see 'hwinfo --usb'
+when using a DVB usb device for example), then make sure you
+have the scan util from dvb-utils available:
+
+# aptitude install dvb-utils
+
+Then create a channels.conf configuration file:
+
+% scan /usr/share/doc/dvb-utils/examples/scan/... > ~/.mplayer/channels.conf
+
+You can find some example configuration files on
+your grml system in ~/.channels. Usage example:
+
+% ln -s ~/.mplayer/channels.conf-AT-graz ~/.mplayer/channels.conf
+
+Tip: w_scan (see http://free.pages.at/wirbel4vdr/w_scan/index2.html)
+might be useful if you do not know the initial configuration
+details.
+-- 
+Get the lastest mercurial snapshot:
+
+Make sure you have the python-dev package available:
+# apt-get update ; apt-get install python-dev
+
+Get and build the source:
+% hg clone http://selenic.com/repo/hg mercurial
+% cd mercurial
+% make local
+% export PYTHONPATH=$(pwd)
+% export PATH=$PATH:$(pwd)
+
+now you should have the newest version of mercurial whenever you execute hg.
+
+To update to the lastest development snapshot, additionally use
+the following commands:
+% hg pull -u http://hg.intevation.org/mercurial/crew
+% make local
+--