add activate ceph script

add activate ceph script

#!/bin/bash

CMD_PATH=.
DST_PATH=./conf_orig
CONF_DEPLOY_DIR=./conf_deploy
MY_LOCALE=$($CMD_PATH/get-conf-data.sh ./locale.txt LOCALE)
if [ $MY_LOCALE = 'CN' ]; then
    source ./locale_cn.txt
else
    source ./locale_en.txt
fi

PREFIX_STORAGE=$($CMD_PATH/get-max-prefix.sh $DST_PATH Storage.txt)
sed   -i  "/^GLANCE_STORAGE=/d"      $DST_PATH/$PREFIX_STORAGE-Storage.txt
sed   -i  "/^CINDER_STORAGE=/d"      $DST_PATH/$PREFIX_STORAGE-Storage.txt
sed   -i  "/^NOVA_STORAGE=/d"        $DST_PATH/$PREFIX_STORAGE-Storage.txt
echo      "GLANCE_STORAGE=ceph"  >>  $DST_PATH/$PREFIX_STORAGE-Storage.txt
echo      "CINDER_STORAGE=ceph"  >>  $DST_PATH/$PREFIX_STORAGE-Storage.txt
echo      "NOVA_STORAGE=ceph"    >>  $DST_PATH/$PREFIX_STORAGE-Storage.txt

sed   -i  "/^GLANCE_STORAGE=/c GLANCE_STORAGE=ceph"  $DST_PATH/*-env.sh
sed   -i  "/^CINDER_STORAGE=/c CINDER_STORAGE=ceph"  $DST_PATH/*-env.sh
sed   -i  "/^NOVA_STORAGE=/c   NOVA_STORAGE=ceph"    $DST_PATH/*-env.sh

echo "Done, will auto install ceph when execute: ./deploy.sh"

#

exit 0

error: pathspec 'DeployScripts/activate-ceph.sh' did not match any file(s) known to git


WIP Binutils

WIP Binutils

#!/bin/bash
source environ.sh

BROKEN

SRC=ftp://sourceware.org/pub/binutils/snapshots/binutils-2.24.90.tar.bz2
DIR=binutils-2.24.90

CONFIGURE_ARGS="--host=i386-elf-redox --prefix=$PREFIX"
configure_template $*

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


adding uninstall script

adding uninstall script

#! /bin/bash
#
# Subnodes uninstall script. Removes dnsmasq, hostapd, bridge-utils, batctl, iw. Does *not* yet remove Node.js. Deletes subnoes folder and files within.
# Sarah Grant
# Updated 16 April 2015
#
# TO-DO
# - Remove node.js
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CHECK USER PRIVILEGES
(( `id -u` )) && echo "This script *must* be ran with root privileges, try prefixing with sudo. i.e sudo $0" && exit 1

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Uninstall Subnodes
#
read -p "Do you wish to uninstall subnodes from your Raspberry Pi? Hitting return will continue with the default 'No' option and exit this script." yn
case $yn in
	[Yy]* )
		clear
		echo "Disabling the batman-adv kernel..."
		# remove the batman-adv module to be started on boot
		#sed -i '$a batman-adv' /etc/modules
		modprobe -r batman-adv;
		echo ""

		echo -en "Disabling hostapd and dnsmasq on boot... 			"
		update-rc.d hostapd disable
		update-rc.d dnsmasq disable

		# remove hostapd init file
		echo -en "Deleting default hostapd and configuration files...			"
		rm /etc/default/hostapd
		rm /etc/hostapd/hostapd.conf
		echo -en "[OK]\n"

		# remove dnsmasq
		echo -en "Deleting dnsmasq configuration file... 			"
		rm /etc/dnsmasq.conf
		echo -en "[OK]\n"

		echo ""
		echo -en "Purging iw, batctl, bridge-utils, hostapd and dnsmasq... 			"
		# how do i uninstall with apt-get
		apt-get purge -y bridge-utils hostapd dnsmasq batctl iw
		echo -en "[OK]\n"

		# restore the previous interfaces file
		echo -en "Restoring previous network interfaces configuration file... 			"
		rm /etc/network/interfaces
		cp /etc/network/interfaces.bak /etc/network/interfaces
		echo -en "[OK]\n"

		# Remove startup scripts and delete
		echo -en "Disabling and deleting startup subnodes startup scripts... 			"
		update-rc.d -f subnodes_mesh remove
		rm /etc/init.d/subnodes_mesh
		update-rc.d -f subnodes_ap remove
		rm /etc/init.d/subnodes_ap

		echo "Deleting subnodes folder			"
		rm -rf /home/pi/subnodes
		echo -en "[OK]\n"
	;;
	[Nn]* ) ;;
esac

exit 0

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


moving john-smith-taggers tests out of Makefile and into a shell script run by tests

#!/bin/sh

set -e

cd $(dirname $0)/../../..

## to make real tests, we need to dump a non-time-sensitive
## extract from these Chunk files and compare it to a stored
## copy of what is expected.
git checkout -- data/john-smith/john-smith-0.sc
git checkout -- data/john-smith/john-smith-tagged-by-lingpipe-0.sc
rm -f data/john-smith/john-smith-tagged-by-lingpipe-test-0.sc
rm -rf tmp
mkdir tmp

echo data/john-smith/original | python -m streamcorpus_pipeline.run configs/john-smith-lingpipe.yaml
echo data/john-smith/john-smith-0.sc | python -m streamcorpus_pipeline.run configs/john-smith-lingpipe-from-chunk.yaml

## compare dumps
python -m streamcorpus.dump data/john-smith/john-smith-tagged-by-lingpipe-0.sc      --tokens > tmp/lp-0.tsv
python -m streamcorpus.dump data/john-smith/john-smith-tagged-by-lingpipe-test-0.sc --tokens > tmp/lp-test-0.tsv

diff tmp/lp-0.tsv tmp/lp-test-0.tsv || { echo 'failed!'; exit 1; }
diff tmp/lp-0.tsv data/john-smith/john-smith-tagged-by-lingpipe-0.tsv || { echo 'failed!'; exit 1; }

echo data/john-smith/original | python -m streamcorpus_pipeline.run configs/john-smith-serif-streamcorpus_one_step.yaml
echo data/john-smith/john-smith-0.sc | python -m streamcorpus_pipeline.run configs/john-smith-serif-streamcorpus_generate_serifxml.yaml
echo data/john-smith/john-smith-tagged-by-serifxml-only.sc | python -m streamcorpus_pipeline.run configs/john-smith-serif-streamcorpus_read_serifxml.yaml

## compare dumps
python -m streamcorpus.dump data/john-smith/john-smith-tagged-by-serif-0.sc      --tokens > tmp/serif-0.tsv
python -m streamcorpus.dump data/john-smith/john-smith-tagged-by-serif-via-serifxml-0.sc    --tokens > tmp/serif-test-0.tsv

diff tmp/serif-0.tsv data/john-smith/john-smith-tagged-by-serif-0.tsv
diff tmp/serif-0.tsv tmp/serif-test-0.tsv || { echo 'failed!'; exit 1; }

## this is so slow that there must be something wrong with our
## build of Stanford CoreNLP
#echo data/john-smith/john-smith-0.sc | python -m streamcorpus.pipeline.run configs/john-smith-stanford-from-chunk.yaml

rm -rf tmp

error: pathspec 'src/tests/streamcorpus_pipeline/john-smith-taggers.sh' did not match any file(s) known to git


none: further script fix

none: further script fix

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/langurmonkey/gaiasky.git/'


Add a script to provision on Atmosphere instances

#!/bin/bash
set -e

TMP_DIR=$(mktemp -d)

# Checkout latest release of Flow
git clone https://github.com/Kitware/flow.git $TMP_DIR
pushd $TMP_DIR
git checkout "$(git describe --tags $(git rev-list --tags --max-count=1))"

# Create inventory file to provision localhost
# This only provisions the "girder" host (updating Girder and Flow)
pushd $TMP_DIR/devops/ansible
echo -e "[girder]\nlocalhost" > inventory

# Run ansible on localhost
ansible-playbook --inventory inventory --connection=local site.yml

error: pathspec 'devops/atmosphere/post-scripts.d/provision.sh' did not match any file(s) known to git


added setup script for when switching workstations

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/pauldeden/my-workstation-scripts.git/'


added sync-env script

added sync-env 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/BrentDorsey/pipeline.git/'


Add init.sh

Add init.sh

#!/bin/bash
#
# See more info at https://github.com/tmux-plugins/tpm

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

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


Add a python/install.sh script

Add a python/install.sh script

Ideally I want to just have one script/install script that runs ./install.sh in
every directory in my dotfiles. Then we have a loose framework to build up machines.
But I'm too lazy, so pulls accepted. :)

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


Add a script building image from archive on GitHub Release

#!/usr/bin/env bash

BASE_IMAGE="norionomura/swift:base4"
ARCHIVE=swift-3.1.1-RELEASE-3f82132-with-sourcekit.tar.gz

if [ ! -f "${ARCHIVE}" ]; then
  curl -L https://github.com/norio-nomura/docker-sourcekit-builder/releases/download/311/$ARCHIVE -O
fi

cat <<-EOF | docker build -f - -t norionomura/sourcekit:311 .
FROM ${BASE_IMAGE}
ADD ${ARCHIVE} /
EOF

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


More generic...more generic...

More generic...more generic...

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/epiphyte/phabricator-tools.git/'


redis up and down

redis up and down

alias redis-up='redis-server /usr/local/etc/redis.conf > /dev/null &'
alias redis-down='killall redis-server'

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


Changed apk repositories

Changed apk repositories

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/Kittyhacker101-Software/KatOS.git/'


add auto build versioning

add auto build versioning

#Update build number with number of git commits
buildNumber=$(git rev-list HEAD | wc -l | tr -d ' ')
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"

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


add untrack command

add untrack command

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/levinsamuel/rand.git/'


add script for all closed parts

add script for all closed parts

#!/bin/sh

for i in sql network local ; do
	./wine-etersoft-$i.sh $@
done

error: pathspec 'bin-wine/wine-etersoft-all.sh' did not match any file(s) known to git


Fixed nokogiri dependencies.

Fixed nokogiri dependencies.

#!/usr/bin/env bash

provision ruby

# checks if a gem is bundled
function bundles () {
    local lockfile=`readlink -f "${2:-/vagrant/Gemfile}.lock"`
    grep -o " ${1}[ $]" $lockfile >/dev/null 2>&1
}
# installs bundle from given path or /vagrant
function install-bundle () {
    local gemfile=`readlink -f "${1:-/vagrant}/Gemfile"`

    while :
    do
        can bundle && break || gem install --no-ri --no-rdoc bundler >/dev/null
    done

    bundles pg $gemfile && {
        provision build pgsql
        has libpq-dev ||
        apt-install libpq-dev
    }
    bundles curb $gemfile && {
        provision build
        has libcurl4-openssl-dev ||
        apt-install libcurl4-openssl-dev
    }
    bundles nokogiri $gemfile && {
        provision build
        has libxslt1-dev && has libxml2-dev ||
        apt-install libxslt1-dev libxml2-dev
    }
    bundles rmagick $gemfile && {
        provision build
        has libmagickwand-dev ||
        apt-install libmagickwand-dev
    }
    bundles sqlite3 $gemfile && {
        provision build
        has libsqlite3-dev ||
        apt-install libsqlite3-dev
    }
    bundles resque $gemfile && {
        has redis-server ||
        apt-install redis-server
    }

    bundle check >/dev/null || {
        echo "Installing bundle..."
        as vagrant "bundle install --no-deployment --path=/home/vagrant/gems --gemfile=${gemfile} --quiet --no-cache --without doc production"
    }
}
# runs rake tasts as vagrant user
function carry-out () {
    local directory=`pwd`

    while getopts "at:" flag
    do
        case "${flag}" in
            at)
                directory=$OPTARG
                ;;
        esac
    done

    gemfile=`readlink -f "${directory}/Gemfile"`
    rakefile=`readlink -f "${directory}/Rakefile"`

    as vagrant "BUNDLE_GEMFILE=${gemfile} bundle exec rake -f${rakefile} $@"
}

#!/usr/bin/env bash

provision ruby

# checks if a gem is bundled
function bundles () {
    local lockfile=`readlink -f "${2:-/vagrant/Gemfile}.lock"`
    grep -o " ${1}[ $]" $lockfile >/dev/null 2>&1
}
# installs bundle from given path or /vagrant
function install-bundle () {
    local gemfile=`readlink -f "${1:-/vagrant}/Gemfile"`

    while :
    do
        can bundle && break || gem install --no-ri --no-rdoc bundler >/dev/null
    done

    bundles pg $gemfile && {
        provision build pgsql
        has libpq-dev ||
        apt-install libpq-dev
    }
    bundles curb $gemfile && {
        provision build
        has libcurl4-openssl-dev ||
        apt-install libcurl4-openssl-dev
    }
    bundles nokogiri $gemfile && {
        provision build
        has libxslt1.1 && has libxml2-dev ||
        apt-install libxslt1.1 libxml2-dev
    }
    bundles rmagick $gemfile && {
        provision build
        has libmagickwand-dev ||
        apt-install libmagickwand-dev
    }
    bundles sqlite3 $gemfile && {
        provision build
        has libsqlite3-dev ||
        apt-install libsqlite3-dev
    }
    bundles resque $gemfile && {
        has redis-server ||
        apt-install redis-server
    }

    bundle check >/dev/null || {
        echo "Installing bundle..."
        as vagrant "bundle install --no-deployment --path=/home/vagrant/gems --gemfile=${gemfile} --quiet --no-cache --without doc production"
    }
}
# runs rake tasts as vagrant user
function carry-out () {
    local directory=`pwd`

    while getopts "at:" flag
    do
        case "${flag}" in
            at)
                directory=$OPTARG
                ;;
        esac
    done

    gemfile=`readlink -f "${directory}/Gemfile"`
    rakefile=`readlink -f "${directory}/Rakefile"`

    as vagrant "BUNDLE_GEMFILE=${gemfile} bundle exec rake -f${rakefile} $@"
}


Use Sublime Text for "bundle open"

Use Sublime Text for "bundle open"

# Use Sublime Text as an editor for "bundle open".

export BUNDLER_EDITOR=subl

error: pathspec 'ruby/bundler.bash' did not match any file(s) known to git


Better pathing for updating homebrew formula

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/thomasmmitchell/spruce.git/'


03_osx.sh: dashboard out

03_osx.sh: dashboard out

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


Overlays for modules out of nametab dirtab

overlay paramcoq https://github.com/SkySkimmer/paramcoq locatemod-noopen 15078

error: pathspec 'dev/ci/user-overlays/15078-SkySkimmer-locatemod-noopen.sh' did not match any file(s) known to git


Replace ~/ with /home/dawikur in base16 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/dawikur/mnl.git/'


Wed Dec 18 14:24:12 CET 2013: scripts/confbk.sh: 8c8 < for FILENAME in $(cat scripts/.conftrack.txt) --- > for FILENAME in .bashrc cheatsheet.txt se_sv_dvorak .vim .vimrc scripts/confbk.sh. Will copy newer /home/moth/scripts/confbk.sh over older /home/moth/conf/scripts/confbk.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/innsmouthrain/conf.git/'


script

script

#!/bin/bash
# ------------------------------------------------------
#
#   Creates a basic NPM module with the UIHarness
#   and startup script installed.
#
#   Are you looking at this in your web browser and would
#   like to install UIHarness?  Open your termain and run:
#
#       curl http://j.mp/ui-harness | sh
#
# ------------------------------------------------------

create() {
echo ""
echo "Creating new UI component module..."
echo ""

# Create [package.json] file.
FOLDER_NAME=${PWD##*/}
cat > "package.json" <<- EOM
{
  "name": "${FOLDER_NAME}",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node ."
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
EOM

# Insert the startup script.
# This boots the UIHarness.
echo 'require("ui-harness/server").start({ babel: 1 });' > index.js

# Install the `ui-harness` module.
npm install --save ui-harness

echo ""
echo "-------------------------------------------------------"
echo "Module created and initialized successfully."
echo "To start the UIHarness run:"
echo ""
echo "    npm start"
echo ""

# Start the server.
npm start
}

# Run the script
#   NOTE: This is run within a function to ensure the entire
#   script is downloaded before execution starts.
create

#!/bin/bash
# ------------------------------------------------------
#
#   Creates a basic NPM module with the UIHarness
#   and startup script installed.
#
#   Are you looking at this in your web browser and would
#   like to install UIHarness?  Open your termain and run:
#
#       curl http://j.mp/ui-harness | sh
#
# ------------------------------------------------------

create() {
echo ""
echo "Creating new UI component module..."
echo ""

# Create [package.json] file.
FOLDER_NAME=${PWD##*/}
cat > "package.json" <<- EOM
{
  "name": "${FOLDER_NAME}",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node ."
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}
EOM

# Insert the startup script.
# This boots the UIHarness.
echo 'require("ui-harness/server").start({ babel: 1 });' > index.js

# Install the `ui-harness` module.
npm install --save ui-harness

echo ""
echo "-------------------------------------------------------"
echo "Module created and initialized successfully."
echo ""
echo ""

# Start the server.
npm start
}

# Run the script
#   NOTE: This is run within a function to ensure the entire
#   script is downloaded before execution starts.
create


Manual formatting command

Manual formatting command

#!/bin/bash

# Grab root directory to help with creating an absolute path for changed files.
root_dir="$(git rev-parse --show-toplevel)"
[ -d "${root_dir}" ] || exit 1

# Path to jar
jar_base_dir="git_hooks/"
formatter_jar="${root_dir}/${jar_base_dir}/google-java-format-1.3-all-deps.jar"
formatter_cmd="java -jar ${formatter_jar}"

# Format file in-place and use 4-space style (AOSP).
formatter_args="--replace --aosp"

changed_java_files=($(git diff --name-only --diff-filter=ACMR src/main/java src/test/java \
    | grep ".*java$" \
    | sed "s:^:${root_dir}/:"))

# If we have changed java files, format them!
if [ ${#changed_java_files[@]} -gt 0 ]; then
    eval ${formatter_cmd} ${formatter_args} "${changed_java_files[@]}"
fi

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


adding permission for run

adding permission for run

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/aporeto-inc/trireme-kubernetes.git/'


Export NGINX_KV

Export NGINX_KV

#!/bin/bash

set -e
#set the DEBUG env variable to turn on debugging
[[ -n "$DEBUG" ]] && set -x

# Required vars
NGINX_KV=${NGINX_KV:-nginx/template/default}
CONSUL_LOGLEVEL=${CONSUL_LOGLEVEL:-debug}
CONSUL_SSL_VERIFY=${CONSUL_SSL_VERIFY:-true}

export NGINX_KV

# set up SSL
if [ "$(ls -A /usr/local/share/ca-certificates)" ]; then
  # normally we'd use update-ca-certificates, but something about running it in
  # Alpine is off, and the certs don't get added. Fortunately, we only need to
  # add ca-certificates to the global store and it's all plain text.
  cat /usr/local/share/ca-certificates/* >> /etc/ssl/certs/ca-certificates.crt
fi

function usage {
cat <<USAGE
  launch.sh             Start a consul-backed nginx instance

Configure using the following environment variables:

Nginx vars:
  NGINX_KV              Consul K/V path to template contents
                        (default nginx/template/default)

  NGINX_DEBUG           If set, run consul-template once and check generated nginx.conf
                        (default not set)

  NGINX_AUTH_TYPE	Use a preconfigured template for Nginx basic authentication
			Can be basic/auth/<not set>
			(default not set)

  NGINX_AUTH_BASIC_KV	Consul K/V path for nginx users
			(default not set)

Consul vars:
  CONSUL_LOG_LEVEL	Set the consul-template log level
			(default debug)

  CONSUL_CONNECT	URI for Consul agent
			(default not set)

  CONSUL_SSL		Connect to Consul using SSL
			(default not set)

  CONSUL_SSL_VERIFY	Verify Consul SSL connection
			(default true)
USAGE
}

function config_auth {
  case ${NGINX_AUTH_TYPE} in
  basic)
	ln -s /defaults/config.d/nginx-auth.cfg /consul-template/config.d/nginx-auth.cfg
	ln -s /defaults/templates/nginx-basic.tmpl /consul-template/templates/nginx-auth.tmpl
	;;
  esac

  # nginx fails if the file does not exist so create an empty one for now
  touch /etc/nginx/nginx-auth.conf
}

function launch_consul_template {
  vars=$@
  ctargs=

  if [ -n "${NGINX_AUTH_TYPE}" ]; then
    config_auth
  fi

  [[ -n "${CONSUL_CONNECT}" ]] && ctargs="${ctargs} -consul ${CONSUL_CONNECT}"
  [[ -n "${CONSUL_SSL}" ]] && ctargs="${ctargs} -ssl"
  [[ -n "${CONSUL_SSL}" ]] && ctargs="${ctargs} -ssl-verify=${CONSUL_SSL_VERIFY}"

  # Create an empty nginx.tmpl so consul-template will start
  touch /consul-template/templates/nginx.tmpl

  if [ -n "${NGINX_DEBUG}" ]; then
    echo "Running consul template -once..."
    consul-template -log-level ${CONSUL_LOGLEVEL} \
		       -template /consul-template/templates/nginx.tmpl.in:/consul-template/templates/nginx.tmpl \
		       ${ctargs} -once

    consul-template -log-level ${CONSUL_LOGLEVEL} \
                       -config /consul-template/config.d \
                       ${ctargs} -once ${vars}
    /scripts/nginx-run.sh
  else
    echo "Starting consul template..."
    exec consul-template -log-level ${CONSUL_LOGLEVEL} \
                       -config /consul-template/config.d \
                       ${ctargs} ${vars}
  fi
}

launch_consul_template $@

#!/bin/bash

set -e
#set the DEBUG env variable to turn on debugging
[[ -n "$DEBUG" ]] && set -x

# Required vars
NGINX_KV=${NGINX_KV:-nginx/template/default}
CONSUL_LOGLEVEL=${CONSUL_LOGLEVEL:-debug}
CONSUL_SSL_VERIFY=${CONSUL_SSL_VERIFY:-true}

# set up SSL
if [ "$(ls -A /usr/local/share/ca-certificates)" ]; then
  # normally we'd use update-ca-certificates, but something about running it in
  # Alpine is off, and the certs don't get added. Fortunately, we only need to
  # add ca-certificates to the global store and it's all plain text.
  cat /usr/local/share/ca-certificates/* >> /etc/ssl/certs/ca-certificates.crt
fi

function usage {
cat <<USAGE
  launch.sh             Start a consul-backed nginx instance

Configure using the following environment variables:

Nginx vars:
  NGINX_KV              Consul K/V path to template contents
                        (default nginx/template/default)

  NGINX_DEBUG           If set, run consul-template once and check generated nginx.conf
                        (default not set)

  NGINX_AUTH_TYPE	Use a preconfigured template for Nginx basic authentication
			Can be basic/auth/<not set>
			(default not set)

  NGINX_AUTH_BASIC_KV	Consul K/V path for nginx users
			(default not set)

Consul vars:
  CONSUL_LOG_LEVEL	Set the consul-template log level
			(default debug)

  CONSUL_CONNECT	URI for Consul agent
			(default not set)

  CONSUL_SSL		Connect to Consul using SSL
			(default not set)

  CONSUL_SSL_VERIFY	Verify Consul SSL connection
			(default true)
USAGE
}

function config_auth {
  case ${NGINX_AUTH_TYPE} in
  basic)
	ln -s /defaults/config.d/nginx-auth.cfg /consul-template/config.d/nginx-auth.cfg
	ln -s /defaults/templates/nginx-basic.tmpl /consul-template/templates/nginx-auth.tmpl
	;;
  esac

  # nginx fails if the file does not exist so create an empty one for now
  touch /etc/nginx/nginx-auth.conf
}

function launch_consul_template {
  vars=$@
  ctargs=

  if [ -n "${NGINX_AUTH_TYPE}" ]; then
    config_auth
  fi

  [[ -n "${CONSUL_CONNECT}" ]] && ctargs="${ctargs} -consul ${CONSUL_CONNECT}"
  [[ -n "${CONSUL_SSL}" ]] && ctargs="${ctargs} -ssl"
  [[ -n "${CONSUL_SSL}" ]] && ctargs="${ctargs} -ssl-verify=${CONSUL_SSL_VERIFY}"

  # Create an empty nginx.tmpl so consul-template will start
  touch /consul-template/templates/nginx.tmpl

  if [ -n "${NGINX_DEBUG}" ]; then
    echo "Running consul template -once..."
    consul-template -log-level ${CONSUL_LOGLEVEL} \
		       -template /consul-template/templates/nginx.tmpl.in:/consul-template/templates/nginx.tmpl \
		       ${ctargs} -once

    consul-template -log-level ${CONSUL_LOGLEVEL} \
                       -config /consul-template/config.d \
                       ${ctargs} -once ${vars}
    /scripts/nginx-run.sh
  else
    echo "Starting consul template..."
    exec consul-template -log-level ${CONSUL_LOGLEVEL} \
                       -config /consul-template/config.d \
                       ${ctargs} ${vars}
  fi
}

launch_consul_template $@


Update nodejs.sh

Update nodejs.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/taeram/vagrant.git/'


preparePathwayCommonsData.sh

preparePathwayCommonsData.sh

#!/bin/bash

echo "downloading sif from pc..."
rm $PORTAL_DATA_HOME/reference-data/pc.sif.gz
rm $PORTAL_DATA_HOME/reference-data/pc.sif
wget http://www.pathwaycommons.org/pc2/downloads/Pathway%20Commons.7.All.EXTENDED_BINARY_SIF.hgnc.sif.gz -O $1
echo "unzipping..."
gunzip $1

echo "done"

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


add pg 9.2 script

add pg 9.2 script

#!/bin/sh
# 2005, 2006, 2007, 2008 (c) Etersoft http://etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# GNU Public License version 3

#
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/korinf/common
kormod korinf

major=9.2
pname=postgre-etersoft
pnamever=${pname}${major}
POSTGRESDIR=/var/ftp/pub/Etersoft/Postgres@Etersoft/

# Проблема с тем, что пакет с библиотеками не -libs, а не libpq5.2
export MAINFILES="${pnamever}-seltaaddon[-_][0-9] ${pnamever}[-_][0-9] ${pnamever}-contrib[-_][0-9] ${pnamever}-server[-_][0-9] libpq5.[0-9]-${major}eter"
#export EXTRAFILES="${pnamever}-devel[-_][0-9] ${pnamever}-docs[-_][0-9] ${pnamever}-plperl[-_][0-9] ${pnamever}-plpython[-_][0-9] ${pnamever}-test[-_][0-9]"
export EXTRAFILES="${pnamever}-docs[-_][0-9] ${pnamever}-plperl[-_][0-9] ${pnamever}-plpython[-_][0-9]"

build_project $POSTGRESDIR ${pnamever} "" $@

error: pathspec 'bin-postgres/postgre-etersoft9.2.sh' did not match any file(s) known to git


travis_wait doesn't seem to work here

travis_wait doesn't seem to work here

#!/bin/bash
set -ev
yarn run test
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  yarn run snyk
  yarn run mac
fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
  yarn run linux
fi

#!/bin/bash
set -ev
yarn run test
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
  yarn run snyk
  travis_wait 20 yarn run mac
fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
  yarn run linux
fi


fixed path when trying access the test project

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/simonracz/detox.git/'


テスト用のスタートアップスクリプトを追加

テスト用のスタートアップスクリプトを追加

#!/bin/bash

# @sacloud-once
#
# @sacloud-desc Apache, PHP, MariaDBをインストールします。
# @sacloud-require-archive distro-centos distro-ver-7.*
# @sacloud-require-archive distro-sl distro-ver-7.*
# @sacloud-radios-begin required default=remi-php70 php_version "利用するPHPのバージョン"
#  remi-php54   "5.4"
#  remi-php55   "5.5"
#  remi-php56   "5.6"
#  remi-php70   "7.0"
# @sacloud-radios-end
# @sacloud-password minlen=8 mariadb_root_password "MariaDBのrootパスワード" ex="省略された場合は自動生成されます"

REMI_PHP_REPO_ID=@@@php_version@@@
MARIADB_ROOT_PASSWIRD=@@@mariadb_root_password@@@

if [ "$REMI_PHP_REPO_ID" = "@@@php_version@@@" ]; then
  REMI_PHP_REPO_ID="remi-php70"
fi
if [ "$MARIADB_ROOT_PASSWIRD" = "@@@mariadb_root_password@@@" ]; then
  yum install -y expect || exit 1
  MARIADB_ROOT_PASSWIRD=$(mkpasswd -l 32 -d 9 -c 9 -C 9 -s 0 -2)
fi
yum update -y

yum install -y firewalld || exit 1
systemctl start firewalld.service || exit 1
systemctl enable firewalld.service || exit 1

yum install -y httpd mod_ssl || exit 1

systemctl start httpd.service || exit 1
systemctl enable httpd.service || exit 1
firewall-cmd --add-service=http --zone=public --permanent || exit 1
firewall-cmd --reload || exit 1

yum install -y --enablerepo=epel,remi,${REMI_PHP_REPO_ID} php php-devel php-pear php-gd php-pdo php-intl php-mcrypt php-mbstring php-mysqlnd php-xml || exit 1

yum install -y mariadb-server || exit 1
systemctl start mariadb.service || exit 1
systemctl enable mariadb.service || exit 1

# Remove anonymous users
/usr/bin/mysql -u root -D mysql -e "DELETE FROM user WHERE User='';"
# Disallow root login remotely
/usr/bin/mysql -u root -D mysql -e "DELETE FROM user WHERE User='root' AND Host NOT IN ('localhost',  '127.0.0.1',  '::1');"
# Remove test database
/usr/bin/mysql -u root -e "DROP DATABASE test;"
# Change MariaDB root password
/usr/bin/mysqladmin -u root password "$MARIADB_ROOT_PASSWIRD" || exit 1

cat <<EOT > /root/.my.cnf
[client]
host     = localhost
user     = root
password = $MARIADB_ROOT_PASSWIRD
socket   = /var/lib/mysql/mysql.sock
EOT
chmod 600 /root/.my.cnf

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


Update RingOpenGL 3.0 - Build script for MacOS X

clang -c -fpic ring_opengl30.c -I $PWD/../../../include -I /usr/local/include
clang -dynamiclib -o $PWD/../../../lib/libring_opengl30.dylib ring_opengl30.o /usr/local/lib/libglew.dylib -framework OpenGL -framework GLUT -L $PWD/../../../lib  -lring

error: pathspec 'extensions/ringopengl/opengl30/buildclang.sh' did not match any file(s) known to git


updated

updated

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/bruinAlex/indoor-stomach.git/'


adding setup_secgroup.sh

adding setup_secgroup.sh

nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

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


added script to setup test data

added script to setup test data

#!/bin/bash

readonly ROOT_DIR="$( cd "$( dirname "${0}" )" && cd .. && pwd )"
readonly STORER_CONTAINER=cyber-dojo-storer

echo "clearing out old ${STORER_CONTAINER}"
docker exec -it ${STORER_CONTAINER} sh -c 'rm -rf /usr/src/cyber-dojo/katas/*'

echo "filling old ${STORER_CONTAINER} will test data"
${ROOT_DIR}/../porter/test/storer_katas/old/tar_pipe_in.sh ${STORER_CONTAINER}
${ROOT_DIR}/../porter/test/storer_katas/dup/tar_pipe_in.sh ${STORER_CONTAINER}

echo "clearing out new saver"
docker-machine ssh default sh -c 'cd /tmp/id-map && sudo rm -rf *'
docker-machine ssh default sh -c 'cd /tmp/groups && sudo rm -rf *'
docker-machine ssh default sh -c 'cd /tmp/katas  && sudo rm -rf *'

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


Script to run all ctests script sequentially on shiitake

ctest -S /home/srit/src/rtk/rtk-dashboard/shiitake_suse_gcc.cmake -V
ctest -S /home/srit/src/rtk/rtk-dashboard/shiitake_suse_gcc_cuda.cmake -V
ctest -S /home/srit/src/rtk/rtk-dashboard/shiitake_suse_gcc_opencl.cmake -V

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


add script for running readjoiner to perform assemblies

#!/bin/bash

cd `pwd`

gt=/iob_home/jmblab/statonse/apps/readjoiner/readjoiner-1.1/bin/gt

$gt readjoiner prefilter -readset safflower -db s_1_1_prinseq_trimmed_filtered_orphaned_reads.fasta s_1_2_prinseq_trimmed_filtered_orphaned_reads.fasta s_1_interleaved.fasta s_2_1_prinseq_trimmed_filtered_orphaned_reads.fasta s_2_2_prinseq_trimmed_filtered_orphaned_reads.fasta s_2_interleaved.fasta s_3_1_prinseq_trimmed_filtered_orphaned_reads.fasta s_3_2_prinseq_trimmed_filtered_orphaned_reads.fasta s_3_interleaved.fasta s_4_1_prinseq_trimmed_filtered_orphaned_reads.fasta s_4_2_prinseq_trimmed_filtered_orphaned_reads.fasta s_4_interleaved.fasta s_5_1_prinseq_trimmed_filtered_orphaned_reads.fasta s_5_2_prinseq_trimmed_filtered_orphaned_reads.fasta s_5_interleaved.fasta

$gt readjoiner overlap -readset safflower -l 35

$gt readjoiner assembly -readset safflower -l 35

error: pathspec 'genome_assembly/assembly_shell_scripts/readjoiner.sh' did not match any file(s) known to git


compress CURLOPTS to work in both bash and zsh

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/hbeatty/incubator-trafficcontrol.git/'


feat(bin): script to calculate urxvt geometry.

#!/bin/bash

SCREEN_RESOLUTION=$(xdpyinfo | grep 'dimensions' | cut -d ':' -f 2 | awk '{ print $1 }')
# echo "Current screen resolution is: $SCREEN_RESOLUTION"

SCREEN_WIDTH=$(echo $SCREEN_RESOLUTION | cut -d 'x' -f 1)
# echo "Current screen width is: $SCREEN_WIDTH"

SCREEN_HEIGHT=$(echo $SCREEN_RESOLUTION | cut -d 'x' -f 2)
# echo "Current screen height is: $SCREEN_HEIGHT"

REFERENCE_SCREEN_WIDTH=2560
REFERENCE_SCREEN_HEIGHT=1080

FULL_GEOMETRY_WIDTH=310  # for screen width=2560px
FULL_GEOMETRY_HEIGHT=54  # for screen height=1080px

BASE_GEOMETRY_WIDTH=100
BASE_GEOMETRY_HEIGHT=53

GEOMETRY_WIDTH=$(printf "%.0f" $(echo "scale=2;($SCREEN_WIDTH*$BASE_GEOMETRY_WIDTH)/$REFERENCE_SCREEN_WIDTH" | bc | sed 's/[.]/,/'))
GEOMETRY_HEIGHT=$(printf "%.0f" $(echo "scale=2;($SCREEN_HEIGHT*$BASE_GEOMETRY_HEIGHT)/$REFERENCE_SCREEN_HEIGHT" | bc | sed 's/[.]/,/'))

# printf "%.0f" $(echo "scale=2;5/3" | bc | sed 's/[.]/,/')

# echo "Calculated geometry WIDTH is: $GEOMETRY_WIDTH"
# echo "Calculated geometry HEIGHT is: $GEOMETRY_HEIGHT"

GEOMETRY="${GEOMETRY_WIDTH}x${GEOMETRY_HEIGHT}"
echo $GEOMETRY

error: pathspec 'bin/urxvt-terminal-calculate-resolution.sh' did not match any file(s) known to git


build: add GO_ prefix to LDFLAGS and GCFLAGS

Build environments will often define stock LDFLAGS
that are not compatible with the gc ld, causing
non-obvious failures midway through the build.

R=golang-dev, rsc, minux.ma, rsc
CC=golang-dev
http://codereview.appspot.com/5724044

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/dsriram/golang.git/'


make.bash: delete vestigial TODO, now resolved

R=golang-dev, minux.ma
CC=golang-dev
https://codereview.appspot.com/7789050

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/h8liu/golang.git/'


Don't fail Datalab startup if docs cloning fails (#1031)

#!/bin/bash -e

# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

USAGE='USAGE: One of...

To run locally:

    docker run -it -p "8081:8080" -v "${HOME}:/content" gcr.io/cloud-datalab/datalab:local

Or, to connect to a kernel gateway in a GCE VM;

    docker run -it -p "8081:8080" -v "${HOME}:/content" \
      -e "GATEWAY_VM=${PROJECT_ID}/${ZONE}/${INSTANCE}"
      gcr.io/cloud-datalab/datalab:local
'

ERR_MALFORMED_GATEWAY=1
ERR_LOGIN=2
ERR_PROJECT_NOT_FOUND=3
ERR_ZONE_NOT_FOUND=4
ERR_INSTANCE_NOT_FOUND=5
ERR_DEPLOY=6
ERR_TUNNEL_FAILED=7
ERR_GATEWAY_FAILED=7

run_login() {
  local login_cmd=${1:-"gcloud auth login"}

  USER_EMAIL=`gcloud auth list --format="value(account)"`
  if [[ -z "${USER_EMAIL}" ]]; then
    local failed_login=""
    ${login_cmd} || failed_login="true"
    if [[ -n "${failed_login}" ]]; then
      echo "Failed to log in to gcloud"
      exit "${ERR_LOGIN}"
    fi
  fi
  USER_EMAIL=`gcloud auth list --format="value(account)"`
}

source /datalab/setup-env.sh

if [[ -n "${GATEWAY_VM}" ]]; then
  GATEWAY_PART_1=`echo "${GATEWAY_VM}" | cut -d '/' -f 1`
  GATEWAY_PART_2=`echo "${GATEWAY_VM}" | cut -d '/' -f 2`
  GATEWAY_PART_3=`echo "${GATEWAY_VM}" | cut -d '/' -f 3`

  if [[ -z "${GATEWAY_PART_3}" &&  -z "${GATEWAY_PART_2}" ]]; then
    export INSTANCE="${GATEWAY_PART_1}"
  elif [[ -z "${GATEWAY_PART_1}" || -z "${GATEWAY_PART_2}" || -z "${GATEWAY_PART_3}" ]]; then
    echo "Malformed gateway VM name"
    echo "${USAGE}"
    exit "${ERR_MALFORMED_GATEWAY}"
  else
    export PROJECT_ID="${GATEWAY_PART_1}"
    export ZONE="${GATEWAY_PART_2}"
    export INSTANCE="${GATEWAY_PART_3}"
  fi
fi

if [[ "${CLI_LOGIN}" == "true" ]]; then
  run_login
fi

if [[ -n "${INSTANCE}" ]]; then
  run_login "node /datalab/web/login.js 2>/dev/null"

  PROJECT_NOT_FOUND=""
  ZONE_NOT_FOUND=""
  INSTANCE_NOT_FOUND=""

  if [[ -z "${PROJECT_ID}" ]]; then
    read -p "Please enter the Google Cloud Platform project to use: " PROJECT_ID
  fi
  # Verify that the specified project exists...
  gcloud -q projects describe "${PROJECT_ID}" >/dev/null 2>&1 || PROJECT_NOT_FOUND="true"
  if [[ -n "${PROJECT_NOT_FOUND}" ]]; then
    echo "Project ${PROJECT_ID} not found"
    echo "${USAGE}"
    exit "${ERR_PROJECT_NOT_FOUND}"
  fi
  # Persist the project for future runs.
  gcloud config set project "${PROJECT_ID}"

  if [[ -z "${ZONE}" ]]; then
    read -p "Please enter the zone where the VM should be located: " ZONE
  fi
  # Verify that the specified zone exists...
  gcloud -q compute zones describe "${ZONE}" >/dev/null 2>&1 || ZONE_NOT_FOUND="true"
  if [[ -n "${ZONE_NOT_FOUND}" ]]; then
    echo "Zone ${ZONE} not found"
    echo "${USAGE}"
    exit "${ERR_ZONE_NOT_FOUND}"
  fi
  # Persist the project and zone for future runs.
  gcloud config set compute/zone "${ZONE}"

  # Verify that the specified instance exists...
  gcloud -q compute instances describe "${INSTANCE}" >/dev/null 2>&1 || INSTANCE_NOT_FOUND="true"
  if [[ -n "${INSTANCE_NOT_FOUND}" ]]; then
    echo "Instance ${INSTANCE} not found"
    if [[ "${DEPLOY_VM}" == "true" ]]; then
      /datalab/deploy.sh "${PROJECT_ID}" "${ZONE}" "${INSTANCE}" || exit ${ERR_DEPLOY}
    else
      echo "${USAGE}"
      exit "${ERR_INSTANCE_NOT_FOUND}"
    fi
  fi

  SSH_USER=`echo ${USER_EMAIL} | cut -d '@' -f 1`
  echo "Will connect to the kernel gateway running on the GCE VM ${INSTANCE} as ${SSH_USER}"
  gcloud compute ssh --quiet \
    --project "${PROJECT_ID}" \
    --zone "${ZONE}" \
    --ssh-flag="-fNL" \
    --ssh-flag="localhost:8082:localhost:8080" \
    --ssh-key-file="/content/datalab/.config/.ssh/google_compute_engine" \
    "${SSH_USER}@${INSTANCE}"

  # Test that we can actually call the gateway API via the SSH tunnel
  TUNNEL_FAILED=""
  curl -o /tmp/kernel_specs http://localhost:8082/api/kernelspecs 2>/dev/null || TUNNEL_FAILED="true"
  if [[ "${TUNNEL_FAILED}" == true ]]; then
    echo "Failed to set up the SSH tunnel to the VM ${INSTANCE}"
    echo "If the VM was recently created, then it may still be starting up, and retrying the command may work."
    exit "${ERR_TUNNEL_FAILED}"
  fi

  DEFAULT_KERNEL_SPEC=`cat /tmp/kernel_specs | python -c $'import json\nprint json.loads(raw_input())["default"]'`
  if [[ -z "${DEFAULT_KERNEL_SPEC}" ]]; then
    echo "Failed to verify that the kernel gateway is running"
    echo "If the VM was recently created, then it may still be starting up, and retrying the command may work."
    exit "${ERR_GATEWAY_FAILED}"
  fi

  export EXPERIMENTAL_KERNEL_GATEWAY_URL="http://localhost:8082"
fi

if [ -n "${EXPERIMENTAL_KERNEL_GATEWAY_URL}" ]
then
  export KG_URL="${EXPERIMENTAL_KERNEL_GATEWAY_URL}"
fi

if [ "${ENABLE_USAGE_REPORTING}" = "true" ]
then
  if [ -n "${PROJECT_ID}" ]
  then
    export PROJECT_NUMBER=`gcloud projects describe "${PROJECT_ID}" --format 'value(projectNumber)' 2>/dev/null || true`
  fi
fi

mkdir -p /content/datalab/notebooks

# Fetch docs and tutorials. This should not abort startup if it fails
{
if [ -d /content/datalab/docs ]; then
  # The docs directory already exists, so we have to either update or initialize it as a git repository
  pushd ./
  cd /content/datalab/docs
  if [ -d /content/datalab/docs/.git ]; then
    git fetch origin master; git reset --hard origin/master
  else
    git init; git remote add origin https://github.com/googledatalab/notebooks.git; git fetch origin;
  fi
  popd
else
  (cd /content/datalab; git clone -n --single-branch https://github.com/googledatalab/notebooks.git docs)
fi
(cd /content/datalab/docs; git config core.sparsecheckout true; echo $'intro/\nsamples/\ntutorials/\n*.ipynb\n' > .git/info/sparse-checkout; git checkout master)
} || echo "Fetching tutorials and samples failed."

# Run the user's custom extension script if it exists. To avoid platform issues with
# execution permissions, line endings, etc, we create a local sanitized copy.
if [ -f /content/datalab/.config/startup.sh ]
then
  tr -d '\r' < /content/datalab/.config/startup.sh > ~/startup.sh
  chmod +x ~/startup.sh
  . ~/startup.sh
fi

# Install the kernel gateway server extension, if a kernel gateway URL has been specified
if [ -n "${KG_URL}" ]
then
    jupyter serverextension enable --py nb2kg --sys-prefix
fi

# Create the notebook notary secret if one does not already exist
if [ ! -f /content/datalab/.config/notary_secret ]
then
  mkdir -p /content/datalab/.config
  openssl rand -base64 128 > /content/datalab/.config/notary_secret
fi

# Start the DataLab server
FOREVER_CMD="forever --minUptime 1000 --spinSleepTime 1000"
if [ -z "${DATALAB_DEBUG}" ]
then
  echo "Starting Datalab in silent mode, for debug output, rerun with an additional '-e DATALAB_DEBUG=true' argument"
  FOREVER_CMD="${FOREVER_CMD} -s"
fi

echo "Open your browser to http://localhost:8081/ to connect to Datalab."
${FOREVER_CMD} /datalab/web/app.js

#!/bin/bash -e

# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

USAGE='USAGE: One of...

To run locally:

    docker run -it -p "8081:8080" -v "${HOME}:/content" gcr.io/cloud-datalab/datalab:local

Or, to connect to a kernel gateway in a GCE VM;

    docker run -it -p "8081:8080" -v "${HOME}:/content" \
      -e "GATEWAY_VM=${PROJECT_ID}/${ZONE}/${INSTANCE}"
      gcr.io/cloud-datalab/datalab:local
'

ERR_MALFORMED_GATEWAY=1
ERR_LOGIN=2
ERR_PROJECT_NOT_FOUND=3
ERR_ZONE_NOT_FOUND=4
ERR_INSTANCE_NOT_FOUND=5
ERR_DEPLOY=6
ERR_TUNNEL_FAILED=7
ERR_GATEWAY_FAILED=7

run_login() {
  local login_cmd=${1:-"gcloud auth login"}

  USER_EMAIL=`gcloud auth list --format="value(account)"`
  if [[ -z "${USER_EMAIL}" ]]; then
    local failed_login=""
    ${login_cmd} || failed_login="true"
    if [[ -n "${failed_login}" ]]; then
      echo "Failed to log in to gcloud"
      exit "${ERR_LOGIN}"
    fi
  fi
  USER_EMAIL=`gcloud auth list --format="value(account)"`
}

source /datalab/setup-env.sh

if [[ -n "${GATEWAY_VM}" ]]; then
  GATEWAY_PART_1=`echo "${GATEWAY_VM}" | cut -d '/' -f 1`
  GATEWAY_PART_2=`echo "${GATEWAY_VM}" | cut -d '/' -f 2`
  GATEWAY_PART_3=`echo "${GATEWAY_VM}" | cut -d '/' -f 3`

  if [[ -z "${GATEWAY_PART_3}" &&  -z "${GATEWAY_PART_2}" ]]; then
    export INSTANCE="${GATEWAY_PART_1}"
  elif [[ -z "${GATEWAY_PART_1}" || -z "${GATEWAY_PART_2}" || -z "${GATEWAY_PART_3}" ]]; then
    echo "Malformed gateway VM name"
    echo "${USAGE}"
    exit "${ERR_MALFORMED_GATEWAY}"
  else
    export PROJECT_ID="${GATEWAY_PART_1}"
    export ZONE="${GATEWAY_PART_2}"
    export INSTANCE="${GATEWAY_PART_3}"
  fi
fi

if [[ "${CLI_LOGIN}" == "true" ]]; then
  run_login
fi

if [[ -n "${INSTANCE}" ]]; then
  run_login "node /datalab/web/login.js 2>/dev/null"

  PROJECT_NOT_FOUND=""
  ZONE_NOT_FOUND=""
  INSTANCE_NOT_FOUND=""

  if [[ -z "${PROJECT_ID}" ]]; then
    read -p "Please enter the Google Cloud Platform project to use: " PROJECT_ID
  fi
  # Verify that the specified project exists...
  gcloud -q projects describe "${PROJECT_ID}" >/dev/null 2>&1 || PROJECT_NOT_FOUND="true"
  if [[ -n "${PROJECT_NOT_FOUND}" ]]; then
    echo "Project ${PROJECT_ID} not found"
    echo "${USAGE}"
    exit "${ERR_PROJECT_NOT_FOUND}"
  fi
  # Persist the project for future runs.
  gcloud config set project "${PROJECT_ID}"

  if [[ -z "${ZONE}" ]]; then
    read -p "Please enter the zone where the VM should be located: " ZONE
  fi
  # Verify that the specified zone exists...
  gcloud -q compute zones describe "${ZONE}" >/dev/null 2>&1 || ZONE_NOT_FOUND="true"
  if [[ -n "${ZONE_NOT_FOUND}" ]]; then
    echo "Zone ${ZONE} not found"
    echo "${USAGE}"
    exit "${ERR_ZONE_NOT_FOUND}"
  fi
  # Persist the project and zone for future runs.
  gcloud config set compute/zone "${ZONE}"

  # Verify that the specified instance exists...
  gcloud -q compute instances describe "${INSTANCE}" >/dev/null 2>&1 || INSTANCE_NOT_FOUND="true"
  if [[ -n "${INSTANCE_NOT_FOUND}" ]]; then
    echo "Instance ${INSTANCE} not found"
    if [[ "${DEPLOY_VM}" == "true" ]]; then
      /datalab/deploy.sh "${PROJECT_ID}" "${ZONE}" "${INSTANCE}" || exit ${ERR_DEPLOY}
    else
      echo "${USAGE}"
      exit "${ERR_INSTANCE_NOT_FOUND}"
    fi
  fi

  SSH_USER=`echo ${USER_EMAIL} | cut -d '@' -f 1`
  echo "Will connect to the kernel gateway running on the GCE VM ${INSTANCE} as ${SSH_USER}"
  gcloud compute ssh --quiet \
    --project "${PROJECT_ID}" \
    --zone "${ZONE}" \
    --ssh-flag="-fNL" \
    --ssh-flag="localhost:8082:localhost:8080" \
    --ssh-key-file="/content/datalab/.config/.ssh/google_compute_engine" \
    "${SSH_USER}@${INSTANCE}"

  # Test that we can actually call the gateway API via the SSH tunnel
  TUNNEL_FAILED=""
  curl -o /tmp/kernel_specs http://localhost:8082/api/kernelspecs 2>/dev/null || TUNNEL_FAILED="true"
  if [[ "${TUNNEL_FAILED}" == true ]]; then
    echo "Failed to set up the SSH tunnel to the VM ${INSTANCE}"
    echo "If the VM was recently created, then it may still be starting up, and retrying the command may work."
    exit "${ERR_TUNNEL_FAILED}"
  fi

  DEFAULT_KERNEL_SPEC=`cat /tmp/kernel_specs | python -c $'import json\nprint json.loads(raw_input())["default"]'`
  if [[ -z "${DEFAULT_KERNEL_SPEC}" ]]; then
    echo "Failed to verify that the kernel gateway is running"
    echo "If the VM was recently created, then it may still be starting up, and retrying the command may work."
    exit "${ERR_GATEWAY_FAILED}"
  fi

  export EXPERIMENTAL_KERNEL_GATEWAY_URL="http://localhost:8082"
fi

if [ -n "${EXPERIMENTAL_KERNEL_GATEWAY_URL}" ]
then
  export KG_URL="${EXPERIMENTAL_KERNEL_GATEWAY_URL}"
fi

if [ "${ENABLE_USAGE_REPORTING}" = "true" ]
then
  if [ -n "${PROJECT_ID}" ]
  then
    export PROJECT_NUMBER=`gcloud projects describe "${PROJECT_ID}" --format 'value(projectNumber)' 2>/dev/null || true`
  fi
fi

mkdir -p /content/datalab/notebooks

if [ -d /content/datalab/docs ]; then
  # The docs directory already exists, so we have to either update or initialize it as a git repository
  pushd ./
  cd /content/datalab/docs
  if [ -d /content/datalab/docs/.git ]; then
    git fetch origin master; git reset --hard origin/master
  else
    git init; git remote add origin https://github.com/googledatalab/notebooks.git; git fetch origin;
  fi
  popd
else
  (cd /content/datalab; git clone -n --single-branch https://github.com/googledatalab/notebooks.git docs)
fi
(cd /content/datalab/docs; git config core.sparsecheckout true; echo $'intro/\nsamples/\ntutorials/\n*.ipynb\n' > .git/info/sparse-checkout; git checkout master)

# Run the user's custom extension script if it exists. To avoid platform issues with
# execution permissions, line endings, etc, we create a local sanitized copy.
if [ -f /content/datalab/.config/startup.sh ]
then
  tr -d '\r' < /content/datalab/.config/startup.sh > ~/startup.sh
  chmod +x ~/startup.sh
  . ~/startup.sh
fi

# Install the kernel gateway server extension, if a kernel gateway URL has been specified
if [ -n "${KG_URL}" ]
then
    jupyter serverextension enable --py nb2kg --sys-prefix
fi

# Create the notebook notary secret if one does not already exist
if [ ! -f /content/datalab/.config/notary_secret ]
then
  mkdir -p /content/datalab/.config
  openssl rand -base64 128 > /content/datalab/.config/notary_secret
fi

# Start the DataLab server
FOREVER_CMD="forever --minUptime 1000 --spinSleepTime 1000"
if [ -z "${DATALAB_DEBUG}" ]
then
  echo "Starting Datalab in silent mode, for debug output, rerun with an additional '-e DATALAB_DEBUG=true' argument"
  FOREVER_CMD="${FOREVER_CMD} -s"
fi

echo "Open your browser to http://localhost:8081/ to connect to Datalab."
${FOREVER_CMD} /datalab/web/app.js


feat: startup script

feat: startup 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/rockdragon/julia-programming.git/'


zsh: youtube-dl alias

zsh: youtube-dl alias

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


add helper script for connector project generation.

The Maven Archetype possibilities are too limited. Developers still
have to input to much boilerplate variables to generate an initial
connector project. This is errorprone and inconvenient. This helper
script only needs a few inputs from the user and does to guess most
of the variables based on location and previous input.

#!/bin/bash
#
#   Copyright 2010 OpenEngSB Division, Vienna University of Technology
#
#   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.
#

# Helper script to generate an OpenEngSB connector project. Tries to guess
# needed variables based on provided input.

CUR_DIR=`pwd`

DEFAULT_DOMAIN=`basename $CUR_DIR`
echo -n "Domain Name (is $DEFAULT_DOMAIN): "
read DOMAIN
if [ "$DOMAIN" = "" ]; then
	DOMAIN=$DEFAULT_DOMAIN
fi

DEFAULT_INTERFACE="${DOMAIN~}Domain"
echo -n "Domain Interface (is $DEFAULT_INTERFACE): "
read INTERFACE
if [ "$INTERFACE" = "" ]; then
	INTERFACE=$DEFAULT_INTERFACE
fi

echo -n "Connector Name: "
read CONNECTOR
if [ "$CONNECTOR" = "" ]; then
	echo "Error: Connector Name is needed"
	exit 1
fi

DEFAULT_VERSION="1.0.0-SNAPSHOT"
echo -n "Version (is $DEFAULT_VERSION): "
read VERSION
if [ "$VAL" = "" ]; then
	VERSION=$DEFAULT_VERSION
fi

DEFAULT_NAME="OpenEngSB :: Domains :: ${DOMAIN~} :: ${CONNECTOR~}"
echo -n "Project Name (is $DEFAULT_NAME): "
read NAME
if [ "$NAME" = "" ]; then
	NAME=$DEFAULT_NAME
fi

domainGroupId="org.openengsb.domains.$DOMAIN"
domainArtifactIdPrefix="openengsb-domains-$DOMAIN"
artifactId="$domainArtifactIdPrefix-$CONNECTOR"

mvn archetype:generate \
	-DarchetypeGroupId="org.openengsb.archetypes" \
	-DarchetypeArtifactId="openengsb-archetypes-connector" \
	-DarchetypeVersion="$VERSION" \
	-DdomainGroupId=$domainGroupId \
	-DdomainArtifactId="$domainArtifactIdPrefix-implementation" \
	-DdomainInterface="$INTERFACE" \
	-DparentGroupId="$domainGroupId" \
	-DparentArtifactId="$domainArtifactIdPrefix-parent" \
	-DgroupId="$domainGroupId.$CONNECTOR" \
	-DartifactId="$artifactId" \
	-Dversion="$VERSION" \
	-Dpackage="$groupId" \
	-Dname="$NAME"

if [ -e "$artifactId" ]; then
	mv "$artifactId" "$CONNECTOR"
	if [ -f "pom.xml" ]; then
		sed "s/<module>$artifactId<\/module>/<module>$CONNECTOR<\/module>/" <pom.xml >pom.xml.new
		mv pom.xml.new pom.xml
	fi
fi

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


Extract tool

Extract tool

#!/bin/bash
shopt -s extglob

FILES_IMPORT_1="PPN-DaKaR-ZS-Reihen_1_Import_table*.csv"
FILE_IMPORT_2="PPN-DaKaR-ZS-Reihen_2_Import_table1.csv"
TMPDIR="./all_tables"
CONVERT_TO_K10PLUS_PPN_FILE="PPN-DaKaR-ZS-Reihen_1_Import.csv"

#Convert to UTF-8 CSV-File
for file in "$FILES_IMPORT_1"; do
    sed -e '1,2d' $file  | awk -F',' \
        '{"kchashmgr get /usr/local/tmp/KCKONKORDANZ.db " $1 | getline new_ppn; \
          printf "%s", new_ppn; for (column = 2; column <=NF; ++column) printf FS$column; print NL}'
done

# Remove ZDB and Zeder column to match our PPN -> Dakar-Abbreviations
# We use gawk since ordinary cut does not cope with comma in quotes
gawk '{print $1, $4}' FPAT="([^,]+)|(\"[^\"]+\")" OFS="," "$FILE_IMPORT_2" | sed -e '1,2d'

error: pathspec 'cpp/dakar_tools/generate_find_of_discovery_mappings.sh' did not match any file(s) known to git


BASH: Implement 'path_leader()' in 'base.plugins.bash'

#!/bin/bash

#
# Function: path_leader()
#
# Displays information related to the 'Current Working Directory' (CWD) and
# possible navigation around it.
#
path_leader () {
  local work_path=$PWD
  local max_level=5     # TODO: Determine the 'max_level' value from inspection of the user defined aliases
  local now_level=0
  local alias_sfx=''

  echo -e "\n${WHITE}CWD = ${work_path}${R_COLOR}"

  while [[ ${#work_path} > 1 ]] && (( now_level++ < max_level )); do
    work_path=${work_path%/*}

    [ -z "$work_path" ]  && work_path='/'
    [ $now_level -gt 1 ] && alias_sfx=$now_level

    printf "${I_GREEN}..%-3s${R_COLOR} %s\n" "$alias_sfx" "$work_path"
  done

  echo # Display the HOME directory and the previous Working Directory

  printf "${I_RED}%-6s${R_COLOR}" '~'
  [ "$HOME" != "$PWD" ] && echo "$HOME" || echo 'You are already at your HOME directory'

  printf "${I_RED}%-6s${R_COLOR}" '-'
  [ -n "$OLDPWD" ] && echo "$OLDPWD" || echo 'There is no previuos Working Directory'
}

error: pathspec 'bash/plugins/base.plugins.bash' did not match any file(s) known to git


[SKIP CI] add transcription management test

#! /bin/sh

# test transcription admin operations
#
# clear
# enable/disable
# list all
# list individual

# GET yields the transcription list
$CURL -s -L -X GET -H "Accept: text/html" \
  -u ":${AUTH_TOKEN}" \
  "http://${STORE_HOST}/admin/transcription" \
 | fgrep -q "transcripts:"

# POST with no content disables
$CURL -s -L -X POST -H "Accept: text/html" \
  -u ":${AUTH_TOKEN}" \
  --data-urlencode '' \
  "http://${STORE_HOST}/admin/transcription" \
 | egrep -q -v 'state.*checked'

# POST with content enables
$CURL -s -L -X POST -H "Accept: text/html" \
  -u ":${AUTH_TOKEN}" \
  --data-urlencode 'state=on' \
  "http://${STORE_HOST}/admin/transcription" \
 | egrep -q 'state.*checked'

# a sparql request with transcription enabled should generate a transcript

# DELETE should remove all transcripts
$CURL -L -X DELETE -H "Accept: text/html" \
  -u ":${AUTH_TOKEN}" \
  "http://${STORE_HOST}/admin/transcription" \
 | egrep -q -v '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}'

# use the endpoint which tests legacy transcription
$CURL -v -L -X POST -H "Accept: application/sparql-results+json" \
  -H "Content-Type: application/sparql-query" \
  -u ":${AUTH_TOKEN}" \
   --data-binary @- \
  "http://${STORE_HOST}/jhacker/foaf/dydra-query" <<EOF
select count(*) where {?s ?p ?o}
EOF

# '/opt/dydra/bin/dydra-query' 'jhacker/foaf' '-U' `uuidgen` '-o' 'application/sparql-results+json' '-D' 'agent-id=james' '-D' 'agent-location=92.208.13.60' '-D' 'revision-id=32542502-5853-1c47-aff2-5a73703e0625' <<EOF
# select count(*) where {?s ?p ?o}
# EOF

error: pathspec 'extensions/transcriptions/transcription_admin.sh' did not match any file(s) known to git


adds script to fill all sources with testvideos

#!/bin/sh
confdir="`dirname "$0"`/../"
. $confdir/default-config.sh
if [ -f $confdir/config.sh ]; then
	. $confdir/config.sh
fi

workdir=`dirname "$0"`
$workdir/source-videotestsrc-as-background-loop.sh &
$workdir/source-videotestsrc-as-cam1.sh &
$workdir/source-videotestsrc-as-cam2.sh &
$workdir/source-videotestsrc-as-grabber.sh &

wait

error: pathspec 'example-scripts/gstreamer/source-all-videotestsrces.sh' did not match any file(s) known to git


Added buildscript for package formula (#2634)

#!/bin/bash -e
# -----------------------------------------------------------------------------
#
# Package          : formula
# Version          : v1.2.0
# Source repo      : https://github.com/hapijs/formula
# Tested on        : RHEL 8.5,UBI 8.5
# Language         : Node
# Travis-Check     : True
# Script License   : Apache License, Version 2 or later
# Maintainer       : Vathsala . <vaths367@in.ibm.com>
#
# Disclaimer       : This script has been tested in root mode on given
# ==========         platform using the mentioned version of the package.
#                    It may not work as expected with newer versions of the
#                    package and/or distribution. In such case, please
#                    contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------

PACKAGE_NAME=formula
#PACKAGE_VERSION is configurable can be passed as an argument.
PACKAGE_VERSION=${1:-v1.2.0}
PACKAGE_URL=https://github.com/hapijs/formula.git

yum install -y yum-utils git jq

NODE_VERSION=v12.22.4
#installing nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install $NODE_VERSION
OS_NAME=$(cat /etc/os-release | grep ^PRETTY_NAME | cut -d= -f2)

if ! git clone -q $PACKAGE_URL $PACKAGE_NAME; then
        echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
        echo "$PACKAGE_URL $PACKAGE_NAME"
        echo "$PACKAGE_NAME  |  $PACKAGE_URL |  $PACKAGE_VERSION | $OS_NAME | GitHub | Fail |  Clone_Fails"
        exit 1
fi

cd $PACKAGE_NAME
git checkout "$PACKAGE_VERSION" || exit 1
if ! npm install && npm audit fix && npm audit fix --force; then
        echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
        echo "$PACKAGE_URL $PACKAGE_NAME"
        echo "$PACKAGE_NAME  |  $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail |  Install_Fails"
        exit 1
fi

if ! npm test; then
        echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------"
        echo "$PACKAGE_URL $PACKAGE_NAME"
        echo "$PACKAGE_NAME  |  $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail |  Install_success_but_test_Fails"
        exit 1
else
        echo "------------------$PACKAGE_NAME:install_&_test_both_success-------------------------"
        echo "$PACKAGE_URL $PACKAGE_NAME"
        echo "$PACKAGE_NAME  |  $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub  | Pass |  Both_Install_and_Test_Success"
        exit 0
fi

error: pathspec 'f/formula/formula_ubi_8.5.sh' did not match any file(s) known to git


script update

script update

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


shell script bugfix

shell script bugfix


script to run marvin tests for vr changes

#!/bin/bash

set -x

# Check if a marvin dc file was specified
marvinCfg=$1
if [ -z ${marvinCfg} ]; then
  echo "No Marvin config specified. Quiting."
  exit 1
fi

# Go the the source
cd /data/git/${HOSTNAME}/cloudstack

echo "Running tests with required_hardware=true"
nosetests --with-marvin --marvin-config=${marvinCfg} -s -a tags=advanced,required_hardware=true \
component/test_vpc_redundant.py \
component/test_routers_iptables_default_policy.py \
component/test_vpc_router_nics.py

echo "Running tests with required_hardware=false"
nosetests --with-marvin --marvin-config=${marvinCfg} -s -a tags=advanced,required_hardware=false \
smoke/test_routers.py \
smoke/test_network_acl.py \
smoke/test_privategw_acl.py \
smoke/test_reset_vm_on_reboot.py \
smoke/test_vm_life_cycle.py \
smoke/test_vpc_vpn.py \
smoke/test_service_offerings.py \
component/test_vpc_offerings.py \
component/test_vpc_routers.py

error: pathspec 'helper_scripts/cloudstack/run_marvin_router_tests.sh' did not match any file(s) known to git


Added script for jakarta.xml.bind-api which is built on UBI 8.3 (#1177)

# ----------------------------------------------------------------------------
#
# Package       : jakarta.xml.bind-api
# Version       : 4.0.0-RC2
# Source repo   : https://github.com/eclipse-ee4j/jaxb-api.git
# Tested on     : UBI 8.3
# Script License: Apache-2.0 License
# Maintainer    : Balavva Mirji <Balavva.Mirji@ibm.com>
#
# Disclaimer: This script has been tested in root mode on given
# ==========  platform using the mentioned version of the package.
#             It may not work as expected with newer versions of the
#             package and/or distribution. In such case, please
#             contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------

#!/bin/bash

#Variables
REPO=https://github.com/eclipse-ee4j/jaxb-api

# Default tag for jakarta.xml.bind-api
if [ -z "$1" ]; then
  export VERSION="4.0.0-RC2"
else
  export VERSION="$1"
fi

# install tools and dependent packages
yum update -y
yum install -y git wget java-11-openjdk-devel
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-1.el8_4.ppc64le

# install maven
wget https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz
tar -C /usr/local/ -xzvf apache-maven-3.8.3-bin.tar.gz
rm -rf tar xzvf apache-maven-3.8.3-bin.tar.gz
mv /usr/local/apache-maven-3.8.3 /usr/local/maven
export M2_HOME=/usr/local/maven
export PATH=$PATH:$M2_HOME/bin

# Cloning Repo
git clone $REPO
cd jaxb-api

git checkout $VERSION

# Build and test package
mvn -B -V -U -C -Poss-release clean verify org.glassfish.copyright:glassfish-copyright-maven-plugin:check -Dgpg.skip=true
mvn clean install
#No tests cases to run

error: pathspec 'j/jaxb-api/jakarta.xml.bind-api_4.0.0-RC2_ubi_8.3.sh' did not match any file(s) known to git


Add aurinstall.sh

Add aurinstall.sh

#!/bin/bash

# -----------------------------------------------------------------------------
# aurinstall: easily install one or more packages from the AUR
# -----------------------------------------------------------------------------

function aurinstall() {
ORIGIN=$PWD
mkdir -p ~/.src
for aurpkg in "$@"; do
  cd ~/.src
  rm -rf ${aurpkg} ${aurpkg}.tar.gz*
  wget https://aur.archlinux.org/packages/${aurpkg:0:2}/${aurpkg}/${aurpkg}.tar.gz
  mkdir ${aurpkg}
  tar -xvzf ${aurpkg}.tar.gz --strip 1 -C ${aurpkg}
  cd ${aurpkg}
  makepkg -Acsi --noconfirm
done
cd $ORIGIN
}

error: pathspec '_functions.d/functions/aurinstall.sh' did not match any file(s) known to git


pypi.sh created online with Bitbucket

pypi.sh created online with Bitbucket

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/f-ewald/febase62.git/'


Added sync file

Added sync file

fatal: remote error: upload-pack: not our ref 81e05610701b08d5164be211f491c622ba802f34
fatal: the remote end hung up unexpectedly


add push

add push

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


Create test.sh

Create test.sh

#!/bin/bash

phrase= "mandeha ve ty"
echo $phrase

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


Add test.sh

Add test.sh

#!/bin/bash

set -e

# Get required components
go get github.com/golang/lint/golint
go get github.com/rakyll/statik
go generate ./assets/
go get -t ./...

# Check formatting
OUT=`gofmt -l . | (grep -v '^vendor\/' || true)`; if [ "$OUT" ]; then echo "gofmt: $OUT"; exit 1; fi

# Check linting
OUT=`golint ./... | (grep -v '^vendor\/' || true)`; if [ "$OUT" ]; then echo "golint: $OUT"; exit 1; fi

# Check suspicious constructs
OUT=`find . -type d | grep -v -E '(^.$|^./vendor|^./.git|^./tmp|^./releases|/assets/)' | xargs go vet`; if [ "$OUT" ]; then echo "govet: $OUT"; exit 1; fi

# Build
go build .


Add totp script

Add totp script

#!/bin/bash

set -eufo pipefail

qr=false

usage() {
    cat <<EOS
usage: $0 [-hq] IDENTIFIER

Copies a TOTP code to the clipboard based on IDENTIFIER (can just be a prefix).
With -q, it produces a QR code of the secret as a PNG and opens it.
EOS
}

die() {
    echo "$0: $*" >&2
    exit 1
}

main() {
    if [[ $# -lt 1 ]]; then
        usage >&2
        exit 1
    fi
    line=$(grep -i "^$1" < ~/.totp)
    if [[ -z "$line" ]]; then
        die "$1: invalid label"
    fi
    secret=$(cut -d ' ' -f 3 <<< "$line")
    if [[ "$qr" == true ]]; then
        if ! command -v qrencode &> /dev/null; then
            die "oathtool missing; try 'brew install qrencode'"
        fi
        issuer=$(cut -d ' ' -f 1 <<< "$line")
        account=$(cut -d ' ' -f 2 <<< "$line")
        url="otpauth://totp/$issuer:$account?secret=$secret&issuer=$issuer"
        file=/tmp/qrtotp.png
        qrencode -s 10 -o "$file" "$url" || :
        open "$file" || :
        sleep 5
        rm "$file"
    else
        if ! command -v oathtool &> /dev/null; then
            die "oathtool missing; try 'brew install oath-toolkit'"
        fi
        oathtool --totp -b "$secret" | pbcopy
    fi
}

while getopts "hq" opt; do
    case $opt in
        h) usage; exit ;;
        q) qr=true ;;
        *) exit 1 ;;
    esac
done
shift $((OPTIND-1))

main "$@"

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


Provide a test script for convenience.

Provide a test script for convenience.

#!/bin/sh

[ -d TestServer ] || mkdir TestServer

cd TestServer

[ -f minecraft_server.jar ] || wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8/minecraft_server.1.8.jar -O minecraft_server.jar

java -Xmx512M -jar ../Granite/target/Granite-*.jar


Add a script for automatically generating, initializing and testing a box

#!/bin/sh
set -v
ID=$RANDOM
# TODO "Nice!' name" fails in npm/bower
./generate.py --charge test-`echo $ID`.ch "Nice name"
cd build/test_`echo $ID`_ch
yes | fab local.setup
fab check.test


Fix previous.

Fix previous.

--HG--
extra : convert_revision : 3498fa3f50a519c98ebdeaecf07201b6da2bfe4d

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


Added autogen script

Added autogen script

git-svn-id: 05fd97617545bfa18ff4ab269b4a03860c354a97@546 a5903396-d722-0410-b921-86c7d4935375

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


Fix test user ops

Fix test user ops

PiperOrigin-RevId: 199171316

#!/usr/bin/env bash
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# Test user-defined ops against installation of TensorFlow.
#
# Usage: test_user_ops.sh [--virtualenv] [--gpu]
#
# If the flag --virtualenv is set, the script will use "python" as the Python
# binary path. Otherwise, it will use tools/python_bin_path.sh to determine
# the Python binary path.
#
# The --gpu flag informs the script that this is a GPU build, so that the
# appropriate test blacklists can be applied accordingly.
#

echo ""
echo "=== Testing user ops ==="

# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/builds_common.sh"

# Process input arguments
IS_VIRTUALENV=0
IS_GPU=0
while true; do
  if [[ "$1" == "--virtualenv" ]]; then
    IS_VIRTUALENV=1
  elif [[ "$1" == "--gpu" ]]; then
    IS_GPU=1
  fi
  shift

  if [[ -z "$1" ]]; then
    break
  fi
done

TMP_DIR=$(mktemp -d)
mkdir -p "${TMP_DIR}"

cleanup() {
  rm -rf "${TMP_DIR}"
}

die() {
  echo $@
  cleanup
  exit 1
}

# Obtain the path to Python binary
if [[ ${IS_VIRTUALENV} == "1" ]]; then
  PYTHON_BIN_PATH="$(which python)"
else
  source tools/python_bin_path.sh
  # Assume: PYTHON_BIN_PATH is exported by the script above
fi
echo "PYTHON_BIN_PATH: ${PYTHON_BIN_PATH}"

pushd "${TMP_DIR}"

# Obtain compilation and linking flags
TF_CFLAGS=( $("${PYTHON_BIN_PATH}" \
	      -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
TF_LFLAGS=( $("${PYTHON_BIN_PATH}" \
	      -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )

if [[ -z "${TF_CFLAGS[*]}" || -z "${TF_LFLAGS[*]}" ]]; then
  die "FAILED to determine TensorFlow compilation or linking flags"
else
  echo "TensorFlow compile flags: ${TF_CFLAGS[*]}"
  echo "TensorFlow link flags: ${TF_LFLAGS[*]}"
fi

# Check g++ availability
GPP_BIN="g++"
if [[ -z $(which "${GPP_BIN}") ]]; then
  die "ERROR: ${GPP_BIN} not on path"
fi

echo ""
echo "g++ version:"
"${GPP_BIN}" -v
echo ""

IS_MAC=0
if [[ $(uname) == "Darwin" ]]; then
  echo "Detected Mac OS X environment"
  IS_MAC=1
fi

EXTRA_GPP_FLAGS=""
if [[ ${IS_MAC} == "1" ]]; then
  # Extra flags required on Mac OS X, where dynamic_lookup is not the default
  # behavior.
  EXTRA_GPP_FLAGS="${EXTRA_GPP_FLAGS} -undefined dynamic_lookup"
fi

echo "Extra GPP flag: ${EXTRA_GPP_FLAGS}"

# Input to the user op
OP_INPUT="[42, 43, 44]"

if [[ ${IS_GPU} == "0" ]]; then
  echo "Testing user ops in CPU environment"

  # Expected output from user op
  EXPECTED_OUTPUT="[42, 0, 0]"

  # Locate the op kernel C++ file
  OP_KERNEL_CC="${SCRIPT_DIR}/user_ops/zero_out_op_kernel_1.cc"
  OP_KERNEL_CC=$(realpath "${OP_KERNEL_CC}")

  if [[ ! -f "${OP_KERNEL_CC}" ]]; then
    die "ERROR: Unable to find user-op kernel C++ file at: ${OP_KERNEL_CC}"
  fi

  # Copy the file to a non-TensorFlow source directory
  cp "${OP_KERNEL_CC}" ./

  # Compile the op kernel into an .so file
  SRC_FILE=$(basename "${OP_KERNEL_CC}")

  echo "Compiling user op C++ source file ${SRC_FILE}"

  USER_OP_SO="zero_out.so"

  "${GPP_BIN}" -std=c++11 ${EXTRA_GPP_FLAGS} \
    -shared "${SRC_FILE}" -o "${USER_OP_SO}" \
    -fPIC ${TF_CFLAGS[@]} ${TF_LFLAGS[@]}  || \
    die "g++ compilation of ${SRC_FILE} FAILED"

else
  echo "Testing user ops in GPU environment"

  # Expected output from user op
  EXPECTED_OUTPUT="[43, 44, 45]"

  # Check nvcc availability
  NVCC_BIN="/usr/local/cuda/bin/nvcc"
  if [[ -z $(which "${NVCC_BIN}") ]]; then
    die "ERROR: ${NVCC_BIN} not on path"
  fi

  echo ""
  echo "nvcc version:"
  "${NVCC_BIN}" --version
  echo ""

  OP_KERNEL_CU="${SCRIPT_DIR}/user_ops/cuda_op_kernel.cu.cc"
  OP_KERNEL_CU=$(realpath "${OP_KERNEL_CU}")
  if [[ ! -f "${OP_KERNEL_CU}" ]]; then
    die "ERROR: Unable to find user-op kernel CUDA file at: ${OP_KERNEL_CU}"
  fi

  OP_KERNEL_CC="${SCRIPT_DIR}/user_ops/cuda_op_kernel.cc"
  OP_KERNEL_CC=$(realpath "${OP_KERNEL_CC}")
  if [[ ! -f "${OP_KERNEL_CC}" ]]; then
    die "ERROR: Unable to find user-op kernel C++ file at: ${OP_KERNEL_CC}"
  fi

  # Copy the file to a non-TensorFlow source directory
  cp "${OP_KERNEL_CU}" ./
  cp "${OP_KERNEL_CC}" ./

  OP_KERNEL_O=$(echo "${OP_KERNEL_CC}" | sed -e 's/\.cc/\.o/')
  "${NVCC_BIN}" -std=c++11 \
      -c -o "${OP_KERNEL_O}" "${OP_KERNEL_CU}" \
      ${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC || \
      die "nvcc compilation of ${OP_KERNEL_CC} FAILED"

  CUDA_LIB_DIR="/usr/local/cuda/lib64"
  if [[ ! -d "${CUDA_LIB_DIR}" ]]; then
    CUDA_LIB_DIR="/usr/local/cuda/lib"
  fi
  if [[ ! -d "${CUDA_LIB_DIR}" ]]; then
    die "ERROR: Failed to find CUDA library directory at either of "
"/usr/local/cuda/lib and /usr/local/cuda/lib64"
  fi

  echo "Found CUDA library diretory at: ${CUDA_LIB_DIR}"
  echo ""

  # USER_OP_SO=$(basename $(echo "${OP_KERNEL_CC}" | sed -e 's/\.cc/\.so/'))
  USER_OP_SO="add_one.so"
  "${GPP_BIN}" -std=c++11 ${EXTRA_GPP_FLAGS} \
      -shared -o "${USER_OP_SO}" "${OP_KERNEL_CC}" \
      "${OP_KERNEL_O}" ${TF_CFLAGS[@]} -L "${CUDA_LIB_DIR}" ${TF_LFLAGS[@]} \
      -fPIC -lcudart || \
      die "g++ compilation of ${OP_KERNEL_CC}" FAILED
fi

# Try running the op
USER_OP=$(echo "${USER_OP_SO}" | sed -e 's/\.so//')
echo "Invoking user op ${USER_OP} defined in file ${USER_OP_SO} "\
"via pip installation"

function run_op() {
  local ORIG_OUTPUT=$1
  local ADDITIONAL_LOG=$2

  # Format OUTPUT for analysis
  if [[ -z $(echo "${ORIG_OUTPUT}" | grep -o ',') ]]; then
    if [[ ${IS_MAC} == "1" ]]; then
      local OUTPUT=$(echo "${ORIG_OUTPUT}" | sed -E -e 's/[ \t]+/,/g')
    else
      local OUTPUT=$(echo "${ORIG_OUTPUT}" | sed -r -e 's/[ \t]+/,/g')
    fi
  else
    local OUTPUT="${ORIG_OUTPUT}"
  fi

  local EQUALS_EXPECTED=$("${PYTHON_BIN_PATH}" -c "print(${OUTPUT} == ${EXPECTED_OUTPUT})")

  if [[ "${EQUALS_EXPECTED}" != "True" ]]; then
    local ERROR="FAILED: Output from user op (${OUTPUT}) does not match expected "\
  "output ${EXPECTED_OUTPUT}"${ADDITIONAL_LOG}
    die ${ERROR}
  else
    echo "Output from user op (${OUTPUT}) matches expected output"
  fi
}

run_op "$("${PYTHON_BIN_PATH}" -c "import tensorflow as tf; print(tf.Session('').run(tf.load_op_library('./${USER_OP_SO}').${USER_OP}(${OP_INPUT})))")"
run_op "$("${PYTHON_BIN_PATH}" -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.load_op_library('./${USER_OP_SO}').${USER_OP}(${OP_INPUT}).numpy())")" " in eager mode"

popd

cleanup

echo ""
echo "SUCCESS: Testing of user ops PASSED"

#!/usr/bin/env bash
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# Test user-defined ops against installation of TensorFlow.
#
# Usage: test_user_ops.sh [--virtualenv] [--gpu]
#
# If the flag --virtualenv is set, the script will use "python" as the Python
# binary path. Otherwise, it will use tools/python_bin_path.sh to determine
# the Python binary path.
#
# The --gpu flag informs the script that this is a GPU build, so that the
# appropriate test blacklists can be applied accordingly.
#

echo ""
echo "=== Testing user ops ==="

# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/builds_common.sh"

# Process input arguments
IS_VIRTUALENV=0
IS_GPU=0
while true; do
  if [[ "$1" == "--virtualenv" ]]; then
    IS_VIRTUALENV=1
  elif [[ "$1" == "--gpu" ]]; then
    IS_GPU=1
  fi
  shift

  if [[ -z "$1" ]]; then
    break
  fi
done

TMP_DIR=$(mktemp -d)
mkdir -p "${TMP_DIR}"

cleanup() {
  rm -rf "${TMP_DIR}"
}

die() {
  echo $@
  cleanup
  exit 1
}

# Obtain the path to Python binary
if [[ ${IS_VIRTUALENV} == "1" ]]; then
  PYTHON_BIN_PATH="$(which python)"
else
  source tools/python_bin_path.sh
  # Assume: PYTHON_BIN_PATH is exported by the script above
fi
echo "PYTHON_BIN_PATH: ${PYTHON_BIN_PATH}"

pushd "${TMP_DIR}"

# Obtain compilation and linking flags
TF_CFLAGS=( $("${PYTHON_BIN_PATH}" \
	      -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
TF_LFLAGS=( $("${PYTHON_BIN_PATH}" \
	      -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )

if [[ -z "${TF_CFLAGS[*]}" || -z "${TF_LFLAGS[*]}" ]]; then
  die "FAILED to determine TensorFlow compilation or linking flags"
else
  echo "TensorFlow compile flags: ${TF_CFLAGS[*]}"
  echo "TensorFlow link flags: ${TF_LFLAGS[*]}"
fi

# Check g++ availability
GPP_BIN="g++"
if [[ -z $(which "${GPP_BIN}") ]]; then
  die "ERROR: ${GPP_BIN} not on path"
fi

echo ""
echo "g++ version:"
"${GPP_BIN}" -v
echo ""

IS_MAC=0
if [[ $(uname) == "Darwin" ]]; then
  echo "Detected Mac OS X environment"
  IS_MAC=1
fi

EXTRA_GPP_FLAGS=""
if [[ ${IS_MAC} == "1" ]]; then
  # Extra flags required on Mac OS X, where dynamic_lookup is not the default
  # behavior.
  EXTRA_GPP_FLAGS="${EXTRA_GPP_FLAGS} -undefined dynamic_lookup"
fi

echo "Extra GPP flag: ${EXTRA_GPP_FLAGS}"

# Input to the user op
OP_INPUT="[42, 43, 44]"

if [[ ${IS_GPU} == "0" ]]; then
  echo "Testing user ops in CPU environment"

  # Expected output from user op
  EXPECTED_OUTPUT="[42, 0, 0]"

  # Locate the op kernel C++ file
  OP_KERNEL_CC="${SCRIPT_DIR}/user_ops/zero_out_op_kernel_1.cc"
  OP_KERNEL_CC=$(realpath "${OP_KERNEL_CC}")

  if [[ ! -f "${OP_KERNEL_CC}" ]]; then
    die "ERROR: Unable to find user-op kernel C++ file at: ${OP_KERNEL_CC}"
  fi

  # Copy the file to a non-TensorFlow source directory
  cp "${OP_KERNEL_CC}" ./

  # Compile the op kernel into an .so file
  SRC_FILE=$(basename "${OP_KERNEL_CC}")

  echo "Compiling user op C++ source file ${SRC_FILE}"

  USER_OP_SO="zero_out.so"

  "${GPP_BIN}" -std=c++11 ${EXTRA_GPP_FLAGS} \
    -shared "${SRC_FILE}" -o "${USER_OP_SO}" \
    -fPIC ${TF_CFLAGS[@]} ${TF_LFLAGS[@]}  || \
    die "g++ compilation of ${SRC_FILE} FAILED"

else
  echo "Testing user ops in GPU environment"

  # Expected output from user op
  EXPECTED_OUTPUT="[43, 44, 45]"

  # Check nvcc availability
  NVCC_BIN="/usr/local/cuda/bin/nvcc"
  if [[ -z $(which "${NVCC_BIN}") ]]; then
    die "ERROR: ${NVCC_BIN} not on path"
  fi

  echo ""
  echo "nvcc version:"
  "${NVCC_BIN}" --version
  echo ""

  OP_KERNEL_CU="${SCRIPT_DIR}/user_ops/cuda_op_kernel.cu.cc"
  OP_KERNEL_CU=$(realpath "${OP_KERNEL_CU}")
  if [[ ! -f "${OP_KERNEL_CU}" ]]; then
    die "ERROR: Unable to find user-op kernel CUDA file at: ${OP_KERNEL_CU}"
  fi

  OP_KERNEL_CC="${SCRIPT_DIR}/user_ops/cuda_op_kernel.cc"
  OP_KERNEL_CC=$(realpath "${OP_KERNEL_CC}")
  if [[ ! -f "${OP_KERNEL_CC}" ]]; then
    die "ERROR: Unable to find user-op kernel C++ file at: ${OP_KERNEL_CC}"
  fi

  # Copy the file to a non-TensorFlow source directory
  cp "${OP_KERNEL_CU}" ./
  cp "${OP_KERNEL_CC}" ./

  OP_KERNEL_O=$(echo "${OP_KERNEL_CC}" | sed -e 's/\.cc/\.o/')
  "${NVCC_BIN}" -std=c++11 \
      -c -o "${OP_KERNEL_O}" "${OP_KERNEL_CU}" \
      ${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC || \
      die "nvcc compilation of ${OP_KERNEL_CC} FAILED"

  CUDA_LIB_DIR="/usr/local/cuda/lib64"
  if [[ ! -d "${CUDA_LIB_DIR}" ]]; then
    CUDA_LIB_DIR="/usr/local/cuda/lib"
  fi
  if [[ ! -d "${CUDA_LIB_DIR}" ]]; then
    die "ERROR: Failed to find CUDA library directory at either of "
"/usr/local/cuda/lib and /usr/local/cuda/lib64"
  fi

  echo "Found CUDA library diretory at: ${CUDA_LIB_DIR}"
  echo ""

  # USER_OP_SO=$(basename $(echo "${OP_KERNEL_CC}" | sed -e 's/\.cc/\.so/'))
  USER_OP_SO="add_one.so"
  "${GPP_BIN}" -std=c++11 ${EXTRA_GPP_FLAGS} \
      -shared -o "${USER_OP_SO}" "${OP_KERNEL_CC}" \
      "${OP_KERNEL_O}" ${TF_CFLAGS[@]} -L "${CUDA_LIB_DIR}" ${TF_LFLAGS[@]} \
      -fPIC -lcudart || \
      die "g++ compilation of ${OP_KERNEL_CC}" FAILED
fi

# Try running the op
USER_OP=$(echo "${USER_OP_SO}" | sed -e 's/\.so//')
echo "Invoking user op ${USER_OP} defined in file ${USER_OP_SO} "\
"via pip installation"

function run_op() {
  local ORIG_OUTPUT=$1
  local ADDITIONAL_LOG=$2

  # Format OUTPUT for analysis
  if [[ -z $(echo "${ORIG_OUTPUT}" | grep -o ',') ]]; then
    if [[ ${IS_MAC} == "1" ]]; then
      local OUTPUT=$(echo "${ORIG_OUTPUT}" | sed -E -e 's/[ \t]+/,/g')
    else
      local OUTPUT=$(echo "${ORIG_OUTPUT}" | sed -r -e 's/[ \t]+/,/g')
    fi
  else
    local OUTPUT="${ORIG_OUTPUT}"
  fi

  local EQUALS_EXPECTED=$("${PYTHON_BIN_PATH}" -c "print(${OUTPUT} == ${EXPECTED_OUTPUT})")

  if [[ "${EQUALS_EXPECTED}" != "True" ]]; then
    local ERROR="FAILED: Output from user op (${OUTPUT}) does not match expected "\
  "output ${EXPECTED_OUTPUT}"${ADDITIONAL_LOG}
    die ${ERROR}
  else
    echo "Output from user op (${OUTPUT}) matches expected output"
  fi
}

run_op $("${PYTHON_BIN_PATH}" -c "import tensorflow as tf; print(tf.Session('').run(tf.load_op_library('./${USER_OP_SO}').${USER_OP}(${OP_INPUT})))")
run_op $("${PYTHON_BIN_PATH}" -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.load_op_library('./${USER_OP_SO}').${USER_OP}(${OP_INPUT}))") " in eager mode"

popd

cleanup

echo ""
echo "SUCCESS: Testing of user ops PASSED"