Skip to main content

Posts

Showing posts from 2020

Archlinux UK keyboard

How to setup UK keyboard on Archlinux I recently switched from an US to an UK keyboard. The US one is the default for install, almost nothing has to be done for setting it up. But once you get out of that default setup, it is easy to deal with, but you must know that: In console, UK is "uk" In Xorg / X11, UK is "gb" Then, in /etc/vconsole.conf : KEYMAP=uk And in /etc/X11/xorg.conf.d/00-keyboard.conf : Section "InputClass"         Identifier "system-keyboard"         MatchIsKeyboard "on"         Option "XkbLayout" "gb"         Option "XkbModel" "pc105" EndSection

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 Node Install Typescript (which will provide "tsserver") Install TIDE and some usefull dependencies Configure Emacs to use all those Node 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/browserify After 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 "

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: https://issues.jenkins-ci.org/browse/JENKINS-57495 Just 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 https://www.newtonsoft.com/json The 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&

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" );

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 GDM Install TigerVNC Setup the VNC Server: password + startup Run the server Connect 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 howtos The checkboxes are due to the "vncconfig -iconic &" command