# HG changeset patch # User Oleksandr Gavenko # Date 1335384272 -10800 # Node ID ff1f781e38d3f893cb91f9c55baa4de478aae6ab # Parent 6fccb9f7cfd80e378e4518223700d3b963704320# Parent f98228108bb6c3c7c86104c6b0adb7b62d865943 merged diff -r f98228108bb6 -r ff1f781e38d3 README.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.rst Wed Apr 25 23:04:32 2012 +0300 @@ -0,0 +1,22 @@ + +================ + gavenkoa tips. +================ +.. contents:: + +About. +====== + +Make HTML version. +================== + +Install docutils package:: + + $ sudo apt-get install docutils-common # for Debian + +and build:: + + $ make html + $ sensible-browser tips-html/index.html + + diff -r f98228108bb6 -r ff1f781e38d3 benchmark.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/benchmark.rst Wed Apr 25 23:04:32 2012 +0300 @@ -0,0 +1,22 @@ +.. -*- coding: utf-8; -*- + +============ + Benchmark. +============ +.. contents:: + +CPU. +==== + + http://www.cpubenchmark.net/ + +Video. +====== + + http://www.videocardbenchmark.net/ + +Hard drive. +=========== + + http://www.harddrivebenchmark.net/ + diff -r f98228108bb6 -r ff1f781e38d3 bsd-debug.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bsd-debug.rst Wed Apr 25 23:04:32 2012 +0300 @@ -0,0 +1,18 @@ +.. -*- coding: utf-8 -*- + +====================== + Debugging under BSD. +====================== + +dtrace. +======= + + http://en.wikipedia.org/wiki/Dtrace + Wikipedia home page. + +Truss. +====== + + http://en.wikipedia.org/wiki/Truss_%28Unix%29 + Wikipedia home page. + diff -r f98228108bb6 -r ff1f781e38d3 bzr.rst --- a/bzr.rst Wed Apr 25 07:41:28 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ --*- mode: outline -*- - -* 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 -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: - $ bzr unshelve -Using changes with id "1". - M README -All changes applied successfully. -Deleted changes with id "1". - diff -r f98228108bb6 -r ff1f781e38d3 debian.rst --- a/debian.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/debian.rst Wed Apr 25 23:04:32 2012 +0300 @@ -81,7 +81,7 @@ /dev/sda5 /mnt/music ntfs ro,nls=utf8,gid=win,dmask=222,fmask=337 0 0 /dev/sdd1 /mnt/usb vfat rw,shortname=winnt,utf8,quiet,gid=win,dmask=002,fmask=111 0 0 -Installing and configuting documentation. +Installing and configuring documentation. ========================================= Documentation packages end with ``-doc`` suffix. diff -r f98228108bb6 -r ff1f781e38d3 emacs.rst --- a/emacs.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/emacs.rst Wed Apr 25 23:04:32 2012 +0300 @@ -171,6 +171,7 @@ :: (benchmark-run 1 (revert-buffer)) + (benchmark-run-compiled 1 (hi-lock-face-phrase-buffer "hello" 'hi-yellow)) elp.el. ------- diff -r f98228108bb6 -r ff1f781e38d3 game.rst --- a/game.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/game.rst Wed Apr 25 23:04:32 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. -------- @@ -40,25 +38,29 @@ $ sudo apt-get install supertuxkart -Games for Linux. -================ +wormux. +======= + +Worms like game with nice graphics:: + + $ sudo apt-get install wormux Pingus. -------- +======= Pingus is a free Lemmings-like game covered under the GNU GPL:: $ sudo apt-get install pingus FreeCiv. --------- +======== Civilisation-like turn based game:: $ sudo apt-get install freeciv MegaGlest. ----------- +========== MegaGlest is a free and open source 3D real-time strategy (RTS) game, where you control the armies of one of seven different factions: Tech, Magic, Egyptians, @@ -74,7 +76,7 @@ wiki page Warzone2100. ------------- +============ In Warzone 2100 you command the forces of “The Project” in a battle to rebuild the world after mankind has almost been destroyed by nuclear missiles. @@ -88,7 +90,7 @@ $ sudo apt-get install warzone2100 extremetuxracer. ----------------- +================ GPL-version of TuxRacer:: @@ -96,10 +98,39 @@ $ etracer Frozen Bubble. --------------- +============== + +gnurobo. +======== + +GNU Robbo is a free open source reimplementation of Janusz Pelc's Robbo for the +Atari XE/XL which was distributed by LK Avalon in 1989:: + + $ sudo apt-get install gnurobo + +See: + + http://gnurobbo.sourceforge.net/ + Home page. + http://www.anotherguest.se/ + Simbian port. + +Frozen Bubble. +============== + + http://fb-s60.sourceforge.net/ + Frozen Bubble for S60. + + +gnujump. +======== + +Jump as high as possible:: + + $ sudo apt-get install gnujump FlightGear. ------------ +=========== Sophisticated open source flight simulator framework. FlightGear uses the SimGear simulation engine. Some of the aircraft models available in FlightGear @@ -108,18 +139,34 @@ $ sudo apt-get install flightgear fgrun +Kobo Deluxe. +============ + +Shot 0.5.1.1 Kobo Deluxe is an enhanced version of Akira Higuchi's game XKobo +for Un*x systems with X11. Kobo Deluxe adds sound, smoother animation, high +resolution support, OpenGL acceleration (optional), an intuitive menu driven +user interface, joystick support and other features. Recent versions also add a +number of alternative skill levels with slightly modernized gameplay:: + + $ sudo apt-get install kobodeluxe + $ kobodl + ManiaDrive. ------------ +=========== Blobwars. ---------- +========= $ sudo apt-get install blobwars Nethack. --------- +======== :: $ sudo apt-get install nethack $ sudo apt-get install glhack +Misc games. +=========== + + http://code.google.com/p/opentyrian/ diff -r f98228108bb6 -r ff1f781e38d3 http.rst --- a/http.rst Wed Apr 25 07:41:28 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ --*- mode: outline; coding: utf-8 -*- - -* Web server in Cygwin. - - $ setup -p apache2,lighttpd,dhttp - -* Encoding HTTP data. - -Starting with HTTP/1.1, web clients can indicate support for compression: - - Accept-Encoding: gzip, deflate - -Web server notifies the web client of this via the Content-Encoding header in the response: - - Content-Encoding: gzip - -* ETags. - -Server respond: - - HTTP/1.1 200 OK - Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT - ETag: "10c24bc-4ab-457e1c1f" - Content-Length: 12195 - -Lately client send: - - GET /i/yahoo.gif HTTP/1.1 - Host: us.yimg.com - If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT - If-None-Match: "10c24bc-4ab-457e1c1f" - -and get respond: - - HTTP/1.1 304 Not Modified - diff -r f98228108bb6 -r ff1f781e38d3 java.rst --- a/java.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/java.rst Wed Apr 25 23:04:32 2012 +0300 @@ -1,47 +1,61 @@ --*- mode: outline; coding: utf-8; -*- - -* Class version. +.. -*- coding: utf-8; -*- -See value of 6 and 8 bytes in .class file: +================ + Java language. +================ - {0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major} +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 + ========= ====== ===================== + 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 + ========= ====== ===================== -* Modifiers. +where ``minor`` and ``major`` are value of 6 and 8 bytes in .class file:: + + 0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major -** public. +Access modifiers. +================= + +Public. +------- * Public class is visible in other packages. * Public field is visible everywhere (class must be public too). -** private. +Private. +-------- * Private variables or methods may be used only by an instance of the same - class that declares the variable or method + class that declares the variable or method * A private feature may only be accessed by the class that owns the feature. -** protected. +Protected. +---------- * Is available to all classes in the same package and also available to all - subclasses of the class that owns the protected feature. + 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. + package from the class that owns the protected feature. -** default. +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. +------- * 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 @@ -53,13 +67,15 @@ a subclass, as long as the original method was not declared final. * You can't override a static method with a nonstatic method. -* final. +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. +Exceptions. +=========== A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. @@ -69,9 +85,11 @@ however, the compiler doesn't force client programmers either to catch the exception or declare it in a throws clause. -* Inner classes. +Inner classes. +============== -** Nested top-level 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. @@ -81,7 +99,8 @@ 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 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. @@ -91,7 +110,8 @@ that member classes have access to the specific instance of the enclosing class. -** Local classes. +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 @@ -101,12 +121,14 @@ Because local classes are not members, the modifiers public, protected, private, and static are not usable. -** Anonymous classes. +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. +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 @@ -114,16 +136,45 @@ http://java.sun.com/javase/6/webnotes/install/system-configurations.html Java SE 6 Release Notes Supported System Configurations -* Java performance. +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. +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 + diff -r f98228108bb6 -r ff1f781e38d3 lang-comp.rst --- a/lang-comp.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/lang-comp.rst Wed Apr 25 23:04:32 2012 +0300 @@ -41,3 +41,9 @@ http://www.ohloh.net/languages/compare User selected. +Lang cost. +========== + + http://archive.adaic.com/intro/ada-vs-c/cada_art.html + Comparing Development Costs of C and Ada + diff -r f98228108bb6 -r ff1f781e38d3 linux-debug.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux-debug.rst Wed Apr 25 23:04:32 2012 +0300 @@ -0,0 +1,42 @@ +.. -*- coding: utf-8 -*- + +======================== + Debugging under Linux. +======================== +.. contents:: + +ltrace. +======= + + http://www.ltrace.org/ + home page + https://sourceforge.net/projects/ltrace/ + SourceForge home page + http://en.wikipedia.org/wiki/Ltrace + Wikipedia page. + http://freecode.com/projects/ltrace + Freecode home page. + +strace. +======= +:: + + $ strace -o $CMD.log -e trace=open,close $CMD + +See: + + http://en.wikipedia.org/wiki/Strace + Wikipedia home page. + +lsof. +===== + +htop. +===== + +systemtap. +========== + + http://en.wikipedia.org/wiki/SystemTap + Wikipedia home page. + diff -r f98228108bb6 -r ff1f781e38d3 linux-driver.rst --- a/linux-driver.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/linux-driver.rst Wed Apr 25 23:04:32 2012 +0300 @@ -21,6 +21,40 @@ * http://wiki.debian.org/GraphicsCard#nVidia * http://wiki.debian.org/NvidiaGraphicsDrivers +ATI free driver. +================ + + http://wiki.debian.org/AtiHowTo + Debian ATI howto. + +ATI/AMD proprietary driver. +=========================== + +To install driver under Debian run:: + + $ sudo apt-get install fglrx-driver + +To create simple ``xorg.conf`` file run:: + + $ sudo aticonfig --initial --input=/etc/X11/xorg.conf + +To check that driver was loaded properly:: + + $ fglrxinfo + display: :0 screen: 0 + OpenGL vendor string: Advanced Micro Devices, Inc. + OpenGL renderer string: AMD Radeon HD 6900 Series + OpenGL version string: 4.2.11566 Compatibility Profile Context + +Configure performance in Catalyst Control Center:: + + $ amdcccle + + http://wiki.debian.org/ATIProprietary + Debian ATI Proprietary Driver Howto + https://help.ubuntu.com/community/BinaryDriverHowto/ATI + Ubuntu AMD Binary Driver Howto + nouveau video driver. ===================== diff -r f98228108bb6 -r ff1f781e38d3 linux.rst --- a/linux.rst Wed Apr 25 07:41:28 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ --*- mode: outline; coding: utf-8 -*- - -* SysRq. - - x86: ALT-SysRq- - SPARC: ALT-STOP- - PPC: ALT - Print Screen (or F13) - - - 'b' - reboot - 'p' - dump the current registers and flags to your console - 'r' - take control of keyboard back from X - 'e' - send SIGTERM to all processes, except for init - 'i' - send SIGKILL to all processes, except for init - 's' - attempt to sync all mounted filesystems - 'u' - remount all filesystems read-only - -You can put one of such line: - - $ echo 0 > /proc/sys/kernel/sysrq # disable - $ echo 1 > /proc/sys/kernel/sysrq # enable - -to your /etc/rc.local or alternativaly place under /etc/sysctl: - - kernel.sysrq = 1 - - http://www.kernel.org/doc/Documentation/sysrq.txt - Linux Magic System Request Key Hacks diff -r f98228108bb6 -r ff1f781e38d3 macosx-debug.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macosx-debug.rst Wed Apr 25 23:04:32 2012 +0300 @@ -0,0 +1,36 @@ +.. -*- coding: utf-8 -*- + +======================== + Debugging in Mac OS X. +======================== + +dtruss. +======= + + $ dtruss df -h # run and examine the "df -h" command + $ dtruss -p 1871 # examine PID 1871 + $ dtruss -n tar # examine all processes called "tar" + +dtrace. +======= +:: + + $ man -k dtrace + $ dapptrace + +See: + + http://en.wikipedia.org/wiki/Dtrace + Wikipedia home page. + +ktrace. +======= + +Log files generated by ``ktrace`` are viewable in human-readable form using +``kdump``. + +Since Mac OS X 10.5 Leopard, ktrace has been replaced by dtrace. + + http://en.wikipedia.org/wiki/Ktrace + Wikipedia home page. + diff -r f98228108bb6 -r ff1f781e38d3 mail.rst --- a/mail.rst Wed Apr 25 07:41:28 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ --*- mode: outline; coding: utf-8; -*- - -* Message headers fields. - - from = "From:" mailbox-list CRLF - sender = "Sender:" mailbox CRLF - reply-to = "Reply-To:" address-list CRLF - - to = "To:" address-list CRLF - cc = "Cc:" address-list CRLF - bcc = "Bcc:" (address-list / [CFWS]) CRLF - newsgroups - - http://tools.ietf.org/rfc//rfc2076.txt - Common Internet Message Headers, Informational - http://tools.ietf.org/rfc/rfc2822.txt - Internet Message Format, Standard Track - http://tools.ietf.org/rfc/rfc2821.txt - Simple Mail Transfer Protocol, Standard Track - -* Sending email via gmail in emacs. - -; install starttls from here (no need for patch) -; http://josefsson.org/emacs-smtp-starttls.html - -(setq send-mail-function 'smtpmail-send-it - message-send-mail-function 'smtpmail-send-it - smtpmail-starttls-credentials - '(("smtp.gmail.com" 587 nil nil)) - smtpmail-auth-credentials - (expand-file-name "~/.authinfo") - smtpmail-default-smtp-server "smtp.gmail.com" - smtpmail-smtp-server "smtp.gmail.com" - smtpmail-smtp-service 587 - smtpmail-debug-info t - starttls-extra-arguments nil - smtpmail-warn-about-unknown-extensions t - starttls-use-gnutls nil) - -machine smtp.gmail.com login [your name]@gmail.com password [your password] - -And finally download, unzip, make and install startttls: - -http://josefsson.org/emacs-smtp-starttls.html - -See - - http://justinsboringpage.blogspot.com/2009/02/sending-email-via-gmail-in-emacs.html - http://obfuscatedcode.wordpress.com/2007/04/26/configuring-emacs-for-gmails-smtp - -* Mail etiquette. - -** Bottom vs. top quoting. - -Just not use top quoting! - -** Stallman warn about Google. - - http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg00302.html - -* Storage format for email. - -** mbox. - - http://tools.ietf.org/html/rfc4155 - The application/mbox Media Type (Category: Informational) - http://en.wikipedia.org/wiki/Mbox - -** maildir. - - http://en.wikipedia.org/wiki/Maildir - -** MH mailbox format. - - http://en.wikipedia.org/wiki/MH_Message_Handling_System - diff -r f98228108bb6 -r ff1f781e38d3 media-type.rst --- a/media-type.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/media-type.rst Wed Apr 25 23:04:32 2012 +0300 @@ -1,5 +1,20 @@ --*- mode: outline; coding: utf-8 -*- +.. -*- coding: utf-8 -*- -* List of media types. +============== + Media types. +============== +.. contents:: + +List of media types. +==================== http://en.wikipedia.org/wiki/Internet_media_type + +Determine video codec. +====================== +:: + + $ sudo apt-get install mediainfo mediainfo-gui + $ mediainfo $FILE + + diff -r f98228108bb6 -r ff1f781e38d3 net.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/net.rst Wed Apr 25 23:04:32 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 + diff -r f98228108bb6 -r ff1f781e38d3 php.rst --- a/php.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/php.rst Wed Apr 25 23:04:32 2012 +0300 @@ -1,19 +1,19 @@ -.. -*- coding: utf-8; -*- - -====== - PHP. -====== - -Debugging. -========== - -Pretty print variable:: - - print_r($var); - -Print backtrace:: - - debug_print_backtrace(); - - * http://php.net/manual/ru/function.print-r.php - * http://www.php.net/manual/en/function.debug-print-backtrace.php +.. -*- coding: utf-8; -*- + +====== + PHP. +====== + +Debugging. +========== + +Pretty print variable:: + + print_r($var); + +Print backtrace:: + + debug_print_backtrace(); + + * http://php.net/manual/ru/function.print-r.php + * http://www.php.net/manual/en/function.debug-print-backtrace.php diff -r f98228108bb6 -r ff1f781e38d3 port.rst --- a/port.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/port.rst Wed Apr 25 23:04:32 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 + diff -r f98228108bb6 -r ff1f781e38d3 prettyprint.rst --- a/prettyprint.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/prettyprint.rst Wed Apr 25 23:04:32 2012 +0300 @@ -1,46 +1,67 @@ --*- mode: outline; coding: utf-8 -*- +.. -*- coding: utf-8 -*- + +=========================== + Pretty print source code. +=========================== +.. contents:: -* xml. +Code formatter, beautifier, pretty printer. -** tidy. +xml. +==== + +tidy. +----- +:: $ tidy -xml -i -utf8 -o out.xml in.xml -or in Emacs C-x h C-x c utf-8 C-u M-| tidy -q -xml -i -utf8 - +or in Emacs:: + + C-x h C-x c utf-8 C-u M-| tidy -q -xml -i -utf8 - http://tidy.sourceforge.net - home page + Home page. http://www.emacswiki.org/cgi-bin/wiki/tidy.el + Emacs bindings. -** xmllint. +xmllint. +-------- +:: $ xmllint --format file.xml -or in Emacs: C-x h C-u M-| xmllint --format - +or in Emacs: -** Emacs and nxml. + : C-x h C-u M-| xmllint --format - + +Emacs and nxml. +--------------- -You need introduce line-breaks and then C-x h C-M-\. +You need introduce line-breaks and then:: -** xmlindent. + C-x h C-M-\ + +xmlindent. +---------- http://xmlindent.sourceforge.net/ -code formatter/beautifier/pretty printer - -* c/c++/java/c#. +c/c++/java/c#. +-------------- -** Artistic Style, astyle. +Artistic Style, astyle. +----------------------- -A Free, Fast and Small Automatic Formatter for C, C++, C#, and Java Source -Code. +A Free, Fast and Small Automatic Formatter for C, C++, C#, and Java Source Code. -Exist package for Cygwin, Debian. +There are exist package for Cygwin, Debian. http://astyle.sourceforge.net/ home page -** Uncrustify. +Uncrustify. +----------- Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA. @@ -48,3 +69,12 @@ http://uncrustify.sourceforge.net/ home page + +jpplib. +------- + +Pretty Printer Library. + + http://jpplib.sourceforge.net/ + Home page. + diff -r f98228108bb6 -r ff1f781e38d3 python.rst --- a/python.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/python.rst Wed Apr 25 23:04:32 2012 +0300 @@ -64,3 +64,19 @@ http://pychecker.sourceforge.net/ +Debugging Python code. +====================== + +Pretty print under Python. +-------------------------- +:: + + import pprint + print(pprint.pformat('string')) + print(pprint.pformat(['1', '2'])) + +See: + + http://docs.python.org/library/pprint.html + Doc page. + diff -r f98228108bb6 -r ff1f781e38d3 remote-shell.rst --- a/remote-shell.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/remote-shell.rst Wed Apr 25 23:04:32 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). diff -r f98228108bb6 -r ff1f781e38d3 stat.rst --- a/stat.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/stat.rst Wed Apr 25 23:04:32 2012 +0300 @@ -75,7 +75,17 @@ Swap size and usage:: - $ free + $ free -t + total used free shared buffers cached + Mem: 1028732 91928 936804 0 5396 34936 + -/+ buffers/cache: 51596 977136 + Swap: 1048568 0 1048568 + Total: 2077300 91928 1985372 + + $ vmstat + procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- + r b swpd free buff cache si so bi bo in cs us sy id wa + 0 0 0 936804 5460 34936 0 0 21 5 363 29 0 0 99 0 FreeBSD interactive. -------------------- diff -r f98228108bb6 -r ff1f781e38d3 system-load.rst --- a/system-load.rst Wed Apr 25 07:41:28 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ --*- mode: outline; coding: utf-8; -*- - -* How cpu busy? - - $ top - -* How many free memory? - - $ free -t - total used free shared buffers cached - Mem: 1028732 91928 936804 0 5396 34936 - -/+ buffers/cache: 51596 977136 - Swap: 1048568 0 1048568 - Total: 2077300 91928 1985372 - -or - - $ vmstat - procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- - r b swpd free buff cache si so bi bo in cs us sy id wa - 0 0 0 936804 5460 34936 0 0 21 5 363 29 0 0 99 0 diff -r f98228108bb6 -r ff1f781e38d3 torrent.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/torrent.rst Wed Apr 25 23:04:32 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 diff -r f98228108bb6 -r ff1f781e38d3 web-search.rst --- a/web-search.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/web-search.rst Wed Apr 25 23:04:32 2012 +0300 @@ -12,10 +12,84 @@ +General purpose search. +======================= + + http://google.com + http://yandex.com + http://yahoo.com + http://bing.com + +Mail list search. +================= + + http://www.mail-archive.com/ + turns your mailing list into a searchable archive + http://www.gmane.org/ + USENET gateway/archive service, some lists may have delay in + indexing. + +Image by image search. +====================== + + * http://www.gazopa.com/ + * http://images.google.com/ + * http://www.tineye.com/ + +Image by text search. +===================== + + * http://en.wikipedia.org/wiki/List_of_CBIR_Engines + Dictionary Search. ================== - http://www.onelook.com/ + * http://www.onelook.com/ + +Software search. +================ + + http://alternativeto.net + Search for alternatives. + +Code search. +============ + + http://code.google.com/ + Google Code. + http://www.koders.com/ + Search for code in released Open Source tarballs. You can select + license and language. + http://www.merobase.com/ + Search for file names in Open Source VCS. + http://snipplr.com/ + Search for code snippets from its service. + +Search in blogs. +================ + + http://blogsearch.google.com/ + Google search for blog entries. + http://www.google.com/search?q=EXPR&tbm=blg&output=atom + Atom feed for new result of search in blogs. + http://www.technorati.com/ + Very irrelevant or zero result. + +History of word/phrase occurrence. +================================== + + http://www.google.com/trends/ + How often something searched through Google. + http://books.google.com/ngrams + Search of phrases in books from 1800 till now day. + +DuckDuckGo. +=========== + +General search engine. + + http://duckduckgo.com/ + search page Google historical corpus statistics. ==================================== @@ -208,47 +282,6 @@ define:WORD -Google Code. -============ - - http://code.google.com/ - http://www.google.com/codesearch - http://www.google.com/help/faq_codesearch.html - -file: ------ -:: - - file:\.(x|abc)$ - -lang: ------ -:: - - lang:"c++", -lang:java - lang:^(c|c#|c\+\+)$ - -license: --------- -:: - - license:apache,-license:gpl - license:bsd|mit - -package: --------- -:: - - package:"www.kernel.org" - package:\.tgz$ - -Koders.com. -=========== - -You can select license and language. - - http://www.koders.com/ - Yahoo search query syntax. ========================== @@ -454,4 +487,3 @@ http://marketshare.hitslink.com/ Market Share for Mobile and Desktop. Browsers, Operating Systems, Search Engines and Social Media Marketing - diff -r f98228108bb6 -r ff1f781e38d3 web-seo.rst --- a/web-seo.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/web-seo.rst Wed Apr 25 23:04:32 2012 +0300 @@ -5,6 +5,18 @@ ========== .. contents:: +Informing search engine about site structure. +============================================= +:: + + http://www.example.org/sitemap.xml + http://www.example.org/robots.txt + + * http://en.wikipedia.org/wiki/Sitemaps + * http://www.sitemaps.org/ + * http://en.wikipedia.org/wiki/Robots.txt + * http://www.robotstxt.org/ + Alexa. ====== diff -r f98228108bb6 -r ff1f781e38d3 wget.rst --- a/wget.rst Wed Apr 25 07:41:28 2012 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ --*- mode: outline; coding: utf-8 -*- - -* Recursive site download. - - $ wget -r -np -nc -e robots=off -p -k TOP-LEVEL-URL - -* Get server response header. - - $ wget --server-response http://example.com - $ wget -S http://example.com # short variant - -* View cookies from site. - - $ wget --save-cookies FILE -O - http://google.com >/dev/null - -* Send cookies to site. - - $ wget --load-cookies FILE http://google.com - -* Send specific header line. - - $ wget --header='Accept-Charset: iso-8859-2' --header='Accept-Language: hr' http://fly.srk.fer.hr/ - -* Send POST request. - -Log in to the server. This can be done only once. - - $ wget --save-cookies cookies.txt --post-data 'user=foo&password=bar' http://server.com/auth.php - -Now grab the page or pages we care about. - - $ wget --load-cookies cookies.txt -p http://server.com/interesting/article.php diff -r f98228108bb6 -r ff1f781e38d3 windows-driver.rst --- a/windows-driver.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/windows-driver.rst Wed Apr 25 23:04:32 2012 +0300 @@ -199,6 +199,10 @@ Debugging Tools for Windows http://msdn.microsoft.com/en-us/library/ff543450%28VS.85%29.aspx Checked and Free Build Differences + http://msdn.microsoft.com/en-us/library/windows/hardware/ff540793.aspx + Debugging Driver Installation + http://msdn.microsoft.com/en-us/library/windows/hardware/ff550863.aspx + SetupAPI Device Installation Log Entries Driver signing. =============== diff -r f98228108bb6 -r ff1f781e38d3 windows.rst --- a/windows.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/windows.rst Wed Apr 25 23:04:32 2012 +0300 @@ -532,6 +532,14 @@ cmd> systeminfo +From ``Win+R``:: + + helpctr.exe -mode hcp://system/sysinfo/msinfo.xml + +or by:: + + cmd> %SystemRoot%\pchealth\helpctr\binaries\helpctr.exe -mode hcp://system/sysinfo/msinfo.xml + Automatically logon to Windows. =============================== :: diff -r f98228108bb6 -r ff1f781e38d3 x.rst --- a/x.rst Wed Apr 25 07:41:28 2012 +0300 +++ b/x.rst Wed Apr 25 23:04:32 2012 +0300 @@ -76,6 +76,74 @@ $ xprop -root $ xprop -name bash # for xterm with running bash inside +Keyboard's keys under X window. +=============================== + + scancodes + hardware-dependent codes generated by keystrokes and received by + the X server. + keycodes + Codes sent by the X server to the client indicating which key + was pressed. Keycodes by themselves do not indicate what the + keystroke means; the client must request that information from + the X server. + modifiers + Flags, such as ``shift'' and ``control,'' that the server sends + with each keycode to the client. The client's interpretation of + the keycode may depend on the state of the modifiers. For + example, the state of the shift modifier determines whether an + alphabetic character should be lowercase or uppercase. Because + the X server encodes the states of the eight modifiers (shift, + lock, control, mod1, mod2, mod3, mod4, and mod5) in a single + byte of data, modifiers are often referred to as ``modifier + bits.'' + keysyms + codes that specify the glyphs appearing on the keys. The X + server also maintains a list of strings that describe the + keysyms, such as ``a'', ``B'', and ``Control.'' + +Find the keycode. +================= + +:: + + $ xev + $ cat /usr/include/X11/keysymdef.h + +Don't run under X:: + + $ showkey + +To do same under X:: + + $ xev | sed -n 's=.*keycode \([0-9]*\).*=\1=p' + +List key modifier:: + + $ xmodmap -pm + +Add keycode to modifier:: + + $ xmodmap -e "add shift = Shift_R" + +Remove keycode from modifier:: + + $ xmodmap -e "remove shift = Shift_L" + +Examining the current keymap table:: + + $ xmodmap -pk + +Changing the keymap table:: + + $ xmodmap -e "keycode 34 = bracketleft braceleft" + $ xmodmap -e "keysym CapsLock = Control_L" + + https://wiki.ubuntu.com/LaptopTesting/Keycodes + Ubuntu Keycodes howto. + http://en.gentoo-wiki.com/wiki/Multimedia_Keys + Gentoo Multimedia Keys howto. + Making screenshort. =================== :: diff -r f98228108bb6 -r ff1f781e38d3 xkb.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xkb.rst Wed Apr 25 23:04:32 2012 +0300 @@ -0,0 +1,24 @@ + +====== + xkb. +====== +.. contents:: + +List xkb settings. +================== +:: + + $ setxkbmap -query + rules: evdev + model: pc105 + layout: us,ru + variant: , + options: grp:rwin_toggle,grp_led:scroll + +Set en/ru layout. +================= + +Empty ``-option`` reset xkb settings:: + + $ setxkbmap -layout us,ru -option '' -option grp:rwin_toggle,grp_led:scroll +