Skip to content

Instantly share code, notes, and snippets.

@jkroepke
Last active March 9, 2022 16:25
Show Gist options
  • Save jkroepke/fbf4dd411edeef42ee3d26dc0773cd76 to your computer and use it in GitHub Desktop.
Save jkroepke/fbf4dd411edeef42ee3d26dc0773cd76 to your computer and use it in GitHub Desktop.
1 Nice to know from Joe

curl

Username & Password via env

#!/bin/bash
SRV="example.com"
URL="https://$SRV/path"
curl --netrc-file <(cat <<<"machine $SRV login $USER password $PASSWORD") "$URL"

or

curl --config - https://example.com <<< 'user = "username:password"'

https://stackoverflow.com/a/33818945

git

Delete all local branches if remote branch is gone

git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D

Helm

Check if value is nil

Masterminds/sprig#53

{{ if kindIs "invalid" $value }}
nil
{{ else }}
non empty string
{{ fi }}

node

node-gyp doesnt work on MacOs

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node@10/10.18.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd .../node_modules/fsevents
gyp ERR! node -v v10.18.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

Fix: Remove and reinstall xcode CLI Tools. Full XCode is not requried!

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

node-gyp on Windows

  • Run cmd as Administrator
npm install --global --production windows-build-tools --vs2015
npm config set msvs_version 2015 --global

Source: https://spin.atomicobject.com/2019/03/27/node-gyp-windows/

Prometheus

Prometheus Annotation for label value change

grafana/grafana#11948

prometheus_build_info unless (prometheus_build_info offset 1m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment