Provide username and password for git clone

There are situations when you need to clone some privately hosted git repository, which is accessible only via http. (Yes, I know it is not secure, but that was not my choice). Ssh access is not provided, and neither is https. The only access is via http accessible on VPN. The connection is protected with username and password, but when trying to clone it, I have always got Authentication Error. Git never asked for credentials. Solution So how do you supply the required credentials? You can embed them directly in the url, like this The obvious downside is that now …

Continue Reading

Awaitable http(s) request in Nodejs and Pulumi

Pulumi is a great tool for quick and easy deployment to cloud. It provides nice abstraction above several cloud providers, such as AWS, Kubernetes or Azure. But it also has some drawbacks. The biggest plus is that you can define your lambdas, tasks etc in single index.js file and import dependencies from other npm packages. Pulumi will then gather all those dependencies and compile then into single script. That script is then deployed to the could. The drawback is that Pulumi can not compile some native functions, such as [Symbol.iterator]. When you rely on some 3rd party npm package, which iterates with …

Continue Reading

File validators in Angular

Whenever you allow users to upload files to your server, you should have both client side and server side validation. Most likely you will validate file size and file type, identifiable by the file extension. FileValidator covers all three aspects. Example of usage is below the source code. If you are using Angular, you can use these simple validators. If you do use them, or find them inspiring, please let me know. import { ValidatorFn, FormControl } from ‘@angular/forms’; export class FileValidator { static fileMaxSize(maxSize: number): ValidatorFn { const validatorFn = (file: File) => { if (file instanceof File && …

Continue Reading

Angular (click) not fired and how to fix it

Sometimes, very rarely, you can run into situation then Angular does not fire the (click) event. Or it fires later, on the 2nd click. It can be really hard to debug and figure out what causes it. So here are my two cents. This can be caused by view being updated while user clicks. What happens under the hood is this: Click event consists of mousedown event followed by mouseup event. That is important to remember! But when the view changes, then the mouseup event is fired elsewhere, so the click event never happens. It can even be, that the …

Continue Reading

How to migrate Pulumi stack

Pulumi is a great abstraction layer above AWS and other cloud infrastructure. It enables to quickly deploy and update your cloud. But what if you have several AWS profiles, eg: several private ones and one or more which belongs to a company? Your private one is the default and you use it to deploy … Aaaah, problems, the deployed code is not hosted under your company account 🙂 To migrate perform these steps: pulumi destroy  // destroy current stack under personal account set AWS_PROFILE=your-company-profile // define global env variable read by both Pulumi and AWS CLI pulumi up -y // create …

Continue Reading