Updated version number in distribute.sh

Updated version number in distribute.sh

#!/bin/bash

export PYTHONPATH="."

USER="coderxpress"
SERVER="coderxpress.net"
REMOTE_DIR=www-ipopo

# iPOPO Version
VERSION="0.5.5"

# Directories
API_HTML="api"
API_PDF="api-pdf"

# Files
DIST_DIR="dist"
DIST_TGZ="iPOPO-$VERSION.tar.gz"
DIST_ZIP="ipopo-$VERSION.zip"
TEST_ZIP="ipopo-$VERSION-tests.zip"
HTML_ZIP="ipopo-$VERSION-doc-html.zip"
PDF_FILE="ipopo-$VERSION-doc.pdf"
PDF_ZIP="ipopo-$VERSION-doc-pdf.zip"

LATEST_DIST_LINK="ipopo-latest.zip"
LATEST_TEST_LINK="ipopo-latest-tests.zip"
LATEST_HTML_LINK="ipopo-latest-doc-html.zip"
LATEST_PDF_LINK="ipopo-latest-doc-pdf.zip"

# Generate the API
echo "API..."
echo "... HTML ..."
epydoc --html pelix -o "$API_HTML" || exit 1

echo "... PDF ..."
epydoc --pdf pelix -o "$API_PDF" || exit 1

# Compress API files
echo "API Compression..."
echo "... HTML ..."
zip -r "$HTML_ZIP" "$API_HTML" || exit 1

pushd $API_PDF
echo "... PDF ..."
mv "api.pdf" "$PDF_FILE"
zip "$PDF_ZIP" "$PDF_FILE" || exit 1
popd
mv "$API_PDF/$PDF_ZIP" . || exit 1

# Clean up API folders
echo "API clean up..."
rm -fr "$API_HTML"
rm -fr "$API_PDF"

# Test files
echo "Unit tests..."
find tests -name '*.py' -print | zip "$TEST_ZIP" -@

# Python distribution
echo "Python source distribution..."
python setup.py sdist

# Convert the .tgz file into a .zip file
pushd "$DIST_DIR"
echo "... Extracting ..."
tar xf $DIST_TGZ || exit 1

echo "... Adding license ..."
cp ../LICENSE "iPOPO-$VERSION"

echo "... Zipping ..."
zip -r "$DIST_ZIP" "iPOPO-$VERSION"
popd
mv "$DIST_DIR/$DIST_ZIP" .

# Clean up
echo "Clean up distribution..."
rm -fr $DIST_DIR
rm MANIFEST

# Send to CoderXpress
echo "Creating SFTP script..."
BATCH_FILE=$(mktemp)
REMOTE_SHELL="remote_dist_ipopo_$VERSION.sh"
files=("$HTML_ZIP" "$PDF_ZIP" "$DIST_ZIP" "$TEST_ZIP")
for file in ${files[@]}
do
    echo "put '$file'" >> $BATCH_FILE
done
echo "put '$REMOTE_SHELL'" >> $BATCH_FILE

# Make the remote script
echo "Creating remote script..."
cat > "$REMOTE_SHELL" <<END
echo "Moving files..."
mkdir -p $REMOTE_DIR/dl
mv "$DIST_ZIP" "$REMOTE_DIR/dl/"
mv "$TEST_ZIP" "$REMOTE_DIR/dl/"
mv "$HTML_ZIP" "$REMOTE_DIR/dl/"
mv "$PDF_ZIP" "$REMOTE_DIR/dl/"

pushd $REMOTE_DIR
echo "Replacing API..."
rm -fr "$API_HTML"
unzip "dl/$HTML_ZIP"

echo "Making latest links..."
cd dl
ln -sf $DIST_ZIP $LATEST_DIST_LINK
ln -sf $TEST_ZIP $LATEST_TEST_LINK
ln -sf $HTML_ZIP $LATEST_HTML_LINK
ln -sf $PDF_ZIP $LATEST_PDF_LINK
popd
END

echo "Sending files..."
# Batch mode info :
# http://www.derkeiler.com/Newsgroups/comp.security.ssh/2007-06/msg00142.html
sftp -o "batchmode no" -b $BATCH_FILE $USER@$SERVER
rm $BATCH_FILE
rm $REMOTE_SHELL

# Remote script
echo "Remote commands..."
ssh $USER@$SERVER REMOTE_SHELL="$REMOTE_SHELL" "bash -s" <<'ENDSSH'
echo "On remote site - REMOTE SHELL = $REMOTE_SHELL"
bash "$REMOTE_SHELL"
rm "$REMOTE_SHELL"
ENDSSH

echo "All done"

#!/bin/bash

export PYTHONPATH="."

USER="coderxpress"
SERVER="coderxpress.net"
REMOTE_DIR=www-ipopo

# iPOPO Version
VERSION="0.5.4"

# Directories
API_HTML="api"
API_PDF="api-pdf"

# Files
DIST_DIR="dist"
DIST_TGZ="iPOPO-$VERSION.tar.gz"
DIST_ZIP="ipopo-$VERSION.zip"
TEST_ZIP="ipopo-$VERSION-tests.zip"
HTML_ZIP="ipopo-$VERSION-doc-html.zip"
PDF_FILE="ipopo-$VERSION-doc.pdf"
PDF_ZIP="ipopo-$VERSION-doc-pdf.zip"

LATEST_DIST_LINK="ipopo-latest.zip"
LATEST_TEST_LINK="ipopo-latest-tests.zip"
LATEST_HTML_LINK="ipopo-latest-doc-html.zip"
LATEST_PDF_LINK="ipopo-latest-doc-pdf.zip"

# Generate the API
echo "API..."
echo "... HTML ..."
epydoc --html pelix -o "$API_HTML" || exit 1

echo "... PDF ..."
epydoc --pdf pelix -o "$API_PDF" || exit 1

# Compress API files
echo "API Compression..."
echo "... HTML ..."
zip -r "$HTML_ZIP" "$API_HTML" || exit 1

pushd $API_PDF
echo "... PDF ..."
mv "api.pdf" "$PDF_FILE"
zip "$PDF_ZIP" "$PDF_FILE" || exit 1
popd
mv "$API_PDF/$PDF_ZIP" . || exit 1

# Clean up API folders
echo "API clean up..."
rm -fr "$API_HTML"
rm -fr "$API_PDF"

# Test files
echo "Unit tests..."
find tests -name '*.py' -print | zip "$TEST_ZIP" -@

# Python distribution
echo "Python source distribution..."
python setup.py sdist

# Convert the .tgz file into a .zip file
pushd "$DIST_DIR"
echo "... Extracting ..."
tar xf $DIST_TGZ || exit 1

echo "... Adding license ..."
cp ../LICENSE "iPOPO-$VERSION"

echo "... Zipping ..."
zip -r "$DIST_ZIP" "iPOPO-$VERSION"
popd
mv "$DIST_DIR/$DIST_ZIP" .

# Clean up
echo "Clean up distribution..."
rm -fr $DIST_DIR
rm MANIFEST

# Send to CoderXpress
echo "Creating SFTP script..."
BATCH_FILE=$(mktemp)
REMOTE_SHELL="remote_dist_ipopo_$VERSION.sh"
files=("$HTML_ZIP" "$PDF_ZIP" "$DIST_ZIP" "$TEST_ZIP")
for file in ${files[@]}
do
    echo "put '$file'" >> $BATCH_FILE
done
echo "put '$REMOTE_SHELL'" >> $BATCH_FILE

# Make the remote script
echo "Creating remote script..."
cat > "$REMOTE_SHELL" <<END
echo "Moving files..."
mkdir -p $REMOTE_DIR/dl
mv "$DIST_ZIP" "$REMOTE_DIR/dl/"
mv "$TEST_ZIP" "$REMOTE_DIR/dl/"
mv "$HTML_ZIP" "$REMOTE_DIR/dl/"
mv "$PDF_ZIP" "$REMOTE_DIR/dl/"

pushd $REMOTE_DIR
echo "Replacing API..."
rm -fr "$API_HTML"
unzip "dl/$HTML_ZIP"

echo "Making latest links..."
cd dl
ln -sf $DIST_ZIP $LATEST_DIST_LINK
ln -sf $TEST_ZIP $LATEST_TEST_LINK
ln -sf $HTML_ZIP $LATEST_HTML_LINK
ln -sf $PDF_ZIP $LATEST_PDF_LINK
popd
END

echo "Sending files..."
# Batch mode info :
# http://www.derkeiler.com/Newsgroups/comp.security.ssh/2007-06/msg00142.html
sftp -o "batchmode no" -b $BATCH_FILE $USER@$SERVER
rm $BATCH_FILE
rm $REMOTE_SHELL

# Remote script
echo "Remote commands..."
ssh $USER@$SERVER REMOTE_SHELL="$REMOTE_SHELL" "bash -s" <<'ENDSSH'
echo "On remote site - REMOTE SHELL = $REMOTE_SHELL"
bash "$REMOTE_SHELL"
rm "$REMOTE_SHELL"
ENDSSH

echo "All done"


Add http alias to spin up a SimpleHTTPServer

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


build all first

build all first

git-svn-id: 193148810cf65385f3a195dbc9a8b504846da3a2@18244 ec53bebd-3082-4978-b11e-865c3cabbd6b

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/madscientist159/heimdal.git/'


Created show-signal-queues-for-process.sh

#read -p "PID=" pid
pid=$1
cat /proc/$pid/status|egrep '(Sig|Shd)(Pnd|Blk|Ign|Cgt)'|while read name mask;do
    bin=$(echo "ibase=16; obase=2; ${mask^^*}"|bc)
    echo -n "$name $mask $bin "
    i=1
    while [[ $bin -ne 0 ]];do
        if [[ ${bin:(-1)} -eq 1 ]];then
            kill -l $i | tr '\n' ' '
        fi
        bin=${bin::-1}
        set $((i++))
    done
    echo
done
# vim:et:sw=4:ts=4:sts=4:

error: pathspec 'show-signal-queues-for-process.sh' did not match any file(s) known to git


Added passed variables on trigger build "COMMIT"

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/nirareba1969/lifetime-chart.git/'


added theme chooser

added theme chooser

#!/bin/sh

# Zsh Theme Chooser by fox (fox91 at anche dot no)
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.

THEMES_DIR="$ZSH/themes"
FAVLIST="~/.zsh_favlist"

function noyes() {
    read -p "$1 [y/N]" a
    if [[ $a == "N" || $a == "n" || $a = "" ]]; then
        return 0
    fi
    return 1
}

function theme_preview() {
    THEME=$1
    export ZDOTDIR="$(mktemp -d)"

cat <<-EOF >"$ZDOTDIR/.zshrc"
    source ~/.zshrc
    source "$THEMES_DIR/$THEME"
EOF
    zsh
    rm -rf "$ZDOTDIR"

    echo
    noyes "Do you want to add it to your favourite list?" && \
          echo $THEME >> $FAVLIST
    echo
}

echo
echo "╺━┓┏━┓╻ ╻   ╺┳╸╻ ╻┏━╸┏┳┓┏━╸   ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓"
echo "┏━┛┗━┓┣━┫    ┃ ┣━┫┣╸ ┃┃┃┣╸    ┃  ┣━┫┃ ┃┃ ┃┗━┓┣╸ ┣┳┛"
echo "┗━╸┗━┛╹ ╹    ╹ ╹ ╹┗━╸╹ ╹┗━╸   ┗━╸╹ ╹┗━┛┗━┛┗━┛┗━╸╹┗╸"
echo

for i in $(ls $THEMES_DIR); do
    echo "Now showing theme $i"
    theme_preview $i
done

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


add boot2docker environment variables

add boot2docker environment variables

# set the boot2docker environment variables
eval "$(boot2docker shellinit)"

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


Improve the cygnus translator script

Improve the cygnus translator 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/jmcanterafonseca/fiware-cygnus.git/'


git_checkout_name: Track locally when checking out remote branches

This is needed by git-buildpackage, which won't work correctly in
'detached HEAD' state

#!/usr/bin/env bash

#/ Check out a given branch or tag name, if it exists.
#/
#/ This script will try to check out the provided name in the current Git
#/ repository, and will revert back to the name 'master' if the desired one
#/ does not exist.
#/
#/
#/ Arguments
#/ ---------
#/
#/ --name <GitName>
#/
#/   Git branch or tag name that should be checked out, if it exists.
#/
#/   Optional. Default: 'master'.
#/   See also: '--fallback'.
#/
#/ --fallback <FallbackName>
#/
#/   Branch name that should be checked out when a <GitName> has been
#/   requested but it doesn't exist in the current repository.
#/
#/   Optional. Default: 'master'.
#/   See also: '--name'.

# Shell setup
# -----------

BASEPATH="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"  # Absolute canonical path
# shellcheck source=bash.conf.sh
source "$BASEPATH/bash.conf.sh" || exit 1

# Trace all commands
set -o xtrace

# Parse call arguments
# --------------------

CFG_NAME="master"
CFG_FALLBACK="master"

while [[ $# -gt 0 ]]; do
    case "${1-}" in
        --name)
            if [[ -n "${2-}" ]]; then
                CFG_NAME="$2"
                shift
            else
                log "ERROR: --name expects <GitName>"
                log "Run with '--help' to read usage details"
                exit 1
            fi
            ;;
        --fallback)
            if [[ -n "${2-}" ]]; then
                CFG_FALLBACK="$2"
                shift
            else
                log "ERROR: --fallback expects <FallbackName>"
                log "Run with '--help' to read usage details"
                exit 1
            fi
            ;;
    esac
    shift
done

log "CFG_NAME=$CFG_NAME"
log "CFG_FALLBACK=$CFG_FALLBACK"

# Check out the given branch or tag
# ---------------------------------

BRANCH_NAME="refs/remotes/origin/${CFG_NAME}"
TAG_NAME="refs/tags/${CFG_NAME}"

if git rev-parse --verify --quiet "$BRANCH_NAME"; then
    git checkout --track "$BRANCH_NAME"
elif git rev-parse --verify --quiet "$TAG_NAME"; then
    git checkout "$TAG_NAME"
else
    # Use the fallback name
    case "$CFG_FALLBACK" in
        xenial|bionic)
            BRANCH_NAME="refs/remotes/origin/ubuntu/${CFG_FALLBACK}"
            ;;
        *)
            BRANCH_NAME="refs/remotes/origin/${CFG_FALLBACK}"
            ;;
    esac
    if git rev-parse --verify --quiet "$BRANCH_NAME"; then
        git checkout "$BRANCH_NAME"
    else
        git checkout master
    fi
fi

#!/usr/bin/env bash

#/ Check out a given branch or tag name, if it exists.
#/
#/ This script will try to check out the provided name in the current Git
#/ repository, and will revert back to the name 'master' if the desired one
#/ does not exist.
#/
#/
#/ Arguments
#/ ---------
#/
#/ --name <GitName>
#/
#/   Git branch or tag name that should be checked out, if it exists.
#/
#/   Optional. Default: 'master'.
#/   See also: '--fallback'.
#/
#/ --fallback <FallbackName>
#/
#/   Branch name that should be checked out when a <GitName> has been
#/   requested but it doesn't exist in the current repository.
#/
#/   Optional. Default: 'master'.
#/   See also: '--name'.

# Shell setup
# -----------

BASEPATH="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"  # Absolute canonical path
# shellcheck source=bash.conf.sh
source "$BASEPATH/bash.conf.sh" || exit 1

# Trace all commands
set -o xtrace

# Parse call arguments
# --------------------

CFG_NAME="master"
CFG_FALLBACK="master"

while [[ $# -gt 0 ]]; do
    case "${1-}" in
        --name)
            if [[ -n "${2-}" ]]; then
                CFG_NAME="$2"
                shift
            else
                log "ERROR: --name expects <GitName>"
                log "Run with '--help' to read usage details"
                exit 1
            fi
            ;;
        --fallback)
            if [[ -n "${2-}" ]]; then
                CFG_FALLBACK="$2"
                shift
            else
                log "ERROR: --fallback expects <FallbackName>"
                log "Run with '--help' to read usage details"
                exit 1
            fi
            ;;
    esac
    shift
done

log "CFG_NAME=$CFG_NAME"
log "CFG_FALLBACK=$CFG_FALLBACK"

# Check out the given branch or tag
# ---------------------------------

BRANCH_NAME="refs/remotes/origin/${CFG_NAME}"
TAG_NAME="refs/tags/${CFG_NAME}"

if git rev-parse --verify --quiet "$BRANCH_NAME"; then
    git checkout "$BRANCH_NAME"
elif git rev-parse --verify --quiet "$TAG_NAME"; then
    git checkout "$TAG_NAME"
else
    # Use the fallback name
    case "$CFG_FALLBACK" in
        xenial|bionic)
            BRANCH_NAME="refs/remotes/origin/ubuntu/${CFG_FALLBACK}"
            ;;
        *)
            BRANCH_NAME="refs/remotes/origin/${CFG_FALLBACK}"
            ;;
    esac
    if git rev-parse --verify --quiet "$BRANCH_NAME"; then
        git checkout "$BRANCH_NAME"
    else
        git checkout master
    fi
fi


build-api-docs.sh can deploy html to local nginx

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/simonsdave/cloudfeaster-services.git/'


UARTから監視するスクリプト

UARTから監視するスクリプト

#!/bin/bash
# シリアルUARTからMACアドレスを受信し、送信する
# Copyright (c) 2018 Wataru KUNINO

#UART="/dev/ttyUSB0"
UART=""
SENDTO="127.0.0.1"                                  # ローカルへ
DEVICE="adash_1,"
PORT=1024
MAC_LIST=(
    "01:23:45:67:89:AB dash1"
    "00:11:22:33:44:55 dash2"
    "66:77:88:99:AA:BB dash3"
    "CC:DD:EE:FF:00:11 iphone1"
    "22:33:44:55:66:77 iphone7"
)                                                   # 監視対象のMACアドレスと機器名
MAC_NUM=${#MAC_LIST[*]}

UARTS=(`ls /dev/ttyUSB*`) &> /dev/null
if [ ${#UARTS[*]} -lt 1 ]; then
	echo "no UART devices"
	exit
fi
for ((i=0; i < ${#UARTS[*]}; i++)); do
    if [ "$UART" = "${UARTS[i]}" ]; then
		break
	fi
done
if [ $i -eq ${#UARTS[*]} ]; then
	i=$(( i - 1 ))
	UART=${UARTS[i]}
fi
echo "UART["${i}"]="${UART}
stty --file ${UART} 115200 igncr
while true; do                                      # 永久に繰り返し
	UIN=`timeout 1 cat /dev/ttyUSB1`
	delimiter=`echo $UIN|cut -d" " -f1`
	mac=`echo $UIN|cut -d" " -f2`
	if [ "${delimiter}" = "'" ] && [ -n $mac ]; then
		echo -n ${mac}" "
		for (( i=0; i < $MAC_NUM; i++ )); do
			mac_array=(${MAC_LIST[i]})
			mac_address=(${mac_array[0]})
			mac_name=(${mac_array[1]})
			if [ "${mac_address}" = "${mac}" ]; then
				echo $mac_name
				mac_csv=`echo ${mac_address}|tr ":" ","`
				echo ${DEVICE}${i}","${mac_address}","${mac_name} > /dev/udp/${SENDTO}/${PORT}
				break
			fi
		done
		if [ $i -eq $MAC_NUM ]; then
			echo
		fi
	fi
done

error: pathspec '2_example/example29u_dash/uart_mon_dash.sh' did not match any file(s) known to git


add debian.sh

add debian.sh

# Debian 9 script
# I use this to install basic things on my server, so I can run some apps and play around

apt-get update
apt-get install python3-pip git mongodb neovim

useradd onhernandes -m
usermod -a -G sudo onhernandes

pip install virtualenv

systemctl enable mongodb
systemctl start mongodb

git clone git@github.com:onhernandes/dotfiles.git /home/onhernandes/

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


adding deploy script for hook

adding deploy script for hook

#!/bin/bash
cd $(dirname "$(readlink -fn "$0")")
screen -ls | grep botsession && screen -x botsession -X stuff "^C"
screen -ls | grep webserver && screen -x webserver -X stuff "^C"
pip install -r requirements.txt
git submodule init
git submodule update
rm bastard.sqlite
screen -S botsession python bot.py
screen -S webserver python webserver.py

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


Make deploy.sh executable [skip appveyor]

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/OxideMod/CSharpCompiler.git/'


Use .env.docker during deployment

Use .env.docker during deployment

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/endroid/symfony-application.git/'


Create deploy.sh

Create deploy.sh

git ftp catchup -u username -p password --remote-root htdoc/daigou --syncroot build --version --verbose ftp://host.example.com:21


Choise added

Choise added

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/Entframe/fogdeploy.git/'


Add examples of time command.

Add examples of time command.

# Description: time - run programs and summarize system resource usage

# Notes
# None

# Common Examples

# Examples with details
time echo "scale=5000; 4*a(1)" | bc -l -q   # Time to compute PI to 5000 places of decimal.

# Cool Tricks
# 1. A very simple and useful stopwatch. Use CTRL-d to stop.
time read

# TODO
# Explore man pages of this commands.

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


feat: add a little script to add ie8 support to r.js build.js

#!/bin/bash

for dir in */; do
    file="${dir}build.js"
    if [ -f "$file" ] ; then
        sed -i "/})/d"  "$file"
        sed -i "s/}$/},/"  "$file"
        cat <<-EOF >> "$file"

    // support IE8 on r.js 2.2+ and uglify 2.x
    uglify2: {
        max_line_length: 32 * 1024,
        compress: {
            screw_ie8: false
        }
    }
})
EOF
    fi
done

error: pathspec 'json_modify/add-ie8-support-to-rjs-build.sh' did not match any file(s) known to git


Fixed error printing in factor.sh

Fixed error printing in factor.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/mancoast/cado-nfs.git/'


New script to deploy tater to bsve

New script to deploy tater to bsve

#!/bin/bash

rm -fr /tmp/tater.tar*

docker save tater > /tmp/tater.tar
gzip -1 /tmp/tater.tar

aws s3 cp /tmp/tater.tar.gz s3://bsve-integration/tater.tar.gz

sns publish --topic-arn arn:aws:sns:us-east-1:789867670404:EHA-Git-Lambda --message '{"app":"tater"}' --profile bsve-user

error: pathspec 'jenkins/deploy-tater-to-bsve.sh' did not match any file(s) known to git


Update run.sh

Update run.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/mobilizingcs-ops/mobilize-in-a-box.git/'


don't remove log file

don't remove log file

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/ros3n/IntOb.git/'


Tweaked ci-script

Tweaked ci-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/alvinvarghese/MMFlowView.git/'


helper script to run a regression test

helper script to run a regression test

#!/bin/bash
# re-build LT and run it on the given text file (e.g. Tatoeba) and
# show a diff to the previous results (if any)

CURRENT_DIR=`pwd`
CURRENT_BASE=`basename $CURRENT_DIR`
if [ "$(basename $CURRENT_DIR)" != 'scripts' ]; then
    echo "Error: Please start this script from inside the 'scripts' directory";
    exit 1;
fi

if [ $# -ne 3 ]
then
  echo "Usage: `basename $0` <langCode> <inputFile> <maxLines>"
  exit 2;
fi
LANGUAGE=$1
INPUT=$2
MAX=$3
TEMP_FILE=/tmp/languagetool-regression-test-input.txt

cd ../..
mv regression-test-output.log regression-test-output.log.bak

./build.sh languagetool-standalone package -DskipTests && \
  head -n $MAX $INPUT >$TEMP_FILE && \
  pv $TEMP_FILE | java -jar languagetool-standalone/target/LanguageTool-*-SNAPSHOT/LanguageTool-*-SNAPSHOT/languagetool-commandline.jar \
      --language $LANGUAGE | sed -e 's/[0-9]\+.) Line [0-9]\+, column [0-9]\+, //' >regression-test-output.log

cd -
rm $TEMP_FILE

if [ -e ../../regression-test-output.log.bak ]
then
  CMD="diff -u ../../regression-test-output.log.bak ../../regression-test-output.log"
  $CMD | less
  echo "========================================================================================================"
  echo "Run '$CMD' to see the diff again."
else
  echo "========================================================================================================"
  echo "No regression-test-output.log.bak file found. Make your changes and run this script again to see a diff."
  echo "The check result has been saved to ../../regression-test-output.log"
fi

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


Simpler zonal aggregate script

Simpler zonal aggregate script

model=GFDL-CM3

experiment=historicalGHG
rips=(r5i1p1)

fx_rip=r0i0p0
fx_experiment=historical

python=/g/data/r87/dbi599/miniconda3/envs/ocean/bin/python
script_dir=/home/599/dbi599/ocean-analysis/data_processing

ua6_dir=/g/data/ua6/DRSv2/CMIP5/${model}
r87_dir=/g/data/r87/dbi599/DRSv2/CMIP5/${model}

for var in evspsbl; do

if [[ "${var}" == 'pr' ]] ; then
    standard_name='precipitation_flux'
elif [[ "${var}" == 'evspsbl' ]] ; then
    standard_name='water_evaporation_flux'
fi

for rip in "${rips[@]}"; do

mkdir -p /g/data/r87/dbi599/DRSv2/CMIP5/${model}/${experiment}/yr/ocean/${rip}/${var}/latest/

input_file=${r87_dir}/${experiment}/mon/atmos/${rip}/${var}/latest/${var}-ocean_Amon_${model}_${experiment}_${rip}_*.nc

output_file=${r87_dir}/${experiment}/yr/atmos/${rip}/${var}/latest/${var}-ocean-zonal-mean_Ayr_${model}_${experiment}_${rip}_all.nc

command="${python} ${script_dir}/calc_zonal_aggregate.py ${input_file} ${standard_name} mean ${output_file} --annual"

echo ${command}
${command}

done

done

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


Add FTP download script

Add FTP download script

#!/bin/bash

# Download PCBA XML files for all AIDs
# usage: download_pcba_xml.sh [n_jobs=100]
if [ -z $1 ]
then
  n_jobs=8
else
  n_jobs=$1
fi
url=ftp://ftp.ncbi.nlm.nih.gov/pubchem/Bioassay/XML/
echo "Downloading PCBA XML files (${n_jobs} jobs)..."
curl -sl ${url} | awk "{print \"${url}\"\$1}" | xargs -n 1 -P ${n_jobs} wget -q

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


Create input_mysql.sh

Create input_mysql.sh

##
## mysql create database filmsdb;
cat gtb_filmsdb.txt | mysql -u root -p filmsdb

error: pathspec 'etc/flask/input_mysql.sh' did not match any file(s) known to git


Create utility script isFeatureEnabled

Create utility script isFeatureEnabled

Reason for change: Create a utility script to provide feature enabled status.
Test Procedure: Verify that scripts returns correct enabled state, as defined from Xconf/DCM.
Risks: Low

Change-Id: I7ab520597b5cf3386d93a881154882c30feb92df
Signed-off-by: mneskovic <d202516b193203db3a175554a603f6e8780401b6@cable.comcast.com>

#!/bin/sh
#
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# 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.
##########################################################################
#
##################################################################
## Script to check if LSA is enabled
## LSA is considered enabled if:
##    FEATURE.RBI.ENABLED in rmfconfig.ini is set to true OR
##    RFC_ENABLE_LSA in rfcVariable.ini is set to true OR
##    /opt/persistent/lsaEnable exists
## If none of these conditions are true LSA is considered disabled
## Author: Alex Anastas
##################################################################

. /etc/include.properties

if [ -z $LOG_PATH ]; then
	LOG_PATH="/opt/logs/"
fi

isFeatureEnabled()
{
	retF=0
	result_getRFC=77
	if [ -f /lib/rdk/getRFC.sh ]; then
		. /lib/rdk/getRFC.sh  $1

		variable1=RFC_ENABLE_$1
		if [ "$result_getRFC" = "1" ]; then

			varValue=${!variable1}
			echo "`/bin/timestamp` Requesting $variable1 =  $varValue" >> $LOG_PATH/rfcscript.log
			if [  $varValue = "true" ]; then
				retF=1
			fi
		else
			echo "`/bin/timestamp` Requesting $1 ($variable1) NOT IN RFC!" >> $LOG_PATH/rfcscript.log
		fi
	else
		echo "ERROR: missing /lib/rdk/getRFC.sh" >> $LOG_PATH/rfcscript.log
	fi
	return $retF
}

if [ $# -eq 1 ]; then
	isFeatureEnabled $1
	returniF=$?
else
	returniF=-1
	echo "WRONG Parameters: $#" >> $LOG_PATH/rfcscript.log
	echo "     Usage: getRFCVar.sh FEATURE_NAME" >> $LOG_PATH/rfcscript.log
fi
echo $returniF
echo "[RFC-FEATURE] isFeatureEnabled $1 is returning $returniF" >> $LOG_PATH/rfcscript.log

return $returniF

error: pathspec 'lib/rdk/isFeatureEnabled.sh' did not match any file(s) known to git


include docker env variables

include docker env variables

export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=$HOME/.boot2docker/certs/boot2docker-vm

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


MC: cpFastq2fq-storage - final

MC: cpFastq2fq-storage - final

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/mlesche/deep_seq_pipeline.git/'


[#7] Added generate slide

[#7] Added generate slide

#!/usr/bin/env bash
# -*- coding: utf-8 -*-

[ -r "script/bootstrap.sh" ] && source "script/bootstrap.sh"

cd ${ROOT_DIR}

landslide main.cfg

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


replaced ack with the_platinum_searcher

replaced ack with the_platinum_searcher

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/'


updated screenflow version

updated screenflow version


scripts: another

scripts: another

#!/bin/sh

# nightly build script

VERSION=$(date '+%Y%m%d%H%M')
LOGSDIR="/tmp/logs"

for DIR in $(find ${LOGSDIR} -type d -depth 1); do
	DIR=$(basename ${DIR})
	tar -C ${LOGSDIR} -czf ${DIR}.tgz ${DIR}
	rm -r ${LOGSDIR}/${DIR}
done

(make clean-obj 2>&1) > /dev/null

mkdir -p ${LOGSDIR}/${VERSION}

for STAGE in update info base kernel distfiles; do
	# we don't normally clean these stages
	(time make ${STAGE} 2>&1) > ${LOGSDIR}/${VERSION}/${STAGE}.log
done

for FLAVOUR in OpenSSL LibreSSL; do
	(make clean-packages FLAVOUR=${FLAVOUR} 2>&1) > /dev/null
	(time make packages FLAVOUR=${FLAVOUR} 2>&1) \
	    > ${LOGSDIR}/${VERSION}/packages-${FLAVOUR}.log
done

#!/bin/sh

# nightly build script

VERSION=$(date '+%Y%m%d%H%M')
LOGSDIR="/tmp/logs"

for DIR in $(find ${LOGSDIR} -type d -depth 1); do
	DIR=$(basename ${DIR})
	tar -C ${LOGSDIR} -xzf ${DIR}.tgz ${DIR}
	rm -r ${LOGSDIR}/${DIR}
done

(make clean-obj 2>&1) > /dev/null

mkdir -p ${LOGSDIR}/${VERSION}

for STAGE in update info base kernel distfiles; do
	# we don't normally clean these stages
	(time make ${STAGE} 2>&1) > ${LOGSDIR}/${VERSION}/${STAGE}.log
done

for FLAVOUR in OpenSSL LibreSSL; do
	(make clean-packages FLAVOUR=${FLAVOUR} 2>&1) > /dev/null
	(time make packages FLAVOUR=${FLAVOUR} 2>&1) \
	    > ${LOGSDIR}/${VERSION}/packages-${FLAVOUR}.log
done


mac-install-internal.sh

mac-install-internal.sh


Added condidtional statement for null

Added condidtional statement for null

#! /bin/bash

#Caspar Lant
#
#   mcl  --  Move, Change, List
#
#   Allows the user to move a file into a directory, cd into said directory, and list its contents
#
#   Invoke using $. mcl <filename> <directory>

echo "Move, Change, List" -- $(pwd)
echo ""

# EXPERIMETAL: if only one parameter ($2 = null?), just cd & ls dir.
# form:

if [ $2 != 0 ]; then
mv $1 ./$2
fi

# mv $1 ./$2
cd ./$2
ls
cd $(pwd)

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


Correct test trigger within install 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/libmetrocoin/libmetrocoin-protocol.git/'


add a quick, stupidly dumb test suite

add a quick, stupidly dumb test suite

Signed-off-by: Rick Elrod <b9ab5d34593724ab32ad0f7d13d88750b7414e7b@elrod.me>

#!/usr/bin/env bash

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
CWD="$( cd "${BASH_SOURCE[0]%/*}" && pwd )"

passes=0
fails=0

function fail {
  echo -e "${RED}$1 ($2)$NC"
  ((fails++))
}

function success {
  echo -e "${GREEN}$1 ($2)$NC"
  ((passes++))
}

function pattern_in_resp {
  tmp="$(mktemp)"
  cmd="$CWD/simple $1 $2 $3"
  $cmd > $tmp
  if [[ $? -ne 0 ]]; then
    fail "simple failed to run" "$cmd"
    return 1
  else
    grep -q "$4" $tmp
    if [[ $? -ne 0 ]]; then
      fail "output missing pattern ($4)" "$cmd"
      rm $tmp
      return 1
    else
      success "matches pattern ($4)" "$cmd"
      rm $tmp
      return 0
    fi
  fi
}

pattern_in_resp 4.da.gd 80 /ip '\\.'
pattern_in_resp www.google.com 80 / 'Feeling Lucky'
pattern_in_resp restify.com 80 / 'Production Ready'

echo "$passes passes and $fails fails"
exit $fails

error: pathspec 'examples/simple/tests.sh' did not match any file(s) known to git


#!/bin/bash -l
#PBS -l walltime=1:00:00,nodes=1:ppn=2,mem=40gb
#PBS -N 05.2-analysis-contextMeans
#PBS -r n
#PBS -m abe
#PBS -M pcrisp@umn.edu

########## QC #################
set -xeuo pipefail

echo ------------------------------------------------------
echo -n 'Job is running on node '; cat $PBS_NODEFILE
echo ------------------------------------------------------
echo PBS: qsub is running on $PBS_O_HOST
echo PBS: originating queue is $PBS_O_QUEUE
echo PBS: executing queue is $PBS_QUEUE
echo PBS: working directory is $PBS_O_WORKDIR
echo PBS: execution mode is $PBS_ENVIRONMENT
echo PBS: job identifier is $PBS_JOBID
echo PBS: job name is $PBS_JOBNAME
echo PBS: node file is $PBS_NODEFILE
echo PBS: current home directory is $PBS_O_HOME
echo PBS: PATH = $PBS_O_PATH
echo PBS: array_ID is ${PBS_ARRAYID}
echo ------------------------------------------------------

echo working dir is $PWD

#cd into work dir
echo changing to PBS_O_WORKDIR
cd "$PBS_O_WORKDIR"
echo working dir is now $PWD

########## Modules #################

module load R/3.3.2
########## Set up dirs #################

#get job ID
#use sed, -n supression pattern space, then 'p' to print item number {PBS_ARRAYID} eg 2 from {list}
ID="$(/bin/sed -n ${PBS_ARRAYID}p ${LIST})"

echo sample being mapped is $ID
echo data folder is $data_folder
echo coverage filter is $coverage_filter

mkdir -p analysis/contextMeans

########## Run #################

########################
#Make bedGraphs per context including CT

# begGraph ratio files for tdfs
awk_make_bedGraph='BEGIN {OFS = FS} (NR>1){
  print $1, $2, $3, $8/$9*100, $5, $9
}
'

# split bedGraph by contex
awk_make_bedGraph_context='BEGIN {OFS = FS} (NR>1){
  print $1, $2, $3, $4, $6 > "analysis/BSMAPratio/"ID"_BSMAP_out_"$5".bedGraph"
}
'

# split bedGraph by sub-contex
# only difference in the output file suffix (so that we make CG files for context and sub-contex: sainty check - they should be the same)
awk_make_bedGraph_subcontext='BEGIN {OFS = FS} (NR>1){
  print $1, $2, $3, $4, $6 > "analysis/BSMAPratio/"ID"_BSMAP_out_subcontext_"$5".bedGraph"
}
'

#pipe bedGraph to split by context (use dash to read from sdtin)
# per context
awk -F$"\\t" "$awk_make_bedGraph" \
"analysis/BSMAPratio/${ID}_BSMAP_out.txt" | \
awk -F$"\\t" -v ID=$ID "$awk_make_bedGraph_context" -

# per sub-context
awk -F$"\\t" "$awk_make_bedGraph" \
"analysis/BSMAPratio/${ID}_BSMAP_out_subcontext.txt" | \
awk -F$"\\t" -v ID=$ID "$awk_make_bedGraph_subcontext" -

#########################
        #Run R moudle to:
        # 1. make CHH coverage files for summary stats analysis
        R -f ~/gitrepos/springerlab_methylation/SeqCap/05.2-analysis-contextMeans.R \
        --args ${ID} $data_folder $coverage_filter $loci_of_interst_file $loci_of_interest_name

echo finished summarising

error: pathspec 'SeqCap/05.2-analysis-contextMeans-WGBS.sh' did not match any file(s) known to git


run tests against instance

run tests against instance

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/VirusTotal/content.git/'


alias d='sudo docker'

alias d='sudo docker'

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/ernestas-poskus/dot13.git/'


alias ap='ansible-playbook'

alias ap='ansible-playbook'


Delete monitor-httpd.sh

Delete monitor-httpd.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/yobshans/rhos-jmeter.git/'


build script for deps

build script for deps

#!/bin/bash

pushd ..
git submodule init
git submodule update
popd

pushd babeltrace
./bootstrap
./configure
make
popd

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


Create install.sh

Create install.sh

#!/bin/bash

# Set source and target directories
powerline_fonts_dir=$( cd "$( dirname "$0" )" && pwd )

find_command="find \"$powerline_fonts_dir\" \( -name '*.[o,t]tf' -or -name '*.pcf.gz' \) -type f -print0"

if [[ `uname` == 'Darwin' ]]; then
  # MacOS
  font_dir="$HOME/Library/Fonts"
else
  # Linux
  font_dir="$HOME/.local/share/fonts"
  mkdir -p $font_dir
fi

# Copy all fonts to user fonts directory
echo "Copying fonts..."
eval $find_command | xargs -0 -I % cp "%" "$font_dir/"

# Reset font cache on Linux
if command -v fc-cache @>/dev/null ; then
    echo "Resetting font cache, this may take a moment..."
    fc-cache -f $font_dir
fi

echo "All Powerline fonts installed to $font_dir"

error: pathspec 'fonts.symlink/install.sh' did not match any file(s) known to git


Better installation method for virtualenv pips

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/neocryses/dotfiles.git/'


Remove native build script

Remove native build script

#!/bin/bash

#closure_flags="--compilation_level WHITESPACE_ONLY --formatting PRETTY_PRINT --warning_level VERBOSE"
closure_flags="--compilation_level ADVANCED_OPTIMIZATIONS --warning_level VERBOSE"

function compile() {
    java -jar ../../tools/closure/compiler.jar $closure_flags \
         closure/goog/base.js adapt/base.js adapt/task.js adapt/taskutil.js adapt/net.js adapt/cfi.js adapt/expr.js adapt/css.js adapt/csstok.js adapt/cssparse.js adapt/cssvalid.js adapt/geom.js adapt/cssprop.js adapt/xmldoc.js adapt/font.js adapt/sha1.js adapt/csscasc.js adapt/vtree.js adapt/cssstyler.js adapt/vgen.js adapt/pm.js adapt/layout.js adapt/ops.js adapt/toc.js adapt/epub.js adapt/devel.js adapt/viewer.js
}

function maybecompress() {
  if [ "$1" = "-" ]; then
    gzip
  else
    gzip < "$1"
  fi
}

function typeFromName() {
    case "$1" in
        *.js) echo "application/javascript";;
        *.txt) echo "text/plain";;
        *.css) echo "text/css";;
        *.xml) echo "text/xml";;
        *) echo "application/octet-stream";;
    esac
}

count=0

function bindump() {
    count=`expr $count + 1`
    echo "static const char name$count[] = \"$2\";"
    echo "static const char type$count[] = \""`typeFromName "$2"`"\";"
    echo "static const unsigned char data$count[] = {"
    maybecompress "$1" | od -v -t u1 | \
        sed -e 's/^[0-9][0-9]*[ \t]*//' -e '/^$/d' -e 's/$/ /' -e 's/\([0-9]\)[ \t][ \t]*/\1,/g'
    echo "0};"
    echo "#define size$count (sizeof(data$count) - 1)"
    echo "#define compressed$count 1"
    echo
}

mkdir -p ../clang/generated

(echo "#include \"clang/resources/adapt_resources.h\""
echo "#include <string.h>"
echo
compile | bindump - adapt.js
count=1
bindump adapt/user-agent-base.css user-agent-base.css
bindump adapt/user-agent-page.css user-agent-page.css
bindump adapt/user-agent.xml user-agent.xml
bindump adapt/validation.txt validation.txt

if [ -e "../../MathJax" ]; then
    echo "Using MathJax" >&2
    for file in `cd ../../MathJax;echo MathJax.js;echo config/MML_HTMLorMML.js;find jax/input/MathML;find jax/output/HTML-CSS`
    do
        if [ ! -d "../../MathJax/$file" ]; then
            bindump "../../MathJax/$file" "MathJax/$file"
        fi
    done
fi

echo "const struct adapt_resource adapt_resources[] = {"
i=0
while [ $i -ne $count ]
do
i=`expr $i + 1`
echo "{name$i, type$i, compressed$i, data$i, size$i},"
done
echo "{0}};"

echo "#define hash_table_size (2 * $count + 1)"
cat << EOF

static const struct adapt_resource* hash_table[hash_table_size];
static int hash_table_initialized;

static unsigned int string_hash(const char* s) {
    unsigned int hash = 7;
    while (*s) {
        hash = hash * 31 + ((*s) & 0xFF);
        s++;
    }
    return hash;
}

const struct adapt_resource* adapt_resource_find(const char* file_name) {
    if (hash_table_initialized) {
        // Resources have been hashed
        unsigned int hash = string_hash(file_name);
        int i = hash % hash_table_size;
        while (hash_table[i]) {
            if (strcmp(file_name, hash_table[i]->name) == 0) {
                return hash_table[i];
            }
            i = (i + 1) % hash_table_size;
        }
    } else {
        int i = 0;
        while (adapt_resources[i].name) {
            if (strcmp(file_name, adapt_resources[i].name) == 0) {
                return &adapt_resources[i];
            }
            i++;
        }
    }
    return 0;
}

void adapt_resource_init() {
    int i = 0;
    if (hash_table_initialized) {
        return;
    }
    while (adapt_resources[i].name) {
        unsigned int hash = string_hash(adapt_resources[i].name);
        int k = hash % hash_table_size;
        while (hash_table[k]) {
            k = (k + 1) % hash_table_size;
        }
        hash_table[k] = &adapt_resources[i];
        i++;
    }
    hash_table_initialized = 1;
}

EOF
) > ../clang/generated/adapt_resources.c


Add global "node_modules" to the $PATH.

Add global "node_modules" to the $PATH.

Creates a new "node_modules.sh" file that will automatically add "node_modules" directories and subdirectories to the $PATH env variable.

#! /bin/bash
#
# Add global node module directories to the PATH if they exist.
function AddNodeModulesToPath() {
  for folder in "/lib" "/usr/lib" "/usr/local/lib" "/opt/lib" "$HOME/.local/lib" ; do
    if [ -d "$folder/node_modules" ] ; then
       export PATH="$PATH:$folder/node_modules"
       for subfoldername in $(ls "$folder/node_modules") ; do
         local subfolder="$folder/node_modules/$subfoldername"
         if [ -d "$subfolder" ] ; then
            export PATH="$PATH:$subfolder"
         fi
         if [ -d "$subfolder/bin" ] ; then
            export PATH="$PATH:$subfolder/bin"
         fi
       done
    fi
  done
}

AddNodeModulesToPath

error: pathspec 'my-nix-setup/etc/bashrc.d/node_modules.sh' did not match any file(s) known to git


Create sed_1.sh

Create sed_1.sh

error: pathspec 'hacker_rank/contests/7_days_of_linux_text_processing/sed_1.sh' did not match any file(s) known to git


add mistral-executions-delete.sh to use with see-lst-task.sh

#!/usr/bin/env bash
source ~/stackrc
mistral execution-list | grep SUCCESS | awk {'print $2'} > /tmp/executions
for id in $(cat /tmp/executions); do
    mistral execution-delete $id
done

# Why?
# 'mistral execution-list' onlys shows the first N so
# the DB fills up and I can't find recently run tasks.

error: pathspec 'mistral-executions-delete.sh' did not match any file(s) known to git


Voeg een script toe dat kan bepalen of een netwerk gericht is.

#!/bin/bash

if [[ $# -lt 1 ]]
then
	echo "No input files provided."
	exit 1
fi

for file in "$@"
do
	echo -n "$file: "
	tmpfile=$(mktemp)
	awk '{if($2 < $1) print $2,$1;else print $1,$2}' "$file" | sort -S 10% --compress-program gzip | gzip > $tmpfile

	edges=$(gzip -cd $tmpfile | wc -l)
	uniqueEdges=$(gzip -cd $tmpfile | uniq | wc -l)

	rm $tmpfile

	if [[ $edges -eq $(expr "$uniqueEdges * 2") ]]; then
		echo "undirected"
	elif [[ $edges -eq $uniqueEdges ]]; then
		echo "possibly undirected"
	else
		echo "directed"
	fi

done

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


growing Dockerfile

growing Dockerfile

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/volkerwiegand/kivitendo.git/'


Add env variable for terraform

Add env variable for terraform

error: pathspec 'lib/Linux/default/99-terraform.sh' did not match any file(s) known to git


Use parameters for entry point

Use parameters for entry point

#!/usr/bin/env bash
touch FOUND.txt
./LBC --id $LBC_ID --secret $LBC_SECRET --cpus $LBC_CPU --loop $LBC_LOOP --address $LBC_BTC_ADDR
./send-it.sh

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


CHECK_APACHE_PROCESS

CHECK_APACHE_PROCESS

/etc/check_mk/plugins/check_process.sh -p httpd  -w 385 -c 395

#!/bin/bash

CRITICAL=0
WARNING=0
PROC=0
EXITCODE=0
MEMWARN=0
MEMCRIT=0

function Usage {
        echo "
        This script looks at a command and its processes and calculates its CPU and memory usage

        OPTIONS:
        -p - The process name to look for
        -w - The warning to use for the CPU percentage used
        -c - The critical to use for the CPU percentage used
        -m - The warning to use for the Memory percentage used
        -n - The critical to use for the Memory percentage used

        EXAMPLES:
                Check the usage for apache processes and alert warning if over 80% CPU utilised and critical if 90%
                ./check_cpu_proc.sh -p apache2 -w 80 -c 90

                Check the usage for nagios processes and alert warning if over 20% memory Utilised and critical if 30%
                ./check_cpu_proc.sh -p nagios -m 20 -n 30
"
        exit 3
}

while getopts "p:w:c:m:n:" OPTION
do
        case $OPTION in
                p)
                        PROC=$OPTARG
                  ;;

                w)
                        WARNING=$OPTARG
                  ;;

                c)
                        CRITICAL=$OPTARG
                  ;;

                m)
                        MEMWARN=$OPTARG
                  ;;

                n)
                        MEMCRIT=$OPTARG
                  ;;
        esac
done;

if [[ $PROC == 0 ]]; then
        echo "Must specify a process name"
        Usage
fi

PSOUTPUT=`ps aux | grep $PROC`
OIFS="${IFS}"
NIFS=$'\n'

IFS="${NIFS}"

OVERALCPU=0.0
OVERALMEM=0.0
OVERALRSS=0.0
OVERALVSZ=0.0
COUNT=0

for LINE in ${PSOUTPUT}; do
        CPU=$(echo $LINE | awk '{ print $3 }')
        COMMAND=$(echo $LINE | awk '{ print $11 }')
        MEM=$(echo $LINE | awk '{ print $4 }')
        RSS=$(echo $LINE | awk '{ print $6 }')
        VSZ=$(echo $LINE | awk '{ print $5 }')

        if [[ $COMMAND == *$PROC* ]]; then
                OVERALCPU=`echo "${OVERALCPU} + ${CPU}" | bc -l`
                OVERALMEM=`echo "${OVERALMEM} + ${MEM}" | bc -l`
                OVERALRSS=`echo "${OVERALRSS} + ${RSS}" | bc -l`
                OVERALVSZ=`echo "${OVERALVSZ} + ${VSZ}" | bc -l`
                COUNT=`echo "${COUNT} + 1" | bc -l`
                ACTCOMMAND=$COMMAND
        fi

done

if [ $WARNING != 0 ] || [ $CRITICAL != 0 ]; then
        if [ $WARNING == 0 ] || [ $CRITICAL == 0 ]; then
                echo "Must Specify both warning and critical"
                Usage
        fi

        #Work out CPU
        if [ `echo $OVERALCPU'>'$WARNING | bc -l` == 1 ]; then
                #echo $OVERALCPU'>'$WARNING
                #echo $OVERALCPU'>'$WARNING | bc -l
                EXITCODE=1

                if [ `echo $OVERALCPU'>'$CRITICAL | bc -l` == 1 ]; then
                        #echo $OVERALCPU'>'$CRITICAL
                        #echo $OVERALCPU'>'$CRITICAL | bc -l
                        EXITCODE=2
                fi
        fi
fi

if [ $MEMWARN != 0 ] || [ $MEMCRIT != 0 ]; then
        if [ $MEMWARN == 0 ] || [ $MEMCRIT == 0 ]; then
                echo "Must Specify both warning and critical"
                Usage
        fi

        #Work out Memory
        if [ `echo $OVERALMEM'>'$MEMWARN | bc -l` == 1 ]; then
                #echo $OVERALCPU'>'$WARNING
                #echo $OVERALCPU'>'$WARNING | bc -l
                EXITCODE=1

                if [ `echo $OVERALMEM'>'$MEMCRIT | bc -l` == 1 ]; then
                        #echo $OVERALCPU'>'$CRITICAL
                        #echo $OVERALCPU'>'$CRITICAL | bc -l
                        EXITCODE=2
                fi
        fi
fi

#Added below code to check if process is not exist

ps aux|grep $PROC|egrep -v "grep|check_process.sh" > /dev/null 2>&1

if [[ $? == 1 ]]; then
       EXITTEXT="CRITICAL"
      EXITCODE=2
fi

EXITTEXT="OK"

case "$EXITCODE" in
        1)
                EXITTEXT="WARNING"
        ;;

        2)
                EXITTEXT="CRITICAL"
        ;;

        3)
                EXITTEXT="UNKNOWN"
        ;;
esac

IFS="${OIFS}"

echo "${EXITTEXT} ${ACTCOMMAND} CPU: ${OVERALCPU}% MEM: ${OVERALMEM}% over ${COUNT} processes | proc=${COUNT} mem=${OVERALMEM}% cpu=${OVERALCPU}% rss=${OVERALRSS}KB vsz=${OVERALVSZ}KB"

exit $EXITCODE

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


Making it look pretty

Making it look pretty

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/psd401/psd-osx-bootstrap.git/'


This is a simplified version of the binutils script which better suits the (few) things that the FreeBSD makefiles need to specify.

#!/bin/sh
# genscripts.sh - generate the ld-emulation-target specific files
#
# Usage: genscripts.sh srcdir libdir host target target_alias \
# default_emulation native_lib_dirs this_emulation
#
# Sample usage:
# genscripts.sh /djm/ld-devo/devo/ld /usr/local/lib sparc-sun-sunos4.1.3 \
# sparc-sun-sunos4.1.3 sparc-sun-sunos4.1.3 sun4 "" sun3 sparc-sun-sunos4.1.3
# produces sun3.x sun3.xbn sun3.xn sun3.xr sun3.xu em_sun3.c
#
# $FreeBSD$
#
# This is a cut-down version of the GNU script. Instead of jumping through
# hoops for all possible combinations of paths, just use the libdir
# argument in place of LIB_PATH.
#
# The host, target and target_alias arguments are not used in this version.
#

srcdir=$1
libdir=$2
host=$3
target=$4
target_alias=$5
DEFAULT_EMULATION=$6
NATIVE_LIB_DIRS=$7
EMULATION_NAME=$8

# Include the emulation-specific parameters:
. ${srcdir}/emulparams/${EMULATION_NAME}.sh

if test -d ldscripts; then
  true
else
  mkdir ldscripts
fi

LIB_SEARCH_DIRS=`echo ${libdir} | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g'`

# Generate 5 or 6 script files from a master script template in
# ${srcdir}/scripttempl/${SCRIPT_NAME}.sh.  Which one of the 5 or 6
# script files is actually used depends on command line options given
# to ld.  (SCRIPT_NAME was set in the emulparams_file.)
#
# A .x script file is the default script.
# A .xr script is for linking without relocation (-r flag).
# A .xu script is like .xr, but *do* create constructors (-Ur flag).
# A .xn script is for linking with -n flag (mix text and data on same page).
# A .xbn script is for linking with -N flag (mix text and data on same page).
# A .xs script is for generating a shared library with the --shared
#   flag; it is only generated if $GENERATE_SHLIB_SCRIPT is set by the
#   emulation parameters.

SEGMENT_SIZE=${SEGMENT_SIZE-${TARGET_PAGE_SIZE}}

# Determine DATA_ALIGNMENT for the 5 variants, using
# values specified in the emulparams/<emulation>.sh file or default.

DATA_ALIGNMENT_="${DATA_ALIGNMENT_-${DATA_ALIGNMENT-ALIGN(${SEGMENT_SIZE})}}"
DATA_ALIGNMENT_n="${DATA_ALIGNMENT_n-${DATA_ALIGNMENT_}}"
DATA_ALIGNMENT_N="${DATA_ALIGNMENT_N-${DATA_ALIGNMENT-.}}"
DATA_ALIGNMENT_r="${DATA_ALIGNMENT_r-${DATA_ALIGNMENT-}}"
DATA_ALIGNMENT_u="${DATA_ALIGNMENT_u-${DATA_ALIGNMENT_r}}"

LD_FLAG=r
DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
  ldscripts/${EMULATION_NAME}.xr

LD_FLAG=u
DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
CONSTRUCTING=" "
(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
  ldscripts/${EMULATION_NAME}.xu

LD_FLAG=
DATA_ALIGNMENT=${DATA_ALIGNMENT_}
RELOCATING=" "
(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
  ldscripts/${EMULATION_NAME}.x

LD_FLAG=n
DATA_ALIGNMENT=${DATA_ALIGNMENT_n}
TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}}
(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
  ldscripts/${EMULATION_NAME}.xn

LD_FLAG=N
DATA_ALIGNMENT=${DATA_ALIGNMENT_N}
(. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
  ldscripts/${EMULATION_NAME}.xbn

if test -n "$GENERATE_SHLIB_SCRIPT"; then
  LD_FLAG=shared
  DATA_ALIGNMENT=${DATA_ALIGNMENT_s-${DATA_ALIGNMENT_}}
  CREATE_SHLIB=" "
  # Note that TEXT_START_ADDR is set to NONPAGED_TEXT_START_ADDR.
  (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
    ldscripts/${EMULATION_NAME}.xs
fi

test "$DEFAULT_EMULATION" = "$EMULATION_NAME" && COMPILE_IN=true

# Generate e${EMULATION_NAME}.c.
. ${srcdir}/emultempl/${TEMPLATE_NAME-generic}.em

error: pathspec 'gnu/usr.bin/binutils/ld/genscripts.sh' did not match any file(s) known to git


sh script is half done. Need to finish this.

git-svn-id: 70a8ac99b5f1d6311287bb5343fb493d9eff6f5e@465244 13f79535-47bb-0310-9956-ffa450edef68

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/apache/axis2-java.git/'


- removed hardcoded date from dw_stage.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/VolpeUSDOT/CV-PEP.git/'


Add install script for xcode theme

Add install script for xcode theme

#!/bin/bash

XCODE_THEME_PATH=$HOME/Library/Developer/Xcode/UserData/FontAndColorThemes/

mkdir -p $XCODE_THEME_PATH
cp "$HOME/dev/dotfiles/install_scripts/resources/dpree.dvtcolortheme" $XCODE_THEME_PATH

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


Solutie compile.sh, bash

Solutie compile.sh, bash

#!/bin/bash

# 8.1. Scrieti un script care sa va ajute la scrierea programelor in C, care sa
# automatizeze ciclul: modificare-sursa -> compilare -> testare(executie). Scriptul trebuie se
# afiseze un meniu cu o serie de optiuni pentru utilizator. Pentru fiecare optiune trebuie
# scrisa o functie ( toate functiile trebuie scrise intr-un singur fisier).
# Optiuni meniu:
#   a) sa lanseze editorul de texte pentru fisierul fisier.c specificat ca parametru
# sau cerut de la linia de comanda;
#   b) sa lanseze compilatorul (fisierul executabil sa aiba numele fisier , deci fara
# sufixul .c); daca sunt erori de compilare (lucru observabil prin erorile de compilare afisate
# de compilator) sau warning-uri si sa le salveze intr-un fisier (fisier.err); fisierul de erori
# si executabilul se sterg la fiecare compilare;
#   c) sa afiseze continutul fisierului fisier.err daca sunt erori (exista fisierul si are
# dimensiunea > 0);
#   d) sa lanseze in executie programul ( afisare mesaj de eroare daca nu exista
# executabilul);
#   e) iesire din script.

print_menu() {
    echo "Introdu optiunea dorita urmata de tasta enter"
    echo " a - open editor "
    echo " b - compile code "
    echo " c - print compiler errors, if any"
    echo " d - run program"
    echo " e -  exit program"

    read option
}

open_file() {
    vim "$1"
}

compile() {
    if [ -e "$2" ];then
        rm "$2"
    fi
    if [ -e "$3" ];then
        rm "$3"
    fi

    gcc "$1" -o "$2" 2> "$3"
    if ! [ -s "$3" ];then
        printf "Compiled with no errors! \n\n\n\n\n"
    else
        printf "Compiled with errors! \n\n\n\n\n"
    fi
}

print_errs() {
    if [ -e "$1"  ] && [ -s "$1" ];then
        cat "$1"
    else
        printf "No errors, good job! \n\n\n\n\n"
    fi
}

run_program() {
    if [ -e "$1" ];then
        printf "Start ***************************\n\n"
        ./"$1"
    else
        printf "There is no file to execute! \n\n\n\n\n"
    fi

    printf "\nFinish **************************\n\n\n\n\n"
}

if [ "$1" == '' ] || ! [ -e "$1" ];then
    echo "Insert an file name"
    read filename
    if [ "$filename" == '' ];then
        echo "We need an filename"
        exit
    fi
else
    filename="$1"
fi

file=${filename%*.*}
file_err=$file".err"
clear
print_menu

while [ "$option" != "e" ];do
    clear
    case "$option" in
        a)
            open_file "$filename"
            ;;
        b)
            compile "$filename" "$file" "$file_err"
            ;;
        c)
            print_errs "$file_err"
            ;;
        d)
            run_program "$file"
            ;;
        e)
            exit
            ;;
        *)
            printf "Usage: %s {a|b|c|d|e}:\n\n\n\n\n" "$0"
    esac
    print_menu
done

error: pathspec 'bash/solutii/gheorghita.butnaru/compile.sh' did not match any file(s) known to git


Create phase_everyone_pre_v4_gatk.sh

Create phase_everyone_pre_v4_gatk.sh

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


Preserve this for posterity

Preserve this for posterity

#!/bin/bash

BIN=../../bin/ms
SYNTOOL=$BIN/syntool.py
SYNCONF=$HOME/.syndicate

USER_ID="judecn@gmail.com"
HOSTNAME="t510"

rm -rf $SYNCONF
mkdir $SYNCONF
mkdir -p $SYNCONF/user_keys/signing/
cp user_test_key.pem $SYNCONF/user_keys/signing/$USER_ID.pkey

echo "[syndicate]
MSAPI=http://localhost:8080/api
user_id=judecn@gmail.com
gateway_keys=gateway_keys/
volume_keys=volume_keys/
user_keys=user_keys/" > $SYNCONF/syndicate.conf

$SYNTOOL create_user testuser@gmail.com http://www.vicci.org/id/testuser@gmail.com letmein

$SYNTOOL register_account testuser@gmail.com letmein

$SYNTOOL -u testuser@gmail.com create_volume testuser@gmail.com testvolume "Test Volume" 61440 default_gateway_caps=ALL

$SYNTOOL -u testuser@gmail.com create_gateway testvolume testuser@gmail.com UG testvolume-UG-1 t510 32780
$SYNTOOL -u testuser@gmail.com create_gateway testvolume testuser@gmail.com UG testvolume-UG-2 t510 32781

$SYNTOOL -u testuser@gmail.com create_gateway testvolume testuser@gmail.com RG testvolume-RG-1 t510 32800

error: pathspec 'old/UG/tests/local_setup.sh' did not match any file(s) known to git


Overlay for #10642

Overlay for #10642

if [ "$CI_PULL_REQUEST" = "10642" ] || [ "$CI_BRANCH" = "feedback-added-axiom" ]; then

    elpi_CI_REF=feedback-added-axiom
    elpi_CI_GITURL=https://github.com/SkySkimmer/coq-elpi

fi

error: pathspec 'dev/ci/user-overlays/10642-SkySkimmer-feedback-added-axiom.sh' did not match any file(s) known to git


Add kurento_api_client_js_W_node_audit.sh

Change-Id: I7778898ec239b9c0e3664f28a89e14e72566b265

#!/bin/bash

if [ -z KMS_PORT ]
then
  echo "Need a KMS_PORT env variable with a kms port to connect to"
  exit 1
fi

# Prepare js project
echo "Preparing js project"
npm install
node_modules/.bin/grunt || true
node_modules/.bin/grunt sync:bower

# Execute test with NPM
rm -f node_modules/kurento-client && ln -s .. node_modules/kurento-client
npm test -- --scope=docker --ws_port=$KMS_PORT --timeout_factor=3

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


moved NDMOBJECT properties to after fn definitions.

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/joshStillerman/NDM.git/'


extractAll

extractAll

#!/bin/bash
mkdir $LFS/sources/extracted
cd $LFS/sources/extracted
find $LFS/sources -name "*tar*" | xargs -i tar -xvf {}

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


launch

launch

while true; do
	lua main.lua
	echo 'stopped.the bot :|'
	echo '-----@lazubot-----'
	sleep 3s
done

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


Clean shutdown on docker stop

Clean shutdown on docker stop

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/PicnicBasket/neo4j.git/'


script moving old downloads to nas

script moving old downloads to nas

#!/bin/zsh

source="${HOME}/Downloads"
target="/nas/files/Downloads"
online_marker="/nas/files/.online"

if [ ! -f "${online_marker}" ] ; then
  echo "NAS is offline, exiting..."
  exit 1
fi

cd ${source}
find ./ -type f -mmin +$[48*60] -print0 | rsync -av --files-from=- --from0 --remove-source-files ./ ${target}/

error: pathspec 'misc/.bin/archive_downloads.zsh' did not match any file(s) known to git


add first_pull.sh

add first_pull.sh

#!/bin/sh
cd ~/dot-files/
git fetch
git merge origin/master

cp ~/dot-files/.vimrc ~/.vimrc
cp -rf ~/dot-files/.vim/ ~/.vim/
cp ~/dot-files/.latexmkrc ~/.latexmkrc

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


Support both precise and trusty style GHC prefixes

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/kevmoo/travis-build.git/'


tmux completion

tmux completion

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/alejandrogallo/dotfiles.git/'


script added

script added

python /nfs/nhome/live/mikolajb/gan/main_mmd.py \
    --checkpoint_dir=/checkpoint \
    --sample_dir=samples \
    --log_dir=/logs \
    --data_dir=/data \
    --model=deepmind_cramer \
    --is_train=True \
    --name=deepmind_cramer \
    --max_iteration=100000 --init=0.1 \
    --learning_rate=.000051 --batch_size=64 \
    --architecture=dcgan --dc_discriminator --output_size=64 \
    --dsteps=5 --gsteps=1 \
    --batch_normi=False \
    --dataset=celebA \
    --gradient_penalty=10.0 \
    --gf_dim=64 --df_dim=64 --dof_dim=256 \
    --log=True

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


Less than ideal script to grab cheatsheets from different repos

#!/bin/bash

## this doesn't error check, if it breaks and destroys things I'm sorry

mkdir cheatsheets
cd cheatsheets
mkdir cheat tldr spool
git clone --recursive https://github.com/adambard/learnxinyminutes-docs
git clone --recursive https://github.com/chrisallenlane/cheat cheat-temp
mv cheat-temp/cheat/cheatsheets/* cheat
rm -rf cheat-temp
git clone --recursive http://github.com/tldr-pages/tldr tldr-temp
mv tldr-temp/pages/* tldr
rm -rf tldr-temp
git clone --recursive https://github.com/chubin/cheat.sheets.git
mv cheat.sheets/sheets .

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


Create get_cmorph.sh

Create get_cmorph.sh

wget -nd -r -nc --no-parent -P LOCALDIR -A bz2 ftp://ftp.cpc.ncep.noaa.gov/precip/CMORPH_V1.0/CRT/0.25deg-3HLY/gunzip -k LOCALDIR/*.gz

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


Add git-export.sh script to produce a source tarball for distribution

#!/bin/sh

set -e

if [ -z "$1" ] ; then
	echo "Usage: $0 <version>" >&2
	exit 1
fi

b="imagejfind"

git archive --format tar "v$1" "--prefix=$b-$1/" -o "$b-$1.tar"
gzip -9f "$b-$1.tar"

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


modify git_commit.sh

modify git_commit.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/skyaspnet/wenke.git/'


Novas Configurações

Novas Configurações

Signed-off-by: Rodrigo Cabral <793e1455c1fdf3353d934664fdf5c66470c91d73@gmail.com>

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/rodrixcornell/bin.git/'


Shut up, tests

Shut up, tests

function shunittest_shutup
{
    return 0
}

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


Added the script to run pdtools in development

#!/bin/sh
SCRIPT=`realpath -s $0`
SCRIPTPATH=`dirname $SCRIPT`

PYTHONPATH=$SCRIPTPATH python -m pdtools $@

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


Add a sanity test script

Add a sanity test script

#! /bin/bash

# Setup directories
WORK_DIR="$(pwd)"/..
CONFIG_DIR=${WORK_DIR}/config_example/
BENCHMARK_DIR=${WORK_DIR}/build/benchmarks/

BENCHMARK_LIST="$(ls ${BENCHMARK_DIR} | grep test*)"
CONFIG_LIST="$(ls ${CONFIG_DIR})"
PROFILER=nvprof

for bm in ${BENCHMARK_LIST[@]}
do
  EXE="$(find ${BENCHMARK_DIR}${bm} -executable -type f)"
  echo $bm
  trimed_bm="$(echo $bm | cut -d "_" -f2)"
  if [ ${trimed_bm} == "fwd" ] || [ ${trimed_bm} == "bwd" ]; then
    trimed_bm="$(echo $bm | cut -d "_" -f3)"
  fi
  for config in ${CONFIG_LIST[@]}
  do
    if [[ $config == *"$trimed_bm"* ]]; then
      echo "Configure file: " $config
      echo "${EXE} -config ${config} -debuginfo 1 -warmup 1"
      ${EXE} -config ${CONFIG_DIR}${config} -debuginfo 1 -warmup 1
    fi
  done
done

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


Copy config and at the same time do add some things into the config

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/cybeliak/mispronounceableness.git/'


Change behavior when JAVA_HOME is not set

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/yahoojapan/multiple-dimension-spread.git/'


common/hooks: use cp instead of ln

common/hooks: use cp instead of ln

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/Bubble-be/void-packages.git/'


Fix typo and improve file exclusions.

Fix typo and improve file exclusions.

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/gartung/fnal-art.git/'


Overall processing script.

Overall processing script.

#! /bin/bash

# (time countGoodKeysByTarget.sh) \
# | tee countGoodKeysByTarget.log

# (time tokenizeTitleAndTextAndSaveSeq.sh) \
# | tee tokenizeTitleAndTextAndSaveSeq.log

(time ./applyCrfSjSparkDescMemexHairEyesHj.sh) \
| tee applyCrfSjSparkDescMemexHairEyesHj.log

(time ./applyCrfSjSparkDescMemexNameEthnicHj.sh) \
| tee applyCrfSjSparkDescMemexNameEthnicHj.log

(time ./countCrfResultPhrases-crf-hair-eyes-hj.sh) \
| tee countCrfResultPhrases-crf-hair-eyes-hj.log

(time ./countCrfResultPhrases-crf-name-ethnic-hj.sh) \
| tee countCrfResultPhrases-crf-name-ethnic-hj.log

(time ./countCrfResultPhrasesFancy-crf-hair-eyes-hj.sh) \
| tee countCrfResultPhrasesFancy-crf-hair-eyes-hj.log

(time ./countCrfResultPhrasesFancy-crf-name-ethnic-hj.sh) \
| tee countCrfResultPhrasesFancy-crf-name-ethnic-hj.log

(time ./countCrfResultTokensFancy-crf-hair-eyes-hj.sh) \
| tee countCrfResultTokensFancy-crf-hair-eyes-hj.log

(time ./countCrfResultTokensFancy-crf-name-ethnic-hj.sh) \
| tee countCrfResultTokensFancy-crf-name-ethnic-hj.log

error: pathspec 'examples/hbase-dump-2016-06-15/process.sh' did not match any file(s) known to git


Fix bluetooth version check on OS X 10.11

error: pathspec 'Continuity' did not match any file(s) known to git
error: pathspec 'Activation' did not match any file(s) known to git
error: pathspec 'Tool.app/Contents/Resources/contitool.sh' did not match any file(s) known to git


add install-kd.sh script

add install-kd.sh 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/szkl/koding.git/'


Added script to generate combinators

Added script to generate combinators

#!/bin/sh
runghc -isrc src/Util/GenerateHtmlCombinators.hs

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


add vagrant provision script

add vagrant provision script

#!/usr/bin/env bash

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties -y

# install postgresql
#sudo apt-get update
#sudo apt-get install postgresql postgresql-contrib libpq-dev -y

# setup a database for the app
#sudo -u postgres createuser vagrant -s
#sudo -u vagrant createdb vagrant

# install pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

# install virtalenv globally
sudo pip install virtualenv

# create virtualenv
virtualenv flaskapp
source /home/vagrant/flaskapp/bin/activate
pip install -r /vagrant/requirements.txt

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


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/sharkspeed/dororis.git/'


updated init script

updated init 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/johncoleman83/AirBnB_clone_v2.git/'


[*] migrated to git submodules

[*] migrated to git submodules

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/ownport/docker-env.git/'


Setup script for cron backups

Setup script for cron backups

#!/bin/bash

# Halt on errors/unsets, change fail returns, change field separator, verbose mode
#
set -euo pipefail
IFS=$'\n\t'
[ "${VERBOSE:-}" != true ]|| set -x

# Parameters and mode variables
#
PARAM=${1:-""}
PROJECT=$( echo ${PARAM} | cut -d "/" -f 1 )
TARGET=$( echo ${PARAM} | cut -d "/" -f 2 )

# App and build settings
#
OC_BUILD=${OC_BUILD:-../backup.bc.yaml}
OC_DEPLOY=${OC_DEPLOY:-../backup.cj.yaml}
#
DRY_RUN=${DRY_RUN:-false}
SCHEDULE=${SCHEDULE:-}

# Show message if passed any params
#
if [ "${#}" -ne 1 ]
then
	set +x
	echo
	echo "PostgreSQL Backup Cronjob:"
	echo
	echo "Provide a project and a command."
	echo " ./cron-backup.sh PROJECT/TARGET"
	echo
	echo "Set variables to non-defaults at runtime.  E.g.:"
	echo " VERBOSE=true SCHEDULE=\"*/5 * * * *\" ./cron-backup.sh <...>"
	echo
	exit
fi

# Check project
#
CHECK=$( oc projects | tr -d '*' | grep -v "Using project" | grep "${PROJECT}" | awk '{ print $1 }' || echo )
if [ "${PROJECT}" != "${CHECK}" ]
then
	echo
	echo "Unable to access project ${PROJECT}"
	echo
	exit
fi

# Create build config and image
#
oc process -f ${OC_BUILD} \
	| oc apply -n moe-gwells-tools -f -

# Deploy, add SCHEDULE is provided
#
if [ -z "${SCHEDULE}" ]
then
	oc process -f ${OC_DEPLOY} -p TARGET=${TARGET} \
		| oc apply -n ${PROJECT} -f -
else
	oc process -f ${OC_DEPLOY} -p TARGET=${TARGET} -p SCHEDULE=${SCHEDULE} \
		| oc apply -n ${PROJECT} -f -
fi

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


Updated debian-console config script

Updated debian-console config 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/SaintGimp/BeagleBoneHardware.git/'


e2e without root fails because certs can't be viewed by wait_for_url

#!/bin/bash

# This script tests the high level end-to-end functionality demonstrated
# as part of the examples/sample-app

if [[ -z "$(which iptables)" ]]; then
	echo "IPTables not found - the end-to-end test requires a system with iptables for Kubernetes services."
	exit 1
fi
iptables --list > /dev/null 2>&1
if [ $? -ne 0 ]; then
	sudo iptables --list > /dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "You do not have iptables or sudo privileges.	Kubernetes services will not work without iptables access.	See https://github.com/GoogleCloudPlatform/kubernetes/issues/1859.	Try 'sudo hack/test-end-to-end.sh'."
		exit 1
	fi
fi

set -o errexit
set -o nounset
set -o pipefail

OS_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${OS_ROOT}/hack/util.sh"

echo "[INFO] Starting end-to-end test"

USE_LOCAL_IMAGES="${USE_LOCAL_IMAGES:-true}"
ROUTER_TESTS_ENABLED="${ROUTER_TESTS_ENABLED:-true}"

if [[ -z "${BASETMPDIR-}" ]]; then
	TMPDIR="${TMPDIR:-"/tmp"}"
	BASETMPDIR="${TMPDIR}/openshift-e2e"
	sudo rm -rf "${BASETMPDIR}"
	mkdir -p "${BASETMPDIR}"
fi
ETCD_DATA_DIR="${BASETMPDIR}/etcd"
VOLUME_DIR="${BASETMPDIR}/volumes"
CERT_DIR="${BASETMPDIR}/certs"
LOG_DIR="${LOG_DIR:-${BASETMPDIR}/logs}"
ARTIFACT_DIR="${ARTIFACT_DIR:-${BASETMPDIR}/artifacts}"
mkdir -p $LOG_DIR
mkdir -p $ARTIFACT_DIR
API_PORT="${API_PORT:-8443}"
API_SCHEME="${API_SCHEME:-https}"
API_HOST="${API_HOST:-localhost}"
PUBLIC_MASTER_HOST="${PUBLIC_MASTER_HOST:-${API_HOST}}"
KUBELET_SCHEME="${KUBELET_SCHEME:-http}"
KUBELET_PORT="${KUBELET_PORT:-10250}"

# use the docker bridge ip address until there is a good way to get the auto-selected address from master
# this address is considered stable
# Used by the docker-registry and the router pods to call back to the API
CONTAINER_ACCESSIBLE_API_HOST="${CONTAINER_ACCESSIBLE_API_HOST:-172.17.42.1}"

STI_CONFIG_FILE="${LOG_DIR}/stiAppConfig.json"
DOCKER_CONFIG_FILE="${LOG_DIR}/dockerAppConfig.json"
CUSTOM_CONFIG_FILE="${LOG_DIR}/customAppConfig.json"
GO_OUT="${OS_ROOT}/_output/local/go/bin"

# set path so OpenShift is available
export PATH="${GO_OUT}:${PATH}"

function cleanup()
{
	out=$?
	echo
	if [ $out -ne 0 ]; then
		echo "[FAIL] !!!!! Test Failed !!!!"
	else
		echo "[INFO] Test Succeeded"
	fi
	echo

	echo "[INFO] Dumping container logs to ${LOG_DIR}"
	for container in $(docker ps -aq); do
		docker logs "$container" >&"${LOG_DIR}/container-$container.log"
	done

	echo "[INFO] Dumping build log to ${LOG_DIR}"

	set +e
	osc get -n test builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n test >"${LOG_DIR}/stibuild.log"
	osc get -n docker builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n docker >"${LOG_DIR}/dockerbuild.log"
	osc get -n custom builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n custom >"${LOG_DIR}/custombuild.log"
	curl -L http://localhost:4001/v2/keys/?recursive=true > "${ARTIFACT_DIR}/etcd_dump.json"
	echo

	if [[ -z "${SKIP_TEARDOWN-}" ]]; then
		echo "[INFO] Tearing down test"
		pids="$(jobs -pr)"
		echo "[INFO] Children: ${pids}"
		sudo kill ${pids}
		sudo ps f
		set +u
		echo "[INFO] Stopping k8s docker containers"; docker ps | awk '{ print $NF " " $1 }' | grep ^k8s_ | awk '{print $2}'	| xargs -l -r docker stop
		if [[ -z "${SKIP_IMAGE_CLEANUP-}" ]]; then
			echo "[INFO] Removing k8s docker containers"; docker ps -a | awk '{ print $NF " " $1 }' | grep ^k8s_ | awk '{print $2}'	| xargs -l -r docker rm
		fi
		set -u
	fi
	set -e

	# clean up zero byte log files
	# Clean up large log files so they don't end up on jenkins
	find ${ARTIFACT_DIR} -name *.log -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
	find ${LOG_DIR} -name *.log -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
	find ${LOG_DIR} -name *.log -size 0 -exec echo Deleting {} because it is empty. \; -exec rm -f {} \;

	echo "[INFO] Exiting"
	exit $out
}

trap "exit" INT TERM
trap "cleanup" EXIT

function wait_for_app() {
	echo "[INFO] Waiting for app in namespace $1"
	echo "[INFO] Waiting for database pod to start"
	wait_for_command "osc get -n $1 pods -l name=database | grep -i Running" $((30*TIME_SEC))

	echo "[INFO] Waiting for database service to start"
	wait_for_command "osc get -n $1 services | grep database" $((20*TIME_SEC))
	DB_IP=$(osc get -n $1 -o template --output-version=v1beta1 --template="{{ .portalIP }}" service database)

	echo "[INFO] Waiting for frontend pod to start"
	wait_for_command "osc get -n $1 pods | grep frontend | grep -i Running" $((120*TIME_SEC))

	echo "[INFO] Waiting for frontend service to start"
	wait_for_command "osc get -n $1 services | grep frontend" $((20*TIME_SEC))
	FRONTEND_IP=$(osc get -n $1 -o template --output-version=v1beta1 --template="{{ .portalIP }}" service frontend)

	echo "[INFO] Waiting for database to start..."
	wait_for_url_timed "http://${DB_IP}:5434" "[INFO] Database says: " $((3*TIME_MIN))

	echo "[INFO] Waiting for app to start..."
	wait_for_url_timed "http://${FRONTEND_IP}:5432" "[INFO] Frontend says: " $((2*TIME_MIN))
}

# Wait for builds to complete
# $1 namespace
function wait_for_build() {
	echo "[INFO] Waiting for $1 namespace build to complete"
	wait_for_command "osc get -n $1 builds | grep -i complete" $((10*TIME_MIN)) "osc get -n $1 builds | grep -i -e failed -e error"
	BUILD_ID=`osc get -n $1 builds -o template -t "{{with index .items 0}}{{.metadata.name}}{{end}}"`
	echo "[INFO] Build ${BUILD_ID} finished"
	osc build-logs -n $1 $BUILD_ID > $LOG_DIR/$1build.log
}

# Setup
stop_openshift_server
echo "[INFO] `openshift version`"
echo "[INFO] Server logs will be at:    ${LOG_DIR}/openshift.log"
echo "[INFO] Test artifacts will be in: ${ARTIFACT_DIR}"
echo "[INFO] Volumes dir is:            ${VOLUME_DIR}"
echo "[INFO] Certs dir is:              ${CERT_DIR}"

# Start All-in-one server and wait for health
# Specify the scheme and port for the listen address, but let the IP auto-discover.	Set --public-master to localhost, for a stable link to the console.
echo "[INFO] Starting OpenShift server"
sudo env "PATH=${PATH}" OPENSHIFT_ON_PANIC=crash openshift start --listen="${API_SCHEME}://0.0.0.0:${API_PORT}" --public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}" --hostname="127.0.0.1" --volume-dir="${VOLUME_DIR}" --etcd-dir="${ETCD_DATA_DIR}" --cert-dir="${CERT_DIR}" --loglevel=4 --latest-images &> "${LOG_DIR}/openshift.log" &
OS_PID=$!

if [[ "${API_SCHEME}" == "https" ]]; then
	export CURL_CA_BUNDLE="${CERT_DIR}/master/root.crt"
	export CURL_CERT="${CERT_DIR}/admin/cert.crt"
	export CURL_KEY="${CERT_DIR}/admin/key.key"

	# Generate the certs first
	wait_for_file "${CURL_CERT}" 0.5 80

	# Read client cert data in to send to containerized components
	sudo chmod -R a+rX "${CERT_DIR}/openshift-client/"

	# Make osc use ${CERT_DIR}/admin/.kubeconfig, and ignore anything in the running user's $HOME dir
	sudo chmod -R a+rwX "${CERT_DIR}/admin/"
	export HOME="${CERT_DIR}/admin"
	export KUBECONFIG="${CERT_DIR}/admin/.kubeconfig"
	echo "[INFO] To debug: export KUBECONFIG=$KUBECONFIG"
fi

wait_for_url "${KUBELET_SCHEME}://${API_HOST}:${KUBELET_PORT}/healthz" "[INFO] kubelet: " 0.5 60
wait_for_url "${API_SCHEME}://${API_HOST}:${API_PORT}/healthz" "apiserver: " 0.25 80
wait_for_url "${API_SCHEME}://${API_HOST}:${API_PORT}/api/v1beta1/minions/127.0.0.1" "apiserver(minions): " 0.25 80

# Set KUBERNETES_MASTER for osc
export KUBERNETES_MASTER="${API_SCHEME}://${API_HOST}:${API_PORT}"

# create test project so that this shows up in the console
osc create project -f examples/sample-app/project.json

echo "The console should be available at ${API_SCHEME}://${PUBLIC_MASTER_HOST}:$(($API_PORT + 1)).	You may need to visit ${API_SCHEME}://${PUBLIC_MASTER_HOST}:${API_PORT} first to accept the certificate."

# install the registry
CERT_DIR="${CERT_DIR}/openshift-client" hack/install-registry.sh

echo "[INFO] Waiting for Docker registry pod to start"
wait_for_command "osc get pods | grep registrypod | grep -i Running" $((5*TIME_MIN))

echo "[INFO] Waiting for Docker registry service to start"
wait_for_command "osc get services | grep registrypod"

# services can end up on any IP.	Make sure we get the IP we need for the docker registry
DOCKER_REGISTRY_IP=$(osc get -o template --output-version=v1beta1 --template="{{ .portalIP }}" service docker-registry)

echo "[INFO] Probing the docker-registry"
wait_for_url_timed "http://${DOCKER_REGISTRY_IP}:5001" "[INFO] Docker registry says: " $((2*TIME_MIN))

echo "[INFO] Pre-pulling and pushing centos7"
docker pull centos:centos7
echo "[INFO] Pulled centos7"

docker tag -f centos:centos7 ${DOCKER_REGISTRY_IP}:5001/cached/centos:centos7
docker push ${DOCKER_REGISTRY_IP}:5001/cached/centos:centos7
echo "[INFO] Pushed centos7"

# Process template and create
echo "[INFO] Submitting application template json for processing..."
osc process -n test -f examples/sample-app/application-template-stibuild.json > "${STI_CONFIG_FILE}"
osc process -n docker -f examples/sample-app/application-template-dockerbuild.json > "${DOCKER_CONFIG_FILE}"
osc process -n custom -f examples/sample-app/application-template-custombuild.json > "${CUSTOM_CONFIG_FILE}"

echo "[INFO] Applying STI application config"
osc create -n test -f "${STI_CONFIG_FILE}"

# Trigger build
echo "[INFO] Invoking generic web hook to trigger new sti build using curl"
curl -k -X POST $API_SCHEME://$API_HOST:$API_PORT/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic?namespace=test && sleep 3
wait_for_build "test"
wait_for_app "test"

#echo "[INFO] Applying Docker application config"
#osc create -n docker -f "${DOCKER_CONFIG_FILE}"
#echo "[INFO] Invoking generic web hook to trigger new docker build using curl"
#curl -k -X POST $API_SCHEME://$API_HOST:$API_PORT/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic?namespace=docker && sleep 3
#wait_for_build "docker"
#wait_for_app "docker"

#echo "[INFO] Applying Custom application config"
#osc create -n custom -f "${CUSTOM_CONFIG_FILE}"
#echo "[INFO] Invoking generic web hook to trigger new custom build using curl"
#curl -k -X POST $API_SCHEME://$API_HOST:$API_PORT/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic?namespace=custom && sleep 3
#wait_for_build "custom"
#wait_for_app "custom"

if [[ "$ROUTER_TESTS_ENABLED" == "true" ]]; then
	echo "[INFO] Installing router with master url of ${API_SCHEME}://${CONTAINER_ACCESSIBLE_API_HOST}:${API_PORT} and starting pod..."
	echo "[INFO] To disable router testing set ROUTER_TESTS_ENABLED=false..."
	CERT_DIR="${CERT_DIR}/openshift-client" "${OS_ROOT}/hack/install-router.sh" "router1" "${API_SCHEME}://${CONTAINER_ACCESSIBLE_API_HOST}:${API_PORT}"
	wait_for_command "osc get pods | grep router1 | grep -i Running" $((5*TIME_MIN))

	echo "[INFO] Validating routed app response..."
	validate_response "-s -k --resolve www.example.com:443:${CONTAINER_ACCESSIBLE_API_HOST} https://www.example.com" "Hello from OpenShift" 0.2 50
else
	echo "[INFO] Validating app response..."
	validate_response "http://${FRONTEND_IP}:5432" "Hello from OpenShift"
fi

#!/bin/bash

# This script tests the high level end-to-end functionality demonstrated
# as part of the examples/sample-app

if [[ -z "$(which iptables)" ]]; then
	echo "IPTables not found - the end-to-end test requires a system with iptables for Kubernetes services."
	exit 1
fi
iptables --list > /dev/null 2>&1
if [ $? -ne 0 ]; then
	sudo iptables --list > /dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "You do not have iptables or sudo privileges.	Kubernetes services will not work without iptables access.	See https://github.com/GoogleCloudPlatform/kubernetes/issues/1859.	Try 'sudo hack/test-end-to-end.sh'."
		exit 1
	fi
fi

set -o errexit
set -o nounset
set -o pipefail

OS_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${OS_ROOT}/hack/util.sh"

echo "[INFO] Starting end-to-end test"

USE_LOCAL_IMAGES="${USE_LOCAL_IMAGES:-true}"
ROUTER_TESTS_ENABLED="${ROUTER_TESTS_ENABLED:-true}"

if [[ -z "${BASETMPDIR-}" ]]; then
	TMPDIR="${TMPDIR:-"/tmp"}"
	BASETMPDIR="${TMPDIR}/openshift-e2e"
	sudo rm -rf "${BASETMPDIR}"
	mkdir -p "${BASETMPDIR}"
fi
ETCD_DATA_DIR="${BASETMPDIR}/etcd"
VOLUME_DIR="${BASETMPDIR}/volumes"
CERT_DIR="${BASETMPDIR}/certs"
LOG_DIR="${LOG_DIR:-${BASETMPDIR}/logs}"
ARTIFACT_DIR="${ARTIFACT_DIR:-${BASETMPDIR}/artifacts}"
mkdir -p $LOG_DIR
mkdir -p $ARTIFACT_DIR
API_PORT="${API_PORT:-8443}"
API_SCHEME="${API_SCHEME:-https}"
API_HOST="${API_HOST:-localhost}"
PUBLIC_MASTER_HOST="${PUBLIC_MASTER_HOST:-${API_HOST}}"
KUBELET_SCHEME="${KUBELET_SCHEME:-http}"
KUBELET_PORT="${KUBELET_PORT:-10250}"

# use the docker bridge ip address until there is a good way to get the auto-selected address from master
# this address is considered stable
# Used by the docker-registry and the router pods to call back to the API
CONTAINER_ACCESSIBLE_API_HOST="${CONTAINER_ACCESSIBLE_API_HOST:-172.17.42.1}"

STI_CONFIG_FILE="${LOG_DIR}/stiAppConfig.json"
DOCKER_CONFIG_FILE="${LOG_DIR}/dockerAppConfig.json"
CUSTOM_CONFIG_FILE="${LOG_DIR}/customAppConfig.json"
GO_OUT="${OS_ROOT}/_output/local/go/bin"

# set path so OpenShift is available
export PATH="${GO_OUT}:${PATH}"

function cleanup()
{
	out=$?
	echo
	if [ $out -ne 0 ]; then
		echo "[FAIL] !!!!! Test Failed !!!!"
	else
		echo "[INFO] Test Succeeded"
	fi
	echo

	echo "[INFO] Dumping container logs to ${LOG_DIR}"
	for container in $(docker ps -aq); do
		docker logs "$container" >&"${LOG_DIR}/container-$container.log"
	done

	echo "[INFO] Dumping build log to ${LOG_DIR}"

	set +e
	osc get -n test builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n test >"${LOG_DIR}/stibuild.log"
	osc get -n docker builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n docker >"${LOG_DIR}/dockerbuild.log"
	osc get -n custom builds -o template -t '{{ range .items }}{{.metadata.name}}{{ "\n" }}{{end}}' | xargs -r -l osc build-logs -n custom >"${LOG_DIR}/custombuild.log"
	curl -L http://localhost:4001/v2/keys/?recursive=true > "${ARTIFACT_DIR}/etcd_dump.json"
	echo

	if [[ -z "${SKIP_TEARDOWN-}" ]]; then
		echo "[INFO] Tearing down test"
		pids="$(jobs -pr)"
		echo "[INFO] Children: ${pids}"
		sudo kill ${pids}
		sudo ps f
		set +u
		echo "[INFO] Stopping k8s docker containers"; docker ps | awk '{ print $NF " " $1 }' | grep ^k8s_ | awk '{print $2}'	| xargs -l -r docker stop
		if [[ -z "${SKIP_IMAGE_CLEANUP-}" ]]; then
			echo "[INFO] Removing k8s docker containers"; docker ps -a | awk '{ print $NF " " $1 }' | grep ^k8s_ | awk '{print $2}'	| xargs -l -r docker rm
		fi
		set -u
	fi
	set -e

	# clean up zero byte log files
	# Clean up large log files so they don't end up on jenkins
	find ${ARTIFACT_DIR} -name *.log -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
	find ${LOG_DIR} -name *.log -size +20M -exec echo Deleting {} because it is too big. \; -exec rm -f {} \;
	find ${LOG_DIR} -name *.log -size 0 -exec echo Deleting {} because it is empty. \; -exec rm -f {} \;

	echo "[INFO] Exiting"
	exit $out
}

trap "exit" INT TERM
trap "cleanup" EXIT

function wait_for_app() {
	echo "[INFO] Waiting for app in namespace $1"
	echo "[INFO] Waiting for database pod to start"
	wait_for_command "osc get -n $1 pods -l name=database | grep -i Running" $((30*TIME_SEC))

	echo "[INFO] Waiting for database service to start"
	wait_for_command "osc get -n $1 services | grep database" $((20*TIME_SEC))
	DB_IP=$(osc get -n $1 -o template --output-version=v1beta1 --template="{{ .portalIP }}" service database)

	echo "[INFO] Waiting for frontend pod to start"
	wait_for_command "osc get -n $1 pods | grep frontend | grep -i Running" $((120*TIME_SEC))

	echo "[INFO] Waiting for frontend service to start"
	wait_for_command "osc get -n $1 services | grep frontend" $((20*TIME_SEC))
	FRONTEND_IP=$(osc get -n $1 -o template --output-version=v1beta1 --template="{{ .portalIP }}" service frontend)

	echo "[INFO] Waiting for database to start..."
	wait_for_url_timed "http://${DB_IP}:5434" "[INFO] Database says: " $((3*TIME_MIN))

	echo "[INFO] Waiting for app to start..."
	wait_for_url_timed "http://${FRONTEND_IP}:5432" "[INFO] Frontend says: " $((2*TIME_MIN))
}

# Wait for builds to complete
# $1 namespace
function wait_for_build() {
	echo "[INFO] Waiting for $1 namespace build to complete"
	wait_for_command "osc get -n $1 builds | grep -i complete" $((10*TIME_MIN)) "osc get -n $1 builds | grep -i -e failed -e error"
	BUILD_ID=`osc get -n $1 builds -o template -t "{{with index .items 0}}{{.metadata.name}}{{end}}"`
	echo "[INFO] Build ${BUILD_ID} finished"
	osc build-logs -n $1 $BUILD_ID > $LOG_DIR/$1build.log
}

# Setup
stop_openshift_server
echo "[INFO] `openshift version`"
echo "[INFO] Server logs will be at:		${LOG_DIR}/openshift.log"
echo "[INFO] Test artifacts will be in: ${ARTIFACT_DIR}"
echo "[INFO] Volumes dir is:						${VOLUME_DIR}"
echo "[INFO] Certs dir is:							${CERT_DIR}"

# Start All-in-one server and wait for health
# Specify the scheme and port for the listen address, but let the IP auto-discover.	Set --public-master to localhost, for a stable link to the console.
echo "[INFO] Starting OpenShift server"
sudo env "PATH=${PATH}" OPENSHIFT_ON_PANIC=crash openshift start --listen="${API_SCHEME}://0.0.0.0:${API_PORT}" --public-master="${API_SCHEME}://${PUBLIC_MASTER_HOST}" --hostname="127.0.0.1" --volume-dir="${VOLUME_DIR}" --etcd-dir="${ETCD_DATA_DIR}" --cert-dir="${CERT_DIR}" --loglevel=4 --latest-images &> "${LOG_DIR}/openshift.log" &
OS_PID=$!

if [[ "${API_SCHEME}" == "https" ]]; then
	export CURL_CA_BUNDLE="${CERT_DIR}/master/root.crt"
	export CURL_CERT="${CERT_DIR}/admin/cert.crt"
	export CURL_KEY="${CERT_DIR}/admin/key.key"
fi

wait_for_url "${KUBELET_SCHEME}://${API_HOST}:${KUBELET_PORT}/healthz" "[INFO] kubelet: " 0.5 60
wait_for_url "${API_SCHEME}://${API_HOST}:${API_PORT}/healthz" "apiserver: " 0.25 80
wait_for_url "${API_SCHEME}://${API_HOST}:${API_PORT}/api/v1beta1/minions/127.0.0.1" "apiserver(minions): " 0.25 80

# Set KUBERNETES_MASTER for osc
export KUBERNETES_MASTER="${API_SCHEME}://${API_HOST}:${API_PORT}"
if [[ "${API_SCHEME}" == "https" ]]; then
	# Read client cert data in to send to containerized components
	sudo chmod -R a+rX "${CERT_DIR}/openshift-client/"

	# Make osc use ${CERT_DIR}/admin/.kubeconfig, and ignore anything in the running user's $HOME dir
	sudo chmod -R a+rwX "${CERT_DIR}/admin/"
	export HOME="${CERT_DIR}/admin"
	export KUBECONFIG="${CERT_DIR}/admin/.kubeconfig"
	echo "[INFO] To debug: export KUBECONFIG=$KUBECONFIG"
fi

# create test project so that this shows up in the console
osc create project -f examples/sample-app/project.json

echo "The console should be available at ${API_SCHEME}://${PUBLIC_MASTER_HOST}:$(($API_PORT + 1)).	You may need to visit ${API_SCHEME}://${PUBLIC_MASTER_HOST}:${API_PORT} first to accept the certificate."

# install the registry
CERT_DIR="${CERT_DIR}/openshift-client" hack/install-registry.sh

echo "[INFO] Waiting for Docker registry pod to start"
wait_for_command "osc get pods | grep registrypod | grep -i Running" $((5*TIME_MIN))

echo "[INFO] Waiting for Docker registry service to start"
wait_for_command "osc get services | grep registrypod"

# services can end up on any IP.	Make sure we get the IP we need for the docker registry
DOCKER_REGISTRY_IP=$(osc get -o template --output-version=v1beta1 --template="{{ .portalIP }}" service docker-registry)

echo "[INFO] Probing the docker-registry"
wait_for_url_timed "http://${DOCKER_REGISTRY_IP}:5001" "[INFO] Docker registry says: " $((2*TIME_MIN))

echo "[INFO] Pre-pulling and pushing centos7"
docker pull centos:centos7
echo "[INFO] Pulled centos7"

docker tag -f centos:centos7 ${DOCKER_REGISTRY_IP}:5001/cached/centos:centos7
docker push ${DOCKER_REGISTRY_IP}:5001/cached/centos:centos7
echo "[INFO] Pushed centos7"

# Process template and create
echo "[INFO] Submitting application template json for processing..."
osc process -n test -f examples/sample-app/application-template-stibuild.json > "${STI_CONFIG_FILE}"
osc process -n docker -f examples/sample-app/application-template-dockerbuild.json > "${DOCKER_CONFIG_FILE}"
osc process -n custom -f examples/sample-app/application-template-custombuild.json > "${CUSTOM_CONFIG_FILE}"

echo "[INFO] Applying STI application config"
osc create -n test -f "${STI_CONFIG_FILE}"

# Trigger build
echo "[INFO] Invoking generic web hook to trigger new sti build using curl"
curl -k -X POST $API_SCHEME://$API_HOST:$API_PORT/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic?namespace=test && sleep 3
wait_for_build "test"
wait_for_app "test"

#echo "[INFO] Applying Docker application config"
#osc create -n docker -f "${DOCKER_CONFIG_FILE}"
#echo "[INFO] Invoking generic web hook to trigger new docker build using curl"
#curl -k -X POST $API_SCHEME://$API_HOST:$API_PORT/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic?namespace=docker && sleep 3
#wait_for_build "docker"
#wait_for_app "docker"

#echo "[INFO] Applying Custom application config"
#osc create -n custom -f "${CUSTOM_CONFIG_FILE}"
#echo "[INFO] Invoking generic web hook to trigger new custom build using curl"
#curl -k -X POST $API_SCHEME://$API_HOST:$API_PORT/osapi/v1beta1/buildConfigHooks/ruby-sample-build/secret101/generic?namespace=custom && sleep 3
#wait_for_build "custom"
#wait_for_app "custom"

if [[ "$ROUTER_TESTS_ENABLED" == "true" ]]; then
	echo "[INFO] Installing router with master url of ${API_SCHEME}://${CONTAINER_ACCESSIBLE_API_HOST}:${API_PORT} and starting pod..."
	echo "[INFO] To disable router testing set ROUTER_TESTS_ENABLED=false..."
	CERT_DIR="${CERT_DIR}/openshift-client" "${OS_ROOT}/hack/install-router.sh" "router1" "${API_SCHEME}://${CONTAINER_ACCESSIBLE_API_HOST}:${API_PORT}"
	wait_for_command "osc get pods | grep router1 | grep -i Running" $((5*TIME_MIN))

	echo "[INFO] Validating routed app response..."
	validate_response "-s -k --resolve www.example.com:443:${CONTAINER_ACCESSIBLE_API_HOST} https://www.example.com" "Hello from OpenShift" 0.2 50
else
	echo "[INFO] Validating app response..."
	validate_response "http://${FRONTEND_IP}:5432" "Hello from OpenShift"
fi