How to setup powerline-go in vscode running in WSL2 (Ubuntu) - visual-studio-code

These are the contents of my ~/.vscode-server/server-env-setup
function _update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
... gives this error
[2019-12-10 13:49:39.763] /mnt/c/Users/cber/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.3/scripts/wslServer.sh: 1: /home/cber/.vscode-server/server-env-setup: Syntax error: "(" unexpected
[2019-12-10 13:49:39.805] VS Code Server for WSL closed unexpectedly.
UPDATE
This version (stripped of windows line endings) does not produce any errors, but unfortunately also does not display anything in the prompt in a git repo:
GOPATH=$HOME/go
_update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi

Related

use a `task` to export a workspace-specific environment variable: $PATH?

I have several workspaces that have unique environments.
When I load a workspace, I would like to update the linux $PATH accordingly, however, I tried the following:
### workspace.code-workspace
{
"folders": [
{
"path": "."
}
],
"settings": {},
"tasks": [
{
"command": "export $PATH=${workspaceFolder}/bin:$PATH"
}
]
}
Which fails according to:
me#pc:~/Containers/cuda_devcon/project$ ls -alvh ./bin/julia
lrwxrwxrwx 1 me me 21 Jan 29 17:38 ./bin/julia -> julia-1.6.7/bin/julia
me#pc:~/Containers/cuda_devcon/project$ which julia
me#pc:~/Containers/cuda_devcon/project$ julia
Command 'julia' not found, but can be installed with:
sudo snap install julia # version 1.8.5, or
sudo apt install julia # version 1.4.1+dfsg-1
See 'snap info julia' for additional versions.

CircleCI run failed on delete k8s resource

I have CircleCI setup and running fine normally, it will helps with creating deployment for me. Today I have suddenly had an issue with the step in creating the deployment due to an error related to kubernetes.
I have the config.yml followed the doc from https://circleci.com/developer/orbs/orb/circleci/kubernetes
Here is my version of setup in the config file:
version: 2.1
orbs:
kube-orb: circleci/kubernetes#1.3.0
commands:
docker-check:
steps:
- docker/check:
docker-username: MY_USERNAME
docker-password: MY_PASS
registry: $DOCKER_REGISTRY
jobs:
create-deployment:
executor: aws-eks/python3
parameters:
cluster-name:
description: Name of the EKS cluster
type: string
steps:
- checkout
# It failed on this step
- kube-orb/delete-resource:
now: true
resource-names: my-frontend-deployment
resource-types: deployments
wait: true
Below is a copy of the error log
#!/bin/bash -eo pipefail
#!/bin/bash
RESOURCE_FILE_PATH=$(eval echo "$PARAM_RESOURCE_FILE_PATH")
RESOURCE_TYPES=$(eval echo "$PARAM_RESOURCE_TYPES")
RESOURCE_NAMES=$(eval echo "$PARAM_RESOURCE_NAMES")
LABEL_SELECTOR=$(eval echo "$PARAM_LABEL_SELECTOR")
ALL=$(eval echo "$PARAM_ALL")
CASCADE=$(eval echo "$PARAM_CASCADE")
FORCE=$(eval echo "$PARAM_FORCE")
GRACE_PERIOD=$(eval echo "$PARAM_GRACE_PERIOD")
IGNORE_NOT_FOUND=$(eval echo "$PARAM_IGNORE_NOT_FOUND")
NOW=$(eval echo "$PARAM_NOW")
WAIT=$(eval echo "$PARAM_WAIT")
NAMESPACE=$(eval echo "$PARAM_NAMESPACE")
DRY_RUN=$(eval echo "$PARAM_DRY_RUN")
KUSTOMIZE=$(eval echo "$PARAM_KUSTOMIZE")
if [ -n "${RESOURCE_FILE_PATH}" ]; then
if [ "${KUSTOMIZE}" == "1" ]; then
set -- "$#" -k
else
set -- "$#" -f
fi
set -- "$#" "${RESOURCE_FILE_PATH}"
elif [ -n "${RESOURCE_TYPES}" ]; then
set -- "$#" "${RESOURCE_TYPES}"
if [ -n "${RESOURCE_NAMES}" ]; then
set -- "$#" "${RESOURCE_NAMES}"
elif [ -n "${LABEL_SELECTOR}" ]; then
set -- "$#" -l
set -- "$#" "${LABEL_SELECTOR}"
fi
fi
if [ "${ALL}" == "true" ]; then
set -- "$#" --all=true
fi
if [ "${FORCE}" == "true" ]; then
set -- "$#" --force=true
fi
if [ "${GRACE_PERIOD}" != "-1" ]; then
set -- "$#" --grace-period="${GRACE_PERIOD}"
fi
if [ "${IGNORE_NOT_FOUND}" == "true" ]; then
set -- "$#" --ignore-not-found=true
fi
if [ "${NOW}" == "true" ]; then
set -- "$#" --now=true
fi
if [ -n "${NAMESPACE}" ]; then
set -- "$#" --namespace="${NAMESPACE}"
fi
if [ -n "${DRY_RUN}" ]; then
set -- "$#" --dry-run="${DRY_RUN}"
fi
set -- "$#" --wait="${WAIT}"
set -- "$#" --cascade="${CASCADE}"
if [ "$SHOW_EKSCTL_COMMAND" == "1" ]; then
set -x
fi
kubectl delete "$#"
if [ "$SHOW_EKSCTL_COMMAND" == "1" ]; then
set +x
fi
error: exec plugin: invalid apiVersion "client.authentication.k8s.io/v1alpha1"
Exited with code exit status 1
CircleCI received exit code 1
Does anyone have idea what is wrong with it? Im not sure whether the issue is happening on Circle CI side or Kubernetes side.
I was facing the exact issue since yesterday morning (16 hours ago). Then taking #Gavy's advice, I simply added this in my config.yml:
steps:
- checkout
# !!! HERE !!!
- kubernetes/install-kubectl:
kubectl-version: v1.23.5
- run:
And now it works. Hope it helps.

Ncurses.h ( (.text+0xd): undefined reference to `initscr') visual code Ubuntu

I need to know why VS code is not compiling ncurses.h. but it is possible to compile in the terminal ubuntu. this message is appearing on the VS code. (.text+0xd): undefined reference to `initscr'
the code runner extension configuration add -lncurses before -o
"code-runner.executorMap": {
"c": "cd $dir && gcc $fileName -lncurses -o $fileNameWithoutExt && $dir$fileNameWithoutExt "
}
I solved this problem adding "-lncurses" in the "args" (tasks.json)
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-lncurses" <--------- add the library ("-lncurses" ) here
],

reexport - SyntaxError: Unexpected token 'export'

There is such a file. That imports from API and exports at once.
export { extractValue, parse, parseCommand } from './parser'
export { Manager, EVENTS } from './manager'
export { runCLI, runCommand, bootstrapCommandManager } from './cli'
I receive an error:
export { extractValue, parse, parseCommand } from './parser'
^^^^^^
SyntaxError: Unexpected token 'export'
There is my babel.config.js
module.exports = {
presets: [['#babel/preset-env', {targets: {node: 'current'}}]],
plugins: [
['#babel/plugin-transform-modules-commonjs'],
['#babel/plugin-proposal-decorators', {'legacy': true}],
['#babel/plugin-proposal-class-properties'],
['#babel/plugin-proposal-export-default-from']
]
};
#babel/plugin-proposal-export-default-from does not help.
It did not compile files from node_modules directory. An ignore rule had to be set.
It works
Variant A babel-node
npx babel-node --ignore="/node_modules\/(?\!console-command-manager)/" --config-file ./babel.config.js ./src/index.js
I fault to move --ignore argument into ./babel.config.js
Variant B
Node executtion with -r runner.js
Execution
node -r ./runner.js src/index.js
Runner
const config = require('./babel.config.js')
console.log(config)
require("#babel/register")({
extensions: ['.js'],
ignore: [
/node_modules[\\/](?!console-command-manager)/
],
...config
});

Install4j installer package does not work on Odroid mini computer

The error message is the following:
Syntax error: "elif" unexpected (expecting "then")
We changed the "elif" to "else if", to check if it is working this way, but at next try we got another error message:
Syntax error: word unexpected (expecting "do")
The installer works well on a Linux based PC.
It does not work only on Odroid mini pc.
The Odroid linux features are the following:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
Linux odroid 3.10.104-184 #1 SMP PREEMPT Mon Feb 20 06:38:17 UTC 2017 armv7l armv7l armv7l GNU/Linux
The installer package (it is only one .sh file) starts with the folliwing lines:
#!/bin/sh
# Uncomment the following line to override the JVM search sequence
# INSTALL4J_JAVA_HOME_OVERRIDE=
# Uncomment the following line to add additional VM parameters
# INSTALL4J_ADD_VM_PARAMS=
INSTALL4J_JAVA_PREFIX=""
GREP_OPTIONS=""
read_db_entry() {
if [ -n "$INSTALL4J_NO_DB" ]; then
return 1
fi
if [ ! -f "$db_file" ]; then
return 1
fi
if [ ! -x "$java_exc" ]; then
return 1
fi
found=1
exec 7< $db_file
while read r_type r_dir r_ver_major r_ver_minor r_ver_micro r_ver_patch r_ver_vendor<&7; do
if [ "$r_type" = "JRE_VERSION" ]; then
if [ "$r_dir" = "$test_dir" ]; then
ver_major=$r_ver_major
ver_minor=$r_ver_minor
ver_micro=$r_ver_micro
ver_patch=$r_ver_patch
fi
elif [ "$r_type" = "JRE_INFO" ]; then
if [ "$r_dir" = "$test_dir" ]; then
is_openjdk=$r_ver_major
if [ "W$r_ver_minor" = "W$modification_date" ]; then
found=0
break
fi
fi
fi
done
exec 7<&-
return $found
}
create_db_entry() {
tested_jvm=true
version_output=`"$bin_dir/java" $1 -version 2>&1`
is_gcj=`expr "$version_output" : '.*gcj'`
is_openjdk=`expr "$version_output" : '.*OpenJDK'`
if [ "$is_gcj" = "0" ]; then
java_version=`expr "$version_output" : '.*"\(.*\)".*'`
ver_major=`expr "$java_version" : '\([0-9][0-9]*\).*'`
ver_minor=`expr "$java_version" : '[0-9][0-9]*\.\([0-9][0-9]*\).*'`
ver_micro=`expr "$java_version" : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`
ver_patch=`expr "$java_version" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[\._]\([0-9][0-9]*\).*'`
fi
if [ "$ver_patch" = "" ]; then
ver_patch=0
fi
if [ -n "$INSTALL4J_NO_DB" ]; then
return
...