<reponame>AstroHuntsman/huntsman-drp
# Setup the LSST bash env
source ${LSST_HOME}/loadLSST.bash

# Use the EUPS package manager to set up required packages
eups declare obs_huntsman v1 -r "${LSST_HOME}/obs_huntsman"
eups declare huntsman_drp v1 -r "${LSST_HOME}/huntsman-drp"
setup obs_huntsman v1
setup huntsman_drp v1
setup display_firefly

# This seems to be the only way of getting the logs to work properly
userid=$(id -u ${USER})
sudo chown ${userid}:${userid} ${HUNTSMAN_LOG_DIR}
sudo chown ${userid}:${userid} ${HUNTSMAN_ARCHIVE}


<filename>generate-workload-with-slo.sh
./burst.sh with-slo 500,500,500


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

OUTPUT=$1

TYPE=1
ICONS=".."

current=$(echo "$(bspc query -D -d --names) - 1" | bc)

icon_set=$(echo ${ICONS} | cut -d'.' -f ${TYPE})
icon=${icon_set:${current}:1}

echo -en "%{T3}${icon}%{T1}" > $OUTPUT


#!/bin/bash
###############################################################################
#
# FIO tools
#
# Created by CryptoLions.io
# Git Hub: https://github.com/fioprotocol/fio.start
#
###############################################################################

# 1000000000 = 1.000000000 FIO

receiverFiopubKey="<KEY>"
from_actor="welcome.fio"
amount="1000000000"
maxfee=2000000000
tpid=""

./clio.sh push action fio.token trnsfiopubky '{"payee_public_key": "'$receiverFiopubKey'","amount": "'$amount'", "max_fee": '$maxfee', "tpid": "'$tpid'", "actor": "'$from_actor'"}' -p $from_actor@active

#Example
#./clio.sh push action fio.token trnsfiopubky '{"payee_public_key": "<KEY>","amount": "1000000000000", "max_fee": 2000000000, "tpid": "", "actor": "welcome.fio"}' -p welcome.fio@active


<gh_stars>1-10
#!/usr/bin/env bash
info() {
	echo INFO: $*
}

bullet() {
	echo "INFO:   -" "$@"
}

has_curl() {
	hash curl 2>/dev/null
}

has_docker() {
	if hash docker 2>/dev/null; then
		local version=$(docker -v | sed 's/^Docker version \([^,]*\),.*/\1/')
		local versionMax=$(printf "$version\n1.9.1" | sort -V | tail -1)
		if [ "$versionMax" = "1.9.1" ]; then
			bullet "docker v1.10+ (missing - $version is too old)"
			return 1
		else
			bullet "docker v1.10+ (found)"
			return 0
		fi
	else
		bullet "docker v1.10+ (missing)"
		return 1
	fi
}

has_docker_compose() {
	if hash docker-compose 2>/dev/null; then
		# this comparison should keep working for a while
		local version=$(docker-compose -v | sed 's/^docker-compose version \([^,]*\),.*/\1/')
		local versionMax=$(printf "$version\n1.5.2" | sort -V | tail -1)
		if [ "$versionMax" = "1.5.2" ]; then
			bullet "docker-compose v1.6+ (missing - $version is too old)"
			return 1
		else
			bullet "docker-compose v1.6+ (found)"
			return 0
		fi
	else
		bullet "docker-compose v1.6+ (missing)"
		return 1
	fi
}

has_docker_group() {
	groups $user | grep &>/dev/null '\bdocker\b'
}

install_curl() {
	info Installing curl...
	sudo apt-get update
	sudo apt-get install -y curl
}

install_docker() {
	info "It's coffee time 'cause this will take a while"
	curl -sSL https://get.docker.com | sudo sh
}

install_docker_compose() {
	bullet "installing docker-compose"
	local release=$(curl -fL https://api.github.com/repos/docker/compose/releases/latest -H 'accept: application/json' 2> /dev/null)
	if [ $? -ne 0 ]; then
		bullet "docker-compose install failed: unable to query for latest available version"
		return 1
	fi
	local latest=$(echo "$release" | grep tag_name | sed -e 's/.*"tag_name":[^"]*"\([^"]*\)".*/\1/')
	if [ "$latest" == "" ]; then
		bullet "docker-compose install failed: unable to determine latest available version"
		return 1
	fi
	curl -L https://github.com/docker/compose/releases/download/$latest/docker-compose-`uname -s`-`uname -m` > /tmp/docker-compose 2> /dev/null
	sudo mv /tmp/docker-compose /usr/local/bin/
	sudo chmod +x /usr/local/bin/docker-compose
}

install_docker_group() {
	info "Granting $user access to run docker commands without sudo. You'll need to re-login for changes to take affect."
	sudo usermod -a -G docker $user
}

tt_install() {
	local user=${SUDO_USER:-$USER}
	local queue=""

	info "checking dependencies:"

	if has_curl; then
		bullet "curl (found)"
	else
		bullet "curl (missing)"
		queue="curl"
	fi

	if ! has_docker; then
		queue="$queue docker"
	fi

	if ! has_docker_compose; then
		queue="$queue docker_compose"
	fi

	if has_docker_group; then
		bullet "user is part of 'docker' group (found)"
	else
		bullet "user is part of 'docker' group (missing)"
		queue="$queue docker_group"
	fi

	if [ ! -z "$queue" ]; then
		echo
		# skip the read (effectively saying "yes") if in a CI environment
		if [ "$CI" != "true" ]; then
			read -n 1 -p "Install missing dependencies? (Y/n)" CONFIRM
		fi

		if [ "$CONFIRM" == "n" -o "$CONFIRM" == "N" ]; then
			echo
			info "You chose not to install required dependencies, there be dragons."
		else
			echo
			for dep in $queue; do
				echo
				"install_$dep"
			done
		fi
	fi
}


#!/bin/sh
# wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/data/hillshade-lu.json

rm -rf ios_bundle; mkdir ios_bundle; cd ios_bundle
wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/data/omt-geoportail-lu.json
wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/fonts/Noto%20Sans%20Regular/0-255.pbf
wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/fonts/Noto%20Sans%20Regular/256-511.pbf
wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/fonts/Noto%20Sans%20Bold/0-255.pbf
wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/fonts/Noto%20Sans%20Bold/256-511.pbf
wget --no-host-directories --force-directories https://vectortiles.geoportail.lu/styles/roadmap/style.json
sed 'sYhttps://vectortiles.geoportail.lu/data/omt-geoportail-lu.jsonYhttp://localhost:8765/data/omt-geoportail-lu.jsonYg' -i styles/roadmap/style.json
sed 'sYhttps://vectortiles.geoportail.lu/fonts/Yhttp://localhost:8765/fonts/Yg' -i styles/roadmap/style.json
wget http://download.geoportail.lu/index.php/s/o7ZmTx7ySpgZgF7/download -O omt-geoportail-lu.mbtiles


<filename>ansible/roles/ndouglas.deploy_dotfiles/files/bash/torrents/get_current_instance_id.sh
#!/usr/bin/env bash

# Retrieve the numeric instance ID for an instance for the specified torrent
# Returns -1 if not found.
torrent_get_current_instance_id() {
  : "${1?"Usage: ${FUNCNAME[0]} TORRENT_FILE|DOMAIN"}";
  torrent_file="${1}";
  if [ -f "${torrent_file}" ]; then
    torrent_get_current_instance_id "$(torrent_get_safe_announce_domain "${torrent_file}")";
  else
    safe_domain="${1}";
    safe_domain_path="/torrents/domains/${safe_domain}";
    if [ -L "${safe_domain_path}" ]; then
      original="$(readlink -f "${safe_domain_path}")";
      basename "${original}" | grep -oE '[0-9]+' | bc;
    else
      return 255;
    fi;
  fi
}


TEMP_FILE=/tmp/uav_number.txt
BLOCKING=""

if [ ! -e $TEMP_FILE ]; then
  BLOCKING=1
fi

~/.i3/detacher.sh $BLOCKING "rostopic list | grep reference | head -n 1 | tr '/' ' ' | awk '{print \$1}' | sed 's/uav//' >> $TEMP_FILE" > /dev/null 2>&1
cat $TEMP_FILE | tail -n 1


#!/usr/bin/env bash

set -o errexit

eval "$(command conda 'shell.bash' 'hook' 2> /dev/null)"

# TMP: Upstream patches
git clone https://github.com/xnd-project/rbc /tmp/rbc

pushd /tmp/rbc

conda env create --force --file .conda/environment.yml

conda activate rbc

pytest --capture=no --exitfirst --verbose rbc/


# to be called from repo root

cp skysail.um.httpbasic/generated/skysail.um.httpbasic.jar ../skysail-server/cnf/localrepo/skysail.um.httpbasic/skysail.um.httpbasic-0.2.1.jar
cp skysail.um.httpbasic/generated/skysail.um.httpbasic.jar ../skysail-notes/cnf/localrepo/skysail.um.httpbasic/skysail.um.httpbasic-0.2.1.jar


<gh_stars>0
#!/usr/bin/env bash

: ${OS?}
: ${ARCH?}

set -eux

BASE_DIR=$(cd $(dirname $0)/.. && pwd)

FFMPEG_VERSION=4.4.1
FFMPEG_BUILD_TAG=v4.4.1-1

TMP_BUILD_DIR=$BASE_DIR/$(mktemp -d build.XXXXXXXX)
trap 'rm -rf $TMP_BUILD_DIR' EXIT

cd $TMP_BUILD_DIR

CMAKE_ARGS=(
    -DCMAKE_VERBOSE_MAKEFILE=ON
    -DCMAKE_BUILD_TYPE=Release
    -DBUILD_TOOLS=ON
    -DBUILD_TESTS=OFF
    -DBUILD_SHARED_LIBS=OFF
)

mkdir ffmpeg
export FFMPEG_DIR=$TMP_BUILD_DIR/ffmpeg

case $OS in
    linux)
        case $ARCH in
            x86_64)
                CMAKE_ARGS+=(
                    -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++'
                    -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++'
                )
                TARGET=$ARCH-linux-gnu
                ;;
            i686)
                CMAKE_ARGS+=(
                    -DCMAKE_C_FLAGS='-m32 -static -static-libgcc -static-libstdc++'
                    -DCMAKE_CXX_FLAGS='-m32 -static -static-libgcc -static-libstdc++'
                )
                TARGET=$ARCH-linux-gnu
                ;;
            *)
                echo "Unsupported architecture: $ARCH"
                exit 1
                ;;
        esac
        ;;
    windows)
        TARGET=$ARCH-w64-mingw32
        perl -pe "s!{EXTRA_PATHS}!$FFMPEG_DIR!g" $BASE_DIR/package/toolchain-mingw.cmake.in | perl -pe "s!{ARCH}!$ARCH!g" >toolchain.cmake
        CMAKE_ARGS+=(
            -DCMAKE_TOOLCHAIN_FILE=$TMP_BUILD_DIR/toolchain.cmake
            -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++'
            -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++'
        )
        ;;
    macos)
        CMAKE_ARGS+=(
            -DCMAKE_CXX_FLAGS="-stdlib=libc++"
        )
        case $ARCH in
            x86_64)
                CMAKE_ARGS+=(
                    -DCMAKE_OSX_DEPLOYMENT_TARGET="10.8"
                    -DCMAKE_OSX_ARCHITECTURES="x86_64"
                )
                TARGET=x86_64-apple-macos10.8
                ;;
            arm64)
                CMAKE_ARGS+=(
                    -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0"
                    -DCMAKE_OSX_ARCHITECTURES="arm64"
                )
                TARGET=arm64-apple-macos11
                ;;
            *)
                echo "Unsupported architecture: $OS/$ARCH"
                exit 1
                ;;
        esac
        ;;
    *)
        echo "Unsupported os: $OS"
        exit 1
        ;;
esac

curl -s -L "https://github.com/acoustid/ffmpeg-build/releases/download/$FFMPEG_BUILD_TAG/ffmpeg-$FFMPEG_VERSION-audio-$TARGET.tar.gz" | tar xz
mv ffmpeg-*/ffmpeg-*/* $FFMPEG_DIR

CMAKE_ARGS+=(
    -DCMAKE_INSTALL_PREFIX=$BASE_DIR/artifacts
)

#case $OS in
#windows)
#    perl -pe "s!{EXTRA_PATHS}!$FFMPEG_DIR!g" $BASE_DIR/package/toolchain-mingw.cmake.in | perl -pe "s!{ARCH}!$ARCH!g" >toolchain.cmake
#    CMAKE_ARGS+=(
#        -DCMAKE_TOOLCHAIN_FILE=$TMP_BUILD_DIR/toolchain.cmake
#        -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++'
#        -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++'
#        -DHAVE_AV_PACKET_UNREF=1
#        -DHAVE_AV_FRAME_ALLOC=1
#        -DHAVE_AV_FRAME_FREE=1
#    )
#    STRIP=$ARCH-w64-mingw32-strip
#    ;;
#linux)
#    case $ARCH in
#    i686)
#        CMAKE_ARGS+=(
#            -DCMAKE_C_FLAGS='-m32 -static -static-libgcc -static-libstdc++'
#            -DCMAKE_CXX_FLAGS='-m32 -static -static-libgcc -static-libstdc++'
#        )
#        ;;
#    x86_64)
#        CMAKE_ARGS+=(
#            -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++'
#            -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++'
#        )
#        ;;
#    arm*)
#        perl -pe "s!{EXTRA_PATHS}!$FFMPEG_DIR!g" $BASE_DIR/package/toolchain-armhf.cmake.in | perl -pe "s!{ARCH}!$ARCH!g" >toolchain.cmake
#        CMAKE_ARGS+=(
#            -DCMAKE_TOOLCHAIN_FILE=$TMP_BUILD_DIR/toolchain.cmake
#            -DCMAKE_C_FLAGS='-static -static-libgcc -static-libstdc++'
#            -DCMAKE_CXX_FLAGS='-static -static-libgcc -static-libstdc++'
#        )
#        STRIP=arm-linux-gnueabihf-strip
#        ;;
#    *)
#        echo "unsupported architecture ($ARCH)"
#        exit 1
#    esac
#    ;;
#*)
#    echo "unsupported OS ($OS)"
#    exit 1
#    ;;
#esac

cmake "${CMAKE_ARGS[@]}" $BASE_DIR

VERSION=${GITHUB_REF##*/}

make
make install/strip


<reponame>micperr/prezto<filename>contrib/micper/dev/git.zsh
alias g='git'
alias gb='git branch'
alias gs='git status'
alias gac='git add . && git commit -m'
alias gacu='git add -u . && git commit -m'
alias gc='git checkout'
alias gl='git log --topo-order --pretty=format:"${_git_log_medium_format}"'

alias gFileReset='git checkout --'
alias gFileUndoAdd='git reset HEAD'

alias gUpdateSubmodules='git submodule update --recursive --remote'
alias gUntrackRemote='git branch --unset-upstream'

alias gMyCommits='git log --author="$(git config user.name)"'


#!/bin/bash -e
#
# Script for implementation step
#
# Author: <NAME> (<EMAIL>)
#######################################################################################################################

# Check whether a serial device with the given name exists.
if [ ! -c '{serial_device}' ]
then
  echo "Not found"
  exit
fi

# Check whether the serial device is readible and writable.
if [ ! -r '{serial_device}' -o ! -w '{serial_device}' ]
then
  echo 'Not accessible'
  exit
fi

# Everything went well.
echo "Success"


<reponame>open-power-ref-design-toolkit/ceph-services
#!/usr/bin/env bash
#
# Copyright 2016,2017 IBM Corp.
#
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

# This parameter controls the version of ceph-ansible that is installed
CEPH_ANSIBLE_TAG=${CEPH_ANSIBLE_TAG:-"v2.0.0"}

if [ "$1" == "--help" ]; then
    echo "Usage: bootstrap-ceph.sh"
    exit 1
fi

if [ ! -e scripts/bootstrap-ceph.sh ]; then
    echo "This script must be run in the root directory of the project.  ie. /root/os-services/ceph-services or /root/ceph-services"
    exit 1
fi
PCLD_DIR=`pwd`

SCRIPTS_DIR=$(dirname $0)
source $SCRIPTS_DIR/process-args.sh

INSTALL=False
if [ ! -d $CEPH_DIR ]; then
    echo "Installing ceph-ansible..."
    git-clone https://github.com/ceph/ceph-ansible $CEPH_ANSIBLE_TAG $CEPH_DIR
    INSTALL=True
fi

# If ceph is invoked as a standalone project, install ansible
type ansible >/dev/null 2>&1
if [ $? != 0 ]; then
    echo "Installing ansible..."
    $CEPH_DIR/install-ansible.sh
fi

# Apply patches iff ceph-ansible is installed above.  Code is designed to be reentrant
if [ "$INSTALL" == "True" ] && [ -d $PCLD_DIR/diffs ]; then
    echo "Applying patches"
    pushd / >/dev/null 2>&1
    for f in $PCLD_DIR/diffs/*.patch; do
        patch -N -p1 < $f
        rc=$?
        if [ $rc != 0 ]; then
            echo "scripts/bootstrap-ceph failed, rc=$rc"
            echo "Patch $f could not be applied"
            echo "Manual retry procedure:"
            echo "1) fix patch $f"
            echo "2) rm -rf /etc/ansible; rm -rf $CEPH_DIR"
            echo "3) re-run command"
            exit 1
        fi
    done
    popd >/dev/null 2>&1
fi

# Setup site.yml playbook for use
cp ${CEPH_DIR}/site.yml.sample ${CEPH_DIR}/site.yml
rc=$?
if [ $rc != 0 ]; then
    echo "scripts/bootstrap-ceph failed, rc=$rc"
    echo "Check whether ceph-ansible is properly installed at $CEPH_DIR"
    echo "Manual retry procedure:"
    echo "1) rm -rf $CEPH_DIR"
    echo "2) re-run command"
    exit 1
fi

# This is the normalized genesis style input source of inventory covering all configurations
echo "Using genesis inventory"
${PCLD_DIR}/scripts/ulysses_ceph/generate_ceph_ansible_input.py \
    --inventory $GENESIS_INVENTORY --output_directory $CEPH_DIR
if [ $? != 0 ]; then
    echo "Error generating ceph inventory"
    exit 2
fi
echo "The ceph ansible control files are located at $CEPH_DIR/group_vars"
echo ""
echo "Settings may be customized if desired before they are activated by create cluster"
echo ""
echo "vi $CEPH_DIR/group_vars/all"
echo "vi $CEPH_DIR/group_vars/osds"
echo ""
echo "Note there is no requirement to modify any parameter"


#!/bin/bash

set -e -o pipefail

mkdir -p $PREFIX/bin
export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"
export CPPFLAGS="${CPPFLAGS} -I${PREFIX}/include"
export W3M_LIBS="-lncurses -ltinfo"
./configure --prefix=$PREFIX --with-termlib=ncurses
make
make install


<gh_stars>1-10
#!/bin/sh
#
#  This command loads the distribution to the pypi.org site for access via pip3 install veriteemcomplianceledger
#
#  You need and account on pypi.org and will be prompted for account/password to complete the operation
#
#  The version number of the upload is set in the setup.py file in this directory
#
twine upload dist/*


<filename>tmux-resize.sh
#!/usr/bin/env bash
set -euo pipefail

get_tmux_option() { tmux show-option -gqv "$@" | grep . ;}

navigate_script=$(tmux display-message -p "#{navigate_pane}")
if [[ ! -x ${navigate_script} ]]; then
  printf "tmux-navigate script is not available.\n" >&2;
  exit 1;
fi
# shellcheck source=../tmux-navigate/tmux-navigate.sh
source "${navigate_script}"

neighbour_pane_contains_vim() {
  local direction="${1}"
  # workaround for strange bash regex behaviour. https://stackoverflow.com/a/9793094
  # shellcheck disable=SC2116
  if [[ "$pane_title" =~ $(echo '.*neighbours:\w*:.*') ]]; then
    # shellcheck disable=SC2001 # A sed is fine here
    neighbours=$(echo "$pane_title" | sed 's/.*neighbours:\(l\):.*/\1/')
    case "$direction" in
      left)  [[ $neighbours == *h* ]] ;;
      down)  [[ $neighbours == *j* ]] ;;
      up)    [[ $neighbours == *k* ]] ;;
      right) [[ $neighbours == *l* ]] ;;
      * )
        printf "Unsupported direction: '%s'\n" "$direction" >&2; exit 1
    esac
  else
    # user hasn't setup vim plugin
    return 1
  fi
};
resize() {
  tmux_resizing_command=$1;
  vim_resizing_command=$2;
  vim_resizing_only_if=${3:-true};
  if pane_contains_vim && eval "$vim_resizing_only_if"; then
    in_terminal=0
    if pane_contains_neovim_terminal; then
      # tmux-resize inherits the same problem with detecting neovim terminal
      # panes as tmux-navigate. This means that it's hard to know when whether
      # tmux-navigate should send a command to reenter insert-terminal-mode.
      in_terminal=1
      # escape terminal mode
      tmux send-keys C-\\ C-n;
    fi;
    in_insert_mode=0
    if [[ "$pane_title" == *"mode:i"* ]]; then
      in_insert_mode=1
      # enter insert-normal mode for one command
      # Doesn't seem keep up if holding down the resize key
      tmux send-keys 'C-o'
    fi
    if neighbour_pane_contains_vim "$direction"; then
      eval "$vim_resizing_command";
    else
      eval "$tmux_resizing_command";
    fi
    if [[ "${in_terminal}" -eq 1 ]] || [[ "${in_insert_mode}" -eq 1 ]]; then
      tmux send-keys i;
    fi;
  elif ! pane_is_zoomed; then
    eval "$tmux_resizing_command";
  fi;
};

main() {
  direction=${1:-}
  action=${2:-}
  if [ -z "${direction}" ]; then
    printf "Not enough arguments\n" >&2; exit 1
  fi
  if [ -z "${action}" ]; then
    # Capability mode
    # Tmux and Vim treat expanding left to mean shrinking the right edge(*). So
    # smooth this expected behaviour. (* unless in the rightmost pane, when the
    # left edge moves as expected)
    case "$direction" in
      down|right) action="expand" ;;
      up|left)
        action="shrink"
        if [[ "$direction" == "left" ]]; then
          direction="right"
        else
          direction="down"
        fi
        ;;
      * )
        printf "Unsupported direction: '%s'\n" $direction >&2; exit 1
    esac
  fi

  # Manually switching vim splits with "C-w h" is a workaround for aboveleft
  # having no effect in `:aboveleft vertical resize +5`.
  # Track issue at https://github.com/neovim/neovim/issues/8270
  case "$action" in
    expand )
      case "$direction" in
        down )
          resize 'tmux resize-pane -D'  'tmux send-keys C-w +' ;;
        right )
          resize 'tmux resize-pane -R'  'tmux send-keys C-w \>' ;;
        up )
          resize 'tmux resize-pane -t{up-of} -U'  'tmux send-keys C-w k C-w - C-w j' ;;
        left )
          resize 'tmux resize-pane -t{left-of} -L'  'tmux send-keys C-w h C-w \< C-w l' ;;
        * )
          printf "Unsupported direction for %sing: '%s'\n" $action $direction >&2; exit 1
      esac
      ;;
    shrink )
      case "$direction" in
        down )
          resize 'tmux resize-pane -U'  'tmux send-keys C-w -' ;;
        right )
          resize 'tmux resize-pane -L'  'tmux send-keys C-w \<' ;;
        up )
          resize 'tmux resize-pane -t{up-of} -D'  'tmux send-keys C-w k C-w + C-w j' ;;
        left )
          resize 'tmux resize-pane -t{left-of} -R'  'tmux send-keys C-w h C-w \> C-w l' ;;
        * )
          printf "Unsupported direction for %sing: '%s'\n" $action $direction >&2; exit 2
      esac
      ;;
  esac
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
  main "$@"
fi


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

echo "#"
echo "#"
echo "#"
echo "# Cleaning up inspec and extras from the template!"
echo "#"
echo "#"
echo "#"
sudo dpkg --remove inspec
sudo rm -rf ~/.chef
sudo rm -rf ~/.ansible
sudo rm -rf ~/.inspec


#!/bin/bash

MODEL_NAME=${1}
BUDGET=${2}
SRC_DATA=${3}
TGT_DATA=${4}
BATCH_SIZE=${5}
EPOCH=${6}
LR=${7}
MAX_LEN=${8}
GPU_ID=${9}
SAMP_RATE=${10}
OUTPUT_DIR=${11}

python code/rel_da_budget.py \
  --lm_model "$MODEL_NAME" \
  --src_data "$SRC_DATA"     \
  --tgt_data "$TGT_DATA"     \
  --gpu_ids "$GPU_ID"  \
  --output_dir "$OUTPUT_DIR"/da/"$SRC_DATA"_"$TGT_DATA" \
  --learning_rate "$LR" \
  --task_name fa_rel \
  --batch_size "$BATCH_SIZE" \
  --max_len "$MAX_LEN" \
  --epochs "$EPOCH" \
  --budget "$BUDGET" \
  --alpha 1 \
  --down_sample \
  --down_sample_rate "$SAMP_RATE" \
  --save_model


<gh_stars>0

mkdir B6_cellphoneDB
cd B6_cellphoneDB
cellphonedb method statistical_analysis ../B6_filtered_meta.txt ../B6_filtered_hcount.txt
cellphonedb plot dot_plot
cellphonedb plot heatmap_plot ../B6_filtered_meta.txt

cd ..
mkdir SLE.yaa_cellphoneDB
cd SLE.yaa_cellphoneDB
cellphonedb method statistical_analysis ../SLE.yaa_filtered_meta.txt ../SLE.yaa_filtered_hcount.txt
cellphonedb plot dot_plot
cellphonedb plot heatmap_plot ../SLE.yaa_filtered_meta.txt


webmTOmp4 () {
  ffmpeg -i "$1".webm -qscale 0 "$1".mp4
}

extension=".webm"
for file in ./*.webm; do
    filename=$(basename "$file" "$extension")
    echo "$filename"
    webmTOmp4 "$filename"

    #webmTOmp4 $filename
done


<reponame>jamesyoungman/beebtools
#! /bin/sh
#
#   Copyright 2020 <NAME>
#
#   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.
#
# Tags: positive

# Args:
# ${DFS}" "${TEST_DATA_DIR}"
DFS="$1"
shift
TEST_DATA_DIR="$1"
shift

# Ensure TMPDIR is set.
: ${TMPDIR:?}

check_dump() {
    input="$1"
    shift
    # The rest of the arguments are filename - regex pairs.

    if ! actual="$(mktemp --tmpdir=${TMPDIR:?} actual_dump_output_XXXXXX.txt)"
    then
	echo "failed to create temporary file" >&2
	exit 1
    fi

    cleanup() {
	rm -f "${input}" "${actual}"
    }

    (
	rv=0
	while [ $# -gt 0 ]
	do
	    filename="$1"
	    regex="$2"
	    shift 2
	    if ! ${DFS}  --file "${TEST_DATA_DIR}/${input}" dump "${filename}" > "${actual}"
	    then
		echo "dump command failed on ${filename}" >&2
		rv=1
		break
	    fi
	    if egrep -q -e "${regex}" "${actual}"
	    then
		echo "dump ${filename} output matches extended regular expression ${regex}, good"
	    else
		echo "FAIL dump ${filename} output did not match extended regular expression ${regex}:" >&2
		cat "${actual}" >&2
		rv=1
	    fi
	done
	exit $rv
    )
    rv=$?
    cleanup
    ( exit $rv )
}

# The space in "FIFTY FOUR" should be rendered as a space, not a dot.
# After the end of the file the hex digits column should contain **
# to denote that the data is absent.  Also check that the line
# break occurs at the correct point (i.e. that counting from 0, byte
# 8 of the file is the first thing on the secondf line).
check_dump watford-sd-62-with-62-files.ssd.gz \
	   'FILE54' 'FIFTY' \
	   'FILE54' 'FIFTY FO' \
	   'FILE54' '^000008 55 52 0D [*][*]'


#! /usr/bin/env sh

DIR=$(dirname "$0")
cd "$DIR"

. ../scripts/functions.sh

SOURCE="$(realpath .)"
DESTINATION="$(realpath ~)"

info "Configuring git..."

find . -name ".git*" | while read fn; do
    fn=$(basename $fn)
    symlink "$SOURCE/$fn" "$DESTINATION/$fn"
done

success "Finished configuring git."


#!/bin/bash

MAX_WORKSPACES=5

WORKSPACE_PREFIX="w_"

NUMBER_OF_CREATED_WORKSPACES=$(swaymsg -t get_workspaces | jq -r '.[] .name' | grep -c $WORKSPACE_PREFIX)

WORKSPACE_NR=$(( $NUMBER_OF_CREATED_WORKSPACES > $MAX_WORKSPACES ? $MAX_WORKSPACES : $NUMBER_OF_CREATED_WORKSPACES ))

swaymsg workspace "${WORKSPACE_PREFIX}${WORKSPACE_NR}"


#!/bin/bash

bot_logs=(bot_agent.log)

cd ~/PI_2020/logs/

now=$(date "+%A %B %d %T %y")
dir_name=${now// /_}
dir_name=${dir_name//:/_}
mkdir $dir_name

for log in ${cc_logs[@]}; do
	docker cp bot:twitter/$log $dir_name
	docker exec bot sh -c "echo > $log"
done

tar -czf $dir_name.tar.gz $dir_name
rm -rf $dir_name


<filename>z_mac.command
#!/bin/bash
ws=cocoa
cud=~/cuda/cuda
exe=$cud/app/builds/macos-cocoa/cudatext
bundle=$cud/app/cudatext.app
$cud/setup/mac_common.command $ws $cud $exe $bundle


sudo docker stack rm milkyway-stack-ci && \
sleep 45 && \
sh remove_volume.sh && \
sleep 5 && \
sh deploy_stack.sh


<reponame>redhat-openstack/oooq-site-config-ci-centos<filename>ci-scripts/collect-logs.sh
#!/bin/bash
# Collect the logs from a CI job

set -eux

export ANSIBLE_INVENTORY=$WORKSPACE/hosts
export ANSIBLE_CONFIG=$WORKSPACE/tripleo-quickstart/ansible.cfg
export SSH_CONFIG=$WORKSPACE/ssh.config.ansible
export ANSIBLE_SSH_ARGS="-F ${SSH_CONFIG}"

# (trown) This is so that we ensure separate ssh sockets for
# concurrent jobs. Without this, two jobs running in parallel
# would try to use the same undercloud-stack socket.
socketdir=$(mktemp -d /tmp/sockXXXXXX)
export ANSIBLE_SSH_CONTROL_PATH=$socketdir/%%h-%%r

bash $WORKSPACE/tripleo-quickstart/quickstart.sh \
    --working-dir $WORKSPACE/ \
    --no-clone \
    --bootstrap \
    --retain-inventory \
    --requirements $WORKSPACE/tripleo-quickstart/quickstart-role-requirements.txt \
    --config $WORKSPACE/config/general_config/centosci-logs.yml \
    --playbook collect-logs.yml \
    localhost


<filename>examples/demo.sh
#!/bin/sh -e

# This script is to show all features of cnbot.
#
# Generally, cnbot creates messages out of two sources:
# - it receives messages from Telegram users,
#   runs script according configuration file and
#   treats script's output as response
# - it listens HTTP requests (if configured),
#   treats bodies of requests in the same way and
#   sends the result to Telegram users
#
# So, this script is run for every user request and
# its output is used to reply to user.

# PART I: Set up environment #########################################
#
# cnbot doesn't pass environment to script to avoid side effects and
# prevent possible vulnerabilities. So, you are to
# set up explicitly variables like PATH, LANG, and so on.

PATH=/usr/local/bin:/bin:/usr/bin

# PART II: Check if binaries exist ##################################
#
# You are free to skip it.

for c in dirname awk cal curl date df echo env grep sed sort tail test uname uptime
do
    if ! command -v $c >/dev/null
    then
        echo "WARNING: Command $c not found, check PATH ($PATH)" >&2
    fi
done

# PART III: Check if it is forwarded message or contact or location #
#
# If you don't need this functionality, you are free to skip this part.
#
# If the bot receives forwarded message or users contact, it sets
# up three additional variables:
# - BOT_SIDE_TYPE -- type of message: string "user", "contact", "bot" and so on
# - BOT_SIDE_NAME -- name
# - BOT_SIDE_ID -- id, it is useful to set up black/white list in configuration file.
#
# If you wish to add some user to black/white list, you can forward
# his message to the bot and figure out the user id.
# Of cause, you can figure out user id directly from bots logs.
#
# By the way, you can check if BOT_MESSAGE_TYPE=callback and process
# callbacks separately. In this script we are processing callbacks
# and regular messages in the same place.

if test -n "$BOT_SIDE_TYPE"
then
    echo "Message from $BOT_SIDE_TYPE"
    echo "Name: $BOT_SIDE_NAME"
    echo "ID: $BOT_SIDE_ID"
    exit
fi

# You can process shared locations if you wish

if test -n "$BOT_LOCATION_LONGITUDE" # BOT_LOCATION_LATITUDE can be used too
then
    echo '%!PRE'
    echo 'Location is received'
    echo ''
    echo "Longitude: $BOT_LOCATION_LONGITUDE"
    echo "Latitude:  $BOT_LOCATION_LATITUDE"
    echo ''
    echo 'Optional:'
    echo "Accuracy:     $BOT_LOCATION_ACCURACY"
    echo "Live period:  $BOT_LOCATION_LIVE_PERIOD"
    echo "Heading:      $BOT_LOCATION_HEADING"
    echo "Alert radius: $BOT_LOCATION_ALERT_RADIUS"
    exit
fi

# PART IV: Commands #################################################

# I use magic COMMAND prefix just to facilitate code reading/searching

case "COMMAND_$1" in
    COMMAND_start)
        # Simple text messages are sent as is
        echo 'Hi there! 👋'
        echo 'Say /help to get help 👈😎👈'
        ;;
    COMMAND_date)
        # You can run any command and get output in your Telegram client
        date
        ;;
    COMMAND_uname)
        # One more example of command
        uname -a
        ;;
    COMMAND_uptime)
        # And one more
        uptime
        ;;
    COMMAND_noout)
        # Empty output turns to italic string "empty"
        ;;
    COMMAND_nothing)
        # The bot will reply nothing.
        echo '%!SILENT'
        ;;
    COMMAND_args)
        # Try to say to bot
        # - args
        # - args Hello world!
        # and so on
        # You will see how cnbot prepares command arguments:
        # - it converts your message to lower case
        # - save only letters, digits and symbols dot (.), minus (-) and underscore (_)
        # - and consider all the rest symbols as separators
        #
        echo 'Passed args:'
        for a in "$@"
        do
            echo "○ $a"
        done
        echo 'Try:'
        echo 'args'
        echo 'args 1 2 3'
        echo 'args Hello world!'
        ;;
    COMMAND_env)
        # You can preformat your message, using '%!PRE' control line
        # at the beginning of response.
        #
        # Try this command and check out all available environment variables:
        # BOT_CHAT -- integer chat id
        # BOT_FROM -- integer sender id
        # BOT_FROM_FIRST_NAME -- sender name
        # BOT_NAME -- bot name, according configuration file
        # BOT_SERVER -- server for asynchronous communication (if set up)
        # BOT_TEXT -- original message
        # BOT_MESSAGE_TYPE -- Message source: "callback" or "message"
        #
        # Telegram API doesn't guarantee to provide the following information
        # BOT_FROM_LANGUAGE -- language in form like "en" (IETF language tag)
        # BOT_FROM_LAST_NAME -- last name
        # BOT_FROM_USERNAME -- username
        #
        echo '%!PRE'
        declare -xp | sed 's;declare -x ;;' # ugly, but things like 'env | sort' don't work right with multi line values
        ;;
    COMMAND_cal)
        # One more %!PRE example
        echo '%!PRE'
        cal
        ;;
    COMMAND_calc)
        # The example of how to get access to raw message (BOT_TEXT).
        # .----------------------------------------------------------------.
        # | ⚠  WARNING  Be careful, it is very easy to make vulnerability. |
        # |             Do not use this code in production.                |
        # `----------------------------------------------------------------'
        if test "$#" = '1'
        then
            echo '%!MARKDOWN'
            echo '*Usage:* calc _expression_'
            echo 'For example:'
            echo '`calc 1\+1`'
            echo '`calc atan2(1, 0) * 2`'
            echo '`calc sqrt(2)`'
        else
            prog="BEGIN {print($(echo "$BOT_TEXT" | sed 's/^[^c]*calc//'))}"
            echo '%!PRE'
            #echo "$prog" # uncomment for debugging
            set +e
            awk "$prog" 2>&1
            set -e
        fi
        ;;
    COMMAND_gologo)
        # To reply by image you have just put image to stdout as is.
        curl -qfs https://golang.org/lib/godoc/images/footer-gopher.jpg
        # curl -qfs https://www.telegram.org/img/t_logo.png # try this if footer-gopher.jpg disappear
        ;;
    COMMAND_du)
        # You can generate image using APIs, or utilities like RRDtools.
        d="$(df -P -m / | tail -1 | awk '{gsub("[^0-9]", "", $5); print $5","(100-$5)}')"
        # This old fashioned API is deprecated in 2012, however, it is still working
        # https://developers.google.com/chart/image/docs/making_charts
        u="https://chart.googleapis.com/chart?cht=p&chd=t:$d&chs=300x200&chl=Available|Used&chtt=Disk%20usage"
        curl -qfs "$u"
        ;;
    COMMAND_async)
        # You are free to speak asynchronously using HTTP interface.
        #
        # Here we send three messages in reply to one incoming message.
        # Obviously, it is possible to schedule some jobs and send such
        # messages later.
        #
        # Here you can see
        # - %!MARKDOWN control line
        # - two ways to send asynchronous messages:
        #   (1) raw body and
        #   (2) multipart/form-data encoding
        #
        # %!MARKDOWN is similar to %!PRE, however
        # - It allows you to use all Telegrams markdown abilities
        # - It doesn't escapes control chars for you.
        #   So you must to put '\' before every control character by your self.
        #
        # You can also see how we specify target user explicitly.
        # So you can send message to other user, chat or even bot,
        # not only in reply to sender. For example, you can echo
        # the conversation to the third party observer.
        #
        echo '%!SILENT' # suppress message
        mark='%!MARKDOWN'$'\n' # it may surprise you, how we get newline in sh
        # the first way to send async message: multipart/form-data
        curl -qfsX POST -o /dev/null -F to=$BOT_FROM -F msg="${mark}_I'll send you_ *random* _image\.\.\._" $BOT_SERVER
        curl -qfskL https://source.unsplash.com/random/600x400 |
        curl -qfsX POST -o /dev/null -F to=$BOT_FROM -F msg=@- $BOT_SERVER
        # the second way to send async message: raw data + user_id at the end of URL
        echo "${mark}_Are you happy now?_" |
        curl -qfsX POST -o /dev/null --data-binary @- "http://$BOT_SERVER/$BOT_FROM"
        ;;
    COMMAND_cap)
        echo '%!SILENT' # no message
        # The only way to send image with caption
        # is to use multipart/form-data encoding and "cap" parameter
        curl -qfs https://golang.org/lib/godoc/images/footer-gopher.jpg |
        curl -qfsX POST -o /dev/null -F to=$BOT_FROM -F msg=@- -F cap="$(date)" $BOT_SERVER
        ;;
    COMMAND_btn)
        # %!CALLBACK is a control line to create inline keyboards
        #
        # There are three ways to use it
        # - %!CALLBACK cmd_name run command
        #   Creates a key with label "run command".
        #   That button will start the script with command "cmd_name".
        # - %!CALLBACK one_word
        #   Is literally equal to
        #   %!CALLBACK one_word one_word
        #   label and command are equal
        # - %!CALLBACK
        #   Without arguments the command line starts new line of keys
        #   in inline keyboard layout.
        #
        # The following control lines describe three-line keyboard
        # [__env___][__date__]
        # [_execute_uname_-a_]
        #
        echo '%!CALLBACK env'
        echo '%!CALLBACK date'
        echo '%!CALLBACK'
        echo '%!CALLBACK uname execute uname -a'
        echo 'Simple inline keyboard'
        ;;
    COMMAND_update)
        # %!UPDATE control can be used in conjunction with %!CALLBACK
        # and in synchronous messages only
        # it means that the message have to replace the inline-keyboard-message.
        # It allows you to create mutable menus.
        #
        # Here we send the same inline keyboard, but new message text every time.
        #
        echo '%!UPDATE'
        echo '%!CALLBACK update What time is it now?'
        echo '%!CALLBACK update-helper Show env'
        date
        ;;
    COMMAND_update-helper)
        # We can use %!UPDATE in a reply that invoked by %!CALLBACK
        echo '%!UPDATE'
        echo '%!CALLBACK update What time is it now?'
        echo '%!CALLBACK update-helper Show env'
        echo '%!PRE'
        env | sort
        ;;
    COMMAND_notify)
        # It is possible to add additional notification to response to
        # callback message. There are two types of notifications:
        # text and alert. See notify-text and notify-alert bellow.
        echo '%!CALLBACK notify-text text'
        echo '%!CALLBACK notify-alert alert'
        echo '%!MARKDOWN'
        echo '*Notifications*'
        echo 'Show date as'
        ;;
    COMMAND_notify-text)
        echo '%!SILENT' # no message, however, you can use %!UPDATE, nonempty messages etc.
        echo "%!TEXT Text notification: $(date)"
        ;;
    COMMAND_notify-alert)
        echo '%!SILENT' # no message
        echo "%!ALERT Alert: $(date)"
        ;;
    COMMAND_help)
        # One more %!MARKDOWN example
        echo '%!MARKDOWN'
        cat "$(dirname "$0")/demo-help-message.md"
        ;;
    *)
        # And one more
        cmd="$(echo $1 | sed 's/[-_.]/\\&/g')" # we have to care about [-_.] only because other must-escaped-chars are disallowed by bot
        echo '%!MARKDOWN'
        echo 'This is `cnbot` speaking\.' "I didn't recognize your command '*$cmd*' Try to say '*help*' to me"
        ;;
esac


#!/bin/bash

tmpfile=$(mktemp -u)
in=$1
out=$2
pushd $(dirname $in) && zip -r $tmpfile $(basename $in) && popd && cp $tmpfile $out && rm $tmpfile


#!/bin/bash
# Copy Virgo code and plans to another a testbed node
# Ensure that $VIRGO_HOME refers to correct location, i.e. Virgo top directory

testParams() {
        if [ $1 -eq 1 ]
        then
                return 0
        else
                if [ $1 -eq 0 ]
                then
                        echo "Specify ssh target e.g. <user>@<node address>"
                else
                        echo "Too many parameters"
                fi
                return 1
        fi
}

transferFiles() {

        echo ""
        echo "Tranfer files from $VIRGO_HOME to $1"
        echo "------------------------------------"

        #echo ""
        #echo "Transfer Virgo configuration files to $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/config"
        #echo "--------------------------------------------------------------------------------------------"

        #scp  $VIRGO_HOME/config/xc.properties $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/config
        #scp  $VIRGO_HOME/config/org.societies.platform.properties $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/config

        echo ""
        echo "Transfer Virgo Societies plans to $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/repository/usr"
        echo "------------------------------------------------------------------------------------------------"

        scp $VIRGO_HOME/repository/usr/*.plan $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/repository/usr

        echo ""
        echo "Transfer Virgo Societies bundles to $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/repository/usr"
        echo "--------------------------------------------------------------------------------------------------"

        scp $VIRGO_HOME/repository/usr/*.jar $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/repository/usr
        scp $VIRGO_HOME/repository/usr/*.war $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/repository/usr

        echo ""
        echo "Update Virgo startup plan to $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/pickup"
        echo "--------------------------------------------------------------------------------------------------"

        scp $VIRGO_HOME/repository/usr/org.societies.platform.plan $1:/usr/local/virgo-tomcat-server-3.0.1.RELEASE/pickup

}

testParams $#
if [ $?  -eq 0 ]
 then
  transferFiles $1 $2
fi

exit 0


<reponame>conda-forge/digital_rf-feedstock
#!/bin/bash

mkdir build
cd build
cmake ${CMAKE_ARGS} \
    -DCMAKE_INSTALL_PREFIX=$PREFIX \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DDRF_INSTALL_PREFIX_PYTHON=$PREFIX \
    -DPython_EXECUTABLE=$PYTHON \
    ..
cmake --build .
if [[ "${CONDA_BUILD_CROSS_COMPILATION}" != "1" ]]; then
cmake --build . --target test
rm -r /tmp/hdf5
fi
cmake --build . --target install


<reponame>clb6/jarvis
#! /bin/bash

# Verify that the required dependencies are installed

command -v docker > /dev/null 2>&1 \
    || { echo >&2 "docker must be installed"; exit 1; }
command -v docker-compose > /dev/null 2>&1 \
    || { echo >&2 "docker-compose must be installed"; exit 1; }

# Argument parsing

if [ "$1" == "help" ]; then
    echo "Usage:"
    echo "install.sh dev"
    echo "install.sh <username> <password>"
    exit 0
elif [ "$1" == "dev" ]; then
    MODE="dev"
else
    MODE="prod"
    JARVIS_API_USER="$1"
    JARVIS_API_PASSWORD="$2"
fi

# TODO: Ensure that working directory is at the project root or maybe script
# downloads necessary artifacts?

if [ "$MODE" == "dev" ]; then
    echo "Starting Jarvis installation for local development.."
    JARVIS_DIR_ROOT="/tmp/jarvis"
    JARVIS_DOCKER_COMPOSE_FILE="$PWD/docker-compose-dev.yml"
elif [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
else
    echo "Starting Jarvis installation.."
    JARVIS_DIR_ROOT="/opt/jarvis"
    JARVIS_DOCKER_COMPOSE_FILE="$PWD/docker-compose.yml"
fi

echo

# Create required directories

JARVIS_DATA_VERSION="20160628"
echo "Creating installation directory"
echo "Installation directory: $JARVIS_DIR_ROOT"
echo "Data model version: $JARVIS_DATA_VERSION"

for target_dir in "LogEntries-$JARVIS_DATA_VERSION" "Tags-$JARVIS_DATA_VERSION" \
    "Images" "Elasticsearch" "Redis"
do
    mkdir -p "$JARVIS_DIR_ROOT/$target_dir"
done

echo

# Copy Elasticsearch mappings to be used by jarvis-api to provision Elasticsearch
#
# REVIEW: Should just hardcode into jarvis-api? Usefulness of having external
# mappings is the ability to test the mapping requests outside of jarvis-api.

mkdir "$JARVIS_DIR_ROOT/Elasticsearch/mappings"
cp $PWD/setup/mappings/* $JARVIS_DIR_ROOT/Elasticsearch/mappings

# Setup Nginx

if [ "$MODE" == "prod" ]; then
    mkdir -p "$JARVIS_DIR_ROOT/etc/nginx"
    cp $PWD/setup/nginx/* $JARVIS_DIR_ROOT/etc/nginx
    # Inspired from https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-nginx-on-ubuntu-14-04
    echo -n "$JARVIS_API_USER:" >> $JARVIS_DIR_ROOT/etc/nginx/htpasswd
    openssl passwd -apr1 $JARVIS_API_PASSWORD >> $JARVIS_DIR_ROOT/etc/nginx/htpasswd
fi

echo

# Docker-compose up

if [ -e $JARVIS_DOCKER_COMPOSE_FILE ]; then
    echo "Starting up Jarvis containers"
    JARVIS_DIR_ROOT=$JARVIS_DIR_ROOT docker-compose -f $JARVIS_DOCKER_COMPOSE_FILE up -d
else
    echo "Error! Could not find docker-compose file"
    exit 1
fi

# TODO: Should go ahead and install cli too?

echo; echo;
echo "Jarvis installation done!"


# leave ssh disabled at first, do this from the console
# vi /etc/ssh/sshd_config
# service sshd restart
# edit sshd_config to enable whatever ports and options are needed

# install iptables and disable firewalld
yum install iptables
systemctl disable firewalld
systemctl stop firewalld
yum install wget
yum install ipset

# wget the update_firewall_centos.sh from somewhere
# uncomment the get zones commands in the firewall script
# then run the script to update iptables
# consider putting it in cron to run on reboot, else use iptables-persistent or similar

# next line assumes you have the script already local
./update_firewall_centos.sh

# install other repos which are useful, and the keys needed to use them
yum install epel-release
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

# install X Windows and a GUI DE
yum groupinstall "X Window system"
yum groupinstall "MATE Desktop"
# (or GNOME or whatever instead of MATE if desired)

# enable the GUI to start automatically
systemctl isolate graphical.target
systemctl set-default graphical.target

# install some other useful stuff, some of which are in the added repos above
yum install gnome-disk-utility
yum install tigervnc-server
yum install tigervnc-server-module
yum install xrdp
yum install rdesktop

# enable rdp and set the selinux contexts so it works
# might also have to do some xrdp config file edits
systemctl start xrdp.service
systemctl enable xrdp.service
chcon --type=bin_t /usr/sbin/xrdp
chcon --type=bin_t /usr/sbin/xrdp-sesman


#!/bin/bash -u

. ./cmd.sh
. ./path.sh

# DNN training. This script is based on egs/swbd/s5b/local/run_dnn.sh
# <NAME>

if [ $# -ne 1 ]; then
  printf "\nUSAGE: %s <mic condition(ihm|sdm|mdm)>\n\n" `basename $0`
  exit 1;
fi

mic=$1
final_lm=`cat data/local/lm/final_lm`
LM=$final_lm.pr1-7

for lm_suffix in $LM; do
# Config:
gmmdir=exp/$mic/tri4a
graph_dir=exp/$mic/tri4a/graph_${lm_suffix}
data_fmllr=data-fmllr-tri4
stage=0 # resume training with --stage=N
# End of config.
. utils/parse_options.sh || exit 1;
#

if [ $stage -le 0 ]; then
  # Store fMLLR features, so we can train on them easily,
  # test
  dir=$data_fmllr/$mic/eval
  steps/nnet/make_fmllr_feats.sh --nj 1 --cmd "$train_cmd" \
     --transform-dir $gmmdir/decode_eval_${lm_suffix} \
     $dir data/$mic/eval $gmmdir $dir/log $dir/data || exit 1
  # dev
  dir=$data_fmllr/$mic/dev
  steps/nnet/make_fmllr_feats.sh --nj 1 --cmd "$train_cmd" \
     --transform-dir $gmmdir/decode_dev_${lm_suffix} \
     $dir data/$mic/dev $gmmdir $dir/log $dir/data || exit 1
  # train
  dir=$data_fmllr/$mic/train
  steps/nnet/make_fmllr_feats.sh --nj 1 --cmd "$train_cmd" \
     --transform-dir ${gmmdir}_ali \
     $dir data/$mic/train $gmmdir $dir/log $dir/data || exit 1
  # split the data : 90% train 10% cross-validation (held-out)
  utils/subset_data_dir_tr_cv.sh $dir ${dir}_tr90 ${dir}_cv10 || exit 1
fi

if [ $stage -le 1 ]; then
  # Pre-train DBN, i.e. a stack of RBMs
  dir=exp/$mic/dnn4_pretrain-dbn
  (tail --pid=$$ -F $dir/log/pretrain_dbn.log 2>/dev/null)& # forward log
  $cuda_cmd $dir/log/pretrain_dbn.log \
    steps/nnet/pretrain_dbn.sh --rbm-iter 1 $data_fmllr/$mic/train $dir || exit 1;
fi

if [ $stage -le 2 ]; then
  # Train the DNN optimizing per-frame cross-entropy.
  dir=exp/$mic/dnn4_pretrain-dbn_dnn
  ali=${gmmdir}_ali
  feature_transform=exp/$mic/dnn4_pretrain-dbn/final.feature_transform
  dbn=exp/$mic/dnn4_pretrain-dbn/6.dbn
  (tail --pid=$$ -F $dir/log/train_nnet.log 2>/dev/null)& # forward log
  # Train
  $cuda_cmd $dir/log/train_nnet.log \
    steps/nnet/train.sh --feature-transform $feature_transform --dbn $dbn --hid-layers 0 --learn-rate 0.008 \
    $data_fmllr/$mic/train_tr90 $data_fmllr/$mic/train_cv10 data/lang $ali $ali $dir || exit 1;
  # Decode (reuse HCLG graph)
  steps/nnet/decode.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf --acwt 0.1 \
    --num-threads 3 \
    $graph_dir $data_fmllr/$mic/dev $dir/decode_dev_${lm_suffix} || exit 1;
  steps/nnet/decode.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf --acwt 0.1 \
    --num-threads 3 \
    $graph_dir $data_fmllr/$mic/eval $dir/decode_eval_${lm_suffix} || exit 1;
fi

# Sequence training using sMBR criterion, we do Stochastic-GD
# with per-utterance updates. We use usually good acwt 0.1
# Lattices are re-generated after 1st epoch, to get faster convergence.
dir=exp/$mic/dnn4_pretrain-dbn_dnn_smbr
srcdir=exp/$mic/dnn4_pretrain-dbn_dnn
acwt=0.1

if [ $stage -le 3 ]; then
  # First we generate lattices and alignments:
  steps/nnet/align.sh --nj 6 --cmd "$train_cmd" \
    $data_fmllr/$mic/train data/lang $srcdir ${srcdir}_ali || exit 1;
  steps/nnet/make_denlats.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf \
    --acwt $acwt $data_fmllr/$mic/train data/lang $srcdir ${srcdir}_denlats || exit 1;
fi

if [ $stage -le 4 ]; then
  # Re-train the DNN by 1 iteration of sMBR
  steps/nnet/train_mpe.sh --cmd "$cuda_cmd" --num-iters 1 --acwt $acwt --do-smbr true \
    $data_fmllr/$mic/train data/lang $srcdir ${srcdir}_ali ${srcdir}_denlats $dir || exit 1
  # Decode (reuse HCLG graph)
  for ITER in 1; do
    steps/nnet/decode.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf \
      --num-threads 3 \
      --nnet $dir/${ITER}.nnet --acwt $acwt \
      $graph_dir $data_fmllr/$mic/dev $dir/decode_dev_${lm_suffix} || exit 1;
    steps/nnet/decode.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf \
      --num-threads 3 \
      --nnet $dir/${ITER}.nnet --acwt $acwt \
      $graph_dir $data_fmllr/$mic/eval $dir/decode_eval_${lm_suffix} || exit 1;
  done
fi

# Re-generate lattices, run 4 more sMBR iterations
dir=exp/$mic/dnn4_pretrain-dbn_dnn_smbr_i1lats
srcdir=exp/$mic/dnn4_pretrain-dbn_dnn_smbr
acwt=0.1

if [ $stage -le 5 ]; then
  # First we generate lattices and alignments:
  steps/nnet/align.sh --nj 6 --cmd "$train_cmd" \
    $data_fmllr/$mic/train data/lang $srcdir ${srcdir}_ali || exit 1;
  steps/nnet/make_denlats.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf \
    --acwt $acwt $data_fmllr/$mic/train data/lang $srcdir ${srcdir}_denlats || exit 1;
fi

if [ $stage -le 6 ]; then
  # Re-train the DNN by 1 iteration of sMBR
  steps/nnet/train_mpe.sh --cmd "$cuda_cmd" --num-iters 4 --acwt $acwt --do-smbr true \
    $data_fmllr/$mic/train data/lang $srcdir ${srcdir}_ali ${srcdir}_denlats $dir || exit 1
  # Decode (reuse HCLG graph)
  for ITER in 1 2 3 4; do
    steps/nnet/decode.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf \
      --num-threads 3 \
      --nnet $dir/${ITER}.nnet --acwt $acwt \
      $graph_dir $data_fmllr/$mic/dev $dir/decode_dev_${lm_suffix}_$ITER || exit 1;
    steps/nnet/decode.sh --nj 6 --cmd "$decode_cmd" --config conf/decode_dnn.conf \
      --num-threads 3 \
      --nnet $dir/${ITER}.nnet --acwt $acwt \
      $graph_dir $data_fmllr/$mic/eval $dir/decode_eval_${lm_suffix}_$ITER || exit 1;
  done
fi

done
# Getting results [see RESULTS file]
# for x in exp/$mic/*/decode*; do [ -d $x ] && grep WER $x/wer_* | utils/best_wer.sh; done


<reponame>tabulon-ext/modernish
#! /usr/bin/env modernish
#! use safe -k
#! use sys/cmd/harden
#! use var/loop/find -B
#! use sys/base/mktemp
harden cat
harden -e '>1' cmp
harden paste
harden LC_ALL=C sed
harden LC_ALL=C sort

# This is a helper script I use to maintain the 'unalias' commands at the top
# of every lib/modernish/mdl/**/*.mm module file. They are mainly inserted for
# the benefit of interactive shell users, where aliases are not unlikely to
# interfere with function definitions, causing spurious syntax errors.
# Ref.: https://github.com/modernish/modernish/issues/5
#
# This script greps function names in module files, sorts them, and combines
# them on one line. Without options, it adds or updates unalias commands on the
# second line of each module file, only updating the file if something actually
# changed. With the -r option, it removes these unalias commands.
#
# It is a nice demonstration of the use of the 'find' loop, as well as the
# auto-cleanup option of modernish 'mktemp'.

# --- Parse options ---
showusage() { putln "Usage: $ME [ -r ]" "See comments in script for info."; }
unset -v opt_r
while getopts 'r' opt; do
	case $opt in
	( r )	opt_r= ;;
	( * )	exit -u 1 ;;
	esac
done
shift $((OPTIND-1))
let $# && exit -u 1 'Excess arguments.'

# --- Make sure we're in a modernish tree ---
mdl_reldir=${MSH_MDL#"$MSH_PREFIX/"}
is dir $mdl_reldir || chdir $MSH_PREFIX
putln "Updating unalias for modules in $PWD/$mdl_reldir"

# --- Prepare temp file ---
mktemp -sCCt unalias_update	# 2x -C = auto-cleanup even on Ctrl+C
mytempfile=$REPLY

# --- Main loop ---
changed=0 total=0
LOOP find modulefile in $mdl_reldir -type f -name *.mm; DO
	let "total += 1"
	# Eliminate comments, get function names from lines like "funcname() {",
	# as well as alias names from lines like 'alias name=...',
	# and make make "_" sort last (change to "~").
	fn_al_names=$(
		export LC_ALL=C
		sed -n 's/#.*//
			/[[:alpha:]_][[:alnum:]_]*()[[:blank:]]*[{(]/ {
				h
				s/().*//
				s/^.*[^[:alnum:]_]//
				s/^_/~/
				p
				g
			}
			/alias[[:blank:]]\{1,\}[[:alnum:]_!%,@]\{1,\}=/ {
				s/^.*alias //
				s/=.*//
				s/^_/~/
				p
			}' $modulefile |
		sort -u |
		sed 's/^~/_/' |
		paste -s -d ' ' -	# combine on one line
	)
	str empty $fn_al_names && continue
	if isset opt_r; then
		message="- Removing unalias from $PWD/$modulefile"
		script="2 { /^\\\\command unalias/ d; }"
	else
		message="- Updating $PWD/$modulefile:${CCn}  $fn_al_names"
		script="2 i\\${CCn}\\\\command unalias $fn_al_names 2>/dev/null
			2 { /^\\\\command unalias/ d; }"
	fi
	# (The >| operator bypasses the safe mode's noclobber check: we *want*
	# to overwrite. Redirections cannot be covered by 'harden', so check.)
	sed $script $modulefile >| $mytempfile || die
	if ! cmp -s $modulefile $mytempfile; then
		putln $message
		cat $mytempfile >| $modulefile || die
		let "changed += 1"
	fi
DONE
putln "$changed out of $total modules updated."


<reponame>nathanpc/currentflow.net
#!/bin/bash

### copy_index.sh
### Creates the main website index.html by copying the first page.
###
### Author: <NAME> <<EMAIL>>

outfolder=$(./bin/get_config.pl 'folders/output')
echo -e "\e[34mGenerating the main page...\e[0m"
echo -n "  index.html "
cp "$outfolder/page/1/index.html" "$outfolder/index.html"
echo -e "\e[32mOK\e[0m"


#!/bin/sh

(
  declare -i p
  trap 'kill "$p"' EXIT
  while true; do
    stack exec paragon-optimization & p=$!
    notify-send "Server started" --urgency=critical
    inotifywait -q -e create .stack-work/install/*/*/*/bin/
    sleep 1
    kill "$p"
  done
)


#!/bin/bash

set -e

# Setup
INPUT=$1
FILES_DIR=${2%/} # strips trailing slash
DOC_TO_MD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LIBS="$DOC_TO_MD_DIR/libs"
TEMP="$DOC_TO_MD_DIR/tmp"
NODE_BIN="$DOC_TO_MD_DIR/node_modules/.bin"

if [ -f ~/doc_to_html.html ]; then
    echo "~/doc_to_html.html already exists" >&2
    exit 1
fi

# Remove temp dir
rm -rf $TEMP >&2

# Re-add temp dir
mkdir $TEMP >&2
cp $INPUT $TEMP

# Convert to HTML -> ~/doc_to_html.html
INPUT_FILE=`ls $TEMP/*.doc*`
echo "CONVERTING TO HTML: " $INPUT_FILE " -> " ~/doc_to_html.html >&2
automator -i $INPUT_FILE $DOC_TO_MD_DIR/doc-to-html.app >&2

# Move from home dir -> 1_doc_to_html.html
echo "MOVING FROM HOME DIR TO TEMP DIR " ~/doc_to_html.html " -> " $TEMP/1_doc_to_html.html >&2
mv ~/doc_to_html.html $TEMP/1_doc_to_html.html
mv ~/doc_to_html_files $TEMP

# Encode characters -> 2_document_encoded_and_with_delimiters_and_vml_images.html
echo "ENCODING UTF-8 CHARACTERS " $TEMP/1_doc_to_html.html " -> " $TEMP/2_document_encoded_and_with_delimiters_and_vml_images.html >&2
$NODE_BIN/coffee $DOC_TO_MD_DIR/2-encode-utf8-and-add-delimiters-and-vml-images.coffee < $TEMP/1_doc_to_html.html > $TEMP/2_document_encoded_and_with_delimiters_and_vml_images.html

# Convert to XML -> 3_document.xml
echo "CONVERTING TO XML " $TEMP/2_document_encoded_and_with_delimiters_and_vml_images.html " -> " $TEMP/3_document.xml >&2
java -jar $LIBS/tagsoup-1.2.1.jar --lexical $TEMP/2_document_encoded_and_with_delimiters_and_vml_images.html > $TEMP/3_document.xml

# Convert equations to MathML -> 4_document_with_equations.xml
echo "CONVERTING EQUATIONS TO MATHML" $TEMP/3_document.xml " -> " $TEMP/4_document_with_equations.xml >&2
java -jar $LIBS/saxon8.jar -o $TEMP/4_document_with_equations.xml $TEMP/3_document.xml $LIBS/xhtml-mathml.xsl >&2

# Hiding equations -> 5_document_with_hidden_equations_and_cleaned_breaks.xml
echo "HIDING EQUATIONS" $TEMP/4_document_with_equations.xml " -> " $TEMP/5_document_with_hidden_equations_and_cleaned_breaks.xml >&2
$NODE_BIN/coffee $DOC_TO_MD_DIR/5-hide-math-and-cleanup-breaks.coffee < $TEMP/4_document_with_equations.xml > $TEMP/5_document_with_hidden_equations_and_cleaned_breaks.xml

# Convert and tidy to HTML again -> 6_document.html
echo "CONVERTING TO TIDY HTML" $TEMP/5_document_with_hidden_equations_and_cleaned_breaks.xml " -> " $TEMP/6_document.html >&2
set +e
tidy -config $DOC_TO_MD_DIR/tidy-config.txt -output $TEMP/6_document.html $TEMP/5_document_with_hidden_equations_and_cleaned_breaks.xml >&2
if [ $? -eq 2 ]; then
    echo "Tidy failed" >&2
    exit 1
fi
set -e

# Unhiding equations -> 7_document_with_unhidden_equations.html
echo "UNHIDING EQUATIONS" $TEMP/6_document.html " -> " $TEMP/7_document_with_unhidden_equations.html >&2
$NODE_BIN/coffee $DOC_TO_MD_DIR/7-unhide-math.coffee < $TEMP/6_document.html > $TEMP/7_document_with_unhidden_equations.html

# Convert to markdown -> 8_document.md
echo "CONVERTING TO MARKDOWN" $TEMP/7_document_with_unhidden_equations.html " -> " $TEMP/8_document.md >&2
pandoc -f html -t markdown_strict --normalize -R --atx-headers -o $TEMP/8_document.md < $TEMP/7_document_with_unhidden_equations.html >&2

# Cleaning up markdown -> 9_document_clean.md
echo "CLEANING UP MARKDOWN" $TEMP/8_document.md " -> " $TEMP/9_document-clean.md >&2
$NODE_BIN/coffee $DOC_TO_MD_DIR/9-cleanup-markdown.coffee < $TEMP/8_document.md > $TEMP/9_document_clean.md

if [ $FILES_DIR ]; then
	echo "COPYING FILES TO " $FILES_DIR >&2
  rm -rf $FILES_DIR
  mkdir $FILES_DIR
	cp $TEMP/doc_to_html_files/* $FILES_DIR
fi

# Output
cat $TEMP/9_document_clean.md | sed s/doc_to_html_files/$FILES_DIR/g


<reponame>jcm007/vertx-zero
#!/usr/bin/env bash

docker stop ox_es
docker stop ox_tidb
docker stop ox_neo4j


#!/bin/bash

echo "***Bootstrappin' the system!***"
apt-get update

echo "Installing build packages"
apt-get install -q -y git-core build-essential zlib1g-dev libssl-dev libreadline5-dev wget

echo "Removing Ruby from apt"
apt-get remove -q -y ^ruby*

PREFIX="/usr"
REE="ruby-enterprise-1.8.6-20090421"

if [ `which ruby` ]; then

 echo "Ruby already installed."

else

  echo "Installing Ruby"

  pushd /tmp
  echo "Downloading REE"
  wget -q http://rubyforge.org/frs/download.php/55511/$REE.tar.gz
  echo "Untar REE"
  tar xzf $REE.tar.gz
  pushd $REE/

  echo "Running installer"
  ./installer --dont-install-useful-gems -a $PREFIX

  echo "Cleaning up REE download"
  popd
  rm -rf $REE*
  popd

fi

echo "Installing Rake"
gem install rake --no-rdoc --no-ri

echo "Installing Shadow Puppet"
gem install shadow_puppet --no-rdoc --no-ri


#!/bin/bash
#https://www.hackerrank.com/challenges/text-processing-in-linux-the-sed-command-1/problem

sed -e 's/\bthe\b/this/'


#!/bin/bash
file1=1.out
file2=2.out
file3=3.out
file4=4.out
file5=5.out
file6=6.out
file7=7.out
file8=8.out
file9=9.out
rm -f *.out
testFile=../../evaluation/scripts/input/10M.txt
batchSize=100000
mkfifo $file1
mkfifo $file2
mkfifo $file3
mkfifo $file4
# mkfifo $file5

mkfifo $file7
mkfifo $file8
mkfifo $file9

# mkfifo $file6
# cat $testFile > $file9 &
# ../auto-split.sh $file9 $file1 $file2 &
# grep '\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4' < $file3 > $file4 &
# grep '\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4' < $file2 > $file6 &
# ../eager.sh $file1 $file3 temp &
# ../eager.sh $file6 $file7 temp2 &
# cat $file4 $file7 > $file5

../r_split $testFile $batchSize $file1 $file2 $file7 &

../r_wrap grep '\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4' < $file1 > $file3 &
../r_wrap grep '\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4' < $file2 > $file4 &
../r_wrap grep '\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4' < $file7 > $file8 &

../r_merge $file3 $file4 $file8> $file5

# cat $testFile | grep '\(.\).*\1\(.\).*\2\(.\).*\3\(.\).*\4' > $file6
# if cmp -s "$file6" "$file5"; then
#     printf 'The file "%s" is the same as "%s"\n' "$file6" "$file5"
# else
#     printf 'The file "%s" is different from "%s"\n' "$file6" "$file5"
# fi

# rm -rf *out


<filename>dist/weather_radar.sh
#!/bin/bash
cd /home/homeassistant/.homeassistant/www/weather_card

curl -s -o "dmv-weather.png" "https://s.w-x.co/staticmaps/wu/wu/wxtype1200_cur/usshd/animate.png"
curl -s -o "sat-weather.png" "https://s.w-x.co/staticmaps/wu/wu/wxtype1200_cur/ussat/animate.png"

#create the gif
/home/homeassistant/.homeassistant/gifsicle-static -O3 --colors 132 --lossy=1500 -o /home/homeassistant/.homeassistant/www/weather_card/weather_map_sat.gif sat-weather.png
/home/homeassistant/.homeassistant/gifsicle-static -O3 --colors 132 --lossy=1500 -o /home/homeassistant/.homeassistant/www/weather_card/weather_map_dmv.gif dmv-weather.png

#reduce the size of gif
mogrify -size 1200x875 -resize 492x359 *.gif

#create mp4
ffmpeg -f gif -i sat-weather.png -pix_fmt yuv420p -c:v libx264 -preset veryslow -tune animation -profile:v baseline -crf 34 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' weather_map_sat.mp4 -y

ffmpeg -f gif -i dmv-weather.png -pix_fmt yuv420p -c:v libx264 -preset veryslow -tune animation -profile:v baseline -crf 34 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' weather_map_dmv.mp4 -y

#remove the original files
rm sat-weather.png
rm dmv-weather.png

#return the original folder
cd /home/homeassistant/.homeassistant/includes/


cd core
sbt -Dver=12.1.4.0.1 "publish-local"
cd ..
cd api
sbt -Dver=12.1.4.0.1 "publish-local"
cd ..


<reponame>coinse/FSE2021-IVR-BIC
PID=$1
VID=$2
BIC=$3
defects4j checkout -p ${PID} -v ${VID}b -w /tmp/${PID}-${VID}b-check
cd /tmp/${PID}-${VID}b-check
defects4j export -p classes.relevant -o classes.relevant
defects4j export -p tests.trigger -o tests.trigger.expected
defects4j export -p dir.src.classes -o dir.src.classes
defects4j test
mv failing_tests failing_tests.original
git format-patch ${BIC} --stdout > d4j.patch
git checkout ${BIC}
git apply d4j.patch
git checkout -- $(cat dir.src.classes)
#cat tests.trigger.expected


figlet HiveKit  V.1.0.1 STABLE -c -k
git pull
python3 hive.py > log.txt


#!/usr/bin/env bash
set -eou pipefail

IPLIST_URL=https://www.cloudflare.com/ips-v4
NGINX_CONFIG_LOCATION="{{ cloudflare_nginx_config }}"

generate_nginx_config() {
    local list=$1;
    local ip;
    for ip in $list;do
        echo "set_real_ip_from ${ip};"
    done
}

update_nginx_config() {
    local iplist;
    local config_content;
    local current_config;

    iplist="$(curl -sfL "${IPLIST_URL}")"
    config_content="$(generate_nginx_config "${iplist}")"
    if [ -f "$NGINX_CONFIG_LOCATION" ];then
        current_config="$(cat ${NGINX_CONFIG_LOCATION})"
        if [ "${current_config}" = "${config_content}" ];then
            echo "Cloudflare configuration up to date"
            return
        fi
    fi

    echo "Updating cloudflare configuration"
    echo "${config_content}" > "$NGINX_CONFIG_LOCATION"
    echo "Reloading nginx"
    systemctl reload nginx
}

update_nginx_config


STAGE=${1:-sample}

# Helm can only access files within its chart folder, so copy them here.
rm -rf deploy/kubernetes/idv/config
cp -r config deploy/kubernetes/idv/config

export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace ${NAMESPACE} mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)

cd deploy/kubernetes/idv || exit
helm upgrade --install ${RELEASE} . --namespace ${NAMESPACE} -f values.yaml -f values.${STAGE}.yaml --set mongodb.auth.rootPassword=$MONGODB_ROOT_PASSWORD --debug


<filename>Flite-TTS-Engine-for-Android/build.sh
#!/bin/sh
FLITE_APP_DIR="$(dirname $(readlink -f "$0"))"
FLITE_BUILD_DIR="${FLITE_APP_DIR}/flite"
FLITE_ARCHIVE_URL="http://www.festvox.org/flite/packed/flite-2.0/flite-2.0.0-release.tar.bz2"
FLITE_ARCHIVE_MD5="645db96ffc296cbb6d37f231cc1cc6b2"
FLITE_ARCHIVE_NAM="$(basename "${FLITE_ARCHIVE_URL}")"
FLITE_ARCHIVE_DIR="$(basename "${FLITE_ARCHIVE_URL}" .tar.bz2)"

FLITE_PATCH='
--- flite-2.0.0-release/configure.in	2014-12-09 22:39:01.000000000 +0100
+++ flite-2.0.0-release.new/configure.in	2016-06-15 12:36:53.543619329 +0200
@@ -151,16 +151,22 @@
                 # http://developer.android.com/sdk/ndk/index.html
 		shared=false

+		if test -z "${ANDROID_NDK}";
+		then
+			ANDROID_NDK="${ANDROID_NDK_HOME}"
+		fi
+
 		# We target our compilation to android-14 (4.0) platform
 		ANDROID_NDK_PLATFORM_PATH="$ANDROID_NDK/platforms/android-14"

-		ANDROID_GCC_VERSION=4.6
+		ANDROID_GCC_ARCH="$(uname -m)"
+		ANDROID_GCC_VERSION=4.9

 		if test "$target_cpu" = "armeabi"
                 then
 		   ANDROID_TOOLCHAIN="arm-linux-androideabi-$ANDROID_GCC_VERSION"
 		   ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-arm"
-		   ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/arm-linux-androideabi"
+		   ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-$ANDROID_GCC_ARCH/bin/arm-linux-androideabi"
       		   CFLAGS="$CFLAGS -fpic -mthumb -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
                 fi

@@ -168,7 +174,7 @@
                 then
 		   ANDROID_TOOLCHAIN="arm-linux-androideabi-$ANDROID_GCC_VERSION"
 		   ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-arm"
-		   ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/arm-linux-androideabi"
+		   ANDROIDBIN="$ANDROID_NDK/toolchains/arm-linux-androideabi-$ANDROID_GCC_VERSION/prebuilt/linux-$ANDROID_GCC_ARCH/bin/arm-linux-androideabi"
       		   CFLAGS="$CFLAGS -fpic -march=armv7-a -mfloat-abi=softfp -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
 		   LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
                 fi
@@ -177,7 +183,7 @@
 		then
 		   ANDROID_TOOLCHAIN="x86-$ANDROID_GCC_VERSION"
 		   ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-x86"
-		   ANDROIDBIN="$ANDROID_NDK/toolchains/x86-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/i686-linux-android"
+		   ANDROIDBIN="$ANDROID_NDK/toolchains/x86-$ANDROID_GCC_VERSION/prebuilt/linux-$ANDROID_GCC_ARCH/bin/i686-linux-android"
       		   CFLAGS="$CFLAGS -fpic -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
 		fi

@@ -185,7 +191,7 @@
 		then
 		   ANDROID_TOOLCHAIN="mipsel-linux-android-$ANDROID_GCC_VERSION"
 		   ANDROID_NDK_SYSROOT="$ANDROID_NDK_PLATFORM_PATH/arch-mips"
-		   ANDROIDBIN="$ANDROID_NDK/toolchains/mipsel-linux-android-$ANDROID_GCC_VERSION/prebuilt/linux-x86/bin/mipsel-linux-android"
+		   ANDROIDBIN="$ANDROID_NDK/toolchains/mipsel-linux-android-$ANDROID_GCC_VERSION/prebuilt/linux-$ANDROID_GCC_ARCH/bin/mipsel-linux-android"
       		   CFLAGS="$CFLAGS -fpic -O3 -DANDROID --sysroot=$ANDROID_NDK_SYSROOT"
 		fi
';

# Abort after first error
set -e
OLDPWD="${PWD}"

# Check for required environment vairables
HAVE_REQUIRED_ENVS=true

if [ -z "${ANDROID_NDK}" ] && [ -z "${ANDROID_NDK_HOME}" ];
then
	echo "Missing Android NDK path environment variable: ANDROID_NDK / ANDROID_NDK_HOME" >&2
	HAVE_REQUIRED_ENVS=false
fi

if [ -z "${ANDROID_SDK}" ] && [ -z "${ANDROID_HOME}" ];
then
	echo "Missing Android SDK path environment variable: ANDROID_SDK / ANDROID_HOME" >&2
	HAVE_REQUIRED_ENVS=false
fi

if ! ${HAVE_REQUIRED_ENVS};
then
	exit 1
fi

export FLIGHT_APP_DIR

# Download and patch flight, unless it was provided
if [ -z "${FLITEDIR}" ];
then
	# Check if the actual `flight` build directory exists
	flite_directory="${FLITE_BUILD_DIR}/${FLITE_ARCHIVE_DIR}"
	if ! [ -d "${flite_directory}" ];
	then
		mkdir -p "${FLITE_BUILD_DIR}"

		flite_archive="${FLITE_BUILD_DIR}/${FLITE_ARCHIVE_NAM}"

		# Download the `flight` file archive
		if ! [ -e "${flite_archive}" ];
		then
			wget "${FLITE_ARCHIVE_URL}" -O "${flite_archive}"
		fi

		# Verify the archive's integrity
		echo "${FLITE_ARCHIVE_MD5}  ${flite_archive}" | md5sum --check -

		# Extract the `flight` file archive
		tar -C "${FLITE_BUILD_DIR}" -xvf "${flite_archive}"

		# Patch `flight` configure script to work with newer versions of the NDK (10e – 11c tested)
		cd "${flite_directory}"
		echo "${FLITE_PATCH}" | patch -p 1
		autoreconf
		cd "${OLDPWD}"

	fi

	export FLITEDIR="${flite_directory}"
fi

# Build `flight` engine for all supported targets
cd "${FLITEDIR}"
for arch in armeabi armeabiv7a x86 mips;
do
	if ! [ -e "${FLITEDIR}/build/${arch}-android/lib/libflite.a" ];
	then
		./configure --with-langvox=android --target="${arch}-android"
		make -j4
	fi
done
cd "${OLDPWD}"

# Build the Android application package
if [ $# -gt 0 ];
then
	action="${1}"
	shift 1
else
	action="debug"
fi
ant "${action}" "$@"


if test $# -ne 2
then
    echo "sh $0 <ftype> <column>" >&2
    exit
fi

ftype=$1
col=$2

n=`cat "$ftype"*.dat | wc -l`

awk '{print $(col)}' col=$col "$ftype"*.dat \
    | sort -g \
    | awk '{print $1, NR/n}' n=$n


<gh_stars>0
ANSIBLE_STDOUT_CALLBACK=debug ansible-playbook tukole_frontend.yml -i inventory/hosts.ini


<reponame>bkasws/dex
#!/bin/bash -x

COMPOSE_VERSION="1.23.2"
COMPOSE_URL="https://github.com/docker/compose/releases/download/$COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)"

install_user_deploy() {
  sudo useradd -g users -s `which bash` -m deploy
}

# Opendax bootstrap script
install_core() {
  sudo bash <<EOS
apt-get update
apt-get install -y -q git tmux gnupg2 dirmngr dbus htop curl libmariadbclient-dev-compat build-essential
EOS
}

log_rotation() {
  sudo bash <<EOS
mkdir -p /etc/docker
echo '
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "10"
  }
}' > /etc/docker/daemon.json
EOS
}

# Docker installation
install_docker() {
  curl -fsSL https://get.docker.com/ | bash
  sudo bash <<EOS
usermod -a -G docker deploy
curl -L "$COMPOSE_URL" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
EOS
}

if id "deploy" >/dev/null 2>&1; then
  echo "user deploy exists"
else
  install_user_deploy
fi

install_core
log_rotation
install_docker


#! /bin/bash

PRGNAME="etc-shells"

### /etc/shells (login shell list)
# Файл /etc/shells содержит список оболочек для входа в систему. Приложения
# используют этот файл, чтобы определить, является ли оболочка действительной.

# в файле /etc/profile мы изменили $PATH и этот файл уже установлен в систему
# LFS, поэтому тест скрипта check_environment.sh в этой директории не будет
# пройден. Проверим окружение явно:
if [[ "$(id -u)" != "0" ]]; then
    echo "Only superuser (root) can run this script"
    exit 1
fi

# мы в chroot окружении?
ID1="$(awk '$5=="/" {print $1}' < /proc/1/mountinfo)"
ID2="$(awk '$5=="/" {print $1}' < /proc/$$/mountinfo)"
if [[ "${ID1}" == "${ID2}" ]]; then
    echo "You must enter chroot environment."
    echo "Run 003_entering_chroot.sh script in this directory."
    exit 1
fi

ROOT="/"

TMP_DIR="/tmp/pkg-${PRGNAME}"
rm -rf "${TMP_DIR}"
mkdir -pv "${TMP_DIR}/etc"

SHELLS="/etc/shells"
# оболочки записываются как полный путь к исполняемому файлу в отдельной строке
cat << EOF > "${TMP_DIR}${SHELLS}"
# Begin ${SHELLS}

/bin/sh
/bin/bash

# End ${SHELLS}
EOF

/bin/cp -vR "${TMP_DIR}"/* /

cat << EOF > "/var/log/packages/${PRGNAME}"
# Package: ${PRGNAME} (login shell list)
#
# /etc/shells
#
EOF

source "${ROOT}write_to_var_log_packages.sh" \
    "${TMP_DIR}" "${PRGNAME}"


#!/bin/bash

# Deletes devices from a GCP IoT registry.
#
# Usage:
#   ./createDevices.sh
#
# The deviceIds to delete are read from devicelist.csv in the ltk root directory.

function info {
  echo "LTK: $1"
}

while IFS=',' read deviceId rest; do

  gcloud iot devices delete $deviceId \
    --project=$LTK_TARGET_PROJECT_ID \
    --region=$LTK_TARGET_REGION \
    --registry=$LTK_TARGET_REGISTRY_ID \
    --quiet

done < $LTK_ROOT/devicelist.csv

# All the devices are deleted so delete this devicelist.
info "Devices deleted from GCP, deleting $LTK_ROOT/devicelist.csv"
rm $LTK_ROOT/devicelist.csv


<reponame>particleman314/ShellLibrary<gh_stars>1-10
#!/usr/bin/env bash

assert_not_empty "${TEST_XML}"

__disable_xml_failure

fieldpath='/base/level2/field1/subfield2/subsubfield2'

answer=$( xml_count_entries )
assert_failure $?
assert_false "${answer}"

answer=$( xml_count_entries --xmlfile "${TEST_XML}" )
assert_failure $?
assert_equals "${answer}" 0

answer=$( xml_count_entries --xpath "${fieldpath}" )
assert_failure $?
assert_equals "${answer}" 0

answer=$( xml_count_entries --xmlfile "${TEST_XML}" --xpath "${fieldpath}"  )
assert_success $?
assert_equals "${answer}" 2

fieldpath="/base/level2/field1/subfield2/subsubfield1"
answer=$( xml_count_entries --xmlfile "${TEST_XML}" --xpath "${fieldpath}"  )
assert_success $?
assert_equals "${answer}" 1

fieldpath="/base/level2/field1/blah"
answer=$( xml_count_entries --xmlfile "${TEST_XML}" --xpath "${fieldpath}"  )
assert_success $?
assert_equals "${answer}" 0


<reponame>UKCloud/webinars
#!/bin/sh
#

yum -y install epel-release yum-plugin-priorities  mariadb-server mariadb

systemctl enable mariadb.service
systemctl start mariadb.service

cat > /tmp/schema.sql <<-EOF
DATABASE_SCHEMA
EOF

cat /tmp/schema.sql | mysql


<gh_stars>1-10
# initialize the cluster
sudo kubeadm init --pod-network-cidr=10.244.0.0/16

# set config and permissions
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown azureuser:azureuser $HOME/.kube/config

# apply the cni
sudo kubectl apply -f /root/kube-flannel.yml


#!/bin/bash
cd /src/esp/nina-fw
export PATH=/src/esp/xtensa-esp32-elf/bin:$PATH
export IDF_PATH=/src/esp/esp-idf
make firmware
cp /src/esp/nina-fw/build/bootloader/bootloader.bin /src/build/
cp /src/esp/nina-fw/build/phy_init_data.bin /src/build/
cp /src/esp/nina-fw/build/nina-fw.bin /src/build/
cp /src/esp/nina-fw/build/partitions.bin /src/build/
cd -


<reponame>Diffblue-benchmarks/Rabbitmq-rabbitmq-tutorials
#!/bin/bash

set -ex

rm -rf ~/Library/Caches/org.carthage.CarthageKit

for tutdir in `ls | grep "tutorial[1-9]"`
do
    cd $tutdir
    carthage update --platform iOS
    cd ..
done


<reponame>cognusion/go-jar
#!/bin/bash

NAME=jard

go build -o $NAME -ldflags "-linkmode external -extldflags -static"

# Grab the version, per the build
VERSION=`./${NAME} --version | perl -pe 's/\n/\t/g' | cut -f 1 | cut --delimiter=' ' -f 2`

echo
echo "$NAME $VERSION..."

rm -f $NAME.zip
rm -Rf builds/
mkdir builds
cp $NAME builds/
zip -j $NAME.zip builds/*

rm -Rf builds/


#!/bin/bash

### g09td2csv
### Script to obtain transition energies and intensities from Gaussian09 TD calculation
### Export data in CSV (Comma-Separated Values)
### Grupo de Espectroscopia Teórica e Modelagem Molecular - GETMM (IQ/UFRJ)
### Author <NAME> : <EMAIL>

###############################
#### Variables Definitions ####
###############################

## Log complete filename with extension
LogFile=$1

###################
#### Functions ####
###################

## CheckingInputFile function
function CheckingInputFile {
if [ -n "$LogFile" ]; then
	if [ ! -f "$LogFile" ]; then
		echo -e "\033[01;31m$1 Gaussian09 log file was not found.\033[00m"
		exit 1
	fi
else
	echo -e "Usage: g09td2csv [Gaussian09 log file]"
	exit 1
fi

if grep -q "Normal termination of Gaussian 09" "$LogFile"; then
    if grep -q "Excited State" "$LogFile"; then
		LogName=$(basename "$LogFile")
		LogName="${LogName%.*}"
    fi
else
	echo -e "\033[01;31mGaussian09 log aren't from TD type. End of script execution.\033[00m"
	exit 1
fi
}

## BuildingCSVfile function
function BuildingCSVfile {
	# Obtaining TD data from log file
	grep "Excited State" $LogFile |awk '{print $5}' > .energy.temp
	grep "Excited State" $LogFile |awk '{print $9}'|cut -f 2 -d '=' > .oos.temp

	# Building CSV File
	touch $LogName.td.csv
	echo "Transition Energy (eV),Oscillator Strength" > $LogName.td.csv
	paste -d "," .energy.temp .oos.temp >> $LogName.td.csv

	# Removing temporary files
	rm -f .energy.temp .oos.temp
}

## FinishingScript function
function FinishingScript {
	echo -e "\033[01;32m$LogName.td.csv preview:\033[00m"
	cat $LogName.td.csv
	echo -e "\033[01;32mg09td2csv was sucesfully executed.\033[00m"
}

#####################
#### Main Script ####
#####################

## Checking Gaussian09 log file
CheckingInputFile

## Building CSV file
BuildingCSVfile

## Finishing script
FinishingScript


#!/bin/bash

set -e

SCRIPTS_DIR=$(dirname "${BASH_SOURCE[0]}")

export HELM_NO_PREPARE="${HELM_NO_PREPARE:-0}"
if [[ "$1" == "-f" ]]; then HELM_NO_PREPARE=1; shift; fi

if [ -z "$1" ]; then echo >&2 "Release is required as the first argument"; exit 1; fi
if [ -z "$2" ]; then echo >&2 "Namespace is required as the second argument"; exit 1; fi

type schelm >/dev/null 2>&1 || { echo >&2 -e "The 'schelm' command is required for this script to run.\n\n --> Installation: https://github.com/databus23/schelm"; exit 1; }

"${SCRIPTS_DIR}/helm_prepare.sh"

RELEASE="$1"
NAMESPACE="${2}"

echo >&2 -e "\n########## Dry run - Release: ${RELEASE} ########## \n"

mkdir -p /tmp/schelm

helm upgrade \
  "${RELEASE}" \
  . \
  --install \
  --dry-run \
  --namespace "${NAMESPACE}" \
  -f "values.${RELEASE}.yaml" \
  -f values.custom.yaml
# | schelm -f /tmp/schelm/${RELEASE}

echo >&2 -e "You can find the hydrated Kubernetes configuration files here: /tmp/schelm/${RELEASE}"


#!/usr/bin/env bash

if [ ! -f target/scala-2.11/shoushiling_2.11-0.2.0-runnable.jar ]
then
    ./activator assembly
fi
java -jar target/scala-2.11/shoushiling_2.11-0.2.0-runnable.jar $1


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

# Purpose:     Master Settings
# Author:      CM
# Date:        Jan 2017
# Language:    Shell (.sh)

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

#----------------------------------------------------------------------------#
#                                  Settings                                  #
#----------------------------------------------------------------------------#

# initialise  [* DEFAULT]
#-------------------------------------------------#
export execution_id=`date +%s`
echo $execution_id

export current_date=$(date +"%m_%d_%Y")
echo $current_date

export wd_path=$(pwd)
echo $wd_path

echo $PATH

# directory settings
#-------------------------------------------------#

# directories [* DEFAULT SETTINGS]
export wd_path_helper=$wd_path"/helper"
export wd_path_data=$wd_path"/data"
export wd_path_helper=$wd_path"/helper"
export wd_path_log=$wd_path"/log"
export wd_path_code=$wd_path"/code_base"
export wd_path_TextToCode=$wd_path"/TextToCode"

export wd_path_output=$(cd $wd_path/../../../output; pwd)
export wd_path_interface=$(cd $wd_path/../../../interface; pwd)

## data paths
export data_path_raw=$wd_path_data"/raw_data"
export data_path_temp=$wd_path_data"/temp_data"
export data_path_parsed=$wd_path_data"/parsed_data"
export data_path_structured=$wd_path_data"/structured_data"
export data_path_annotated=$wd_path_data"/annotated_data"

## vb interface paths
export vb_path_input=$wd_path_interface"/product_code_input"
export vb_path_output=$wd_path_interface"/product_code_output"
export send_path=$wd_path_interface"/send_order"

## error_paths
export error_path_ocr=$wd_path_data"/error/ocr"
export error_path_parsed=$wd_path_data"/error/parse"

## archived paths
export data_path_archived_raw=$wd_path_data"/archived_data/raw_data"
export data_path_archived_parsed=$wd_path_data"/archived_data/parsed_data"
export data_path_archived_structured=$wd_path_data"/archived_data/structured_data"
export data_path_archived_annotated=$wd_path_data"/archived_data/annotated_data"
export data_path_archived_sent=$wd_path_data"/archived_data/sent_data"
export data_path_archived_error=$wd_path_data"/archived_data/error"

## code paths
export init_path=$wd_path_code"/helper_code"

## helper paths
export helper_path_keyword=${wd_path_helper}"/product/master_keyword.xlsm"

## texttocode app
export app_name=`cat helper/TextToCode/app_version.txt`
export database_name=`cat helper/TextToCode/database_version.txt`

export TextToCode_app=$wd_path_TextToCode"/"$app_name
export TextToCode_database=$wd_path_TextToCode"/"$database_name

export TextToCode_input=$wd_path_TextToCode"/input"
export TextToCode_output=$wd_path_TextToCode"/output"

# parsing settings [DEFAULT]
#-------------------------------------------------#
# export thorough_mode="FALSE"
export thorough_mode="TRUE"

# email settings [DEFAULT]
#-------------------------------------------------#
export email_sender=`cat helper/user_setting/email/email_sender.txt`
export email_text=`cat helper/user_setting/email/email_text.txt`
export email_pwd=`cat helper/user_setting/email/email_password.txt`
export email_address=`cat helper/user_setting/email/email_username.txt`
export email_cc_address=`cat helper/user_setting/email/email_cc_address.txt`

# Cocoa Dialogue [DEFAULT]
#-------------------------------------------------#
export CD="$wd_path/code_base/helper_code/CocoaDialog.app/Contents/MacOS/CocoaDialog"

# Excel [DEFAULT]
#-------------------------------------------------#
export EXCEL=`cat helper/user_setting/excel/excel_path.txt`

# PHP [DEFAULT]
#-------------------------------------------------#
export PHP="/usr/local/php5/bin/php"
export PHP_ini="/usr/local/php5/lib/php.ini"

#----------------------------------------------------------------------------#
#                                    End                                     #
#----------------------------------------------------------------------------#


<reponame>vuejs-translations/ryu-cho
git clone https://github.com/vuejs-jp/ryu-cho.git


<reponame>glenjamin/typescript-xunit-xml
#!/bin/sh

cat sample.txt | node main.js > actual.txt
result=$?

git diff --exit-code --no-index expected.txt actual.txt
diff=$?

if [ "$result" != "1" ]; then
  echo "Unexpected exit code $result. Expected 1"
  exit 1
fi

if [ "$diff" != "0" ]; then
  echo "Unexpected output diff"
  exit 1
fi


<filename>notes/ncat_note.sh<gh_stars>0
#!/bin/bash

ncat -l -U /tmp/gemini-btcusd.out -k --send-only < /tmp/gemini-btcusd.in


#!/bin/bash

moonbox_home_dir="$(cd "`dirname "$0"`/.."; pwd)"
if [ -f "${moonbox_home_dir}/conf/moonbox-env.sh" ]; then
  . "${moonbox_home_dir}/conf/moonbox-env.sh"
fi

java -cp $MOONBOX_HOME/libs/moonbox-repl_2.11-0.2.0-SNAPSHOT.jar  moonbox.repl.Main "$@"


<reponame>ebilling/dd-trace-go
#!/bin/sh

#
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2016 Datadog, Inc.
#

# Update the libddwaf to the latest GitHub release version.
# Usage: ./update-libddwaf.sh
#

set -ex

bindings_dir=$(readlink -f "$(dirname $0)/..")

echo Looking up for the latest GitHub release

latest_release=$(curl -s https://api.github.com/repos/DataDog/libddwaf/releases/latest)
version=$(jq -r '.tag_name') << EOF
$latest_release
EOF

echo Found libddwaf v$version

tmpdir=$(mktemp -d /tmp/libddwaf-XXXXXXXX)
echo Using $tmpdir

run_binutils() {
  docker run -it --rm -v $bindings_dir:$bindings_dir -v $tmpdir:$tmpdir -w $PWD ghcr.io/datadog/binutils-gdb:2.37 $@
}

run_strip() {
  run_binutils $1-strip --strip-dwo --strip-unneeded --strip-debug $2
}

#
# darwin/amd64
#

echo Updating libddwaf for darwin/amd64
curl -L https://github.com/DataDog/libddwaf/releases/download/$version/libddwaf-$version-darwin-x86_64.tar.gz | tar -xz -C$tmpdir
echo Copying the darwin/amd64 library
cp -v $tmpdir/libddwaf-$version-darwin-x86_64/lib/libddwaf.a $bindings_dir/lib/darwin-amd64
run_strip x86_64-apple-darwin $bindings_dir/lib/darwin-amd64/libddwaf.a

#
# linux/amd64
#

echo Updating libddwaf for linux/amd64
# 1. Download the libddwaf build
curl -L https://github.com/DataDog/libddwaf/releases/download/$version/libddwaf-$version-linux-x86_64.tar.gz | tar -xz -C$tmpdir
# 2. Download the libc++ build
libcxx_dir=$tmpdir/libc++-x86_64-linux
mkdir $libcxx_dir
curl -L https://github.com/DataDog/libddwaf/releases/download/$version/libc++-static-x86_64-linux.tar.gz | tar -xz -C$libcxx_dir
# 3. Combine libddwaf.a + libc++.a + libc++abi.a + libunwind.a in a single
#  object file by using ld -r
run_binutils x86_64-linux-gnu-ld \
   -r -o $bindings_dir/lib/linux-amd64/libddwaf.a \
   --require-defined=ddwaf_init \
   --require-defined=ddwaf_get_version \
   --require-defined=ddwaf_destroy \
   --require-defined=ddwaf_context_init \
   --require-defined=ddwaf_result_free \
   --require-defined=ddwaf_context_destroy \
   --require-defined=ddwaf_required_addresses \
   $tmpdir/libddwaf-$version-linux-x86_64/lib/libddwaf.a $libcxx_dir/libc++.a $libcxx_dir/libc++abi.a $bindings_dir/lib/linux-amd64/libunwind_linux_amd64.a #$libcxx_dir/libunwind.a
# 4. Strip
run_strip x86_64-linux-gnu $bindings_dir/lib/linux-amd64/libddwaf.a

#
# ddwaf.h
# Note that we arbitrarily take it from the linux/amd64 archive as it does not
# depend on the target.
#
echo Updating ddwaf.h
cp -v $tmpdir/libddwaf-$version-linux-x86_64/include/ddwaf.h $bindings_dir/include


#!/usr/bin/env bash

# name of current dir
NAME=$(basename "$PWD")

podman run -v "$(pwd):/root/$NAME":Z -w "/root/$NAME" -it "$@"
# -t   -- allocate TTY
# -i   -- keep STDIN open

# running podman/docker is not trivial and not convenient  - need to be aware
# to :z :Z flags to volumes, -it flags to execute commands in the shell, need
# to understand how share/unshare works if container specifies USER directive
#
# `runin-podman.sh` tries to address some problems with that
#
# [ ] you can not reentry the container if you quit
# [x] current directory is not mounted by default (with necessary :Z flag for Fedora)
# [x] container is not interactive be default
# [ ] there is no default image
#
# all these problem are addressed by https://github.com/containers/toolbox but
# it also add a serious security issue
#
# [x] `toolbox` makes the whole HOME directory r/w accessible
#
# that means SSH keys are readable, setup / test scripts can mess with
# dotfiles. while the `toolbox` may be useful for OS developers, who need to
# test package installation and rollback, it is not secure enough to run
# random projects from GitHub in isolation


# Bump version number & build
VERSION=$(cat VERSION | perl -pe 's/^((\d+\.)*)(\d+)(.*)$/$1.($3+1).$4/e' | tee VERSION)
docker build -t jdallen/apcups:$VERSION -t jdallen/apcups:latest .


perl $SHALLOW_PARSER_BEN/bin/sys/common/printinput.pl $1 > vibhakticomputationinput$$
perl $SHALLOW_PARSER_BEN/bin/sl/vibhakticomputation/vibhakticomputation.pl --path=$SHALLOW_PARSER_BEN/bin/sl/vibhakticomputation --input=vibhakticomputationinput$$
rm -fr vibhakticomputationinput$$


#!/usr/bin/env bash

# Get location of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Go to data folder
cd $DIR/../data

# Download gaussian_input_files.tar.gz
wget -O gaussian_input_files.tar.gz https://osf.io/v8awm/download


#!/bin/sh
sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid robocup ap any
#sudo dhclient wlan0
sudo ip route add 192.168.1.0/24 via 192.168.123.1


<gh_stars>0
#!/usr/bin/env bash

set -e

curl https://cache.agilebits.com/dist/1P/op/pkg/$VERSION/op_linux_amd64_$VERSION.zip --output op.zip
unzip op.zip
sudo mv op /usr/local/bin/op
rm op.*


<reponame>Otus-DevOps-2019-08/quotms_infra
#!/bin/bash

packages=(
   ruby-full
   ruby-bundler
   build-essential
)

apt update

for i in "${packages[@]}"
do
    apt install -y $i
done


#!/bin/bash

set -euo pipefail
tag_name=$1

echo "Docker login"
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;

echo "Pushing to Docker-hub, generated from branch $TRAVIS_BRANCH";
docker build -f docker/Dockerfile -t gnosispm/dex-open-solver:$tag_name .;
docker push gnosispm/dex-open-solver:$tag_name;
echo "The image has been pushed";


#!/usr/bin/env bash

if [ "$(id -u)" -ne "$(id -u znc)" ]; then
	printf 'Please run as znc!\n' ; exit 1
fi

CONF='/srv/znc/.znc/configs/znc.conf'
PID="$(pgrep -u znc znc)"

if [ -z "$1" ]; then
    echo -e "Usage: $(basename "$0") [username]" ; exit 1
fi

if grep -Fxq "<User $1>" "$CONF"; then
    echo -e "znc user \"$1\" already exists" ; exit 1
fi

sed -e "s/NEWUSER/$1/g" /srv/znc/newuser.conf.template >> "$CONF"

[ -n "$2" ] && kill -s HUP "$PID"

exit 0


#!/bin/bash

. ./build.sh

TEST_CMD="
cd /zeromq-4.0.4/perf
./local_thr tcp://lo:5555 1 10000000 &
./remote_thr tcp://localhost:5555 1 10000000
sleep 1
wait
./local_thr tcp://lo:5555 10 1000000 &
./remote_thr tcp://localhost:5555 10 1000000
sleep 1
wait
./local_thr tcp://lo:5555 100 100000 &
./remote_thr tcp://localhost:5555 100 100000
sleep 1
wait
./local_thr tcp://lo:5555 1000 10000 &
./remote_thr tcp://localhost:5555 1000 10000
wait
sleep 1
./local_thr tcp://lo:5555 10000 1000 &
./remote_thr tcp://localhost:5555 10000 1000
wait
sleep 1
./local_thr tcp://lo:5555 100000 100 &
./remote_thr tcp://localhost:5555 100000 100
wait
"

. ../test.inc


<reponame>fossabot/DynMatch<filename>compile_withcmake.sh
#!/bin/bash

NCORES=4
unamestr=`uname`
if [[ "$unamestr" == "Linux" ]]; then
        NCORES=`grep -c ^processor /proc/cpuinfo`
fi

if [[ "$unamestr" == "Darwin" ]]; then
        NCORES=`sysctl -n hw.ncpu`
fi

rm -rf deploy
rm -rf build
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release
make -j $NCORES
cd ..

mkdir deploy
cp ./build/dynmatch deploy/
cp ./build/conver* deploy/
rm -rf build


#!/bin/bash
set -x

# Network post-configuration actions that should be run on every boot should be appended here
# Used by net-postconfig systemd service

route_table_cfg_file="/etc/vmware/route-tables.cfg"

# Appends an entry to the route-table service's config file.
# Input values:
# - 1 Routing Table ID
# - 2 Routing Table Name = Network/Interface Name
# - 3 Interface MAC
# - 4 Gateway IP (If unset, assumes acquired using DHCP)
writeRouteTableConfig() {
    id="${1}"
    network="${2}"
    mac="${3}"
    gateway="${4}"
    if [ "${gateway}" == "" ] || [ "${gateway}" == "null" ]; then
        # Assume DHCP. Get it from DHCP lease file.
        ifindex=$(cat "/sys/class/net/${network}/ifindex")
        gateway=$(grep ROUTER "/var/run/systemd/netif/leases/${ifindex}" | cut -d= -f2)
        if [ "${gateway}" == "" ] || [ "${gateway}" == "null" ]; then
            return 0
        fi
    fi
    ip=$(ip -4 address show "${network}" | grep 'scope global' | awk '{print $2}')
    # Set default gateway route if not already set in route-tables.cfg.
    default_gw_route="${id},${network},${mac},${ip},${gateway}"
    if ! grep -Fxq "$default_gw_route" "$route_table_cfg_file"; then
        echo "$default_gw_route" >> "$route_table_cfg_file"
    fi

    # Set linked scope route if not already set in route-tables.cfg.
    linked_scoped_route="${id},${network},${mac},${ip}"
    if ! grep -Fxq "$linked_scoped_route" "$route_table_cfg_file"; then
        echo "$linked_scoped_route" >> "$route_table_cfg_file"
    fi
}


ouid="pi"
nuid="pi001"
/usr/sbin/usermod -l ${nuid} ${ouid}
[ -h /home/pi ] && /bin/rm /home/pi
/usr/sbin/usermod -d /home/${nuid} -m ${nuid}
/usr/sbin/groupmod -n ${nuid} ${ouid}
/bin/sed -E -i "s/^${ouid} /${nuid} /" /etc/sudoers.d/010_pi-nopasswd
/bin/sed -E -i "s/--autologin ${ouid} /--autologin ${nuid} /" /etc/systemd/system/autologin@.service
/bin/sed -E -i "s/autologin-user=${ouid}$/autologin-user=${nuid}/" /etc/lightdm/lightdm.conf
/bin/sed -i "s/:${ouid};/:${nuid};/" /etc/polkit-1/localauthority.conf.d/60-desktop-policy.conf
if [ ${nuid} = "pi" ]; then
  :  # do nothing
else
  if [ ! -e /home/pi ]; then
    /bin/ln -s /home/${nuid} /home/pi
  fi
fi
[ -f /var/spool/cron/crontabs/${ouid} ] && /bin/mv /var/spool/cron/crontabs/${ouid} /var/spool/cron/crontabs/${nuid}
[ -f /var/spool/mail/${ouid} ] && /bin/mv /var/spool/mail/${ouid} /var/spool/mail/${nuid}
[ -e /etc/rc.local.backup ] && /bin/cp /etc/rc.local.backup /etc/rc.local && /bin/rm /etc/rc.local.backup && /sbin/reboot
exit 0


<reponame>jeremyschlatter/vaccine-feed-ingest
#!/usr/bin/env bash

#
# Fetch stage should retrieve raw data from external source and store it unmodified
#

set -Eeuo pipefail

output_dir=""

if [ -n "${1}" ]; then
    output_dir="${1}"
else
    echo "Must pass an output_dir as first argument"
fi

### Replace the following with your implementation ###

echo "Fetching into ${output_dir}"
touch "${output_dir}/data.geojson"


#!/bin/bash
# Script for creating TeraChem inputs.
# Called within script RecalcGeometries.sh
# We need two arguments: input geometry and name of the input file

# SETUP #################################
charge=0             # molecular charge
spin=1               # molecular spin
numstates=8
mem=1500Mb            # memory in G09 job
basis=6-31+g*
method=b3lyp
#----------------------------------------

# For typical TERA jobs, don't modify anything below.
geometry=$1
output=$2
num_gpu=$3
natom=$(head -1 $1 | awk '{print $1}')
path=$(pwd)

cat $geometry > $output.xyz

cat > $output.ground.in << EOF

basis         $basis
method        $method
charge        $charge
spinmult      $spin
maxit         100
xtol          1e-3
threall       1e-12
convthre      1.0e-6
dftgrid       1
gpus          $num_gpu
run           energy
nstep         100
coordinates   $path/$output.xyz

pcm             cosmo
pcm_grid        iswig
pcmgrid_heavy   17
pcmgrid_h       17
epsilon         2.28
pcm_radii       bondi
cosmo_rad_scale 1.2
solvent_radius  0
dynamiccg       3
cgprecond       blockjacobi3
cgblocksize     100
pcm_write       $path/$output.groundfield.bin    #Please note, that Terachem reads all letters as lowercase
end

EOF

let spin2=spin+1
let charge2=charge+1

cat > $output.ss.in << EOF

basis         $basis
method        u$method
charge        $charge2
spinmult      $spin2
maxit         100
xtol          1e-3
threall       1e-12
convthre      1.0e-6
dftgrid       1
gpus          $num_gpu
run           energy
coordinates   $path/$output.xyz

#CIS related
cis       yes
cisnumstates    $numstates
cismaxiter     100
cistarget      1

#PCM related
#most important keywords
pcm           		cosmo
pcm_grid       		iswig
ss_pcm_solvation 	ground_neq
sspcm_convthre   	1e-6
epsilon         	2.28
fast_epsilon    	1.776
pcm_read       		$path/$output.groundfield.bin    #Please note, that Terachem reads all letters as lowercase

#other PCM keywords (same as their default values.
#List explicitly here as examples of what could be specified
pcmgrid_heavy   17
pcmgrid_h       17
pcm_radii       bondi
cgprecond       blockjacobi
end

EOF


<reponame>FaniD/SecureWilly<gh_stars>1-10
#!/bin/bash

#Load the AppArmor profiles for services in the list below
service_list=(cloudsuitemedia-streamingserver cloudsuitemedia-streamingclient cloudsuitemedia-streamingdataset)
for SERVICE in "${service_list[@]}"; do
	sudo apparmor_parser -r -W /etc/apparmor.d/${SERVICE}_profile
done


<reponame>kevakil/mesh-transformer-jax<filename>scripts/to_hf.sh
python3 to_hf_weights.py \
--input-ckpt gs://aarrfsf/home/keyan/mesh-transformer-jax/split_training_data_model_dir/_slim/step_10 \
--output-path gs://aarrfsf/hf_model \
--config ./configs/split_training_data.json


<filename>fabricConfig/startPeer.sh
#!/usr/bin/env bash
export FABRIC_CFG_PATH=/etc/hyperledger/fabric
export CORE_PEER_LOGGINGLEVEL=DEBUG #输出日志级别
export CORE_PEER_ID=peer0.org1.example.com #peer的ID
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 #服务地址
export CORE_PEER_GOSSIP_USELEADERELECTION=true #是否自动选举代表节点
export CORE_PEER_GOSSIP_ORGLEADER=false #是否作为组织代表节点从Ordering服务拉取区块
export CORE_PEER_LOCALMSPID=Org1MSP #所属组织MSP的ID
export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp  #msp文件所在的相对路径
export CORE_VM_ENDPOINT=unix:///var/run/docker.sock #Docker服务地址
export CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=host #链码容器使用的网络模式

export CORE_PEER_TLS_ENABLE=false #是否允许TLS
export CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key #TLS开启时指定的签名私钥
export CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt #TLS开启时指定身份证书位置
export CORE_PEER_TLS_ROOTCERT=[/etc/hyperledger/fabric/artifacts/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt]      #TLS开启时指定信任的跟CA证书位置
peer node start


<reponame>smorimoto/opam-cross-windows
#!/bin/bash -e

. $(dirname $0)/config.sh

for pkg in packages/*; do
  pkgcur=${pkg/-${SUFFIX}/}
  pkgname=${pkgcur/.*/}
  if ! [ -e "${UPSTREAM}/${pkgname}" ]; then
    continue
  fi
  opam remove -y ${pkg/packages\//}
done


<filename>Paco-Server/scripts/getpaco_multipleexperiments.sh
#/bin/bash

echo "enter experimentIds (e.g. 1 or 1,2,3) (these are from the definition page on server)"
read experiment_id

echo "enter report format (csv,json,html)"
read report_format

echo "output file name"
read outfile

#if [ "$experiment_id" =~ "," ]; then
experiment_ids=$(echo $experiment_id  | tr "," "\n")
#else
#  experiment_ids = experiment_id
#fi

for curr_experiment_id in $experiment_ids; do

echo "retrieving $curr_experiment_id"

if [ "$report_format" = "json" ]; then
    result=`curl -L -b ~/.paco_qs_cookie "https://quantifiedself.appspot.com/events?q=experimentId=$curr_experiment_id&json"`
else
    joburl=`curl -L -v -b ~/.paco_qs_cookie "https://quantifiedself.appspot.com/events?q=experimentId=$curr_experiment_id&$report_format" 2>&1 | grep "GET /jobStatus" | cut -d " " -f 3`

    joburl="$joburl&cmdline=1"

    result=`curl -L -b ~/.paco_qs_cookie "https://quantifiedself.appspot.com$joburl"`

    # refresh until the report is ready
    while [ "$result" = pending ]; do
        result=`curl -L -b ~/.paco_qs_cookie "https://quantifiedself.appspot.com$joburl"`
    done
fi

echo "$result" >> $outfile

done