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


Tuesday, December 18, 2018

How to quickly checkout github pull request

Two ways:

1.
$ git fetch origin pull/117/head:local-branch-name
$ git checkout local-branch-name

Or you can put in  ~/.profile following function:

checkoutPull() {
  #Usage: checkoutPull pr-number pr-branch
  #   or  checkoutPull pr-number user:pr-branch
  BRACH=$(echo $2 | sed -e "s/^.*://")
  if git branch | grep $BRACH; then
    echo "Branch $BRACH already exists and should be removed"
    read -p "Are you sure (y/n)? " -n 1 -r
    echo    # (optional) move to a new line
    if [[ $REPLY =~ ^[Yy]$ ]]
    then
      git branch -D $BRACH
    fi
  fi
  echo "git fetch upstream pull/$1/head:$BRACH"
  git fetch upstream pull/$1/head:$BRACH
  echo "git checkout $BRACH"
  git checkout $BRACH
}

And use it as:
$ checkoutPull 3058 my-coworker-username:issue-51502

2.
One more approach is or create function that consume easy to copy value from Github page. All PRs pages show this value as text "my-coworker-fork:his-branch".
Add to ~/.profile
checkoutForked() {
  #usage: checkoutForked another-fork:branch-in-fork
  FORK=$(echo $1 | cut -d ':' -f 1)
  BRANCH=$(echo $1 | cut -d ':' -f 2)
  REPO=$(grep -A 1 "\"origin\"" .git/config | grep github | sed -E "s/.*\///");
  if git remote | grep $FORK; then
    echo "Fork already exists"
  else
    echo "git remote add $FORK git@github.com:$FORK/$REPO;"
    git remote add $FORK git@github.com:$FORK/$REPO;
  fi
  echo "git fetch $FORK"
  git fetch $FORK
  if git branch | grep $FORK/$BRANCH; then
    echo "Branch $FORK/$BRANCH already exists"
  else
    echo "git checkout $FORK/$BRANCH"
    git checkout $FORK/$BRANCH
    echo "git checkout -b $FORK/$BRANCH"
    git checkout -b $FORK/$BRANCH
  fi
}
execute:
$ checkoutForked my-coworker-fork:his-branch

NOTE:
to push to forked repo remote you will need bind your branch and his branch:
git push my-coworker-fork my-coworker-fork/his-branch:his-branch -f

Tuesday, May 1, 2018

How to find and install missed man page or section in linux


Two options:
1) web
2) in server repositories

1) In web - just google it
https://www.google.com/search?q=man+7+signal
Will result in smth like http://man7.org/linux/man-pages/man7/signal.7.html

2) In server
$ man kill
# no signals details , most likely in "SEE ALSO .... signals(7)"
$ man 7 signal
No manual entry for signal in section 7
$ yum provides */signal.7.gz
...
#man-pages-3.53-5.el7.noarch : Man (manual) pages from the Linux Documentation Project
#Repo : rhel-7-server-rpms-master
#Matched from:
#Filename : /usr/share/man/man7/signal.7.gz
..
$ sudo yum install man-pages
$ man 7 signal

Tuesday, January 10, 2017

How to get name of laptop from windows command line


In Windows CMD:
wmic csproduct get vendor,name,identifyingnumber

Result is smth like:
IdentifyingNumber  Name            Vendor
JG1Z111            Latitude E6420  Dell Inc.

Tuesday, January 3, 2017

Process maven's pom xml file with xmlstarlet

General command  to get version of certain plugin dependency from pom file:

xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 -t -m "/pom:project/pom:build/pom:pluginManagement/pom:plugins/pom:plugin[pom:artifactId='maven-checkstyle-plugin']/pom:dependencies/pom:dependency[pom:artifactId='checkstyle']/pom:version" -v . pom.xml

Examples for editing and selection are at:
https://github.com/sevntu-checkstyle/sevntu.checkstyle/blob/master/pom-version-bump.sh

https://github.com/checkstyle/checkstyle/wiki/How-to-generate-Checkstyle-report-for-Google-Guava-project

Few XPATH conditions for query:
http://stackoverflow.com/questions/28370054/find-a-specific-groupid-from-a-maven-pom-xml-using-xmstarlet


Useful command to print all tags from xml file to help construct XPATH:
xmlstarlet el -v pom.xml