Gradle “Could not resolve all dependencies for configuration ‘:classpath’.”

Running a gradle project, you may encounter the error below. In my case it occurs after the gradle project crashed, requiring a restart.

Error message:

>Could not resolve all dependencies for configuration ':classpath'.
 >Could not load module metadata from /home/username/.gradle/caches/modules-2/metadata-2.97/descriptors/io.netty/netty-common/4.1.23.Final/671a8ecc284f9e9f4d35b614eb5de66e/descriptor.bin

Solution:

You need to delete the cache

cd /home/username/.gradle
rm -r caches

Check if tensorflow is using the GPU

If you run tensorflow in a docker console you can run the following code in your terminal:

docker exec b61a27999cb8 python3 -c "import tensorflow as tf; tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True))"

If you run a jupyter notebook you add the following line:

import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))

Data persistence with Docker and tensorflow.

https://docs.docker.com/storage/

https://docs.docker.com/storage/volumes/

https://stackoverflow.com/questions/57341455/how-to-persist-my-notebooks-and-data-in-my-docker-image-container

docker run -it -p 8888:8888 -v /home/personal/Documents/tensorflowData:/tf/notebooks tensorflow/tensorflow:latest-gpu-jupyter

Change SOURCE_FOLDER and DEST_FOLDER accordingly (use absolute paths!).

Now if you navigate to localhost:8888 and create a notebook on DEST_FOLDER, it also should be available on SOURCE_FOLDER.

For tensorflow 2, the destination folder is /tf. You can create a folder of your choice, say: notebook, where you will save your file in your jupyter notebook. Those files will be available in the SOURCE_FOLDER you have set.

The changes in tensorflow-tutorials won’t be kept even if you choose it as your destination folder. You have to use another folder as detailed above.

Jmeter: first line of a csv not read in a loop

One obvious reason for this to happen is that you set the “ignore first line” parameter to true.

The most likely case is that you used the csv in another request before your loop. This previous request is taken into account and the first line is considered already done when the loop starts.

If you call the csv three times in three separate requests before using it in a loop, the loop will starts at the fourth line of the csv (disregarding the column name line), even though only the first line was read in the first attempt.

Git: Revert commit and see what was change in a commit

Revert is usually a safe operation as it create a new commit.

git revert <SHA>

Before you revert a commit, you might want to check what was change in the commit as you might want to keep changes that were lumped in the commit:

git show SHA

If you made a commit in the wrong branch:

Go to proper branch and run: 

git cherry-pick <HASH> 

go to old branch, run: 

git revert <HASH>

In case of error see: https://blog.seobytes.eu/development/git-returns-is-a-merge-but-no-m-option-was-given/

Create remote repository from local (bitbucket/github)

Command to use:

Set up bitbucket ssh access.

Open a terminal in local directory and run:

git init
git checkout -b feature-branch

Create repository in Bitbucket and get the ssh url by clicking on the clone button.

In yout terminal run:

git remote add origin git@bitbucket.org:nicolashoquet/arcade.git

In case “origin” already exists, you can rename origin by running this command:

git remote rename origin https-origin

or use another name for origin (e.g. ssh-origin).

Set git ssh access for github or bitbucket

https://docs.github.com/en/github/getting-started-with-github/setting-your-username-in-git

Open a terminal

cd in the folder were you want to clone the repo:

$ cd directory/you/clone
$ git init
$ git config user.name “Your-Username” #can be different from your github username
$ git config user.email “your.email@example.com
$ ssh-keygen -t rsa -C “your.email@example.com

Enter file in which to save the key (/home/username/.ssh/id_rsa): /home/username.ssh/id_rsa

Copy the content of the id_rsa.pub in your Github settings in your profile.

Set Github local authentication to be able to clone and push:

http://kbroman.org/github_tutorial/pages/first_time.html

git stash

Save your current work on branch and return to a clean branch.

The following is copied from: https://git-scm.com/docs/git-stash

git-stash – Stash the changes in a dirty working directory away

SYNOPSIS

git stash list [<log-options>]
git stash show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]
git stash drop [-q|--quiet] [<stash>]
git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
git stash branch <branchname> [<stash>]
git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
	     [-u|--include-untracked] [-a|--all] [-m|--message <message>]
	     [--pathspec-from-file=<file> [--pathspec-file-nul]]
	     [--] [<pathspec>…​]]
git stash clear
git stash create [<message>]
git stash store [-m|--message <message>] [-q|--quiet] <commit>

DESCRIPTION

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.

The modifications stashed away by this command can be listed with git stash list, inspected with git stash show, and restored (potentially on top of a different commit) with git stash apply. Calling git stash without any arguments is equivalent to git stash push. A stash is by default listed as “WIP on branchname …​”, but you can give a more descriptive message on the command line when you create one.

The latest stash you created is stored in refs/stash; older stashes are found in the reflog of this reference and can be named using the usual reflog syntax (e.g. stash@{0} is the most recently created stash, stash@{1} is the one before it, stash@{2.hours.ago} is also possible). Stashes may also be referenced by specifying just the stash index (e.g. the integer n is equivalent to stash@{n}).