merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 20 Oct 2017 18:03:16 +0300
changeset 2200 75f1bafcfe41
parent 2199 47cadb10f1df (diff)
parent 2198 81ae8abd153a (current diff)
child 2201 af2d2e117b4e
merged
--- a/.dir-locals.el	Sat Oct 07 23:16:33 2017 +0300
+++ b/.dir-locals.el	Fri Oct 20 18:03:16 2017 +0300
@@ -1,5 +1,5 @@
 (
  (nil . (
-         (fill-column . 80)
+         (fill-column . 100)
          ) )
  )
--- a/Makefile	Sat Oct 07 23:16:33 2017 +0300
+++ b/Makefile	Fri Oct 20 18:03:16 2017 +0300
@@ -30,7 +30,7 @@
 
 RST2HTML := rst2html
 ifeq '$(host_os)' 'cygwin'
-  RST2HTML := rst2html.py
+  RST2HTML := LC_ALL=en_US.utf8 rst2html.py
 endif
 
 RST_WARNING_FLAGS := --halt warning
--- a/android.rst	Sat Oct 07 23:16:33 2017 +0300
+++ b/android.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -6,15 +6,38 @@
 .. contents::
    :local:
 
-Official docs.
-==============
+Official docs
+=============
+
+http://developer.android.com/sdk/index.html
+  Get the Android SDK
+http://developer.android.com/guide/index.html
+  Introduction to Android
+https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
+  init.rd file syntax.
+
+Getting tools
+=============
 
-  http://developer.android.com/sdk/index.html
-    Get the Android SDK
-  http://developer.android.com/guide/index.html
-    Introduction to Android
-  https://android.googlesource.com/platform/system/core/+/master/init/readme.txt
-    init.rd file syntax.
+https://developer.android.com/studio/releases/platform-tools.html
+  SDK Platform Tools (includes adb and fastboot) download and rellease
+  changelog.
+https://developer.android.com/studio/index.html
+  Android Studio (official IDE for Android) and sdk-tools (includes ``sdkmanager``).
+
+Android emulator
+================
+
+Intel provided images and hypervisor to run x86 Android port with acceleration:
+
+https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm
+  Intel® Hardware Accelerated Execution Manager (Intel® HAXM). It is available from SDK manager
+  also.
+
+It starts service. To manage service use::
+
+  sc stop intelhaxm
+  sc start intelhaxm
 
 Android stats
 =============
@@ -31,19 +54,19 @@
 Android API levels.
 ===================
 
-  http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
-    "Platform Version / API Level" table.
+http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
+  "Platform Version / API Level" table.
 
 Package repositories.
 =====================
 
-  https://play.google.com/
-    Google package repository.
-  https://f-droid.org/
-    Free software repository.
-  http://www.appbrain.com/
-    AppBrain, alternative catalog to Google Play. Packages is backed via lisnk
-    to Google Play.
+https://play.google.com/
+  Google package repository.
+https://f-droid.org/
+  Free software repository.
+http://www.appbrain.com/
+  AppBrain, alternative catalog to Google Play. Packages is backed via lisnk
+  to Google Play.
 
 Link to package description page::
 
@@ -51,21 +74,21 @@
 
 See also:
 
-  http://android.stackexchange.com/questions/216/what-are-the-alternative-android-app-markets/
-    What are the alternative Android app markets?
+http://android.stackexchange.com/questions/216/what-are-the-alternative-android-app-markets/
+  What are the alternative Android app markets?
 
 Mods.
 =====
 
-  http://xda-university.com/
-    How to mod.
-  http://www.cyanogenmod.org/about
-    CyanogenMod
-  https://www.clockworkmod.com/
-    ClockworkMod
+http://xda-university.com/
+  How to mod.
+http://www.cyanogenmod.org/about
+  CyanogenMod
+https://www.clockworkmod.com/
+  ClockworkMod
 
-Connect to Android via USB by adb.
-==================================
+Connect to Android via USB by adb in Linux
+==========================================
 
 Add ``udev`` rule for fix permission issues::
 
@@ -82,8 +105,85 @@
 
 See:
 
-  http://developer.android.com/tools/device.html
-    Setting up a Device for Development.
+http://developer.android.com/tools/device.html
+  Setting up a Device for Development.
+
+Connect to Android via USB by adb in Windows
+============================================
+
+Get latest official Google drivers from:
+
+https://developer.android.com/studio/run/win-usb.html
+  Get the Google USB Driver.
+
+If your device isn't in official list you can try to find driver in `Windows
+update catalog at http://www.catalog.update.microsoft.com`__.
+
+__ http://www.catalog.update.microsoft.com
+
+Use search by vendor or device name, or string ``adb``. Alternatively use
+`hardware id`_.
+
+BTW older version of official Google drivers are also in `Windows update
+catalog`__.
+
+__ http://www.catalog.update.microsoft.com/Search.aspx?q=google+adb
+
+Most probably you will fail to find drivers for numerous Chinese/noname Android
+devices. We can reuse official Google drivers. To do that:
+
+.. _hardware id:
+
+* Find your USB's hardware VID and PID. Locate your device in *Device Manager*,
+  open Properties => Details => Hardware Ids and copy (by ``Ctrl+C``) string
+  like::
+
+    USB\VID_2A45&PID_201D&MI_01
+
+* Extract official Google's ADB driver package::
+
+    unzip latest_usb_driver_windows.zip
+
+* Locate and modify driver's ``.inf`` file (in my case it was
+  ``android_winusb.inf``) by adding lines, like::
+
+    ; Meizu
+    %SingleAdbInterface%        = USB_Install, USB\VID_2A45&PID_201D
+    %CompositeAdbInterface%     = USB_Install, USB\VID_2A45&PID_201D&MI_01
+
+  to all sections that has similar lines setting your own `hardware id`_
+  that we've extracted.
+
+* Temporary disable driver signing enforcement (run from Administrator, ``Win``,
+  type ``cmd``, ``Ctrl+Shift+Enter``)::
+
+    cmd# bcdedit /set testsigning off
+
+  and reboot. You'll see ``Test mode`` sign in right lower corner of desktop.
+
+* Locate your decive, then follow *Properties => Driver => Update => Browse my computer =>
+  Let me pick => Hard Disk...*. Select *Android Composite ADB interface* driver
+  and ignore security warning about broken file signature.
+
+* Enable signing checks back::
+
+    cmd# bcdedit /set testsigning on
+
+  and reboot. Hurrah!
+
+.. note::
+
+   As you see Google's adb driver works fine with any Android phone. It's
+   Microsoft policy to forbid class drivers so each vendor is required to
+   provide same driver with different hardware ID and to pay money for Windows
+   Logo® program and signing process.
+
+.. tip::
+
+   ``bcdedit`` can be run with alternative options::
+
+     cmd# bcdedit.exe /set nointegritychecks on
+     cmd# bcdedit.exe /set nointegritychecks off
 
 Recovery.
 =========
@@ -94,8 +194,8 @@
 
 See:
 
-  http://teamw.in/project/twrp2
-    Custom recovery built.
+http://teamw.in/project/twrp2
+  Custom recovery built.
 
 ADB tips.
 =========
@@ -262,7 +362,9 @@
 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.
+http://droid-at-screen.org/
+  Easily show the screen of an Android device on a computer/laptop (PC, Mac,
+  Linux, ...) and then project the desktop using a LCD-projector.
+http://droid-at-screen.ribomation.com/
+  Old DNS name.
+
--- a/cygwin.rst	Sat Oct 07 23:16:33 2017 +0300
+++ b/cygwin.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -187,18 +187,24 @@
 http://cygwin-xp.portfolis.net/
   Another old mirror.
 
-Cygwin ports.
-=============
+Cygwin ports
+============
 
 This project provides Cygwin binary and source packages for a large variety of programs and
 libraries, including the GNOME  and KDE desktop environments
 
-  http://cygwin-ports.sourceforge.net/
-                newest home of the Cygwin Ports project
-  http://sourceware.org/cygwinports/
-                home page
-  http://cygwinports.blogspot.com
-                official blog??
+http://cygwin-ports.sourceforge.net/
+  Newest home of the Cygwin Ports project.
+http://sourceware.org/cygwinports/
+  Home page.
+http://cygwinports.blogspot.com
+  Official blog.
+https://github.com/cygwinports
+  cygport scripts to compile cygwinports
+https://github.com/cygwinports/cygport
+  Source packaging tool for Cygwin
+https://cygwinports.github.io/cygport
+  Cygport Reference Manual.
 
 Which Cygwin version you run?
 =============================
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/elasticsearch.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -0,0 +1,52 @@
+
+===============
+ elasticsearch
+===============
+
+REST syntax conventions
+=======================
+
+To get data in table form use ``/_cat`` endpoint::
+
+  GET /_cat/nodes
+
+To pretty print output append query::
+
+  ?pretty=1
+
+Get base information
+====================
+
+Cluster health::
+
+  GET /_cat/health?v
+
+List of nodes in cluster::
+
+  GET /_cat/nodes?v
+  GET /_cat/master?v
+
+List of indexes::
+
+  GET /_cat/indices
+  GET /_cat/indices?v
+  GET /_cat/indices?v&s=index
+
+List of mappings across all indexes::
+
+  GET /_mapping
+  GET /_all/_mapping
+
+https://www.elastic.co/guide/en/elasticsearch/reference/current/_cluster_health.html
+  Cluster Health.
+https://www.elastic.co/guide/en/elasticsearch/reference/current/_list_all_indices.html
+  List All Indices.
+https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html
+  cat APIs.
+
+Managing indexes
+================
+
+https://www.elastic.co/guide/en/elasticsearch/reference/current/_delete_an_index.html
+  Delete an Index.
+
--- a/git.rst	Sat Oct 07 23:16:33 2017 +0300
+++ b/git.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -146,12 +146,22 @@
 List all remote branches (from all remotes)::
 
   $ git ls-remote
+  $ git ls-remote origin
+
+List registered remotes::
+
+  $ git remote show
 
 List remote branches from ``$REMOTE`` remote::
 
   $ git ls-remote --heads $REMOTE
   $ git remote show $REMOTE
 
+Special case of above is ``origin`` remote, which is default remote::
+
+  $ git remote show origin
+  $ git ls-remote --heads origin
+
 .. note::
 
    Look to ``[remote "..."]`` in ``~/.git/config`` to find out names of possible
@@ -159,7 +169,8 @@
 
      $ git remote show
 
-Getting branches pointers from default (``origin``) remote::
+Getting branches pointers from default (``origin``) remote (without merging
+tracking branch)::
 
   $ git fetch
 
@@ -167,6 +178,20 @@
 
   $ git fetch $REMOTE
 
+To get updated with default remote changes::
+
+  $ git pull
+
+or specify concrete remote::
+
+  $ git pull $REMOTE
+  $ git pull origin
+
+To locally remove pointers to deleted remotely branches::
+
+  $ git remote update --prune
+  $ git remote update --prune origin
+
 .. note::
 
    Only curtain branches fetched by default::
@@ -410,9 +435,23 @@
 To search in all history::
 
   $ git log -S$PATT
+  $ git log --pickaxe-regex=$PATT
   $ git log -G$PATT
   $ git grep -i PATT $(git rev-list --all) -- '*.[ch]'
 
+.. note::
+
+   ``-S`` search occurences in diff chunks, while ``-G`` detects changes in match count.
+
+https://git-scm.com/book/en/v2/Git-Tools-Searching
+  Git Tools - Searching.
+https://stackoverflow.com/questions/1337320/how-to-grep-git-commit-diffs-or-contents-for-a-certain-word
+  How to grep Git commit diffs or contents for a certain word?
+https://stackoverflow.com/questions/4468361/search-all-of-git-history-for-a-string
+  Search all of Git history for a string?
+https://stackoverflow.com/questions/2928584/how-to-grep-search-committed-code-in-the-git-history
+  How to grep (search) committed code in the git history?
+
 Find most recent tag for revision.
 ==================================
 ::
--- a/oracle.rst	Sat Oct 07 23:16:33 2017 +0300
+++ b/oracle.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -27,7 +27,7 @@
                 Oracle Reports is a tool for developing reports against data
                 stored in an Oracle database.
 
-Useful PL/SQL stub.
+Useful PL/SQL stubs
 ===================
 ::
 
@@ -57,6 +57,34 @@
   exec DBMS_OUTPUT.PUT_LINE('Silence');
   exec DBMS_OUTPUT.ENABLE();
 
+Call procedure::
+
+  create or replace procedure MY_PROC as
+  begin
+    null;
+  end;
+  /
+
+  begin
+    MY_PROC;
+  end;
+  /
+
+Call function::
+
+  create or replace function MY_FUN return number as
+  begin
+    return 42;
+  end;
+  /
+
+  declare
+    x NUMBER;
+  begin
+    ret := MY_FUN();
+  end;
+  /
+
 Database info.
 ==============
 
@@ -81,10 +109,30 @@
 
   select sum(BYTES) from USER_EXTENTS;
 
-Tables indexes::
+Table indexes restricted to user::
 
   select * from USER_INDEXES order by TABLE_NAME;
 
+Table indexes available to user::
+
+  select * from ALL_INDEXES order by TABLE_NAME;
+
+All table indexes::
+
+  select * from DBA_INDEXES order by TABLE_NAME;
+
+View index columns::
+
+  select * from DBA_IND_COLUMNS;
+  select * from ALL_IND_COLUMNS;
+  select * from USER_IND_COLUMNS;
+
+Vie index expressions::
+
+  select * from DBA_IND_EXPRESSIONS;
+  select * from ALL_IND_EXPRESSIONS;
+  select * from USER_IND_EXPRESSIONS;
+
 List of index sizes::
 
   select index_name, table_name, sum(user_extents.bytes) as bytes from user_indexes
@@ -92,6 +140,13 @@
     group by index_name, table_name
     order by table_name;
 
+View index statistics::
+
+  select * from DBA_IND_STATISTICS;
+  select * from ALL_IND_STATISTICS;
+  select * from USER_IND_STATISTICS;
+  select * from INDEX_STATS;
+
 List of tables without primary keys::
 
   select OWNER || '.' || TABLE_NAME from ALL_TABLES
@@ -100,10 +155,28 @@
     ) and OWNER in ('USER1', 'USER2')
     order by OWNER, TABLE_NAME;
 
-List of currenct user constraints::
+List of current constraints limited to current user::
 
   select * from USER_CONSTRAINTS;
 
+List of constraints available to user::
+
+  select * from ALL_CONSTRAINTS;
+
+List of all constraints::
+
+  select * from DBA_CONSTRAINTS;
+
+.. note::
+   ``CONSTRAINT_TYPE``:
+
+   * ``C`` (check constraint on a table)
+   * ``P`` (primary key)
+   * ``U`` (unique key)
+   * ``R`` (referential integrity)
+   * ``V`` (with check option, on a view)
+   * ``O`` (with read only, on a view)
+
 List of tablespaces::
 
   select distinct TABLESPACE_NAME from USER_TABLES;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vagrant.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -0,0 +1,16 @@
+
+=========
+ Vagrant
+=========
+
+Changing Vagrant home directory
+===============================
+
+Set ``VAGRANT_HOME`` env var, like::
+
+  VAGRANT_HOME=d:\srv\vagrant
+
+Default is ``~/.vagrant.d`` for Linux and ``%USERPROFILE%\.vagrant.d`` for Windows.
+
+https://www.vagrantup.com/docs/other/environmental-variables.html
+
--- a/windows.rst	Sat Oct 07 23:16:33 2017 +0300
+++ b/windows.rst	Fri Oct 20 18:03:16 2017 +0300
@@ -478,7 +478,7 @@
 * ``/l`` - Performs the operation on a symbolic link versus its destination.
 * ``/q`` - Suppresses success messages.
 
-Permissions description::
+Permissions description:
 
 * ``f`` - full control
 * ``CI`` = Container Inherit - This flag indicates that subordinate containers will
@@ -588,10 +588,15 @@
 Well known users/groups:
 
 ``S-1-0-0``
-  Null SID. A group with no members. This is often used when a SID
+  Nobody. A group with no members. This is often used when a SID
   value is not known.
 ``S-1-1-0``
   World/Everyone. A group that includes all users.
+``S-1-2-0``
+  Local. A group that includes all users who have logged on locally.
+``S-1-2-1``
+  Console Logon. A group that includes users who are logged on to the physical
+  console.
 ``S-1-3-0``
   Creator Owner ID. A security identifier to be replaced by the
   security identifier of the user who created a new object. This