Friday, November 8, 2019

How to list all changed files between two branches that does not have common ancestor

If tree is like this:

Same tree you can see by(if you do not have gitk): git log --all --graph

to get a all files:
$ (git diff --name-status master...staging && \
    git diff --name-status $(git merge-base  master staging) fb-4) \
  | cut -f 2 | sort | uniq
2-2.txt
2.txt
3.txt
4.txt


Good picture that explain difference between "..." and ".." - https://stackoverflow.com/a/46345364

Tuesday, November 5, 2019

How to keep release branch commits in history but do not keep branch

Command: git merge --no-ff -s "ours" release-branch 
Removal of branch label from git tree: git branch -D release-branch

It will make "diamond" in git history BUT it will not merge any changes from release branch to master. Blue dots are former "release-branch"

Tuesday, October 22, 2019

move log file with timestamp prefix

mv server.log server.log.before.$(date '+%Y%m%d%H%M%S')

How to connect from docker container to host local service

Elasticsearch is running on localhost MacOS.
run image with curl and test connection to host local webservice.
Some interesting steps are at https://dev.to/bufferings/access-host-from-a-docker-container-4099 , it explains why networks are not wokrigin MacOS (it is not supported).

custom docker net creation - https://nickjanetakis.com/blog/docker-tip-35-connect-to-a-database-running-on-your-docker-host

$ docker container run --rm -it curlimages/curl sh
Unable to find image 'curlimages/curl:latest' locally
latest: Pulling from curlimages/curl
9d48c3bd43c5: Pull complete
9fbab065c978: Pull complete
Digest: sha256:4c7b687d607d7f5f397db1ca877a626fedc79c7a537a3f145482083bd68dc115
Status: Downloaded newer image for curlimages/curl:latest

/ $ curl 'localhost:9200/_cat/indices?v'
curl: (7) Failed to connect to localhost port 9200: Connection refused
#### This is expected as elastic search in NOT in docker container

# base on https://docs.docker.com/docker-for-mac/networking/
/ $ ping host.docker.internal
PING host.docker.internal (192.168.65.2): 56 data bytes
ping: permission denied (are you root?)

/ $ curl 'host.docker.internal:9200/_cat/indices?v'
health status index      uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   conv_v12 tIP0ha4USEG3Wr5cKJNzGw   5   1     837120            0      1.2gb          1.2gb
yellow open   conv_v11 0e-Y9pnlQHGyFTicGfQHbg   5   1    3917501           27      5.6gb          5.6gb
yellow open   geota    lSixJug2QDqtR8sjtXWdKg   5   1      69070            0      1.6gb          1.6gb
yellow open   conv_v10 9WX0fuMgRTCem0OgHn9fPw   5   1      67706            0    127.6mb        127.6mb

/ $ curl '192.168.65.2:9200/_cat/indices?v'
health status index      uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   conv_v12 tIP0ha4USEG3Wr5cKJNzGw   5   1     832120            0      1.2gb          1.2gb
yellow open   conv_v11 0e-Y9pnlQHGyFTicGfQHbg   5   1    3917501           27      5.6gb          5.6gb
yellow open   geota    lSixJug2QDqtR8sjtXWdKg   5   1      69070            0      1.6gb          1.6gb
yellow open   conv_v10 9WX0fuMgRTCem0OgHn9fPw   5   1      67706            0    127.6mb        127.6mb

Monday, September 23, 2019

WH-1000XM3 failing to pair with macOS (it is not even discoverable in bluetooth settings)

simple steps does not work https://helpguide.sony.net/mdr/wh1000xm3/v1/en/contents/TP0001867146.html

To start pairing Headphones , press power button for several seconds (about 7).

I found solution that helped me:
https://us.community.sony.com/s/question/0D50B00005kn3GA/unable-to-pair-wh1000xm3-with-mac-mojave-os-sony-support-docs-only-reference-earlier-versions-of-mac-operating-systems-am-i-out-of-luck?language=en_US#0054O000007uGjsQAE

Quote from forum:

====

Hello, I think I have the solution. this is for the latest version of Mojave. it's in this macworld article: https://www.macworld.co.uk/how-to/mac/fix-bluetooth-mac-3682642/ - this is the one that worked for me, but they have other options if it doesn't:

Using Finder
  1. Open Finder.
  2. Click Go.
  3. Click Go to Folder.
  4. Type in: /Library/Preferences
  5. Click Go.
  6. Find the com.apple.Bluetooth.plist file.
  7. Move the plist file to the Trash.
  8. Click Go > Go to Folder
  9. Type in: ~/Library/Preferences/ByHost
  10. Click Go.
  11. This time find com.apple.Bluetooth.???.plist file (this will be made up of some random letters) and move it to the Trash.
  12. Now restart your Mac - it will automatically generate new Bluetooth plist files the next time you turn Bluetooth off and on again.

After I did this it took a few minutes, at first all the bluetooth commands were just digits but after about 1 minute the headphones showed up and now they work. 

====

to initiate pairing I pressed power button for several seconds (about 7 seconds).

Tuesday, August 27, 2019

Firefox multi-line tabs

Enable loading of styles from disk - https://winaero.com/blog/enable-loading-userchrome-css-usercontent-css-firefox/ (Set at "about:config" page the option toolkit.legacyUserProfileCustomizations.stylesheets to True)

create or find userChrome.css - https://www.userchrome.org/how-create-userchrome-css.html or https://www.howtogeek.com/334716/how-to-customize-firefoxs-user-interface-with-userchrome.css/
1) Open "about:support" in Firefox
2) Click on "Profile Folder" button.
3) Steps inside folder
4) create "chrome" folder

put content of https://github.com/MrOtherGuy/firefox-csshacks/blob/master/chrome/multi-row_tabs.css to userChrome.css

In version FF 76.0.1, something was broken in again, download of latest multi-row_tabs.css helps to make work again.

in FF 81.0 something changed again and required to reload latest multi-row_tabs.css from github again

Tuesday, May 7, 2019

shell function to put changes in previous git commit

code for '~/.profile' file:

amendPrevCommit() {
  BRANCH=`git branch | grep \* | cut -d ' ' -f2`
  cd `git rev-parse --show-toplevel`
  git stash
  git branch -D $BRANCH-temp-for-stash
  git checkout -b $BRANCH-temp-for-stash
  git checkout -
  git reset HEAD~1 --hard
  git stash pop
  git add .
  git commit --amend --no-edit
  git cherry-pick $BRANCH-temp-for-stash
}

after update of ~/.profile
do not forget to do "source ~/.profile" in terminal window

Example of use:
$ amendPrevCommit