Note that this uses tr
to remove any carriage-returns (as in "\r\n" from Windows or network programs)
# Print only the block of lines before the first double-newline
cat file.txt | tr -d '\r' | \
awk 'BEGIN {RS="\n\n"} NR==1'
If you try to copy a source directory into a symlink to a target directory, you may get an error like:
cp: cannot overwrite non-directory 'symbolic-link' with directory 'source'
.
The solution is to actually copy the .
directory of your source directory.
This is not obvious based on the GNU coreutils FAQ or the man page.
Below is an example to explain:
vagrant@devbox:~/foo$ mkdir bin
This guide will step you through setting up an Ubuntu 18.04 Linux system so that you can login to it using an Active Directory server for authentication and authorization. NOTE: You do not need to join a domain to use this method!!
The net effect of this guide is that you do not need to ever set up a user on your Linux host. Its home directory will be automatically created at log-in time, and its password is checked (along with account expiration) against the Active Directory server.
echo "explain char *(*pfpc)()" | cdecl
$ git clone git@github.com:jenkinsci/configuration-as-code-secret-ssm-plugin.git
$ cd configuration-as-code-secret-ssm-plugin
// from https://stackoverflow.com/questions/9815273/how-to-get-a-list-of-installed-jenkins-plugins-with-name-and-version-pair#12730830 | |
// the sort version doesn't seem to work on my jenkins install | |
Jenkins.instance.pluginManager.plugins.each{ | |
plugin -> | |
println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}") | |
} |
This document explains how to use the Unix tool pass
to manage passwords.
$ sudo apt-get install gnupg2
// To support more types of credentials, look up the credentials plugin code and write | |
// additional groovy to parse those credential types. | |
// | |
// From Mohamed Saeed: https://medium.com/@eng.mohamed.m.saeed/show-all-credentials-value-in-jenkins-using-script-console-83784e95b857 | |
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials( | |
com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class, | |
Jenkins.instance, | |
null, | |
null |
#!/bin/sh | |
set -e | |
_get_cert () { | |
openssl s_client -showcerts -connect "$1":"$2" </dev/null 2>/dev/null | openssl x509 -outform PEM | |
} | |
if [ $# -lt 2 ] ; then | |
echo "Usage: $0 HOST PORT [OUTFILE]" | |
echo "" | |
echo "Connects to TCP PORT on HOST and downloads TLS certificates." | |
echo "Saves to OUTFILE if it is specified, otherwise outputs to standard out." |
#!/bin/sh | |
# defaultenv.sh - Load environment variable defaults and run programs | |
set -e | |
[ x"$DEBUG" = "x1" ] && set -x | |
_load_envrc () { | |
local file="$1"; shift | |
if [ -r "$file" ] ; then | |
# Bourne shell limits how we can test and set env vars, so here I'm |