How to launch Git bash in ConEmu from SublimeText? - conemu

I tried to use Terminal Plugin for ST3, like that
{
"terminal": "D:/Mega/SOFT/ConEmu/ConEmu.exe",
"parameters": ["C:/Program Files (x86)/Git/bin/sh.exe"]
}
Sh.exe launches, but I can't pass "--login -i" parameters to it.
{
"terminal": "D:/Mega/SOFT/ConEmu/ConEmu.exe",
"parameters": ["C:/Program Files (x86)/Git/bin/sh.exe --login -i"] // not working
}
/cmd {Git bash} and other switches also don't work here

This works for me:
{
"terminal": "D:/Mega/SOFT/ConEmu/ConEmu.exe",
"parameters": ["/cmd", "%ProgramFiles%/Git/bin/sh.exe", "--login", "-i"]
}

That's work for me:
{
"terminal": "C:\\Program Files\\ConEmu\\ConEmu64.exe",
"parameters": ["-run", "bash"]
}

Related

Referencing lambda environment variable in Cloudformation template throws "circular dependency" error

I have an application that uses an AWS lambda function triggered by an implicit http api event, which gets post/get requests from a React app:
"mylambda": {
"Type": "AWS::Serverless::Function",
"Properties": {
"InlineCode": "exports.handler = async (event, context)",
"MemorySize": {
"Ref": "LambdaMemorySize"
},
"Handler": "backend/index.handler",
"Role": {
"Fn::GetAtt": ["myrole", "Arn"]
},
"Timeout": {
"Ref": "LambdaTimeout"
},
"Runtime": "nodejs12.x",
"FunctionName": "myFunction",
"Events": {
"httpapi": {
"Type": "HttpApi",
"Properties": {
"Path": "/myApi",
"Method": "ANY"
}
}
}
}
}
},
I want to add an environment variable inside the Lambda function for the http-api endpoint so that I can use it in lambda's handler:
"Environment": {
"Variables": {
"apiEndpoint": {
"Fn::Join": [
"",
[
"https://",
{ "Ref": "ServerlessHttpApi" },
".execute-api.",
{ "Ref": "AWS::Region" },
".amazonaws.com"
]
]
}
}
}
The problem is that this throws a circular dependency error and I can see why (lambda relies on api-gateway and api-gateway relies on lambda).
I tried to create the http-api separately but then there seemed to be no way of referencing the api inside lambda as a trigger i.e. when I deploy, the template creates a lambda function that doesn't have my api as a trigger, while my api was created separately.
I know the whole env variables thing can be done easily from the console but my deployment model assumes everything should be done in the CF template.
An answer here suggested:
"You could easily extract the information you need from that event instead of having it as an environment variable, but this depends on your exact use case."
I could do this in the body of the lambda's handler in index.js:
module.exports.apiendpoint = event.requestContext.domainName;
But this will collide with the fact that 1) I can't use index.js variables that are outside React's src folder and 2) I'm not sure how the app will run for the first time since it'll require the get/post request first to trigger lambda.
I think my main problem is simple: I don't know how I can reference the http api endpoint in Lambda's environment variables without throwing an error. Is it that the whole structure of my app is wrong?

Tailwind CSS IntelliSense does not provide suggestions in a ReactJS project?

I created a ReactJS project using create-react-project command. I npm installed tailwindcss and created a tailwind.config.js file.
Now to make my life easier I also installed an extension called Tailwind CSS IntelliSense and reloaded VSCode. The extension still does not give suggestions in my JavaScript files.
At first, i thought it is maybe because it works only with html extensions or that the reactjs files uses className for adding CSS classes as class keyword is reserved. So, I tried to edit index.html file but not suggestions in HTML files as well.
Please tell what else can I tryout?
Here's how to get Tailwind Intellisense to work with React files
Go to Tailwind CSS settings and add Javascript support "tailwindCSS.includeLanguages": { "plaintext": "javascript" }
Reload vscode
If this doesn't fix things, try using ctrl + space before adding a class name.
View image of Tailwind settings
Edit your settings.json as below:
{
// other settings
"tailwindCSS.includeLanguages": {
"javascript": "javascript",
"html": "HTML"
},
"editor.quickSuggestions": {
"strings": true
}
}
I faced this issue even after configuring tailwindCSS.includeLanguages settings.
So make sure you configure the below settings as well to allow suggestions inside a string.
"editor.quickSuggestions": {
"strings": true
}
Add this at the end of your setting.json file in order to get IntelliSense on both HTML and js file
"tailwindCSS.includeLanguages": {
"javascript": "javascript",
"html": "HTML"
},
Try to delete the "tailwind.config.js" and create it back again with
npx tailwindcss init
and it should start working.
Both combined worked for me.
"tailwindCSS.includeLanguages": {
"javascript": "javascript",
"html": "HTML"
},
and
Try to delete the "tailwind.config.js" and create it back again with
npx tailwindcss init
You have to include the files, in which you want to work with Tailwind CSS in your tailwind.config.js file.
You can replace:
content: [],
with
content: ["*"],
It will include all files in your project. Save it and now the Tailwind CSS IntelliSense will popup the suggestions.
I had the same issue. I uninstalled Tailwind CSS IntelliSense, then reinstalled it back. And the problem was solved.
Placed the following snippit in VSCode’s settings.json file.
"tailwindCSS.emmetCompletions": true, // remove this line if you don't use Emmet
"editor.inlineSuggest.enabled": true,
"editor.quickSuggestions": {
"strings": true
},
"css.validate": false,
Add to settings.json
You can open via
cmd + shift + p => Prefences: Open Settings (JSON)
"tailwindCSS.includeLanguages": {
"javascript": "javascript",
"javascriptreact": "javascriptreact",
"typescript": "typescript",
"typescriptreact": "typescriptreact",
}
The last version of tailwindcss for this time is 3.2.1 and it seems this version is not matched with the last version of vsCode or IntelliJ IDEA so I downgraded tailwind to 3.1.8 (npm i tailwindcss#3.1.8) and then those ways that guys suggest work now
I added these lines of code but it did not work. However, updating my vscode to the latest version did the trick for me.
"tailwindCSS.includeLanguages": { "plaintext": "javascript" },
"tailwindCSS.emmetCompletions": true,
"editor.inlineSuggest.enabled": true,
"editor.quickSuggestions": {
"strings": true
},
"css.validate": false,
"emmet.includeLanguages": {
"javascript": "javascriptreact"
}

ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY on dotnet core 3.1 react project

I started a new dotnet core with react project on my Windows 8.1 machine.
dotnet new react my-project
When I started debugging in chrome at https://localhost:5001/, I got the following error
ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY.
Where should I look into?
You can configure Kestrel server to serve Http1. Please follow the following instruction to solve the problem -
Go to your project appsettings.json file.
Add below code under "AllowedHosts": "*" line
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http1"
}
}
Your default appsettings.json file will look like this -
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http1"
}
}
}
Hope it will solve your problem.

How to call a function when "RPC.allow" is applied?

 In the volttron/platform/store.py file, it contains:
# RPC.export
# RPC.allow ('edit_config_store')
def manage_store (self, identity, config_name, raw_contents, config_type = "raw"):
contents = process_raw_config (raw_contents, config_type)
self._add_config_to_store (identity, config_name, raw_contents, contents, config_type,
                                  trigger_callback = True)
To call this function from outside, I wrote the code as below.
 self.vip.rpc.call (CONFIGURATION_STORE, "manage_store", 'platform.driver', config_name, raw_contents, 'json')
The error code is as follows.
volttron.platform.jsonrpc.Error: method "manage_store" requires capabilities {'edit_config_store'}, but capability [] was provided for user pnp
auth is registered as below.
INDEX: 8
{
  "domain": null,
  "address": null,
  "mechanism": "CURVE",
  "credentials": "6vjPXC8ctO8oWkeMXAOe5FsAM9vZD_sg0vkLrstnVFs",
  "groups": [],
  "roles": [],
  "capabilities": {
    "edit_config_store": {
      "identity": "pnp.b"
    }
  },
  "comments": "Automatically added on agent install",
  "user_id": "pnp.b",
  "enabled": true
}
How do I fix Capability?
This is a security feature. By default an agent can only update its own config store. So the agent with identity pnp.b can only edit its own config store and not of platform.driver. But you (or whoever has access to run vctl auth command or to directly edit the $VOLTTRON_HOME/auth.json file) can edit config store by giving the pnp.b agent the capability to edit the config store of platform.driver.
The capabilities entry for the agent can be changed to a regular expression that allows pnp.b or platform.driver (Or any other pattern you want). Regular expressions should be enclosed in / For example
{
"domain": null,
"address": null,
"mechanism": "CURVE",
"credentials": "6vjPXC8ctO8oWkeMXAOe5FsAM9vZD_sg0vkLrstnVFs",
"groups": [],
"roles": [],
"capabilities": {
"edit_config_store": {
"identity": "/pnp.b|platform.driver/"
}
},
"comments": "Automatically added on agent install",
"user_id": "pnp.b",
"enabled": true
}
Thank you very much for your answer.
Referring to your answer, I was correcting auth's capability.
INDEX: 8
{
"domain": null,
"address": null,
"mechanism": "CURVE",
"credentials": "TG3z7cEa1FnMp_642srvNLyd6HsxTq18xMOg20FFWjE",
"groups": [],
"roles": [],
"capabilities": {
"edit_config_store": {
"identity": "/pnp.b|platform.driver/"
}
},
"comments": "Automatically added on agent install",
"user_id": "pnp.b",
"enabled": true
}
However, it still shows that the agent is not authorized as shown in the log below.
Is it my mistake during correction?
Do you have any comments on this?
Note: I use the volttron 7.0rc branch.
2020-04-07 09:09:37,467 () volttron.platform.vip.agent.subsystems.rpc ERROR: unhandled exception in JSON-RPC method 'manage_store':
Traceback (most recent call last):
File "/volttron7_200331/volttron/platform/vip/agent/subsystems/rpc.py", line 158, in method
return method(*args, **kwargs)
File "/volttron7_200331/volttron/platform/vip/agent/subsystems/rpc.py", line 283, in checked_method
raise jsonrpc.exception_from_json(jsonrpc.UNAUTHORIZED, msg)
volttron.platform.jsonrpc.Error: method "manage_store" requires capabilities {'edit_config_store'}, but capability [] was provided for user pnp

How to use $npm_config_ in package.json?

I'm using create-react-app for my React project (ejected), and I've configured a proxy in package.json. But I don't want to have my credentials committed in this file. So I've added to npm using npm config set my_user xxxx.
I can see them in my ~/.npmrc, too.
"proxy": {
"/api/v3/": {
"target": "https://ourstagingserver.nl/",
"changeOrigin": true,
"ssl": false,
"secure": false,
"headers": {
"username": "$npm_config_my_user",
"password": "$npm_config_my_pass"
}
},
This doesn't work. The username and password are not used in the proxy requests.
But if I add this to "scripts":
"hello": "echo $npm_config_my_user $npm_config_my_pass
and run npm run hello, both are echoed...
Any ideas? Is this supposed to work or am I doing it wrong?
Thx! Gijs
I didn't figure out the use of $npm_config_ variables for this purpose but I did solve the issue of using ENV variables for the proxy in create-react-app:
In scripts/start.js (line 62, below const proxySetting = require(paths.appPackageJson).proxy), add this:
proxySetting[Object.keys(proxySetting)[0]].headers.username = process.env.PROXY_USERNAME;
proxySetting[Object.keys(proxySetting)[0]].headers.password = process.env.PROXY_PASSWORD;
or you could loop over the objects in proxySetting and set the credentials for every object in there if you have multiple API's to proxy to:
Object.keys(proxySetting).forEach(function(proxy) {
proxySetting[proxy].headers.username = process.env.PROXY_USERNAME;
proxySetting[proxy].headers.password = process.env.PROXY_PASSWORD;
});
Note: scripts/start.js is a file that's generated by create-react-app

Resources