Skip to content

Instantly share code, notes, and snippets.

View InsulaVentus's full-sized avatar
🦆

Øyvind Strømmen InsulaVentus

🦆
View GitHub Profile
package com.github.insulaventus.bytes;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class Bytes {
public static List<byte[]> split(byte[] input, byte[] delimiter) {
List<byte[]> byteArrays = new LinkedList<>();
if (delimiter.length == 0) {

Determine which ip is assgined to a given container:

$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container-name>
172.23.0.2

The network inteface gateway follows the syntax; xxx.xxx.xxx.1, so in this case it will be: 172.23.0.1

Determine which interface the gateway ip is assigned to:

Curl with certificates

$ curl -v -k \
--key private-key.pem \
--cert public-certificate.pem:{password} \
https://api.example.com/xsd \
-o foo.xsd

Keybase proof

I hereby claim:

  • I am insulaventus on github.
  • I am insulaventus (https://keybase.io/insulaventus) on keybase.
  • I have a public key ASDCa4vhbyRXNyNPbrn-NWzY4yX1X7EhTaqLI-bgUoxLBQo

To claim this, I am signing this object:

package record
import (
"errors"
"fmt"
"strings"
"unicode"
)
// LicensePlate represents a license plate that can be attempted normalized.
package record
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func TestValidLicensePlate(t *testing.T) {
$ tree test
test
├── http-client.env.json
└── rest-api.http

http-client.env.json

{

GNU Makefile manual

A simple makefile consists of “rules” with the following shape:

target … : prerequisites …
        recipe
        …
        …
@InsulaVentus
InsulaVentus / git-exclude.md
Last active August 29, 2019 12:33
Git ignore rules independent of .gitignore

In some cases you might want to add one or more ignore rules for a git repository that you don't want to check in. For example you might have a script that you use to manually test stuff - foo.sh. If you don't want to check in this file you can of course add foo.sh to .gitignore, but foo.sh does not mean anything to anyone but you. A better option would therefore be to add foo.sh to .git/info/exclude. This file will not be checked in, and no one but you need ever know about foo.sh.

But say you tend to create a foo.sh in all the git repositories you clone. Then you could edit the .git/info/exclude of all those repos, or you could create a global excludes file. To do this, simply:

Create a file and name it whatever you like. E.g:

Say you have a string with a date and a time, e.g "24.07.2019 12:49", but no time zone. And you want to format that string according to the ISO-8601 standard, with offset, e.g "2019-07-24T12:49:00+02:00".

In java:

LocalDate date = LocalDate.parse("27.07.2019", DateTimeFormatter.ofPattern("dd.MM.yyyy"));
LocalTime time = LocalTime.parse("12:49");
        
LocalDateTime.of(date, time)
 .atZone(ZoneId.of("Europe/Oslo"))