Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# https://stackoverflow.com/a/79334151/2597447
# usage:
# ./git-commits-as-yaml.sh [rev-list options]
#
# examples, show last 3 commits as yaml:
# ./git-commits-as-yaml.sh HEAD~3..HEAD
# show all commits in branch as yaml:
# ./git-commits-as-yaml.sh
#!/usr/bin/env bash
# usage: app-refresh kafka
set -eo pipefail
application=${1:-argocd-applications}
current_project=$(oc project | cut -d '"' -f 2)
cleanup () {
oc project "$current_project" &> /dev/null
}
@arve0
arve0 / elasticsearch.sh
Created June 15, 2023 14:40
OpenShift Logging Elasticsearch search script
#!/usr/bin/env bash
set -xeuo pipefail
ES_REST_BASEURL=${ES_REST_BASEURL:-https://localhost:9200}
ES_PATH_CONF=${ES_PATH_CONF:-/etc/elasticsearch}
function es {
path="$1"
shift
curl -s \
@arve0
arve0 / formel.md
Last active November 3, 2022 07:32

$L(x + 1) = L(x) + 0.03 \times \frac{L(x)}{L_{total}} \times \left( \frac{-0.25 \times E(x)}{E_{avg}} + 1 \right)$

#!/bin/sh
# source:
# - https://staaldraad.github.io/2017/12/20/netstat-without-netstat/
# - https://gist.github.com/staaldraad/4c4c80800ce15b6bef1c1186eaa8da9f
awk 'function hextodec(str,ret,n,i,k,c){
ret = 0
n = length(str)
for (i = 1; i <= n; i++) {
c = tolower(substr(str, i, 1))
#!/usr/bin/env bash
# watches files recursively in folder, runs command upon changes
# usage:
# ./watch.sh folder command
# example:
# ./watch.sh lib make test
folder=$1
shift
@arve0
arve0 / wait-for
Created April 17, 2020 17:29
wait for open tcp port (no deps)
#!/bin/sh
# https://github.com/eficode/wait-for
#
# The MIT License (MIT)
#
# Copyright (c) 2017 Eficode Oy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal

Tilbakemelding tofagerl/atbash-cipher

Overordnet er koden lett å lese og forstå, og dermed enkelt å validere at den er korrekt. Bra! Seksjonene under tar for seg et tema om gangen.

cargo fmt

Kun ett forslag til endring i formatering 👍

cargo clippy

Ingen forslag, meget bra.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class SimpleJDBC {
public static void main(String[] args) throws Exception {
String db_url = "jdbc:oracle:thin:@localhost:1521/ORCLPDB1.localdomain";
String schema = "NVMSADMIN";
function get_JSON(url) {
return new Promise((resolve, reject) => {
https.get(url, {
headers: {
'user-agent': 'arve0/nvdb-vegsystemreferanse',
'accept': 'application/json',
}
}, (res) => {
let body = '';
res.on('data', (chunk) => {