Skip to content

Instantly share code, notes, and snippets.

@jglick
jglick / catmani.sh
Created February 22, 2023 13:23
Dump manifest of JAR(s) without line-wrapping
#!/bin/sh
for j in "$@"
do
unzip -p "$j" META-INF/MANIFEST.MF | perl -p -0777 -e 's/\r?\n //g'
done
@jglick
jglick / slack.sh
Last active October 1, 2020 19:56
Script to launch Slack on Xubuntu with an icon
#!/bin/bash -xe
# adapted from https://launchpadlibrarian.net/422519169/slack via https://bugs.launchpad.net/ubuntu/+source/xfwm4/+bug/1827302/comments/12
ICON=/snap/slack/current/usr/share/pixmaps/slack.png
nohup /snap/bin/slack
WINDOWS=
while [ -z "$WINDOWS" ]
do
@jglick
jglick / Dockerfile.minikube
Last active September 6, 2018 17:31 — forked from andrewjjenkins/Dockerfile.minikube
Istio-Minikube and Jenkins
# Portions Copyright 2016 The Kubernetes Authors All rights reserved.
# Portions Copyright 2018 AspenMesh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jglick
jglick / backport.sh
Last active June 10, 2024 20:52
Example of setting up a Jenkins plugin backport branch
BASE=1.19 # or whatever; last release compatible with targeted core or other deps
BASETAG=mystuff-${BASE} # or as per http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#tagNameFormat
FIX=abcd1234 # whatever the backportable fix was, in master or somewhere newer than $BASE
git checkout -b ${BASE}.x $(git log --reverse --ancestry-path --pretty=%H ${BASETAG}..master | head -1)
# or for JEP-305 (“Incrementals”) use: mvn versions:set-property -Dproperty=revision -DnewVersion=${BASE}.1
mvn versions:set -DnewVersion=${BASE}.1-SNAPSHOT -DgenerateBackupPoms=false
git commit -a -m "Prepare for ${BASE}.1"
git push -u origin ${BASE}.x
git cherry-pick -x -m1 $FIX
mvn -B release:{prepare,perform}
@jglick
jglick / .gitconfig
Created October 20, 2017 19:56
git first-child
[alias]
# http://stackoverflow.com/a/30010601/12916
first-child = "!f() { git log --reverse --ancestry-path --pretty=%H $1..${2:-HEAD} | head -1; }; f"
@jglick
jglick / .gitconfig
Created September 1, 2017 17:47
git out
[alias]
out = !git log --patch-with-stat --irreversible-delete --find-renames @{u}.. > /tmp/out.diff && $EDITOR /tmp/out.diff
@jglick
jglick / find-git-unreleased.sh
Last active July 25, 2019 19:20
run with optional args, e.g., {workflow,pipeline}-*-plugin
#!/bin/bash
# http://stackoverflow.com/a/37730085/12916
if [ $# -ge 1 ]
then
files="$@"
else
files=*
fi
for r in $files
do
@jglick
jglick / JENKINS-41745-proposal.md
Last active August 22, 2017 18:22
Proposal for JENKINS-41745: Remoting-free CLI

Summary

JENKINS-41745: Deprecate the Remoting-based protocol for the Jenkins CLI feature. Enhance the client and server to conveniently perform most existing CLI tasks with simpler and safer protocols.

Goals

@jglick
jglick / maven-release.sh
Last active October 23, 2022 13:50
Script to do a Maven release relatively safely
#!/bin/sh
set -e
git branch
git status -s
git pull
git log --patch-with-stat --irreversible-delete --find-renames @{u}..
gitg
gh pr list || :
git tag --sort=version:refname
@jglick
jglick / git-grep-dired.el
Last active June 1, 2023 21:21
Emacs command to look for a regexp among versioned files in a Git repo
(defun git-grep-dired (repo wildcards regexp)
"Find Git-controlled files in DIR with a name like WILDCARDS containing a regexp REGEXP and start Dired on output."
(interactive "DGit-grep (directory): \nsGit-grep (filename wildcard(s), e.g. *.xml): \nsGit-grep (grep regexp): ")
(setq repo (file-name-as-directory (expand-file-name repo)))
(switch-to-buffer (concat "*Git Grep " repo "*"))
(fundamental-mode)
(setq buffer-read-only nil)
(erase-buffer)
(setq default-directory repo)
(let ((cmd (format "git --git-dir %s/.git ls-files --recurse-submodules -z%s | xargs -0 grep -lZ -- %s | xargs -0 ls -l"