Get unix micro time in VB.NET

Public Shared Function GetUnixMicroTime() As String Dim origin As DateTime = New DateTime(1970, 1, 1, 0, 0, 0, 0) Dim diff As TimeSpan = Now() – origin Return CStr(diff.TotalSeconds) End Function

Extract only numbers from a string in JavaScript

There are many ways to extract numbers from a string in JavaScript. Here’s the function we use: function ExtractOnlyNumbersFromString(txt) { var numbers = txt.match(/\d/g); return (numbers) ? numbers.join(“”) : “”; } ExtractOnlyNumbersFromString(“a 1 b 2…

Serving HTTP images in a HTTPS site

If you’re looking for a solution to load images over HTTPS then the free cache & proxy service at cdn.dotmaui.com/ip/ is exactly what you are looking for. Silmply to use,  .Maui Proxy will cache the…

Clear systemd journal

Journalctl is a utility for querying and displaying logs from journald, systemd’s logging service. Journal logs can take considerable amount of disk space. Here are some useful steps to free up space on ubuntu and…

Uppercase first in VB.Net

To capitalize only the first character of a string you can create an extension, like this: Public Module MyModule Public Function UppercaseFirst(my_string As String) As String If String.IsNullOrWhiteSpace(my_string ) OrElse my_string .Length < 2 Then...

Connect and query to a Sqlite database in Golang

First you need to install the go-sqlite3 library downloadable from Github, github.com/mattn/go-sqlite3 Then copy and adapt the code below to your database. package main import ( “fmt” “database/sql” _ “github.com/mattn/go-sqlite3” ) func main() { db,…

Generate random numbers in GoLang

We continue our series on the Go programming language. Today we propose a very useful function to generate random numbers, in this case integers. package main import ( “fmt” “math/rand” “strconv” “time” ) func random(min,…

Connect to a Sql Server database with Go

In this example, let’s see how to connect to Sql Server, select and view the database version using Go programming language. package main import ( _ “github.com/denisenkom/go-mssqldb” “database/sql” “context” “log” “fmt” ) // Replace with…