<filename>Tests/compile.sh
#!/bin/sh
echo "Assembling Paladin as a static library (You MUST compile it successfully first)"
cd ../Paladin/objects*
ar rvs paladin.a *.o
echo "Compiling and linking tests against Paladin static library"
cd ../../Tests
g++ 	Main.cpp \
	ProjectTests.cpp \
	CompileCommandsJSONTests.cpp \
	CommandOutputHandlerTests.cpp \
	../Paladin/objects*/paladin.a -o ./tests.o -Wall -lUnitTest++ -I../Paladin -I../Paladin/SourceControl -I../Paladin/BuildSystem -I../Paladin/ThirdParty -I../Paladin/PreviewFeatures -fprofile-arcs -ftest-coverage -lgcov -lbe -llocalestub
echo "Done. Now execute ./tests.o"


#!/bin/bash

# Found here: https://gist.github.com/sultanqasim

# Raspberry Pi ZRAM script
# Tuned for quad core, 1 GB RAM models
# put me in /etc/init.d/zram.sh and make me executable
# then run "sudo update-rc.d zram.sh defaults"

modprobe zram
echo 3 >/sys/devices/virtual/block/zram0/max_comp_streams
echo lz4 >/sys/devices/virtual/block/zram0/comp_algorithm
echo 268435456 >/sys/devices/virtual/block/zram0/mem_limit
echo 536870912 >/sys/devices/virtual/block/zram0/disksize
mkswap /dev/zram0
swapon -p 0 /dev/zram0
sysctl vm.swappiness=70


<gh_stars>1000+
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#
# The following only applies to changes made to this file as part of YugaByte development.
#
# Portions Copyright (c) YugaByte, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied.  See the License for the specific language governing permissions and limitations
# under the License.
#

set -e

# Enables the Red Hat devtoolset on RHEL 6 based systems and executes the
# arguments. On non-RHEL 6 systems, the arguments are executed without changes
# to the environment.
# USAGE: ./enable_devtoolset.sh <command> <args>...

if [[ "$OSTYPE" =~ ^linux ]] && \
   [[ "$(lsb_release -irs)" =~ (CentOS|RedHatEnterpriseServer)[[:space:]]+6\.[[:digit:]]+ ]]; then
  scl enable devtoolset-3 "$*"
else
  # No quotes around $@ because we pass multiple commands in one parameter to this script
  # (see build-and-test.sh for usage).
  $@
fi


#!/bin/sh

# Building Jace requies:
#
#   * Maven
#   * Java 1.8 JDK
#
# On OSX the easiest way to install Maven is to use brew
#
#   brew install maven
#
#
# Troubleshooting:
# ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project jace: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
# org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project jace: Fatal error compiling
#
# Cause: You probably have the Java 1.8 RUNTIME installed but Maven is (trying to) use the Java 1.7 COMPILER.
#  OR  : You probably have Java 1.7 installed but Maven is (trying to) use Java 1.8
# Reference: http://stackoverflow.com/questions/24705877/cant-get-maven-to-recognize-java-1-8
#
# 0. Here is some information to clear up the confusion about Java:
#
#    The JRE (runtime) is needed to RUN Java programs.
#    The JDK (compiler) is needed to COMPILTE Java programs.
#
# Solution:
#
# 1. Check which verison of Java that Maven is using
#
#   mvn -version
#
# 2. Check which version of the Java JRE is installed:
#
#   java -version
#
# You should see something like this:
#
#       java version "1.8.0_66"
#       Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
#
# 3. Check which version of the Java JDK is installed:
#
#   javac -version
#
# If you see something like this:
#
#      javac 1.7.0_75
#
# Then you will need to proceed to the next step, else you can skip it.
#
# 4. Install Java 1.8 JDK (if necessary)
#
# You can download the JDK either via the GUI or the command line:
#   http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
#
# To download from the command line:
#
#   For OSX
#     curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "https://edelivery.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-macosx-x64.dmg"
#     open jdk-8u66-macosx-x64.dmg
#     Double-click on the .pkg
#
#   For Linux
#     curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "https://edelivery.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-i586.tar.gz"
#
#   Reference:
#     Commands / shell script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt.
#     https://gist.github.com/P7h/9741922
#
# 5. Lastly, verify that JAVA_HOME is set:
#
#   echo ${JAVA_HOME}
#
# If it is blank (or not set), set it via:
#
#   export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
#
# Then you can (finally!) build JACE. Whew!
#
# Note: Changing the maven project file 'pom.xml' to use Java 1.7 *won't* work:
#            <plugin>
#                <groupId>org.apache.maven.plugins</groupId>
#                <artifactId>maven-compiler-plugin</artifactId>
#                <version>3.3</version>
#                <configuration>
#                    <source>1.7</source>
#                    <target>1.7</target>
#
# As the source code is using Java 1.8 langauge features.

if [[ -z "$JAVA_HOME" ]]; then
    echo "WARNING: JAVA_HOME was not set"
    echo "... Defaulting to Java 1.8..."
    export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
    echo "... JAVA_HOME=${JAVA_HOME}"
fi

#mvn clean install -X

mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V


<filename>charts/argo-templates/scripts/diff-bq-table.sh
set -euo pipefail

# Copy-pasted from StackOverflow.
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }

# Point to BQ metadata we expect to be present on disk.
declare -r TABLE_DIR=/bq-metadata/${TABLE}
declare -r PK_COLS=$(cat ${TABLE_DIR}/primary-keys)
declare -r COMPARE_COLS=$(cat ${TABLE_DIR}/compare-cols)

# Build the WHERE clause of the SQL query.
declare -a COMPARISONS=()
for c in ${COMPARE_COLS//,/ }; do
  COMPARISONS+=("TO_JSON_STRING(S.${c}) != TO_JSON_STRING(J.${c})")
done
declare -r FULL_DIFF=$(join_by ' OR ' "${COMPARISONS[@]}")

declare -a DATAREPO_PKS=()
for col in ${PK_COLS//,/ }; do
  DATAREPO_PKS+=("J.${col} as datarepo_${col}")
done
declare -r REPO_KEYS=$(join_by ', ' "${DATAREPO_PKS[@]}")

declare -r TARGET_TABLE=${TABLE}_joined

# Target either the live view or the raw table.
# Targeting the raw table will prevent re-ingestion of rows that have already
# been appended & deleted.
declare JADE_TABLE
if [[ ${USE_RAW_TABLE} = 'true' ]]; then
  JADE_TABLE="\`${JADE_PROJECT}.${JADE_DATASET}.datarepo_raw_${TABLE}_*\`"
else
  JADE_TABLE="\`${JADE_PROJECT}.${JADE_DATASET}.${TABLE}\`"
fi

if [[ ! -z "${JADE_FILTER}" ]]; then
  JADE_TABLE="(SELECT * FROM ${JADE_TABLE} WHERE ${JADE_FILTER})"
fi

# Join the data staged in GCS against the existing Jade data, filtering out identical rows.
# The result is stored back in BigQuery for subsequent processing.
declare -ra BQ_QUERY=(
  bq
  --location=US
  --project_id=${STAGING_PROJECT}
  --synchronous_mode=true
  --headless=true
  --format=none
  query
  --use_legacy_sql=false
  --replace=true
  --external_table_definition=${TABLE}::${TABLE_DIR}/schema.json@NEWLINE_DELIMITED_JSON=${GCS_PREFIX}/*
  --destination_table=${STAGING_PROJECT}:${STAGING_DATASET}.${TARGET_TABLE}
)
1>&2 ${BQ_QUERY[@]} "SELECT J.datarepo_row_id, S.*, ${REPO_KEYS}
  FROM ${TABLE} S FULL JOIN ${JADE_TABLE} J
  USING (${PK_COLS}) WHERE ${FULL_DIFF}"

# Echo the output table name so Argo can slurp it into a parameter.
echo ${TARGET_TABLE}


<reponame>zwliew/teeny-thoughts.netlify.com<gh_stars>0
yarn serve -p 2002


<gh_stars>0
#! /bin/env bash
#
# This is a hack to compile customer/internal documentation as pdf - it's
# easyer to mail one pdf document than a set of files.
#
# So, unite all pdf files from /var/opt/UNItools
# together with a table of contents describing tool name, version and vendor
# and put a splashing cover on and call it 'documentation'
#

function make_toc_file()
{
	# Create a table with all all software, version, vendor and URL
	# in
	#	- pdf using tbl and groff for combined documentation
	#	- html/markdown for github/online viewing
	#	- dokuwiki for internal use (abandoned and removed)

	# star here
	SAVE_DIR=`pwd`

	cd ..

	cat << EOF > ${TBL_TXT_FILE}

.PAPER A 4

.TS H box;
c s s
c | c | c
l | l | l | l.
.TH UNItools 1 "Table of Contents"
UNItools Table of Contents
=
Package	Version		Description
EOF

	find . -maxdepth 2 -type f  -name CFG|while read CFG; do
		. $CFG
		VENDOR=`echo $VENDOR | fmt -w 16`
		URL=`echo $URL | fmt -w 20`
		cat << EOF  >> ${TBL_TXT_FILE}
_
		Name	$NAME
$PKG	$VER	Vendor	T{
$VENDOR
T}
		URL	T{
$URL
T}
EOF
	done

	cat << EOF >> ${TBL_TXT_FILE}
.TE

The next pages describes the manual pages for the installed versions of the software components.

EOF

tbl ${TBL_TXT_FILE} | groff -man -Tps | ps2pdf13 - ${TBL_PDF_FILE}
# tbl ${TBL_TXT_FILE} | groff -man -Tascii

#printf "^ %-18s ^ %10s ^ %-45s ^%-45s^\n" "Package" "Version" "Name" "URL"
#find . -maxdepth 2 -type f -name CFG|while read CFG; do
#	. $CFG
#printf "| %-18s | %10s | %-45s | %-45s |\n" "$PKG" "$VER" "$NAME" "$URL" >> /tmp/tmpfile
#done

	cd $SAVE_DIR
}

#
# Main
#
MYNAME="/lan/ssi/shared/software/internal/pkg_tools/bin/pkg_mk_wikitoc.sh"

PREFIX=/lan/ssi/shared/software/internal/UNItools

SRC=$PREFIX/src/GAiA

TARGET=/var/opt/UNItools/docs/UNItools.pdf
COVER=UNItools-coverpage.pdf

TBL_TXT_FILE="/tmp/unitools_list_of_apps.txt"
TBL_PDF_FILE="/tmp/unitools_list_of_apps.pdf"
ALLPDF=`find /var/opt/UNItools/ -name '*.pdf' -type f`

make_toc_file

pdfunite ${COVER} ${TBL_PDF_FILE} ${ALLPDF} ${TARGET}

ls -l ${TARGET}

exit 0


<gh_stars>1-10
#!/bin/sh
#smbadd.sh
if [ $UID -ne 0 ]; then
    echo Non root user. Please run as root.
    exit 1;
fi
echo "Please enter the new system and samaba user's name:"
	read name
echo "Please enter password for $name:"
	read pass
echo "Making $name a system  and samba user"
echo $pass > useradd -p $name
echo $pass > smbpasswd -a -s  $name


#!/bin/sh
WITH_MEMLEAK_TESTS=0 nosetests -w tests/ -s


#!/bin/bash

# For CentOS version 6.
/usr/sbin/ntpdate -s time.google.com
/sbin/clock --systohc


# https://github.com/microsoft/WSL/issues/4245#issuecomment-507619097
# ~/set-date.sh

# Get time from google server or some other reliable source
# TIME_FROM_SERVER=$(curl -v --insecure --silent https://google.com/ 2>&1 | grep Date | sed -e 's/< Date: //');

# echo "$TIME_FROM_SERVER"

# # Set stored time
# date +"%d%m%Y%H%M%S" -d "$TIME_FROM_SERVER";

# echo "Time updated with success!";

# ^^ - this doesn't really work

# vv - do this instead

# sudo apt install ntpdate
sudo ntpdate -sb time.nist.gov


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

set -o noclobber -o noglob -o nounset -o pipefail
IFS=$'\n'

# If the option `use_preview_script` is set to `true`,
# then this script will be called and its output will be displayed in ranger.
# ANSI color codes are supported.
# STDIN is disabled, so interactive scripts won't work properly

# This script is considered a configuration file and must be updated manually.
# It will be left untouched if you upgrade ranger.

# Meanings of exit codes:
# code | meaning    | action of ranger
# -----+------------+-------------------------------------------
# 0    | success    | Display stdout as preview
# 1    | no preview | Display no preview at all
# 2    | plain text | Display the plain content of the file
# 3    | fix width  | Don't reload when width changes
# 4    | fix height | Don't reload when height changes
# 5    | fix both   | Don't ever reload
# 6    | image      | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
# 7    | image      | Display the file directly as an image

# Script arguments
FILE_PATH="${1}"         # Full path of the highlighted file
PV_WIDTH="${2}"          # Width of the preview pane (number of fitting characters)
PV_HEIGHT="${3}"         # Height of the preview pane (number of fitting characters)
IMAGE_CACHE_PATH="${4}"  # Full path that should be used to cache image preview
PV_IMAGE_ENABLED="${5}"  # 'True' if image previews are enabled, 'False' otherwise.

FILE_EXTENSION="${FILE_PATH##*.}"
FILE_EXTENSION_LOWER="${FILE_EXTENSION,,}"
FILE_SIZE=$(stat --printf="%s" "${FILE_PATH}")
MAX_FILE_SIZE_TO_READ=3147528 # 3 Mb

# Settings
HIGHLIGHT_SIZE_MAX=262143  # 256KiB
HIGHLIGHT_TABWIDTH=8
HIGHLIGHT_STYLE='pablo'
PYGMENTIZE_STYLE='autumn'

try() { output=$(eval '"$@"'); }

dump() { echo "$output"; }

separator()
{
    echo "----------------------------------------------------------------------------------------";
}

try_git()
{
    git diff --shortstat "${FILE_PATH}"
    git log --color -n 1 -- "${FILE_PATH}" && separator
}

hexdump()
{
    xxd -l 880 "${FILE_PATH}" && exit 4 || exit 1
}

elf_headers()
{
    readelf -hd "${FILE_PATH}" | grep "Class:\|Data:\|ABI:\|Type:\|Machine:\|(NEEDED)"
    separator
}

elf_rodata_strings()
{
    if [ "${FILE_SIZE}" -lt "${MAX_FILE_SIZE_TO_READ}" ]; then
        readelf -x .rodata "${FILE_PATH}" | sed '1,2d' | sed 's/^.\{12\}\(.\{36\}\).*$/\1/' | xxd -r -p | strings
        separator
    else
        hexdump
    fi
}

on_elf()
{
    elf_headers
    elf_rodata_strings
    exit 5;
}

on_json()
{
    if [ "${FILE_SIZE}" -lt "300000000" ]; then
        echo "JSON lines:"
        echo "--------"
        jq . "${FILE_PATH}" | wc -l
        echo ""

        echo "JSON Schema lines:"
        echo "--------"
        genson "${FILE_PATH}" | jq . | wc -l
        echo ""

        echo "JSON Keys (and frequency):"
        echo "--------"
        genson "${FILE_PATH}" | jq -c  ".. | .required? | .."  | grep -v null | grep -v "^\[" | sort | uniq -c | sort -n -r
        echo ""

        echo "JSON first bytes:"
        echo "--------"
        if [[ "$( tput colors )" -ge 256 ]]; then
            local pygmentize_format='terminal256'
            local highlight_format='xterm256'
        else
            local pygmentize_format='terminal'
            local highlight_format='ansi'
        fi
        head -4000 "${FILE_PATH}" | jq . | highlight --syntax=json --out-format="${highlight_format}"
    fi
    exit 5;
}

on_csv()
{
    if [ "${FILE_SIZE}" -lt "300000000" ]; then
        echo "CSV lines:"
        echo "--------"
        wc -l "${FILE_PATH}"
        echo ""
    fi
    echo "CSV Columns:"
    echo "-------------"
    xsv headers "${FILE_PATH}"
    echo ""
    echo "CSV Stats (on 10K lines):"
    echo "-------------"
    head -10000 "${FILE_PATH}" | xsv stats | xsv table -c 10 && exit 5
    exit 5;
}

on_highlight()
{
    # Syntax highlight
    if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
        exit 2
    fi
    if [[ "$( tput colors )" -ge 256 ]]; then
        local pygmentize_format='terminal256'
        local highlight_format='xterm256'
    else
        local pygmentize_format='terminal'
        local highlight_format='ansi'
    fi
    highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
        --style="${HIGHLIGHT_STYLE}" -- "${FILE_PATH}" && exit 5
    # pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5
}

handle_extension() {
    case "${FILE_EXTENSION_LOWER}" in
        # Archive
        a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
        rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
            atool --list -- "${FILE_PATH}" && exit 5
            bsdtar --list --file "${FILE_PATH}" && exit 5
            exit 1;;
        rar)
            # Avoid password prompt by providing empty password
            unrar lt -p- -- "${FILE_PATH}" && exit 5
            exit 1;;
        7z)
            # Avoid password prompt by providing empty password
            7z l -p -- "${FILE_PATH}" && exit 5
            exit 1;;

        # PDF
        pdf)
            # Preview as text conversion
            pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - && exit 5
            exiftool "${FILE_PATH}" && exit 5
            exit 1;;

        # BitTorrent
        torrent)
            transmission-show -- "${FILE_PATH}" && exit 5
            exit 1;;

        # OpenDocument
        odt|ods|odp|sxw)
            # Preview as text conversion
            odt2txt "${FILE_PATH}" && exit 5
            exit 1;;

        # CSV
        csv)
            on_csv
            exit 1;;

        # JSON
        json)
            on_json
            exit 1;;

        # HTML
        htm|html|xhtml)
            # Preview as text conversion
            w3m -dump "${FILE_PATH}" && exit 5
            lynx -dump -- "${FILE_PATH}" && exit 5
            elinks -dump "${FILE_PATH}" && exit 5
            ;; # Continue with next handler on failure

    esac
}

handle_image() {
    local mimetype="${1}"
    case "${mimetype}" in
        # SVG
        # image/svg+xml)
        #     convert "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
        #     exit 1;;

        # Image
        image/*)
            # `w3mimgdisplay` will be called for all images (unless overriden as above),
            # but might fail for unsupported types.
            exit 7;;

        # Video
        # video/*)
        #     # Thumbnail
        #     ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
        #     exit 1;;

        application/octet-stream)
            hexdump
            ;;
    esac
}

handle_mime() {
    local mimetype="${1}"
    case "${mimetype}" in
        # Text
        text/* | */xml)
            try_git
            on_highlight
            exit 2;;

        # Image
        image/*)
            # Preview as text conversion
            # img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
            exiftool "${FILE_PATH}" && exit 5
            exit 1;;

        # Video and audio
        video/* | audio/*)
            mediainfo "${FILE_PATH}" && exit 5
            exiftool "${FILE_PATH}" && exit 5
            ;;

        application/x-executable|application/x-sharedlib)
            on_elf
            ;;

        data)
            hexdump
            ;;
    esac
}

handle_fallback() {
    echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
    exit 1
}

handle_extension
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
    handle_image "${MIMETYPE}"
fi
handle_mime "${MIMETYPE}"
handle_fallback

exit 1


<reponame>darwin/simverse
#!/usr/bin/env bash

set -e -o pipefail

TEST_SUITE=${1:-default}

LAUNCH_DIR=$(pwd -P)

SIMVERSE_DEBUG_TEST=${SIMVERSE_DEBUG_TEST}
SIMVERSE_TEST_REPOS=${SIMVERSE_TEST_REPOS}

cd "$(dirname "${BASH_SOURCE[0]}")"

TESTS_DIR="$(pwd -P)"

source ../toolbox/_toolbox_lib.sh
source _lib/helpers.sh

cd ..

export SIMVERSE_HOME="$(pwd -P)"

# instead of generating TMP_DIR using mktemp, default SIMVERSE_TEST_TMP to /tmp to prevent error:
# "lightningd: Binding rpc socket to 'lightning-rpc': Filename too long"
# this has something to do with docker bug under macOS: https://github.com/moby/moby/issues/23545
# having long TMP_DIR will cause failures inside docker container, when process tries work with files
# in that mapped volume folder (bind call in case of c-lightning)
SIMVERSE_TEST_TMP=${SIMVERSE_TEST_TMP:-/tmp}
if [[ -n "$SIMVERSE_TEST_TMP" ]]; then
  TMP_DIR="$SIMVERSE_TEST_TMP/simverse-tests"
  rm -rf "$TMP_DIR"
  mkdir -p "$TMP_DIR"
else
  TMP_DIR=$(mktemp -d -t simverse_tests.XXXXXXXX)
fi

if [[ ! "$TMP_DIR" || ! -d "$TMP_DIR" ]]; then
  echo_err "failed to create temp directory"
  exit 1
fi

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

trap "exit 20" HUP INT PIPE QUIT TERM
trap cleanup EXIT

export SIMVERSE_WORKSPACE=${SIMVERSE_WORKSPACE:-$TMP_DIR/_workspace}
if [[ -n "$SIMVERSE_TEST_REPOS" ]]; then
  export SIMVERSE_REPOS="$SIMVERSE_TEST_REPOS"
  export SIMVERSE_GIT_REFERENCE_PREFIX=
else
  export SIMVERSE_REPOS=${SIMVERSE_REPOS:-$TMP_DIR/_repos}
  export SIMVERSE_GIT_REFERENCE_PREFIX=${SIMVERSE_GIT_REFERENCE_PREFIX:-$SIMVERSE_HOME/_repos} # use git references to limit network I/O
fi

cd "${SIMVERSE_HOME}"

log_section start "repos_init"
  announce "init repos"
  ./sv repos init
log_section end "repos_init"

log_section start "repos_report"
  announce "report repos"
  ./sv repos report
log_section end "repos_report"

cd "$TESTS_DIR"

announce "running [$TEST_SUITE] tests from '$(pwd -P)'"

# echo alias commands during tests
export SIMVERSE_VERBOSE_ALIASES=1

. "suites/$TEST_SUITE.sh"

announce "all tests went OK"


<filename>script.sh
#/bin/bash

sudo apt update
sudo apt install cups
sudo usermod -a -G lpadmin pi
sudo reboot
cupsctl --remote-admin --remote-any --share-printers
sudo apt-get install git build-essential libcups2-dev
git clone https://gitlab.com/ScumCoder/splix.git
git clone https://github.com/nu774/jbigkit.git
cd jbigkit && cp Makefile.original Makefile && make
cd libjbig && cp libjbig85.a /usr/lib && cd ../..
cd splix/splix && make && sudo make install
echo 'Installation is done. Now copy your printer drivers to /usr/share/cups/model/ \n'
echo 'e.g. sudo cp ppd/m2020.ppd /usr/share/cups/model/'
echo 'Credits to dufzss @ for<EMAIL>'


<reponame>OsamahAnsari/eternagame.org
#!/bin/bash

# ensure we don't error initial deployment
pm2 stop /var/www/app/ecosystem.config.js || true


export EDITOR=`which vim`
# source `brew --prefix`/etc/profile.d/z.sh
source ~/code/z/z.sh

autoload edit-command-line
zle -N edit-command-line
bindkey '^Xe' edit-command-line


<reponame>TeamSPoon/MUD_ircbot
#!/bin/bash

if pgrep -x "eggdrop" > /dev/null
then
    echo "Running"
    sleep 30
else
    echo "Eggdop not running"
    rm -f pid.*

if [[ $EUID -ne 0 ]]; then
 if ! [[ -f PrologMUD-freenode.user ]]; then
 eggdrop -n -m
  else
 eggdrop -n
 fi
else
   echo "#* "
   echo -e "\e[1;31mWarning: This script ( ${BASH_SOURCE[0]})  should not be run as root. \e[0m"
   echo "#* "
   sudo -u prologmud_server bash ${BASH_SOURCE[0]} $*
fi

fi

sleep 10


<reponame>chinaran/kernel-study-demo
#!/bin/sh

make clean
color_compile make
insmod test.ko
rmmod test
dmesg -c


<reponame>SARDONYX-sard/dotfile<filename>linux/bin/installers/oh-my-posh.sh<gh_stars>1-10
#!/usr/bin/env bash

if (which brew) >/dev/null 2>&1; then
  brew install oh-my-posh
else
  printf "brew not found. \n Changed manual install oh-my-posh."

  sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
  sudo chmod +x /usr/local/bin/oh-my-posh
fi

echo "$(tput setaf 4)"Nerd font installing..."$(tput sgr0)"

curl -fsSL https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CodeNewRoman.zip -o "$HOME"/CodeNewRoman.zip
mkdir -p "$HOME"/.local/share/fonts
unzip "$HOME"/CodeNewRoman.zip -d "$HOME"/.local/share/fonts
fc-cache -fv

echo "$(tput setaf 4)"Remove zCodeNewRoman.zip file..."$(tput sgr0)"
rm "$HOME"/CodeNewRoman.zip

echo "$(tput setaf 2)"Nerd font installed."$(tput sgr0)"


<gh_stars>0
#!/bin/bash
# TODO adapt path to where your create_graspit_files main.py script is
python3 /home/${USER}/PycharmProjects/create_graspit_files/main.py $IVCON $1 $GRASPIT


<filename>geo_dataproc/dataproc.sh
#! bin/sh

# Check if src is spatial archive or file...
if [ -f "$1" ]; then
    # Unzip Static Geospatial Data
    mkdir -p ./data/layers && unzip -o $1 -d ./data/layers/$2

    # Write Streets as DB Objects -> PostGIS; Convert to EPSG 4326, (lng, lat)
    # Option: Serving Dynamic Tiles
    ogr2ogr -overwrite \
        -f "PostgreSQL" PG:"dbname=${POSTGRES_DB} user=${POSTGRES_USER}" \
        ./data/layers/$2 \
        -nln $2 \
        -lco OVERWRITE=yes \
        -t_srs "EPSG:4326"

    # Write Original Shapefiles To GeoJSON; Convert to EPSG 4326
    # Option: Serving Static Tiles
    ogr2ogr -overwrite\
        -f GeoJSON \
        -t_srs "EPSG:4326" \
        ./data/layers/$2.geojson  ./data/layers/$2/
fi

# To MBTiles - Create a SQLiteDB w. all shapes prepped for /x/y/z extraction
# Use level 13->16; this is expensive, consider running to level 20 for production??
# Ref: https://fuzzytolerance.info/blog/2017/02/02/Making-your-own-tiles-with-Tippecanoe/
# Ref: https://wiki.openstreetmap.org/wiki/Zoom_levels
tippecanoe -L $2:./data/layers/$2.geojson \
    -f -F -ps -pf -pk -pt -Bg \
    --drop-densest-as-needed \
    -o ./data/layers/$2.mbtiles -z18 -Z10\
    --drop-lines\
    --force

# Cleanup: save a bit of space in the container
rm -rf /data/layers/$2 /data/layers/$2.geojson


#!sh

CS="Server=localhost,1433;User Id=sa;Password=<PASSWORD>"

echo "Seeding databases"

echo "Seeding IdentityService"
dotnet run --project ./IdentityService/IdentityService/IdentityService.csproj -- --seed --connection-string "$CS;Database=IdentityServer"
echo "Done"

echo "All done"


# assemblyLine.sh
#############################################################################
#
#   Assemble exec.sh script.  Call this script directly to preview exec.sh.
#
#############################################################################
. ../../init.sh
. init.sh
cat init.sh > exec.sh
cat ${SCRIPTS}/general/addSwap.sh >> exec.sh
cat ${SCRIPTS}/java/oracle/installJavaInit.sh >> exec.sh
cat installJenkinsInit.sh >> exec.sh
cat ${SCRIPTS}/general/ubuntuUpdate.sh >> exec.sh
cat ${SCRIPTS}/general/mustHaves.sh >> exec.sh
cat ${SCRIPTS}/java/oracle/installJava.sh >> exec.sh
cat installJenkins.sh >> exec.sh
cat ${SCRIPTS}/general/stopServices.sh >> exec.sh
cat ${SCRIPTS}/general/reboot.sh >> exec.sh


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

set -u
set -e

# build targets for fuzzer
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_STATIC=1 -DENABLE_SHARED=0 \
        -DCMAKE_C_COMPILER=clang \
        -DCMAKE_CXX_COMPILER=clang++ \
	-DCMAKE_C_FLAGS_RELWITHDEBINFO="-g -DNDEBUG -fsanitize=fuzzer-no-link,address,integer,bounds,null,undefined,float-divide-by-zero" \
	-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g -DNDEBUG -fsanitize=fuzzer-no-link,address,integer,bounds,null,undefined,float-divide-by-zero" -DCMAKE_INSTALL_PREFIX=install
make "-j$(nproc)" "--load-average=$(nproc)"
make install

CXX=clang++
CXXFLAGS="-g -fsanitize=fuzzer,address,integer,bounds,null,undefined,float-divide-by-zero"
$CXX $CXXFLAGS -std=c++11 -I.. -Iinstall/include \
    ../fuzz/compress.cc -o /compress_fuzzer \
    "install/lib/libturbojpeg.a"

$CXX $CXXFLAGS -std=c++11 -I.. -Iinstall/include \
    ../fuzz/decompress.cc -o /decompress_fuzzer \
    "install/lib/libturbojpeg.a"

$CXX $CXXFLAGS -std=c++11 -I.. -Iinstall/include \
    ../fuzz/transform.cc -o /transform_fuzzer \
    "install/lib/libturbojpeg.a"

# build targets for Sydr
cd ..
rm -rf build
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_STATIC=1 -DENABLE_SHARED=0 \
        -DCMAKE_C_COMPILER=clang \
        -DCMAKE_CXX_COMPILER=clang++ \
	-DCMAKE_C_FLAGS_RELWITHDEBINFO="-g -DNDEBUG" \
	-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-g -DNDEBUG" -DCMAKE_INSTALL_PREFIX=install
make "-j$(nproc)" "--load-average=$(nproc)"
make install

CXX=clang++
CXXFLAGS="-g"
$CXX $CXXFLAGS -std=c++11 -I.. -Iinstall/include \
    ../fuzz/compress_sydr.cc -o /compress_sydr \
    "install/lib/libturbojpeg.a"

$CXX $CXXFLAGS -std=c++11 -I.. -Iinstall/include \
    ../fuzz/decompress_sydr.cc -o /decompress_sydr \
    "install/lib/libturbojpeg.a"

$CXX $CXXFLAGS -std=c++11 -I.. -Iinstall/include \
    ../fuzz/transform_sydr.cc -o /transform_sydr \
    "install/lib/libturbojpeg.a"


#!/bin/bash

BASE_DIR=$HOME/projects/2gis_sum
# DATA_DIR=$BASE_DIR/ria_news_dataset
WEIGHTS_DIR=$BASE_DIR/rubert-base-cased
PREP_DATA_DIR=/media/dmitry/data/outputs/headlines/ria_1k
CACHE_DIR=/media/dmitry/data/huggingface/cache
OUT_DIR=/media/dmitry/data/outputs/headlines/default
SRC_DIR=$(dirname "$0")/../src

python "$SRC_DIR/train_seq2seq.py" \
    --do_train \
    --fp16 \
    --predict_with_generate \
    --overwrite_output_dir \
    --tie_encoder_decoder \
    --per_device_train_batch_size 8 \
    --per_device_eval_batch_size 8 \
    --gradient_accumulation_steps 4 \
    --logging_steps 100 \
    --learning_rate 2e-4 \
    --max_steps -1 \
    --save_steps 500 \
    --eval_accumulation_steps 3 \
    --output_dir $OUT_DIR \
    --cache_dir $CACHE_DIR \
    --load_data_from $PREP_DATA_DIR \
    --model_name_or_path "$WEIGHTS_DIR"


<reponame>trulleberg/Dotfiles
function mkdircd () { mkdir "$@" && eval cd "\"\$$#\""; }


#!/bin/bash

# build the Docker image
docker build -t jarvis_home .

# run the Docker container
docker run -p 8000:8000 -v $(pwd):/code jarvis_home


<reponame>math-fehr/Untitled-Language
#! /bin/sh

tmpfile=$(mktemp /tmp/ulformat.XXXXXX)

for file in src/*.hs
do
    cat $file | hindent > $tmpfile
    cp $tmpfile $file
done


#!/bin/bash

set -ex

$BASE/new/devstack-gate/devstack-vm-gate.sh

# Add a rootwrap filter to support test-only
# configuration (e.g. a KillFilter for processes that
# use the python installed in a tox env).
FUNC_FILTER=$BASE/new/neutron/neutron/tests/functional/contrib/filters.template
sed -e "s+\$BASE_PATH+$BASE/new/neutron/.tox/dsvm-functional+" \
    $FUNC_FILTER | sudo tee /etc/neutron/rootwrap.d/functional.filters > /dev/null


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

/kafka/create_topic.sh

if [[ -z "$BROKER_LIST" ]]; then
    export BROKER_LIST=localhost:9092
fi

echo "BROKER_LIST: " ${BROKER_LIST}

java -Xmx200m -jar /app/kafka-mgd-full.jar producer -delay 1000 -amount 10000 -brokers ${BROKER_LIST}


<reponame>anuragvajpayee/opentelemetry-dotnet-instrumentation
#!/bin/bash
set -euxo pipefail

# The purpose of this bash is to build two docker images based on the current git branch
# The first image has SCRATCH as a based image and contains only the /dd-tracer-dotnet
# folder with the publish version of the tracer. Useful to use in a dockerfile as a CopyFrom image.
# The second image has the dotnet sdk 3.1 as a base image + the /dd-tracer-dotnet folder.
# Because is a linux build we try to use BuildKit as engine to parallelize the building process.

BRANCH="$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')"
SOURCEFOLDER="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." >/dev/null && pwd )"
export DOCKER_BUILDKIT=1

docker build -f $SOURCEFOLDER/linux-build.dockerfile --target tracer-build -t dd-trace-dotnet:$BRANCH $ROOT
docker build -f $SOURCEFOLDER/linux-build.dockerfile -t dotnet-sdk-with-dd-tracer:$BRANCH $ROOT


<reponame>bitlw/EGSfM<filename>scripts/install.sh
## Global Required(For development: GLOG, GFlags, GTest)
sudo apt-get install libgoogle-glog-dev libgflags-dev libgtest-dev

cd /usr/src/gtest
sudo mkdir build
cd build
sudo cmake ..
sudo make
sudo cp libgtest* /usr/lib/
cd ..
sudo rm -rf build

git clone https://github.com/gflags/gflags
cd gflags
mkdir build && cd build
cmake ..
make -j4
sudo make install

## Eigen 3
hg clone https://bitbucket.org/eigen/eigen
mkdir eigen_build && cd eigen_build
cmake . ../eigen
make && sudo make install
cd ..

## Ceres-Solver (Required by both COLMAP and TheiaSfM and OpenMVG)
sudo apt-get install libatlas-base-dev libsuitesparse-dev
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
git checkout $(git describe --tags) # Checkout the latest release
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make
sudo make install

## Required by openMVG
sudo apt-get install libpng-dev libjpeg-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev graphviz

## Required by COLMAP
sudo apt-get install \
    git \
    cmake \
    build-essential \
    libboost-program-options-dev \
    libboost-filesystem-dev \
    libboost-graph-dev \
    libboost-regex-dev \
    libboost-system-dev \
    libboost-test-dev \
    libeigen3-dev \
    libsuitesparse-dev \
    libfreeimage-dev \
    libgoogle-glog-dev \
    libgflags-dev \
    libglew-dev \
    qtbase5-dev \
    libqt5opengl5-dev \
    libcgal-dev \
    libcgal-qt5-dev

## Configure and compile COLMAP
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake ..
make
sudo make install

#GLFW3 (Optional)
sudo apt-get -y install freeglut3-dev libglew-dev libglfw3-dev


#!/bin/bash

#2.14 Создайте копию файла из задачи 2.13, назвав её myfile или
#создайте новый файл с таким именем.

cp $HOME/.profile $HOME/myfile;

echo "Copied!";

exit 0;


<reponame>Mehrad0711/dialogues
mongorestore --dir=db


#!/bin/bash
set -euo pipefail

while getopts t: option; do
case "${option}" in
    t) IMAGETAG=${OPTARG};;
    *) echo "Usage: $0 [OPTIONS]. Where OPTIONS can be:"
       echo "    -t <IMAGETAG>  tag for cybercoredev/evm_loader Docker-image"
       exit 1;;
esac
done

REVISION=$(git rev-parse HEAD)
EVM_LOADER_IMAGE=cybercoredev/evm_loader:${IMAGETAG:-$REVISION}

docker-compose -f evm_loader/docker-compose-test.yml up -d

function cleanup_docker {
    echo "Cleanup docker-compose..."
    docker-compose -f evm_loader/docker-compose-test.yml down
    echo "Cleanup docker-compose done."
}
trap cleanup_docker EXIT
sleep 10

echo "Run tests..."
cmd='python3 -m unittest discover -v --start-directory /opt/commun.contracts/scripts/'
docker run --rm --network evm_loader-deploy_test-net -ti \
     -e SOLANA_URL=http://solana:8899 \
     ${EXTRA_ARGS:-} \
     $EVM_LOADER_IMAGE '/opt/deploy-test.sh'
echo "Run tests return"

exit $?


<reponame>hunternsk/grin-pool<filename>ansible/roles/pool/files/grinwallet_secret.sh<gh_stars>100-1000
#!/bin/bash

echo -n "password" > ./password.txt
kubectl create secret generic grinwallet --from-file=./password.txt
rm ./password.txt


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

GENERIC_FUNCTIONS=$(pwd)/config-scripts/generic-functions

if [ ! -r "${GENERIC_FUNCTIONS}" ]; then
  logger --tag ${SCRIPT_NAME} --stderr --id=$$ -p user.err "Can't find ${GENERIC_FUNCTIONS} file. Abort."
  exit 2
fi

source "${GENERIC_FUNCTIONS}"

# Due to bug https://github.com/wata727/tflint/issues/167
# disable module from hashicorp modules registry
for DIR in terraform/{,stage,prod};do
    docker_tflint "${DIR}" "--ignore-module=SweetOps/storage-bucket/google"
done


../launchSim.sh -bFreeSpace 0 -muteAll 1 -bpdx 16 -bpdy 8 -tdump 0.0 -nu 0.00001 -tend 0 -shapes 'stefanfish L=0.2 xpos=0.15 bFixed=1 pid=1,stefanfish L=0.2 xpos=0.45 bFixedy=1'


# update docs on gh-pages branch

git checkout gh-pages
rm -r docs/
git checkout master dist/docs/
mkdir docs/
mv dist/docs/* docs/.
rm -r dist/
git add -A
git commit
git checkout master


#!/bin/bash
DIR="$(dirname $(realpath ${BASH_SOURCE}))"
setToken() {
    $DIR/mfa.sh $1 $2
    source $DIR/.token_file
    echo "Your creds have been set in your env."
}
alias mfa=setToken


#!/bin/sh
# compares package differences between two hosts:
# usage:
#
#    [kambiz@vorlon (home)]$ ssh  -q <EMAIL> rpm -qa > /tmp/graph01-rpm-qa
#    [kambiz@vorlon (home)]$ ssh  -q root@graph02.oslab.example.com rpm -qa > /tmp/graph02-rpm-qa
#
#    [kambiz@vorlon (home)]$ cd /tmp
#
#    [kambiz@vorlon (home)]$ ~/git/oslab-tools/bin/compare-rpm-qa.sh graph01-rpm-qa graph02-rpm-qa
#    kernel-core appears more than once in graph01-rpm-qa
#    kernel-core appears more than once in graph01-rpm-qa
#    kernel-core appears more than once in graph01-rpm-qa
#    kernel-modules appears more than once in graph01-rpm-qa
#    kernel-modules appears more than once in graph01-rpm-qa
#    kernel-modules appears more than once in graph01-rpm-qa
#    kernel-core appears more than once in graph02-rpm-qa
#    kernel-core appears more than once in graph02-rpm-qa
#    kernel-core appears more than once in graph02-rpm-qa
#    kernel-modules appears more than once in graph02-rpm-qa
#    kernel-modules appears more than once in graph02-rpm-qa
#    kernel-modules appears more than once in graph02-rpm-qa
#    nspr-4.10.8-1.fc22.x86_64 nspr-4.10.10-1.fc22.x86_64
#    rpm-4.12.0.1-13.fc22.x86_64 rpm-4.12.0.1-12.fc22.x86_64
#    rpm-build-libs-4.12.0.1-13.fc22.x86_64 rpm-build-libs-4.12.0.1-12.fc22.x86_64
#    rpm-libs-4.12.0.1-13.fc22.x86_64 rpm-libs-4.12.0.1-12.fc22.x86_64
#    rpm-plugin-selinux-4.12.0.1-13.fc22.x86_64 rpm-plugin-selinux-4.12.0.1-12.fc22.x86_64
#    rpm-plugin-systemd-inhibit-4.12.0.1-13.fc22.x86_64 rpm-plugin-systemd-inhibit-4.12.0.1-12.fc22.x86_64
#    rpm-python-4.12.0.1-13.fc22.x86_64 rpm-python-4.12.0.1-12.fc22.x86_64
#    sqlite-3.8.10.2-1.fc22.x86_64 sqlite-3.9.0-1.fc22.x86_64
#
#
#    [kambiz@vorlon (home)]$ wc -l only-graph01-rpm-qa
#    32 only-graph01-rpm-qa
#
#    [kambiz@vorlon (home)]$ wc -l only-graph02-rpm-qa
#    94 only-graph02-rpm-qa

file1=$1
file2=$2
onlyfile1=only-$file1
onlyfile2=only-$file2

rm -f $onlyfile1 $onlyfile2

tmpfile1=$(mktemp /tmp/rpmqa1-XXXXXX)
sort < $file1 > $tmpfile1

tmpfile2=$(mktemp /tmp/rpmqa2-XXXXXX)
sort < $file2 > $tmpfile2

# make sure things are sane ...

for pkg in $(sed 's/\(.*\)-[^\-][^\-]*-[^\-][^\-]*.*/\1/g' < $tmpfile1) ; do
  if [ "$pkg" != "kernel" ]; then
    if [ $(egrep -c "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile1) -gt 1 ]; then
      echo $pkg appears more than once in $file1
    fi
  fi
done

for pkg in $(sed 's/\(.*\)-[^\-][^\-]*-[^\-][^\-]*.*/\1/g' < $tmpfile2) ; do
  if [ "$pkg" != "kernel" ]; then
    if [ $(egrep -c "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile2) -gt 1 ]; then
      echo $pkg appears more than once in $file2
    fi
  fi
done

# now look for things in file1 that are not in file2

for pkg in $(sed 's/\(.*\)-[^\-][^\-]*-[^\-][^\-]*.*/\1/g' < $tmpfile1) ; do
  if [ "$pkg" != "kernel" ]; then
    if [ $(egrep -c "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile2) -ne 1 ]; then
      echo $pkg >> $onlyfile1
    fi
  fi
done

# now look for things in file2 that are not in file1

for pkg in $(sed 's/\(.*\)-[^\-][^\-]*-[^\-][^\-]*.*/\1/g' < $tmpfile2) ; do
  if [ "$pkg" != "kernel" ]; then
    if [ $(egrep -c "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile1) -ne 1 ]; then
      echo $pkg >> $onlyfile2
    fi
  fi
done

# finally compare the ones that appear in both
for pkg in $(cat $tmpfile1 $tmpfile2 | sed 's/\(.*\)-[^\-][^\-]*-[^\-][^\-]*.*/\1/g' | sort -u) ; do
  if [ "$pkg" != "kernel" ]; then
    if [ $(egrep -c "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile1) -eq 1 -a $(egrep -c "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile2) -eq 1 ]; then
      pkg1=$(egrep "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile1)
      pkg2=$(egrep "^$(echo ${pkg} | sed 's/\+/\\\+/g')-[0-9]" $tmpfile2)
      if [ "$pkg1" != "$pkg2" ]; then
        echo $pkg1 $pkg2
      fi
    fi
  fi
done

rm -f $tmpfile1 $tmpfile2


echo "Tip: must be sourced under root directory of the repo!"
export PYTHONPATH=$(pwd):${PYTHONPATH}


################################################################################
# bug-report: collect environment information for bug reports.
# % source bug-report.sh
################################################################################

cat <<-EOF
## System

  $(uname -a)

## Script

  TYPE:    $(command -v php-version 2>/dev/null || echo 'NOT FOUND')
  VERSION: $(php-version --version  2>/dev/null || echo 'NOT FOUND')

## Environment

  SHELL:        $(echo $SHELL)
  PATH:         $(echo $PATH)
  PHPS:         $(find ~/.phps -maxdepth 1 -mindepth 1 -type d 2>/dev/null)
  PHP_VERSIONS: $(echo $PHP_VERSIONS)

## Homebrew

  VERSION: $(test -n `command -v brew` && brew --version)
  PATH:    $(command -v brew)
  PHPS:    $(find $(brew --cellar) -maxdepth 1 -type d | grep -E 'php[0-9]+$')

## PHP

  VERSION: $(php-config --version)

## INI

$(php --ini | sed 's/^/  /')

EOF


<filename>start.sh
#!/bin/bash
set -e

if [ "$1" = "/usr/share/opscenter/bin/opscenter" ]; then
    IP=`hostname --ip-address`

    FIRSTRUN=/firstrun
    if [ ! -f $FIRSTRUN ]; then
        cp -f /etc/opscenter/opscenterd.conf /etc/opscenter/opscenterd.conf.org
        touch $FIRSTRUN
    else
        cp -f /etc/opscenter/opscenterd.conf.org /etc/opscenter/opscenterd.conf
    fi

    sed -i -e "s/^interface.*/interface = $IP/" /etc/opscenter/opscenterd.conf

    if [ "$AUTH" = "true" ]; then
        sed -i -e "s/^enabled = False/enabled = $AUTH/" /etc/opscenter/opscenterd.conf
    fi

    echo "=> Starting OpsCenter on $IP..."
fi

exec "$@"


<gh_stars>0
build=false
while getopts 'b' opt; do
    case $opt in
        b) build=true ;;
    esac
done

shift $((OPTIND -1))

jupytext --to notebook --output bilateral-connectome/docs/$1.ipynb bilateral-connectome/scripts/$1.py
jupyter nbconvert --to notebook --inplace --execute --ExecutePreprocessor.timeout=-1 bilateral-connectome/docs/$1.ipynb
python bilateral-connectome/docs/add_cell_tags.py bilateral-connectome/docs/$1.ipynb

if "$build"; then
    jupyter-book build bilateral-connectome/docs
fi


#! /bin/sh

report_cp() {

mkdir "$CIRCLE_ARTIFACTS/app"
mkdir "$CIRCLE_TEST_REPORTS/junit/"
mkdir "$CIRCLE_TEST_REPORTS/junit/$1"

cp -r ./app/build/reports "$CIRCLE_ARTIFACTS/app"
find . -type f -regex ".*/build/test-results/$1/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/$1/ \;
}

# テスト実行
./gradlew -PpreDexEnable=false -Pcom.android.build.threadPoolSize=1  \
          :app:testDebugUnitTest

if [ $? -ne 0 ]; then
    echo "UnitTest failed..."
    report_cp "debug"
    exit 1
else
    report_cp
fi


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

circleci orb pack src > orb.yml
circleci orb publish orb.yml wiz-sec/swissknife@dev:alpha
#rm -rf orb.yml


#!/bin/bash
# Code by <NAME> <<EMAIL>>
#
# - to run Clair server with latest updated DB
#

if [[ `uname` == 'Linux' ]]; then
   if [ -f "/bin/busybox" ]; then
     CDATE=`date -I`
     YDATE=`date -D "%s" -d $(( $(/bin/date +%s ) - 86400 )) +%Y-%m-%d`
     YYDATE=`date -D "%s" -d $(( $(/bin/date +%s ) - 172800 )) +%Y-%m-%d`
   else
     CDATE=`date +%Y-%m-%d`
     YDATE=`date -d -1days +%Y-%m-%d`
     YYDATE=`date -d -2days +%Y-%m-%d`
   fi
elif [[ `uname` == 'Darwin' ]]; then
   # For OSX
   CDATE=`date +%Y-%m-%d`
   YDATE=`date -j -v -1d  +%Y-%m-%d`
   YYDATE=`date -j -v -2d  +%Y-%m-%d`
else
  echo "Can't determine OS"
  exit 1
fi
DATE=${CDATE}

# Kill Containers
docker rm -f clair-server || true
docker rm -f clair-db || true

# Fetch Today's version
docker pull arminc/clair-db:${DATE}
if [ `docker images arminc/clair-db:${DATE} | grep "arminc/clair-db" | wc -l` -eq "0" ]; then
  # If failed, try yesterday.
  DATE=${YDATE}
  docker pull arminc/clair-db:${DATE}
  if [ `docker images arminc/clair-db:${DATE} | grep "arminc/clair-db" | wc -l` -eq "0" ]; then
    DATE=${YYDATE}
    docker pull arminc/clair-db:${DATE}
  fi
fi

docker run -d --name clair-db arminc/clair-db:${DATE}

while true; do
  # wait to open port on DB server
  if [ `docker logs clair-db 2>&1 | grep started | wc -l` -gt "0" ] ; then
    break
  fi
done

# Clear Old Clair DB images.
docker images | grep clair-db | grep -v "${DATE}" | awk '{print $3}' | xargs docker rmi {} || true

# Run Clair Server
docker run -p 6060:6060 --link clair-db:postgres -d --name clair-server arminc/clair-local-scan:v2.0.0


<reponame>tmekaumput/vagrant-vault-cluster-raft-storage-auto-unseal-azure-pr-dr
#!/bin/bash

SHARED_DIR=${1}

export VAULT_TOKEN=$(sudo cat ${SHARED_DIR}/root_token-vault)

vault write sys/replication/performance/secondary/enable token=$(sudo cat ${SHARED_DIR}/../pr-activation-token.txt)


<reponame>markreay/dotfiles<gh_stars>0
############################################
# Start ssh-agent
# adapted from http://mah.everybody.org/docs/ssh

TITLE Enabling ssh-agent . . .

SSH_ENV="$HOME/.ssh/environment"

function start_ssh_agent {
    INFO "Initialising new SSH agent..."
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    INFO succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add;
}

if [ -f "${SSH_ENV}" ]; then
    . "${SSH_ENV}" > /dev/null

    if [ "$(basename $(ps -o command -p ${SSH_AGENT_PID} | tail -1 | cut -f1 -d' ') 2>/dev/null)" != "ssh-agent" ]; then
        WARNING "ssh-agent not running on ${SSH_AGENT_PID} as expected . . . restarting"
        start_ssh_agent;
    else
        INFO "SSH agent already running on PID ${SSH_AGENT_PID}"
    fi
else
    start_ssh_agent;
fi


#!/bin/bash

echo "Composer install..."
composer install


#!/usr/bin/env bash

readonly ROOT_DIR="$(dirname "$(dirname "${0}")")"
# shellcheck disable=SC1090
source "${ROOT_DIR}"/ci/_build_functions.sh

fetch_current_branch


<filename>zsh/fpath.zsh
# fpath+=("$DOTFILES/zsh/pure")


<gh_stars>0
#!/bin/sh
#
# Setup the edep-sim directory for development (or simply running the
# simulation).  This makes sure that the ROOT and GEANT4 environment
# variables are set (using thisroot.sh and geant4.sh), and then
# defines a couple of conveniences commands:
#
#  edep-build == Source ./build/edep-build.sh which will conveniently
#           run cmake/make/make install from any place so that it's
#           really easy to recompile.
#
#  edep-setup == Source this file.  You probably never have to use
#           this one.
#
# This setup script is not needed.  You can also do it by hand.  It's
# a usual cmake build, but you need to make sure root and geant are
# "in the path".
#
# source thisroot.sh
# source geant4.sh
# cd the-build-directory
# cmake -DCMAKE_INSTALL_PREFIX=the-install-directory the-edep-sim-directory
# make
# make install

# Try to setup root.  ROOT installs thisroot.sh in the bin directory
# to setup the environment.  The first "thisroot.sh" in the path will
# define the root that is used.
. thisroot.sh >& /dev/null
if [ $? != 0 ]; then
    echo ROOT not available.
fi

# Try to setup geant4.  GEANT4 installs geant4.sh in the bin directory
# to setup the environment.  The first "geant4.sh" in the path will
# define the geant that is used.
. geant4.sh >& /dev/null
if [ $? != 0 ]; then
    echo GEANT not available.
fi

# Find the root of the building area.
___edep_root() {
    COUNT=50
    while true; do
	if [ -e ./build -a -d ./build -a -e ./build/edep-build.sh ]; then
	    echo ${PWD}
	    return
	fi
	COUNT=$(expr ${COUNT} - 1)
	if [ ${COUNT} -lt 1 ]; then
	    echo invalid-directory
	    return
	fi
	cd ..
    done
}

export EDEP_ROOT
EDEP_ROOT=$(___edep_root)
unset -f ___edep_root

if [ ${EDEP_ROOT} = "invalid-directory" ]; then
    echo EDEP-SIM setup.sh must be sourced in edep-sim directory.
    return
fi

___edep_target () {
    target="edep"
    compiler=gcc
    target="${target}-${compiler}-$(cc -dumpversion)-$(cc -dumpmachine)"
    echo $target
}

export EDEP_TARGET
EDEP_TARGET=$(___edep_target)
unset -f ___edep_target

___path_prepend () {
    ___path_remove $1 $2
    eval export $1="$2:\$$1"
}
___path_remove ()  {
    export $1=$(eval echo -n \$$1 | \
	awk -v RS=: -v ORS=: '$0 != "'$2'"' | \
	sed 's/:$//');
}

___path_prepend PATH ${EDEP_ROOT}/${EDEP_TARGET}/bin
___path_prepend LD_LIBRARY_PATH ${EDEP_ROOT}/${EDEP_TARGET}/lib

unset -f ___path_prepend
unset -f ___path_remove

alias edep-setup=". ${EDEP_ROOT}/setup.sh"

alias edep-build="${EDEP_ROOT}/build/edep-build.sh"

echo Defined edep-setup to re-setup the edep-sim package.
echo Defined edep-build to build the the edep-sim package.


#!/bin/bash
FILE=LICENSE

if [ ! -f "$FILE" ]; then
    echo "Please run script from main directory"
    exit 1
fi
sudo chown -R $USER src
cp src/go.mod.back src/go.mod

docker build -t rcplinux - < Dockerfile.linux
docker rm -fv ygglinux || true
docker run -d --name=ygglinux -v $(pwd)/src:/src rcplinux tail -f /dev/null
docker exec ygglinux /bin/buildlinux #run this to build again without restarting docker


<gh_stars>100-1000
#!/usr/bin/env bash
set -ex

# Program deployer script.

cd $(dirname $0)
source _common.sh

CLUSTER=$1

# reset on localnet
if [[ $CLUSTER == "localnet" ]]; then
    echo "On localnet, clearing old program deploy."
    rm -fr $HOME/stableswap_deployments/localnet/
fi

setup_solana_cluster $CLUSTER

if [ ! -f "$SWAP_PROGRAM_ID_PATH" ]; then
    echo "Swap program ID path $SWAP_PROGRAM_ID_PATH does not exist. Cannot deploy."
    exit 1
fi

if solana program show $SWAP_PROGRAM_ID; then
    echo "Program already deployed at $SWAP_PROGRAM_ID. Did you mean to upgrade?"
    exit 1
fi

SOL_BALANCE=$(solana balance $DEPLOYER_KP --lamports | awk '{ print $1 }')

# We need about 8 SOL for a successful deploy
MIN_SOL_BALANCE_LAMPORTS=8000000000
if [[ "$SOL_BALANCE" -lt "$MIN_SOL_BALANCE_LAMPORTS" ]]; then
    if [[ $CLUSTER == "localnet" ]]; then
        echo "On localnet. Requesting SOL airdrop."
        solana airdrop 10 $DEPLOYER_ADDRESS
    elif [[ $CLUSTER != "mainnet-beta" ]]; then
        echo "Not on mainnet. Requesting SOL airdrop."
        for i in {1..8}; do
            solana airdrop 1 $DEPLOYER_ADDRESS
        done
    else
        echo "Not enough SOL in the deployer. Need 8 SOL to deploy."
        echo "Deployer address:"
        solana address
        exit 1
    fi
fi

echo "Deploying program to $SWAP_PROGRAM_ID..."
solana program deploy \
    --program-id $SWAP_PROGRAM_ID_PATH \
    ../target/deploy/stable_swap.so

echo "StableSwap deployed to ProgramID: $SWAP_PROGRAM_ID"

echo "Changing upgrade authority to $UPGRADE_AUTHORITY"
solana program set-upgrade-authority $SWAP_PROGRAM_ID --new-upgrade-authority $UPGRADE_AUTHORITY

echo "Program deploy complete. Saving deployment result."
OUTFILE=$CLUSTER_DEPLOYMENT_DIR/program.json
solana program show $SWAP_PROGRAM_ID --output json > $OUTFILE
cat $OUTFILE | jq .


<gh_stars>10-100
#!/usr/bin/env bash
# This Let's Encrypt post-validation hook is to be used for the DNS-01 challenge with
# BOAST's main domain. It's made to work with the Dockerfile in this directory and may
# need some changes for customized use cases.
#
# This hook will only be run if the certificate is due for renewal, so certbot can be
# run frequently (e.g. as a cron job) without unnecessarily stopping BOAST.
#
# Doc on how to use this with the provided Dockerfile and more:
# https://github.com/marcoagner/boast/blob/master/docs/deploying.md#deploying-with-docker
#
if [ -z "$RENEWED_LINEAGE"  ]
then
	echo "error: renewed lineage is empty"
	exit -1
fi

_docker_boast_img="boastimg"
_docker_boast_container="boastmain"
_docker_boast_dns_container="boastdns"
_tls_certificate="${RENEWED_LINEAGE}/fullchain.pem"
_tls_privkey="${RENEWED_LINEAGE}/privkey.pem"
_boast_tls="$HOME/boast/tls"  # <- Change this if necessary

# Ignoring errors with `|| true` in case containers are not running or do not exist.

# Make sure everything is stopped.
docker stop ${_docker_boast_container} || true
docker stop ${_docker_boast_dns_container} || true

# Make sure the BOAST container does not exist.
docker container rm ${_docker_boast_container} || true

# Copy TLS files to BOAST's TLS directory.
mkdir -p ${_boast_tls}
cp ${_tls_certificate} ${_tls_privkey} ${_boast_tls}

# Run the BOAST's main container.
docker run -d --name ${_docker_boast_container} -p 53:53/udp -p 80:80 -p 443:443 -p 1337:1337 -p 8080:8080 -p 8443:8443 -v ${_boast_tls}:/go/src/agner.io/boast/tls ${_docker_boast_img}


echo "### WORKER LOCAL INSTALL SCRIPT"

# https://github.com/kubernetes-incubator/cri-tools/releases/download/v1.0.0-beta.0/crictl-v1.0.0-beta.0-linux-amd64.tar.gz \

POD_CIDR=$(curl -s -H "Metadata-Flavor: Google" \
    http://metadata.google.internal/computeMetadata/v1/instance/attributes/pod-cidr)
K8S_VERSION=1.10.6
CNI_VERSION=0.7.1
CONTAINERD_VERSION=1.1.3
CRICTL_VERSION=1.11.1

echo " # HOSTNAME=${HOSTNAME}"
echo " # POD_CIDR=${POD_CIDR}"
echo " # VERSIONS:"
echo "  - K8S_VERSION       =${K8S_VERSION}"
echo "  - CNI_VERSION       =${CNI_VERSION}"
echo "  - CONTAINERD_VERSION=${CONTAINERD_VERSION}"
echo "  - CRICTL_VERSION    =${CRICTL_VERSION}"

echo " ## Install network tools"
sudo apt-get update && sudo apt-get -y install socat conntrack ipset

echo " # Prepare landing folders"
sudo mkdir -p \
    /etc/cni/net.d \
    /opt/cni/bin \
    /var/lib/kubelet \
    /var/lib/kube-proxy \
    /var/lib/kubernetes \
    /var/run/kubernetes \
    /etc/containerd/

echo " # Move certificates to their required locations"
sudo mv ${HOSTNAME}-key.pem ${HOSTNAME}.pem /var/lib/kubelet/
ls -lath /var/lib/kubelet/
sudo mv ${HOSTNAME}.kubeconfig /var/lib/kubelet/kubeconfig
ls -lath /var/lib/kubelet/kubeconfig
sudo mv ca.pem /var/lib/kubernetes/
ls -lath /var/lib/kubernetes/

echo " # Download all required binaries"
wget -q --show-progress --https-only --timestamping \
    https://github.com/kubernetes-incubator/cri-tools/releases/download/v${CRICTL_VERSION}/crictl-v${CRICTL_VERSION}-linux-amd64.tar.gz \
    https://storage.googleapis.com/kubernetes-the-hard-way/runsc \
    https://github.com/opencontainers/runc/releases/download/v1.0.0-rc5/runc.amd64 \
    https://github.com/containernetworking/plugins/releases/download/v${CNI_VERSION}/cni-plugins-amd64-v${CNI_VERSION}.tgz \
    https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz \
    https://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/linux/amd64/kubectl \
    https://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/linux/amd64/kube-proxy \
    https://storage.googleapis.com/kubernetes-release/release/v${K8S_VERSION}/bin/linux/amd64/kubelet

sleep 10

echo " ## Extract binaries to landing folders"
ls -lath
chmod +x kubectl kube-proxy kubelet runc.amd64 runsc
sudo mv runc.amd64 runc
sudo mv kubectl kube-proxy kubelet runc runsc /usr/local/bin/
sudo tar -xvf crictl-v${CRICTL_VERSION}-linux-amd64.tar.gz -C /usr/local/bin/
sudo tar -xvf cni-plugins-amd64-v${CNI_VERSION}.tgz -C /opt/cni/bin/
sudo tar -xvf containerd-${CONTAINERD_VERSION}.linux-amd64.tar.gz -C /

echo " ## CONTAINERD CONFIG"
echo "  # Create containerd config (/etc/containerd/config.toml)"
cat << EOF | sudo tee /etc/containerd/config.toml
[plugins]
  [plugins.cri.containerd]
    snapshotter = "overlayfs"
    [plugins.cri.containerd.default_runtime]
      runtime_type = "io.containerd.runtime.v1.linux"
      runtime_engine = "/usr/local/bin/runc"
      runtime_root = ""
    [plugins.cri.containerd.untrusted_workload_runtime]
      runtime_type = "io.containerd.runtime.v1.linux"
      runtime_engine = "/usr/local/bin/runsc"
      runtime_root = "/run/containerd/runsc"
EOF

echo "  # Create containerd systemd service definition (/etc/systemd/system/containerd.service)"
cat <<EOF | sudo tee /etc/systemd/system/containerd.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target

[Service]
ExecStartPre=/sbin/modprobe overlay
ExecStart=/bin/containerd
Restart=always
RestartSec=5
Delegate=yes
KillMode=process
OOMScoreAdjust=-999
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity

[Install]
WantedBy=multi-user.target
EOF

echo " ## KUBELET CONFIGURATION"
echo "  # create kubelet config yaml (/var/lib/kubelet/kubelet-config.yaml)"
cat <<EOF | sudo tee /var/lib/kubelet/kubelet-config.yaml
kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
  anonymous:
    enabled: false
  webhook:
    enabled: true
  x509:
    clientCAFile: "/var/lib/kubernetes/ca.pem"
authorization:
  mode: Webhook
clusterDomain: "cluster.local"
clusterDNS:
  - "10.32.0.10"
podCIDR: "${POD_CIDR}"
runtimeRequestTimeout: "15m"
tlsCertFile: "/var/lib/kubelet/${HOSTNAME}.pem"
tlsPrivateKeyFile: "/var/lib/kubelet/${HOSTNAME}-key.pem"
EOF

echo " # create kubelet systemd service definition (/etc/systemd/system/kubelet.service)"
cat <<EOF | sudo tee /etc/systemd/system/kubelet.service
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes
After=containerd.service
Requires=containerd.service

[Service]
ExecStart=/usr/local/bin/kubelet \\
  --config=/var/lib/kubelet/kubelet-config.yaml \\
  --allow-privileged=true \\
  --container-runtime=remote \\
  --container-runtime-endpoint=unix:///var/run/containerd/containerd.sock \\
  --resolv-conf=/run/systemd/resolve/resolv.conf \\
  --image-pull-progress-deadline=2m \\
  --kubeconfig=/var/lib/kubelet/kubeconfig \\
  --network-plugin=cni \\
  --register-node=true \\
  --v=2
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

echo " ## KUBE-PROXY CONFIGURATION"
echo "  # move kubeconfig to the correct location"
sudo mv kube-proxy.kubeconfig /var/lib/kube-proxy/kubeconfig
ls -lath /var/lib/kube-proxy/kubeconfig

echo "  # create kube-proxy config yaml"
cat <<EOF | sudo tee /var/lib/kube-proxy/kube-proxy-config.yaml
kind: KubeProxyConfiguration
apiVersion: kubeproxy.config.k8s.io/v1alpha1
clientConnection:
    kubeconfig: "/var/lib/kube-proxy/kubeconfig"
mode: "iptables"
clusterCIDR: "10.200.0.0/16"
EOF

echo "  # create kube-proxy systemd service definition (/etc/systemd/system/kube-proxy.service)"
cat <<EOF | sudo tee /etc/systemd/system/kube-proxy.service
[Unit]
Description=Kubernetes Kube Proxy
Documentation=https://github.com/kubernetes/kubernetes

[Service]
ExecStart=/usr/local/bin/kube-proxy \\
    --config=/var/lib/kube-proxy/kube-proxy-config.yaml \\
    --v=2
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

echo " ## RELOAD AND START SYSTEMD SERVICES"
echo "  # containerd, kubelet, kube-proxy"
sudo systemctl daemon-reload
sudo systemctl enable containerd kubelet kube-proxy
sudo systemctl start containerd kubelet kube-proxy


# Before running this script, copy config_template.json to config.json and make the necessary changes.
# After running this script, delete config.json for security.
#
#As of this writing, Socrata documentation for loading preferences through a config.json file is at: http://socrata.github.io/datasync/guides/setup-standard-job-headless.html

java -jar datasync.jar --config config.json --jobType LoadPreferences


#!/usr/bin/env bash

#
# Combine all driver logs into single stdout
#

{ \
    kubectl logs -f --all-containers=true $(kubectl get pods | awk '/nexentastor-block-csi-controller/ {print $1;exit}') & \
    kubectl logs -f --all-containers=true $(kubectl get pods | awk '/nexentastor-block-csi-node/ {print $1;exit}'); \
}


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

# We need to install dependencies only for Docker
[[ ! -e /.dockerenv ]] && exit 0

set -xe

export https_proxy=http://m100.cache.pvt:3128
export http_proxy=http://m100.cache.pvt:3128

# Install git (the php image doesn't have it) which is required by composer
apt-get update -yqq
# apt-get install wget git unzip -yqq
apt-get install wget git unzip -yqq

pear config-set http_proxy http://m100.cache.pvt:3128
# pear config-set https_proxy http://m100.cache.pvt:3128

pecl install xdebug && docker-php-ext-enable xdebug

{ \
    echo "xdebug.mode=coverage"; \
    echo "xdebug.start_with_request=yes"; \
    echo "xdebug.client_host=host.docker.internal"; \
    echo "xdebug.client_port=9000"; \
} > /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \

echo "zend_extension=xdebug.so" >> /usr/local/etc/php/php.ini

# Install phpunit, the tool that we will use for testing
# curl --location --output /usr/local/bin/phpunit "https://phar.phpunit.de/phpunit.phar"
# chmod +x /usr/local/bin/phpunit

# Install mysql driver
# Here you can install any other extension that you need
# docker-php-ext-install pdo_mysql


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

set -e

copy()
{
  LD_LIBRARY_PATH=/system/lib /system/bin/toybox cp --preserve=a "$1" "$2"
}

VAR_SELECT_HOOK=/tmp/install/bin/variant_blobs_hook.sh

# Detect variant and copy its specific-blobs
BOOTLOADER=`getprop ro.bootloader`

if [ -f $VAR_SELECT_HOOK ] ; then
  . $VAR_SELECT_HOOK
else
  echo "Could not find variant selector hook: $VAR_SELECT_HOOK"
  exit 1
fi

echo "Device with bootloader $BOOTLOADER requires $VARIANT blobs"

BLOBBASE=/system/blobs/$VARIANT

if [ -d $BLOBBASE ]; then
  cd $BLOBBASE

  for FILE in `find . -type f` ; do
    mkdir -p `dirname /system/$FILE`
    copy $FILE /system/$FILE
  done

  for FILE in bin/* ; do
    chmod 755 /system/$FILE
  done
else
  echo "Expected source directory does not exist!"
  exit 1
fi

exit 0


<reponame>OurRootsOrg/cms-server
#!/bin/bash
set -e
ENVIRONMENT_NAME="${ENVIRONMENT_NAME:?}"
USE_POSTGRES="${USE_POSTGRES:-true}"
ES_ADMIN_CIDR="${ES_ADMIN_CIDR:-0.0.0.0/0}"
# DOMAIN_NAME="${DOMAIN_NAME:?}"
# set -x
s3_bucket_name="${ENVIRONMENT_NAME}-deploy"
if aws s3 ls "s3://${s3_bucket_name}" 2>&1 | grep -q 'NoSuchBucket'
then
  echo Creating deploy bucket...
  aws s3 mb "s3://${s3_bucket_name}"
fi
if [ "${USE_POSTGRES}" == "true" ]
then
  template_file="cms-infra-aurora.cf.yaml"
else
  template_file="cms-infra-dynamodb.cf.yaml"
fi
echo Processing CloudFormation...
aws cloudformation package --template-file "${template_file}" --output-template-file output-cms-infra.cf.yaml --s3-bucket $s3_bucket_name
aws cloudformation deploy --template-file output-cms-infra.cf.yaml --stack-name "${ENVIRONMENT_NAME}-infra" --parameter-overrides "EnvironmentName=${ENVIRONMENT_NAME}" "ESAdminCIDR=${ES_ADMIN_CIDR}" --capabilities CAPABILITY_IAM

if [ "${USE_POSTGRES}" == "true" ]
then
  # Enable Data API
  aws rds modify-db-cluster --db-cluster-identifier "${ENVIRONMENT_NAME}-cms" --enable-http-endpoint --apply-immediately
fi
echo Done


<reponame>dimitry-dukhovny/unixtoys<gh_stars>0
#!/bin/bash

# Configure this part
mydaemon=postfix

# Derived, but also configurable
outfile=/tmp/check.${mydaemon}
pidfile=/var/spool/postfix/pid/master.pid

# Bookkeeping
mypid=$$
myname=`basename $0`
mydir=`dirname ${myname}`

# Import node-specific configuration
if [ ! -f ${mydir}/check.config.sh ]
then
    echo ${mydir}/check.config.sh is missing.  I am lost.
    exit 255
fi
. ${mydir}/check.config.sh

# Import common functions after declaring configuration
if [ ! -f ${mydir}/check.functions.sh ]
then
    echo ${mydir}/check.functions.sh is missing.  I am lost.
    exit 255
fi
. ${mydir}/check.functions.sh

main() {
    bounce=0
    timestampit
    for q in `/usr/sbin/postmulti -l | awk '{print $4}'`
    do
        echo Checking Postfix queue ${q}
        /usr/sbin/postmulti -xi ${q} postqueue -p
    done
    datesay Looking for pidfile ${pidfile}
    ls -l ${pidfile}
    if [ -f ${pidfile} ]; then oldpid=`cat ${pidfile}`; else oldpid=0; fi
    datesay PID claims to be ${oldpid} for Postfix master
    [ ${oldpid} -eq 0 ] && bounce=$(( ${bounce} + 1 ))
    for portpair in ${postfixports}
    do
        tcpport=`echo ${portpair} | awk -F: '{print $2}'`
        portname=`echo ${portpair} | awk -F: '{print $1}'`
        portholder=0
        ncresponse=0
        portholder=`getportholder ${tcpport} "(0.0.0.0|127.0.0.1)"`
        datesay PID ${portholder} owns TCP port ${tcpport} for ${portname}
        [ ${portholder:-0} -eq 0 ] && bounce=$(( ${bounce} + 1 ))
        #[ ${portholder:-0} -ne ${oldpid:-0} ] && bounce=$(( ${bounce} + 1 ))

        #ncresponse=`checknc ${tcpport}`
        #datesay GOT ${ncresponse} answer\(s\) from ${tcpport} for ${portname}
        #[ ${ncresponse:-0} -eq 0 ] && bounce=$(( ${bounce} + 1 ))

        smtpresponse=`checksmtp localhost ${tcpport}`
        datesay NEEDED 220 and GOT ${smtpresponse} from ${tcpport} for ${portname}
        [ ${smtpresponse} -ne 220 ] && bounce=$(( ${bounce} + 1 ))
    done
    datesay ${mydaemon} has ${bounce} reasons to restart!
    [ ${bounce} -gt 0 ] && bouncedaemon
}

touch ${outfile}; chmod a+r ${outfile}
main ${@} > ${outfile} 2>&1


#!/bin/bash

cp $RECIPE_DIR/setup.py ./
$PYTHON setup.py install --single-version-externally-managed --record=record.txt


#!/bin/bash

ACTION=$1 # create / flush
CHINA_IPSET_V4=$2 # chinaip4 / empty
CHINA_IPSET_V6=$3 # chinaip6 / empty
REDIR_PORT=$4 # $PORT / empty
ENABLE_UDP=$5 # "udp" / empty

SS_FWMARK=0xff # right now hardcoded by shadowsocks-rust
FWMARK=0x233 # some uint that is unique across tables

iptables46() {
    iptables "$@"
    ip6tables "$@"
}

flush() {
    ip -4 route del local 0/0 dev lo table 100
    ip -4 rule del fwmark "$FWMARK" table 100
    ip -6 route del local ::/0 dev lo table 100
    ip -6 rule del fwmark "$FWMARK" table 100

    # flush existing rules
    iptables-save | grep -v SHADOWSOCKS | iptables-restore
    ip6tables-save | grep -v SHADOWSOCKS | ip6tables-restore

    echo "Flushed iptables"
}

create() {
    modprobe xt_TPROXY || { echo "Failed to load TPROXY module"; exit 1; }

    readonly IPV4_RESERVED_IPADDRS="\
        0/8 \
        10/8 \
        100.64/10 \
        127/8 \
        169.254/16 \
        172.16/12 \
        192/24 \
        192.0.2.0/24 \
        192.88.99/24 \
        192.168/16 \
        198.18/15 \
        198.51.100/24 \
        203.0.113/24 \
        224/4 \
        240/4 \
        255.255.255.255/32 \
    "
    readonly IPV6_RESERVED_IPADDRS="\
        ::/128 \
        ::1/128 \
        ::ffff:0:0/96 \
        fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b/96 \
        64:ff9b::/96 \
        100::/64 \
        2001::/32 \
        2001:20::/28 \
        2001:db8::/32 \
        2002::/16 \
        fc00::/7 \
        fe80::/10 \
        ff00::/8 \
    "

    # add firewall mark
    ip -4 route add local 0/0 dev lo table 100
    ip -4 rule add fwmark "$FWMARK" table 100
    ip -6 route add local ::/0 dev lo table 100
    ip -6 rule add fwmark "$FWMARK" table 100

    # lan rules
    iptables46 -t mangle -N SHADOWSOCKS

    # bypass lan ip
    for addr in $IPV4_RESERVED_IPADDRS; do
        iptables -t mangle -A SHADOWSOCKS -d "$addr" -j RETURN
    done
    for addr in $IPV6_RESERVED_IPADDRS; do
        ip6tables -t mangle -A SHADOWSOCKS -d "$addr" -j RETURN
    done

    # bypass sslocal outbound with mask $SS_FWMARK
    iptables46 -t mangle -A SHADOWSOCKS -m mark --mark "$SS_FWMARK"/"$SS_FWMARK" -j RETURN

    # bypass china ip
    iptables -t mangle -A SHADOWSOCKS -m set --match-set "$CHINA_IPSET_V4" dst -p tcp -j RETURN
    ip6tables -t mangle -A SHADOWSOCKS -m set --match-set "$CHINA_IPSET_V6" dst -p tcp -j RETURN

    # TPROXY TCP/UDP with mask $FWMARK to port $REDIR_PORT
    iptables46 -t mangle -A SHADOWSOCKS -p tcp -j TPROXY --on-port "$REDIR_PORT" --tproxy-mark "$FWMARK/$FWMARK"

    # apply lan rules
    iptables46 -t mangle -A PREROUTING -p tcp -j SHADOWSOCKS

    ##########

    # local rules
    iptables46 -t mangle -N SHADOWSOCKS-MARK

    # bypass lan ip
    for addr in $IPV4_RESERVED_IPADDRS; do
        iptables -t mangle -A SHADOWSOCKS-MARK -d "$addr" -j RETURN
    done
    for addr in $IPV6_RESERVED_IPADDRS; do
        ip6tables -t mangle -A SHADOWSOCKS-MARK -d "$addr" -j RETURN
    done

    # bypass sslocal outbound with mask $SS_FWMARK
    iptables46 -t mangle -A SHADOWSOCKS-MARK -m mark --mark "$SS_FWMARK"/"$SS_FWMARK" -j RETURN

    # bypass china ip
    iptables -t mangle -A SHADOWSOCKS-MARK -m set --match-set "$CHINA_IPSET_V4" dst -p tcp -j RETURN
    ip6tables -t mangle -A SHADOWSOCKS-MARK -m set --match-set "$CHINA_IPSET_V6" dst -p tcp -j RETURN

    # reroute
    iptables46 -t mangle -A SHADOWSOCKS-MARK -p tcp -j MARK --set-xmark "$FWMARK/0xffffffff"

    # apply local rules
    iptables46 -t mangle -A OUTPUT -p tcp -j SHADOWSOCKS-MARK

    ##########

    # udp
    if [ "$ENABLE_UDP" == "udp" ]; then
        # bypass china ip
        iptables -t mangle -A SHADOWSOCKS -m set --match-set "$CHINA_IPSET_V4" dst -p udp -j RETURN
        ip6tables -t mangle -A SHADOWSOCKS -m set --match-set "$CHINA_IPSET_V6" dst -p udp -j RETURN

        # TPROXY TCP/UDP with mask $FWMARK to port $REDIR_PORT
        iptables46 -t mangle -A SHADOWSOCKS -p udp -j TPROXY --on-port "$REDIR_PORT" --tproxy-mark "$FWMARK/$FWMARK"

        # apply lan rules
        iptables46 -t mangle -A PREROUTING -p udp -j SHADOWSOCKS

            # bypass china ip
        iptables -t mangle -A SHADOWSOCKS-MARK -m set --match-set "$CHINA_IPSET_V4" dst -p udp -j RETURN
        ip6tables -t mangle -A SHADOWSOCKS-MARK -m set --match-set "$CHINA_IPSET_V6" dst -p udp -j RETURN

        # reroute
        iptables46 -t mangle -A SHADOWSOCKS-MARK -p udp -j MARK --set-xmark "$FWMARK/0xffffffff"

        # apply local rules
        iptables46 -t mangle -A OUTPUT -p udp -j SHADOWSOCKS-MARK
    fi

    echo "Created iptables"
}

if [ "$ACTION" == "flush" ]; then
    flush
elif [ "$ACTION" == "create" ]; then
    create
fi


ip link add vxlan2 type vxlan id 1970 dev ens3 dstport 4789
ip link set vxlan2 up
bridge fdb append to 00:00:00:00:00:00 dst 10.4.48.79 dev vxlan2
ip link add vxlan3 type vxlan id 1971 dev ens3 dstport 4789
ip link set vxlan3 up
bridge fdb append to 00:00:00:00:00:00 dst 10.4.48.195 dev vxlan3


<filename>run/amr_oracle_smatch.sh
#!/bin/bash

set -o errexit
set -o pipefail
# . set_environment.sh
set -o nounset

##### CONFIG
dir=$(dirname $0)

if [ ! -z "$1" ]; then
    config=$1
    . $config    # $config should include its path
fi
# NOTE: when the first configuration argument is not provided, this script must
#       be called from other scripts
# in this case, must provide $1 as "" empty; otherwise put "set -o nounset" below

##### reconstruct AMR given sentence and oracle actions without being constrained
# by training stats
for split in dev test train
do

    if [ $split == "dev" ]; then
        ref=$AMR_DEV_FILE
    elif [ $split == "test" ]; then
        ref=$AMR_TEST_FILE
    else
        ref=$AMR_TRAIN_FILE
    fi

    if [ ! -s $ORACLE_FOLDER/oracle_$split.smatch ]; then

        python transition_amr_parser/amr_fake_parse.py \
            --in-sentences $ORACLE_FOLDER/$split.en \
            --in-actions $ORACLE_FOLDER/$split.actions \
            --out-amr $ORACLE_FOLDER/oracle_$split.amr \
            --in-pred-entities $ENTITIES_WITH_PREDS

        ##### evaluate reconstruction performance
        # smatch="$(smatch.py --significant 3 -r 10 -f $reference_amr $ORACLE_FOLDER/oracle_${test_set}.amr)"

        smatch.py --significant 3 -r 10 -f $ref $ORACLE_FOLDER/oracle_$split.amr > $ORACLE_FOLDER/oracle_$split.smatch

    else

        echo "smatch result for "$ORACLE_FOLDER/oracle_$split.amr" already exists."

    fi

    cat $ORACLE_FOLDER/oracle_$split.smatch

done


#!/bin/bash

function print_help_and_exit
{
cat >&2 << 'EOF'

'fetch.bash' is a script to download molecular structures from PDB

Options:
    --pdb-id | -i              string   *  PDB ID, alternatively can be provided as an unnamed argument
    --assembly-num | -a        number      assembly number
    --help | -h                            flag to display help message and exit

EOF
exit 1
}

command -v curl &> /dev/null || { echo >&2 "Error: 'curl' executable not in binaries path"; exit 1; }

PDB_ID=""
PDB_SELECTED_ASSEMBLY=""
HELP_MODE=false

while [[ $# > 0 ]]
do
	OPTION="$1"
	OPTARG="$2"
	shift
	case $OPTION in
	-i|--pdb-id)
		PDB_ID="$OPTARG"
		shift
		;;
	-a|--assembly-num)
		PDB_SELECTED_ASSEMBLY="$OPTARG"
		shift
		;;
	-h|--help)
		HELP_MODE=true
		;;
	*)
		[ -z "$PDB_ID" ] || { echo >&2 "Error: invalid command line option '$OPTION'"; exit 1; }
		PDB_ID="$OPTION"
		;;
	esac
done

if $HELP_MODE
then
	print_help_and_exit
fi

if [ -z "$PDB_ID" ]
then
	echo >&2 "Error: missing PDB ID"
	exit 1
fi

readonly TMPLDIR=$(mktemp -d)

function on_exit_final
{
	rm -r $TMPLDIR
}

trap on_exit_final EXIT

curl "http://www.rcsb.org/pdb/rest/getEntityInfo?structureId=${PDB_ID}" > "$TMPLDIR/pdbinfo" 2> /dev/null

if [ ! -s "$TMPLDIR/pdbinfo" ]
then
	echo >&2 "Error: failed to get info for PDB ID '$PDB_ID'"
	exit 1
fi

PDB_ID_CONFIRMED="$(cat "$TMPLDIR/pdbinfo" | egrep '<PDB.*structureId' | head -1 | sed 's/.*\sstructureId\s*=\s*\"\s*\(\S\+\)\s*\".*/\1/')"

PDB_METHOD="$(cat "$TMPLDIR/pdbinfo" | egrep '<Method.*name' | head -1 | sed 's/.*\sname\s*=\s*\"\s*\(\S\+\)\s*\".*/\1/')"

PDB_ASSEMBLIES="$(cat "$TMPLDIR/pdbinfo" | egrep '<PDB.*bioAssemblies' | head -1 | sed 's/.*\sbioAssemblies\s*=\s*\"\s*\(\S\+\)\s*\".*/\1/')"

if [ "$PDB_ID_CONFIRMED" != "$PDB_ID" ]
then
	echo >&2 "Error: failed to get info for PDB ID '$PDB_ID'"
	exit 1
fi

mkdir -p "$TMPLDIR/models"

PDB_FILE=""

if [ -n "$PDB_SELECTED_ASSEMBLY" ]
then
	PDB_FILE="$TMPLDIR/models/${PDB_ID}_as${PDB_SELECTED_ASSEMBLY}"

	curl "https://files.rcsb.org/download/${PDB_ID}.pdb${PDB_SELECTED_ASSEMBLY}.gz" 2> /dev/null \
	| zcat 2> /dev/null \
	> "$PDB_FILE"
else
	PDB_FILE="$TMPLDIR/models/${PDB_ID}"

	curl "https://files.rcsb.org/download/${PDB_ID}.pdb.gz" 2> /dev/null \
	| zcat 2> /dev/null \
	> "$PDB_FILE"
fi

if [ -z "$PDB_FILE" ] || [ ! -s "$PDB_FILE" ]
then
	echo >&2 "Error: failed download and extract relevant atoms"
	exit 1
fi

cat "$PDB_FILE"


<filename>tests/test__grep.sh
#!/bin/sh
#==============================================================================
# VALID CASES
#==============================================================================
posix_adapter__test__valid_case 'grep - [stdin] extended regexp mode'

expected='hello'

if result="$(echo 'hello' | posix_adapter__grep --extended 'l+')"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [path] extended regexp mode'

grep_file_path='./fixtures/grep/dummy_file_1'
expected='hello'

if result="$(posix_adapter__grep --extended 'l+' "$grep_file_path")"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [both] file path input has priority'

grep_file_path='./fixtures/grep/dummy_file_1'
expected='hello'

if result="$( \
  echo 'other' | posix_adapter__grep --extended 'l+' "$grep_file_path" \
)"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [stdin] silent mode'

expected=''

if result="$(echo 'hello' | posix_adapter__grep --silent '.')"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [path] silent mode'

grep_file_path='./fixtures/grep/dummy_file_1'
expected=''

if result="$(posix_adapter__grep --silent '.' "$grep_file_path")"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [stdin] inverted mode'

expected='hello'

if result="$(echo 'hello' | posix_adapter__grep --invert-match 'imre')"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [path] inverted mode'

grep_file_path='./fixtures/grep/dummy_file_1'
expected='hello'

if result="$(posix_adapter__grep --invert-match 'imre' "$grep_file_path")"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [stdin] count mode'

expected='1'

if result="$(echo 'hello' | posix_adapter__grep --count 'l')"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [stdin] count mode'

grep_file_path='./fixtures/grep/dummy_file_1'
expected='1'

if result="$(posix_adapter__grep --count 'l' "$grep_file_path")"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [stdin] only matching mode'

expected='ll'

if result="$( \
  echo 'imre hello' | posix_adapter__grep --match-only 'll' \
)"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
posix_adapter__test__valid_case 'grep - [path] only matching mode'

grep_file_path='./fixtures/grep/dummy_file_1'
expected='ll'

if result="$(posix_adapter__grep --match-only 'll' "$grep_file_path")"
then
  posix_adapter__test__assert_equal "$expected" "$result"
else
  status="$?"
  posix_adapter__test__test_case_failed "$status"
fi

#==============================================================================
# ERROR CASES
#==============================================================================
posix_adapter__test__error_case 'grep - missing pattern should result an error'

if error_message="$(posix_adapter__grep 2>&1)"
then
  posix_adapter__test__test_case_failed "$status"
else
  status="$?"
  posix_adapter__test__assert_invalid_parameters "$status" "$error_message"
fi

#==============================================================================
posix_adapter__test__error_case 'grep - invalid option'

if error_message="$(posix_adapter__grep --option 2>&1)"
then
  status="$?"
  posix_adapter__test__test_case_failed "$status"
else
  status="$?"
  posix_adapter__test__assert_invalid_parameters "$status" "$error_message"
fi

#==============================================================================
posix_adapter__test__error_case 'grep - invalid option style'

if error_message="$(posix_adapter__grep -option 2>&1)"
then
  status="$?"
  posix_adapter__test__test_case_failed "$status"
else
  status="$?"
  posix_adapter__test__assert_invalid_parameters "$status" "$error_message"
fi


<reponame>davengeo/distributedlog
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#

ROOT_DIR=$(git rev-parse --show-toplevel)
cd $ROOT_DIR/docker

MVN_VERSION=`./get-version.sh`
ALL_MODULE="distributedlog-dist"
DOCKER_IMAGE_NAME="distributedlog"
DOCKER_GRAFANA_NAME="distributedlog-grafana"
DOCKER_IMAGE_VERSION="latest"

echo "distributedlog version: ${MVN_VERSION}"

DLOG_TGZ=$(dirname $PWD)/distributedlog-dist/target/${ALL_MODULE}-${MVN_VERSION}-bin.tar.gz

if [ ! -f $DLOG_TGZ ]; then
    echo "distributedlog bin distribution not found at ${DLOG_TGZ}"
    exit 1
fi

LINKED_DLOG_TGZ=${ALL_MODULE}-${MVN_VERSION}-bin.tar.gz
ln -f ${DLOG_TGZ} $LINKED_DLOG_TGZ

echo "Using distributedlog binary package at ${DLOG_TGZ}"

# Build base image, reused by all other components
docker build --build-arg VERSION=${MVN_VERSION} \
             -t ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION} .

if [ $? != 0 ]; then
    echo "Error: Failed to create Docker image for distributedlog"
    exit 1
fi

rm ${ALL_MODULE}-${MVN_VERSION}-bin.tar.gz

# Build distributedlog-grafana image
docker build -t ${DOCKER_GRAFANA_NAME}:${DOCKER_IMAGE_VERSION} grafana
if [ $? != 0 ]; then
    echo "Error: Failed to create Docker image for distributedlog-grafana"
    exit 1
fi


<reponame>NERC-CEH/ubuntu
#!/bin/bash -eux

if [[ $PACKER_BUILDER_TYPE =~ vmware ]]; then
    echo "==> Installing Open VM Tools"
    # Install open-vm-tools so we can mount shared folders
    apt-get install -y open-vm-tools
    # Install open-vm-tools-desktop so we can copy/paste, resize, etc.
    if [[ "$DESKTOP" =~ ^(true|yes|on|1|TRUE|YES|ON])$ ]]; then
        apt-get install -y open-vm-tools-desktop
    fi
    # Add /mnt/hgfs so the mount works automatically with Vagrant
    mkdir /mnt/hgfs
fi


<filename>usr/src/test/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_006_pos.ksh
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#
# Copyright (c) 2016 by Delphix. All rights reserved.
# Copyright 2019 RackTop Systems.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib

#
# DESCRIPTION:
#	Invoke "zfs mount <filesystem>" with a filesystem
#	which mountpoint be the identical or the top of an existing one,
#	it will fail with a return code of 1
#
# STRATEGY:
#	1. Prepare an existing mounted filesystem.
#	2. Setup a new filesystem and make sure that it is unmounted.
#       3. Mount the new filesystem using the various combinations
#		- zfs set mountpoint=<identical path> <filesystem>
#		- zfs set mountpoint=<top path> <filesystem>
#       4. Verify that mount failed with return code of 1.
#

verify_runnable "both"

function cleanup
{
	log_must force_unmount $TESTPOOL/$TESTFS

	datasetexists $TESTPOOL/$TESTFS1 && \
		cleanup_filesystem $TESTPOOL $TESTFS1

	[[ -d $TESTDIR ]] && \
		log_must rm -rf $TESTDIR
	log_must zfs set mountpoint=$TESTDIR $TESTPOOL/$TESTFS
	log_must force_unmount $TESTPOOL/$TESTFS

	return 0
}

typeset -i ret=0

log_assert "Verify that 'zfs $mountcmd <filesystem>' " \
	"which mountpoint be the identical or the top of an existing one " \
	"will fail with return code 1."

log_onexit cleanup

unmounted $TESTPOOL/$TESTFS || \
	log_must force_unmount $TESTPOOL/$TESTFS

[[ -d $TESTDIR ]] && \
	log_must rm -rf $TESTDIR

typeset -i MAXDEPTH=3
typeset -i depth=0
typeset mtpt=$TESTDIR

while (( depth < MAXDEPTH )); do
	mtpt=$mtpt/$depth
	(( depth = depth + 1))
done

log_must zfs set mountpoint=$mtpt $TESTPOOL/$TESTFS
log_must zfs $mountcmd $TESTPOOL/$TESTFS

mounted $TESTPOOL/$TESTFS || \
	log_unresolved "Filesystem $TESTPOOL/$TESTFS is unmounted"

log_must zfs create $TESTPOOL/$TESTFS1

unmounted $TESTPOOL/$TESTFS1 || \
	log_must force_unmount $TESTPOOL/$TESTFS1

while [[ $mtpt != $TESTDIR ]] ; do
	(( depth == MAXDEPTH )) && \
		log_note "Verify that 'zfs $mountcmd <filesystem>' " \
		"which mountpoint be the identical of an existing one " \
		"will fail with return code 1."

	log_must zfs set mountpoint=$mtpt $TESTPOOL/$TESTFS1
	log_mustnot zfs $mountcmd $TESTPOOL/$TESTFS1

	unmounted $TESTPOOL/$TESTFS1 || \
		log_fail "Filesystem $TESTPOOL/$TESTFS1 is mounted."

	mtpt=${mtpt%/*}

	(( depth == MAXDEPTH )) && \
		log_note "Verify that 'zfs $mountcmd <filesystem>' " \
		"which mountpoint be the top of an existing one " \
		"will fail with return code 1."
	(( depth = depth - 1 ))
done

log_pass "'zfs $mountcmd <filesystem>' " \
	"which mountpoint be the identical or the top of an existing one " \
	"will fail with return code 1."


<filename>multi-node/col-split/mushroom-col-rabit-mock.sh
#!/bin/bash
if [[ $# -ne 1 ]]
then
    echo "Usage: nprocess"
    exit -1
fi

#
# This script is same as mushroom-col except that we will be using xgboost instead of xgboost-mpi
# xgboost used built in tcp-based allreduce module, and can be run on more enviroment, so long as we know how to start job by modifying ../submit_job_tcp.py
#
rm -rf train.col* *.model
k=$1

# split the lib svm file into k subfiles
python splitsvm.py ../../demo/data/agaricus.txt.train train $k

# run xgboost mpi
../../rabit/tracker/rabit_mpi.py $k local ../../rabit/test/keepalive.sh ../../xgboost-mock mushroom-col.conf dsplit=col mock=0,1,0,0 mock=1,1,0,0

# the model can be directly loaded by single machine xgboost solver, as usuall
#../../xgboost mushroom-col.conf task=dump model_in=0002.model fmap=../../demo/data/featmap.txt name_dump=dump.nice.$k.txt

#cat dump.nice.$k.txt


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

source /usr/bin/motion-tools.sh

#
# %$ - camera name
# %Y - The year as a decimal number including the century.
# %m - The month as a decimal number (range 01 to 12).
# %d - The day of the month as a decimal number (range 01 to 31).
# %H - The hour as a decimal number using a 24-hour clock (range 00 to 23)
# %M - The minute as a decimal number (range 00 to 59). >& /dev/stderr
# %S - The second as a decimal number (range 00 to 61).
#

###
### MAIN
###

hzn.log.trace "started program"

CN="${1}"
YR="${2}"
MO="${3}"
DY="${4}"
HR="${5}"
MN="${6}"
SC="${7}"
TS="${YR}${MO}${DY}${HR}${MN}${SC}"

# get time
NOW=$($dateconv -i '%Y%m%d%H%M%S' -f "%s" "$TS")

hzn.log.debug "got timestamp: ${TS} and time: ${NOW}"

MOTION_DEVICE=${MOTION_DEVICE:-$(hostname)}

# `status/found`
mqtt_pub -q 2 -r -t "${MOTION_GROUP}/${MOTION_DEVICE}/${CN}/status/found" -m '{"device":"'${MOTION_DEVICE}'","camera":"'"${CN}"'","time":'"${NOW}"',"status":"found"}'

# test pattern to `image`
mqtt_pub -q 2 -r -t "${MOTION_GROUP}/${MOTION_DEVICE}/${CN}/image" -f "/etc/motion/test.jpg"

# test pattern to `image-animated`
mqtt_pub -q 2 -r -t "$MOTION_GROUP/$MOTION_DEVICE/$CN/image-animated" -f "/etc/motion/test.gif"

hzn.log.trace "completed program"


#!/bin/bash
set -e -x

echo "Deploying since this is a tag commit"

# Upload to PYPI
python -m twine upload dist/* -u aantonitis -p $PYPASS --skip-existing


#!/bin/bash
export TRAIN_PATH="data/ner_covid19/train.json"
export DEV_PATH="data/ner_covid19/dev.json"
export TEST_PATH="data/ner_covid19/test.json"
export CHAR_VOCAB_PATH="data/charindex.json"
export LABEL_SET_PATH="data/ner_covid19/label_set.txt"
export MAX_CHAR_LEN=20
export MAX_SEQ_LENGTH=200
export BATCH_SIZE=32
export CHAR_EMBEDDING_DIM=100
export CHAR_HIDDEN_DIM=200
export NUM_BERT_LAYER=1
export CHAR_VOCAB_SIZE=108
export HIDDEN_DIM=728
export HIDDEN_DIM_FFW=300
export NUM_LABELS=12
export MODEL_NAME_OR_PATH="vinai/phobert-base"
export NUM_EPOCHS=30
export LEARNING_RATE=5e-5
export ADAM_EPSILON=1e-8
export WEIGHT_DECAY=0.01
export WARMUP_STEPS=0
export MAX_GRAD_NORM=1
export SAVE_FOLDER="results"

python train.py --train_path $TRAIN_PATH \
                --max_char_len $MAX_CHAR_LEN  \
                --dev_path $DEV_PATH \
                --max_seq_length $MAX_SEQ_LENGTH \
                --batch_size $BATCH_SIZE \
                --char_embedding_dim $CHAR_EMBEDDING_DIM \
                --char_hidden_dim $CHAR_HIDDEN_DIM \
                --num_layer_bert $NUM_BERT_LAYER \
                --char_vocab_size $CHAR_VOCAB_SIZE \
                --hidden_dim $HIDDEN_DIM \
                --hidden_dim_ffw $HIDDEN_DIM_FFW \
                --num_labels $NUM_LABELS \
                --model_name_or_path $MODEL_NAME_OR_PATH \
                --num_epochs $NUM_EPOCHS \
                --learning_rate $LEARNING_RATE \
                --adam_epsilon $ADAM_EPSILON \
                --weight_decay $WEIGHT_DECAY \
                --warmup_steps $WARMUP_STEPS \
                --max_grad_norm $MAX_GRAD_NORM  \
                --save_folder $SAVE_FOLDER \
                --test_path $TEST_PATH \
                --char_vocab_path $CHAR_VOCAB_PATH \
                --label_set_path $LABEL_SET_PATH \
                --do_eval \
                --do_train \
#                 --use_char \


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

# Copyright 2021 The Kubernetes Authors.
#
# 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 script checks coding style for go language files
# Usage: `hack/verify-golangci-lint.sh`.

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

. "$(dirname "${BASH_SOURCE[0]}")/common.sh"

# Ensure that we find the binaries we build before anything else.
export GOBIN="${TOOLS_BIN}"
PATH="${GOBIN}:${PATH}"

# Install golangci-lint
if ! command -v golangci-lint &> /dev/null; then
  cd "${KOPS_ROOT}/hack" || exit 1
  go install github.com/golangci/golangci-lint/cmd/golangci-lint
fi

cd "${KOPS_ROOT}"

# The config is in ${KOPS_ROOT}/.golangci.yaml
echo 'running golangci-lint ' >&2
res=0
if [[ "$#" -gt 0 ]]; then
    golangci-lint run "$@" >&2 || res=$?
else
    golangci-lint run ./... >&2 || res=$?
fi

# print a message based on the result
if [[ "$res" -eq 0 ]]; then
  echo 'Congratulations! All files are passing lint :-)'
else
  {
    echo
    echo 'Please review the above warnings. You can test via "./hack/verify-golangci-lint.sh"'
    echo 'If the above warnings do not make sense, you can exempt this warning with a comment'
    echo ' (if your reviewer is okay with it).'
    echo 'In general please prefer to fix the error, we have already disabled specific lints'
    echo ' that the project chooses to ignore.'
    echo 'See: https://golangci-lint.run/usage/false-positives/'
    echo
  } >&2
  exit 1
fi

# preserve the result
exit "$res"


<filename>scripts/configuration/unity-tweak-tool.sh
apt-get install unity-tweak-tool gnome-tweak-tool


<reponame>Nani-Games/bulk-bot<gh_stars>0
echo "Stopping..."
screen -S bulkbot -X quit
echo "Done!"


<filename>m2c/generate_mapping_files.sh
#!/bin/bash

# Bash script to generate the mapping files from the extracted metadata.
# The mapping file is intended to be edited by the customer, while the
# metadata file is left untouched.
#
# Generated on: 2021-10-13 12:52:30 UTC
# Generated by: artifact_generator.py generate_initial_scripts()
# Template:     generate_mapping_files.txt

source env.sh

while true; do
    echo ''
    echo 'This process will overlay the mapping files you may have edited.'
    read -p "Do you wish to proceed - regenerate and overlay? " yn
    case $yn in
        [Yy]* ) break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

echo ''

# format: python main.py generate_mapping_file <db-name>

python main.py generate_mapping_file olympics

python main.py generate_mapping_file openflights

echo 'done'


#!/bin/bash
# First argument $1 will be the question_id.

gcc $1.c -w -o $1;


<filename>docker-cmd.sh
#!/bin/bash

trap "{ /opt/atlassian/confluence/bin/stop-confluence.sh; exit $?; }" SIGTERM SIGINT

# Run config for Confluence
/confluence-cfg.sh

# Start Confluence
su -c "/opt/atlassian/confluence/bin/start-confluence.sh -fg" confluence  &

# Loop until signal
while :
do
    sleep 4
done


<filename>lib/test/runall.sh<gh_stars>10-100
#!/bin/bash

CC="/cygdrive/e/c/dcc/dcc/bin/dcc.exe"
EXE_TEMP="a.exe"
ALLOW_DRT=$($CC --has-feature drt 2>/dev/null)

run_one() {
	echo "Testing: '$1'"
	if [ "$ALLOW_DRT" == "1" ]; then
		# Use DRT execution to prevent temporary files (Plus: it makes )
		$CC -dg "$1" || exit $?
	else
		$CC -g -o "$EXE_TEMP" "$1" || exit $?
		"./$EXE_TEMP" || {
			E=$?
			echo "ERROR: $E"
			exit $E
		}
	fi
}

run_test() {
	for src in $*; do
		run_one "$src"
	done
}

run_test *.c

rm -f "$EXE_TEMP"


<gh_stars>0
set -eo nounset
set +h

cd /sources

rm -rf perl-5.26.1
tar xf perl-5.26.1.tar.xz
pushd  perl-5.26.1

echo "127.0.0.1 localhost $(hostname)" > /etc/hosts

export BUILD_ZLIB=False
export BUILD_BZIP2=0

sh Configure -des -Dprefix=/usr                 \
                  -Dvendorprefix=/usr           \
                  -Dman1dir=/usr/share/man/man1 \
                  -Dman3dir=/usr/share/man/man3 \
                  -Dpager="/usr/bin/less -isR"  \
                  -Duseshrplib                  \
                  -Dusethreads

make

#make -k test

make install
unset BUILD_ZLIB BUILD_BZIP2

popd
rm -rf perl-5.26.1


#!/bin/bash -eux

function build() {
    local version=$1
    local platform=$2
    local arch=$3

    GOOS=$platform GOARCH=$arch go build \
        -ldflags "-X main.Version=${version}" \
        -o servicefabrik_cli_plugin_${platform}_${arch}
}

function main() {
    if [[ $# -ne 1 ]]; then
        echo "usage: ${0} <version>"
        exit 1
    fi
    local version=$1
    local platforms="linux darwin windows"
    for platform in $platforms; do
        echo calling to build for $platform
        build $version $platform "amd64"
        #Make windows binary executable
        if [[ $platform == "windows" ]] ; then
          mv servicefabrik_cli_plugin_${platform}_amd64 servicefabrik_cli_plugin_${platform}_amd64.exe
        fi
    done
}

main "$@"


<reponame>PeterMitrano/vector_v1<gh_stars>0
# This configures the environment variables for a vector rmp V3 simulation
# This is necessary to run before starting the simulation
#

# If there is an onboard PC powered by the system this will run the watchdog
# to make sure it gets gracefully shutdown before the system power cuts out.
export VECTOR_POWERS_PC_ONBOARD=true

#Default Vector RMP_V3 network
export VECTOR_IP_ADDRESS=10.66.171.5
export VECTOR_IP_PORT_NUM=8080

# The reference frame for all the accessories and sensors
export VECTOR_PARENT_LINK=base_chassis_link

#Determines if the platform should use 2D or 3D odometry
export VECTOR_USE_2D_ODOMETRY=true

#
# Determines if we should use robot_localization EKF or the onboard odometry;
# set to true for onboard odometry. Platform odometry is fairly accurate and will
# improve in the next few releases, but the robot_localization package offers an alternative
# form of localization that can be used to fuse other forms of odometry sensor data. Such as Visual,
# laser scan matching and landmarking information sources. If this is set to false we use robot
# localization to fuse the wheel odometry, SIC IMU, external IMU, etc.
#
export VECTOR_USE_PLATFORM_ODOMETRY=true

# This will run the full system tele-op node (ie can control all the joints in the system) it is not
# collision aware and is really only meant for demonstration purposes. If set false, teleop just controls
# the platform
export RUN_FULL_SYSTEM_TELEOP=true

# Joystick configurations for joystick set VECTOR_JOY_IS_ATTACHED if the joystick
# is physically attached to this PC
export VECTOR_JOY_IS_ATTACHED=false
export VECTOR_JOY_DEV=/dev/input/js0
export VECTOR_JOY_MAPPING=xbox360
export VECTOR_JOY_DEADZONE=0.1

# Sets whether the costmaps use 3D voxel grid layer (need a 3D sensor enabled)
# export VECTOR_USE_VOXEL_GRID=false support upon request

# External IMU configuration;
export VECTOR_HAS_EXT_IMU=true
export VECTOR_HAS_UM7_IMU=true
export VECTOR_UM7_DEV="/dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0"
export EXT_IMU_XYZ="0.15386 0 0.35547"
export EXT_IMU_RPY="0 0 0"

# 2D scanner configuration for launch files; should change hokuyo
# to sick if using a SICK LMS1XX
export VECTOR_HAS_2D_LASER=true
export VECTOR_2D_LASER_NS=hokuyo
export VECTOR_2D_LASER_TOPIC=/hokuyo/scan

# Hokuyo configuration (only supports one by default) watch
# wavelength on multi-laser systems
export VECTOR_HAS_HOKUYO=true
export VECTOR_HOKUYO_IP=10.66.171.6
export VECTOR_HOKUYO_PORT=10940
export HOKUYO_XYZ="0.35 0 0.2"
export HOKUYO_RPY="3.1415 0 0"
export HOKUYO_MAX_RANGE=10.0
export HOKUYO_MIN_RANGE=0.01

# SICK LIDAR configuration (only supports one by default) watch
# wavelength on multi-laser systems
export VECTOR_HAS_SICK_TIM=false
export VECTOR_SICK_TIM_IP=10.66.171.8
export VECTOR_SICK_TIM_PORT=2112
export SICK_TIM_XYZ="0.35 0 0.2"
export SICK_TIM_RPY="3.1415 0 0"
export HOKUYO_MAX_RANGE=25.0
export HOKUYO_MIN_RANGE=0.01

# Kinect pan-tilt configuration
export VECTOR_HAS_KINECT_PAN_TILT=true
export KINECT_PAN_TILT_PARENT_LINK=linear_actuator_fixed_link
export KINECT_PAN_TILT_XYZ="0.16688476 0 0.96899800"
export KINECT_PAN_TILT_RPY="0 0 0"
export OCL_IGNORE_SELF_TEST=1

# Machine vision  configuration used for visual odometry, landmark detection, etc
# To add machine vision cabability please contact <EMAIL>
export VECTOR_HAS_FLEA3=false
export VECTOR_FLEA3_SN='14472220'
export VECTOR_FLEA3_IS_CALIBRATED=false
export FLEA3_XYZ="0.0518 0 0.35508750"
export FLEA3_RPY="0 0 0"

#Kinova arm configurations (the right arm should be the default if there is only one)
export VECTOR_HAS_KINOVA_ARM=true
export VECTOR_HAS_TWO_KINOVA_ARMS=false
export KINOVA_RIGHT_ARM_SERIAL_NUMBER='PJ00900006153340003' #default arm if there is only one
export KINOVA_LEFT_ARM_SERIAL_NUMBER='PJ00900006152990001' #must specify serial number for 2 arms

#Robotiq gripper configurations
export VECTOR_HAS_ROBOTIQ_GRIPPER=true
export VECTOR_HAS_TWO_ROBOTIQ_GRIPPERS=false
export ROBOTIQ_GRIPPER_COMM_PORT="/dev/serial/by-path/pci-0000:00:14.0-usb-0:4:1.0-port0"
export ROBOTIQ_GRIPPER_BAUDRATE=115200

#Linear actuator
export VECTOR_HAS_LINEAR_ACTUATOR=true