merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 29 May 2015 23:05:59 +0300
changeset 1716 ee2b194456b8
parent 1714 eed8cfffa44e (diff)
parent 1715 ec4088985c44 (current diff)
child 1717 79628df58b2d
merged
debian-apt.rst
--- a/android.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/android.rst	Fri May 29 23:05:59 2015 +0300
@@ -16,20 +16,13 @@
   https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
     init.rd file syntax.
 
-Show screencast from Android.
-=============================
+Package repositories.
+=====================
 
-  http://droid-at-screen.ribomation.com/
-                Easily show the screen of an Android device on a computer/laptop
-                (PC, Mac, Linux, ...) and then project the desktop using a
-                LCD-projector.
-
-Controlling Android from PC.
-============================
-
- * http://code.google.com/p/androidscreencast/
- * http://code.google.com/p/android-screen-monitor/
- * http://androidwebkey.com/
+  https://play.google.com/
+    Google package repository.
+  https://f-droid.org/
+    Free software repository.
 
 Mods.
 =====
@@ -41,6 +34,27 @@
   https://www.clockworkmod.com/
     ClockworkMod
 
+Connect to Android via USB by adb.
+==================================
+
+Add ``udev`` rule for fix permission issues::
+
+  $ cat /etc/udev/rules.d/90-android.rules
+
+  # Standard Google device.
+  SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c03", MODE="0666", GROUP="plugdev"
+  # China N101 II
+  SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0010", MODE="0666", GROUP="plugdev"
+
+Reload udev rules and re-plug device via USB::
+
+  $ sudo service udev force-reload
+
+See:
+
+  http://developer.android.com/tools/device.html
+    Setting up a Device for Development.
+
 Recovery.
 =========
 
@@ -119,3 +133,17 @@
   $ adb logcat
   $ adb logcat "*:W"
 
+Controlling Android from PC.
+============================
+
+ * http://code.google.com/p/androidscreencast/
+ * http://code.google.com/p/android-screen-monitor/
+ * http://androidwebkey.com/
+
+Show screencast from Android.
+=============================
+
+  http://droid-at-screen.ribomation.com/
+                Easily show the screen of an Android device on a computer/laptop
+                (PC, Mac, Linux, ...) and then project the desktop using a
+                LCD-projector.
--- a/devel-proj-files.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/devel-proj-files.rst	Fri May 29 23:05:59 2015 +0300
@@ -418,6 +418,7 @@
 ::
 
   BUGFORM
+  REPORTING-BUGS
   BUG-REPORTING
   BUG-REPORTS
   BUGS
--- a/dup.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/dup.rst	Fri May 29 23:05:59 2015 +0300
@@ -79,8 +79,6 @@
 
   https://sourceforge.net/projects/dupmerge/
                 dupmerge home page
-  http://freecode.com/projects/dupmerge
-                dupmerge freecode page
 
 ssdeep.
 -------
--- a/fvwm.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/fvwm.rst	Fri May 29 23:05:59 2015 +0300
@@ -60,3 +60,9 @@
   http://home.gna.org/fvwm-crystal/features.html
                 Usable for ideas how to do things.
 
+Menu.
+=====
+
+  https://wiki.archlinux.org/index.php/Xdg-menu
+    Generates menus for WMs using the Free Desktop menu standard.
+
--- a/git.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/git.rst	Fri May 29 23:05:59 2015 +0300
@@ -217,6 +217,19 @@
 
   $ git describe $REV
 
+List tags with dates.
+=====================
+::
+
+  $ git log --tags --simplify-by-decoration --pretty="format:%ci %d"
+
+Update to date.
+===============
+::
+
+  $ git checkout 'master@{1979-02-26}'
+  $ git checkout 'master@{1979-02-26 18:30:00}'
+
 Using git to work with SVN offline.
 ===================================
 
--- a/grub.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/grub.rst	Fri May 29 23:05:59 2015 +0300
@@ -6,6 +6,26 @@
 =======
 .. contents::
 
+Resore GRUB 2.
+==============
+
+If you boot to same bit-width kernel (32/64) that have installed you can chroot
+to main system and recover by your Linux discto commans::
+
+  mount /dev/sdX /mnt
+  sudo mount --bind /dev /mnt/dev &&
+  sudo mount --bind /dev/pts /mnt/dev/pts &&
+  sudo mount --bind /proc /mnt/proc &&
+  sudo mount --bind /sys /mnt/sys
+  sudo chroot /mnt
+  grub-install /dev/sdX
+  update-grub
+
+Check that partition with ``/boot`` directory::
+
+  $ mount /dev/sdX /mnt
+  $ ls -l /mnt/boot/grub
+
 Setting text mode resolution on boot.
 =====================================
 
--- a/hg.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/hg.rst	Fri May 29 23:05:59 2015 +0300
@@ -476,11 +476,15 @@
 
   $ hg pull --rebase
 
-Rebase draft (unpublished) changes over public changes::
+Rebase draft (unpublished) changes over public changes if one one head::
 
   $ hg rebase -s 'draft()' -d 'public()'
   $ hg up  # it possible that you isn't on a tip
 
+If you want to limit merge only to current branch::
+
+  $ hg rebase -s 'draft() & branch(.)' -d 'public() & branch(.)'
+
 Find greatest common ancestor of changesets.
 ============================================
 ::
--- a/html.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/html.rst	Fri May 29 23:05:59 2015 +0300
@@ -22,7 +22,7 @@
 
 or in HTML 5::
 
-  <meta charset="utf-8"> 
+  <meta charset="utf-8">
 
 See:
 
--- a/java.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/java.rst	Fri May 29 23:05:59 2015 +0300
@@ -197,6 +197,12 @@
 To review loaded classes explore heap dump in ``visualvm`` (visit "Classes"
 tab).
 
+Decompile class file.
+=====================
+::
+
+  $ javap -v -p -c My.java
+
 Find jar by class.
 ==================
 
--- a/lang-comp.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/lang-comp.rst	Fri May 29 23:05:59 2015 +0300
@@ -17,13 +17,15 @@
 ================
 
   http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
-                TIOBE Programming Community Index
+    TIOBE Programming Community Index
   http://www.langpop.com/
-                Programming Language Popularity
+    Programming Language Popularity
   http://lang-index.sourceforge.net/
     The Transparent Language Popularity Index
   http://www.google.com/trends
-                Google trends (history of search request count).
+    Google trends (history of search request count).
+  http://www.indeed.com/jobtrends
+    Trends in vacancies by keywords.
   http://stackoverflow.com/questions/48997/what-programming-language-is-most-popular-today
                 what-programming-language-is-most-popular-today
 
--- a/linux-debug.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/linux-debug.rst	Fri May 29 23:05:59 2015 +0300
@@ -15,8 +15,6 @@
                 SourceForge home page
   http://en.wikipedia.org/wiki/Ltrace
                 Wikipedia page.
-  http://freecode.com/projects/ltrace
-                Freecode home page.
 
 strace.
 =======
--- a/linux-wifi.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/linux-wifi.rst	Fri May 29 23:05:59 2015 +0300
@@ -29,3 +29,11 @@
   $ rfkill list
   $ rfkill unblock wifi
 
+Enable Wifi in recovery mode.
+=============================
+::
+
+  ifconfig wlan0 up
+  iwlist wlan0 scan
+  iwconfig wlan0 essid $NETWORK key s:$PASS
+
--- a/mount-smbfs.rst	Sun Apr 12 14:25:14 2015 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
--*- mode: outline; coding: utf-8 -*-
-
-* Debian
-
-Install smbfs package:
-
-  $ apt-get install smbfs
-
-Create new group:
-
-  $ groupadd smbgrp
-
-Add permitions for user that may used mount point:
-
-  $ useradd me smbgrp
-  $ useradd you smbgrp
-
-Make password file:
-
-  $ cat >/etc/.smbpass
-  username=<smb-user>
-  password=<smb-pass>
-  domain=<WORKGROUP>
-  ^D
-
-Make mount point:
-
-  $ mkdir /mnt/smb
-  $ chgrp smbgrp /mnt/smb
-  $ chmod 770 /mnt/smb
-
-Add this line to /etc/fstab
-
-  XXX correct uid=root,gid=smbgrp,umode=775,fmask=775
-  //192.168.xx.xx/share-point  /mnt/smb  smbfs  rw,credentials=/etc/.smbpass,uid=root,gid=smbgrp,umode=775,fmask=775
-
-* FreeBSD
-
-* Solaris
--- a/postgre.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/postgre.rst	Fri May 29 23:05:59 2015 +0300
@@ -13,6 +13,7 @@
 
   $ sudo apt-get install postgresql postgresql-client
   $ sudo su - postgres
+  % psql
   postgres=# CREATE USER "mypguser" WITH PASSWORD 'mypguserpass';
   postgres=# CREATE DATABASE "mypgdatabase" OWNER "mypguser";
   postgres=# \q
@@ -22,13 +23,35 @@
   $ su - mypguser
   $ psql mypgdatabase
 
+In order to create local host superuser::
+
+  $ sudo su - postgres
+  $ createuser --superuser USER
+  $ exit
+  $ sudo -u USER psql
+
 ..
 
   https://wiki.debian.org/PostgreSql
     Debian wiki instructions.
 
-List all schemas and tables.
-============================
+List databases, schemas and tables.
+===================================
+
+Default database is ``postgres``.
+
+To list databases and database locales::
+
+  $ psql -U pgadmin -l
+
+or::
+
+  => SELECT datname FROM pg_database WHERE datistemplate = false;
+  => \l
+
+To switch databases::
+
+  => \connect NAME
 
 Schemas::
 
@@ -36,3 +59,66 @@
   => select nspname from pg_catalog.pg_namespace;
   => \dn *
 
+To list all tables in the current database::
+
+  => SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;
+  => \dt
+
+Set default schema.
+===================
+::
+
+  set search_path to NAME;
+
+Database, table, index size.
+============================
+
+Database size::
+
+  SELECT pg_database_size('geekdb');  -- in bytes
+  SELECT pg_size_pretty(pg_database_size('dbname'));
+
+List of databases sizes::
+
+  \l+
+
+List tables sizes::
+
+  \d+
+
+Table total size (with indexes)::
+
+  SELECT pg_size_pretty(pg_total_relation_size('schemaname.tablename'));
+
+Sole table size (without indexes and other)::
+
+  SELECT pg_size_pretty(pg_relation_size('schemaname.tablename'));
+
+Largest table in the PostgreSQL database::
+
+  SELECT relname, relpages FROM pg_class ORDER BY relpages DESC;
+
+Using psql client.
+==================
+
+Using password file ``~/.pgpass``::
+
+  # comment
+  hostname:port:database:username:password
+  hostname:port:*:username:password
+  hostname:*:*:username:password
+
+Connect by::
+
+  $ psql -U $USER -h $HOST  $SCHEMA
+
+How to view execution plan::
+
+  EXPLAIN query;
+  EXPLAIN ANALYZE query;
+
+How to redirect the output of query to a file::
+
+  \o output_file
+  SELECT * FROM pg_class;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samba.rst	Fri May 29 23:05:59 2015 +0300
@@ -0,0 +1,80 @@
+.. -*- coding: utf-8 -*-
+
+========
+ Samba.
+========
+.. contents::
+
+Installing smbfs.
+=================
+
+Install smbfs package::
+
+  $ apt-get install smbfs
+
+Create new group::
+
+  $ groupadd smbgrp
+
+Add permitions for user that may used mount point::
+
+  $ useradd me smbgrp
+  $ useradd you smbgrp
+
+Make password file::
+
+  $ cat >/etc/.smbpass
+  username=<smb-user>
+  password=<smb-pass>
+  domain=<WORKGROUP>
+  ^D
+
+Make mount point::
+
+  $ mkdir /mnt/smb
+  $ chgrp smbgrp /mnt/smb
+  $ chmod 770 /mnt/smb
+
+Add this line to ``/etc/fstab``::
+
+  XXX correct uid=root,gid=smbgrp,umode=775,fmask=775
+  //192.168.xx.xx/share-point  /mnt/smb  smbfs  rw,credentials=/etc/.smbpass,uid=root,gid=smbgrp,umode=775,fmask=775
+
+Recursively getting files.
+==========================
+
+You can use ``TAB``completion in ``smbclient``::
+
+  $ mkdir $DEST
+  $ cd $DEST
+  $ smbclient -U $DOMAIN/$DOMAINUSER //$IP/$SHARE $DOMAINPASSWORD
+  smb> prompt
+  smb> recurse
+  smb> mget directory\
+  ...
+  smb> quit
+
+Alternative syntax to run ``smbclient``::
+
+  $ smbclient -U $USER //$IP/$SHARE $PASSWORD
+  ...
+
+or::
+
+  $ smbclient -U $USER //$IP/$SHARE
+  Password:
+  ...
+
+Alternative syntax for ``smbclient`` and additional commands::
+
+  mask ""
+  recurse ON
+  prompt OFF
+  cd 'path\to\remote\dir'
+  lcd '~/path/to/local/dir'
+  mget *
+
+To list all available shares::
+
+  $ smbclient -U $USER -L //$IP
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wine.rst	Fri May 29 23:05:59 2015 +0300
@@ -0,0 +1,49 @@
+.. -*- coding: utf-8; -*-
+.. include:: HEADER.rst
+
+=======
+ Wine.
+=======
+.. contents::
+
+Installing into separate workspace.
+===================================
+::
+
+  $ PROFILE=my-program
+  $ export WINEPREFIX=~/.wine-$PROFILE
+  $ winetricks dotnet20 dotnet40
+  $ wine /path/to/installer.exe
+  $ wine $WINEPREFIX/Program\ Files/Program/start.exe
+
+Write simple script to run program in your environment::
+
+  #!/bin/sh
+  env WINEPREFIX=~/.wine-my ~/.wine-my/
+
+winetricks.
+===========
+
+List of available packages::
+
+  $ winetricks apps list
+
+Instal .Net 2.0/4.0::
+
+  $ winetricks dotnet20 dotnet40
+
+Wine utils.
+===========
+::
+
+  $ winecfg
+
+  $ wine notepad
+  $ wine regedit
+  $ wine uninstaller
+
+Installing fresh copy under Debian.
+===================================
+
+https://www.winehq.org/download/debian
+
--- a/x.rst	Sun Apr 12 14:25:14 2015 +0300
+++ b/x.rst	Fri May 29 23:05:59 2015 +0300
@@ -437,3 +437,25 @@
 
   $ sudo dpkg-reconfigure x11-common
 
+Running X server without display.
+=================================
+
+Run ``Xvfb`` and make screenshort of desktop::
+
+  $ apt-get install xvfb
+  $ Xvfb :1 -screen 0 1280x1024x24 &
+  $ xclock -display :1 &
+  $ import -display :1 -window root image.png
+  $ kill %1 %2
+
+In order to run ``Xvfb`` permanently add entry to ``/etc/inittab``::
+
+  xvfb:2:respawn:/usr/bin/Xvfb :1 -ac -screen 0 1280x1024x24
+
+Running X server in nested windows.
+===================================
+::
+
+  $ sudo apt-get install xnest
+  $ startx xterm -- `command -v Xnest` :1 -geometry 800x600
+