Added retired block counts for disk

Added retired block counts for disk

#!/bin/bash

#	Check S.M.A.R.T. (check_smart.sh)
#	by Dan Barrett
#	http://yesdevnull.net

#	v1.0 - 9 Aug 2013
#	Initial release.

#	Read S.M.A.R.T. data from the specified disk using smartmontools
#	(http://sourceforge.net/apps/trac/smartmontools/wiki)

#	Arguments:
#	-d	Drive BSD name (disk0/disk1 etc)
#	-g	Graph item(s)

#	Example:
#	./check_smart.sh -d disk0 -g "badSectors tempCelcius"

#	Performance Data
#	* badSectors		Number of bad sectors on disk
#	* reallocSectors	Number of re-allocated sectors on disk
#	* powerOnHours		Number of hours the disk has been powered on for
#	* tempCelcius		Temperature in celcius of the disk (internal)
#	* retiredBlockCount	Number of retired blocks

disk=""
graphs=""
graphString=""

badSectors=0
reallocSectors=0

# Get the flags!
while getopts "d:g:" opt
	do
		case $opt in
			d ) disk=$OPTARG;;
			g ) graphs=$OPTARG;;
		esac
done

# enable SMART on the drive if it is not already
smartoncmd=`/opt/local/libexec/nagios/smartctl --smart=on --saveauto=on $disk`

resultString=`/opt/local/libexec/nagios/smartctl -H $disk`

if echo $graphs | grep -q -E "[A-Za-z ]+"
then
	graphString="|"
fi

# Did user want badSectors graph?
if echo $graphs | grep -q "badSectors"
then
	badSectors=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Reallocated_Sector_Ct' | grep -E -o "[0-9]+" | tail -1 `
	graphString="$graphString badSectors=$badSectors;"
fi

# Did user want reallocSectors graph?
if echo $graphs | grep -q "reallocSectors"
then
	reallocSectors=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Reallocated_Event_Count' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString reallocSectors=$reallocSectors;"
fi

# Did user want powerOnHours graph?
if echo $graphs | grep -q "powerOnHours"
then
	powerOnHours=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Power_On_Hours' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString powerOnHours=$powerOnHours;"
fi

# Did user want tempCelcius graph?
if echo $graphs | grep -q "tempCelcius"
then
	internalTemp=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Temperature_Celsius' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString tempCelcius=$internalTemp;"
fi

if echo $graphs | grep -q "retiredBlockCount"
then
	retiredBlockCount=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Retired_Block_Count' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString retiredBlockCount=$retiredBlockCount;"
fi

if echo $resultString | grep -q "PASSED"
then
  	printf "OK - All S.M.A.R.T. attributes passed $graphString\n"
  	exit 0
else
	# Get the first line that is FAILING_NOW
	failString=`echo $resultString | grep -C 0 'FAILING_NOW'`
	# Now we make a human readable error message
	if echo $failString | grep -q "Reallocated_Sector_Ct\|Reallocated_Event_Count"
	then
		printf "CRITICAL - Drive has bad sectors! $graphString\n"
		exit 2
	elif echo $failString | grep -q "Command_Timeout"
	then
		printf "CRITICAL - Drive is having constant timeout issues, check any power sources! $graphString\n"
		exit 2
	elif echo $failString | grep -q "Temperature_Celsius"
	then
		printf "CRITICAL - Drive is exposed to extreme temperatures! $graphString\n"
		exit 2
	else
		printf "WARNING - Drive has failing S.M.A.R.T. attributes! $graphString\n"
		exit 1
	fi
fi

#!/bin/bash

#	Check S.M.A.R.T. (check_smart.sh)
#	by Dan Barrett
#	http://yesdevnull.net

#	v1.0 - 9 Aug 2013
#	Initial release.

#	Read S.M.A.R.T. data from the specified disk using smartmontools
#	(http://sourceforge.net/apps/trac/smartmontools/wiki)

#	Arguments:
#	-d	Drive BSD name (disk0/disk1 etc)
#	-g	Graph item(s)

#	Example:
#	./check_smart.sh -d disk0 -g "badSectors tempCelcius"

#	Performance Data
#	* badSectors		Number of bad sectors on disk
#	* reallocSectors	Number of re-allocated sectors on disk
#	* powerOnHours		Number of hours the disk has been powered on for
#	* tempCelcius		Temperature in celcius of the disk (internal)

disk=""
graphs=""
graphString=""

badSectors=0
reallocSectors=0

# Get the flags!
while getopts "d:g:" opt
	do
		case $opt in
			d ) disk=$OPTARG;;
			g ) graphs=$OPTARG;;
		esac
done

# enable SMART on the drive if it is not already
smartoncmd=`/opt/local/libexec/nagios/smartctl --smart=on --saveauto=on $disk`

resultString=`/opt/local/libexec/nagios/smartctl -H $disk`

if echo $graphs | grep -q -E "[A-Za-z ]+"
then
	graphString="|"
fi

# Did user want badSectors graph?
if echo $graphs | grep -q "badSectors"
then
	badSectors=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Reallocated_Sector_Ct' | grep -E -o "[0-9]+" | tail -1 `
	graphString="$graphString badSectors=$badSectors;"
fi

# Did user want reallocSectors graph?
if echo $graphs | grep -q "reallocSectors"
then
	reallocSectors=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Reallocated_Event_Count' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString reallocSectors=$reallocSectors;"
fi

# Did user want powerOnHours graph?
if echo $graphs | grep -q "powerOnHours"
then
	powerOnHours=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Power_On_Hours' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString powerOnHours=$powerOnHours;"
fi

# Did user want tempCelcius graph?
if echo $graphs | grep -q "tempCelcius"
then
	internalTemp=`/opt/local/libexec/nagios/smartctl -a $disk | grep -C 0 'Temperature_Celsius' | grep -E -o "[0-9]+" | tail -1`
	graphString="$graphString tempCelcius=$internalTemp;"
fi

if echo $resultString | grep -q "PASSED"
then
  	printf "OK - All S.M.A.R.T. attributes passed $graphString\n"
  	exit 0
else
	# Get the first line that is FAILING_NOW
	failString=`echo $resultString | grep -C 0 'FAILING_NOW'`
	# Now we make a human readable error message
	if echo $failString | grep -q "Reallocated_Sector_Ct\|Reallocated_Event_Count"
	then
		printf "CRITICAL - Drive has bad sectors! $graphString\n"
		exit 2
	elif echo $failString | grep -q "Command_Timeout"
	then
		printf "CRITICAL - Drive is having constant timeout issues, check any power sources! $graphString\n"
		exit 2
	elif echo $failString | grep -q "Temperature_Celsius"
	then
		printf "CRITICAL - Drive is exposed to extreme temperatures! $graphString\n"
		exit 2
	else
		printf "WARNING - Drive has failing S.M.A.R.T. attributes! $graphString\n"
		exit 1
	fi
fi


Update shell_snapshot_kvm.sh.

Update shell_snapshot_kvm.sh.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jerry-0824/017_stone.git/'


adding example runner

adding example runner

python examples/prettyjson.py test/json/one.json
python examples/json.py test/json/one.json
python examples/parse_c.py text/c/hanoi.c
python examples/prettyc.py text/c/hanoi.c
python examples/minify.py text/c/hanoi.c

error: pathspec 'run_examples.sh' did not match any file(s) known to git


download ufw tool

download ufw tool

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/TOTVS/mdmpublic.git/'


create tmp subdir structure in ensembl-live/

#!/bin/sh

for d in export  failure_dir  img  persistent  procedure  temporary  udcCache
do echo $d
   mkdir -p tmp/$d
done

error: pathspec 'scripts/misc-scripts/create_tmp_dir.sh' did not match any file(s) known to git


Add script for purging local S3 cache

Add script for purging local S3 cache

#!/bin/bash

#
# Removes CHI cache files older than 3 (or $ARGV[1]) days
#

set -e

PWD="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

MC_ROOT="$PWD/../"
S3_CACHE_ROOT="$MC_ROOT/data/cache/s3_downloads/"
S3_CACHE_DEFAULT_DIR="$S3_CACHE_ROOT/Default/"

if [ ! -z "$1" ]; then
    if [[ ! "$1" =~ ^-?[0-9]+$ ]]; then
        echo "Max. age in days is not an integer."
        exit 1
    fi
    MAX_AGE_DAYS="$1"
else
    MAX_AGE_DAYS="3"
fi

#
# ---
#

if [ ! -d "$S3_CACHE_DEFAULT_DIR" ]; then
    echo "S3 cache 'Default' directory does not exist at: $S3_CACHE_DEFAULT_DIR"
    exit 1
fi

# Verify that the directory has the "0", "1", "2", ..., "e", "f" directory structure
if [ ! -d "$S3_CACHE_DEFAULT_DIR/0" ]; then
    echo "S3 cache 'Default' directory doesn't look like it contains CHI cache: $S3_CACHE_DEFAULT_DIR"
    exit 1
fi

find "$S3_CACHE_DEFAULT_DIR" -type f -mtime "+$MAX_AGE_DAYS" -exec rm {} \;

exit 0

error: pathspec 'script/purge_local_s3_downloads_cache.sh' did not match any file(s) known to git


include a setup script for new starters

include a setup script for new starters

#!/bin/bash

echo "This command will setup your local dev environment, including"
echo "  * bundle install"
echo

echo "Bundling..."
bundle install --binstubs bin --path .bundle

error: pathspec 'script/setup.sh' did not match any file(s) known to git


Added setup script

Added setup script

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mattcurf/tb2s_setup.git/'


small upgrade script.

small upgrade script.

#!/bin/sh

# remove old osnet profile modules.
cd .. && ./coscli.sh module --purge rewrite
./coscli.sh module --purge rewrite_manip

error: pathspec 'scripts/1.11.sh' did not match any file(s) known to git


-source-serif-pro +source-serif

-source-serif-pro +source-serif

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/vitorgalvao/dotfiles.git/'


jsvc.sh

jsvc.sh

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/JianMingZhuo/NIOCopy.git/'


additional test script

additional test script

error: pathspec 'scripts/test/curl-bitbucket-nocommand.sh' did not match any file(s) known to git


Add shell option to start the daemon on CentOS

Unless a valid shell for the user running influxdb, the command su fails with
the error:
 This account is currently not available.

The user shouldn't have a valid shell although the package creates influxdb
user with /bin/bash

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Tony133/influxdb.git/'


Create fillProdDBwithPosts.sh

Create fillProdDBwithPosts.sh

#!/bin/bash

for x in {0..900..1};
do mysql -h"10.0.0.1" -uroot -p"mysecpas" wordpress < ./naredba;
done

error: pathspec 'fillProdDBwithPosts.sh' did not match any file(s) known to git


Fixed start shell script.

Fixed start shell script.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cschuller/yakjs.git/'


Initial implementation of printer.discovery.sh to refresh list of network printers

#!/bin/bash

# CUPS forgets, from time to time, the list od network browsers.
# This command is to refresh it, so I do not need to remember which service to restart
/usr/bin/sudo /usr/bin/systemctl restart cups-browsed.service

exit $?
#EOF

error: pathspec 'printer.discovery.sh' did not match any file(s) known to git


adds script to quickly start nvim on linux machines

#!/usr/bin/env bash

cd ~
curl -fLO https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -fLo ~/.config/nvim/init.vim https://raw.githubusercontent.com/dbldots/dotfiles/master/files/_config/nvim/init.vim
chmod +x nvim.appimage
sudo ln -s ~/nvim.appimage /usr/local/bin/nvim
nvim

error: pathspec 'scripts/nvim.sh' did not match any file(s) known to git


added - test script

added - test script

#!/bin/bash -eux

terraform plan
terraform graph
terraform apply
terraform output
terraform destroy
terraform plan

error: pathspec 'scripts/test.sh' did not match any file(s) known to git


Do not delete (non-existent) concatvcf images

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/szilvajuhos/CAW.git/'


Create vagrant.sh

Create vagrant.sh

#!/bin/bash

set -eu

# Create the user vagrant with password vagrant
useradd -G sudo -p $(perl -e'print crypt("vagrant", "vagrant")') -m -s /bin/bash -N vagrant

# Set up sudo
echo %vagrant ALL=NOPASSWD:ALL > /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant

# Installing vagrant keys
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys
chmod 600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
chmod -R go-rwsx /home/vagrant/.ssh

# Install NFS for Vagrant
apt-get -y update
apt-get -y install nfs-common

error: pathspec 'src/scripts/vagrant.sh' did not match any file(s) known to git


Inserted slpTesh.sh file with execute permissions

#! /bin/sh

# Testcases for sfcb when slp is enabled using 'slptool'

success=0
failure=0
rc=0

slptool register service:test://localhost "(test-suite=sfcb-test suite)"
if [ $? == 0 ]; then
    let success="$success+1"
    echo "Service register success"
else
    let failure="$failure+1"
    echo "Service registration Failed"
fi

if  [ $? == 0 ] ; then

   slptool unicastfindsrvs 127.0.0.1  service:test
   if [ $? == 0 ]; then
       let success="$success+1"
   else
       let failure="$failure+1"
   fi

   slptool unicastfindsrvs 127.0.0.1  service:test "(test-suite=sfcb-test suite)"
   if [ $? == 0 ]; then
       let success="$success+1"
   else
       let failure="$failure+1"
   fi

   slptool unicastfindattrs 127.0.0.1 service:test
   if [ $? == 0 ]; then
       let success="$success+1"
   else
       let failure="$failure+1"
   fi

   slptool unicastfindattrs 127.0.0.1 service:test://localhost test-suite
   if [ $? == 0 ]; then
       let success="$success+1"
   else
       let failure="$failure+1"
   fi

   slptool deregister service:test://localhost
   if [ $? == 0 ]; then
       let success="$success+1"
       echo "Service deregister Success"
   else
       let failure="$failure+1"
       echo "Service deregistration Failed"
   fi

fi

echo "$success tests were Success : $failure tests Failed"
echo "***** SLP Tests Completed *****"

if [ $failure -gt 0 ]; then
	rc=1
fi

exit $rc

error: pathspec 'test/slptest/slpTest.sh' did not match any file(s) known to git


add docker cheat sheat

add docker cheat sheat

#!/bin/bash

# for bash in OSX, source in ~/.bash_profile

dockerStopAndRm() {
    docker rm $(docker stop $1)
}

# connect to docker-machine

echo 'connecting to docker-machine'
eval $(docker-machine env)

# handy alias
alias dps="docker ps -a"
alias dockerclean="docker images | grep \"<none>\" | awk '{print \$3}' | xargs docker rmi"
alias dstoprm=dockerStopAndRm

error: pathspec 'dockercheatsheat.sh' did not match any file(s) known to git


add shellscripts

add shellscripts

export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
export MAHOUT_HOME=~/Downloads/mahout-distribution-0.10.1/
export SPARK_HOME=~/Downloads/spark-1.3.1/
export MASTER=spark://case:7077

infile="/home/lukas/Documents/infile/inputfile"
outfile="/home/lukas/Documents/outfile/"

/home/lukas/Downloads/mahout-distribution-0.10.0/bin/mahout spark-itemsimilarity --input $infile --output $outfile

#spark-itemsimilarity --input $infile --output $outfile

error: pathspec 'shellscripts/run_spark_itemsimilarity.sh' did not match any file(s) known to git


Run tests script

Run tests script

#!/bin/bash

find . -maxdepth 1 -type f -name '*.scm' | while read test; do
    echo -e "\033[1mRunning tests in ${test}\033[0m"
    racket -r $test
    echo
done

error: pathspec 'exercises/01/run-tests.sh' did not match any file(s) known to git


basic coreg shell script. still needs a masking function

#! /bin/bash

#basic pc_align workflow

#define variables

max_displacement=1000

num_itt=2000

ref_dem='AST14DEM_00310232003045929_20161116155805_13266.tif'

source_dem='AST14DEM_00311102004045819_20161116155805_13272.tif'

output='AST14DEM_00311102004045819_20161116155805_13272_align'

echo 'create mask'

dem_mask.py $ref_dem

echo 'masked reference'

echo 'starting co-reg'

#coreg two dems
pc_align --max-displacement $max_displacement --num-iterations $num_itt \
--compute-translation-only --save-transformed-source-points \
$ref_dem $source_dem -o $output | tee test.log

echo 'co-reg complete. now converting point cloud to dem'

#create coreg rem
apply_dem_translation.py $source_dem test.log

echo 'done'

error: pathspec 'glacierhack_pcalign.sh' did not match any file(s) known to git


Added build script for apiclient binary.

#!/usr/bin/env bash

# Copyright (c) 2013 Galah Group LLC
# Copyright (c) 2013 Other contributers as noted in the CONTRIBUTERS file
#
# This file is part of galah-apiclient.
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# From here on every command will be printed out before it is executed
set -x

# From here on if any command fails the script will abort
set -e

cd $DIR

# Create a temporary build directory to construct the apiclient binary.
TEMP_DIR=`mktemp -d`
cp -r ./apiclient $TEMP_DIR/
cp -r ./galah $TEMP_DIR/__main__.py

# Download dependencies and install into TEMP_DIR
REQUESTS_DIR=`mktemp -d`
cd $REQUESTS_DIR

# This will download the requests library but not install it.
pip install -d . requests

# Untar the library then delete the archive, making sure the resulting module
# is named requests.
tar xzf requests-*.tar.gz
rm requests-*.tar.gz
mv requests-* requests

mv requests $TEMP_DIR/
cd $TEMP_DIR
rm -rf $REQUESTS_DIR
echo "Downloaded and untarred requests package"

YAML_DIR=`mktemp -d`
cd $YAML_DIR

# This will download the requests library but not install it.
pip install -d . pyyaml

# Untar the library then delete the archive, making sure the resulting module
# is named requests.
unzip PyYAML-*.zip
rm PyYAML-*.zip
mv PyYAML-* yaml

mv yaml $TEMP_DIR/
cd $TEMP_DIR
rm -rf $YAML_DIR
echo "Downloaded and unzipped PyYAML package"

# Create the final zip archive
cd $TEMP_DIR
zip -r $DIR/galah-apiclient.zip *
echo "Created zip galah-apiclient.zip in $DIR"

# Turn zip archive into packaged executable
cd $DIR
echo '#!'`which python` | cat - galah-apiclient.zip > galah-client
chmod +x galah-client
rm galah-apiclient.zip

# Clean up anything left over
rm -rf $TEMP_DIR

# Unset the trap so we don't freak the user out by telling them an error has
# occured when everything went fine.
trap - EXIT

error: pathspec 'build_apiclient.sh' did not match any file(s) known to git


Add a script to dump graphs for all functions in the kernel

#!/bin/bash

set -x

SOURCES="sources"
CONFIG="config"
TREE="/home/lgeorget/Documents/THESE/linux/"
CLEAN=1
VERSION="master"

while getopts ":hs:kV:c:" opt; do
  case $opt in
    h)
cat <<EOF
Usage: $0 -s <source files list> -c <config file> -t <linux source tree path>

$0 is used to extract activity diagrams from functions of the Linux kernel code
base.
The options '-s' and '-t' take exactly one argument, which have a
default value:
	-s <source files list>: this parameter is the path of a file
	containing the list of files to compile, one per line.
	The files must be given as path relative to the kernel top directory.
	The functions of the functions list should be a subset of the functions
	implemented in those files. Otherwise, some diagrams will be missing.
	The default value is "$SOURCES".
	-c <config file>: this parameter is the path of the config file.
	The configuration is written in YAML. The configuration should look like
	the following:
		- general:
			- category:
				- 1: <how to output category 1 nodes and edges>
				- 2: <how to output category 2 nodes and edges>
				-...
		- <source file (relative path from the kernel source tree root)>:
			- category: <overload of the 'general' section's 'category'
			- functions: [<list of functions to graph in this file>]
		- <other source file>:
		...
	-t <linux source tree path>: this parameter is the location of the linux
	source tree from which activity diagrams have to be extracted. The
	default value is "$TREE".
	-k: this flags when it is set tells $0 not to clean remove the temporary
	files after extracting activity diagrams (mnemonics: "keep").
	-V: this parameters tells $0 to checkout a specific version of the
	kernel. Any commit number or version tag is fine. The default is 'master'.
EOF
      exit 0
      ;;
    \?)
      echo "Usage: $0 -s <source files list>" >&2
      exit 1
      ;;
    :)
      echo "Option -$OPTARG requires an argument." >&2
      exit 1
      ;;
    s)
      SOURCES="$OPTARG"
      ;;
    c)
      CONFIG="$OPTARG"
      ;;
    t)
      TREE="$OPTARG"
      ;;
    k)
      CLEAN=0
      ;;
    V)
      VERSION="$OPTARG"
      ;;
  esac
done

error=0
if [[ ! -e $SOURCES ]] || [[ ! -r $SOURCES ]]
then
	echo "The source files list \"$SOURCES\" does not exist or is not readable." >&2
	echo "See $0 -h for help." >&2
	error=1
fi

if [[ ! -e $CONFIG ]] || [[ ! -r $CONFIG ]]
then
	echo "The configuration file \"$CONFIG\" does not exist or is not readable." >&2
	echo "See $0 -h for help." >&2
	error=1
fi

if [[ ! -e $TREE ]] || [[ ! -d $TREE ]] || [[ ! -x $TREE ]]
then
	echo "The linux source tree path \"$TREE\" is invalid." >&2
	echo "Do you have sufficient permission?" >&2
	echo "See $0 -h for help." >&2
	error=1
fi

[[ $error == 1 ]] && exit 2

OLDDIR=$(pwd)
tree_clone=$(mktemp -d)
git clone $TREE $tree_clone
cd $tree_clone
git add remote linux  git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch linux
git checkout $VERSION || exit 3
rm -f .config
make defconfig || exit 4
cd "$OLDDIR"
cp "$CONFIG" "$tree_clone/config"

make CFLAGS_KERNEL="-fplugin=cgrapher4gcc -x c"  -C "$tree_clone" bzImage
find $tree_clone -name '*.c.dump' | tar cvf dump-all.tar --transform "s/"${tree_clone//\//\\\/}"/linux-"${VERSION//\//\\\/}"/"-T -

# TODO : make all of this work somehow
#
#tar xvf dump-all.tar
#for i in *.c.dump
#do
#	./clip.pl < $i
#done
#for i in *.dot
#do
#	dot $i -Tpng > ${i/%dot/png}
#done

 if [[ $CLEAN == 1 ]]
 then
 	find \( -name '*.dump' -o -name '*.dot' \) -exec rm -f {} \+
 fi

 rm -rf $tree_clone

error: pathspec 'kayrebtdumpall.sh' did not match any file(s) known to git


Create EnableBatterySuspend.sh

Create EnableBatterySuspend.sh

#!/bin/sh

if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root"
   exit 1
fi

# systemd.timers
echo "[Unit]
Description=Check for low battery every 1m

[Timer]
OnBootSec=10
OnUnitActiveSec=1m

[Install]
WantedBy=timers.target" > /etc/systemd/system/low-battery.timer

# systemd.service
echo "[Unit]
Description=Hibernate if battery is low

[Service]
Type=oneshot
ExecStart=/etc/systemd/system/low-battery.sh" > /etc/systemd/system/low-battery.service

# low-battery.sh
echo "acpi -b | grep 'Battery 1' | awk -F'[,:%]' '{print $2, $3}' | {
     read -r status capacity

     msg=\"Battery is: \$status, \$capacity%\"

     if [ \"\$status\" = Discharging ] && [ \"\$capacity\" -lt 5 ]; then
         critMsg=\"Critical Battery Threshold.\"

         logger \"\$critMsg \$msg\"

         systemctl hibernate
     else
         logger \"Battery Not Low. \$msg\"
     fi
}" > /etc/systemd/system/low-battery.sh

chmod +x /etc/systemd/system/low-battery.sh

systemctl enable low-battery.timer
systemctl start low-battery.timer

error: pathspec 'Arch/Scripts/EnableBatterySuspend.sh' did not match any file(s) known to git


-a

-a

added a shell script to upload to the fleet

#!/bin/bash
cmd='pio run -t upload --upload-port=192.168.1.'
if [ $# -eq 0 ]; then
  echo "usage: upload.sh args, where args are a list of last octets of IPs to update."
  echo "example: 'upload.sh 119 124' updates devices at 192.168.1.119 and 192.168.1.124."
fi
RETRIES=5
for ip in $*; do
  COUNTER=1
  echo "*** $ip: Attempt 1 of $RETRIES, '$cmd$ip'"
  $cmd$ip
  while [[ $? -ne 0 && COUNTER -lt RETRIES ]]; do
    COUNTER=$[ COUNTER + 1 ]
    echo "*** $ip: Attempt $COUNTER of $RETRIES, '$cmd$ip'"
    $cmd$ip
  done
done

error: pathspec 'upload.sh' did not match any file(s) known to git


Check if gcutil is insstalled

Check if gcutil is insstalled

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ThomasMarcel/fedora_configuration.git/'


fix typo

fix typo

#!/bin/bash

# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script downloads the test files from the build bucket and makes some executable.

# The script expects the following env variables:
# OS_ARCH: The operating system and the architecture separated by a hyphen '-' (e.g. darwin-amd64, linux-amd64, windows-amd64)
# VM_DRIVER: the vm-driver to use for the test
# EXTRA_START_ARGS: additional flags to pass into minikube start
# EXTRA_ARGS: additional flags to pass into minikube
# JOB_NAME: the name of the logfile and check name to update on github

readonly TEST_ROOT="${HOME}/minikube-integration"
readonly TEST_HOME="${TEST_ROOT}/${OS_ARCH}-${VM_DRIVER}-${MINIKUBE_LOCATION}-$$-${COMMIT}"
echo ">> Starting at $(date)"
echo ""
echo "arch:      ${OS_ARCH}"
echo "build:     ${MINIKUBE_LOCATION}"
echo "driver:    ${VM_DRIVER}"
echo "job:       ${JOB_NAME}"
echo "test home: ${TEST_HOME}"
echo "sudo:      ${SUDO_PREFIX}"
echo "kernel:    $(uname -v)"
echo "uptime:    $(uptime)"
# Setting KUBECONFIG prevents the version ceck from erroring out due to permission issues
echo "kubectl:   $(env KUBECONFIG=${TEST_HOME} kubectl version --client --short=true)"
echo "docker:    $(docker version --format '{{ .Client.Version }}')"

case "${VM_DRIVER}" in
  kvm2)
    echo "virsh:     $(virsh --version)"
  ;;
  virtualbox)
    echo "vbox:      $(vboxmanage --version)"
  ;;
esac

echo ""
mkdir -p out/ testdata/

# Install gsutil if necessary.
if ! type -P gsutil >/dev/null; then
  if [[ ! -x "out/gsutil/gsutil" ]]; then
    echo "Installing gsutil to $(pwd)/out ..."
    curl -s https://storage.googleapis.com/pub/gsutil.tar.gz | tar -C out/ -zxf -
  fi
  PATH="$(pwd)/out/gsutil:$PATH"
fi

# Add the out/ directory to the PATH, for using new drivers.
PATH="$(pwd)/out/":$PATH
export PATH

echo ""
echo ">> Downloading test inputs from ${MINIKUBE_LOCATION} ..."
gsutil -qm cp \
  "gs://minikube-builds/${MINIKUBE_LOCATION}/minikube-${OS_ARCH}" \
  "gs://minikube-builds/${MINIKUBE_LOCATION}/docker-machine-driver"-* \
  "gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH}" out

gsutil -qm cp -r "gs://minikube-builds/${MINIKUBE_LOCATION}/testdata"/* testdata/

gsutil -qm cp "gs://minikube-builds/${MINIKUBE_LOCATION}/gvisor-addon" testdata/

# Set the executable bit on the e2e binary and out binary
export MINIKUBE_BIN="out/minikube-${OS_ARCH}"
export E2E_BIN="out/e2e-${OS_ARCH}"
chmod +x "${MINIKUBE_BIN}" "${E2E_BIN}" out/docker-machine-driver-*
"${MINIKUBE_BIN}" version

procs=$(pgrep "minikube-${OS_ARCH}|e2e-${OS_ARCH}" || true)
if [[ "${procs}" != "" ]]; then
  echo "Warning: found stale test processes to kill:"
  ps -f -p ${procs} || true
  kill ${procs} || true
  kill -9 ${procs} || true
fi

# Quickly notice misconfigured test roots
mkdir -p "${TEST_ROOT}"

# Cleanup stale test outputs.
echo ""
echo ">> Cleaning up after previous test runs ..."
for entry in $(ls ${TEST_ROOT}); do
  test_path="${TEST_ROOT}/${entry}"
  ls -lad "${test_path}" || continue

  echo "* Cleaning stale test path: ${test_path}"
  for tunnel in $(find ${test_path} -name tunnels.json -type f); do
    env MINIKUBE_HOME="$(dirname ${tunnel})" ${MINIKUBE_BIN} tunnel --cleanup || true
  done

  for home in $(find ${test_path} -name .minikube -type d); do
    env MINIKUBE_HOME="$(dirname ${home})" ${MINIKUBE_BIN} delete --all || true
    sudo rm -Rf "${home}"
  done

  for kconfig in $(find ${test_path} -name kubeconfig -type f); do
    sudo rm -f "${kconfig}"
  done

  # Be very specific to avoid accidentally deleting other items, like wildcards or devices
  if [[ -d "${test_path}" ]]; then
    rm -Rf "${test_path}" || true
  elif [[ -f "${test_path}" ]]; then
    rm -f "${test_path}" || true
  fi
done

# sometimes tests left over zombie procs that won't exit
# for example:
# jenkins  20041  0.0  0.0      0     0 ?        Z    Aug19   0:00 [minikube-linux-] <defunct>
zombie_defuncts=$(ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}')
if [[ "${zombie_defuncts}" != "" ]]; then
  echo "Found zombie defunct procs to kill..."
  ps -f -p ${zombie_defuncts} || true
  kill ${zombie_defuncts} || true
fi

if type -P virsh; then
  virsh -c qemu:///system list --all --uuid \
    | xargs -I {} sh -c "virsh -c qemu:///system destroy {}; virsh -c qemu:///system undefine {}" \
    || true
  echo ">> virsh VM list after clean up (should be empty):"
  virsh -c qemu:///system list --all || true
fi

if type -P vboxmanage; then
  killall VBoxHeadless || true
  sleep 1
  killall -9 VBoxHeadless || true

  for guid in $(vboxmanage list vms | grep -Eo '\{[a-zA-Z0-9-]+\}'); do
    echo "- Removing stale VirtualBox VM: $guid"
    vboxmanage startvm "${guid}" --type emergencystop || true
    vboxmanage unregistervm "${guid}" || true
  done

  ifaces=$(vboxmanage list hostonlyifs | grep -E "^Name:" | awk '{ print $2 }')
  for if in $ifaces; do
    vboxmanage hostonlyif remove "${if}" || true
  done

  echo ">> VirtualBox VM list after clean up (should be empty):"
  vboxmanage list vms || true
  echo ">> VirtualBox interface list after clean up (should be empty):"
  vboxmanage list hostonlyifs || true
fi

if type -P hdiutil; then
  hdiutil info | grep -E "/dev/disk[1-9][^s]" || true
  hdiutil info \
      | grep -E "/dev/disk[1-9][^s]" \
      | awk '{print $1}' \
      | xargs -I {} sh -c "hdiutil detach {}" \
      || true
fi

# cleaning up stale hyperkits
if type -P hyperkit; then
  for pid in $(pgrep hyperkit); do
    echo "Killing stale hyperkit $pid"
    ps -f -p $pid || true
    kill $pid || true
    kill -9 $pid || true
  done
fi

if [[ "${VM_DRIVER}" == "hyperkit" ]]; then
  if [[ -e out/docker-machine-driver-hyperkit ]]; then
    sudo chown root:wheel out/docker-machine-driver-hyperkit || true
    sudo chmod u+s out/docker-machine-driver-hyperkit || true
  fi
fi

kprocs=$(pgrep kubectl || true)
if [[ "${kprocs}" != "" ]]; then
  echo "error: killing hung kubectl processes ..."
  ps -f -p ${kprocs} || true
  sudo -E kill ${kprocs} || true
fi

# clean up none drivers binding on 8443
  none_procs=$(sudo lsof -i :8443 | tail -n +2 | awk '{print $2}' || true)
  if [[ "${none_procs}" != "" ]]; then
    echo "Found stale api servers listening on 8443 processes to kill: "
    for p in $none_procs
    do
    echo "Kiling stale none driver:  $p"
    sudo -E ps -f -p $p || true
    sudo -E kill $p || true
    sudo -E kill -9 $p || true
    done
  fi

function cleanup_stale_routes() {
  local show="netstat -rn -f inet"
  local del="sudo route -n delete"

  if [[ "$(uname)" == "Linux" ]]; then
    show="ip route show"
    del="sudo ip route delete"
  fi

  local troutes=$($show | awk '{ print $1 }' | grep 10.96.0.0 || true)
  for route in ${troutes}; do
    echo "WARNING: deleting stale tunnel route: ${route}"
    $del "${route}" || true
  done
}

cleanup_stale_routes || true

mkdir -p "${TEST_HOME}"
export MINIKUBE_HOME="${TEST_HOME}/.minikube"
export KUBECONFIG="${TEST_HOME}/kubeconfig"

# Build the gvisor image so that we can integration test changes to pkg/gvisor
chmod +x ./testdata/gvisor-addon
# skipping gvisor mac because ofg https://github.com/kubernetes/minikube/issues/5137
if [ "$(uname)" != "Darwin" ]; then
  # Should match GVISOR_IMAGE_VERSION in Makefile
  docker build -t gcr.io/k8s-minikube/gvisor-addon:2 -f testdata/gvisor-addon-Dockerfile ./testdata
fi

readonly LOAD=$(uptime | egrep -o "load average.*: [0-9]+" | cut -d" " -f3)
if [[ "${LOAD}" -gt 2 ]]; then
  echo ""
  echo "********************** LOAD WARNING ********************************"
  echo "Load average is very high (${LOAD}), which may cause failures. Top:"
  if [[ "$(uname)" == "Darwin" ]]; then
    # Two samples, macOS does not calculate CPU usage on the first one
    top -l 2 -o cpu -n 5 | tail -n 15
  else
    top -b -n1 | head -n 15
  fi
  echo "********************** LOAD WARNING ********************************"
  echo "Sleeping 30s to see if load goes down ...."
  sleep 30
  uptime
fi

e2e_start_time="$(date -u +%s)"
echo ""
echo ">> Starting ${E2E_BIN} at $(date)"
set -x
${SUDO_PREFIX}${E2E_BIN} \
  -minikube-start-args="--vm-driver=${VM_DRIVER} ${EXTRA_START_ARGS}" \
  -expected-default-driver="${EXPECTED_DEFAULT_DRIVER}" \
  -test.timeout=70m \
  ${EXTRA_TEST_ARGS} \
  -binary="${MINIKUBE_BIN}" && result=$? || result=$?
set +x
echo ">> ${E2E_BIN} exited with ${result} at $(date)"
echo ""
e2e_end_time="$(date -u +%s)"
elapsed=$(($e2e_end_time-$e2e_start_time))
elapsed=$(bc <<< "scale=2;$elapsed/60")
description="Finished in ${elapsed} minute(s)."
echo $description

if [[ $result -eq 0 ]]; then
  status="success"
  echo "minikube: SUCCESS"
else
  status="failure"
  echo "minikube: FAIL"
fi

echo ">> Cleaning up after ourselves ..."
${SUDO_PREFIX}${MINIKUBE_BIN} tunnel --cleanup || true
${SUDO_PREFIX}${MINIKUBE_BIN} delete >/dev/null 2>/dev/null || true
cleanup_stale_routes || true

${SUDO_PREFIX} rm -Rf "${MINIKUBE_HOME}" || true
${SUDO_PREFIX} rm -f "${KUBECONFIG}" || true
rmdir "${TEST_HOME}"
echo ">> ${TEST_HOME} completed at $(date)"

if [[ "${MINIKUBE_LOCATION}" == "master" ]]; then
  exit $result
fi

# retry_github_status provides reliable github status updates
function retry_github_status() {
  local commit=$1
  local context=$2
  local state=$3
  local token=$4
  local target=$5
  local desc=$6

   # Retry in case we hit our GitHub API quota or fail other ways.
  local attempt=0
  local timeout=2
  local code=-1

  while [[ "${attempt}" -lt 8 ]]; do
    local out=$(mktemp)
    code=$(curl -o "${out}" -s --write-out "%{http_code}" -L \
      "https://api.github.com/repos/kubernetes/minikube/statuses/${commit}?access_token=${token}" \
      -H "Content-Type: application/json" \
      -X POST \
      -d "{\"state\": \"${state}\", \"description\": \"Jenkins: ${desc}\", \"target_url\": \"${target}\", \"context\": \"${context}\"}" || echo 999)

    # 2xx HTTP codes
    if [[ "${code}" =~ ^2 ]]; then
      break
    fi

    cat "${out}" && rm -f "${out}"
    echo "HTTP code ${code}! Retrying in ${timeout} .."
    sleep "${timeout}"
    attempt=$(( attempt + 1 ))
    timeout=$(( timeout * 2 ))
  done
}

retry_github_status "${COMMIT}" "${JOB_NAME}" "${status}" "${access_token}" "https://storage.googleapis.com/minikube-builds/logs/${MINIKUBE_LOCATION}/${JOB_NAME}.txt" "${description}"
exit $result

#!/bin/bash

# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# 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
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script downloads the test files from the build bucket and makes some executable.

# The script expects the following env variables:
# OS_ARCH: The operating system and the architecture separated by a hyphen '-' (e.g. darwin-amd64, linux-amd64, windows-amd64)
# VM_DRIVER: the vm-driver to use for the test
# EXTRA_START_ARGS: additional flags to pass into minikube start
# EXTRA_ARGS: additional flags to pass into minikube
# JOB_NAME: the name of the logfile and check name to update on github

readonly TEST_ROOT="${HOME}/minikube-integration"
readonly TEST_HOME="${TEST_ROOT}/${OS_ARCH}-${VM_DRIVER}-${MINIKUBE_LOCATION}-$$-${COMMIT}"
echo ">> Starting at $(date)"
echo ""
echo "arch:      ${OS_ARCH}"
echo "build:     ${MINIKUBE_LOCATION}"
echo "driver:    ${VM_DRIVER}"
echo "job:       ${JOB_NAME}"
echo "test home: ${TEST_HOME}"
echo "sudo:      ${SUDO_PREFIX}"
echo "kernel:    $(uname -v)"
echo "uptime:    $(uptime)"
# Setting KUBECONFIG prevents the version ceck from erroring out due to permission issues
echo "kubectl:   $(env KUBECONFIG=${TEST_HOME} kubectl version --client --short=true)"
echo "docker:    $(docker version --format '{{ .Client.Version }}')"

case "${VM_DRIVER}" in
  kvm2)
    echo "virsh:     $(virsh --version)"
  ;;
  virtualbox)
    echo "vbox:      $(vboxmanage --version)"
  ;;
esac

echo ""
mkdir -p out/ testdata/

# Install gsutil if necessary.
if ! type -P gsutil >/dev/null; then
  if [[ ! -x "out/gsutil/gsutil" ]]; then
    echo "Installing gsutil to $(pwd)/out ..."
    curl -s https://storage.googleapis.com/pub/gsutil.tar.gz | tar -C out/ -zxf -
  fi
  PATH="$(pwd)/out/gsutil:$PATH"
fi

# Add the out/ directory to the PATH, for using new drivers.
PATH="$(pwd)/out/":$PATH
export PATH

echo ""
echo ">> Downloading test inputs from ${MINIKUBE_LOCATION} ..."
gsutil -qm cp \
  "gs://minikube-builds/${MINIKUBE_LOCATION}/minikube-${OS_ARCH}" \
  "gs://minikube-builds/${MINIKUBE_LOCATION}/docker-machine-driver"-* \
  "gs://minikube-builds/${MINIKUBE_LOCATION}/e2e-${OS_ARCH}" out

gsutil -qm cp -r "gs://minikube-builds/${MINIKUBE_LOCATION}/testdata"/* testdata/

gsutil -qm cp "gs://minikube-builds/${MINIKUBE_LOCATION}/gvisor-addon" testdata/

# Set the executable bit on the e2e binary and out binary
export MINIKUBE_BIN="out/minikube-${OS_ARCH}"
export E2E_BIN="out/e2e-${OS_ARCH}"
chmod +x "${MINIKUBE_BIN}" "${E2E_BIN}" out/docker-machine-driver-*
"${MINIKUBE_BIN}" version

procs=$(pgrep "minikube-${OS_ARCH}|e2e-${OS_ARCH}" || true)
if [[ "${procs}" != "" ]]; then
  echo "Warning: found stale test processes to kill:"
  ps -f -p ${procs} || true
  kill ${procs} || true
  kill -9 ${procs} || true
fi

# Quickly notice misconfigured test roots
mkdir -p "${TEST_ROOT}"

# Cleanup stale test outputs.
echo ""
echo ">> Cleaning up after previous test runs ..."
for entry in $(ls ${TEST_ROOT}); do
  test_path="${TEST_ROOT}/${entry}"
  ls -lad "${test_path}" || continue

  echo "* Cleaning stale test path: ${test_path}"
  for tunnel in $(find ${test_path} -name tunnels.json -type f); do
    env MINIKUBE_HOME="$(dirname ${tunnel})" ${MINIKUBE_BIN} tunnel --cleanup || true
  done

  for home in $(find ${test_path} -name .minikube -type d); do
    env MINIKUBE_HOME="$(dirname ${home})" ${MINIKUBE_BIN} delete --all || true
    sudo rm -Rf "${home}"
  done

  for kconfig in $(find ${test_path} -name kubeconfig -type f); do
    sudo rm -f "${kconfig}"
  done

  # Be very specific to avoid accidentally deleting other items, like wildcards or devices
  if [[ -d "${test_path}" ]]; then
    rm -Rf "${test_path}" || true
  elif [[ -f "${test_path}" ]]; then
    rm -f "${test_path}" || true
  fi
done

# sometimes tests left over zombie procs that won't exit
# for example:
# jenkins  20041  0.0  0.0      0     0 ?        Z    Aug19   0:00 [minikube-linux-] <defunct>
zombie_defuncts=$(ps -A -ostat,ppid | awk '/[zZ]/ && !a[$2]++ {print $2}')
if [[ "${zombie_defuncts}" != "" ]]; then
  echo "Found zombie defunct procs to kill..."
  ps -f -p ${zombie_defuncts} || true
  kill ${zombie_defuncts} || true
fi

if type -P virsh; then
  virsh -c qemu:///system list --all --uuid \
    | xargs -I {} sh -c "virsh -c qemu:///system destroy {}; virsh -c qemu:///system undefine {}" \
    || true
  echo ">> virsh VM list after clean up (should be empty):"
  virsh -c qemu:///system list --all || true
fi

if type -P vboxmanage; then
  killall VBoxHeadless || true
  sleep 1
  killall -9 VBoxHeadless || true

  for guid in $(vboxmanage list vms | grep -Eo '\{[a-zA-Z0-9-]+\}'); do
    echo "- Removing stale VirtualBox VM: $guid"
    vboxmanage startvm "${guid}" --type emergencystop || true
    vboxmanage unregistervm "${guid}" || true
  done

  ifaces=$(vboxmanage list hostonlyifs | grep -E "^Name:" | awk '{ print $2 }')
  for if in $ifaces; do
    vboxmanage hostonlyif remove "${if}" || true
  done

  echo ">> VirtualBox VM list after clean up (should be empty):"
  vboxmanage list vms || true
  echo ">> VirtualBox interface list after clean up (should be empty):"
  vboxmanage list hostonlyifs || true
fi

if type -P hdiutil; then
  hdiutil info | grep -E "/dev/disk[1-9][^s]" || true
  hdiutil info \
      | grep -E "/dev/disk[1-9][^s]" \
      | awk '{print $1}' \
      | xargs -I {} sh -c "hdiutil detach {}" \
      || true
fi

# cleaning up stale hyperkits
if type -P hyperkit; then
  for pid in $(pgrep hyperkit); do
    echo "Killing stale hyperkit $pid"
    ps -f -p $pid || true
    kill $pid || true
    kill -9 $pid || true
  done
fi

if [[ "${VM_DRIVER}" == "hyperkit" ]]; then
  if [[ -e out/docker-machine-driver-hyperkit ]]; then
    sudo chown root:wheel out/docker-machine-driver-hyperkit || true
    sudo chmod u+s out/docker-machine-driver-hyperkit || true
  fi
fi

kprocs=$(pgrep kubectl || true)
if [[ "${kprocs}" != "" ]]; then
  echo "error: killing hung kubectl processes ..."
  ps -f -p ${kprocs} || true
  sudo -E kill ${kprocs} || true
fi

# clean up none drivers binding on 8443
  none_procs=$(sudo lsof -i :8443 | tail -n +2 | awk '{print $2}' || true)
  if [[ "${none_procs}" != "" ]]; then
    echo "Found stale api servers listening on 8443 processes to kill: "
    for p in $none_procs
    do
    echo "Kiling stale none driver:  $p"
    sudo -E ps -f -p $p || true
    sudo -E kill $p || true
    sudo -E kill -9 $p || true
    done
  fi

function cleanup_stale_routes() {
  local show="netstat -rn -f inet"
  local del="sudo route -n delete"

  if [[ "$(uname)" == "Linux" ]]; then
    show="ip route show"
    del="sudo ip route delete"
  fi

  local troutes=$($show | awk '{ print $1 }' | grep 10.96.0.0 || true)
  for route in ${troutes}; do
    echo "WARNING: deleting stale tunnel route: ${route}"
    $del "${route}" || true
  done
}

cleanup_stale_routes || true

mkdir -p "${TEST_HOME}"
export MINIKUBE_HOME="${TEST_HOME}/.minikube"
export KUBECONFIG="${TEST_HOME}/kubeconfig"

# Build the gvisor image so that we can integration test changes to pkg/gvisor
chmod +x ./testdata/gvisor-addon
# skipping gvisor mac because ofg https://github.com/kubernetes/minikube/issues/5137
if [ "$(uname)" != "Darwin" ]; then
  # Should match GVISOR_IMAGE_VERSION in Makefile
  docker build -t gcr.io/k8s-minikube/gvisor-addon:2 -f testdata/gvisor-addon-Dockerfile ./testdata
fi

readonly LOAD=$(uptime | egrep -o "load average.*: [0-9]+" | cut -d" " -f3)
if [[ "${LOAD}" -gt 2 ]]; then
  echo ""
  echo "********************** LOAD WARNING ********************************"
  echo "Load average is very high (${LOAD}), which may cause failures. Top:"
  if [[ "$(uname)" == "Darwin" ]]; then
    # Two samples, macOS does not calculate CPU usage on the first one
    top -l 2 -o cpu -n 5 | tail -n 15
  else
    top -b -n1 | head -n 15
  fi
  echo "********************** LOAD WARNING ********************************"
  echo "Sleeping 30s to see if load goes down ...."
  sleep 30
  uptime
fi

e2e_start_time="$(date -u +%s)"
echo ""
echo ">> Starting ${E2E_BIN} at $(date)"
set -x
${SUDO_PREFIX}${E2E_BIN} \
  -minikube-start-args="--vm-driver=${VM_DRIVER} ${EXTRA_START_ARGS}" \
  -expected-default-driver="${EXPECTED_DEFAULT_DRIVER}" \
  -test.timeout=70m \
  ${EXTRA_TEST_ARGS} \
  -binary="${MINIKUBE_BIN}" && result=$? || result=$?
set +x
echo ">> ${E2E_BIN} exited with ${result} at $(date)"
echo ""
e2e_end_time="$(date -u +%s)"
elapsed=$(($end_time-$start_time))
elapsed=$(bc <<< "scale=2;$elapsed/60")
description="Finished in ${elapsed} minute(s)."
echo $description

if [[ $result -eq 0 ]]; then
  status="success"
  echo "minikube: SUCCESS"
else
  status="failure"
  echo "minikube: FAIL"
fi

echo ">> Cleaning up after ourselves ..."
${SUDO_PREFIX}${MINIKUBE_BIN} tunnel --cleanup || true
${SUDO_PREFIX}${MINIKUBE_BIN} delete >/dev/null 2>/dev/null || true
cleanup_stale_routes || true

${SUDO_PREFIX} rm -Rf "${MINIKUBE_HOME}" || true
${SUDO_PREFIX} rm -f "${KUBECONFIG}" || true
rmdir "${TEST_HOME}"
echo ">> ${TEST_HOME} completed at $(date)"

if [[ "${MINIKUBE_LOCATION}" == "master" ]]; then
  exit $result
fi

# retry_github_status provides reliable github status updates
function retry_github_status() {
  local commit=$1
  local context=$2
  local state=$3
  local token=$4
  local target=$5
  local desc=$6

   # Retry in case we hit our GitHub API quota or fail other ways.
  local attempt=0
  local timeout=2
  local code=-1

  while [[ "${attempt}" -lt 8 ]]; do
    local out=$(mktemp)
    code=$(curl -o "${out}" -s --write-out "%{http_code}" -L \
      "https://api.github.com/repos/kubernetes/minikube/statuses/${commit}?access_token=${token}" \
      -H "Content-Type: application/json" \
      -X POST \
      -d "{\"state\": \"${state}\", \"description\": \"Jenkins: ${desc}\", \"target_url\": \"${target}\", \"context\": \"${context}\"}" || echo 999)

    # 2xx HTTP codes
    if [[ "${code}" =~ ^2 ]]; then
      break
    fi

    cat "${out}" && rm -f "${out}"
    echo "HTTP code ${code}! Retrying in ${timeout} .."
    sleep "${timeout}"
    attempt=$(( attempt + 1 ))
    timeout=$(( timeout * 2 ))
  done
}

retry_github_status "${COMMIT}" "${JOB_NAME}" "${status}" "${access_token}" "https://storage.googleapis.com/minikube-builds/logs/${MINIKUBE_LOCATION}/${JOB_NAME}.txt" "${description}"
exit $result


Create slack-backup.sh

Create slack-backup.sh

#!/bin/bash
# slack-backup.sh
# by Chris Holt 2016-04-18

# Purpose:
#  Download slack history then convert it into browsable HTML files

version="1.0"
author="Chris Holt, @humor4fun"

printf "Slack-Backup $version by $author\n Thanks for using this tool to log your Slack channels.\n"
if [[ -z "$1" ]]
 then
	printf "ERROR: cannot proceed with ($1) as the Slack API token. Please supply your Slack API token as a parameter."
	printf " \n token can be generated here: https://api.slack.com/web"
	printf "\n\n Usage:\n\tslack-backup.sh abcd-0123456789-0123456789-01234567890-abc123def4\n"
	exit 401
fi

printf "\nPerforming software updates/installs to make sure you have everything we need, then we'll get started.\n"
	apt-get -y install php5-common php5-cli wget
	wget -qO- https://deb.nodesource.com/setup | bash -
	apt-get -y install nodejs
	npm install npm -g
	npm install slack-history-export -g

printf "\nSetting up working environment..."
	directory="slack-backup_`date +%Y-%m-%d-%H.%M.%S`"
	debug="$directory/_debug"
	mkdir $directory $debug
	slack_token=$1

#Get a json response from the slack API then clean it up; remove the first X lines of the responses that show:
	#{
	#    "ok": true,
	#    "channels":
	## and the last line that shows:
	#}
# from all files created as a result of the wget api calls.

printf "\nGetting Channel meta data...\n"
	wget https://slack.com/api/channels.list?token=$slack_token -O "channels.list.json"
printf "\nCleaning Channel meta data...\n"
	sed 's/{\"ok\":true,\"channels\"://1w tmp.json' channels.list.json
	sed '$ s/.$//w channels.json' tmp.json
	rm -v tmp.json
	mv -v channels.list.json $debug
	mv -v channels.json $directory

printf "\nGetting Users meta data...\n"
	wget https://slack.com/api/users.list?token=$slack_token -O "users.list.json"
printf "\nCleaning Users meta data...\n"
	sed 's/{\"ok\":true,\"members\"://1w tmp.json' users.list.json
	sed '$ s/.$//w users.json' tmp.json
	rm -v tmp.json
	mv -v users.list.json $debug
	mv -v users.json $directory

printf "\nGetting IntegrationLogs data...\n"
	wget https://slack.com/api/team.integrationLogs.list?token=$slack_token -O "team.integrationLogs.json"
printf "\nCleaning IntegrationLogs data...\n"
	sed 's/{\"ok\":true,\"members\"://1w tmp.json' team.IntegrationLogs.json
	printf "[\n\n]" >> integration_logs.json
		#most users won't have slack-admin rights for this, check for an error and if it occured then just write a blank file "[\n]"
	#if you have slack-admin rights then use the sed line below
	#sed '$ s/.$//w integration_logs.json' tmp.json
	rm -v tmp.json
	mv -v team.integrationLogs.json $debug
	mv -v integration_logs.json $directory

printf "\nGetting optional meta data...\n"
	wget https://slack.com/api/team.info?token=$slack_token -O "$debug/team.info.json"
	wget https://slack.com/api/reminders.list?token=$slack_token -O "$debug/reminders.list.json"
	wget https://slack.com/api/emoji.list?token=$slack_token -O "$debug/emoji.list.json"
printf "\nDone fetching meta data.\n"

#this piece is coming soon
printf "\nGetting list of all chat threads...\n"
	wget https://slack.com/api/im.list?token=$slack_token -O "$debug/im.list.json"
	wget https://slack.com/api/groups.list?token=$slack_token -O "$debug/groups.list.json"
	wget https://slack.com/api/channels.list?token=$slack_token -O "$debug/channels.list.json"
	#wget https://slack.com/api/mpim.list?token=$slack_token -O "$debug/mpim.list.json"
		#slack-history-export can't handle these yet
	#wget https://slack.com/api/mpim.history?token=$slack_token&channel=$mpim_channel -O "$debug/mpim.history.json"
printf "\nParsing chat thread lists...\n"
	#python parse-json.py im.list.json > dm_list
	#mv -v im.list.json $debug
	#python parse-json.py groups.list.json > private_list
	#mv -v groups.list.json $debug
	#python parse-json.py channels.list.json > public_list
	#mv -v channels.list.json $debug

printf "\nGetting Direct Messages...\n"
dm_list=( "insert" "your" "list" "by" "hand" )
#generate a list of IMs from the im.list.json file
for dm in "${dm_list[@]}"
do
	printf "\nDM with: $dm\n"
	dir="$directory/$dm"
	mkdir $dir
	slack-history-export --token $slack_token --type 'dm' --username $dm --directory $dir #--filename $dm
done

printf "\nGetting Private channels...\n"
private_list=( "insert" "your" "list" "by" "hand" )
#generate a list of channels from the groups.list.json file
for dm in "${private_list[@]}"
do
	printf "\nPrivate Channel: $dm\n"
	dir="$directory/$dm"
	mkdir $dir
	slack-history-export --token $slack_token --type 'group' --group $dm --directory $dir #--filename "$dm"
done

printf "\nGetting Public channels...\n"
public_list=( "insert" "your" "list" "by" "hand" )
#generate a list of channels from the channels.list.json file
for dm in "${public_list[@]}"
do
	printf "\nPublic Channel: $dm\n"
	dir="$directory/$dm"
	mkdir $dir
	slack-history-export --token $slack_token --type 'channel' --channel $dm --directory $dir #--filename "$dm"
done

printf "\nFinished downloading history.\n"

printf "\nGetting prettifying resources...\n"
	cd $directory
	wget "https://gist.githubusercontent.com/dharmastyle/5d1e8239c5684938db0b/raw/cf1afe32967c6b497ed1ed97ca4a8ab5ee3df953/slack-json-2-html.php"
	chmod 777 slack-json-2-html.php

printf "\nMaking things pretty...\n"
	php slack-json-2-html.php

printf "\nCleaning up...\n"
	rm "slack-json-2-html.php"
	mv -v *.json $debug
	cd ..
	mv -v slack2html/ $directory/
	cd $directory
	mv slack2html _slacklog_ui

printf "\nCompleted Task.\n"
exit 200

error: pathspec 'slack-backup.sh' did not match any file(s) known to git


Add script that starts the dev server after making sure we are under chroot.

Review URL: http://codereview.chromium.org/414015

git-svn-id: 59a3318ba88c04536d83f47c63c52b7f675c4a1a@299 06c00378-0e64-4dae-be16-12b19f9950a1

#!/bin/bash

# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Start the Dev Server after making sure we are running under a chroot.

COMMON_SH="$(dirname "$0")/../../scripts/common.sh"
. "$COMMON_SH"

# Script must be run inside the chroot.
assert_inside_chroot

python devserver.py

error: pathspec 'start-devserver.sh' did not match any file(s) known to git


Fix too large buffer for shairport (2)

Fix too large buffer for shairport (2)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lesander/shairport-notify.git/'


give it some time for the influx daemon to start up

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/brownlegion/testfleet.git/'


Create docker-entrypoint.sh

Create docker-entrypoint.sh

#!/bin/bash
set -e

do_reset_config() {
	/setMyCnf.sh
}

reset_root_pw() {
	if ! grep -q ${MYSQL_ROOT_PASSWORD} /root/.my.cnf ; then
			echo "resetting mysql root pw"
	        /usr/bin/mysqladmin -u root password "${MYSQL_ROOT_PASSWORD}"
	        mv -f /root/postConfig.my.cnf /root/.my.cnf
	fi

}

case "$*" in
   bash)
      bash
   ;;
   start)
		echo "reseting my.cnf"
		do_reset_config
		echo "Starting Mysql"
		if [ -f /var/run/mysqld/mysqld.sock ]; then
			rm /var/run/mysqld/mysqld.sock
		fi
		if [ -f ${DATADIR}/mysqld.pid ]; then
			rm ${DATADIR}/mysqld.pid
		fi
		mysqld_safe

		#if [ ${USE_KEEPALIVED} = true ]; then
		#	/etc/init.d/keepalived start
		#fi
		#HACK to get Docker to stay running while in Daemon mode, tail stays in the foreground
		mysqladmin --silent --wait=300 ping || exit 1 && tail -f /dev/null
	;;
	bootstrap)
		echo "Bootstrappping Mysql"
		do_reset_config
		if [ -f /var/run/mysqld/mysqld.sock ]; then
			rm /var/run/mysqld/mysqld.sock
		fi
		if [ -f ${DATADIR}/mysqld.pid ]; then
			rm ${DATADIR}/mysqld.pid
		fi
		/etc/init.d/mysql bootstrap-pxc & mysqladmin --silent --wait=300 ping || exit 1
		reset_root_pw
		#if [ ${USE_KEEPALIVED} = true ]; then
		#	/etc/init.d/keepalived start
		#fi
		#HACK to get Docker to stay running while in Daemon mode, tail stays in the foreground
		mysqladmin --silent --wait=300 ping || exit 1 && tail -f /dev/null
	;;
	*)
		echo "Use either start or bootstrap"
	;;
esac

error: pathspec 'docker-entrypoint.sh' did not match any file(s) known to git


Script to run all JMeter tests without a GUI.

#!/bin/sh
# Run all the tests in this directory once locally without starting the jmeter gui.
jmeter -n -q local-1.properties -t list-attendance.jmx
jmeter -n -q local-1.properties -t list-grades.jmx
jmeter -n -q local-1.properties -t list-sections.jmx
jmeter -n -q local-1.properties -t list-students.jmx
jmeter -n -q local-1.properties -t single-student.jmx
jmeter -n -q local-1.properties -t update-attendance.jmx
jmeter -n -q local-1.properties -t update-gradebooks.jmx

error: pathspec 'tools/jmeter/run-all-nogui.sh' did not match any file(s) known to git


Added tests.

Added tests.

See https://github.com/sstephenson/bats for details of test framework.

#!/bin/bash

@setup {
	TOMCAT="../tomcat.sh"
	PIDS=$(pidoff tomcat)
	for pid in PIDS do
		kill pid
		sleep 5
	done
	#OUTPUT=""
}

######## General Functions #######

# Print an error message on standard output.
# $1 Message to print.
#print_error() {
#	echo "ERROR: $1"
#}

# Print an success message on standard output.
# $1 Message to print.
#print_success() {
#	echo "SUCCESS: $1"
#}

# $1 commad to tomcat script.
#call_tomcat_script() {
#	OUTPUT=$($TOMCAT $1)
#	return $?
#}

# Run a test.
# $1: Test name.
# $2: tomcat command.
# $3: Error message.
# $4: Success message.
#test() {
#	echo $1
#	call_tomcat_script $2
#
#	if [ $? -ne 0 ]; then
#		print_error $3
#	else
#		print_success $4
#	fi
#}

######## evn config  #######

# Start in a clean enviroment.
#TEMP=$($TOMCAT stop)

#if [ $? -ne 0 ]; then
#	print_error "Can't set a clean enviroment."
#fi

######## Tests #######

#test "Start tomcat" start \
#	"Tomcat failed to start, check SERVICE_START_WAIT_TIME value on /etc/default/tomcat" \
#	"Tomcat started"
@test Start tomcat {
	run $TOMCAT start
	[ "$status" -eq 0 ]
}

@test Double start tomcat {
	run $TOMCAT start
	[ "$status" -eq 0 ]

	run $TOMCAT start
	[ "$status" -eq 1 ]

}

#test "Stop tomcat" stop \
#	"Tomcat failed to stop." \
#	"Tomcat stoped"

#test "Restart tomcat" restart \
#	"Tomcat failed to restart" \
#	"Tomcat restarted"

#test "Reload tomcat" reload \
#	"Tomcat failed to reload" \
#	"Tomcat reloaded"

#test "Force-reload tomcat" force-reload \
#	"Tomcat failed to force-reload" \
#	"Tomcat foced to reload"

#test "Try restart tomcat" try-restart \
#	"Tomcat failed to try-restart" \
#	"Tomcat restarted"

error: pathspec 'tests/tomcat_tests.bats' did not match any file(s) known to git


Create create_rescue_disk.sh

Create create_rescue_disk.sh

#! /usr/bin/env bash
#
# Make bootable device

device=/dev/sdc
partnum=2
part=$device$partnum

echo "Installing to $part"

#mkfs.ext4 $part

mount $part /mnt

#force in case of "do not proceed with blocklists"
#sudo grub-install --force --root-directory=/mnt $part

#write grub.cfg
cat > /mnt/boot/grub/grub.cfg << EOF

if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

#menuentry "Try Lubuntu without installing" {
#set gfxpayload=keep
#linux/casper/vmlinuz.efi  file=/cdrom/preseed/lubuntu.seed boot=casper quiet splash ---
#initrd/casper/initrd.lz
#}

menuentry "GParted Live" {
loopback loop (hostdisk/$device,$partnum)/isos
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=gparted.iso quiet splash
initrd (loop)/casper/initrd.lz
}

EOF

umount $part

echo "Done"

error: pathspec 'Scripts/NixScripts/create_rescue_disk.sh' did not match any file(s) known to git


Syntax error.

Syntax error.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/demonchild2112/travis-test.git/'


Create curl-install.sh

Create curl-install.sh

git clone git@github.com:tomasperezv/vim-is-great.git
cd vim-is-great
sh setup.sh

error: pathspec 'curl-install.sh' did not match any file(s) known to git


Enable core dump

Enable core dump

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/amilaperera/oh-my-zsh.git/'


Rudimentary build script

Rudimentary build script

#! /usr/bin/env bash

php composer.phar install
php app/console assets:install web
php app/console cache:clear

error: pathspec 'build.sh' did not match any file(s) known to git


First commit of the build script

First commit of the build script

#!/bin/bash -e
SOURCE_FILE=$NAME-$VERSION.tar.gz
# Add the module for the CI environment
module load ci

# add dependencies
module load gmp/5.1.3

if [[ ! -e $SRC_DIR/$SOURCE_FILE ]] ; then
  echo "Seems we are building from scratch - preparing "
  mkdir -p $SRC_DIR
  wget http://mirror.ufs.ac.za/gnu/gnu/mpfr/$SOURCE_FILE -O $SRC_DIR/$SOURCE_FILE
fi
tar -xvzf $SRC_DIR/$SOURCE_FILE -C $WORKSPACE
cd $WORKSPACE/$NAME-$VERSION
./configure --prefix $SOFT_DIR --with-gmp=$GMP_DIR
make -j 8


Travis update

Travis update

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lcomstive/CoffeeEngine.git/'


adding Makefile.am for rampart

adding Makefile.am for rampart

git-svn-id: f9726a030cf96f23c68a92ccd14a73e10c8cadff@1739 a5903396-d722-0410-b921-86c7d4935375

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/techhead/wsf_php.git/'


Initial commit

Initial commit

build.sh, shell script to --/build/-- whole "iamprabhat®" in one go.
Usage: $ sh build.sh


Build script update

Build script update

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Atema/Booqie.git/'


Fixes #12

Fixes #12

#!/bin/bash
set -e
set -x

SHA1=`git rev-parse HEAD`

IMAGE_NAME="zjhsdtc/binance-cpp:latest"
IMAGE_NAME_TAG="zjhsdtc/binance-cpp:${SHA1}"

docker login -u $DOCKER_USER -p $DOCKER_PASSWORD

docker build --tag $IMAGE_NAME -f Dockerfile .
docker tag $IMAGE_NAME $IMAGE_NAME_TAG
docker push $IMAGE_NAME_TAG
docker push $IMAGE_NAME
docker rmi -f $IMAGE_NAME_TAG
docker rmi -f $IMAGE_NAME

DANGLING_IMAGES=`docker images -f "dangling=true" -q`
if [[ -n "$DANGLING_IMAGES" ]]; then
    docker rmi -f $DANGLING_IMAGES
fi

error: pathspec 'push-docker-image.sh' did not match any file(s) known to git


Fuck implicit rules and variables.

Fuck implicit rules and variables.


chmod 0755 build.sh

chmod 0755 build.sh

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/fajro-net/FlexTimer.git/'


Create a set pipeline script

Create a set pipeline script

Signed-off-by: Scott Muc <bc6fe46c111d3e74d7ec89ccf857cb959079fab4@pivotal.io>

#!/bin/bash -eu

if ! which lpass > /dev/null 2>&1
then
  echo "must have lastpass CLI installed" >&2
  exit 1
fi

ssh_key=$(lpass show "Shared-London Services"/london-ci/git-ssh-key --notes)

fly -t london set-pipeline \
    --pipeline rabbitmq-upgrade-preparation \
    --config pipeline.yml \
    --var git-private-key="${ssh_key}"

error: pathspec 'ci/set-pipeline.sh' did not match any file(s) known to git


Generate GPG key, or use existing keys

Generate GPG key, or use existing keys

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/bashrc/freedombone.git/'


Remove proprietary repos first

Remove proprietary repos first


poweramp

poweramp

#!/bin/bash
# Turn on AMP on all BTS, from BTS1 to BTS3
RHIZO_SCRIPT="/home/rhizomatica/bin"
. $RHIZO_SCRIPT/vars.sh
LOGFILE="/var/log/monitor_amp.log"

for bts in $BTS1 $BTS2 $BTS3; do
    logc "Turning on AMP on BTS $bts:";
    ssh root@$bts "sbts2050-util sbts2050-pwr-enable 1 1 0";
done

error: pathspec 'bsc-scripts/turn_off_amplifier.sh' did not match any file(s) known to git


delblock

delblock

#!/usr/local/bin/zsh
strstart=$1
strend=$2
file=$3
grepstart=`grep -B99999999 $strstart $file | grep -v $strstart`
grepend=`grep -A99999999 $strend $file | grep -v $strend`
echo $grepstart
echo $grepend

error: pathspec 'io-scripts/delblock.sh' did not match any file(s) known to git


added helm demo

added helm demo

#! /bin/sh

# install joomla with mariadb
helm install stable/joomla

# delete joomla release
helm delete <releasename>

error: pathspec 'Day2/Demos/Kubernetes/Helm/deploy.sh' did not match any file(s) known to git


Minor tweaks to release tarball process:

1) ensure that juju-core_1.11.4.tar.gz is not include in itself

2) drop leading ./ from paths as this was confusing packaging tooling.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/davecheney/juju.git/'


* check.sh: a make test replacement (rune test_fatal_exception segv and unittests)

#!/bin/sh

dist="out/$1"
test_log_dir=${dist}/test_result
mkdir -p ${test_log_dir}

interactive=no

failed=0

success() {
    test_name="$1"
    test_log="${test_log_dir}/${test_name}.log"
    echo "-----------------" >> $test_log
    shift
    (
        echo -e "${test_name}\t\t (success)"
        if [ -n "$*" ] ; then
            echo "${test_name}: $*"
        fi
    ) | tee -a ${test_log}
}
fail()
{
    test_name="$1"
    test_log="${test_log_dir}/${test_name}.log"
    echo "-----------------" >> $test_log
    shift
    (
        echo -e "${test_name}\t\t (FAIL)"
        if [ -n "$*" ] ; then
            echo "${test_name}: $*"
        fi
    ) | tee -a ${test_log}
    failed=1
}

test_segv()
{
    test_name="test_fatal_exception-segv"
    test_log="${test_log_dir}/${test_name}.log"
    if ! $dist/test_fatal_exception segv &> ${test_log} ; then
        if grep -q "Fatal exception occurred" ${test_log} ; then
            success ${test_name}
        else
            fail ${test_name} "should report exception out stdout/stderr"
        fi
    else
        fail ${test_name} "should exit with non-zero exitcode"
    fi
}
generic_test()
{
    test_name="$1"
    test_log="${test_log_dir}/${test_name}.log"
    if $dist/${test_name} &> ${test_log} ; then
        success ${test_name}
    else
        fail ${test_name}
    fi
}

test_segv
generic_test unittests

exit $failed

error: pathspec 'check.sh' did not match any file(s) known to git


Create std io devices on Android

Create std io devices on Android

# By default, Android does not have /dev/stdin or /dev/stderr, so in order for some of my scripts to work, I need to create them on each boot
if ! ( [ -L /dev/stdin ] && [ -L /dev/stderr ] ); then
  su -c '
    ln -sf /proc/self/fd/0 /dev/stdin &&
    ln -sf /proc/self/fd/2 /dev/stderr
  '
fi

error: pathspec 'system/android.zsh' did not match any file(s) known to git


Indicate with return code 1 that at least one certificate expired Added cert check for Zimbra SSL certificates

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/B-LUC/AdminTools.git/'


manage static file permissions for dockerized nginx

#!/bin/bash
set -e

if [ "$1" = '/bin/true' ]; then
    #ensure that all files have readonly permissions for "others", since nginx is running as non root user
	chmod -R o+r .
	exec "$@"
fi

exec "$@"

error: pathspec 'docker-entrypoint.sh' did not match any file(s) known to git


Switch off line wrapping in case dots occupy extra line

This commit uses the (hopefully) standard rmam and smam escape sequences
which toggle off and on line wrapping respectively.

This is so that extra dots that don't fit the current line won't be
displayed in the next line, which would in turn make the shell
display a new prompt on the next line after the dots are hidden.

I've added a check for $terminfo rmam and smam values to be sure we have
them before printing them out.

If this commit breaks something post an issue with your terminal
emulator and $TERM value and we'll figure out what went wrong.

# fixme - the load process here seems a bit bizarre

unsetopt menu_complete   # do not autoselect the first completion entry
unsetopt flowcontrol
setopt auto_menu         # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end

WORDCHARS=''

zmodload -i zsh/complist

## case-insensitive (all),partial-word and then substring completion
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
  zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  unset CASE_SENSITIVE
else
  if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
    unset HYPHEN_INSENSITIVE
  else
    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  fi
fi

zstyle ':completion:*' list-colors ''

# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history

zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
if [ "$OSTYPE[0,7]" = "solaris" ]
then
  zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
else
  zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
fi

# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories

# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR

# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
        adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
        clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
        gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
        ldap lp mail mailman mailnull man messagebus  mldonkey mysql nagios \
        named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
        operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
        rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
        usbmux uucp vcsa wwwrun xfs '_*'

# ... unless we really want to.
zstyle '*' single-ignored show

if [[ $COMPLETION_WAITING_DOTS = true ]]; then
  expand-or-complete-with-dots() {
    # toggle line-wrapping off and back on again
    [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
    print -Pn "%{%F{red}......%f%}"
    [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam

    zle expand-or-complete
    zle redisplay
  }
  zle -N expand-or-complete-with-dots
  bindkey "^I" expand-or-complete-with-dots
fi

# fixme - the load process here seems a bit bizarre

unsetopt menu_complete   # do not autoselect the first completion entry
unsetopt flowcontrol
setopt auto_menu         # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end

WORDCHARS=''

zmodload -i zsh/complist

## case-insensitive (all),partial-word and then substring completion
if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
  zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  unset CASE_SENSITIVE
else
  if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
    zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
    unset HYPHEN_INSENSITIVE
  else
    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  fi
fi

zstyle ':completion:*' list-colors ''

# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history

zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
if [ "$OSTYPE[0,7]" = "solaris" ]
then
  zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
else
  zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
fi

# disable named-directories autocompletion
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories

# Use caching so that commands like apt and dpkg complete are useable
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR

# Don't complete uninteresting users
zstyle ':completion:*:*:*:users' ignored-patterns \
        adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
        clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
        gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
        ldap lp mail mailman mailnull man messagebus  mldonkey mysql nagios \
        named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
        operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
        rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
        usbmux uucp vcsa wwwrun xfs '_*'

# ... unless we really want to.
zstyle '*' single-ignored show

if [[ $COMPLETION_WAITING_DOTS = true ]]; then
  expand-or-complete-with-dots() {
    print -Pn "%{%F{red}......%f%}"
    zle expand-or-complete
    zle redisplay
  }
  zle -N expand-or-complete-with-dots
  bindkey "^I" expand-or-complete-with-dots
fi