fixed capitalization

fixed capitalization

#!/bin/sh
#
#  start the NuoDB processes
#
set -x

env

# setup NUODB vars pointing to standard locations
export NUODB_HOME=/opt/nuodb
. $NUODB_HOME/etc/nuodb_setup.sh

mv /opt/nuodb/etc/default.properties.sample /opt/nuodb/etc/default.properties
sed -i "/#domainPassword =/c\domainPassword = ${DOMAIN_PASSWORD}" /opt/nuodb/etc/default.properties

mkdir -p $NUODB_LOGDIR
mkdir -p $NUODB_VARDIR

NODE_MEM="512m"

ARCHIVE_VOLUME=$NUODB_VARDIR/production-archives
ARCHIVE_LOCATION=$ARCHIVE_VOLUME/$DB_NAME

# set up BROKER vars
BROKER_OPTS="--password ${DOMAIN_PASSWORD} --broker true"
[ -n "$PEER_ADDRESS" ] && BROKER_OPTS="$BROKER_OPTS --peer ${PEER_ADDRESS}"
[ -n "$ALT_ADDRESS" ] && BROKER_OPTS="$BROKER_OPTS --advertise-alt --alt-addr ${ALT_ADDRESS}"

#confirm broker is responding
if [ "${NODE_TYPE}" != "BROKER" ]; then
    status=""
    count=1
    while [ "$status" == "" ]; do
        echo "wait 5 seconds for broker"
        sleep 5
        status="$( /opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD --command 'show domain summary' | grep broker )"
        ((count++))
        echo "loop count: " $count
        if [ "$count" == 10 ]; then
            echo "timed out waiting for broker to respond. Exiting"
            exit 1
        fi
    done

    #clean unreachable nodes from domain state
    uuid="$(/opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD \
        --command "show domain summary" | grep UNREACHABLE | sed 's/\(.*\)\(uuid.*\)\( .*\)/\2/g' | awk '{print $1}')"

    for id in $uuid; do
        echo $id
        #remove broker
        /opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD --command "agent deprovision stableId $id"
        #remove host
        /opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD \
             --command "domainstate removehostprocesses id $id database ${DB_NAME}"
    done
fi

# first start the broker
if [ "${NODE_TYPE}" == "SM" ]; then
   HOST_TAGS="-DhostTags=SM_OK=True"
elif [ "${NODE_TYPE}" == "TE" ]; then
    HOST_TAGS="-DhostTags=TE_OK=True"
fi

$JAVA_HOME/bin/java $HOST_TAGS -jar $NUODB_HOME/jar/nuoagent.jar --port ${AGENT_PORT} $BROKER_OPTS >> $NUODB_LOGDIR/agent.log 2>&1 &

# set up engine start-up vars
START_CMD="start process ${NODE_TYPE} host ${PEER_ADDRESS}:${AGENT_PORT} database ${DB_NAME}"
NODE_OPTS="--agent-port ${AGENT_PORT} --node-port ${NODE_PORT} --mem $NODE_MEM"

# add options specific to the engine type
if [ "${NODE_TYPE}" == "SM" ]; then
        START_CMD="$START_CMD archive $ARCHIVE_LOCATION"
        NODE_OPTS="$NODE_OPTS --journal enable"

        # if the archive volume is mounted, but the archive does not exist, then initialize it
        if [ -d "$ARCHIVE_VOLUME" ]; then
                [ -d "$ARCHIVE_LOCATION" ] || NODE_OPTS="$NODE_OPS --initialize"
        else
                # the archive volume is not mounted, so the archive is ephemeral
                echo "No archive volume mounted - running in DEV mode"
                mkdir -p $ARCHIVE_LOCATION
        fi
elif [ "${NODE_TYPE}" == "TE" ]; then
        NODE_OPTS="$NODE_OPTS --dba-user ${DB_USER} --dba-password ${DB_PASSWORD}"
elif [ "${NODE_TYPE}" == "BROKER" ]; then
        echo "Starting BROKER container"
else
        echo "Unimplemented node type: ${NODE_TYPE}"
        exit 1
fi

#disable thp if enabled
/bin/bash /scripts/disable_thp.sh

#start api service
/opt/nuodb/etc/nuorestsvc start

#create and populate database if doesn't exist
if [ "${NODE_TYPE}" == "TE" ] && ${POPULATE_NUODB}; then
    #check if there's a db already
    eval_db="$(/opt/nuodb/bin/nuodbmgr --broker localhost --password $DOMAIN_PASSWORD --command "show domain databases" | grep ${DB_NAME})"
    if [ -z "$eval_db" ]; then
       /bin/bash /scripts/createDb.sh
    fi
fi

cat $NUODB_LOGDIR/agent.log
tail -f $NUODB_LOGDIR/agent.log &

#!/bin/sh
#
#  start the NuoDB processes
#
set -x

env

# setup NUODB vars pointing to standard locations
export NUODB_HOME=/opt/nuodb
. $NUODB_HOME/etc/nuodb_setup.sh

mv /opt/nuodb/etc/default.properties.sample /opt/nuodb/etc/default.properties
sed -i "/#domainPassword =/c\domainPassword = ${DOMAIN_PASSWORD}" /opt/nuodb/etc/default.properties

mkdir -p $NUODB_LOGDIR
mkdir -p $NUODB_VARDIR

NODE_MEM="512m"

ARCHIVE_VOLUME=$NUODB_VARDIR/production-archives
ARCHIVE_LOCATION=$ARCHIVE_VOLUME/$DB_NAME

# set up BROKER vars
BROKER_OPTS="--password ${DOMAIN_PASSWORD} --broker true"
[ -n "$PEER_ADDRESS" ] && BROKER_OPTS="$BROKER_OPTS --peer ${PEER_ADDRESS}"
[ -n "$ALT_ADDRESS" ] && BROKER_OPTS="$BROKER_OPTS --advertise-alt --alt-addr ${ALT_ADDRESS}"

#confirm broker is responding
if [ "${NODE_TYPE}" != "BROKER" ]; then
    status=""
    count=1
    while [ "$status" == "" ]; do
        echo "wait 5 seconds for broker"
        sleep 5
        status="$( /opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD --command 'show domain summary' | grep broker )"
        ((count++))
        echo "loop count: " $count
        if [ "$count" == 10 ]; then
            echo "timed out waiting for broker to respond. Exiting"
            exit 1
        fi
    done

    #clean unreachable nodes from domain state
    uuid="$(/opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD \
        --command "show domain summary" | grep UNREACHABLE | sed 's/\(.*\)\(uuid.*\)\( .*\)/\2/g' | awk '{print $1}')"

    for id in $uuid; do
        echo $id
        #remove broker
        /opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD --command "agent deprovision stableId $id"
        #remove host
        /opt/nuodb/bin/nuodbmgr --broker $PEER_ADDRESS --password $DOMAIN_PASSWORD \
             --command "domainstate removehostprocesses id $id database ${DB_NAME}"
    done
fi

# first start the broker
if [ "${NODE_TYPE}" == "SM" ]; then
   HOST_TAGS="-DhostTags=SM_OK=True"
elif [ "${NODE_TYPE}" == "TE" ]; then
    HOST_TAGS="-DhostTags=TE_OK=True"
fi

$JAVA_HOME/bin/java $HOST_TAGS -jar $NUODB_HOME/jar/nuoagent.jar --port ${AGENT_PORT} $BROKER_OPTS >> $NUODB_LOGDIR/agent.log 2>&1 &

# set up engine start-up vars
START_CMD="start process ${NODE_TYPE} host ${PEER_ADDRESS}:${AGENT_PORT} database ${DB_NAME}"
NODE_OPTS="--agent-port ${AGENT_PORT} --node-port ${NODE_PORT} --mem $NODE_MEM"

# add options specific to the engine type
if [ "${NODE_TYPE}" == "SM" ]; then
        START_CMD="$START_CMD archive $ARCHIVE_LOCATION"
        NODE_OPTS="$NODE_OPTS --journal enable"

        # if the archive volume is mounted, but the archive does not exist, then initialize it
        if [ -d "$ARCHIVE_VOLUME" ]; then
                [ -d "$ARCHIVE_LOCATION" ] || NODE_OPTS="$NODE_OPS --initialize"
        else
                # the archive volume is not mounted, so the archive is ephemeral
                echo "No archive volume mounted - running in DEV mode"
                mkdir -p $ARCHIVE_LOCATION
        fi
elif [ "${NODE_TYPE}" == "TE" ]; then
        NODE_OPTS="$NODE_OPTS --dba-user ${DB_USER} --dba-password ${DB_PASSWORD}"
elif [ "${NODE_TYPE}" == "BROKER" ]; then
        echo "Starting BROKER container"
else
        echo "Unimplemented node type: ${NODE_TYPE}"
        exit 1
fi

#disable thp if enabled
/bin/bash /scripts/disable_thp.sh

#start api service
/opt/nuodb/etc/nuorestsvc start

#create and populate database if doesn't exist
if [ "${NODE_TYPE}" == "TE" ] && ${POPUlATE_NUODB}; then
    #check if there's a db already
    eval_db="$(/opt/nuodb/bin/nuodbmgr --broker localhost --password $DOMAIN_PASSWORD --command "show domain databases" | grep ${DB_NAME})"
    if [ -z "$eval_db" ]; then
       /bin/bash /scripts/createDb.sh
    fi
fi

cat $NUODB_LOGDIR/agent.log
tail -f $NUODB_LOGDIR/agent.log &


Fix version inference for the RPM build script.

The leading "v" of the tag needs to be dropped.

#!/bin/sh
set -e
cd ../../
DUB_PATH=`pwd`
#rm -f ~/rpmbuild/SOURCES/dub.tar.gz
#tar -pczf ~/rpmbuild/SOURCES/dub.tar.gz source build-files.txt build.sh LICENSE*
cd installer/rpm/
for i in $(git describe | tr "-" "\n"); do
	if [ "$VER" == "" ]; then
		VER=${i:1}
	elif [ "$REL" == "" ]; then
		REL=0.$i
	else
		REL=$REL.$i
	fi
done
ARCH=$(uname -i)
echo Building RPM FOR $VER-$REL-$ARCH
rpmbuild -ba dub.spec --define "ver $VER" --define "rel $REL" --define="srcpath $DUB_PATH"
cp ~/rpmbuild/BUILD/dub-$VER-$REL.$ARCH.rpm .

#!/bin/sh
set -e
cd ../../
DUB_PATH=`pwd`
#rm -f ~/rpmbuild/SOURCES/dub.tar.gz
#tar -pczf ~/rpmbuild/SOURCES/dub.tar.gz source build-files.txt build.sh LICENSE*
cd installer/rpm/
for i in $(git describe | tr "-" "\n"); do
	if [ "$VER" == "" ]; then
		VER=$i
	elif [ "$REL" == "" ]; then
		REL=0.$i
	else
		REL=$REL.$i
	fi
done
ARCH=$(uname -i)
echo Building RPM FOR $VER-$REL-$ARCH
rpmbuild -ba dub.spec --define "ver $VER" --define "rel $REL" --define="srcpath $DUB_PATH"
cp ~/rpmbuild/BUILD/dub-$VER-$REL.$ARCH.rpm .


monkey

monkey

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/Eliot-Roxbergh/dotFIles.git/'


switched zip to tar, kept file permissions

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/ndoit/fenrir.git/'


pollable script to show cluster & each node's state - service_states.sh

#!/bin/bash

# USAGE: watch -n1 "./scripts/leaders.sh | sort"

set +e # fail fast
set +x # print commands

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

ETCD_CLUSTER=${ETCD_CLUSTER:-10.244.4.2:4001}

services=$(curl -sL "${ETCD_CLUSTER}/v2/keys/service/?sorted=true" | jq -r ".node.nodes[].key")
for servicekey in ${services[@]}; do
  printf "$(basename $servicekey) "
  members=$(curl -sL "${ETCD_CLUSTER}/v2/keys${servicekey}/members/?sorted=true" | jq -r ".node.nodes[].value")
  for member in ${members}; do
    printf "$(echo $member | jq -r .role)/$(echo $member | jq -r .state) "
  done
  echo
done

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


functions: add nc serve_and_dump function

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


add jenkins installation

add jenkins installation

#!/bin/bash
# Install the latest version of Jenkins on Ubuntu

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

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


[plans] Add plan for zip.

[plans] Add plan for zip.

Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>

Pull request: #709
Approved by: adamhjk

pkg_name=zip
pkg_origin=core
pkg_version=3.0
_ver=${pkg_version/./}
pkg_license=('custom')
pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>"
pkg_source=http://downloads.sourceforge.net/infozip/${pkg_name}${_ver}.tar.gz
pkg_shasum=f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369
pkg_dirname="${pkg_name}${_ver}"
pkg_deps=(core/glibc)
pkg_build_deps=(core/coreutils core/make core/gcc)
pkg_bin_dirs=(bin)

do_build() {
  make -f unix/Makefile prefix=$pkg_prefix generic_gcc
}

do_install() {
  make -f unix/Makefile \
    prefix=$pkg_prefix \
    MANDIR=${pkg_prefix}/share/man/man1 \
    install
}

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


Updated cataclysm install req and build settings


Add startup script for graphite and carbon servers.

#!/bin/bash

# Starts and runs the carbon server and graphite web-app.
# Assumes script is running from vagrant environment, and
# Cassandra is running from host environment.

# TODO Stop if Cassandra isn't running?
# TODO Makefile, or startup script?
# TODO Write values to files based on IP address

echo "Make sure Cassandra is running on the host machine."

echo "Starting Carbon Daemon server."
sudo -u www-data /opt/graphite/bin/carbon-daemon.py writer start 2 &> 1

# TODO Run graphite as a background process, append logs to nohup.
echo "Starting Graphite development server."
sudo -u www-data /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite/

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


Command ssh implements proxy feature.

Command ssh implements proxy feature.

# -L local proxy server
ssh -qTfnN -L 0.0.0.0:17922:localhost:17922 root@remote_ip_or_domain

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


Update prestart.sh

Update prestart.sh

#!/bin/bash
# Copyright (c) 2016, TIBCO Software Inc. All rights reserved.
# You may not use this file except in compliance with the license
# terms contained in the TIBCO License.md file provided with this file.

printBWTable ()
{
	echo "---------------> Product Inventory"
	echo "---------------------------------------------------------"
	echo "Name      = "`grep product.name $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "Version   = "`grep product.version $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "Build     = "`grep product.build $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "Vendor    = "`grep product.vendor $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "BuildDate = "`grep product.build.date $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "---------------------------------------------------------"
mkdir -p $APPDIR/tibco.home/addons
pluginFolder=$APPDIR/tibco.home/addons
if [ "$(ls $pluginFolder | grep lib)"  ]; then
for name in $(find $pluginFolder/lib -type f);
do
	# filter out hidden files
	if [[  "$(basename $name )" != .* ]];then
		echo "Name      = "`grep product.name $name|cut -d'=' -f 2`
		echo "Version   = "`grep product.version $name|cut -d'=' -f 2`
		echo "Build     = "`grep product.build $name|cut -d'=' -f 2`
		echo "Vendor    = "`grep product.vendor $name|cut -d'=' -f 2`
		echo "BuildDate = "`grep product.build.date $name|cut -d'=' -f 2`
		echo "---------------------------------------------------------"
	fi
done
fi
}
export APPDIR=/home/vcap/app
export BW_KEYSTORE_PATH=$HOME/keystore
export MALLOC_ARENA_MAX=4
chmod 755 $APPDIR/tibco.home/bw*/*/bin/bwappnode
chmod 755 $APPDIR/tibco.home/bw*/*/bin/startBWAppNode.sh
sed -i.bak "s#_APPDIR_#$APPDIR#g" $APPDIR/tibco.home/bw*/*/config/appnode_config.ini
if [ "$(ls $APPDIR/tibco.home/bw*/*/ext/shared)"  ]; then
	sed -i "s#_APPDIR_#$APPDIR#g" $APPDIR/tibco.home/bw*/*/ext/shared/addons.link
fi
if [ "$(ls $APPDIR/tibco.home/addons/lib)"  ]; then
	sed -i "s#_APPDIR_#$APPDIR#g" $APPDIR/tibco.home/bw*/*/bin/bwappnode.tra
fi

if [[ ${BW_LOGLEVEL} ]]; then
	echo "Before substitution...."
	cat $APPDIR/tmp/pcf.substvar
	# subst profile file
	echo PORT is $PORT
fi
if grep -q BW.CLOUD.PORT "$APPDIR/tmp/pcf.substvar"; then
	sed -i.bak -Ee "
	/BW.CLOUD.PORT/ {
	# append a line
	N
	s/(<value>)[0-9]+(<\/value)/\1${PORT}\2/
	}" $APPDIR/tmp/pcf.substvar
 else
   echo "BW.CLOUD.PORT not found."
fi

export JETTISON_JAR=`echo $APPDIR/tibco.home/bw*/*/system/shared/com.tibco.bw.tpcl.org.codehaus.jettison*/jettison*.jar`
JRE_VERSION=`ls $APPDIR/tibco.home/tibcojre64/`
jreLink=tibcojre64/$JRE_VERSION
chmod +x $APPDIR/tibco.home/$jreLink/bin/java
chmod +x $APPDIR/tibco.home/$jreLink/bin/javac
$APPDIR/tibco.home/$jreLink/bin/javac -cp $JETTISON_JAR:.:$APPDIR/tibco.home/$jreLink/lib:$APPDIR/tibco.home/$jreLink/bin ProfileTokenResolver.java
$APPDIR/tibco.home/$jreLink/bin/java -cp $JETTISON_JAR:.:$APPDIR/tibco.home/$jreLink/lib:$APPDIR/tibco.home/$jreLink/bin ProfileTokenResolver

STATUS=$?
if [ $STATUS == "1" ]; then
    echo "ERROR: Failed to subsitute properties."
    exit 1 # terminate and indicate error
fi

if [[ ${BW_LOGLEVEL} ]]; then
	echo "After substitution...."
	cat $APPDIR/tmp/pcf.substvar
fi
printBWTable
exec ./tibco.home/bw*/*/bin/startBWAppNode.sh

#!/bin/bash
# Copyright (c) 2016, TIBCO Software Inc. All rights reserved.
# You may not use this file except in compliance with the license
# terms contained in the TIBCO License.md file provided with this file.

printBWTable ()
{
	echo "---------------> Product Inventory"
	echo "---------------------------------------------------------"
	echo "Name      = "`grep product.name $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "Version   = "`grep product.version $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "Build     = "`grep product.build $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "Vendor    = "`grep product.vendor $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "BuildDate = "`grep product.build.date $APPDIR/tibco.home/bw*/*/system/lib/bw.ini|cut -d'=' -f 2`
	echo "---------------------------------------------------------"
mkdir -p $APPDIR/tibco.home/addons
pluginFolder=$APPDIR/tibco.home/addons
if [ "$(ls $pluginFolder | grep lib)"  ]; then
for name in $(find $pluginFolder/lib -type f);
do
	# filter out hidden files
	if [[  "$(basename $name )" != .* ]];then
		echo "Name      = "`grep product.name $name|cut -d'=' -f 2`
		echo "Version   = "`grep product.version $name|cut -d'=' -f 2`
		echo "Build     = "`grep product.build $name|cut -d'=' -f 2`
		echo "Vendor    = "`grep product.vendor $name|cut -d'=' -f 2`
		echo "BuildDate = "`grep product.build.date $name|cut -d'=' -f 2`
		echo "---------------------------------------------------------"
	fi
done
fi
}
export APPDIR=/home/vcap/app
export BW_KEYSTORE_PATH=$HOME/keystore
chmod 755 $APPDIR/tibco.home/bw*/*/bin/bwappnode
chmod 755 $APPDIR/tibco.home/bw*/*/bin/startBWAppNode.sh
sed -i.bak "s#_APPDIR_#$APPDIR#g" $APPDIR/tibco.home/bw*/*/config/appnode_config.ini
if [ "$(ls $APPDIR/tibco.home/bw*/*/ext/shared)"  ]; then
	sed -i "s#_APPDIR_#$APPDIR#g" $APPDIR/tibco.home/bw*/*/ext/shared/addons.link
fi
if [ "$(ls $APPDIR/tibco.home/addons/lib)"  ]; then
	sed -i "s#_APPDIR_#$APPDIR#g" $APPDIR/tibco.home/bw*/*/bin/bwappnode.tra
fi

if [[ ${BW_LOGLEVEL} ]]; then
	echo "Before substitution...."
	cat $APPDIR/tmp/pcf.substvar
	# subst profile file
	echo PORT is $PORT
fi
if grep -q BW.CLOUD.PORT "$APPDIR/tmp/pcf.substvar"; then
	sed -i.bak -Ee "
	/BW.CLOUD.PORT/ {
	# append a line
	N
	s/(<value>)[0-9]+(<\/value)/\1${PORT}\2/
	}" $APPDIR/tmp/pcf.substvar
 else
   echo "BW.CLOUD.PORT not found."
fi

export JETTISON_JAR=`echo $APPDIR/tibco.home/bw*/*/system/shared/com.tibco.bw.tpcl.org.codehaus.jettison*/jettison*.jar`
JRE_VERSION=`ls $APPDIR/tibco.home/tibcojre64/`
jreLink=tibcojre64/$JRE_VERSION
chmod +x $APPDIR/tibco.home/$jreLink/bin/java
chmod +x $APPDIR/tibco.home/$jreLink/bin/javac
$APPDIR/tibco.home/$jreLink/bin/javac -cp $JETTISON_JAR:.:$APPDIR/tibco.home/$jreLink/lib:$APPDIR/tibco.home/$jreLink/bin ProfileTokenResolver.java
$APPDIR/tibco.home/$jreLink/bin/java -cp $JETTISON_JAR:.:$APPDIR/tibco.home/$jreLink/lib:$APPDIR/tibco.home/$jreLink/bin ProfileTokenResolver

STATUS=$?
if [ $STATUS == "1" ]; then
    echo "ERROR: Failed to subsitute properties."
    exit 1 # terminate and indicate error
fi

if [[ ${BW_LOGLEVEL} ]]; then
	echo "After substitution...."
	cat $APPDIR/tmp/pcf.substvar
fi
printBWTable
exec ./tibco.home/bw*/*/bin/startBWAppNode.sh


TOOLS-1455: sdc-scripts.git:sbin/postlogrotate.sh can attempt to cat log files over themselves

#!/usr/bin/bash
# vi: sw=4 ts=4 et
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

#
# Copyright (c) 2014, Joyent, Inc.
#

#
# The standard script to be used as the command for '-a CMD' in
# /etc/logadm.conf for rotated SDC logs.  The primary function here is to
# roll the just-rotated "...T%H:%M:%S.log" log file into "...THH:00:00.log" for
# the current hour (rolling backward, the default) *or* for the next hour
# (rolling forward). The latter is to support more-than-once-per-hour rotations
# ending up as one correct hourly log file in Manta. This is needed to not lose
# log data through a "vmadm reprovision" (as is done currently for upgrades).
#
# Usage:
#       lostrotatelog.sh NAME
#
# Environment:
#       SDC_LOG_ROLL_FORWARD=1      If set, then the latest rotated log file
#                                   will be rolled *forward* to the next
#                                   hour. E.g. "...T09:12:34.log" will be
#                                   rolled to "...T10:00:00.log".
#
# where 'NAME' is the base name of the rotated log. Logs are rotated
# to "/var/log/sdc/upload", for example
# "imgapi_8584337e-e54c-4910-86b8-0d5ff9282bbd_2013-10-09T23:00:00.log"
# In this case the 'NAME' is 'imgapi'.
#

if [[ -n "$TRACE" ]]; then
    export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
    set -o xtrace
fi
set -o errexit
set -o pipefail

function fatal() {
    echo "$0: error: $*" >&2
    exit 1
}

#---- mainline

name=$1
[[ -z "$name" ]] && fatal "NAME argument not given"

# Roll this last rotated file fwd (into the top of the next hour)
# or bwd (into the top of this hour). Bwd is the default.
lastlog=$(ls -1t /var/log/sdc/upload/${name}_* | head -1)
if [[ "$SDC_LOG_ROLL_FORWARD" == "1" ]]; then
    # Roll forward.
    base=$(echo $lastlog | cut -d_ -f 1)
    zone=$(echo $lastlog | cut -d_ -f 2)
    logtime=$(echo $lastlog | cut -d_ -f3 | cut -d. -f1)
    # TODO: GZ /usr/bin/date doesn't support -d. Use node? Only if need
    #       support for this code path in GZ.
    DATE=/opt/local/bin/date
    hourfwd=$($DATE -d \@$(( $($DATE -d $logtime "+%s") + 3600 )) "+%Y-%m-%dT%H:00:00")
    targ="${base}_${zone}_${hourfwd}.log"
else
    # Roll backward (to the top of this hour).
    base=$(echo $lastlog | cut -d: -f1)   # '/var/log/sdc/upload/$name...T23'
    targ="${base}:00:00.log"
fi
if [[ "$lastlog" != "$targ" ]]; then
    cat $lastlog >>${targ}
    rm $lastlog
fi

#!/usr/bin/bash
# vi: sw=4 ts=4 et
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

#
# Copyright (c) 2014, Joyent, Inc.
#

#
# The standard script to be used as the command for '-a CMD' in
# /etc/logadm.conf for rotated SDC logs.  The primary function here is to
# roll the just-rotated "...T%H:%M:%S.log" log file into "...THH:00:00.log" for
# the current hour (rolling backward, the default) *or* for the next hour
# (rolling forward). The latter is to support more-than-once-per-hour rotations
# ending up as one correct hourly log file in Manta. This is needed to not lose
# log data through a "vmadm reprovision" (as is done currently for upgrades).
#
# Usage:
#       lostrotatelog.sh NAME
#
# Environment:
#       SDC_LOG_ROLL_FORWARD=1      If set, then the latest rotated log file
#                                   will be rolled *forward* to the next
#                                   hour. E.g. "...T09:12:34.log" will be
#                                   rolled to "...T10:00:00.log".
#
# where 'NAME' is the base name of the rotated log. Logs are rotated
# to "/var/log/sdc/upload", for example
# "imgapi_8584337e-e54c-4910-86b8-0d5ff9282bbd_2013-10-09T23:00:00.log"
# In this case the 'NAME' is 'imgapi'.
#

if [[ -n "$TRACE" ]]; then
    export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
    set -o xtrace
fi
set -o errexit
set -o pipefail

function fatal() {
    echo "$0: error: $*" >&2
    exit 1
}

#---- mainline

name=$1
[[ -z "$name" ]] && fatal "NAME argument not given"

# Roll this last rotated file fwd (into the top of the next hour)
# or bwd (into the top of this hour). Bwd is the default.
lastlog=$(ls -1t /var/log/sdc/upload/${name}_* | head -1)
if [[ "$SDC_LOG_ROLL_FORWARD" == "1" ]]; then
    # Roll forward.
    base=$(echo $lastlog | cut -d_ -f 1)
    zone=$(echo $lastlog | cut -d_ -f 2)
    logtime=$(echo $lastlog | cut -d_ -f3 | cut -d. -f1)
    # TODO: GZ /usr/bin/date doesn't support -d. Use node? Only if need
    #       support for this code path in GZ.
    DATE=/opt/local/bin/date
    hourfwd=$($DATE -d \@$(( $($DATE -d $logtime "+%s") + 3600 )) "+%Y-%m-%dT%H:00:00")
    cat $lastlog >>${base}_${zone}_${hourfwd}.log
else
    # Roll backward (to the top of this hour).
    base=$(echo $lastlog | cut -d: -f1)   # '/var/log/sdc/upload/$name...T23'
    cat $lastlog >>${base}:00:00.log
fi
rm $lastlog


just chucking this in here... doesn't seem to work

java -jar script/jsmin/compiler.jar --js ../../lib/sugar.js --js_output_file ../../release/sugar.js

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


Password hash generator

Password hash generator

#!/bin/bash
echo "	This script will generate md4 hash of your password."
echo ""
echo "		Step 1. Type your password and press enter."
echo "		Step 2. Press Ctrl + D.\n "
echo ""
echo "!!!Warning: Your password will appear as plain text on your screen."

tr -d '\n' | iconv -t utf16le | openssl md4

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


Typo fix: the `--profile` option must be after `test`

Otherwise is a Bazel startup option and build fails due to that not being recognized.

PiperOrigin-RevId: 407422420
Change-Id: Id650bb3a160ffd2a47864ec16a4eacf10594391f

#!/bin/bash
# Copyright 2019 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.
# ==============================================================================

set -e

# Error if we somehow forget to set the path to bazel_wrapper.py
set -u
BAZEL_WRAPPER_PATH=$1
set +u

# From this point on, logs can be publicly available
set -x

function run_build () {
  # Run configure.
  export TF_NEED_CUDA=0
  export PYTHON_BIN_PATH=$(which python3.7)
  yes "" | $PYTHON_BIN_PATH configure.py
  tag_filters="-no_oss,-no_oss_py2,-gpu,-tpu,-benchmark-test,-nomac,-no_mac,-v1only"

  # Get the default test targets for bazel.
  source tensorflow/tools/ci_build/build_scripts/DEFAULT_TEST_TARGETS.sh

  "${BAZEL_WRAPPER_PATH}" \
    test \
    --profile="${KOKORO_ARTIFACTS_DIR}/profile.json" \
    --nodistinct_host_configuration \
    --build_tag_filters="${tag_filters}" \
    --test_tag_filters="${tag_filters}" \
    --action_env=PATH \
    --remote_accept_cached=true \
    --spawn_strategy=standalone \
    --remote_local_fallback=false \
    --remote_timeout=600 \
    --strategy=Javac=standalone \
    --strategy=Closure=standalone \
    --genrule_strategy=standalone \
    -- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/java/... -//tensorflow/lite/java/...

  # Copy log to output to be available to GitHub
  ls -la "$(bazel info output_base)/java.log"
  cp "$(bazel info output_base)/java.log" "${KOKORO_ARTIFACTS_DIR}/"
}

source tensorflow/tools/ci_build/release/common.sh
install_bazelisk

# Set up and install MacOS pip dependencies.
setup_venv_macos python3.7
run_build

#!/bin/bash
# Copyright 2019 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.
# ==============================================================================

set -e

# Error if we somehow forget to set the path to bazel_wrapper.py
set -u
BAZEL_WRAPPER_PATH=$1
set +u

# From this point on, logs can be publicly available
set -x

function run_build () {
  # Run configure.
  export TF_NEED_CUDA=0
  export PYTHON_BIN_PATH=$(which python3.7)
  yes "" | $PYTHON_BIN_PATH configure.py
  tag_filters="-no_oss,-no_oss_py2,-gpu,-tpu,-benchmark-test,-nomac,-no_mac,-v1only"

  # Get the default test targets for bazel.
  source tensorflow/tools/ci_build/build_scripts/DEFAULT_TEST_TARGETS.sh

  "${BAZEL_WRAPPER_PATH}" \
    --profile="${KOKORO_ARTIFACTS_DIR}/profile.json" \
    test \
    --nodistinct_host_configuration \
    --build_tag_filters="${tag_filters}" \
    --test_tag_filters="${tag_filters}" \
    --action_env=PATH \
    --remote_accept_cached=true \
    --spawn_strategy=standalone \
    --remote_local_fallback=false \
    --remote_timeout=600 \
    --strategy=Javac=standalone \
    --strategy=Closure=standalone \
    --genrule_strategy=standalone \
    -- ${DEFAULT_BAZEL_TARGETS} -//tensorflow/java/... -//tensorflow/lite/java/...

  # Copy log to output to be available to GitHub
  ls -la "$(bazel info output_base)/java.log"
  cp "$(bazel info output_base)/java.log" "${KOKORO_ARTIFACTS_DIR}/"
}

source tensorflow/tools/ci_build/release/common.sh
install_bazelisk

# Set up and install MacOS pip dependencies.
setup_venv_macos python3.7
run_build


Expanded list of ports to check to include RDP and VNC

Change-Id: I7e3501d2cb6e6dccf63bf198ad296cff4a177325

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


Add script touchpad.sh

Add script touchpad.sh

#!/bin/bash

touchpad_file='/etc/X11/xorg.conf.d/20-touchpad.conf'

cat << EOF > "${touchpad_file}"
Section "InputClass"
    Identifier "touchpad"
    Driver "synaptics"
    MatchIsTouchpad "on"
        Option "TapButton1" "1"
        Option "TapButton2" "3"
        Option "TapButton3" "2"
        Option "VertEdgeScroll" "off"
        Option "VertTwoFingerScroll" "on"
        Option "VertScrollDelta" "-111"
        Option "HorizEdgeScroll" "off"
        Option "HorizTwoFingerScroll" "off"
EndSection
EOF

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


Add x function.

Add x function.

x() {
  local project="$(ls | grep '.*\.xcworkspace$')"
  [[ -z $project ]] && project="$(ls | grep '.*\.xcodeproj$')"
  [[ -n $project ]] && open $project
}

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


testing local WM regression.

testing local WM regression.

# script to run AFNI's ANATICOR (local WM regression) on simpace data

WD='/home/despo/simpace/rename_files/sub01/'

for session in sess01; do #$(ls -d sess*)

	cd ${WD}/${session}/preproc

	# where to put stuff
	if [ ! -d ${WD}/${session}/preproc/localWMreg ]; then
		mkdir ${WD}/${session}/preproc/localWMreg/
	fi

	#split motion regressors
	cd ${WD}/${session}/preproc/motion_params/
	1d_tool.py -infile ${WD}/${session}/preproc/motion_params/MP.txt -select_rows '0..195' \
	-write ${WD}/${session}/preproc/localWMreg/${session}_MP_run01.1D

	1d_tool.py -infile ${WD}/${session}/preproc/motion_params/MP.txt -select_rows '196..391' \
	-write ${WD}/${session}/preproc/localWMreg/${session}_MP_run02.1D

	1d_tool.py -infile ${WD}/${session}/preproc/motion_params/MP.txt -select_rows '392..587' \
	-write ${WD}/${session}/preproc/localWMreg/${session}_MP_run03.1D

	1d_tool.py -infile ${WD}/${session}/preproc/motion_params/MP.txt -select_rows '588..783' \
	-write ${WD}/${session}/preproc/localWMreg/${session}_MP_run04.1D

	for run in run01 run02 run03 run04; do

		cd ${WD}/${session}/preproc/localWMreg/${session}

		#merge smoothed preproc files into one 4D nifit
		fslmerge -t ${WD}/${session}/preproc/localWMreg/${session}_preproc_smooth_${run}.nii.gz $(ls ${WD}/${session}/preproc/smooth/*${run}*.nii)

		# fix TR info
		3drefit -TR 2 ${WD}/${session}/preproc/localWMreg/${session}_preproc_smooth_${run}.nii.gz

		#get csf regressors
		3dmaskave -mask ${WD}/${session}/preproc/csf_in_func_res/csf_func_res_final.nii.gz -quiet \
		${WD}/${session}/preproc/localWMreg/${session}_preproc_smooth_${run}.nii.gz > ${WD}/${session}/preproc/localWMreg/${session}_csf_${run}.1D

		#get local WM regressors
		3dLocalstat -prefix ${WD}/${session}/preproc/localWMreg/${session}_WMeLOCAL_${run}.nii.gz \
		-nbhd 'SPHERE(30)' \
		-stat mean \
		-mask ${WD}/${session}/preproc/wm_in_func_res/wm_func_res_final.nii.gz \
		-use_nonmask ${WD}/${session}/preproc/localWMreg/${session}_preproc_smooth_${run}.nii.gz

		##do regression
		#the model at this point is Y = [ Motion + localWMreg + Ventricles ] X + Residual
		# did not remove linear drift
		# bandpass filtering at 0.008 0.09
		3dTproject \
		-input ${WD}/${session}/preproc/localWMreg/${session}_preproc_smooth_${run}.nii.gz \
		-prefix ${WD}/${session}/preproc/localWMreg/${session}_preproc_smooth_localWMreg_${run}.nii.gz \
		-ort ${WD}/${session}/preproc/localWMreg/${session}_MP_${run}.1D \
		-ort ${WD}/${session}/preproc/localWMreg/${session}_csf_${run}.1D \
		-dsort ${WD}/${session}/preproc/localWMreg/${session}_WMeLOCAL_${run}.nii.gz \
		-automask \
		-passband 0.008 0.09

	done
done

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


add consul file

add consul 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/hashicorp/atlas-examples.git/'


scripts: Add commit message format checker

Change-Id: I94efe0326e3f68e19af605a1ff381da59d2d7d1d

#!/bin/bash
# Copyright (c) 2018 Valve Corporation
# Copyright (c) 2018 LunarG, Inc.

# 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.
#
# Checks commit messages against project standards in CONTRIBUTING.md document
# Script to determine if commit messages in Pull Request are properly formatted.
# Exits with non 0 exit code if reformatting is needed.

# Disable subshells
shopt -s lastpipe

RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# TRAVIS_COMMIT_RANGE contains range of commits for this PR

# Get user-supplied commit message text for applicable commits and insert
# a unique separator string identifier. The git command returns ONLY the
# subject line and body for each of the commits.
COMMIT_TEXT=$(git log ${TRAVIS_COMMIT_RANGE} --pretty=format:"XXXNEWLINEXXX"%n%B)

# Bail if there are none
if [ -z "${COMMIT_TEXT}" ]; then
  echo -e "${GREEN}No commit messgages to check for formatting.${NC}"
  exit 0
elif ! echo $TRAVIS_COMMIT_RANGE | grep -q "\.\.\."; then
  echo -e "${GREEN}No commit messgages to check for formatting.${NC}"
  exit 0
fi

# Process commit messages
success=1
current_line=0
prevline=""

# Process each line of the commit message output, resetting counter on separator
printf %s "$COMMIT_TEXT" | while IFS='' read -r line; do
  # echo "Count = $current_line <Line> = $line"
  current_line=$((current_line+1))
  if [ "$line" = "XXXNEWLINEXXX" ]; then
    current_line=0
  fi
  chars=${#line}
  if [ $current_line -eq 1 ]; then
    # Subject line should be 50 chars or less (but give some slack here)
    if [ $chars -gt 54 ]; then
      echo "The following subject line exceeds 50 characters in length."
      echo "     '$line'"
      success=0
    fi
    i=$(($chars-1))
    last_char=${line:$i:1}
    # Output error if last char of subject line is not alpha-numeric
    if [[ ! $last_char =~ [0-9a-zA-Z] ]]; then
      echo "For the following commit, the last character of the subject line must not be non-alphanumeric."
      echo "     '$line'"
      success=0
    fi
    # Checking if subject line doesn't start with 'module: '
    prefix=$(echo $line | cut -f1 -d " ")
    if [ "${prefix: -1}" != ":" ]; then
      echo "The following subject line must start with a single word specifying the functional area of the change, followed by a colon and space. I.e., 'layers: Subject line here'"
      echo "     '$line'"
      success=0
    fi
  elif [ $current_line -eq 2 ]; then
    # Commit message must have a blank line between subject and body
    if [ $chars -ne 0 ]; then
      echo "The following subject line must be followed by a blank line."
      echo "     '$prevline'"
      success=0
    fi
  else
    # Lines in a commit message body must be less than 72 characters in length (but give some slack)
    if [ $chars -gt 76 ]; then
      echo "The following commit message body line exceeds the 72 character limit."
      echo "'$line\'"
      success=0
    fi
  fi
  prevline=$line
done

if [ $success -eq 1 ]; then
  echo -e "${GREEN}All commit messages in pull request are properly formatted.${NC}"
  exit 0
else
  exit 1
fi

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


am 5608a8c6: Merge "Add 64-bit gdbclients."

* commit '5608a8c6e86381cdabc46c3a9b90564411771796':
  Add 64-bit gdbclients.

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/xorware/android_build.git/'


am 0f7e0694: am a1fd8e44: Merge "Augment ANDROID_DEV_SCRIPTS with prebuilts/devtools/tools"

* commit '0f7e0694a575fa4472f43e6a4e11c053ff99d69b':
  Augment ANDROID_DEV_SCRIPTS with prebuilts/devtools/tools


adds getFlameGraph script, basically a bookmark

#!/bin/bash

# downloads Brendan Gregg's FlameGraph library and places it in PATH

echo "requires superuser permissions"

cd /usr/local/bin

sudo git clone git@github.com:brendangregg/FlameGraph.git

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


basic bluetooth on arch and debian

basic bluetooth on arch and debian

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/h31nr1ch/Linux.git/'


L6 Release 1.1 (add build script)

L6 Release 1.1 (add build script)

#!/usr/bin/env bash
cd ../ATM
mvn clean install

cd ../L6

mvn clean package

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


Update migration_elastic.sh

Update migration_elastic.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/dengxiangyu768/dengxytools.git/'


feat: add manual release script

feat: add manual release script

#!/bin/bash
set -ex

export REPO=podshows/podcloud-feeds
export COMMIT=$(git rev-parse --short=8 HEAD)
export TAG=latest

docker build -f Dockerfile -t $REPO:$COMMIT .
docker tag $REPO:$COMMIT $REPO:$TAG
docker push $REPO

exec ./deploy.sh

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


initial version of Shellscript to get stats

#! /bin/sh
#
#  Usage: lstemp [ -w or -W]
#  -w / -W: Wake up a sleeping drive to take it's temperature
#
adastat () { echo -n `camcontrol cmd $1 -a "E5 00 00 00 00 00 00 00 00 00 00 00" -r - | awk '{print $10 " " ; }'` " " ; }

filename="../mnt/Log/stats.txt"

echo "==================================================" >> $filename
echo "==================================================" >> $filename
echo >> $filename

echo "System Status"  - `date` >> $filename
echo >> $filename

echo "Server:" >> $filename
sysctl -n kern.hostname >> $filename
../sbin/ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | grep -v '0.0.0.0' | awk '{ print $2}' >> $filename
cat ../../../etc/version >> $filename

uptime | awk '{ print "\nSystem Load:",$(NF-2),$(NF-1),$(NF) }' >> $filename
echo >> $filename

echo "CPU:" >> $filename
sysctl -n hw.model >> $filename

echo "Temperature:" >> $filename
#Hier muss bei anderer CPU erweitert werden...
echo -n "CPU1:" >> $filename; sysctl -n dev.cpu.0.temperature >> $filename
echo -n "CPU2:" >> $filename; sysctl -n dev.cpu.1.temperature >> $filename
echo >> $filename
echo "Process:" >> $filename
ps au >> $filename
echo >> $filename

echo "Virtual Memory:" >> $filename
sysctl -n vm.vmtotal >> $filename
echo >> $filename

if [ "$2" = "-F" ];
then

	echo "Drive Activity Status:" >> $filename
	for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }'); do
		echo -n $i: >> $filename; adastat $i >> $filename
	done
	echo >> $filename
	echo >> $filename
	smartopt=`echo $@ | awk '{opt="-n standby"; if(match(tolower($1),'/-w/')) opt=""; print opt; }'`

	echo "HDD:" >> $filename
	echo "Usage:" >> $filename
	df -H >> $filename
	echo >> $filename

	echo "Temperature:" >> $filename
	for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/ada/')) print $i }')
	do
   		echo $i `smartctl -a  $smartopt /dev/$i | awk 'BEGIN { DevName="N/A - Drive in standby mode" } /Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print "("DevSerNum, DevName"):", DevTemp".0C" }'` >> $filename
	done
	echo >> $filename
fi

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


support parameter completion for switch

support parameter completion for switch

#!/bin/bash
#

# switch parameter-completion
# This file supports parameter completion for the switch script.  It will
# attempt to find a "conf" folder in the current folder, and will list the
# names of the *.conf files in that folder.

_SwitchGetCon ()   #  By convention, the function name
{                  #+ starts with an underscore.
  local cur
  # Pointer to current completion word.
  # By convention, it's named "cur" but this isn't strictly necessary.

  COMPREPLY=()   # Array variable storing the possible completions.
  cur=${COMP_WORDS[COMP_CWORD]}

  # If the conf folder doesnt exist, return no results
  if [ ! -e 'conf' ]
    then
        return 0
  fi
  COMPREPLY=( $( compgen -W '$(cd conf; ls *.conf | sed -e "s/\.conf//g")' -- $cur ) )
#   Generate the completion matches and load them into $COMPREPLY array.
#   xx) May add more cases here.
#   yy)
#   zz)

  return 0
}

complete -F _SwitchGetCon -o filenames ./switch

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


don't launch tilix anymore

don't launch tilix anymore

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/gregflynn/dotsanity.git/'


detect packages that don't exist on AUR and gracefully handle it


Command line stuff

Command line stuff

rm -rf $BEAGLE_RESULTS/fitting_example/BEAGLE-input-files
BEAGLE --fit --parameter-file /home/beagle/Coding/BEAGLE-general/params/fit_photometry_example.param

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


moved and revamped finetuning script for 3,4 layer models

#!/bin/bash

# Batch qsub submission script for 3,5 layer models

outputLayer=$1

# Submit 3 layer jobs

three_arr=(`ls $SCRATCH/gpu_models/gb_hybrid_cm/3_layers/pretrain_pkl_files/$outputLayer`)
offset=0
len=${#three_arr[*]}

for((i=1; i<=$len; i+=2 ))
do
    let prev=$i-1
    first=${three_arr[$i]}
    second=${three_arr[$prev]}
    qsub submit_finetune_gravity_3layers.sh -v FIRSTMODEL="$first",SECONDMODEL="$second",OFFSET="$offset"
    ((offset+=5))
    sleep 5

    # Each pair of jobs needs 30 data chunks, and there are 211 in total.  Reset the offset parameter if necessary.
    if (( offset > 181 )); then
       offset=0
    fi
done

# Submit 4 layer jobs

five_arr=(`ls $SCRATCH/gpu_models/gb_hybrid_cm/4_layers/pretrain_pkl_files/$outputLayer`)
offset=0
len=${#five_arr[*]}

for((i=1; i<=$len; i+=2 ))
do
    let prev=$i-1
    first=${five_arr[$i]}
    second=${five_arr[$prev]}
    qsub submit_finetune_gravity_4layers.sh -v FIRSTMODEL="$first",SECONDMODEL="$second",OFFSET="$offset"
    ((offset+=5))
    sleep 5

    # Each pair of jobs needs 30 data chunks, and there are 211 in total.  Reset the offset parameter if necessary.
    if (( offset > 181 )); then
       offset=0
    fi
done

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


Create yum-install-common.sh

Create yum-install-common.sh

#!/bin/bash

# This script installs a number of common yum packages that I like to
# include on every CentOS Vagrant box; mostly for utility purposes.

echo ""
echo "[Provision-Script] Installing Common Utils & Libraries"
echo ""
yum install -y mlocate pico

error: pathspec 'vagrant/centos7/dev/v1/yum-install-common.sh' did not match any file(s) known to git


Added --no-rebuild argument to bwc-cluster-oar

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


Add build steps to test docker provision

- Add build_compass and build_assets to the provisioning of the testing
  docker containers.
- change tabs to spaces.

# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com

set -o nounset
set -o errexit

setup () {
  if [ -z "${1:-}" ]; then
    echo "Missing mandatory project parameter"
    exit 1
  else
    PROJECT="${1}"
  fi

  docker-compose --file docker-compose-testing.yml \
    --project-name ${PROJECT} \
    up --force-recreate -d

  if [[ $UID -eq 0 ]]; then
    # This fixes permissions with bindfs only on jenkins.
    chown 1000:1000 -R .
  elif [[ $UID -eq 1000 ]]; then
    docker exec -i ${PROJECT}_dev_1 sh -c "
    bindfs /vagrant_bind /vagrant --map=$UID/1000 -o nonempty
    "
  fi

  echo "Provisioning ${PROJECT}_dev_1"
  docker exec -i ${PROJECT}_dev_1 su vagrant -c "
    source /vagrant/bin/init_vagrant_env
    ansible-playbook -i provision/docker/inventory provision/site.yml
    build_compass
    build_assets
  "
}

teardown () {
  if [ -z "${1:-}" ]; then
    echo "Missing mandatory project parameter"
    exit 1
  else
    PROJECT="${1}"
  fi

  docker exec -i ${PROJECT}_dev_1 sh -c "chown $UID -R /vagrant"
  docker exec -i ${PROJECT}_selenium_1 sh -c "chown $UID -R /selenium"

  docker-compose -p ${PROJECT} stop
}

# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com

set -o nounset
set -o errexit

setup () {
  if [ -z "${1:-}" ]; then
    echo "Missing mandatory project parameter"
    exit 1
  else
    PROJECT="${1}"
  fi

	docker-compose --file docker-compose-testing.yml \
		--project-name ${PROJECT} \
		up --force-recreate -d

	if [[ $UID -eq 0 ]]; then
		# This fixes permissions with bindfs only on jenkins.
		chown 1000:1000 -R .
	elif [[ $UID -eq 1000 ]]; then
		docker exec -i ${PROJECT}_dev_1 sh -c "
		  bindfs /vagrant_bind /vagrant --map=$UID/1000 -o nonempty
		"
	fi

	echo "Provisioning ${PROJECT}_dev_1"
	docker exec -i ${PROJECT}_dev_1 su vagrant -c "
		ansible-playbook -i provision/docker/inventory provision/site.yml
	"
}

teardown () {
  if [ -z "${1:-}" ]; then
    echo "Missing mandatory project parameter"
    exit 1
  else
    PROJECT="${1}"
  fi

	docker exec -i ${PROJECT}_dev_1 sh -c "chown $UID -R /vagrant"
	docker exec -i ${PROJECT}_selenium_1 sh -c "chown $UID -R /selenium"

	docker-compose -p ${PROJECT} stop
}


kernel_rt_threads.sh

PIDs=$(ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i "irq" | awk '{ print $1; }' | xargs echo)
echo $PIDs
for i in $PIDs
do
    echo "Changing pid $i"
    ret=$(chrt -f -p 99 $i)
done

PIDs=$(ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i "cpuset" | awk '{ print $1; }' | xargs echo)
echo $PIDs
for i in $PIDs
do
    echo "Changing pid $i"
    ret=$(chrt -f -p 99 $i)
done

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


Rename ~/Projects to ~/workspace. Use `w` command to navigate.

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


Changed input for email

Changed input for email

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


copied formatsd.sh

copied formatsd.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/racing-tech/rrp-raspi-installer.git/'


Added cleanup script for documentation

Added cleanup script for documentation

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/duncanmortimer/ledger.git/'


wait for postgres to be ready inside docker container

#!/bin/bash

su postgres -c '/usr/pgsql-9.6/bin/pg_ctl -D /var/postgres -l /var/postgres/pg_log/logfile start'

# wait for postgres to start
until /usr/pgsql-9.6/bin/pg_isready -q ; do sleep 1 ; done

cd /PrairieLearn
node server.js

#!/bin/bash

su postgres -c '/usr/pgsql-9.6/bin/pg_ctl -D /var/postgres -l /var/postgres/pg_log/logfile start'

cd /PrairieLearn
node server.js


Newer version of vboxrun.sh

Newer version of vboxrun.sh

 #!/bin/bash

VB=VBoxManage
vmName=IncludeOS_test

homeDir=$(eval echo ~${SUDO_USER})

disk="$homeDir/IncludeOS/seed/My_IncludeOS_Service.img"
targetLoc="$homeDir/IncludeOS/seed/My_IncludeOS_Service.vdi"

echo "Creating virtual harddrive ..."
# CONVERT IMAGE TO VDI HERE
if [ $(ls $homeDir/IncludeOS/seed/ | grep .vdi) ];
then
	echo "VDI image aldready exists, moving on..."
else
	$VB convertfromraw $disk $targetLoc
	echo "Creating VDI image..."
fi

#echo $disk
#echo $targetLoc

echo 'Creating VM ...'
$VB createvm --name IncludeOS_test --ostype 'Other' --register
$VB storagectl $vmName --name 'IDE Controller' --add ide --bootable on
$VB storageattach $vmName --storagectl 'IDE Controller' --port 0 --device 0 --type 'hdd' --medium $targetLoc

# Some management
$VB modifyvm $vmName --ioapic on
$VB modifyvm $vmName --boot1 disk --boot2 dvd --boot3 none --boot4 none
$VB modifyvm $vmName --memory 1024 --vram 128

# Serial port
$VB modifyvm $vmName --uart1 0x3F8 4 --uartmode1 file /tmp/IncludeOS.console.pipe

# NETWORK
$VB hostonlyif create
$VB modifyvm $vmName --nic1 hostonly --nictype1 virtio --hostonlyadapter1 include0
$VB modifyvm $vmName --macaddress1 c001A0A0A0A0

# START VM
$VB startvm $vmName --type headless &
echo "\nVM $VmName started, processID is $!"

watch tail /tmp/IncludeOS.consle.pipe

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


modified: misc/shell_scripts/puppet_agent_deploy.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/youvegotmoxie/personal.git/'


New wrapper script that prints <watch> and <srcpkg> versions.

#!/bin/sh

: ${SRCPKGDIR:=$HOME/projects/vanilla/srcpkgs}

# just ignore this!
Add_dependency()
{
	:
}

usage()
{
	echo "Usage: $(basename $0) [-s srcpkgdir] <all|pkgname>"
	exit 1
}

check_pkg()
{
	local pkgname="$1"

	if [ -r $SRCPKGDIR/${pkgname}/${pkgname}.template ]; then
		# skip subpkgs
		continue
	fi
	. $SRCPKGDIR/$pkgname/template
	watchver=$(./watch "$pkgname" 2>/dev/null)
	[ $? -ne 0 ] && continue
	[ -z "$watchver" -o "$watchver" = "" -o "$watchver" = "rcs" ] && continue
	echo "$pkgname: upstream version $watchver, srcpkgs $version."
}

while getopts "s:" opt; do
	case $opt in
		s) SRCPKGDIR="$OPTARG" ;;
		--) shift; break;;
	esac
done
shift $(($OPTIND - 1))

pkgname="$1"
[ $# -ne 1 ] && usage

if [ "$pkgname" = "all" ]; then
	for f in $(xbps-src list|awk '{print $1}'); do
		pkgname=$(xbps-uhelper getpkgname "$f")
		check_pkg "$pkgname"
	done
else
	check_pkg "$pkgname"
fi

exit 0

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


added shell script to test against

added shell script to test against

#!/bin/bash

# script to test against
cat /proc/net/dev | grep "$1" | sed -r 's/\s+/ /g' | cut -d " " -f 3,11

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


Adding manylinux build script to be used with manylinux docker containers.

#!/bin/bash
# Need to build linux wheel using manylinux
#
# https://github.com/pypa/manylinux
# https://github.com/pypa/python-manylinux-demo
# https://www.python.org/dev/peps/pep-0513/
#
# You may need to make the build script executable
# chmod +x /dev/build_wheels.sh
#
# Standard manylinux docker containers provided by pypa. For more information see the links above.
# docker pull quay.io/pypa/manylinux1_x86_64
# docker pull quay.io/pypa/manylinux1_i686
#
# The next set of instructions will let you run the container interactively
# Provide a container name so it is easier to reference later
# sudo docker run --name manylinux_x86_x64 -it -d --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64
# docker ps
#
# Use the docker exec command to interact with our container
# docker exec -it manylinux_x86_x64 ls
# docker exec -it manylinux_x86_x64 ./io/dev/build_wheels.sh
#
# Stop the conatiner when done
# docker stop manylinux_x86_x64
#
# These docker commands will run, build the wheel, attempt to install and then finally upload
# docker run --name manylinux_x86_x64 --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 /io/dev/build_wheels.sh
# docker run --name manylinux_i686 --rm -v `pwd`:/io quay.io/pypa/manylinux1_i686 /io/dev/build_wheels.sh
#
# Pull in Windows artifacts from appveyor https://ci.appveyor.com/project/level12/pymssql if publishing
#
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
set -e -x

# Install freetds. Yum info shows this as version 0.91. Need to look into getting version 1.0 on centos for bundling
yum install -y freetds-devel

# Install Python dependencies and compile wheels
for PYBIN in /opt/python/*/bin; do
    "${PYBIN}/pip" install --upgrade pip setuptools
    "${PYBIN}/pip" install pytest SQLAlchemy Sphinx sphinx-rtd-theme Cython wheel
    "${PYBIN}/pip" wheel /io/ -w /io/dist/
done

# We could make a source distribution by running setup.py sdist, but the current setup.py pathing throws an error
# since the commands above use /io as the mount. Could use -w or WORKDIR to support building this in the container
# eventually.
# /opt/python/cp36-cp36m/bin/python setup.py sdist

# Verify the wheels and move from *-linux_* to -manylinux_*
for whl in /io/dist/*.whl; do
   auditwheel repair "$whl" -w /io/dist/
done

# Install the wheels that were built. Need to be able to connect to mssql and to run the pytest suite after install
for PYBIN in /opt/python/*/bin/; do
    "${PYBIN}/pip" install pymssql --no-index -f /io/dist
done

# Upload the wheels to test.pypi.org
# twine upload --repository-url https://test.pypi.org/legacy/ dist/*manylinux*

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


added spot rate

added spot rate

#!/bin/bash

# Coinbase.com Spot rate
# BitBar plugin
#
# by Mat Ryer
#
# Shows latest spot rate values (in USD) for Bitcoins in the
# Coinbase exchange.

echo -n "BTC: "; curl -s "https://coinbase.com/api/v1/prices/spot_rate?currency=USD" | egrep -o '"amount":"[0-9]+(\.)?([0-9]{0,2}")?' | sed 's/"amount"://'  | sed 's:^.\(.*\).$:\1:'

error: pathspec 'Plugins/BitCoins/coinbase.com/spotrate.10s.sh' did not match any file(s) known to git


do not re-export ListNotations from Program: overlays

if [ "$CI_PULL_REQUEST" = "11992" ] || [ "$CI_BRANCH" = "no-reexports" ] || [ "$CI_BRANCH" = "no-reexports.r" ]; then

    compcert_CI_REF=no-reexports
    compcert_CI_GITURL=https://github.com/llelf/CompCert

    color_CI_REF=no-reexports
    color_CI_GITURL=https://github.com/llelf/color

    math_classes_CI_REF=no-reexports
    math_classes_CI_GITURL=https://github.com/llelf/math-classes

    equations_CI_REF=no-reexports
    equations_CI_GITURL=https://github.com/llelf/Coq-Equations

    ext_lib_CI_REF=no-reexports
    ext_lib_CI_GITURL=https://github.com/llelf/coq-ext-lib

    fiat_parsers_CI_REF=no-reexports
    fiat_parsers_CI_GITURL=https://github.com/llelf/fiat

fi

error: pathspec 'dev/ci/user-overlays/11992-lelf-no-reexports.sh' did not match any file(s) known to git


Add a missing file

Add a missing 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/AmeBel/opencog.git/'


RDKB-35320: btime_wcpenter_split marker is not getting reported

Reason for change: Marker is missed since it is in other component also
Steps to Reproduce:
1. FR the cpe
2. Enable Telemetry and reboot the cpe
3. validate presence of log message "Enter_WiFi_Personalization_captive_mode:" after reboot and availability of marker in splunk
4. Again reboot the cpe and check for log message "Enter_WiFi_Personalization_captive_mode:" after reboot and availability of marker in splunk.

Test Procedure:
Risks: Low
Signed-off-by:Veeraputhiran_Thangavel@comcast.com

(cherry picked from commit fdd5b6378ed3acf9ac980b91fd8d77c3f5d6a92d)
Change-Id: Ie5e073ea573c6855e25bf3568e05a0e6a290716f

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/rdkcmf/rdkb-webui.git/'


version bump, major fixes

version bump, major fixes

#!/bin/bash
#AutoSlack
#to install a package from slackbuilds just type at your prompt
#>autoslack -i $PACKAGENAME
#$PACKAGENAME can be in any case whatsover, since this does do
#some rudimentary fuzzy matching. This also resolves dependencies
#the "Unix way". (Not really, it's just terrible coding, and potentially
#has the possibility of spawning infinite autoslacks. Autoslack fhtagn!

SCRIPTVERSION="1.01"
SLAURL="rsync://slackbuilds.org/slackbuilds/14.1/SLACKBUILDS.TXT"
URPREFIX="rsync://slackbuilds.org/slackbuilds/14.1"
BUILDPREFIX="/tmp"
SLACKBUILDS=/usr/share/autoslack/SLACKBUILDS.TXT
SLACKRCHIVE=/usr/share/autoslack/packages/
PARSESLACK=0

preprerun () {
    if [[ $PACKAGENAME =~ ^$ ]]; then
	echo "You did not select any packages to install, exiting"
	exit 0
    else
	echo "installing $PACKAGENAME"
	#as an attempt to fix this freaking case issue.
	PACKAGENAME=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS | sed 's/SLACKBUILD NAME: //g')
	if [[ $PACKAGENAME =~ ^$ ]]; then
	    echo "Something went wrong, package not found"
	    echo "Try to slackbuilds -s \$packagename"
	    exit 0
	else
	    echo "" > /dev/null
	fi

	echo $PACKAGENAME
	logfile=$(echo $PACKAGENAME-`date +%d_%m_%y`.log)
    fi
}

grabslackbuild () {
    URSUFFIX=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 4 | grep "SLACKBUILD LOCATION:" |sed 's/SLACKBUILD LOCATION: .//g')
    rsync -v $URPREFIX/$URSUFFIX $BUILDPREFIX -r
}

helptext () {
    echo ""
    echo " NAME:"
    echo "	autoslack"
    echo " SYNTAX:"
    echo "	$0 [OPTIONS] -i <PACKAGENAME> ..."
    echo " OPTIONS:"
    echo "	-h 			This helptext"
    echo "	-v			script version numer"
    echo "	-c			clean the package archive"
    echo "	-g			Just grab sources, don't build anything."
    echo "	-i <packagename>	install package. "
    echo "	-s <packagename>	find \$packagename"
    echo "	-u			update SLACKBUILDS.TXT"
    echo "	-f			forces a rebuild of package and dependencies"
    echo "	-m			builds but does not install package"
    echo "	-n			attempt to install without grabbing dependencies"
    echo "	-z			skip md5check for source file. DANGEROUS"
    echo "	-x			force to read package information from"
    echo "				SLACKBUILDS.TXT"
    echo " OTHER:		"
    echo "				the -i option needs to be the last one selected"
}

noopts () {
    echo "You didn't specify any options"
    echo "Please run autoslack -h for assistance"
}
cleanarchive () {
    read -p "Are you sure you want to clean all of your old builds? yes/no " YESNO
    while true; do
	if [[ "$YESNO" = [yY]* ]]; then
	    rm -v /usr/share/autoslack/packages/*
	    exit 0
	elif [[ "$YESNO" = [nN]* ]]; then
	    exit 0
	else
	    echo "I didn't catch that"
	    continue
	fi

    done
}

prerun () {
    if [ -d /usr/share/autoslack/ ]; then
	echo "" > /dev/null
    else
	mkdir /usr/share/autoslack
	mkdir /usr/share/autoslack/packages
    fi
    #let's make a logging directory
    if [ -d /var/log/autoslack ]; then
	echo "" > /dev/null
    else
	mkdir /var/log/autoslack
    fi
    update
    if ((`grep $PACKAGENAME $SLACKBUILDS -c` >= 1)); then
	echo "available"
    else
	echo "no package called $PACKAGENAME found, exiting"
	exit 0
    fi
}

update () {
    rsync -v $SLAURL /usr/share/autoslack
}

packagecheck () {
    if ((`ls /var/log/packages | grep $PACKAGENAME -c` >= 1)); then
	echo "-------------------------------------"
	echo "$PACKAGENAME or similar appears to be installed already."
	ls /var/log/packages | grep $PACKAGENAME
	echo "-------------------------------------"

	while true; do
	    read -p "do you want to rebuild / reinstall it? [yes/no] " YESNO
	    if [[ "$YESNO" = [yY]* ]]; then
		echo "Ok"
		break
	    elif [[ "$YESNO" = [nN]* ]]; then
		echo "not reinstalling"
		exit 0
	    else
		echo "I didn't catch that"
		continue
	    fi
	done
    else
	echo "" > /dev/null
    fi
}

parsefromfile () {
    source $BUILDPREFIX/$PACKAGENAME/$PACKAGENAME.info
#    echo $DOWNLOAD
#    echo $MD5SUM
#    echo $DOWNLOAD_x86_64
#    echo $MD5SUM_x86_64
#    echo $REQUIRES
#    DEPS=$REQUIRES
#    echo $DEPS
#    exit 0
}

depcheck () {
    if [[ $PARSESLACK = 0 ]]; then
	parsefromfile
	DEPS=$REQUIRES
    else
	DEPS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 8 | grep "REQUIRES" | sed 's/SLACKBUILD REQUIRES: //g' | sed 's/%README%//g' | sed 's/  / /g')
	fi
    if [[ "$DEPS" =~ ^$ ]]; then
	echo "NO DEPENDENCIES, CONTINUE"
    else
	echo "NEED DEPENDENCIES"
	#store deps in an array
	deparr=($DEPS)
	for i in "${deparr[@]}"
	do
	    #haha, we just re-launch the entire process @_@, self-recursion YAY.
	    #this is going to need to change because obviously the path of the script
	    if [[ "$SKIPBUILD" = 1 ]]; then
		autoslack -j -i $i
	    else
		autoslack -i $i
	    fi
	done
    fi
}

arraychecking () {

    for x in ${URLARR[@]}; do
	filename=$(echo $x | sed 's/.*\///g')
	largefix=$(echo $BUILDPREFIX/$PACKAGENAME/$filename)
	y=(${MDARR[var]})
	echo $y
	rm $BUILDPREFIX/$PACKAGENAME/$filename
	wget $x -P $BUILDPREFIX/$PACKAGENAME
	if [[ "$MDCHECK" != 1 ]]; then
	    #		#if [[ `md5sum $filename | sed "s/$filename//g"` = "28643857176697dc66786ee898089ca3" ]]; then
	    if [[ `md5sum $BUILDPREFIX/$PACKAGENAME/$filename | awk '{ print $1 }'` = `echo "$y" | sed 's/ //g'` ]]; then
		echo "yay"
		echo "------------got------------"
		md5sum $BUILDPREFIX/$PACKAGENAME/$filename
		echo "----------expected---------"
		echo "$y"
		echo "---------------------------"
	    else
		echo "------------got------------"
		md5sum $BUILDPREFIX/$PACKAGENAME/$filename
		echo "----------expected---------"
		echo "$y"
		echo "---------------------------"
		echo $MDARR
		echo "$package $filename does not pass md5 check. "
		echo "if you are sure about installing this,"
		echo "re-run autoslack with the -z option"
		exit 0
	    fi
	fi
	var=$((var+1))
    done
}

arraychecking2() {
    echo "ARRAYCHECK"
    #echo ${MDARR@}
    #echo ${urarr@}
  #  echo "ARRAYS"
   # echo $URLARR
   # echo $MDARR
   # echo $URLS
    var="0"
   # for x in ${URLARR[var]}
   # do
	#echo "$x"
	#echo "$var"
	#var=$((var+1))
	#echo $var
	#break
    #done
    for y in ${MDARR[var]}
    do
	echo $y
	echo ${URLARR[var]}
    done

    exit 0
}

curlgrab32 (){
    if [[ $PARSESLACK = 0 ]]; then
	parsefromfile
	URLS=$DOWNLOAD
	MDS=$MD5SUM
    else
	URLS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 4 | grep DOWNLOAD | sed  's/SLACKBUILD DOWNLOAD: //g')
	MDS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 6 | grep "SLACKBUILD MD5SUM" | sed 's/SLACKBUILD MD5SUM: //g')
    fi

    URLARR=(${URLS})
    MDARR=(${MDS})
    if [[ $URLARR = "UNSUPPORTED" ]];
    then
	while true; do
	    read -p "32bit not supported. Attempt to grab 64bit anyway? [yes/no] " YESNO
	    if [[ $YESNO = [yY]* ]]; then
		curlgrab64
		break
	    elif [[ $YESNO = [nN]* ]]; then
		 echo "not doing anything"
		 exit 0
	    else
		echo "I didn't catch that"
		continue
	    fi
	done
    else
	echo "" > /dev/null
    fi

}

curlgrab64 () {
    if [[ $PARSESLACK = 0 ]]; then
	parsefromfile
	URLS=$DOWNLOAD_x86_64
	MDS=$MD5SUM_x86_64
    else
	URLS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 5 | grep DOWNLOAD_x86_64 | sed  's/SLACKBUILD DOWNLOAD_x86_64: //g')
	MDS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 7 | grep "SLACKBUILD MD5SUM_x86_64:" | sed 's/SLACKBUILD MD5SUM_x86_64: //g')
    fi
    URLARR=(${URLS})
    MDARR=(${MDS})

    if [[ $URLARR = "UNSUPPORTED" ]];
    then
	while true; do
	    read -p "64bit not supported. Attempt to grab 32bit anyway? [yes/no] " YESNO
	    if [[ $YESNO = [yY]* ]]; then
		curlgrab32
		break
	    elif [[ $YESNO = [nN]* ]]; then
		echo "not doing anything"
		exit 0
	    else
		echo "I didn't catch that"
		continue
	    fi
	done

    else
	echo "" > /dev/null
    fi

}

archcheck () {
    if [[ `uname -a | grep x86_64 -c` = 1 ]]; then
	#are there seperate sources for amd64?
	if [[ `grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 5 | grep DOWNLOAD_x86_64 | sed  's/SLACKBUILD DOWNLOAD_x86_64: //g'` =~ ^$ ]];
	then
	    curlgrab32
	    arraychecking
	else
	    #if 64bit sources
	    curlgrab64
	    arraychecking
	fi
    else
	#we are not amd64, just grab the normal sources
	curlgrab32
    fi
}

findpackage () {
    grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 8 | sed 's/SLACKBUILD //g' | grep -v LOCATION | grep -v DOWNLOAD | grep -v MD5SUM
    exit 0
}
installer () {
    #build and install
    #dumb hack to get around some bullshit, because slackbuilds don't enjoy being called remotely. Yay.
    mypath=$(pwd)
    cd $BUILDPREFIX/$PACKAGENAME/
    sh *.SlackBuild >> /var/log/autoslack/$logfile
    cd $mypath
    #parse our log file for the installfile
    installpath=$(grep "Slackware package" /var/log/autoslack/$logfile | grep "created" | sed 's/created.//g' | sed 's/Slackware package //g')
    #install package
    if [[ $SKIPINSTALL = 1 ]]; then
	echo "Did not install"
	echo $installpath
	exit 0
    else
	installpkg $installpath
    fi
    #move the installer file to the slackarchive
    mv $installpath $SLACKRCHIVE
}

while getopts "fnjbhxzgmuvcys:i:r:" option
do
    case $option in
	h ) helptext
	    exit 0
	    ;;
	v ) echo $SCRIPTVERSION
	    exit 0
	    ;;
	c ) cleanarchive
	    exit 0
	    ;;
	i ) PACKAGENAME=${OPTARG}
	    ;;
	u ) update
	    exit 0
	    ;;
	s ) PACKAGENAME=${OPTARG}
	    findpackage
	    exit 0
	    ;;
	f ) SKIPCHECK="1"
	    ;;
	g ) SKIPBUILD="1"
	    ;;
	n ) SKIPDEP="1"
	    ;;
	m ) SKIPINSTALL="1"
	    ;;
	z ) MDCHECK="1"
	    ;;
	x ) PARSESLACK=1
	    ;;
       	* ) noopts
	    exit 0
	    ;;
    esac
done

#hah, this was most of the script

preprerun
prerun
update
grabslackbuild
parsefromfile
if [[ "$SKIPCHECK" = "1" ]]; then
    echo "" > /dev/null
else
    packagecheck
fi
if [[ "$SKIPDEP" = "1" ]]; then
    echo "" > /dev/null
else
    depcheck
fi
archcheck
if [[ "$SKIPBUILD" =~ "1" ]]; then
    echo "" > /dev/null
else
    echo "INSTALLING"
    installer
fi

#go back to whence ye came
exit 0

#!/bin/bash
#AutoSlack
#to install a package from slackbuilds just type at your prompt
#>autoslack -i $PACKAGENAME
#$PACKAGENAME can be in any case whatsover, since this does do
#some rudimentary fuzzy matching. This also resolves dependencies
#the "Unix way". (Not really, it's just terrible coding, and potentially
#has the possibility of spawning infinite autoslacks. Autoslack fhtagn!
set -x
SCRIPTVERSION="0.9999x"
SLAURL="rsync://slackbuilds.org/slackbuilds/14.1/SLACKBUILDS.TXT"
URPREFIX="rsync://slackbuilds.org/slackbuilds/14.1"
BUILDPREFIX="/tmp"
SLACKBUILDS=/usr/share/autoslack/SLACKBUILDS.TXT
SLACKRCHIVE=/usr/share/autoslack/packages/
PARSESLACK=0

preprerun () {
    if [[ $PACKAGENAME =~ ^$ ]]; then
	echo "You did not select any packages to install, exiting"
	exit 0
    else
	echo "installing $PACKAGENAME"
	#as an attempt to fix this freaking case issue.
	PACKAGENAME=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS | sed 's/SLACKBUILD NAME: //g')
	echo $PACKAGENAME
	logfile=$(echo $PACKAGENAME-`date +%d_%m_%y`.log)
    fi
}

grabslackbuild () {
    URSUFFIX=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 4 | grep "SLACKBUILD LOCATION:" |sed 's/SLACKBUILD LOCATION: .//g')
    rsync -v $URPREFIX/$URSUFFIX $BUILDPREFIX -r
}

helptext () {
    echo ""
    echo " NAME:"
    echo "	autoslack"
    echo " SYNTAX:"
    echo "	$0 [OPTIONS] -i <PACKAGENAME> ..."
    echo " OPTIONS:"
    echo "	-h 			This helptext"
    echo "	-v			script version numer"
    echo "	-c			clean the package archive"
    echo "	-g			Just grab sources, don't build anything."
    echo "	-i <packagename>	install package. "
    echo "	-s <packagename>	find \$packagename"
    echo "	-u			update SLACKBUILDS.TXT"
    echo "	-f			forces a rebuild of package and dependencies"
    echo "	-m			builds but does not install package"
    echo "	-n			attempt to install without grabbing dependencies"
    echo "	-z			skip md5check for source file. DANGEROUS"
    echo "	-x			force to read package information from"
    echo "				SLACKBUILDS.TXT"
    echo " OTHER:		"
    echo "				the -i option needs to be the last one selected"
}

noopts () {
    echo "You didn't specify any options"
    echo "Please run autoslack -h for assistance"
}
cleanarchive () {
    read -p "Are you sure you want to clean all of your old builds? yes/no " YESNO
    while true; do
	if [[ "$YESNO" = [yY]* ]]; then
	    rm -v /usr/share/autoslack/packages/*
	    exit 0
	elif [[ "$YESNO" = [nN]* ]]; then
	    exit 0
	else
	    echo "I didn't catch that"
	    continue
	fi

    done
}

prerun () {
    if [ -d /usr/share/autoslack/ ]; then
	echo "" > /dev/null
    else
	mkdir /usr/share/autoslack
	mkdir /usr/share/autoslack/packages
    fi
    #let's make a logging directory
    if [ -d /var/log/autoslack ]; then
	echo "" > /dev/null
    else
	mkdir /var/log/autoslack
    fi
    update
    if ((`grep $PACKAGENAME $SLACKBUILDS -c` >= 1)); then
	echo "available"
    else
	echo "no package called $PACKAGENAME found, exiting"
	exit 0
    fi
}

update () {
    rsync -v $SLAURL /usr/share/autoslack
}

packagecheck () {
    if ((`ls /var/log/packages | grep $PACKAGENAME -c` >= 1)); then
	echo "-------------------------------------"
	echo "$PACKAGENAME or similar appears to be installed already."
	ls /var/log/packages | grep $PACKAGENAME
	echo "-------------------------------------"

	while true; do
	    read -p "do you want to rebuild / reinstall it? [yes/no] " YESNO
	    if [[ "$YESNO" = [yY]* ]]; then
		echo "Ok"
		break
	    elif [[ "$YESNO" = [nN]* ]]; then
		echo "not reinstalling"
		exit 0
	    else
		echo "I didn't catch that"
		continue
	    fi
	done
    else
	echo "" > /dev/null
    fi
}

parsefromfile () {
    source $BUILDPREFIX/$PACKAGENAME/$PACKAGENAME.info
#    echo $DOWNLOAD
#    echo $MD5SUM
#    echo $DOWNLOAD_x86_64
#    echo $MD5SUM_x86_64
#    echo $REQUIRES
#    DEPS=$REQUIRES
#    echo $DEPS
#    exit 0
}

depcheck () {
    if [[ $PARSESLACK = 0 ]]; then
	parsefromfile
	DEPS=$REQUIRES
    else
	DEPS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 8 | grep "REQUIRES" | sed 's/SLACKBUILD REQUIRES: //g' | sed 's/%README%//g' | sed 's/  / /g')
	fi
    if [[ "$DEPS" =~ ^$ ]]; then
	echo "NO DEPENDENCIES, CONTINUE"
    else
	echo "NEED DEPENDENCIES"
	#store deps in an array
	deparr=($DEPS)
	for i in "${deparr[@]}"
	do
	    #haha, we just re-launch the entire process @_@, self-recursion YAY.
	    #this is going to need to change because obviously the path of the script
	    if [[ "$SKIPBUILD" = 1 ]]; then
		autoslack -j -i $i
	    else
		autoslack -i $i
	    fi
	done
    fi
}

arraychecking() {
    for x in "${URLARR[var]}"
    do
	filename=$(echo $x | sed 's/.*\///g')
	largefix=$(echo $BUILDPREFIX/$PACKAGENAME/$filename)
	rm $BUILDPREFIX/$PACKAGENAME/$filename
	wget $x -P $BUILDPREFIX/$PACKAGENAME
	if [[ "$MDCHECK" != 1 ]]; then
	    for y in "${MDARR[var]}"; do
		#if [[ `md5sum $filename | sed "s/$filename//g"` = "28643857176697dc66786ee898089ca3" ]]; then
		if [[ `md5sum $BUILDPREFIX/$PACKAGENAME/$filename | awk '{ print $1 }'` = `echo "$y" | sed 's/ //g'` ]]; then
		    echo "yay"
		    echo "------------got------------"
		    md5sum $BUILDPREFIX/$PACKAGENAME/$filename
		    echo "----------expected---------"
		    echo "$y"
		    echo "---------------------------"
		    #increment array level to grab the next url and MD5sum
		    var=$((var+1))
		    break
		else
		    echo "------------got------------"
		    md5sum $BUILDPREFIX/$PACKAGENAME/$filename
		    echo "----------expected---------"
		    echo "$y"
		    echo "---------------------------"
		    echo $MDARR
		    echo "$package $filename does not pass md5 check. "
		    echo "if you are sure about installing this,"
		    echo "re-run autoslack with the -z option"
		    exit 0
		fi
	    done
	else
	    echo "skipping md5check"
	fi
    done
}

arraychecking2 () {
    echo "ARRAYCHECK"
    #echo ${MDARR@}
    #echo ${urarr@}
    echo "ARRAYS"
    echo $URLARR
    echo $MDARR
    for x in "${URLARR[var]}"
    do
	echo "$x"
    done
    exit 0
}

curlgrab32 (){
    if [[ $PARSESLACK = 0 ]]; then
	parsefromfile
	URLS=$DOWNLOAD
	MDS=$MD5SUM
    else
	URLS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 4 | grep DOWNLOAD | sed  's/SLACKBUILD DOWNLOAD: //g')
	MDS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 6 | grep "SLACKBUILD MD5SUM" | sed 's/SLACKBUILD MD5SUM: //g')
    fi

    URLARR=($URLS)
    MDARR=($MDS)
    if [[ $URLARR = "UNSUPPORTED" ]];
    then
	while true; do
	    read -p "32bit not supported. Attempt to grab 64bit anyway? [yes/no] " YESNO
	    if [[ $YESNO = [yY]* ]]; then
		curlgrab64
		break
	    elif [[ $YESNO = [nN]* ]]; then
		 echo "not doing anything"
		 exit 0
	    else
		echo "I didn't catch that"
		continue
	    fi
	done
    else
	break
    fi

}

curlgrab64 () {
    if [[ $PARSESLACK = 0 ]]; then
	parsefromfile
	URLS=$DOWNLOAD_x86_64
	MDS=$MD5SUM_x86_64
    else
	URLS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 5 | grep DOWNLOAD_x86_64 | sed  's/SLACKBUILD DOWNLOAD_x86_64: //g')
	MDS=$(grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 7 | grep "SLACKBUILD MD5SUM_x86_64:" | sed 's/SLACKBUILD MD5SUM_x86_64: //g')
    fi
    URLARR=($URLS)
    MDARR=($MDS)

    if [[ $URLARR = "UNSUPPORTED" ]];
    then
	while true; do
	    read -p "64bit not supported. Attempt to grab 32bit anyway? [yes/no] " YESNO
	    if [[ $YESNO = [yY]* ]]; then
		curlgrab32
		break
	    elif [[ $YESNO = [nN]* ]]; then
		echo "not doing anything"
		exit 0
	    else
		echo "I didn't catch that"
		continue
	    fi
	done

    else
	break
    fi

}

archcheck () {
    if [[ `uname -a | grep x86_64 -c` = 1 ]]; then
	#are there seperate sources for amd64?
	if [[ `grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 5 | grep DOWNLOAD_x86_64 | sed  's/SLACKBUILD DOWNLOAD_x86_64: //g'` =~ ^$ ]];
	then
	    curlgrab32
	    arraychecking
	else
	    #if 64bit sources
	    curlgrab64
	    arraychecking
	fi
    else
	#we are not amd64, just grab the normal sources
	curlgrab32
    fi
}

findpackage () {
    grep -iFx "SLACKBUILD NAME: $PACKAGENAME" $SLACKBUILDS -A 8 | sed 's/SLACKBUILD //g' | grep -v LOCATION | grep -v DOWNLOAD | grep -v MD5SUM
    exit 0
}
installer () {
    #build and install
    #dumb hack to get around some bullshit, because slackbuilds don't enjoy being called remotely. Yay.
    mypath=$(pwd)
    cd $BUILDPREFIX/$PACKAGENAME/
    sh *.SlackBuild >> /var/log/autoslack/$logfile
    cd $mypath
    #parse our log file for the installfile
    installpath=$(grep "Slackware package" /var/log/autoslack/$logfile | grep "created" | sed 's/created.//g' | sed 's/Slackware package //g')
    #install package
    if [[ $SKIPINSTALL = 1 ]]; then
	echo "Did not install"
	echo $installpath
	exit 0
    else
	installpkg $installpath
    fi
    #move the installer file to the slackarchive
    mv $installpath $SLACKRCHIVE
}

while getopts "fnjbhxzgmuvcys:i:r:" option
do
    case $option in
	h ) helptext
	    exit 0
	    ;;
	v ) echo $SCRIPTVERSION
	    exit 0
	    ;;
	c ) cleanarchive
	    exit 0
	    ;;
	i ) PACKAGENAME=${OPTARG}
	    ;;
	u ) update
	    exit 0
	    ;;
	s ) PACKAGENAME=${OPTARG}
	    findpackage
	    exit 0
	    ;;
	f ) SKIPCHECK="1"
	    ;;
	g ) SKIPBUILD="1"
	    ;;
	n ) SKIPDEP="1"
	    ;;
	m ) SKIPINSTALL="1"
	    ;;
	z ) MDCHECK="1"
	    ;;
	x ) PARSESLACK=1
	    ;;
       	* ) noopts
	    exit 0
	    ;;
    esac
done

#hah, this was most of the script

preprerun
prerun
update
grabslackbuild
parsefromfile
if [[ "$SKIPCHECK" = "1" ]]; then
    echo "" > /dev/null
else
    packagecheck
fi
if [[ "$SKIPDEP" = "1" ]]; then
    echo "" > /dev/null
else
    depcheck
fi
archcheck
if [[ "$SKIPBUILD" =~ "1" ]]; then
    echo "" > /dev/null
else
    echo "INSTALLING"
    installer
fi

#go back to whence ye came
exit 0


Default to building with -O0

Default to building with -O0

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

# This command bootstraps the autoconf-based configuratino
# for the P4c compiler

set -e  # exit on error
./find-makefiles.sh # creates otherMakefiles.am, included in Makefile.am
mkdir -p extensions # place where additional back-ends are expected
echo "Running autoconf/configure tools"
autoreconf -i
mkdir -p build # recommended folder for build
sourcedir=`pwd`
cd build
# TODO: the "prefix" is needed for finding the p4include folder.
# It should be an absolute path.  This may need to change
# when we have a proper installation procedure.
../configure CXXFLAGS="-g -O0" --prefix=$sourcedir $*
echo "### Configured for building in 'build' folder"

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

# This command bootstraps the autoconf-based configuratino
# for the P4c compiler

set -e  # exit on error
./find-makefiles.sh # creates otherMakefiles.am, included in Makefile.am
mkdir -p extensions # place where additional back-ends are expected
echo "Running autoconf/configure tools"
autoreconf -i
mkdir -p build # recommended folder for build
sourcedir=`pwd`
cd build
# TODO: the "prefix" is needed for finding the p4include folder.
# It should be an absolute path.  This may need to change
# when we have a proper installation procedure.
../configure CXXFLAGS="-g -O1" --prefix=$sourcedir $*
echo "### Configured for building in 'build' folder"


RE-RUN Server

RE-RUN Server

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/airanmehr/bio.git/'


Script to report memory stats.

Script to report memory stats.

#!/bin/bash
echo '{'
grep -e 'MemTotal' -e 'MemFree' -e 'Buffers' -e 'Cached' -e 'SwapCached' /proc/meminfo| tr -s ' '| cut -d ' ' -f '1 2'| sed -e '1s/^/"/' -e '2,$s/^/, "/' -e 's/:/":/'
echo '}'

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


Add shell script for switching profiles.

wprofile shell script will create symlinks for different profiles, allowing you
to easily change your default config.

#!/bin/sh

VERSION="0.1"

# Print usage statement and exit
usage()
{
    echo "usage: $0 [-h] [-v] [-f] <profile> [target]"
    exit
}

# Print version information and exit
version()
{
    echo "wprofile $VERSION, Copyright (c) 2014 Brian Kubisiak " \
        "<velentr.rc@gmail.com>"
    exit
}

# do not remove default.json
force=0

while getopts ":hvf" opt; do
    case $opt in
        h)
            usage
            ;;
        v)
            version
            ;;
        f)
            # remove default.json if it exists
            force=1
            ;;
        \?)
            echo "Unknown option: -$OPTARG"
            ;;
    esac
done

# profile and target must be last two arguments
profile=${@:$OPTIND:1}
target=${@:$OPTIND+1:1}

# default target is default.json
if [ ! $target ]; then
    target="default"
fi

cd ~/.config/winfo

if [ -e "./${profile}.json" ]; then
    if [ ! -e "./${target}.json" ] || [ -h "./${target}.json" ] || [ $force -eq 1 ]; then
        rm -f "./${target}.json"
        ln -s "./${profile}.json" "./${target}.json"
    else
        echo "${target}.json exists! Rerun with '-f' to overwrite."
    fi
else
    echo "${profile}.json does not exist!"
fi

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


c++ coverage experiments: make.sh, added -O0 option

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/fpiantini/rod_projects.git/'


Add install script for vscode extensions

#!/bin/bash

# Generate package list using code --list-extensions
pkglist=(
alefragnani.project-manager
JakeBecker.elixir-ls
josecfreittas.livebook
phoenixframework.phoenix
shd101wyy.markdown-preview-enhanced
zhuangtongfa.material-theme
)

for i in ${pkglist[@]}; do
  code --install-extension $i
done

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


XIP PowerDNS backend

XIP PowerDNS backend

#!/usr/bin/env bash
#
# Copyright (c) 2014 Sam Stephenson, Basecamp
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
set -e
shopt -s nocasematch

#
# Configuration
#
XIP_DOMAIN="xip.test"
XIP_ROOT_ADDRESSES=( "127.0.0.1" )
XIP_NS_ADDRESSES=( "127.0.0.1" )
XIP_MX_RECORDS=( )
XIP_TIMESTAMP="0"
XIP_TTL=300

if [ -a "$1" ]; then
  source "$1"
fi

#
# Protocol helpers
#
read_cmd() {
  local IFS=$'\t'
  local i=0
  local arg

  read -ra CMD
  for arg; do
    eval "$arg=\"\${CMD[$i]}\""
    let i=i+1
  done
}

send_cmd() {
  local IFS=$'\t'
  printf "%s\n" "$*"
}

fail() {
  send_cmd "FAIL"
  log "Exiting"
  exit 1
}

read_helo() {
  read_cmd HELO VERSION
  [ "$HELO" = "HELO" ] && [ "$VERSION" = "1" ]
}

read_query() {
  read_cmd TYPE QNAME QCLASS QTYPE ID IP
}

send_answer() {
  local type="$1"
  shift
  send_cmd "DATA" "$QNAME" "$QCLASS" "$type" "$XIP_TTL" "$ID" "$@"
}

log() {
  printf "[xip-pdns:$$] %s\n" "$@" >&2
}

#
# xip.io domain helpers
#
XIP_DOMAIN_PATTERN="(^|\.)${XIP_DOMAIN//./\.}\$"
NS_SUBDOMAIN_PATTERN="^ns-([0-9]+)\$"
IP_SUBDOMAIN_PATTERN="(^|\.)(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\$"
DASHED_IP_SUBDOMAIN_PATTERN="(^|-|\.)(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)-){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\$"
BASE36_SUBDOMAIN_PATTERN="(^|\.)([a-z0-9]{1,7})\$"

qtype_is() {
  [ "$QTYPE" = "$1" ] || [ "$QTYPE" = "ANY" ]
}

qname_matches_domain() {
  [[ "$QNAME" =~ $XIP_DOMAIN_PATTERN ]]
}

qname_is_root_domain() {
  [ "$QNAME" = "$XIP_DOMAIN" ]
}

extract_subdomain_from_qname() {
  SUBDOMAIN="${QNAME:0:${#QNAME}-${#XIP_DOMAIN}}"
  SUBDOMAIN="${SUBDOMAIN%.}"
}

subdomain_is_ns() {
  [[ "$SUBDOMAIN" =~ $NS_SUBDOMAIN_PATTERN ]]
}

subdomain_is_ip() {
  [[ "$SUBDOMAIN" =~ $IP_SUBDOMAIN_PATTERN ]]
}

subdomain_is_dashed_ip() {
  [[ "$SUBDOMAIN" =~ $DASHED_IP_SUBDOMAIN_PATTERN ]]
}

subdomain_is_base36() {
  [[ "$SUBDOMAIN" =~ $BASE36_SUBDOMAIN_PATTERN ]]
}

resolve_ns_subdomain() {
  local index="${SUBDOMAIN:3}"
  echo "${XIP_NS_ADDRESSES[$index-1]}"
}

resolve_ip_subdomain() {
  [[ "$SUBDOMAIN" =~ $IP_SUBDOMAIN_PATTERN ]] || true
  echo "${BASH_REMATCH[2]}"
}

resolve_dashed_ip_subdomain() {
  [[ "$SUBDOMAIN" =~ $DASHED_IP_SUBDOMAIN_PATTERN ]] || true
  echo "${BASH_REMATCH[2]//-/.}"
}

resolve_base36_subdomain() {
  [[ "$SUBDOMAIN" =~ $BASE36_SUBDOMAIN_PATTERN ]] || true
  local ip=$(( 36#${BASH_REMATCH[2]} ))
  printf "%d.%d.%d.%d" $(( ip&0xFF )) $(( (ip>>8)&0xFF )) $(( (ip>>16)&0xFF )) $(( (ip>>24)&0xFF ))
}

answer_soa_query() {
  send_answer "SOA" "admin.$XIP_DOMAIN ns-1.$XIP_DOMAIN $XIP_TIMESTAMP $XIP_TTL $XIP_TTL $XIP_TTL $XIP_TTL"
}

answer_ns_query() {
  local i=1
  local ns_address
  for ns_address in "${XIP_NS_ADDRESSES[@]}"; do
    send_answer "NS" "ns-$i.$XIP_DOMAIN"
    let i+=1
  done
}

answer_root_a_query() {
  local address
  for address in "${XIP_ROOT_ADDRESSES[@]}"; do
    send_answer "A" "$address"
  done
}

answer_mx_query() {
  set -- "${XIP_MX_RECORDS[@]}"
  while [ $# -gt 1 ]; do
    send_answer "MX" "$1	$2"
  shift 2
  done
}

answer_subdomain_a_query_for() {
  local type="$1"
  local address="$(resolve_${type}_subdomain)"
  if [ -n "$address" ]; then
    send_answer "A" "$address"
  fi
}

#
# PowerDNS pipe backend implementation
#
trap fail err
read_helo
send_cmd "OK" "xip.io PowerDNS pipe backend (protocol version 1)"

while read_query; do
  log "Query: type=$TYPE qname=$QNAME qclass=$QCLASS qtype=$QTYPE id=$ID ip=$IP"

  if qname_matches_domain; then
    if qname_is_root_domain; then
      if qtype_is "SOA"; then
        answer_soa_query
      fi

      if qtype_is "NS"; then
        answer_ns_query
      fi

      if qtype_is "A"; then
        answer_root_a_query
      fi

      if qtype_is "MX"; then
        answer_mx_query
      fi

    elif qtype_is "A"; then
      extract_subdomain_from_qname

      if subdomain_is_ns; then
        answer_subdomain_a_query_for ns

      elif subdomain_is_dashed_ip; then
        answer_subdomain_a_query_for dashed_ip

      elif subdomain_is_ip; then
        answer_subdomain_a_query_for ip

      elif subdomain_is_base36; then
        answer_subdomain_a_query_for base36
      fi
    fi
  fi

  send_cmd "END"
done

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


zplugin: Better code formatting in 2 places

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/psprint/zplugin.git/'


Add support for plugins given by local absolute path


Reddit: user wants to load OMZ::plugins/osx without a warning message

https://www.reddit.com/r/zplugin/comments/ahpddw/how_to_load_an_ohmyzsh_plugin_from_a_folder/

The problem: no ZSH being set up, because the directory layout is
missing Oh-My-Zsh directory layout. This has been fixed in this commit,
by creating a symlink, that allows to assign ZSH="${ZPLG[SIPPETS_DIR]}".


added gcmp function

added gcmp function

fatal: remote error: upload-pack: not our ref 79d629fd9aedc0317fa88d949e40511fc6d2a6ad
fatal: the remote end hung up unexpectedly


Added a script for installing prerequisites

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/marians20/Aquarium.git/'


Some plugins have ".zsh" in directory name


Option diff and env diff are now immune to IFS value


graphical.sh

graphical.sh

#!/usr/bin/env bash
#
# enable GUI
#
set -ex

sudo dnf -y groupinstall "Server with GUI"
sudo systemctl set-default graphical

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


How to use each line of the txt

How to use each line of the txt

# From the man xargs:
# -I replstr
#             Execute utility for each input line, replacing one or more occurrences of replstr in up to replacements (or 5 if no -R flag is specified) arguments to utility with the entire line of input.  The
#             resulting arguments, after replacement is done, will not be allowed to grow beyond 255 bytes; this is implemented by concatenating as much of the argument containing replstr as possible, to the
#             constructed arguments to utility, up to 255 bytes.  The 255 byte limit does not apply to arguments to utility which do not contain replstr, and furthermore, no replacement will be done on
#             utility itself.  Implies -x.

cat fileName | xargs -I{} cp {} directory/

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


Added tool to update tsums_16 roles

Added tool to update tsums_16 roles

#!/bin/bash
set -ex
from_dir=scripts/com.r2studio.Tsum/tsums_16
to_dir=/sdcard/Robotmon/scripts/com.twpda.Tsum/tsums_16
adb shell "rm -rf $to_dir"
adb shell "mkdir -p $to_dir"
cd "$from_dir"
adb push *.png "$to_dir"
echo Done
# vim:et sw=2 ts=2 ai nocp sta

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


MAINT: add script for updating gh-pages

MAINT: add script for updating gh-pages

#!/bin/bash
set -e -u
cd "`dirname "$0"`"/..
rm -rf build
python setup.py build_sphinx
rm -rf build/gh-pages
mkdir -p build/gh-pages
git -C build/gh-pages init
git -C build/gh-pages checkout -b gh-pages
rsync -a build/sphinx/html/ build/gh-pages/
touch build/gh-pages/.nojekyll
git -C build/gh-pages add .
git -C build/gh-pages commit -m "Generated from sources" -a
git branch -D gh-pages || true
git fetch build/gh-pages
git branch gh-pages FETCH_HEAD
rm -rf build/gh-pages
echo "The gh-pages branch is now updated, you can now push it to github: git push -f origin gh-pages"

error: pathspec 'docs/do-gh-pages.sh' did not match any file(s) known to git


Adding .dotfiles/bin back onto the path

Adding .dotfiles/bin back onto the path

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


- Added sln2nant.sh script

- Added sln2nant.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/kiootic/MOSA-Project.git/'