merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 11 Apr 2012 11:41:56 +0300
changeset 1246 dff21ea5a8fd
parent 1245 c4b183601a06 (diff)
parent 1237 1a51a3c2e4fa (current diff)
child 1247 cc97907e3123
child 1259 c7069f501ce1
child 1271 1ea412c9aefb
merged
bzr.rst
game.rst
http.rst
system-load.rst
wget.rst
--- a/bzr.rst	Thu Mar 01 15:24:49 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-
-======
- BZR.
-======
-.. contents::
-
-Import existing/init new project.
-=================================
-::
-
-  $ mkdir proj
-  $ cd proj
-  $ touch README Makefile main.c
-  $ bzr init
-  Created a standalone tree (format: 2a)
-  $ bzr add .
-  adding Makefile
-  adding README
-  adding main.c
-  $ bzr ci -m 'Init proj.'
-  Committing to: /cygdrive/e/home/devel/tmp/vcs-bzr/proj/
-  added Makefile
-  added README
-  added main.c
-  Committed revision 1.
-
-Cloning/branching repo.
-=======================
-
-'branch'/'get'/'clone' are aliases for 'branch' command::
-
-  $ bzr clone proj/ proj-clone
-  Branched 1 revision(s).
-
-Updating repo.
-==============
-
-Incoming changes.
-=================
-::
-
-  $ bzr missing --theirs-only bzr://bzr.example.com/proj/trunk
-
-Outgoing changes.
-=================
-::
-
-  $ bzr st
-  modified:
-  README
-  $ bzr ci -m up
-  Committing to: /cygdrive/e/home/devel/tmp/vcs-bzr/proj-clone/
-  modified README
-  Committed revision 2.
-  $ bzr missing --mine-only
-  Using saved parent location: /cygdrive/e/home/devel/tmp/vcs-bzr/proj/
-  You have 1 extra revision(s):
-  ------------------------------------------------------------
-  revno: 2
-  committer: Oleksandr Gavenko <gavenkoa@gmail.com>
-  branch nick: proj-clone
-  timestamp: Mon 2011-01-24 00:21:27 +0200
-  message:
-    up
-
-Working copy status.
-====================
-
-'status'/'st'/'stat' are aliases for 'status' command::
-
-  $ bzr rm README
-  deleted README
-  $ bzr st
-  removed:
-    README
-
-Show working copy diff.
-=======================
-::
-
-  $ echo hello >README
-  $ bzr diff
-  === modified file 'README'
-  --- README  2011-01-23 21:16:40 +0000
-  +++ README  2011-01-23 21:37:47 +0000
-  @@ -0,0 +1,1 @@
-  +hello
-
-Show history log.
-=================
-::
-
-  $ bzr log
-
-Adding files to repo.
-=====================
-::
-
-  $ touch hello.c
-  $ bzr add hello.c
-  adding hello.c
-
-Deleting files from repo.
-=========================
-
-'remove'/'rm'/'del' are aliases for 'remove' command::
-
-  $ bzr rm README
-  deleted README
-
-Undo local changes.
-===================
-::
-
-  $ bzr rm README
-  deleted README
-  $ bzr revert README
-  +N  README
-
-Undo last commit.
-=================
-::
-
-  $ bzr add hello.c
-  adding hello.c
-
-  $ bzr ci -m bug
-  Committing to: /cygdrive/e/home/devel/tmp/vcs-bzr/proj-clone/
-  added hello.c
-  Committed revision 2.
-
-  $ bzr uncommit
-  Are you sure? [y/n]: y
-    2 Oleksandr Gavenko	2011-01-23
-      bug
-
-  The above revision(s) will be removed.
-  You can restore the old tip by running:
-    bzr pull . -r revid:gavenkoa@gmail.com-20110123213425-f2ca8umip5iw73is
-
-  $ bzr st
-  added:
-  hello.c
-
-Info about bzr repo.
-====================
-::
-
-  $ bzr info
-  Standalone tree (format: 2a)
-  Location:
-    branch root: .
-
-  Related branches:
-    parent branch: /cygdrive/e/home/devel/tmp/vcs-bzr/proj
-
-Shelf changes.
-==============
-::
-
-  $ bzr st
-  modified:
-    README
-  $ bzr shelve --all
-  Selected changes:
-   M  README
-  Changes shelved with id "1".
-  $ bzr diff
-  $ bzr shelve --list
-  1: <no message>
-  $  bzr unshelve
-  Using changes with id "1".
-   M  README
-  All changes applied successfully.
-  Deleted changes with id "1".
-
-How find most recent tag for current revision.
-==============================================
-::
-
-  $ bzr tags --sort=time
-
--- a/game.rst	Thu Mar 01 15:24:49 2012 +0200
+++ b/game.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -5,17 +5,15 @@
 =======
 .. contents::
 
-Shuter games for Linux.
-=======================
+Civilisation.
+=============
 
-Wolfenstein: Enemy Territory.
------------------------------
 
-UT2004 (Unreal Tournament).
----------------------------
+  http://forums.civfanatics.com
+                English fan site.
 
-Unreal Tournament 2004 is closed source, but it's one of the few commercial
-games which also provide a native Linux port.
+Shooter.
+========
 
 Quake 3.
 --------
@@ -172,4 +170,3 @@
 ===========
 
   http://code.google.com/p/opentyrian/
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/java.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -0,0 +1,180 @@
+.. -*- coding: utf-8; -*-
+
+================
+ Java language.
+================
+
+Class version.
+==============
+
+  =========  ====== =====================
+  major      minor  Java platform version
+  =========  ====== =====================
+  45 0x27    3      1.0
+  45 0x27    3      1.1
+  46 0x28    0      1.2
+  47 0x29    0      1.3
+  48 0x30    0      1.4
+  49 0x31    0      1.5
+  50 0x32    0      1.6
+  =========  ====== =====================
+
+where ``minor`` and ``major`` are value of 6 and 8 bytes in .class file::
+
+  0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major
+
+Access modifiers.
+=================
+
+Public.
+-------
+
+ * Public class is visible in other packages.
+ * Public field is visible everywhere (class must be public too).
+
+Private.
+--------
+
+ * Private variables or methods may be used only by an instance of the same
+   class that declares the variable or method
+ * A private feature may only be accessed by the class that owns the feature.
+
+Protected.
+----------
+
+ * Is available to all classes in the same package and also available to all
+   subclasses of the class that owns the protected feature.
+ * This access is provided even to subclasses that reside in a different
+   package from the class that owns the protected feature.
+
+default.
+--------
+
+What you get by default ie, without any access modifier.
+
+ * It means that it is visible to all within a particular package.
+
+static.
+-------
+
+ * Static means one per class, not one for each object no matter how many
+   instance of a class might exist. This means that you can use them without
+   creating an instance of a class.
+ * Static methods are implicitly final, because overriding is done based on
+   the type of the object, and static methods are attached to a class, not an
+   object.
+ * A static method in a superclass can be shadowed by another static method in
+   a subclass, as long as the original method was not declared final.
+ * You can't override a static method with a nonstatic method.
+
+final.
+------
+
+ * A final class can't be extended ie., final class may not be subclassed.
+ * A final method can't be overridden when its class is inherited.
+ * You can't change value of a final variable.
+
+Exceptions.
+===========
+
+A checked exception is some subclass of Exception (or Exception itself),
+excluding class RuntimeException and its subclasses.
+
+Unchecked exceptions are RuntimeException and any of its subclasses. Class
+Error and its subclasses also are unchecked. With an unchecked exception,
+however, the compiler doesn't force client programmers either to catch the
+exception or declare it in a throws clause.
+
+Inner classes.
+==============
+
+Nested top-level classes.
+-------------------------
+
+If you declare a class within a class and specify the static modifier, the
+compiler treats the class just like any other top-level class.
+
+Any class outside the declaring class accesses the nested class with the
+declaring class name acting similarly to a package. eg, outer.inner. Top-level
+inner classes implicitly have access only to static variables. There can also
+be inner interfaces. All of these are of the nested top-level variety.
+
+Member classes.
+---------------
+
+Member inner classes are just like other member methods and member variables
+and access to the member class is restricted, just like methods and variables.
+This means a public member class acts similarly to a nested top-level class.
+
+The primary difference between member classes and nested top-level classes is
+that member classes have access to the specific instance of the enclosing
+class.
+
+Local classes.
+--------------
+
+Local classes are like local variables, specific to a block of code. Their
+visibility is only within the block of their declaration. In order for the
+class to be useful beyond the declaration block, it would need to implement a
+more publicly available interface.
+
+Because local classes are not members, the modifiers public, protected,
+private, and static are not usable.
+
+Anonymous classes.
+------------------
+
+Anonymous inner classes extend local inner classes one level further. As
+anonymous classes have no name, you cannot provide a constructor.
+
+64-bit problem.
+===============
+
+  http://www.java.com/en/download/faq/java_win64bit.xml
+                Which version of Java should I download for my 64-bit Windows
+                operating system?
+  http://java.sun.com/javase/6/webnotes/install/system-configurations.html
+                Java SE 6 Release Notes Supported System Configurations
+
+Java performance.
+=================
+
+  http://java.sun.com/performance/reference/whitepapers/5.0_performance.html
+  http://java.sun.com/performance/reference/whitepapers/6_performance.html
+
+Creating jar.
+=============
+::
+
+  $ jar cf myFile.jar *.class
+  $ jar cmf myManifestFile myFile.jar *.class
+  $ jar -cfe Main.jar foo.Main foo/Main.class
+
+Profiling Java.
+===============
+::
+
+  $ java -Xprof com.vendor.product.Clazz
+  $ java -Xrunhprof:help
+
+Debugging Java.
+===============
+
+Compile with ``-g`` to preserve source code information::
+
+  $ javac -g -cp $CLASSPATH -sourcepath $SRC_DIR -d $BUILD_DIR
+
+To run Java program in debugger::
+
+  $ jdb -cp $CLASSPATH -sourcepath $SRC_DIR
+
+To attach to Java application you firstly must run application with (use
+``dt_shmem`` for Windows and ``dt_socket`` for Linux)::
+
+  $ java -Xdebug -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=$PORT \
+    com.vendor.product.Clazz
+
+and then attach with debugger::
+
+  $ jdb -attach $PORT
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/net.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -0,0 +1,153 @@
+.. -*- coding: utf-8; -*-
+
+==========
+ Network.
+==========
+.. contents::
+
+Ukraine internet provider.
+==========================
+
+Utel.
+-----
+
+User - none, password - none, phone - ``*99***1#`` or ``*99#``.
+
+Peoplenet.
+----------
+
+User and password you get by sending SMS message to ``920`` number. Phone ``#777``.
+
+DNS to IP address.
+==================
+::
+
+  $ nslookup example.com
+
+IP to DNS address.
+==================
+::
+
+  $ nslookup 192.168.1.1
+
+NetBIOS to IP address.
+======================
+
+By nbtstat.exe command from MS you can print NetBIOS name cache with
+name-to-IP address mappings::
+
+  $ nbtstat -c
+
+List of NetBIOS name.
+=====================
+::
+
+  $ nbtstat -r
+
+List of open ports.
+===================
+
+List of open ports under Windows.
+---------------------------------
+::
+
+  cmd> netstat        # with DNS name resolution, TCP only
+  cmd> netstat -n     # without name resolution, TCP only
+  cmd> netstat -a -n  # TCP and UDP
+  cmd> netstat -s     # show IP, ICMP, TCP, and UDP statistics.
+
+List of open ports under Linux.
+-------------------------------
+
+-t tcp, -u udp, -l local, -p process::
+
+  $ sudo netstat -tulp
+
+or to use port number instead of protocol name::
+
+  $ sudo netstat -tulpn
+
+Which processes open port?
+==========================
+
+Windows
+-------
+::
+
+  cmd> netstat -o     # show PID
+  cmd> netstat -b     # show also cmd name
+  cmd> netstat -b -v  # show all modules (.exe and .dll) with full path
+
+Linux.
+------
+::
+
+  $ sudo netstat -tulpn
+
+or::
+
+  $ sudo lsof -i
+
+How disable IPv6?
+=================
+
+Debian kernel 2.6/Ubuntu ("official" method)/Fedora Core.
+---------------------------------------------------------
+
+Comment in /etc/modprobe.d/aliases "alias net-pf-10 ipv6" and add alias
+"net-pf-10 off", "alias ipv6 off"::
+
+  $ sudo emacs /etc/modprobe.d/aliases
+  ...
+  $ cat /etc/modprobe.d/aliases
+  ...
+  # alias net-pf-10 ipv6
+  alias net-pf-10 off
+  alias ipv6 off
+  ...
+
+Reboot or::
+
+  $ sudo update-modules
+
+Another way is adding to /etc/modprobe.d/blacklist.local lines::
+
+  blacklist ipv6
+
+You can safely wipe out any IPv6 reference in ``/etc/hosts`` and
+``/etc/network/interfaces``.
+
+  http://wiki.debian.org/DebianIPv6
+                DebianIPv6
+
+RHEL4/Centos4.
+--------------
+
+As for Debian, but ``/etc/modprobe.d/aliases`` has name ``/etc/modprobe.conf``.
+
+KDE.
+----
+::
+
+  $ cat /etc/environment
+  ...
+  KDE_NO_IPV6=true
+  ...
+
+Firefox.
+--------
+
+See ``about:config`` page, set ``network.dns.disableIPv6`` to ``true``.
+
+Clear saved Windows networking passwords.
+=========================================
+::
+
+  cmd> rundll32.exe keymgr.dll, KRShowKeyMgr
+  cmd> control userpasswords2                 # another way
+
+Proxy auto-config.
+==================
+
+  http://en.wikipedia.org/wiki/Proxy_auto-config
+
--- a/port.rst	Thu Mar 01 15:24:49 2012 +0200
+++ b/port.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -1,6 +1,12 @@
--*- mode: outline; coding: utf-8; -*-
+.. -*- coding: utf-8; -*-
 
-* Port forwarding.
+===============
+ Network port.
+===============
+
+Port forwarding.
+================
+::
 
   $ ssh -L 8888:www.linuxhorizon.ro:80 user@computer -N
   $ ssh -L 8888:www.linuxhorizon.ro:80 -L 110:mail.linuxhorizon.ro:110 \
@@ -10,54 +16,99 @@
 and smtp. It is useful to recive/send your e-mails when you don't have direct access
 to the mail server.
 
-For the ASCII art and lynx browser fans here is illustrated the first example:
+For the ASCII art and lynx browser fans here is illustrated the first example::
 
    +----------+<--port 22-->+----------+<--port 80-->o-----------+
    |SSH Client|-------------|ssh_server|-------------|   host    |
    +----------+             +----------+             o-----------+
   localhost:8888              computer      www.linuxhorizon.ro:80
 
-* Port listening.
+Reverse SSH Tunneling.
+======================
+
+Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can
+with reverse SSH tunneling. This document will show you step by step how to set
+up reverse SSH tunneling. The reverse SSH tunneling should work fine with Unix
+like systems.
+
+Let's assume that Destination's IP is 192.168.20.55 (Linux box that you want to
+access).
+
+You want to access from Linux client with IP 138.47.99.99.
+Destination (192.168.20.55) <- NAT <- Source (138.47.99.99)
+
+SH from the destination to the source (with public ip) using command below::
+
+  $ ssh -R 19999:localhost:22 sourceuser@138.47.99.99
+
+port 19999 can be any unused port. Now you can SSH from source to destination
+through SSH tuneling::
 
-Connect to a server:
+  $ ssh localhost -p 19999
+
+3rd party servers can also access 192.168.20.55 through Destination
+(138.47.99.99). Destination::
+
+  (192.168.20.55) <- |NAT| <- Source (138.47.99.99) <- Bob's server
+
+From Bob's server::
+
+  $ ssh sourceuser@138.47.99.99
+
+After the sucessful login to Source::
+
+  $ ssh localhost -p 19999
+
+The connection between destination and source must be alive at all time. Tip:
+you may run a command (e.g. watch, top) on Destination to keep the connection
+active.
+
+Port listening.
+===============
+
+Connect to a server::
 
   $ nc hostname port
 
-Be a server:
+Be a server::
 
   $ nc -l -p port
 
-* Simple filetransfer.
+Simple filetransfer.
+====================
 
-Serve a file:
+Serve a file::
 
   $ nc -l -p port < file
 
-Receive a file:
+Receive a file::
 
   $ nc hostname port > file
 
-* Filesystem cloning.
+Filesystem cloning.
+===================
 
-Serve the filesystem:
+Serve the filesystem::
 
   $ tar cOPp --same-owner / | nc -l -p port
 
-Receive the filesystem:
+Receive the filesystem::
 
   $ nc -w3 hostname port | tar xPp
 
-* Disk cloning.
+Disk cloning.
+=============
 
-Serve the disk image:
+Serve the disk image::
 
   $ dd if=/dev/hda | nc -l -p port
 
-Receive the image:
+Receive the image::
 
   $ nc -w3 hostname port | dd of=/dev/hda
 
-* Encrypted, compressed and IP restricted filetransfer.
+Encrypted, compressed and IP restricted filetransfer.
+=====================================================
 
 If combining encryption and compression, be sure to compress first then
 encrypt when sending and reverse the order for receiving. Do not attempt to
@@ -66,19 +117,22 @@
 required, specifying the IP address of the host that will be transferring the
 file is a good idea.
 
-Serving a compresssed, encrypted file from 192.168.0.1 to 192.168.0.2:
+Serving a compresssed, encrypted file from 192.168.0.1 to 192.168.0.2::
 
   $ gzip -c < file | openssl aes-128-cbc -e -k thispassword | nc -l 192.168.0.2 12345
 
-Receiving, decrypting and decompressing that file:
+Receiving, decrypting and decompressing that file::
 
   $ nc 192.168.0.1 12345 | openssl aes-128-cbc -d -k thispassword | gunzip -c > file
 
-* Scan with nmap.
+Scan with nmap.
+===============
 
 TODO
 
-* Scan with netcat.
+Scan with netcat.
+=================
+::
 
   $ nc -v -w 2 -z hostname portrange
   $ nc -v -w 2 -z hostname portlisting
@@ -87,6 +141,7 @@
 portlisting is for example 11,20,135 will scan these ports.
 
 I just tried this on windows xp, and the comma separated list of ports does
-NOT work. Instead, use space separated list. eg:
+NOT work. Instead, use space separated list. eg::
 
   cmd> nc.exe -vv -w 2 -z www.example.com 20-25 79 80 110 137-139 443
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/prettyprint.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -0,0 +1,80 @@
+.. -*- coding: utf-8 -*-
+
+===========================
+ Pretty print source code.
+===========================
+.. contents::
+
+Code formatter, beautifier, pretty printer.
+
+xml.
+====
+
+tidy.
+-----
+::
+
+  $ tidy -xml -i -utf8 -o out.xml in.xml
+
+or in Emacs::
+
+  C-x h C-x <RET> c utf-8 <RET> C-u M-| tidy -q -xml -i -utf8 -
+
+  http://tidy.sourceforge.net
+                Home page.
+  http://www.emacswiki.org/cgi-bin/wiki/tidy.el
+                Emacs bindings.
+
+xmllint.
+--------
+::
+
+  $ xmllint --format file.xml
+
+or in Emacs:
+
+  : C-x h C-u M-| xmllint --format - <RET>
+
+Emacs and nxml.
+---------------
+
+You need introduce line-breaks and then::
+
+  C-x h C-M-\
+
+xmlindent.
+----------
+
+  http://xmlindent.sourceforge.net/
+
+c/c++/java/c#.
+--------------
+
+Artistic Style, astyle.
+-----------------------
+
+A Free, Fast and Small Automatic Formatter for C, C++, C#, and Java Source Code.
+
+There are exist package for Cygwin, Debian.
+
+  http://astyle.sourceforge.net/
+                home page
+
+Uncrustify.
+-----------
+
+Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA.
+
+Exist package for Windows (binary from home page), Debian.
+
+  http://uncrustify.sourceforge.net/
+                home page
+
+jpplib.
+-------
+
+Pretty Printer Library.
+
+  http://jpplib.sourceforge.net/
+                Home page.
+
--- a/remote-shell.rst	Thu Mar 01 15:24:49 2012 +0200
+++ b/remote-shell.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -1,39 +1,5 @@
 -*- mode: outline; coding: utf-8 -*-
 
-* Reverse SSH Tunneling
-
-Have you ever wanted to ssh to your Linux box that sits behind NAT? Now you can with
-reverse SSH tunneling. This document will show you step by step how to set up reverse SSH
-tunneling. The reverse SSH tunneling should work fine with Unix like systems.
-
-Let's assume that Destination's IP is 192.168.20.55 (Linux box that you want to access).
-
-You want to access from Linux client with IP 138.47.99.99.
-Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99)
-
-SH from the destination to the source (with public ip) using command below:
-
-  $ ssh -R 19999:localhost:22 sourceuser@138.47.99.99
-
-port 19999 can be any unused port.
-Now you can SSH from source to destination through SSH tuneling:
-
-  $ ssh localhost -p 19999
-
-3rd party servers can also access 192.168.20.55 through Destination (138.47.99.99).
-Destination (192.168.20.55) <- |NAT| <- Source (138.47.99.99) <- Bob's server
-
-From Bob's server:
-
-  $ ssh sourceuser@138.47.99.99
-
-After the sucessful login to Source:
-
-  $ ssh localhost -p 19999
-
-The connection between destination and source must be alive at all time. Tip: you may run
-a command (e.g. watch, top) on Destination to keep the connection active.
-
 * Ajaxterm.
 
 Allow remote shell access to host from web browser (require html+css+javascript).
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/torrent.rst	Wed Apr 11 11:41:56 2012 +0300
@@ -0,0 +1,23 @@
+.. -*- coding: utf-8; -*-
+
+=========
+ Torrent
+=========
+.. contents::
+
+deluge.
+=======
+
+Deluge is a full-featured, multi-platform, multi-interface BitTorrent client
+using libtorrent-rasterbar in it's backend and featuring multiple
+user-interfaces: GTK+, web and console.
+
+
+rtorrent.
+=========
+
+rTorrent is a text-based ncurses BitTorrent client written in C++, based on
+the libTorrent libraries for Unix.
+
+  http://libtorrent.rakshasa.no/
+  http://en.wikipedia.org/wiki/RTorrent