Skip to content

Instantly share code, notes, and snippets.

@davidwalter0
davidwalter0 / concourse.test.text
Created September 19, 2019 16:33
test concourse
Some test text
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@davidwalter0
davidwalter0 / jq-query.sh
Last active March 2, 2019 22:25
kubernetes / jq example rule
#!/bin/bash
kubectl get no -o json|jq -r '.items[]|select(.metadata.name == "node1.example.com")|.metadata' | cat -
curl 0.0.0.0:8080/api/v1/nodes|jq -r '.items[]|select(.metadata.name == "node1.example.com")|.metadata' | cat -
kubectl get no -o json|jq -r '.items[]|select(.metadata.name == "node1.example.com")|.metadata.annotations."flannel.alpha.coreos.com/backend-data"' | cat -
curl -s 0.0.0.0:8080/api/v1/nodes|jq -r '.items[]|select(.metadata.name == "node1.example.com")|.metadata.annotations.flannel.alpha.coreos.com/backend-data' | cat -
@davidwalter0
davidwalter0 / uploader.go
Created February 14, 2019 03:57 — forked from TheGU/uploader.go
Golang to upload file to google drive with progress bar using Google API
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@davidwalter0
davidwalter0 / wayback.go
Last active November 16, 2018 00:15
x/vgo: thoughts on selection criteria for non-versioned go repo
// https://gist.github.com/davidwalter0/60f41b53732656c5c546cc8b0a739d11
// x/vgo: thoughts on selection criteria for non-versioned go repo
// Run git branch version selection for non-vgo versioned repository
// as if in a wayback machine.
// Use the dependency's commit ctime as the wayback ctime.
// Commits prior to the wayback ctime in sub-dependencies are eligible.
// Use the newest commit prior to the wayback ctime.
@davidwalter0
davidwalter0 / vgo-mode.el
Last active August 16, 2019 01:22
emacs: go.mod and go.sum highlighting
;;; package --- mode for go.mod files
;;; Commentary:
;;; font-lock syntax for go.mod files
;;;
(setq vgo-highlights
'(
;;; go.sum
("^\\([^ ]*\\) *[^ ]* h1:*[^ ]*=$" . (1 font-lock-keyword-face))
("^[^ ]* *\\([^ ]*\\) h1:*\\([^ ]*=\\)$" . (1 font-lock-builtin-face))
@davidwalter0
davidwalter0 / gist:a4744b453c4975c49e0e835f7d7f8f89
Last active September 21, 2018 17:59
vgo git version run as git vgo-version >> /tmp/vgo.version
[alias]
# create an un-versioned version faux tag string with v0.0.0-date-commit format
# github.com/davidwalter0/hello v0.0.0-20180519105930-66b6dd4eb1dd
vgo-version = "!TOP=$(git rev-parse --show-toplevel); git log -n 1 --abbrev=12 --date=format:'%Y%m%d%H%M%S' --pretty=format:\"${TOP#${GOPATH}/src/} v0.0.0-%cd-%h\";echo"
- name: Ping David to fix config
delegate_to: localhost
shell: |
. ${HOME}/bin/sms.environment
${HOME}/bin/send.$(uname -s|tr [A-Z] [a-z]) "status update from app..."
- name: Pause for config
pause:
seconds: 120
@davidwalter0
davidwalter0 / stash-pop-recover
Created August 10, 2017 17:42
Undoing accidental git stash pop
# https://stackoverflow.com/questions/6543519/undoing-accidental-git-stash-pop
# https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git
accepted
If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda).
Otherwise, you can find it using this for Linux and Unix:
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
and for Windows:
rpm -qa --qf '%{INSTALLTIME} (%{INSTALLTIME:date}): %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n'
To list all packages, sorted by install date, latest first:
rpm -qa --last
This should work on any RPM based machine:
rpm -qa --qf '%{INSTALLTIME} (%{INSTALLTIME:date}): %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -n