Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# create the base lint result
spectral lint --quiet --format json --output lint.json code/build/api-spec/openapi3.yaml
# process to code quality format
jq -c '[.[] | { description: .message, original: ., location: { path: .source, lines: { begin: .range.start.line }}}]' lint.json > base.json
jq -c '.[]' base.json | while read -r line ; do
sum=$(echo "$line" | md5sum | cut -d' ' -f1);
#!/usr/bin/env bash
# Filename: ${filename}
# Description: ${filedesc}
# Maintainer: Lukas Ciszewski <lukas.ciszewski@gmail.com>
# set shell options
# * fail immediately on the first error occuring
# * allow clean trapping for ERR
# * fail also if the call to nested functions fails
@laidback
laidback / go-json.go
Created April 28, 2018 21:30
go-json created by laidback - https://repl.it/@laidback/go-json
package main
import (
"encoding/json"
"fmt"
)
type resp struct {
Fname string `json:"fname, string"`
}

Forwarding Rsyslog

We want to forward messages using an intermediate rsync forwarder/broker. We do not want the broker to save any messages from the clients and we also want to forward the broker messages to the Rsyslog Sink.

Useful Links

@laidback
laidback / java_cars_detail.java
Created February 17, 2018 17:28
java_cars_detail created by laidback - https://repl.it/@laidback/javacarsdetail
interface SubSystem {
public void startSystem();
public void stopSystem();
public SubSystemState getState();
}
interface SubSystemState {}
enum Color { WHITE, BLACK, RED, BLUE, GREEN; }
enum EngineType { DIESEL, GASOLINE; }
@laidback
laidback / go-routines.go
Created February 17, 2018 17:28
go-routines created by laidback - https://repl.it/@laidback/go-routines
package main
import "os"
import "fmt"
import "time"
import "runtime/debug"
import "runtime/pprof"
var _ = os.Stdout
var _ = debug.PrintStack
@laidback
laidback / go-factorial.go
Created February 17, 2018 17:27
go-factorial created by laidback - https://repl.it/@laidback/go-factorial
// Provide simple time measured factorial function versions
// * iterative
// * recursive
// * tail recursive
package main
import (
"fmt"
"time"
)
# some converge rest api
curl http://127.0.0.1:4774/api/v1/resources/modules/hello.hcl
curl http://127.0.0.1:4774/api/v1/resources/binary -H "Accept: text/plain" | shasum
# download converge binary
curl http://127.0.0.1:4774/api/v1/resources/binary -H "Accept: text/plain" -O
# use the binary
chmod +x binary
./binary
$ python -c "import os; print('\n'.join(os.environ['PATH'].split(':')))"
# users-formula/basic.sls
basic-user:
user.present:
- name: {{ name }}
- gid: {{ gid }}
############################
# state tree: vhost-user.sls
include: