25 January 2022

Serrife bank

After a long time, again my 2 cents for FG Knuth

Added:
+      Germán González-Morris           0x$6.40

 

13 January 2022

Jenkins directory structure

From official documentation:

JENKINS_HOME has a fairly obvious directory structure that looks like the following:

JENKINS_HOME
 +- config.xml     (jenkins root configuration)
 +- *.xml          (other site-wide configuration files)
 +- userContent    (files in this directory will be served under your http://server/userContent/)
 +- fingerprints   (stores fingerprint records)
 +- nodes          (slave configurations)
 +- plugins        (stores plugins)
 +- secrets        (secretes needed when migrating credentials to other servers)
 +- workspace (working directory for the version control system)
     +- [JOBNAME] (sub directory for each job)
 +- jobs
     +- [JOBNAME]      (sub directory for each job)
         +- config.xml     (job configuration file)
         +- latest         (symbolic link to the last successful build)
         +- builds
             +- [BUILD_ID]     (for each build)
                 +- build.xml      (build result summary)
                 +- log            (log file)
                 +- changelog.xml  (change log)

Although the version (legacy) I am using is a bit different.

09 January 2022

RequireUpperBoundDeps

Eventually, this issue would be faced if trying to compile Jenkins plugins: 

In the end, a dependency has a stale version (8.0.1) in this case.

[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (display-info) @ azure-ad ---

[INFO] Adding ignore: module-info
[INFO] Ignoring requireUpperBoundDeps in com.google.guava:guava
[WARNING] Rule 5: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps failed
 with message:
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.ow2.asm:asm:5.0.4 paths to depend
ency are:
+-org.jenkins-ci.plugins:azure-ad:1.2.2
  +-org.jenkins-ci.main:jenkins-core:2.271
    +-com.github.jnr:jnr-posix:3.0.45
      +-com.github.jnr:jnr-ffi:2.1.8
        +-org.ow2.asm:asm:5.0.4 (managed) <-- org.ow2.asm:asm:5.0.3
and
+-org.jenkins-ci.plugins:azure-ad:1.2.2
  +-org.jenkins-ci.main:jenkins-core:2.271
    +-com.github.jnr:jnr-posix:3.0.45
      +-com.github.jnr:jnr-ffi:2.1.8
        +-org.ow2.asm:asm-tree:5.0.3
          +-org.ow2.asm:asm:5.0.4 (managed) <-- org.ow2.asm:asm:5.0.3
and
+-org.jenkins-ci.plugins:azure-ad:1.2.2
  +-com.microsoft.azure:azure:1.22.0
    +-com.microsoft.azure:azure-client-authentication:1.6.4
      +-com.microsoft.azure:adal4j:1.6.2
        +-com.nimbusds:oauth2-oidc-sdk:5.64.4
          +-net.minidev:json-smart:2.3
            +-net.minidev:accessors-smart:1.2
              +-org.ow2.asm:asm:5.0.4 (managed) <-- org.ow2.asm:asm:8.0.1
]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:08 min
[INFO] Finished at: 2022-01-09T10:12:15-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.
0.0-M3:enforce (display-info) on project azure-ad: Some Enforcer rules have fail
ed. Look above for specific messages explaining why the rule failed. -> [Help 1]

https://www.jenkins.io/doc/developer/plugin-development/updating-parent/

https://ourcraft.wordpress.com/2016/08/22/how-to-read-maven-enforcer-plugins-requireupperbounddeps-rule-failure-report/

 

 

02 January 2022

Jq cheat sheet

jq .
jq type
jq keys


Samples:

cat adb_shared.json | jq keys
cat adb_shared.json | jq .ADB_Instance
cat adb_shared.json | jq .ADB_Instance | head

linux: length (count)
cat adb_shared.json | jq ".ADB_Instance | length"

jq length:
(count)

jq '.data' zcluster.json | jq length

extraer key de cada elemento del array:
iterator operator .[]

jq '.data' zadb.json |  jq '.[] | .id'
jq '.data' zadb.json |  jq '.[] | ."defined-tags"'

jq '.data' zadb.json |  jq '.[] | ."db-name"'
 

jq '.data' zadb.json |  jq '.[] | ."db-name" + " " + (."is-dedicated"|tostring) + ", " + (."defined-tags"|tostring)'
 

funcion: tostring
has to be inside of quotation mark.

terraform output -json | jq '.elastic_endpoint.value'

alias jqq='jq --color-output < swagger.json | less'

 
remove additionalProperties for a json

jq 'walk(if type == "object" and has("additionalProperties") then del(.additionalProperties) else . end)'  < sw1.json | grep -i add
 

Samples by quering json:

[
  {
    "Id": "cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b",
    "Names": [
      "condescending_jones",
      "loving_hoover"
    ]
  },
  {
    "Id": "186db739b7509eb0114a09e14bcd16bf637019860d23c4fc20e98cbe068b55aa",
    "Names": [
      "foo_data"
    ]
  },
  {
    "Id": "a4b7e6f5752d8dcb906a5901f7ab82e403b9dff4eaaeebea767a04bac4aada19",
    "Names": [
      "jovial_wozniak"
    ]
  },
  {
    "Id": "76b71c496556912012c20dc3cbd37a54a1f05bffad3d5e92466900a003fbb623",
    "Names": [
      "bar_data"
    ]
  }
]

contains:

devwebcl@devwebcl-PC ~/tmp
$ cat t.json | jq -c 'map(select(.Names[] | contains ("data"))) '
[{"Id":"186db739b7509eb0114a09e14bcd16bf637019860d23c4fc20e98cbe068b55aa","Names":["foo_data"]},{"Id":"76b71c496556912012c20dc3cbd37a54a1f05bffad3d5e92466900a003fbb623","Names":["bar_data"]}]

devwebcl@devwebcl-PC ~/tmp
$ cat t.json | jq -c 'map(select(.Names[] | contains ("data"))) | .[] .Id'
"186db739b7509eb0114a09e14bcd16bf637019860d23c4fc20e98cbe068b55aa"
"76b71c496556912012c20dc3cbd37a54a1f05bffad3d5e92466900a003fbb623"

Not contains:

devwebcl@devwebcl-PC ~/tmp
$ cat t.json | jq 'map(select(any(.Names[]; contains("data"))|not)|.Id)[]'
"cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b"
"a4b7e6f5752d8dcb906a5901f7ab82e403b9dff4eaaeebea767a04bac4aada19"

devwebcl@devwebcl-PC ~/tmp
$ cat t.json | jq '. - map(select(.Names[] | contains ("data"))) | .[] .Id'
"cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b"
"a4b7e6f5752d8dcb906a5901f7ab82e403b9dff4eaaeebea767a04bac4aada19"

https://github.com/stedolan/jq/wiki/Cookbook#filter-objects-based-on-the-contents-of-a-key


jq -s (slurp), concatenates json


--slurp (-s) key is needed and map() to do so in one shot

$ cat f1.json
{
  "records": [
    {"a": 1},
    {"a": 3}
  ]
}

$ cat f2.json
{
  "records": [
    {"a": 2}
  ]
}

$ jq -s 'map(.records[].a)' f?.json
[
  1,
  3,
  2
]

 



20 December 2021

Sonar Java Injection

Rules not assigned by default, but very useful:

 - https://rules.sonarsource.com/java/RSPEC-3749
  Members of Spring components should be injected

- https://rules.sonarsource.com/java/RSPEC-4288
  Spring components should use constructor injection
 



13 November 2021

Algorithms and Data Structures for Massive Datasets

Technical Reviewer:

Dzejla Medjedovic, Emin Tahirovic, and Ines Dedovic
MEAP began July 2020 Publication in January 2022 (estimated)
ISBN 9781617298035 325 pages (estimated) printed in black & white

https://www.manning.com/books/algorithms-and-data-structures-for-massive-datasets



16 September 2021

netcat - nc

netcat
ncat
nc


-n : skip DNS lookups
-u : Use of UDP mode (instead of TCP)
-v : Extensive output
-w : timeout (seconds)
-z : Port scanner mode (zero I/O mode); only listening services are scanned (no data is sent)

Scan port 123 for NTP:
nc -z -v -u 0.us.pool.ntp.org 123


scan ports:
nc -w 2 -z 192.168.10.1 1-1024

nc -v -n 8.8.8.8 1-1000




My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.