<gh_stars>1-10
###############################################################################
## (c) Copyright 2008 2009 Xilinx, Inc. All rights reserved.
##
## This file contains confidential and proprietary information
## of Xilinx, Inc. and is protected under U.S. and
## international copyright and other intellectual property
## laws.
##
## DISCLAIMER
## This disclaimer is not a license and does not grant any
## rights to the materials distributed herewith. Except as
## otherwise provided in a valid license issued to you by
## Xilinx, and to the maximum extent permitted by applicable
## law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
## WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
## AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
## BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
## INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
## (2) Xilinx shall not be liable (whether in contract or tort,
## including negligence, or under any other theory of
## liability) for any loss or damage of any kind or nature
## related to, arising under or in connection with these
## materials, including for any direct, or any indirect,
## special, incidental, or consequential loss or damage
## (including loss of data, profits, goodwill, or any type of
## loss or damage suffered as a result of any action brought
## by a third party) even if such damage or loss was
## reasonably foreseeable or Xilinx had been advised of the
## possibility of the same.
##
## CRITICAL APPLICATIONS
## Xilinx products are not designed or intended to be fail-
## safe, or for use in any application requiring fail-safe
## performance, such as life-support or safety devices or
## systems, Class III medical devices, nuclear facilities,
## applications related to the deployment of airbags, or any
## other applications that could lead to death, personal
## injury, or severe property or environmental damage
## (individually and collectively, "Critical
## Applications"). Customer assumes the sole risk and
## liability of any use of Xilinx products in Critical
## Applications, subject only to applicable laws and
## regulations governing limitations on product liability.
##
## THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
## PART OF THIS FILE AT ALL TIMES.
##
###############################################################################
##   ____  ____
##  /   /\/   /
## /___/  \  /    Vendor             : Xilinx
## \   \   \/     Version            : 4.1
##  \   \         Application        : MIG
##  /   /         Filename           : ies_run.sh
## /___/   /\     Date Last Modified : $Date: 2011/06/02 08:31:17 $
## \   \  /  \    Date Created       : Tue Oct 29 2013
##  \___\/\___\
##
## Device           : 7 Series
## Purpose          :
##                   Sample ies_run.sh file to compile and simulate memory interface
##                   design and run the simulation for specified period of time.
##                   Display the waveforms that are listed with "add wave" command.
## Assumptions      :
##                   Simulation takes place in \sim folder of MIG output directory.
## Reference        :
## Revision History :
###############################################################################

#echo Simulation Tool: IES

#Compile the required libraries here#
#libraries path#

#Compile all modules#
ncvlog -work worklib -sv -messages mig_7series*.v > ies_sim.log
ncvlog -sv -work worklib -messages ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/design_1_mig_7series_0_0.v >> ies_sim.log
ncvlog -sv -work worklib -messages ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/design_1_mig_7series_0_0_mig_sim.v >> ies_sim.log
ncvlog -work worklib -messages -sv ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/clocking/*.v >> ies_sim.log
ncvlog -work worklib -messages -sv ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/controller/*.v >> ies_sim.log
ncvlog -work worklib -messages -sv ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/ecc/*.v >> ies_sim.log
ncvlog -work worklib -messages -sv ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/ip_top/*.v >> ies_sim.log
ncvlog -work worklib -messages -sv ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/phy/*.v >> ies_sim.log
ncvlog -work worklib -messages -sv ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/ui/*.v >> ies_sim.log
ncvlog -sv -work worklib -messages ../design_1_mig_7series_0_0_ex.srcs/sources_1/ip/design_1_mig_7series_0_0/design_1_mig_7series_0_0/user_design/rtl/axi/*.v >> ies_sim.log

ncvlog -sv -work worklib -messages example_top.v >> ies_sim.log

#Compile files in sim folder (excluding model parameter file)#
#$XILINX variable must be set
ncvlog -work worklib -messages $XILINX_VIVADO/data/verilog/src/glbl.v >> ies_sim.log
ncvlog -work worklib -messages wiredly.v >> ies_sim.log
ncvlog -work worklib -messages sim_tb_top.v >> ies_sim.log

#Pass the parameters for memory model parameter file#
ncvlog -work worklib -messages -sv +define+x4Gb +define+sg125 +define+x16 ddr3_model.sv >> ies_sim.log

#Simulate the design with sim_tb_top as the top module
ncelab -namemap_mixgen -timescale '1ps/1ps' -vhdlsync -v93 -messages -nettype_port_relax -access +rwc sim_tb_top glbl >> ies_sim.log
ncsim sim_tb_top >> ies_sim.log
#echo done


#!/usr/bin/env bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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 -ex
# create ./model directory if not existed
if [ ! -d model ]; then
    mkdir -p model
fi
# create ./data directory if not existed
if [ ! -d data ]; then
    mkdir -p data
fi
# Downloading the data and model if not existed
model_file=./model/Inception-BN-symbol.json
params_file=./model/Inception-BN-0126.params
if [ ! -f ${model_file} ] || [ ! -f ${params_file} ]; then
    wget -nc http://data.mxnet.io/models/imagenet/inception-bn.tar.gz
    tar -xvzf inception-bn.tar.gz -C model
fi
cd model
wget -nc https://raw.githubusercontent.com/dmlc/gluon-cv/master/gluoncv/model_zoo/quantized/resnet50_v1_int8-symbol.json
cd ../data
wget -nc http://data.mxnet.io/data/val_256_q90.rec
cd ..

# Running inference on imagenet.
if [ "$(uname)" == "Darwin" ]; then
    echo ">>> INFO: FP32 real data"
    DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:../../../build ./imagenet_inference --symbol_file "./model/Inception-BN-symbol.json" --params_file "./model/Inception-BN-0126.params" --dataset "./data/val_256_q90.rec" --rgb_mean "123.68 116.779 103.939" --batch_size 1 --num_skipped_batches 50 --num_inference_batches 500

    echo ">>> INFO: FP32 dummy data"
    DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:../../../build ./imagenet_inference --symbol_file "./model/Inception-BN-symbol.json" --batch_size 1 --num_inference_batches 500 --benchmark
else
    echo ">>> INFO: FP32 real data"
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:../../../build ./imagenet_inference --symbol_file "./model/Inception-BN-symbol.json" --params_file "./model/Inception-BN-0126.params" --dataset "./data/val_256_q90.rec" --rgb_mean "123.68 116.779 103.939" --batch_size 1 --num_skipped_batches 50 --num_inference_batches 500

    echo ">>> INFO: FP32 dummy data"
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:../../../build ./imagenet_inference --symbol_file "./model/Inception-BN-symbol.json" --batch_size 1 --num_inference_batches 500 --benchmark

    lib_name=$(ls -a ../../../build | grep -oE 'onednn' | tail -1)
    if [[ -n ${lib_name} ]] && [[ 'onednn' =~ ${lib_name} ]]; then
        echo ">>> INFO: INT8 dummy data"
        LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:../../../build ./imagenet_inference --symbol_file "./model/resnet50_v1_int8-symbol.json" --batch_size 1 --num_inference_batches 500 --benchmark
    else
        echo "Skipped INT8 test because onednn was not found which is required for running inference with quantized models."
    fi
fi


<filename>xdg/etc/profile.d/xdg-zsh.sh
# zsh XDG Specification

export ZDOTDIR="${XDG_CONFIG_HOME}"/zsh


#!/bin/bash

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

ALIAS=${1:-transfodev}
PIPELINE_NAME=${2:-dotnet-nodejs}

fly -t "${ALIAS}" sp -p "${PIPELINE_NAME}" -c $DIR/pipeline.yml --non-interactive


<gh_stars>0
#!/bin/sh

echo "Got base path at '$1'"
echo "Got curent version of '$2'"
echo "Got previsous version of '$3'"

/usr/lib/contractor/util/blueprintLoader ${1}usr/lib/contractor/resources/mcp.toml


#!/bin/bash

function enable_venv {
	# Check if there is a virtual env already enabled
	if [ -n "$VIRTUAL_ENV" ]; then
		echo "Warning: Current environment is configured with VIRTUAL_ENV=$VIRTUAL_ENV, this will be used."
		return
	fi

	if [ ! -d ./venv ]; then
		install_venv
	fi

	source venv/bin/activate
}

function install_venv {
	python3 -m venv venv
	venv/bin/pip install -r requirements.txt
}


#!/bin/bash
set -ev

go install ./cmd/registry
go install ./cmd/crane

registry &
PID=$!

crane pull debian:latest debianc.tar
crane push debianc.tar localhost:1338/debianc:latest
docker pull localhost:1338/debianc:latest
docker tag localhost:1338/debianc:latest localhost:1338/debiand:latest
docker push localhost:1338/debiand:latest
crane pull localhost:1338/debiand:latest debiand.tar

docker pull ubuntu:latest
docker tag ubuntu:latest localhost:1338/ubuntud:latest
docker push localhost:1338/ubuntud:latest
crane pull localhost:1338/ubuntud:latest ubuntu.tar
crane push ubuntu.tar localhost:1338/ubuntuc:foo
docker pull localhost:1338/ubuntuc:foo
rm ubuntu.tar
rm debiand.tar
rm debianc.tar

kill $PID


<reponame>hschreck/servCheck
MANUFACTURER="$( sudo dmidecode --type 1 | grep "Manufacturer" | sed -e 's/.Manufacturer: //g' )"

SERIAL="$( sudo dmidecode --type 1 | grep "Serial Number" | sed -e 's/.*Serial Number: //' )"

IDENTIFIER="${MANUFACTURER}_${SERIAL}"

echo $IDENTIFIER

PRINT_IP=192.168.0.1

IP_BLOCK="10.0.2."

SPEC_LOCATION=/path/to/spec/files

SERVCHECK_LOCATION=/path/to/servCheck.sh

$SERVCHECK_LOCATION > $SPEC_LOCATION/$IDENTIFIER
while ! ifconfig | grep -F $IP_BLOCK > /dev/null;
do
	sleep 1
done

scp $SPEC_LOCATION/$IDENTIFIER $PRINT_IP:specs/$IDENTIFIER

ssh $PRINT_IP "cat specs/$IDENTIFIER | sed 's/^\(.\)/\1/' | lpr"


<reponame>keizo042/opentoonz_mruby
#!/bin/sh
cd mruby;
./minirake -f ../build_config.rb


#!/usr/bin/env bash
# Requires lots of functionality to be included to run stand alone.
# Strongly recommended to run via the homebrew-lemp entrypoint

# # # # # # # # # # #
# DROPOUT CONDITIONS
# # #

# Ensure standard nginx package not installed before continuing
if package_installed nginx; then
    error "nginx installation detected"
    echo "> Please remove before using this package"
    echo "> brew uninstall nginx"
    exit 1
fi

# # # # # # # # # # #
# CONFIGURATION INIT
# # #

load_config -o
echo "Note: nginx core modules (excluding ignored) will be automatically included"
while true; do
    read -n 1 -p "Continue with the above configuration? [y/N] " yn
    case $yn in
        [Yy]* ) echo ""; break;;
        [Nn]* ) exit;;
        * ) exit;;
    esac
done

# Export the config values that may exist in tokenized config files
# Example, envsubst used in nginx conf files
export LOCAL_DOMAIN=$LOCAL_DOMAIN
export WEB_ROOT_DIR=$WEB_ROOT_DIR

# Initialise local script variables not loaded via configuration files.
HBL_DIR=$WEB_ROOT_DIR/.homebrew-lemp;
NGINX_DYNAMIC_CONFIG=()

# # # # # # # # # # #
# PRE-INSTALLATION PREPARATIONS
# # #

# Create the web root directory if needed,
if ! [[ -d $WEB_ROOT_DIR ]]; then
    notice "Creating project root at: $WEB_ROOT_DIR ..."
    mkdir -p "$WEB_ROOT_DIR"
fi

# Prepare homebrew lemp asset directory
# Can be deleted as on initialisations as it's managed only by this package
rm -rf $HBL_DIR
mkdir -p $HBL_DIR

# Ensure homebrew exists, if not, installed it.
if ! [ -x "$(command -v brew)" ]; then
    notice "Installing homebrew ..."
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    # shellcheck disable=SC2181
    if [[ $? -ne 0 ]]; then
        error "Failed to install homebrew"
        exit 0
    fi
fi

# Ensure correct access
sudo chown -R "$(whoami)" "$(brew --prefix)"/*

# Update homebrew prior to continuing
notice "Updating Homebrew ..."
brew update

# Ensure git exists, if it doesn't, install
if ! [ -x "$(command -v git)" ]; then
    notice "Installing git ..."
    brew install git
fi

# Ensure the envsubst command can be used
if [ ! -x "$(command -v envsubst)" ]; then
    brew link --force gettext
fi

# # # # # # # # # # #
# HOMEBREW-LEMP INSTALLATION
# # #

# Tap the nginx repositories
notice "Tapping denji/nginx ..."
brew tap denji/nginx

# Output state message
notice "Installing nginx-full ..."

# Determine the nginx options that should be used when installing the nginx-full package
echo "> Determining options ..."
while read -r line; do
    if [[ $line == --with-* ]] && [[ $line != --with-*-module ]]; then
        # shellcheck disable=SC2199
        if ! array_contains $line "${NGINX_OPTIONS[@]}" && ! array_contains $line "${NGINX_OPTIONS_IGNORE[@]}"; then
            NGINX_OPTIONS+=("$line")
        fi
    fi
done < <(brew options nginx-full)

# Output state message
echo "> Checking external dependencies"

# If imlib2 is to be included with the nginx install ensure it's external dependency on
# xquartz is met.
# shellcheck disable=SC2199
if array_contains "--with-imlib2" "${NGINX_OPTIONS[@]}"; then
    brew cask list xquartz || brew cask install xquartz --verbose;
fi

# If the nginx brotli module is to be install ensure the brotli dependencies are met
# shellcheck disable=SC2199
if array_contains "--with-brotli-module" "${NGINX_OPTIONS[@]}"; then
    # Install brotli module first rather than dynamically if requested
    # This is required so the dependency on the brotli package can be fulfilled prior
    # to any dependency checks/configuration etc done during the nginx-full install
    brew install brotli-nginx-module
    rm -rf /usr/local/share/brotli-nginx-module/deps/brotli
    git clone https://github.com/google/brotli.git /usr/local/share/brotli-nginx-module/deps/brotli

    # Add the brotli file to dynamic configuration
    NGINX_DYNAMIC_CONFIG+=('brotli.dynamic.conf')
fi

# If fancy index is to be used, install the theme
if array_contains "--with-fancyindex-module" "${NGINX_OPTIONS[@]}"; then
    # Clone the theme into the hbl lemp web dir
    git clone https://github.com/TheInsomniac/Nginx-Fancyindex-Theme.git $HBL_DIR/fancyindex;

    # Create a copy of the original config before altering paths to the homebrew lemp dir
    cp $HBL_DIR/fancyindex/fancyindex.conf $HBL_DIR/fancyindex/fancyindex.conf.orig
    sed -e 's|/fancyindex/|/.homebrew-lemp/fancyindex/|g' \
        -e 's|fancyindex_ignore "fancyindex"|fancyindex_ignore ".homebrew-lemp"|g' \
        -e '/^#[^!].*/d' \
        -e 's/\(.*[^!]\)#.*[^}]/\1/' \
        -e "s/^[ \t]*//" \
        -e "s/[ \t]*$//" $HBL_DIR/fancyindex/fancyindex.conf.orig > $HBL_DIR/fancyindex/fancyindex.conf

    # Create a copy of the header file before altering paths to the homebrew lemp dir
    cp $HBL_DIR/fancyindex/header.html $HBL_DIR/fancyindex/header.html.orig
    sed -e 's|/fancyindex/css/fancyindex.css|/.homebrew-lemp/fancyindex/css/fancyindex.css|g' \
        $HBL_DIR/fancyindex/header.html.orig > $HBL_DIR/fancyindex/header.html

    # Create a copy of the footer file before altering paths to the homebrew lemp dir
    # Also remove the closing body and html tags
    cp $HBL_DIR/fancyindex/footer.html $HBL_DIR/fancyindex/footer.html.orig
    sed -e 's|/fancyindex/js/history.js|/.hombrew-lemp/fancyindex/js/history.js|g' \
        -e '/<\/body>/d' \
        -e '/<\/html>/d' \
        $HBL_DIR/fancyindex/footer.html.orig > $HBL_DIR/fancyindex/footer.html

    # Append a new script to show first rows of tables on index page
    # Close the previously removed body html tags
    cat <<EOT >> "$HBL_DIR/fancyindex/footer.html"
<script>
  if (currentPath == '/') {
    document.querySelector('.box-content tbody tr').style.display = "table-row"
  }
</script>
</body>
</html>
EOT

    # Add the fancyindex file to dynamic configuration
    NGINX_DYNAMIC_CONFIG+=('fancyindex.dynamic.conf')
fi

# Install nginx full, with its external dependencies met and the required options
brew install nginx-full ${NGINX_OPTIONS[*]};

# Output state message
echo "> Configuring ..."

# Configure nginx to be run on port 80 without the need to sudo
sudo chown root:wheel /usr/local/opt/nginx-full/bin/nginx
sudo chmod u+s /usr/local/opt/nginx-full/bin/nginx

# Make a copy of the original installed nginx, and move the one provided by this module
# into it's place. Create all of the directories this new file references to avoid any
# errors on start.
mv /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf.orig
cp $APP_ROOT/assets/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf
mkdir -p /usr/local/var/log/nginx
mkdir -p /usr/local/etc/nginx/modules
mkdir -p /usr/local/etc/nginx/servers

# Process all of the nginx configuration assets provided by this package
# Each configuration file is processed, environment variables are substituted for actual
# values and moved into the nginx installation directory
for file in $APP_ROOT/assets/nginx/*/*.conf; do
    # Handle dynamic config files
    # If a file is dynamic it will be skipped unless added to the NGINX_DYNAMIC_CONFIG array
    if [[ $file == *.dynamic.conf ]] && ! array_contains $(basename $file) "${NGINX_DYNAMIC_CONFIG[@]}"; then
        continue
    fi

    # Create the files directory if needed
    # shellcheck source=/dev/null
    if [[ ! -d "/usr/local/etc/nginx/$(basename "$(dirname "$file")")" ]]; then
        mkdir -p "/usr/local/etc/nginx/$(basename "$(dirname "$file")")"
    fi

    # Substitute environment variables and create the install the config file
    # Remove the .dynamic prefix from the filename (catch all for dynamic files)
    envsubst '${HOME},${LOCAL_DOMAIN},${WEB_ROOT_DIR}' < "$file" \
        > "/usr/local/etc/nginx/$(basename "$(dirname "$file")")/$(basename ${file/.dynamic/})"
done;

# Install dnsmasq
notice "Installing dnsmasq ..."
brew install dnsmasq

# Add the localhost mask
dnsmasq_add "localhost"

# Flush the dns cache so it dnsmasq changes are updated
sudo dscacheutil -flushcache

# For mojave users ensure sdk headers are installed
if [[ -f /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ]]; then
    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
fi

# Install php versions
brew tap exolnet/homebrew-deprecated
brew install --build-from-source https://raw.githubusercontent.com/JParkinson1991/homebrew-deprecated/79d817a7ef794234d5276df0487a9d037b7b7bba/Formula/php@5.6.rb --with-openssl-1.1-patch
brew unlink php@5.6
brew install php@7.0 --build-from-source
brew unlink php@7.0
brew install php@7.1 --build-from-source
brew unlink php@7.1
brew install php@7.2 --build-from-source
brew unlink php@7.2
brew install php@7.3 --build-from-source
brew unlink php@7.3
brew install php --build-from-source

# Install the info site
mkdir -p "$HBL_DIR/phpinfo"
cp "$APP_ROOT/assets/php/info.php" "$HBL_DIR/phpinfo/info.php"

# Install mysql
if ! package_installed mysql@5.7; then
    brew install mysql@5.7
    sudo rm -f "/usr/local/etc/my.cnf"
    cp "$APP_ROOT/assets/mysql/my.cnf" "/usr/local/etc/my.cnf"
    /usr/local/opt/mysql@5.7/bin/mysql.server start
    /usr/local/opt/mysql@5.7/bin/mysql_secure_installation
fi

# Install phpmyadmin
if ! package_installed phpmyadmin; then
    brew install phpmyadmin
    cp /usr/local/etc/phpmyadmin.config.inc.php /usr/local/etc/phpmyadmin.config.inc.php.orig
    blowfish_secret=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
    sed -e "s|\$cfg\['blowfish_secret'\] = ''|\$cfg\['blowfish_secret'\] = '$blowfish_secret'|g" \
    /usr/local/etc/phpmyadmin.config.inc.php.orig > /usr/local/etc/phpmyadmin.config.inc.php
fi

# # # # # # # # # # #
# POST INSTALLATION OUTPUTS
# # #

# Starts the stack
notice "Starting the Stack"
start_default

success "Homebrew lemp initialised"
notice "Web root available at: http://localhost"
notice "PHP Info available at: http://info.$LOCAL_DOMAIN"
notice "DB Admin available at: http://phpmyadmin.$LOCAL_DOMAIN"

exit 0


#!/bin/bash

docker build -t vscode-ubuntu:v1 .
docker run -it -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /root/vs-test/vsfiles:/root/vs-test/vsfiles -v /root/vs-test/:/root/vs-test/ vscode-ubuntu:v1


#!/bin/bash

# Startup script meant for docker

# Take a backup and use said backup if already created
# This is to make sure that every time we start, the SERVER-URL
# is changed, so that we can change the URL if needed with a restart.
if [ ! -f /tmp/bootstrap.bundle.js ]; then
    cp /usr/src/app/public/bootstrap.bundle.js /tmp/bootstrap.bundle.js
else
    cp /tmp/bootstrap.bundle.js /usr/src/app/public/bootstrap.bundle.js
fi

sed -i -e 's|<!SERVER-URL!>|'$1'|g' /usr/src/app/public/bootstrap.bundle.js

cd /usr/src/app
npm run serveprod


#!/usr/bin/env bash

set -e

#mysql -Be "CALL nbaGetNeverInjured();" | tr '\t' ',' | sed 's/NULL//g' > nba_never_injured.csv
#python3 nba_upto_first_injury.py
# python3 nba_from_first_to_second_injury.py > nba_from_first_to_second_injury.txt

datasets=("nba_never_injured" "nba_upto_first_injury" "nba_upto_first_and_only_injury" "nba_upto_second_injury")

for dataset in "${datasets[@]}"
do
	echo "$dataset.py > $dataset.csv"
	python "$dataset.py" > "$dataset.csv"
done


<reponame>tkejzlar/ruby-buildpack
#!/usr/bin/env bash
set -euo pipefail

cd "$( dirname "${BASH_SOURCE[0]}" )/.."
source .envrc
./scripts/install_tools.sh

GINKGO_NODES=${GINKGO_NODES:-3}
GINKGO_ATTEMPTS=${GINKGO_ATTEMPTS:-2}
export CF_STACK=${CF_STACK:-cflinuxfs3}
DISK_LIMIT_ARG=""
MEM_LIMIT_ARG=""

if [ -n "${CF_BRATS_DISK_QUOTA+x}" ]; then
  DISK_LIMIT_ARG="-disk=$CF_BRATS_DISK_QUOTA"
fi

if [ -n "${CF_BRATS_MEM_QUOTA+x}" ]; then
  MEM_LIMIT_ARG="-memory=$CF_BRATS_MEM_QUOTA"
fi

cd src/*/brats

echo "Run Buildpack Runtime Acceptance Tests"
ginkgo -r -mod=vendor --flakeAttempts=$GINKGO_ATTEMPTS -nodes $GINKGO_NODES -- $DISK_LIMIT_ARG $MEM_LIMIT_ARG


__='
Copyright 2020 CyanSemi Semiconductor Co.

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.

'
#!/bin/bash

# This script is used to pre-check the regular expressions before running
# on hardware; point out the regex that couldn't be parsed by hardware.

# The script requires the directory of "deploy" folder
# and regex_file

usage () {
    echo "Usage: With two arguments:"
    echo "Example: $0 <deploy_folder> <regex_file>"
    echo ""
    echo "Usage: With one argument: (Process all of the regex_*.txt under ./testdata"
    echo "Example: $0 <deploy_folder>"
}

###################################################
if [ -z $1 ]; then
    usage
    exit -1
fi

deploy_folder=`realpath $1` #Convert the input relative path to absolute on
if [ ! -d $deploy_folder ]; then
    echo "ERROR! deploy_folder $deploy_folder doesn't exist"
    exit -1
fi
sh=$deploy_folder/check_regex.sh

###################################################
if [ -z $2 ]; then
    #simfiles need to list explicitly, because it is a link
    if [ -L ./testdata/simfiles ]; then
        argument2="./testdata ./testdata/simfiles/"
    else
        argument2="./testdata"
    fi
    file_list=`find $argument2 -type f -name regex_*.txt`
else
    argument2=$2
    file_list=`find $argument2 -type f`
fi

echo "Start parsing $argument2"

for f in $file_list; do
    file=`realpath $f`
    long_files+=$file
    long_files+=" "
done

for lf in $long_files; do
    $sh $deploy_folder $lf
done
###################################################


<filename>tek_report.sh
#!/bin/bash

# turn the CSVs into a HTML page to be nicer to readers

TARGET_DIR="/var/www/tact/tek-counts"
TARGET="$TARGET_DIR/index.html"
COUNTRY_LIST="ie it de ch pl dk at lv"
DATADIR=/home/stephen/code/tek_transparency
ARCHIVE=$DATADIR/all-zips

function whenisitagain()
{
	date -u +%Y%m%d-%H%M%S
}
NOW=$(whenisitagain)

if [ ! -d $TARGET_DIR ]
then
    TARGET="tek-index.html"
    echo "Can't see $TARGET_DIR, writing to $TARGET"
fi

# do the file header
cat >$TARGET <<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>Testing Apps for COVID-19 Tracing (TACT) - TEK Survey </title>

Testing Apps for COVID-19 Tracing (TACT) - TEK Survey

This page displays the current counts of Temporary Exposure Keys (TEKs)
that are visible on the Internet, to allow for comparisons for each day, for
the Irish, Italian, German, Swiss, Polish, Danish, Austrian and Latvian apps. We also check if the
Irish servers have published any TEKs (so far none that
we can see).

We hope to expand the list of countries over
time (help welcome!) as more public health authorities adopt the Google/Apple
Exposure Notification (GAEN) API (if they do!). The code that produces this is
here.  This is
produced as part of our TACT
project.

The tables below show the counts of TEK for each of the days listed. Where
there were no TEKs for a given day, there is no row in the file. The TEK column
reports the number of TEKs that were published, being considered useful for
contact tracing on that day, so do not represent the number of positive cases
seen on that day (except perhaps for the most recent day).  In other words, on
the latest day reported, the number of TEKs should (in theory) match the number
of people using the app that test positive and subsequently upload their TEKs.
Each such person will upload usually 14 TEKs (one for each day in the previous
two weeks), though the public health authority might decide not to publish the
full set for medical reasons (e.g. not being infectious for some days). That
means that for example the number of TEKs on the 2nd most recent day may
be the sum of the number of people who uploaded on that and the most recent
day.

The count of cases declared is the number of COVID-19 cases declared by that
country to the WHO, either based on a manually downloaded file from the WHO
(rarely) or else on a file from the ECDC that can be downloaded from here.

Comparing the TEKs and Cases columns, it is clear that some more explanation
for those numbers is required. We are trying to find good answers for that.
(And welcome inputs!)

On 20200702 we learned (from <NAME> <<EMAIL>>) that the Swiss
key server always emits 10 "synthetic" TEKs per
day as a method of exercising the client code (a fine idea), so the number
of "real" uploads is what is shown less 10. We also learned that the
Swiss server-side can update the numbers post-facto, so each time our
script is run we download the last two weeks worth of information. It
may take a while to get a full picture of what's going on there.

For some reason the German server publishes 10 keys for every
one really uploaded. (See this github issue.)
I don't really buy that as a privacy win TBH - just rounding up to a
multiple of 10 would be fine, but at least I think I now understand
the numbers.

On 20200704 we found out about the .de hourly API endpoint so we've
added grabbing those zips where they're available. Not clear if that's
using the same random-key-padding-multiplier or not, or maybe they
changed it down to 5 or something.

On 20200709 added Austria. I'm currently unclear what those
numbers mean but did check 'em and they do seem to relate to unique
TEK values. We'll see how it goes for a day or two before worrying.

On 20200709 added Latvia as there are now a few TEKs.

Added Ireland on 20200710

20200711: Took a look at the Austrian server code
and it does have a configured minimum and jitter and randomly pads - search for ensureMinNumExposures(). No idea why they've picked such big numbers though.

20200713: started collecting numbers for Spain, where they're
running a trial apparently, but not clear that
the server for their trial will be used when it goes live so we'll not
yet show the trial numbers.

This file is updated every hour while we figure out the behaviour. This update is from $NOW UTC. If
you manage one of these systems and would prefer we query less often please feel free to get in
touch.

For an explanation of what this means, read this.

EOF

# Check for Irish TEKs - there are none yet and we'll need to check
# how to parse the index
if [ -f $ARCHIVE/ie-canary ]
then
    cat $ARCHIVE/ie-canary >>$TARGET
fi

# table of tables with 1 row only
echo '

' >>$TARGET
for country in $COUNTRY_LIST
do
	cfile="$ARCHIVE/$country-tek-times.csv"
	echo '' >>$TARGET
	echo '
csv file
' >>$TARGET
	echo '
' >>$TARGET
	awk -F, '{print "
"; for(i=1;i<=NF;i++) {print ""$i"	"} print "
"}' $cfile >>$TARGET
	echo '
' >>$TARGET
	echo '	' >>$TARGET
done
echo "

" >>$TARGET

# do the footer
cat >>$TARGET <<EOF

EOF


<reponame>calmelated/linux-tools
#!/bin/sh

#sudo gem install rb-inotify livereload
sudo gem install bundle
sudo gem install guard
sudo gem install guard-livereload
sudo gem install rb-inotify
sudo gem install yajl-ruby


#!/bin/bash

GCP_PROJECT="cloud-functions-talk-22365"
GOOGLE_APPLICATION_CREDENTIALS="/Users/stefan/.secret/cloud-functions-talk-22365-6ba5c5af57f4.json"

gcloud alpha functions call --region=europe-west1 HelloWorld


<reponame>reversemind/kafka-as-module
#!/bin/bash

#1 upload Apache Kafka as submodule
git submodule init
git submodule update

#2 get branch 0.10.1
#cd kafka/
#git checkout 0.10.1
#cd ..

#3 fix  build.gradle
cp -f ./_kafka_fixed_build_gradle_ kafka/build.gradle

#4 upload gradle wrapper
gradle wrapper

#5 build project
./gradlew clean build -x test -x checkstyleMain -x checkstyleTest --info


#!/bin/bash

mkdir ~neutron/.ssh
cat >> ~neutron/.ssh/known_hosts <<EOF
|1|N8KzQU0nKIAgyX/qDsZA8UA725w=|GeojME5hmoAu5m3+rx2WKghyzjA= ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDKzXfRCwUAswY6PfD/Myy7z9RbAk0LVZTpOIF8jtNonPVWbz+m2ZJ8SXjAaVsjwXOvLEHgapqyISPT8sLVtmQq+GPlx2ixZMmG5LYPPXDlsbfqh0yPdBmJ+kGIQcC4nXn1wIC+F6Zv1Yml6s4tvuFK9kzxQ4UjnS55U0in++j1Gw==
EOF
chown neutron.neutron -R ~neutron/.ssh/
chmod 700 ~neutron/.ssh

git clone https://github.com/CiscoSystems/ncclient.git /root/ncclient

(cd /root/ncclient; python ./setup.py install)
## This is a stub and needs a proper front end to capture the right parameters

switch_one='10.1.64.1'
switch_two='10.1.64.2'
admin_user='admin'
admin_pass='!<PASSWORD>'
hypervisor1[0]='aio8'
hypervisor1[1]='1/33'
#hypervisor1[2]='1/34'
hypervisor2[0]='compute8'
hypervisor2[1]='1/47'
#hypervisor2[2]='1/48'

if [ -z "`grep ml2_cisco /etc/neutron/plugins/ml2/ml2_conf.ini`" ]; then

sed -e 's/mechanism_drivers=/mechanism_drivers=cisco_nexus,/' -i /etc/neutron/plugins/ml2/ml2_conf.ini
cat >> /etc/neutron/plugins/ml2/ml2_conf.ini <<EOF
[ml2_cisco]
vlan_name_prefix = q-
svi_round_robin = False
managed_physical_network = physnet1

# Cisco switch configuration(s)

EOF

fi

# switch one
echo "[ml2_mech_cisco_nexus:${switch_one}]" >> /etc/neutron/plugins/ml2/ml2_conf.ini
for ((i=1;i<${#hypervisor1[@]};i++)) ;do
echo "${hypervisor1[0]}=${hypervisor1[$i]}" >> /etc/neutron/plugins/ml2/ml2_conf.ini
echo "${hypervisor2[0]}=${hypervisor2[$i]}" >> /etc/neutron/plugins/ml2/ml2_conf.ini
done
cat >> /etc/neutron/plugins/ml2/ml2_conf.ini <<EOF
ssh_port=22
username=${admin_user}
password=${<PASSWORD>}

EOF

#switch two

# echo "[ml2_mech_cisco_nexus:${switch_two}]" >> /etc/neutron/plugins/ml2/ml2_conf.ini
# for ((i=1;i<${#hypervisor2[@]};i++)) ;do
# echo "${hypervisor1[0]}=${hypervisor1[$i]}" >> /etc/neutron/plugins/ml2/ml2_conf.ini
# echo "${hypervisor2[0]}=${hypervisor2[$i]}" >> /etc/neutron/plugins/ml2/ml2_conf.ini
# done
# cat >> /etc/neutron/plugins/ml2/ml2_conf.ini <<EOF
# ssh_port=22
# username=${admin_user}
# password=${<PASSWORD>}

# EOF

for n in `ls /etc/init/neutron*`; do m=$(basename $n); o=${m%.*}; service $o restart; done


<filename>content/makeMds.command
#!/bin/bash
# coding: utf-8

cd -- "$(dirname "$BASH_SOURCE")"

python pdfannots_scriven.py


alias ps='ps aux'
alias pf='ps -e | grep'
alias psg='ps aux | grep -v grep | grep --ignore-case -e VSZ -e'


<filename>devnet.sh
#!/bin/bash

SCRIPT=$(basename ${BASH_SOURCE[0]})
QTD=2 #QTD=2 == 3 nodes since it counts from zero
TYPE=branch
DUSK_VERSION=v0.3.0
INIT=true
MOCK=true
VOUCHER=true
FILEBEAT=false
MOCK_ADDRESS=127.0.0.1:9191
SEND_BID=false
RUN_AUTOMATON=false

currentDir=$(pwd)
RACE=false
DEBUG=false

# define command exec location
duskCMD="../bin/dusk"

usage() {
  echo "Usage: $SCRIPT"
  echo "Optional command line arguments"
  echo "-c <number>  -- TYPE to use. eg: release"
  echo "-q <number>  -- QTD of validators to run. eg: 5"
  echo "-s <number>  -- DUSK_VERSION version. eg: v0.3.0"
  echo "-i <boolean>  -- INIT instances (true or false). default: true"
  echo "-m <boolean>  -- MOCK instances (true or false). default: true"
  echo "-f <boolean>  -- FILEBEAT instances (true or false). default: false"
  echo "-b <boolean>  -- SEND_BID tx to instances (true or false). default: false"
  echo "-a <boolean>  -- RUN_AUTOMATON to instances (true or false). default: false"
  echo "-r <number>  -- RACE enabled (true or false). eg: true"
  echo "-d <number>  -- DEBUG enabled (true or false). eg: true"

  exit 1
}

while getopts "h?c:q:s:i:m:f:b:a:r:d:" args; do
case $args in
    h|\?)
      usage;
      exit;;
    c ) TYPE=${OPTARG};;
    q ) QTD=${OPTARG};;
    s ) DUSK_VERSION=${OPTARG};;
    i ) INIT=${OPTARG};;
    m ) MOCK=${OPTARG};;
    f ) FILEBEAT=${OPTARG};;
    b ) SEND_BID=${OPTARG};;
    a ) RUN_AUTOMATON=${OPTARG};;
    r ) RACE=${OPTARG};;
    d ) DEBUG=${OPTARG};;
  esac
done

set -euxo pipefail
if [[ "${TYPE}" == "branch" && "${RACE}" == "true" && "${DEBUG}" == "true" ]]; then
  GOBIN=$(pwd)/bin go run scripts/build.go install -race -debug
elif [[ "${TYPE}" == "branch" && "${RACE}" == "true" ]]; then
  GOBIN=$(pwd)/bin go run scripts/build.go install -race
elif [[ "${TYPE}" == "branch" && "${DEBUG}" == "true" ]]; then
  GOBIN=$(pwd)/bin go run scripts/build.go install -debug
elif [[ "${TYPE}" == "branch" ]]; then
  GOBIN=$(pwd)/bin go run scripts/build.go install
fi

#init dusk
init_dusk_func() {
  echo "init Dusk node $i ..."
  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"
  LOGS="${currentDir}/devnet/dusk_data/logs"

  # cleanup
  rm -rf "${DDIR}"
  rm -rf "${LOGS}"
  rm -rf "${DDIR}/walletDB/"

  mkdir -p "${DDIR}"
  mkdir -p "${LOGS}"
  mkdir -p "${DDIR}/walletDB/"

  cat <<EOF > "${DDIR}"/dusk.toml
[consensus]
  defaultamount = 5
  defaultlocktime = 250000
  #defaultoffset = 10
  consensustimeout = 5

[performance]
  # Number of workers to spawn on an accumulator component
  accumulatorWorkers = 4

[database]
  dir = "${DDIR}/chain/"
  driver = "heavy_v0.1.0"

[general]
  network = "devnet"
  walletonly = "false"
  safecallbacklistener = "true"

# Timeout cfg for rpcBus calls
[timeout]
  timeoutsendbidtx = 50
  timeoutsendstaketx = 50
  timeoutgetlastcommittee = 5
  timeoutgetlastcertificate = 5
  timeoutgetmempooltxsbysize = 4
  timeoutgetlastblock = 5
  timeoutgetcandidate = 5
  timeoutclearwalletdatabase = 0
  timeoutverifycandidateblock = 5
  timeoutgetmempooltxs = 3
  timeoutgetroundresults = 5
  timeoutbrokergetcandidate = 2
  timeoutreadwrite = 60
  timeoutkeepalivetime = 30
  timeoutdial = 5

[genesis]
  legacy = false

[gql]
  address = "127.0.0.1:$((9500+$i))"
  enabled = "true"
  network = "tcp"

  # enable/disable both HTTPS and WSS
  enableTLS = false
  # server TLS certificate file
  certFile = ""
  # server TLS key file
  keyFile = ""

  # maximum requests per second
  # uniqueness of a request is based on:
  # Remote IP, Request method and path
  maxRequestLimit = 20

  [gql.notification]
    # Number of pub/sub brokers to broadcast new blocks.
    # 0 brokersNum disables notifications system
    brokersNum = 1
    clientsPerBroker = 1000

[logger]
  output = "stdout"
  #output = "${DDIR}/dusk"
  level = "info"
  format = "json"
[logger.monitor]
# enabling log based monitoring
enabled = false

[mempool]
  # Max size of memory of the accepted txs to keep
  maxSizeMB = 100

  # Possible values: "hashmap", "syncpool", "memcached"
  poolType = "hashmap"

  # number of txs slots to allocate on each reseting mempool
  preallocTxs = 100

  # Max number of items to respond with on topics.Mempool request
  # To disable topics.Mempool handling, set it to 0
  maxInvItems = 10000

[network]
  port = "$((7100+$i))"
  minimumConnections = 5
  maxConnections = 50
  serviceFlag = 1

  [network.seeder]
    addresses = ["127.0.0.1:8081"]

[rpc]
  address = "${DDIR}/dusk-grpc.sock"
  enabled = "true"
  network = "unix"

  # duration of the session for the grpc services exposed by the node
  sessionDurationMins = 5

  # do not require session
  requireSession = false

  enableTLS=false

  # server TLS certificate file
  certFile=""

  # server TLS key file
  keyFile=""

  [rpc.rusk]
    address = "127.0.0.1:$((10000+$i))"
    contractTimeout = 6000
    defaultTimeout = 1000
    connectionTimeout = 10000

[wallet]
  file = "${currentDir}/devnet-wallets/wallet$(($i)).dat"
  store = "${DDIR}/walletDB/"
[api]
  enabled=false
  enabletls = false
  address="127.0.0.1:$((9490+$i))"
  dbfile="${DDIR}/chain/api.db"
  #5 mins
  expirationtime=300

EOF

  echo "init Dusk node $i, done."
}

#init dusk
init_filebeat_func() {
  echo "init FILEBEAT node $i ..."
  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"
  rm -rf "${DDIR}"/filebeat

  cat <<EOF > "${DDIR}"/filebeat.json.yml
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - ${DDIR}/dusk$((7100+$i)).log
  exclude_files: ['\.gz$']
  encoding: plain
  json.keys_under_root: true
name: dusk$((7100+$i))
output.logstash:
  hosts: ["0.0.0.0:5000"]
  #index: "devnet-v1"
  #tags: ["devnet","dusk${i}"]
  #ignore_older: "5h"
  #close_inactive: "4h"
  #close_renamed: true
  #clean_inactive: true
  #clean_removed: true
  #tail_files: true
  encoding: plain
#setup.dashboards.enabled: true
#setup.kibana.host: "localhost:5601"
#setup.kibana.protocol: "http"
#setup.kibana.username: elastic
#setup.kibana.password: <PASSWORD>
#setup.dashboards.retry.enabled: true
#setup.dashboards.retry_interval: 10
fields:
  env: dusk$((7100+$i))
#  type: node
processors:
#  - add_host_metadata: ~
#  - add_cloud_metadata: ~
#  - decode_json_fields:
#      fields: ["field1", "field2", ...]
#      process_array: false
#      max_depth: 1
#      target: ""
#      overwrite_keys: false
#      add_error_key: true
  - convert:
      fields:
        - {from: "msg", type: "string"}
        - {from: "level", to: "msg_level", type: "string"}
        - {from: "category", to: "msg_category", type: "string"}
        - {from: "process", to: "msg_process", type: "string"}
        - {from: "topic", to: "msg_topic", type: "string"}
        - {from: "recipients", to: "msg_recipients", type: "string"}
        - {from: "step", to: "msg_step", type: "string"}
        - {from: "round", to: "msg_round", type: "string"}
        - {from: "id", to: "msg_id", type: "string"}
        - {from: "sender", to :"msg_sender", type: "string"}
        - {from: "agreement", to: "msg_agreement", type: "string"}
        - {from: "quorum", to: "msg_quorum", type: "string"}
        - {from: "new_best", to: "msg_new_best", type: "string"}
        - {from: "block_hash", to: "msg_block_hash", type: "string"}
        - {from: "prefix", to: "msg_prefix", type: "string"}
        - {from: "hash", to: "msg_hash", type: "string"}
        - {from: "error", to: "msg_error", type: "string"}
        - {from: "score", to: "msg_score", type: "string"}
        - {from: "count", to: "msg_count", type: "string"}
        - {from: "last_height", to: "msg_last_height", type: "string"}
        - {from: "height", to: "msg_height", type: "string"}
        - {from: "sender", to: "msg_sender", type: "string"}
      ignore_missing: true
      fail_on_error: false
      mode: rename
  - drop_fields:
      fields: ["agent", "ecs.version", "input", "log", "@metadata", "host"]

EOF

  chmod go-w "${DDIR}"/filebeat.json.yml

  echo "init FILEBEAT node $i, done."
}

# start dusk mocks
start_dusk_mock_rusk_func() {
  echo "starting Dusk Rusk mock $i ..."

  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"
  WALLET_FILE="${currentDir}/devnet-wallets/wallet$(($i)).dat"

  CMD="${currentDir}/bin/utils mockrusk --rusknetwork tcp --ruskaddress 127.0.0.1:$((10000+$i)) --walletstore ${DDIR}/walletDB/ --walletfile ${WALLET_FILE} --configfile ${DDIR}/dusk.toml"
  ${CMD} >> "${currentDir}/devnet/dusk_data/logs/mock_rusk$i.log" 2>&1 &

  EXEC_PID=$!
  echo "started Dusk Rusk Mock node $i, pid=$EXEC_PID"
}

# start dusk
start_dusk_func() {
  echo "starting Dusk node $i ..."

  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"

  CMD="${currentDir}/bin/dusk --config ${DDIR}/dusk.toml"
  ${CMD} <<< "password" >> "${currentDir}/devnet/dusk_data/logs/dusk$i.log" 2> "${currentDir}/devnet/dusk_data/logs/dusk$i.err" &

  EXEC_PID=$!
  echo "started Dusk node $i, pid=$EXEC_PID"
#  sleep 1

}

start_dusk_mock_func() {
  echo "starting Dusk Utils mock ..."

  CMD="${currentDir}/bin/utils mock --grpcmockhost $MOCK_ADDRESS"
  ${CMD} >> "${currentDir}/devnet/dusk_data/logs/mock.log" 2>&1 &

  EXEC_PID=$!
  echo "started Dusk Utils mock, pid=$EXEC_PID"
}

# send_bid_func
send_bid_func(){
  echo "Sending bid to node $i ..."

  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"

  # send bid cmd
  SENDBID_CMD="./bin/utils transactions --grpcaddr unix://${DDIR}/dusk-grpc.sock --txtype consensus --amount 10 --locktime 10"
  ${SENDBID_CMD} >> "${currentDir}/devnet/dusk_data/logs/sendbid_bid$i.log" 2>&1 &
}

# automaton_func
automaton_func(){
  echo "Starting automaton, will be sending automated stakes and bids to node $i ..."

  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"

  # send bid cmd
  AUTOMATE_CMD="./bin/utils automate --grpcaddr unix://${DDIR}/dusk-grpc.sock --sendstaketimeout 10 --sendbidtimeout 10"
  ${AUTOMATE_CMD} >> "${currentDir}/devnet/dusk_data/logs/automaton$i.log" 2>&1 &
}

start_voucher_func() {
  echo "starting Dusk Voucher ..."

  CMD="${currentDir}/bin/voucher"
  ${CMD} >> "${currentDir}/devnet/dusk_data/logs/voucher.log" 2>&1 &

  EXEC_PID=$!
  echo "started Dusk Voucher, pid=$EXEC_PID"
}

start_filebeat_func() {
  echo "starting FILEBEAT node $i ..."

  DDIR="${currentDir}/devnet/dusk_data/dusk${i}"
  filebeat -e -path.config "${DDIR}" -path.data "${DDIR}/filebeat" -c filebeat.json.yml -d "*" >> "${currentDir}/devnet/dusk_data/logs/filebeat${i}.log" 2>&1 &

  EXEC_PID=$!
  echo "started FILEBEAT, pid=$EXEC_PID"
}

if [ "${INIT}" == "true" ]; then

  for i in $(seq 0 "$QTD"); do
    init_dusk_func "$i"
  done

fi

#sleep 1

if [ "${VOUCHER}" == "true" ]; then
  start_voucher_func
fi

#sleep 1

if [ "${MOCK}" == "true" ]; then
  start_dusk_mock_func

  for i in $(seq 0 "$QTD"); do
    start_dusk_mock_rusk_func "$i"
  done
fi

if [ "${FILEBEAT}" == "true" ]; then

  for i in $(seq 0 "$QTD"); do
    init_filebeat_func "$i"
    start_filebeat_func "$i"
  done

fi

#sleep 1

for i in $(seq 0 "$QTD"); do
  start_dusk_func "$i"
done

sleep 5

if [ "${SEND_BID}" == "true" ]; then
  for i in $(seq 0 "$QTD"); do
    send_bid_func "$i"
  done
fi

sleep 5

if [ "${RUN_AUTOMATON}" == "true" ]; then
  for i in $(seq 0 "$QTD"); do
    automaton_func "$i"
  done
fi

echo "done starting Dusk stack"
exit 0


<filename>install.sh
#! /bin/sh

# pull
if [ -d ~/.vim ]
then
  mv ~/.vim ~/.vim-bk
fi
git clone http://github.com/athom/my-sword.git ~/.vim

# install vundle
if [ ! -d ~/.vim/bundle/vundle ]
then
  git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
fi

echo "link configurations"
# rename .vimrc
if [ -f ~/.vimrc ]
then
  mv ~/.vimrc ~/.vimrc-bk
fi

# rename .gvimrc
if [ -f ~/.gvimrc ]
then
  mv ~/.gvimrc ~/.gvimrc-bk
fi

# link configurations
ln -s ~/.vim/_vimrc ~/.vimrc
ln -s ~/.vim/_gvimrc ~/.gvimrc

# install plugins
echo "install plugins"
vim +BundleInstall +qa


<filename>integration/device-test.sh
#!/usr/bin/env bash
source $(dirname ${BASH_SOURCE[0]})/assert.sh

PROG=`realpath $1`
UNITSNUM=${UNITSNUM:-9}
MNTDIR=`mktemp -d`

cleanup() {
    echo Remove mountpoint $MNTDIR
    fusermount -u $MNTDIR || (echo "Trying sudo..."; sudo fusermount -u $MNTDIR && echo DONE)
    rmdir $MNTDIR
    exit $RESULT
}

trap cleanup EXIT INT

# Test section

echo Mount $MNTDIR by $PROG
assert $PROG --units=$UNITSNUM $MNTDIR

assert echo 0 '>' $MNTDIR/ctrl
assert echo 0 '|' diff - $MNTDIR/ctrl
assert echo 5 '>' $MNTDIR/ctrl
assert echo 3 '>' $MNTDIR/ctrl
assert echo 6 '>' $MNTDIR/ctrl
assert printf '5\\n3\\n6\\n' '|' diff - $MNTDIR/ctrl

assert echo 123 '>' $MNTDIR/unit7/lram
assert echo 321 '>' $MNTDIR/unit7/pram
assert echo 123 '|' diff - $MNTDIR/unit7/lram
assert echo 321 '|' diff - $MNTDIR/unit7/pram

# End of test section

if [[ $RESULT -ne 0 ]]; then
    printf "\n****************FAILED****************\n"
else
    printf "\nAll is fine!\n"
fi

exit $RESULT


#!/bin/bash

BASEDIR=$(dirname $0)
DISTDIR=$BASEDIR/../../dist
SRCDIR=$BASEDIR/../../src/
NODE_MODULES=$BASEDIR/../../node_modules

rm -rf $DISTDIR/src
rm -rf $DISTDIR/node_modules

cp $BASEDIR/../../package.json $DISTDIR
cp $BASEDIR/../../yarn.lock $DISTDIR

$BASEDIR/../../node_modules/.bin/babel $SRCDIR -d $DISTDIR/src
$BASEDIR/../../node_modules/.bin/babel $BASEDIR/../config.js.example -o $DISTDIR/src/config.js

cd $BASEDIR/../..
npm install
cp -R $NODE_MODULES $DISTDIR/


#!/usr/bin/env bash
#
# Copyright (c) 2009-2012 VMware, Inc.

set -e

base_dir=$(readlink -nf $(dirname $0)/../..)
source $base_dir/lib/prelude_apply.bash

# this parameters is used by bosh agent
# we should use vsphere when building for vcloud
infrastructure=$stemcell_infrastructure
[ "$infrastructure" == "vcloud" ] && infrastructure=vsphere
echo -n $infrastructure > $chroot/var/vcap/bosh/etc/infrastructure

echo -n $stemcell_operating_system > $chroot/var/vcap/bosh/etc/operating_system


<reponame>SimonWorfolk/LBG4-API<gh_stars>0
#! /bin/bash
npm install
npm test

docker -v
export PORT=5000

echo $?

if echo $? = 0;

then
    echo "docker already installed"
else

curl https://get.docker.com | sudo bash
sudo usermod -aG docker $(whoami)

fi

cd /home/simon_worfolk/LBG4-API

DOCKER_API=$(docker images "lbg4-api" --format "{{.Repository}}")
DOCKER_RUN=$(docker ps -a -f name=lbg4-api --format "{{.Image}}")

if [ $DOCKER_API ];then
echo "Image already built"
else

 docker build -t lbg4-api .
echo "New image built"
fi

if [ $DOCKER_RUN ];
then

 docker start lbg4-api
echo "existing docker container started"
else

docker run -d -p $PORT:$PORT --name lbg4-api lbg4-api
echo "new docker container started"
fi


#!/usr/bin/env bash

get_percent(){
  #used_mem_mb=$(free -m | awk '/^Mem/ {print $3}')
  used_mem_total=$(free -h | awk '/^Mem/ {print $3}' | sed s/i//g)

  echo $used_mem_total\B
}

main(){
  ram_percent=$(get_percent)
  echo "$ram_percent"
}

#run main driver
main


<reponame>LarsonLab/dnlinv
#!/bin/bash
conda activate dnlinv

set -eo pipefail

./0_reco_dip.sh
./1_reco_dnlinv.sh
./2_reco_enlive.sh
./3_reco_espirit.sh
./4_get_measurements.sh
./5_create_us_fig.sh


<filename>fragments/labels/golang.sh
golang)
    # credit: <NAME> (@theilgaard)
    name="GoLang"
    type="pkg"
    packageID="org.golang.go"
    downloadURL="$(curl -fsIL "https://golang.org$(curl -fs "https://golang.org/dl/" | grep -i "downloadBox" | grep "pkg" | tr '"' '\n' | grep "pkg")" | grep -i "^location" | awk '{print $2}' | tr -d '\r\n')"
    appNewVersion="$( echo "${downloadURL}" | sed -E 's/.*\/(go[0-9.]*)\..*/\1/g' )" # Version includes letters "go"
    expectedTeamID="EQHXZ8M8AV"
    blockingProcesses=( NONE )
    ;;


#!/usr/bin/env bash

printTravisHeartbeat() {
    # Sleep one minute between printouts, but don't zombie for more than two hours
    for ((i=0; i < 120; i++)); do
        sleep 60
        printf "…"
    done &
    TRAVIS_HEARTBEAT_PID=$!
}

cromwellLogTail() {
 (
   while [ ! -f logs/cromwell.log ];
   do
     sleep 2
     printf "(Cr)"
   done
   tail -f logs/cromwell.log &
   CROMWELL_LOG_TAIL_PID=$!
 ) &
 CROMWELL_LOG_WAIT_PID=$!
}

centaurLogTail() {
 (
   while [ ! -f logs/centaur.log ];
   do
     sleep 2
     printf "(Ce)"
   done
   tail -f logs/centaur.log &
   CENTAUR_LOG_TAIL_PID=$!
 ) &
 CENTAUR_LOG_WAIT_PID=$!
}

killTravisHeartbeat() {
    if [ -n "${TRAVIS_HEARTBEAT_PID+set}" ]; then
        kill ${TRAVIS_HEARTBEAT_PID} || true
    fi
}

killCromwellLogTail() {
    if [ -n "${CROMWELL_LOG_TAIL_PID+set}" ]; then
        kill ${CROMWELL_LOG_TAIL_PID} || true
    else
        if [ -n "${CROMWELL_LOG_WAIT_PID+set}" ]; then
            kill ${CROMWELL_LOG_WAIT_PID} || true
        fi
    fi
}

killCentaurLogTail() {
    if [ -n "${CENTAUR_LOG_TAIL_PID+set}" ]; then
        kill ${CENTAUR_LOG_TAIL_PID} || true
    else
        if [ -n "${CENTAUR_LOG_WAIT_PID+set}" ]; then
            kill ${CENTAUR_LOG_WAIT_PID} || true
        fi
    fi
}

exitScript() {
    echo "CENTAUR LOG"
    cat logs/centaur.log
    killTravisHeartbeat
    killCromwellLogTail
    killCentaurLogTail
}

trap exitScript EXIT
trap exitScript TERM
cromwellLogTail
centaurLogTail
printTravisHeartbeat

set -x
set -e

sbt assembly
CROMWELL_JAR=$(find "$(pwd)/target/scala-2.11" -name "cromwell-*.jar")
LOCAL_CONF="$(pwd)/src/bin/travis/resources/local_centaur.conf"
git clone https://github.com/broadinstitute/centaur.git
cd centaur
git checkout ${CENTAUR_BRANCH}
cd ..
# All tests use ubuntu:latest - make sure it's there before starting the tests
# because pulling the image during some of the tests would cause them to fail
# (specifically output_redirection which expects a specific value in stderr)
docker pull ubuntu:latest
centaur/test_cromwell.sh -j"${CROMWELL_JAR}" -c${LOCAL_CONF}


<reponame>magnusjahre/parvec
#! /bin/sh
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Check all notrans_, dist_, nodist_ prefix combinations for MANS
# primary and install-man dependencies.

. test-init.sh

cat >>configure.ac <<'END'
AC_OUTPUT
END

cat > Makefile.am << 'EOF'
man_MANS = foo.1 foo2.1
dist_man_MANS = bar.2 bar2.2
nodist_man_MANS = baz.3 baz2.3
notrans_man_MANS = x-foo.4 x-foo2.4
notrans_dist_man_MANS = x-bar.5 x-bar2.5
notrans_nodist_man_MANS = x-baz.6 x-baz2.6
man7_MANS = y-foo.man y-foo2.man
dist_man5_MANS = y-bar.man y-bar2.man
nodist_man4_MANS = y-baz.man y-baz2.man
notrans_man3_MANS = z-foo.man z-foo2.man
notrans_dist_man2_MANS = z-bar.man z-bar2.man
notrans_nodist_man1_MANS = z-baz.man z-baz2.man

# These two are ignored.
dist_notrans_man_MANS = nosuch.8
nodist_notrans_man9_MANS = nosuch.man

y-foo.man y-foo2.man:
	: >$@
y-bar.man y-bar2.man:
	: >$@
y-baz.man y-baz2.man:
	: >$@
z-foo.man z-foo2.man:
	: >$@
z-bar.man z-bar2.man:
	: >$@
z-baz.man z-baz2.man:
	: >$@

test-install: install
	test -f inst/man/man1/gnu-foo.1
	test -f inst/man/man1/gnu-foo2.1
	test -f inst/man/man2/gnu-bar.2
	test -f inst/man/man2/gnu-bar2.2
	test -f inst/man/man3/gnu-baz.3
	test -f inst/man/man3/gnu-baz2.3
	test -f inst/man/man4/x-foo.4
	test -f inst/man/man4/x-foo2.4
	test -f inst/man/man5/x-bar.5
	test -f inst/man/man5/x-bar2.5
	test -f inst/man/man6/x-baz.6
	test -f inst/man/man6/x-baz2.6
	test -f inst/man/man7/gnu-y-foo.7
	test -f inst/man/man7/gnu-y-foo2.7
	test -f inst/man/man5/gnu-y-bar.5
	test -f inst/man/man5/gnu-y-bar2.5
	test -f inst/man/man4/gnu-y-baz.4
	test -f inst/man/man4/gnu-y-baz2.4
	test -f inst/man/man3/z-foo.3
	test -f inst/man/man3/z-foo2.3
	test -f inst/man/man2/z-bar.2
	test -f inst/man/man2/z-bar2.2
	test -f inst/man/man1/z-baz.1
	test -f inst/man/man1/z-baz2.1
	test ! -d inst/man/man8
	test ! -d inst/man/man9
EOF

: > foo.1
: > foo2.1
: > bar.2
: > bar2.2
: > baz.3
: > baz2.3
: > x-foo.4
: > x-foo2.4
: > x-bar.5
: > x-bar2.5
: > x-baz.6
: > x-baz2.6

$ACLOCAL
$AUTOCONF
$AUTOMAKE

grep '^install-man1:' Makefile.in | grep '\$(man_MANS)'
grep '^install-man2:' Makefile.in | grep '\$(dist_man_MANS)'
grep '^install-man3:' Makefile.in | grep '\$(nodist_man_MANS)'
grep '^install-man4:' Makefile.in | grep '\$(notrans_man_MANS)'
grep '^install-man5:' Makefile.in | grep '\$(notrans_dist_man_MANS)'
grep '^install-man6:' Makefile.in | grep '\$(notrans_nodist_man_MANS)'
grep '^install-man8:' Makefile.in && exit 1
grep '^install-man9:' Makefile.in && exit 1

cwd=$(pwd) || fatal_ "getting current working directory"

./configure --program-prefix=gnu- --prefix "$cwd"/inst \
                                  --mandir "$cwd"/inst/man
$MAKE
$MAKE test-install
test $(find inst/man -type f -print | wc -l) -eq 24
$MAKE uninstall
test $(find inst/man -type f -print | wc -l) -eq 0

# Opportunistically test for installdirs.
rm -rf inst
$MAKE installdirs
test -d inst/man/man1
test -d inst/man/man2
test -d inst/man/man3
test -d inst/man/man4
test -d inst/man/man5
test -d inst/man/man6
test -d inst/man/man7
test -d inst/man/man8 && exit 1
test -d inst/man/man9 && exit 1

:


<reponame>mwasilew/conductor<gh_stars>0
#!/bin/bash

REPOSITORY_DIR=""
REPOSITORY_REMOTE=origin
COMMIT_MESSAGE="upgrade/rollback testing"

usage() {
    echo "Usage: $0 [-d <repository_dir>] [-r <repository_remote>]
                    [-m <commit message>]" 1>&2
    exit 1
}

while getopts "d:r:m:" o; do
  case "$o" in
    # The current working directory will be used by default.
    # Use '-p' specify partition that used for fio test.
    d) REPOSITORY_DIR="${OPTARG}" ;;
    r) REPOSITORY_REMOTE="${OPTARG}" ;;
    m) COMMIT_MESSAGE="${OPTARG}" ;;
    *) usage ;;
  esac
done

cd "${REPOSITORY_DIR}"
git checkout master
git commit --allow-empty -m "${COMMIT_MESSAGE}"
git push "${REPOSITORY_REMOTE}" master


<reponame>gbv/cocoda-services<filename>update.sh<gh_stars>1-10
#!/bin/bash -e

function usage {
  echo "Usage: $0 <name> | all"
  echo "Pulls updates via git and restarts service"
}

. utils.sh

[[ -d "$1/.git" ]] || error "missing $1/.git"

# Update via git
git -C $1 fetch --tags
git -C $1 fetch --all
git -C $1 checkout -- package.json || true # workaround for unwanted changes in package.json if necessary
git -C $1 checkout -- package-lock.json || true # workaround for unwanted changes in package-lock.json if necessary
git -C $1 pull
git -C $1 reset --hard

# Install dependencies
./init.sh $1

# Restart service
./start.sh $1


<gh_stars>0
#!/bin/bash

suite='scraper.scraper_run_test.ScraperRunTest'
tests1="
test_missing_url_elem
test_scraper
test_double
test_detail_page_url_id_field
test_single_standard_id_field
test_double_standard_id_field
"
tests2="
test_standard_update_field
test_standard_update_field_update
test_save_to_db
test_save_to_db_non_model_attribute
test_testmode
test_task_run_type
"
tests3="
test_no_task_run_type
test_runtime_config_max_items_read
test_runtime_config_max_items_save
test_max_items_read
test_max_items_save
test_missing_mandatory
"
tests4="
test_unicode_standard_field_main_page
test_unicode_standard_field_detail_page
test_scraper_pause_status
test_scraper_inactive_status
"

for (( i = 1; i <= 4; i++ ))
do
  var="tests$i"
  for test in `echo ${!var}`
  do
      echo $suite.$test
      python manage.py test $suite.$test &
      sleep 0.2
  done
  wait
done


#!/usr/bin/env bash
REPO_ROOT=$(git rev-parse --show-toplevel)
export REPO_ROOT

function die() {
  echo "!! $*"
  exit 1
}

function need() {
  which "$1" &>/dev/null || die "Binary '$1' is missing but required"
}

function load_env() {
  if [ "$(uname)" == "Darwin" ]; then
    set -a
    # shellcheck disable=SC1091
    source "${REPO_ROOT}/.secrets.env"
    set +a
  else
    # shellcheck disable=SC1091
    source "${REPO_ROOT}/.secrets.env"
  fi
}


<gh_stars>1-10
#!/bin/bash

function echo_good
{
	echo -e "\033[32m$1\033[0m\c"
}

function echo_bad
{
	echo -e "\033[31m$1\033[0m\c"
}

function echo_success
{
	echo_good "[SUCCESS]"
	echo " $1"
}

function echo_failure
{
	echo_bad "[FAILURE]"
	echo " $1"
	exit -1
}

# Function taken from Meta Stack Overflow (https://meta.stackoverflow.com)
# Author: <NAME> (profile: https://stackoverflow.com/users/7552/glenn-jackman)
# Original article: https://stackoverflow.com/a/14367368
function is_in_array
{
    local array="$1[@]"
    local seeking=$2
    local in=1
    for element in "${!array}"; do
        if [[ $element == $seeking ]]; then
            in=0
            break
        fi
    done
    return $in
}

######################
# Display quick help #
######################
clear;
echo "Quick help:";
echo "  - This script is meant to be submit as follows: './submit.sh LANGUAGE IMPLEMENTATION SIZE OUTPUT_FILE'";
echo "  - LANGUAGE = 'c' | 'f'";
echo "  - IMPLEMENTATION = 'cpu' | 'gpu'";
echo "  - SIZE = 'small' | 'big'";
echo "  - OUTPUT_FILE = the path to the file in which store the output.";
echo "  - Example: to submit the C CPU version on the small dataset, submit './submit.sh c cpu small'.";
echo "";

echo "Command executing this script: $0 $@"

#################################
# Check the number of arguments #
#################################
if [ "$#" -eq "4" ]; then
	echo_success "Correct number of arguments received."
else
	echo_failure "Incorrect number of arguments received; $# passed whereas 4 are expected. Please refer to the quick help above."
fi

#############################################
# Check that the language passed is correct #
#############################################
languages=("c" "f");
all_languages=`echo ${languages[@]}`;
is_in_array languages $1
language_retrieved=$?;
if [ "${language_retrieved}" == "0" ]; then
	echo_success "The language passed is correct ('$1').";
else
	echo_failure "The language '$1' is unknown. It must be one of: ${all_languages}.";
fi

###################################################
# Check that the implementation passed is correct #
###################################################
implementations=("cpu" "gpu");
all_implementations=`echo ${implementations[@]}`;
is_in_array implementations $2
implementation_retrieved=$?;
if [ "${implementation_retrieved}" == "0" ]; then
	echo_success "The implementation passed is correct (\"$2\").";
else
	echo_failure "The implementation '$2' is unknown. It must be one of: ${all_implementations}.";
fi

#########################################
# Check that the size passed is correct #
#########################################
sizes=("small" "big");
all_sizes=`echo ${sizes[@]}`;
is_in_array sizes $3
size_retrieved=$?;
if [ "${size_retrieved}" == "0" ]; then
	echo_success "The size passed is correct (\"$3\").";
else
	echo_failure "The size '$3' is unknown. It must be one of: ${all_sizes}.";
fi

#########################################################
# Check that the corresponding submission script exists #
#########################################################
reference_file="./reference/$1/$2_$3.txt";
if [ -f "${reference_file}" ]; then
	echo_success "The corresponding reference file \"${reference_file}\" has been found."
else
	echo_failure "The corresponding reference file \"${reference_file}\" has not been found."
fi

reference_iterations_string=`cat ${reference_file} | grep "Iteration" | cut -d ' ' -f 3`;
reference_iterations=($reference_iterations_string)
reference_iterations_count=${#reference_iterations[@]}
reference_iteration_achieved=`cat ${reference_file} | grep "iterations" | cut -d ' ' -f 10`;

iterations_to_verify_string=`cat $4 | grep "Iteration" | cut -d ' ' -f 3`;
iterations_to_verify=($iterations_to_verify_string)
if [ ! "${iterations_to_verify_string}" ]; then
	echo_failure "No iteration found in your file \"${reference_file}\"."
fi
iterations_to_verify_count=${#reference_iterations[@]}
iterations_to_verify_achieved=`cat $4 | grep "iterations" | cut -d ' ' -f 10`;

iteration=0
for i in ${!iterations_to_verify[@]}; do
	if [ ${i} -ge ${reference_iterations_count} ]; then
		echo_success "Your version ran more iterations than the reference; keep in mind that the extra iterations your program has run could not be checked against the reference. However, iterations are compared with an accuracy to the 18th decimal, it is therefore unlikely your code matches the reference output perfectly and all of a suddent turns out to be completely incorrect for the following iterations; the inaccuracy in the temperature change caused by an error in the code would have built up and become visible by then."
		break;
	fi
	if [ ! "${reference_iterations[$i]}" = "${iterations_to_verify[$i]}" ]; then
		echo_failure "Iteration ${iteration} differs: ${reference_iterations[$i]} (reference) vs ${iterations_to_verify[$i]} (you)";
	fi
	let iteration="${iteration} + 25";
done

echo_success "All iterations compared are identical to the reference."
echo_success "Number of iterations achieved: ${reference_iteration_achieved} (reference) vs ${iterations_to_verify_achieved} (you).";


#!/bin/bash -ex

VENV=_virtualenv

if [ ! -d $VENV ]; then
        virtualenv --no-site-packages $VENV
        source $VENV/bin/activate

        pip install sphinx

        deactivate
fi

source $VENV/bin/activate

cd doc
make html
make latexpdf

deactivate


#!/bin/sh
rm -f *~ tmp* movie.gif movie.avi movie.mpeg


<filename>path.sh
# Be sure to change this value accordingly
export KALDI_ROOT=/vol/tensusers4/ctejedor/lanewcristianmachine/opt/kaldi

# SRILM is needed for LM model building
SRILM_ROOT=$KALDI_ROOT/tools/srilm
SRILM_PATH=$SRILM_ROOT/bin:$SRILM_ROOT/bin/i686-m64
export PATH=$PATH:$SRILM_PATH

[ -f $KALDI_ROOT/tools/env.sh ] && . $KALDI_ROOT/tools/env.sh
export PATH=$PWD/utils/:$KALDI_ROOT/tools/openfst/bin:$PWD:$PATH
[ ! -f $KALDI_ROOT/tools/config/common_path.sh ] && echo >&2 "The standard file $KALDI_ROOT/tools/config/common_path.sh is not present -> Exit!" && exit 1
. $KALDI_ROOT/tools/config/common_path.sh

export LC_ALL=C


#!/bin/bash

source /vagrant/env.sh
INTFACE=eth0

python /vagrant/vxlan_tool.py -i ${INTFACE} --do=forward -v on | tee ${HOME}/vxlan_tool.log


#!/bin/bash

_CURR_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
rm -rf ./gh-pages .cache

yq w workshop.yaml -s workshop-attributes.yaml > workshop-site.yaml

antora --pull --stacktrace  workshop-site.yaml

open gh-pages/index.html


<reponame>mizchi-sandbox/my-native-dom
# Ensure development-speecific code is stripped from the bundle
mkdir -p dom/dist

export NODE_ENV=production

# Build the main thread bundle
react-native bundle \
  --config $(pwd)/rn-cli.config.js \
  --dev false \
  --platform dom \
  --entry-file ./dom/bootstrap.js \
  --assets-dest ./dom/dist \
  --bundle-output ./dom/dist/bootstrap.bundle

# Build the JS thread bundle
react-native bundle \
  --config $(pwd)/rn-cli.config.js \
  --dev false \
  --entry-file ./dom/entry.js \
  --platform dom \
  --bundle-output ./dom/dist/entry.bundle \
  --assets-dest ./dom/dist

# Copy the index.html file to the build destination
cp dom/index.html dom/dist/index.html


<gh_stars>0
#!/bin/bash
# Copyright (c) The Dijets Core Contributors
# SPDX-License-Identifier: Apache-2.0

# A script to check stability of a verification outcome. This runs the same prover
# task N times with different random seeds and checks whether the produced output
# (diagnosis or success) stays stable. Use as in
#
#     check_stability.sh <move-source> N
#
# TODO: we should add here some logic to measure and compare verification timing.

set -e

PROVER="cargo run -q -p move-prover --release -- -v=error --stable-test-output"
BASELINE="check_stability.out"

$PROVER $1 > $BASELINE 2>&1 || true
for n in $(seq 1 $2); do
  rand=$RANDOM
  echo "experiment #$n with seed $rand"
  mv $BASELINE $BASELINE.last
  $PROVER --seed=$rand $1 > $BASELINE 2>&1 || true
  if [[ $(diff $BASELINE.last $BASELINE) ]]; then
    echo "not stable"
    exit 1
  fi
done


<gh_stars>0
#!/bin/sh
set -e

get_task_definition() {
  task_name=$1

  # Thoses keys are returned by the Amazon ECS DescribeTaskDefinition, but are not valid fields when registering a new task definition
  keys_to_omit=".compatibilities, .taskDefinitionArn, .requiresAttributes, .revision, .status, .registeredBy, .registeredAt"

  returned_task_definition=$(aws ecs describe-task-definition --task-definition "${task_name}" | jq .taskDefinition | jq "del($keys_to_omit)")
  if [ -z "${returned_task_definition}" ]; then
    echo "ERROR: aws ecs describe-task-definition returned a bad value."; exit 1
  fi
}

set_outputs() {
  should_deploy=$1
  task_definition=$2
  running_stable_task_definition=$3

  echo "::set-output name=should_deploy::$should_deploy"

  output_path="/tmp/task-definition.$INPUT_SERVICE.json"
  echo "$task_definition" > "$output_path"
  echo "::set-output name=path::$output_path"

  if [ -n "$running_stable_task_definition" ]; then
    stable_output_path="/tmp/task-definition.stable.json"
    echo "$running_stable_task_definition" > "$stable_output_path"
    echo "::set-output name=current_stable_task_definition_path::$stable_output_path"
  fi
}

pretty_print_task_definition() {
  task_definition=$1
  task_definition=$(echo "$task_definition" | jq -S '.containerDefinitions[].environment |= sort_by(.name) | .containerDefinitions[].secrets |= sort_by(.name)')
  echo "$task_definition"
}

container_definitions=$(sed -e "s+<IMAGE>+$INPUT_IMAGE+g;" -e "s+<CLUSTER>+$INPUT_CLUSTER+g;" "$INPUT_CONTAINER_DEFINITIONS_PATH")
container_definitions=$(
  echo "$container_definitions" | \
  jq '. | map(if has("portMappings") then .portMappings |= map(if .hostPort == null then .hostPort = .containerPort else . end) else . end)'
)

if [ -f "$INPUT_SECRETS_PATH" ]; then
  echo "Appending secrets for service $INPUT_SERVICE"
  container_definitions=$(echo "$container_definitions" | jq --slurpfile secrets "$INPUT_SECRETS_PATH" '(.[] | .secrets) = $secrets[]')
fi

get_task_definition "$(echo "${INPUT_CLUSTER}_${INPUT_SERVICE}" | tr - _)"
latest_task_definition=$returned_task_definition
new_task_definition=$(echo "$latest_task_definition" | jq --argjson container_defs "$container_definitions" '.containerDefinitions = $container_defs')

if [ -n "$CURRENT_STABLE_TASKDEF_ARN" ]; then
  # The variable has a trailing '\\n' - probably because it is stored as an environnement variable.
  get_task_definition "$(echo "${CURRENT_STABLE_TASKDEF_ARN}" | tr  -d '\n')"
  current_stable_taskdef="$returned_task_definition"

  current_tmp="$(mktemp)"; pretty_print_task_definition "$current_stable_taskdef" > "$current_tmp"
  new_tmp="$(mktemp)"; pretty_print_task_definition "$new_task_definition" > "$new_tmp"

  if cmp -s "$current_tmp" "$new_tmp"; then
    echo "The task definition has not changed. Deployment will be skipped."
    set_outputs "false" "$latest_task_definition" "$current_stable_taskdef"
    exit 0
  else
    echo "::group::Diff between the current running task definition and the new one"
    echo "Current task definition:                                           New task definition diff:"
    diff -y -t --left-column "$current_tmp" "$new_tmp" || true # true prevents exit code 1
    echo "::endgroup::"

    set_outputs "true" "$new_task_definition" "$current_stable_taskdef"
    exit 0
  fi
fi

set_outputs "true" "$new_task_definition" ""


<reponame>cramjaco/Nyvac_096_Microbiome
#!/bin/bash
# modified from from https://gist.github.com/matsen/4263955
cd ../figures
# figure 1
inkscape --without-gui --export-png="useiggs.png" --export-dpi 900 useiggs.svg
convert -compress LZW -alpha remove useiggs.png useiggs.tiff
mogrify -alpha off useiggs.tiff
mv useiggs.tiff numbered/figure1.tiff
rm useiggs.png

# figure 2
convert -compress LZW -alpha remove wunifrac_Agp41_Bgp120_pcoa.png numbered/figure2.tiff

# figure 3

convert -compress LZW -alpha remove stacked_bars.png numbered/figure3.tiff

# figure 4

convert -compress LZW -alpha remove phi_heatmap_withlegend.png numbered/figure4.tiff

cd ../scripts


<gh_stars>0
#!/bin/sh

cat <<EOT >> /etc/one/oned.conf
VM_HOOK = [
   name      = "on_failure_recreate",
   on        = "STOP",
   command   = "/usr/bin/env onevm delete --recreate",
   arguments = "$ID $TEMPLATE" ]

HOST_HOOK = [
    name      = "host_error",
    on        = "DISABLE",
    command   = "/var/lib/one/remotes/hooks/ft/host_error.rb",
    arguments = "$ID -r",
    remote    = "no" ]
EOT

sunstone-server restart
econe-server restart
occi-server restart
onegate-server restart
one restart
sudo service opennebula restart


<filename>build.sh
#!/bin/sh
docker build admin/ -t litbox-admin
docker build tunnel/ -t litbox-tunnel
docker build tor/ -t litbox-tor
docker build admin-go/ -t litbox-admin-go


<gh_stars>1-10
[ -f $HOME/.zsh/antigen.zsh ] && source $HOME/.zsh/antigen.zsh
antigen use oh-my-zsh

antigen bundle git
antigen bundle ruby
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle gusaiani/elixir-oh-my-zsh

# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting

# Load the theme.
antigen theme robbyrussell
antigen theme bhilburn/powerlevel9k powerlevel9k

antigen apply


<filename>ubuntu_settings/vim_setting.sh
#!/bin/bash
###-- this file mainly set the environment for 'vim' --###

# ============== install vim ================= #
sudo apt-get install vim-gnome # (with clipboard function)

# ======== change some contents in .vimrc ======== #
# enable the clipboard among all terminal
echo 'set clipboard^=unnamed' >> ~/.vimrc

# change indent for 4 spaces
# Source: https://stackoverflow.com/questions/234564/tab-key-4-spaces-and-auto-indent-after-curly-braces-in-vim
echo 'filetype plugin indent on' >> ~/.vimrc
echo '" show existing tab with 4 spaces width ' >> ~/.vimrc
echo 'set tabstop=4' >> ~/.vimrc
echo '" when indenting with '>', use 4 spaces width' >> ~/.vimrc
echo 'set shiftwidth=4' >> ~/.vimrc
echo '" On pressing tab, insert 4 spaces' >> ~/.vimrc
echo 'set expandtab' >> ~/.vimrc


<reponame>glasgowneuro/attys-comm
#!/bin/sh
rm -rf cmake_install.cmake libattyscomm.so*
rm -rf dist pyattyscomm_wrap.cpp pyattyscomm_wrap.h __pycache__ pyattyscomm.egg-info build pyattyscomm.py
rm -rf CMakeCache.txt CMakeFiles


<filename>bin/eval-conll05-elmo.sh
#!/usr/bin/env bash
#
# Usage: ./eval-conll05.sh [model_dir] (regular|dm|gold)

model_dir=$1
parse_config=$2

data_dir=$DATA_DIR/conll05st-release-new

valid_file=$data_dir/dev-set.gz.parse.sdeps.combined.bio
valid_props_file=$data_dir/conll2005-dev-gold-props.txt
valid_parse_file=$data_dir/conll2005-dev-gold-parse.txt

# WSJ test
wsj_test_file=$data_dir/test.wsj.gz.parse.sdeps.combined.bio
wsj_test_props_file=$data_dir/conll2005-test-wsj-gold-props.txt
wsj_test_parse_file=$data_dir/conll2005-test-wsj-gold-parse.txt

# Brown test
brown_test_file=$data_dir/test.brown.gz.parse.sdeps.combined.bio
brown_test_props_file=$data_dir/conll2005-test-brown-gold-props.txt
brown_test_parse_file=$data_dir/conll2005-test-brown-gold-parse.txt

# D&M injected
#dm_valid_file=lstm_predicted_parses_elmo/parse_preds-conll2005-lstm-dev24.tsv.replaced
#dm_wsj_test_file=lstm_predicted_parses_elmo/parse_preds-conll2005-lstm-test.tsv.replaced
#dm_brown_test_file=lstm_predicted_parses_elmo/parse_preds-conll2005-lstm-test-brown.tsv.replaced
dm_valid_file=lstm_predicted_parses_elmo_new/parse_preds-conll2005-lstm-dev24.tsv.replaced
dm_wsj_test_file=lstm_predicted_parses_elmo_new/parse_preds-conll2005-lstm-test.tsv.replaced
dm_brown_test_file=lstm_predicted_parses_elmo_new/parse_preds-conll2005-lstm-test-brown.tsv.replaced

if [[ "$parse_config" == "dm" || "$parse_config" == "gold" ]]; then
    gold_attn_at_train="False"
    inject_manual_attn="True"
    if [[ "$parse_config" == "dm" ]]; then
        echo "Doing D&M eval"
        valid_file=$dm_valid_file
        wsj_test_file=$dm_wsj_test_file
        brown_test_file=$dm_brown_test_file
    else
        echo "Doing Gold eval"
    fi
else
    echo "Doing regular eval"
    gold_attn_at_train="True"
    inject_manual_attn="True"
fi

# Dev only
#python $DOZAT_ROOT/network.py \
#    --load \
#    --test \
#    --load_dir $model_dir \
#    --config_file $model_dir/config.cfg \
#    --gold_attn_at_train $gold_attn_at_train \
#    --inject_manual_attn $inject_manual_attn \
#    --valid_file $valid_file \
#    --test_file $wsj_test_file \
#    --gold_test_props_file $wsj_test_props_file \
#    --gold_dev_parse_file $valid_parse_file \
#    --gold_test_parse_file $wsj_test_parse_file
#
#cp $model_dir/srl_preds.tsv $model_dir/${parse_config}_dev_srl_preds.tsv
#cp $model_dir/parse_preds.tsv $model_dir/${parse_config}_dev_parse_preds.tsv

# WSJ test
python $DOZAT_ROOT/network.py \
    --load \
    --test \
    --test_eval \
    --load_dir $model_dir \
    --config_file $model_dir/config.cfg \
    --gold_attn_at_train $gold_attn_at_train \
    --inject_manual_attn $inject_manual_attn \
    --valid_file $valid_file \
    --test_file $wsj_test_file \
    --gold_test_props_file $wsj_test_props_file \
    --gold_dev_parse_file $valid_parse_file \
    --gold_test_parse_file $wsj_test_parse_file \
    --max_dev_batch_size 246 #183

# Brown test
python $DOZAT_ROOT/network.py \
    --load \
    --test \
    --test_eval \
    --load_dir $model_dir \
    --config_file $model_dir/config.cfg \
    --gold_attn_at_train $gold_attn_at_train \
    --inject_manual_attn $inject_manual_attn \
    --valid_file $valid_file \
    --test_file $brown_test_file \
    --gold_test_props_file $brown_test_props_file \
    --gold_dev_parse_file $valid_parse_file \
    --gold_test_parse_file $brown_test_parse_file \
    --max_dev_batch_size 246 #183


<filename>bin/in-container/get-circle-ci-executor.sh
#!/usr/bin/env bash

SCRIPT_DIR_NAME="$( cd "$( dirname "$0" )" && pwd )"

usage() {
    echo "usage: $(basename "$0")" >&2
}

while true
do
    case "$(echo "${1:-}" | tr "[:upper:]" "[:lower:]")" in
        --help)
            shift
            usage
            exit 0
            ;;
        *)
            break
            ;;
    esac
done

if [ $# != 0 ]; then
    usage
    exit 1
fi

REPO_ROOT_DIR=$("${SCRIPT_DIR_NAME}/repo-root-dir.sh")

grep 'image:' < "${REPO_ROOT_DIR}/.circleci/config.yml" | \
    tail -1 | \
    sed -e 's|^.*\-[[:space:]]*image\:[[:space:]]*||g' |
    sed -e 's|[[:space:]]*$||g'

exit 0


<reponame>leegoway/LNMP-docker<gh_stars>0
pwd=`<PASSWORD>`
redis=$pwd/redis

# --net=dev \
docker run \
-tid \
--name redis \
-h redis \
--privileged \
-p 6379:6379 \
-v $redis/conf:/etc/redis \
-v $redis/data:/var/lib/redis \
-v $redis/log:/var/log/redis \
leego/redis \
/sbin/init
sleep 2
docker exec -it redis  /bin/bash -c "redis-server /etc/redis/6379.conf"
echo "Reids starting: OK"


#!/bin/bash

echo '
   _______________  ___    ____
  / ___/_  __/ __ \/   |  / __ \
  \__ \ / / / /_/ / /| | / /_/ /
 ___/ // / / _, _/ ___ |/ ____/
/____//_/ /_/ |_/_/  |_/_/ '

echo -e '\nStrap Kit Dependency Checker'
MISSINGDEPS=0

show_error() {
    MISSINGDEPS=1
    red='\033[0;31m'
    NC='\033[0m' # No Color

    echo -e ${red}$1${NC}
}

green_highlight() {

    green='\033[0;32m'
    NC='\033[0m' # No Color
    echo -e ${green}$1 ${NC}
}

green_highlight "+ Checking CORE requirements (for strapkit)"
echo "==============================="
echo 'Checking git...'
(which git && green_highlight "`git --version`\ngit is installed"|| (show_error 'git was not found.'))
echo "==============================="
echo 'Checking NodeJS...'
(which node && green_highlight "`node --version`\nNode is installed" || (which nodejs && alias node=nodejs;echo 'Node is installed' `node --version` || (show_error 'node or nodejs were not found')))
echo "==============================="
echo 'Checking npm...'
(which npm && green_highlight "`npm --version`\nnpm is installed" || (show_error 'npm was not found.'))
echo "==============================="
echo 'Checking python...'
(which python && green_highlight "`python --version`Python is installed" || (show_error 'python was not found'))
echo "==============================="
green_highlight '+ Checking PLATFORM requirements (not required for strapkit to run, but required for platform builds)'
echo "==============================="
echo "==============================="
echo "     Pebble dependencies       "
echo "==============================="
echo 'Checking Pebble SDK'
(which pebble && green_highlight "Pebble SDK is installed.`pebble --version`" || (show_error 'Pebble SDK was not found'))
echo "==============================="
echo "  ANDROID WEAR dependencies    "
echo "==============================="
echo 'Checking adb'
(which adb && green_highlight "`adb version`\nadb is installed." || (show_error 'adb was not found.'))
echo "==============================="
echo 'Checking android'
(which android && green_highlight "android is installed." || (show_error '!!! android was not found.'))
echo "==============================="
echo 'Checking ANDROID_HOME env variable'
if [ "$ANDROID_HOME" ]; then green_highlight 'ANDROID_HOME is set.'; else show_error '!!! ANDROID_HOME is not set.'; fi
echo "==============================="
echo 'Checking JAVA_HOME env variable'
if [ "$JAVA_HOME" ]; then green_highlight 'JAVA_HOME is set.'; else show_error '!!! JAVA_HOME is not set.'; fi

echo "+++++++++++++++++++++++++++++++"
echo "++++++      RESULTS      ++++++"
echo "+++++++++++++++++++++++++++++++"
([ $MISSINGDEPS -ne 0 ] && show_error '!!! One or more dependencies were not found. Visit https://docs.straphq.com for more info on setting up the dependencies.' || echo 'Congrats, your machine is ready for some live action.')
echo -e "\n"


<filename>scripts/release/createAndUploadDocsReleaseBundle.sh
#!/usr/bin/env bash

if [ "$#" -lt 1 ]
  then
    echo "You must supply a release version number"
    echo "For example: ./scripts/release/createAndUploadDocsReleaseBundle.sh 19.1.2"
    exit 1
fi

TIMESTAMP=`date +%Y%m%d`

RAW_VERSION=$1
VERSION=""${RAW_VERSION//./}""

FILENAME=release_"$TIMESTAMP"_v"$VERSION".zip

./scripts/release/createDocsReleaseBundle.sh $RAW_VERSION
./scripts/release/uploadReleaseZip.sh $FILENAME

./scripts/release/archiveCurrentRelease.sh
./scripts/release/prepareNewDeployment.sh $FILENAME
./scripts/release/switchRelease.sh $TIMESTAMP


# -----------------------------------------------------------------------------
# This file is part of the xPack distribution.
#   (https://xpack.github.io)
# Copyright (c) 2020 <NAME>.
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose is hereby granted, under the terms of the MIT license.
# -----------------------------------------------------------------------------

# Helper script used in the second edition of the xPack build
# scripts. As the name implies, it should contain only functions and
# should be included with 'source' by the container build scripts.

# -----------------------------------------------------------------------------

# https://github.com/ninja-build/ninja/wiki
# https://sourceforge.net/projects/msys2/files/REPOS/MSYS2/Sources/ninja-1.10.0-1.src.tar.gz/download

function build_ninja()
{
  local ninja_version="$1"

  # https://ninja-build.org
  # https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz

  # https://archlinuxarm.org/packages/aarch64/ninja/files/PKGBUILD

  local ninja_src_folder_name="ninja-${ninja_version}"
  local ninja_folder_name="${ninja_src_folder_name}"

  mkdir -pv "${LOGS_FOLDER_PATH}/${ninja_folder_name}"

  cd "${SOURCES_FOLDER_PATH}"

  if [ ! -d "${SOURCES_FOLDER_PATH}/${ninja_src_folder_name}" ]
  then
    (
      cd "${SOURCES_FOLDER_PATH}"
      git_clone "${NINJA_GIT_URL}" "${NINJA_GIT_BRANCH}" \
          "${NINJA_GIT_COMMIT}" "${ninja_src_folder_name}"
    )
  fi

  (
    mkdir -p "${BUILD_FOLDER_PATH}/${ninja_folder_name}"
    cd "${BUILD_FOLDER_PATH}/${ninja_folder_name}"

    # xbb_activate_installed_dev

    # CPPFLAGS="${XBB_CPPFLAGS}"
    CFLAGS="$(echo ${XBB_CPPFLAGS} ${XBB_CFLAGS_NO_W} | sed -e 's|-O[0123s]||')"
    CXXFLAGS="$(echo ${XBB_CPPFLAGS} ${XBB_CFLAGS_NO_W} | sed -e 's|-O[0123s]||')"
    if [ "${TARGET_PLATFORM}" == "win32" ]
    then
      CFLAGS+=" -DUSE_WIN32_CMD_EXE_TO_CREATE_PROCESS"
      CXXFLAGS+=" -DUSE_WIN32_CMD_EXE_TO_CREATE_PROCESS"
    fi
    LDFLAGS="$(echo ${XBB_CPPFLAGS} ${XBB_LDFLAGS_APP_STATIC_GCC} | sed -e 's|-O[0123s]||')"
    if [ "${TARGET_PLATFORM}" == "linux" ]
    then
      LDFLAGS+=" -Wl,-rpath,${LD_LIBRARY_PATH}"
    fi

    export CFLAGS
    export CXXFLAGS
    export LDFLAGS

    local build_type
    if [ "${IS_DEBUG}" == "y" ]
    then
      build_type=Debug
    else
      build_type=Release
    fi

    if true # [ ! -f "CMakeCache.txt" ]
    then
      (
        if [ "${IS_DEVELOP}" == "y" ]
        then
          env | sort
        fi

        echo
        echo "Running ninja configure..."

        config_options=()

        # With ninja, the windows build fails with:
        # The install of the ninja target requires changing an RPATH from the build
        # tree, but this is not supported with the Ninja generator
        config_options+=("-G" "Unix Makefiles")

        config_options+=("-DCMAKE_BUILD_TYPE=${build_type}")

        if [ "${TARGET_PLATFORM}" == "win32" ]
        then
            config_options+=("-DWIN32=ON")
        fi

        if [ "${IS_DEBUG}" == "y" ]
        then
          config_options+=("-DCMAKE_VERBOSE_MAKEFILE=ON")
        fi

        config_options+=("-DCMAKE_INSTALL_PREFIX=${APP_PREFIX}")

        run_verbose_timed cmake \
          ${config_options[@]} \
          \
          "${SOURCES_FOLDER_PATH}/${ninja_src_folder_name}" \

      ) 2>&1 | tee "${LOGS_FOLDER_PATH}/${ninja_folder_name}/cmake-output.txt"
    fi

    (
      echo
      echo "Running ninja build..."

      run_verbose_timed cmake \
        --build . \
        --parallel ${JOBS} \
        --verbose \
        --config "${build_type}" \

      if [ "${TARGET_PLATFORM}" != "win32" ]
      then
        run_verbose_timed ctest -vv
      fi

      # The install target is not funtional:
      mkdir -pv "${APP_PREFIX}/bin"
      if [ "${TARGET_PLATFORM}" == "win32" ]
      then
        install -v -m755 -c ninja.exe "${APP_PREFIX}/bin"
      else
        install -v -m755 -c ninja "${APP_PREFIX}/bin"
      fi

    ) 2>&1 | tee "${LOGS_FOLDER_PATH}/${ninja_folder_name}/build-output.txt"

    copy_license \
      "${SOURCES_FOLDER_PATH}/${ninja_src_folder_name}" \
      "${ninja_folder_name}"

  )

  tests_add "test_ninja"
}

# -----------------------------------------------------------------------------

function test_ninja()
{
  if [ -d "xpacks/.bin" ]
  then
    NINJA="xpacks/.bin/ninja"
  elif [ -d "${APP_PREFIX}/bin" ]
  then
    NINJA="${APP_PREFIX}/bin/ninja"
  else
    echo "Wrong folder."
    exit 1
  fi

  echo
  echo "Checking the ninja shared libraries..."
  show_libs "${NINJA}"

  echo
  echo "Checking if ninja starts..."

  run_app "${NINJA}" --version

  run_app "${NINJA}" --help || true
}

# -----------------------------------------------------------------------------


<reponame>kayoub5/tcpdump-htdocs
#!/bin/sh

# This script regenerates (updates but not commits) tcpdump, libpcap and
# tcpslice man pages for the www.tcpdump.org web-site. It is intended to be
# run in tcpdump-htdocs git repository clone with the source man pages
# available in ../tcpdump, ../libpcap and ../tcpslice git clones respectively.
#
# A number of man pages in the tcpdump and libpcap repositories require
# autotools processing, so if you have just updated any .in files there,
# remember to run ./config.status (or even ./configure for complex changes) in
# that working tree before running this script in this working tree.
#
# This script has been tested to work on the following Linux systems:
#
# * Fedora 24
# * Fedora 25
# * Fedora 28
# * Fedora 30
# * Fedora 32
# * Fedora 34 <--- please use this one
# * Ubuntu 16.04
# * Ubuntu 18.04
# * Ubuntu 20.04 <--- or this one
#
# Please mind that the generated contents of the .txt files may change much
# more than respective source man pages, sometimes even when the source man
# pages didn't change at all. Specifically, the amount of whitespace and
# hyphenation may fluctuate for no obvious reason when this script runs on a
# different distribution or a different version of the same distribution or
# even on the same system as the previous time! Do not worry about it as long
# as the source man pages are the newest you can get from git.

MAN2HTML_PFX=/cgi-bin/man/man2html
WEBSITE_PFX=.

# Both Fedora and Ubuntu man2html versions prepend their output with a
# Content-type header. Only the Ubuntu version generates a document type
# declaration. For consistent and valid results replace everything before
# the  tag with an explicit hard-coded <!DOCTYPE ...> line.
stripContentTypeHeader()
{
	echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'
	sed -n '/^<TITLE>/,$p'
}

# Most (but not all) of the generated HTML files have a short useless
# "Index" section near EOF.
stripIndexSection()
{
	case $(basename "${1:?}") in
	tcpdump.1|tcpslice.1|pcap.3pcap)
		cat
		;;
	*)
		sed '/^/,/^
/d' | sed 's@Index@@'
		;;
	esac
}

printSedFile()
{
	# Fixup custom links.
	# Suppress some output difference between Fedora and Ubuntu versions of man2html.
	# Convert file:// schema hyperlinks to plain text.
	# Customize the page footer.
	cat <<ENDOFFILE
s@Return to Main Contents@Return to Main Contents@g
s@man2html@man2html@g
s@^<TITLE>Manpage of @<TITLE>Man page of @
s@@<LINK REL="stylesheet" type="text/css" href="../style_manpages.css">\n@
s@@<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n@
s@
@
Man page of @
s@\(.*\)@\2@g
s@@[Valid HTML 4.01]\n\0@
s@@[Valid CSS]\n\0@
s/^using the manual pages.
$/using the manual pages from "The Tcpdump Group" git repositories.
/
ENDOFFILE

	# Convert links to non-local pages to plain text.
	printNonLocalManPages | while read -r mansection mantopic; do
		echo "s@$mantopic@$mantopic@g"
	done

	# Fixup links to local pages, part 1.
	while read -r mantopic manfile; do
		echo "s@<A HREF=\"${MAN2HTML_PFX}?${mantopic}\"@<A HREF=\"$manfile\"@g"
	done <<ENDOFLIST
7+pcap-linktype		$WEBSITE_PFX/pcap-linktype.7.html
7+pcap-tstamp		$WEBSITE_PFX/pcap-tstamp.7.html
7+pcap-filter		$WEBSITE_PFX/pcap-filter.7.html
5+pcap-savefile		$WEBSITE_PFX/pcap-savefile.5.html
1+tcpdump		$WEBSITE_PFX/tcpdump.1.html
1+tcpslice		$WEBSITE_PFX/tcpslice.1.html
5+rpcapd-config		$WEBSITE_PFX/rpcapd-config.5.html
8+rpcapd		$WEBSITE_PFX/rpcapd.8.html
ENDOFLIST

	# Fixup links to local pages, part 2.
	print3PCAPMap | while read -r mantopic manfile; do
		manfile="${WEBSITE_PFX}/${manfile:-$mantopic}.3pcap.html"
		# Two substitutions below make up for the new smartness added
		# in man2html-1.6-13.g.fc20.
		echo "s@$mantopic(3PCAP)@$mantopic(3PCAP)@g"
		echo "s@$mantopic(3PCAP)@$mantopic(3PCAP)@g"
		echo "s@$mantopic(3PCAP)@$mantopic(3PCAP)@g"
		echo "s@$mantopic(3PCAP)@$mantopic(3PCAP)@g"
	done
}

print3PCAPMap()
{
	cat <<ENDOFLIST
pcap
pcap_activate
pcap_breakloop
pcap_can_set_rfmon
pcap_close
pcap_compile
pcap_create
pcap_datalink
pcap_datalink_name_to_val
pcap_datalink_val_to_description				pcap_datalink_val_to_name
pcap_datalink_val_to_description_or_dlt				pcap_datalink_val_to_name
pcap_datalink_val_to_name
pcap_dispatch							pcap_loop
pcap_dump
pcap_dump_close
pcap_dump_file
pcap_dump_flush
pcap_dump_fopen							pcap_dump_open
pcap_dump_ftell
pcap_dump_ftell64						pcap_dump_ftell
pcap_dump_open
pcap_file
pcap_fileno
pcap_findalldevs
pcap_fopen_offline						pcap_open_offline
pcap_fopen_offline_with_tstamp_precision			pcap_open_offline
pcap_freealldevs						pcap_findalldevs
pcap_freecode
pcap_free_datalinks						pcap_list_datalinks
pcap_free_tstamp_types						pcap_list_tstamp_types
pcap_get_required_select_timeout
pcap_geterr
pcap_getnonblock						pcap_setnonblock
pcap_get_selectable_fd
pcap_get_tstamp_precision
pcap_init
pcap_inject
pcap_is_swapped
pcap_lib_version
pcap_list_datalinks
pcap_list_tstamp_types
pcap_lookupdev
pcap_lookupnet
pcap_loop
pcap_major_version
pcap_minor_version						pcap_major_version
pcap_next_ex
pcap_next							pcap_next_ex
pcap_offline_filter
pcap_open_dead
pcap_open_dead_with_tstamp_precision				pcap_open_dead
pcap_open_live
pcap_open_offline
pcap_open_offline_with_tstamp_precision				pcap_open_offline
pcap_perror							pcap_geterr
pcap_sendpacket							pcap_inject
pcap_set_buffer_size
pcap_set_datalink
pcap_setdirection
pcap_setfilter
pcap_set_immediate_mode
pcap_setnonblock
pcap_set_promisc
pcap_set_protocol_linux
pcap_set_rfmon
pcap_set_snaplen
pcap_set_timeout
pcap_set_tstamp_precision
pcap_set_tstamp_type
pcap_snapshot
pcap_stats
pcap_statustostr
pcap_strerror
pcap_tstamp_type_name_to_val
pcap_tstamp_type_val_to_description				pcap_tstamp_type_val_to_name
pcap_tstamp_type_val_to_name
ENDOFLIST
}

printNonLocalManPages()
{
	cat <<ENDOFLIST
4P	tcp
4P	udp
4P	ip
4	pf
8	pfconfig
2	select
2	poll
1	autoconf
8	usermod
3	strerror
1	kill
1	stty
1	ps
3	strftime
4	bpf
4P	nit
2	epoll_wait
2	kqueue
2	socket
1	date
3	isatty
3	fileno
1	ECT
2	ioctl
7	packetfilter
2	kevent
2	timerfd_create
ENDOFLIST
}

detectProject()
{
	project_dir=$(dirname "${1:?}")
	project_name=$(basename "$project_dir")
	[ "$project_name" = rpcapd ] && project_dir="$project_dir/.."
	project_version=$(cat "$project_dir/VERSION")
}

BOILERPLATE_BODY='Your system may have a different version installed, possibly with some
local modifications.  To achieve the best results, please make sure this
version of this man page suits your needs.  If necessary, try to look for
a different version on this web site or in the man pages available in your
installation.'

printHTMLBoilerplate()
{
	detectProject "${1:?}"
cat <<ENDOFTEXT

This man page documents ${project_name} version ${project_version}.

$BOILERPLATE_BODY

ENDOFTEXT
}

insertHTMLBoilerplate()
{
	HBTMP=$(mktemp --tmpdir html_boilerplate.XXXXXX)
	printHTMLBoilerplate "${1:?}" >"$HBTMP"
	sed -E "/Return to Main Contents<\/A>
/r $HBTMP"
	rm -f "$HBTMP"
}

produceHTML()
{
	infile=${1:?}
	html_sedfile="${2:?}"
	outfile=${3:?}
	[ -s "$infile" ] || {
		echo "Skipped: $infile, which does not exist or is empty"
		return
	}
	# A possible alternative: mandoc -T html $infile > $outfile
	man2html -M $MAN2HTML_PFX "$infile" | stripContentTypeHeader | \
		insertHTMLBoilerplate "$infile" | \
		stripIndexSection "$infile" | sed --file="$html_sedfile" > "$outfile"
	# If the output file is git-tracked and the new revision is different in
	# timestamp only, discard the new revision.
	git show "$outfile" >/dev/null 2>&1 || {
		echo "Updated but not in repository: $outfile"
		return
	}
	git diff "$outfile" | tail --lines +5 | grep -E '^[-+]' | grep -E -q -v '^[-+]Time: ' || {
		git checkout --quiet "$outfile"
		return
	}
	echo "Updated: $outfile"
}

printTXTBoilerplate()
{
	detectProject "${1:?}"
	echo '+----------------------------------------------------------------------------+'
	while read -r line; do
		printf '| %-74s |\n' "$line"
	done <<ENDOFTEXT

This man page documents ${project_name} version ${project_version}.

$BOILERPLATE_BODY

ENDOFTEXT
	echo '+----------------------------------------------------------------------------+'
	echo
}

produceTXT()
{
	infile=${1:?}
	outfile=${2:?}
	[ -s "$infile" ] || {
		echo "Skipped: $infile, which does not exist or is empty"
		return
	}
	printTXTBoilerplate "$infile" > "$outfile"
	man -E ascii "$infile" >> "$outfile"
	git diff "$outfile" | grep -E -q '^[-+]' && echo "Updated: $outfile"
}

known3PCAPFile()
{
	basename=$(basename "${1:?}" .3pcap)
	print3PCAPMap | while read -r mantopic manfile; do
		if [ "${manfile:-$mantopic}" = "$basename" ]; then
			# Cannot just return 0 or 1 because the while end of
			# the pipe may be in a sub-shell.
			echo 'yes'
			return
		fi
	done
	echo 'no'
}

updateOutputFiles()
{
	command -v man2html >/dev/null 2>&1 || {
		echo "man2html must be installed to proceed"
		exit 1
	}

	# The .txt version of a man page assumes an 80 columns wide terminal,
	# which used to be the default in PC text mode console, xterm etc.
	# Use stty because $COLUMNS doesn't always work.
	cols=$(stty size | cut -d' ' -f2)
	[ "$cols" -ne 80 ] && stty columns 80

	sedfile=$(mktemp --tmpdir manpages_sedfile.XXXXXX)
	printSedFile > "$sedfile"

	produceTXT ../libpcap/pcap-filter.manmisc manpages/pcap-filter.7.txt
	produceTXT ../libpcap/pcap-linktype.manmisc manpages/pcap-linktype.7.txt
	produceTXT ../libpcap/pcap-savefile.manfile manpages/pcap-savefile.5.txt
	produceTXT ../libpcap/pcap-tstamp.manmisc manpages/pcap-tstamp.7.txt
	produceTXT ../libpcap/rpcapd/rpcapd.manadmin manpages/rpcapd.8.txt
	produceTXT ../libpcap/rpcapd/rpcapd-config.manfile manpages/rpcapd-config.5.txt

	produceHTML ../libpcap/pcap-filter.manmisc "$sedfile" manpages/pcap-filter.7.html
	produceHTML ../libpcap/pcap-linktype.manmisc "$sedfile" manpages/pcap-linktype.7.html
	produceHTML ../libpcap/pcap-savefile.manfile "$sedfile" manpages/pcap-savefile.5.html
	produceHTML ../libpcap/pcap-tstamp.manmisc "$sedfile" manpages/pcap-tstamp.7.html
	produceHTML ../libpcap/rpcapd/rpcapd.manadmin "$sedfile" manpages/rpcapd.8.html
	produceHTML ../libpcap/rpcapd/rpcapd-config.manfile "$sedfile" manpages/rpcapd-config.5.html

	for f in ../libpcap/*.3pcap; do
		[ "$(known3PCAPFile "$f")" = 'no' ] && echo "WARNING: file $f is not in the 3PCAP map"
	done

	for f in ../libpcap/*.3pcap ../libpcap/pcap-config.1 ../tcpdump/tcpdump.1 ../tcpslice/tcpslice.1; do
		produceTXT "$f" "manpages/$(basename "$f").txt"
		produceHTML "$f" "$sedfile" "manpages/$(basename "$f").html"
	done

	rm -f "$sedfile"
	[ "$cols" -ne 80 ] && stty columns "$cols"
	return 0
}

updateOutputFiles