Skip to main content


Showing posts from 2020

Emacs TypeScript Development

Emacs Configuration for Typescript
In order to comfortably develop on Node, React or Angular projects with Emacs, TIDE is a good solution. We have TypeScript code highlight (that is the minimum!) and code completion based on the codebase (not only on locally defined and builtins) In order to achieve that: Install Emacs (24+)
Install NodeInstall Typescript (which will provide "tsserver")Install TIDE and some usefull dependenciesConfigure Emacs to use all thoseNode is then installed in "/home/mihamina/Apps/node-v12.18.0-linux-x64/bin": you should add it to your PATH.
Installing Typescript is done with: npm install --save typescript @types/browserifyAfter that, "tsserver" will be in "/home/mihamina/node_modules/.bin" Then comes the installation of TIDE: With the Emacs package manager, M-x package-install, install "tide". Do the same for "web-mode", "flycheck", "company" "js2-mode" and "json-mode".

Emacs append PATH

We sometimes need to add node, yarn and some other binaries to the PATH. Of course, it is possible to do it with the PATH environment variable. But to have it just inside Emacs: (add-to-list 'exec-path "/home/mihamina/.config/yarn/global/node_modules/.bin")

Jenkins invalid privatekey

Publish over SSH, Message "invalid privatekey:" With quite recent (June-July 2020) installations of Jenkins and OpenSSH, I have the following error message when using the "Deploy overs SSH" Jenkins plug-in and publishing artifacts to the target overs SSH: jenkins.plugins.publish_over.BapPublisherException: Failed to add SSH key. Message [invalid privatekey: [B@d8d395a] This problem seems to be referenced here: regenerate a key with the right parameters To solve it: ssh-keygen -t rsa -b 4096 Or ssh-keygen -t rsa -b 4096 -m PEM

CSharp Parse JSON

How to Parse a JSON with C# Let a JSON be: { "access_token": "2564231sdfsdf1sd", "expires_in": 3600, "token_type": "Bearer" } There are at least two ways I know to access to the values with C#: With the Deserialization way With the JSON PAth Query way Both of them requires you to install and reference Deserialization way With this method, you have to define a class that match the JSON and then perform the deserialisation: using Newtonsoft.Json; using Newtonsoft.Json.Serialization; // You probably need more namespace SSFS { public class Token{ public string access_token {get; set;} public int expires_in {get; set;} public string token_type {get; set;} } public class Utils { string jsonString = @"{ "access_token": "2564231sdfsdf1sd", "expires_in": 3600, "token_type": &qu…

CSharp Http Custom Headers

How to send custom HTTP headers in C#I use Ranorex in order to perform UI Tests, and there went the time to mimic some Postman queries to WebServices. The Postman queries has been configured to add custom headers to some GET and POST ones. This is one of the possible ways to to that. First you need to install System.Net.Http Then, this is the code sample to do the trick is: using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using Newtonsoft.Json; // Depending on your use case, you might need more namespace RKTMB { public class Utils { public static HttpClient client = new HttpClient(); public static async Task PostRequest() { string p = ""; string payload = "{\"CustomerId\": 5,\"CustomerName\": \"Pepsi\"}"; HttpContent c = new StringContent(payload,Encoding.UTF8, "text/plain" ); c.Head…

Gnome VNC Grey Checkboxes

When setting up VNC server in Gnome, I get a grey screen (or a black one) and the checkboxes to "Accept clipboard from viewers", "Send clipboard to viewers", "Send primary selection to viewers".
I'm setting up a VNC server on a Debian 10 machine that has Gnome environment.

A zillion articles can be found on Internet, they have the same global path:
Install Gnome and GDMInstall TigerVNCSetup the VNC Server: password + startupRun the serverConnect from the client One of them is this TeknoTut how-to I took inspiration from.

The tutorial is good, but I needed to complete it with extra steps in order to make it work: If the current user has already a running Gnome session, I just get the "grey screen with the checkboxes".

It is good to know that:
The "grey screen" is due to the "xsetroot" command that can be seen in some howtosThe checkboxes are due to the "vncconfig -iconic &" command When you get them, then, it…