#!/bin/bash
#SBATCH -N 1
#SBATCH -c 4
#SBATCH -p gpu-private
##SBATCH -p res-gpu-small
##SBATCH -p res-gpu-large
##SBATCH -p gpu-bigmem
#SBATCH --qos=short
#SBATCH --job-name=dartsMask
#SBATCH --gres=gpu:1
#SBATCH -o dynamicMask.out
#SBATCH --mem=72g
##SBATCH --mem=28g
##SBATCH --mem=48g
#SBATCH -t 2-0:0:0

#module unload cuda
#module load cuda/9.0
#source venv/bin/activate

rm ~/hem/perceptual/tempSave/maskclusters/*
bash bashDynamicMask.sh 100 0.9 0.25


python run_autoencoder.py --firstx 600 --lastx 3500 -b 500 -e 200


<gh_stars>0
#!/bin/bash
echo "Installing Gnome 3..."

simple-install ppa:gnome3-team/gnome3 fonts-cantarell gnome-shell gnome-shell-extensions gnome-session gnome-terminal nautilus


# Package specific behaviors
# Sourced script by generic installer and start-stop-status scripts

SERVICE_COMMAND="python -m SimpleHTTPServer ${SERVICE_PORT}"
SVC_CWD="${SYNOPKG_PKGDEST}"
SVC_BACKGROUND=y
SVC_WRITE_PID=y

# These functions are for demonstration purpose of DSM sequence call.
# Only provide useful ones for your own package, logging may be removed.
service_preinst ()
{
    echo "service_preinst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_postinst ()
{
    echo "service_postinst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_preuninst ()
{
    echo "service_preuninst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_postinst ()
{
    echo "service_postuninst ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_preupgrade ()
{
    echo "service_preupgrade ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_postupgrade ()
{
    echo "service_postupgrade ${SYNOPKG_PKG_STATUS}" >> $INST_LOG
}

service_poststop ()
{
    echo "After stop" >> $LOG_FILE
}


#!/bin/bash

xapp -package ${REGULUS}/Examples/Toy1Specialised/Generated/toy1_specialised_recogniser


<reponame>stajichlab/Fusarium_Phylogenomics
#!/usr/bin/bash
#SBATCH -p short -N 1 -n 48 --mem 96gb  -N 1 --out logs/make_CDSIQ_trees.%A.log
module load fasttree
module load IQ-TREE/2.1.1

CPU=1
if [ $SLURM_CPUS_ON_NODE ]; then
  CPU=$SLURM_CPUS_ON_NODE
fi

make -f PHYling_unified/util/makefiles/Makefile.trees HMM=sordariomycetes_odb10.2021 -j $CPU CDSIQ


BOOTNODE_IP=""
BOOTNODE_PORT=""
RPC_PORT=""
CONSTELLATION_PORT=""
GETH_PORT=""


<gh_stars>0
# vim: tabstop=4 shiftwidth=4 softtabstop=4 smarttab expandtab autoindent
#!/bin/bash

ts=$1
shift
sed -i 's/:page-last_modified_at: 20..-..-.. 00:00:00/:page-last_modified_at: '$ts' 00:00:00/' "$@"


#!/bin/bash
ulimit -c unlimited

BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
PID_FILE="$BASE_DIR/../bin/da_pid"
LOG_LEVEL=3

START=0
STOP=0
IMMEDIATE=0
RELOAD=0
TEST_CONF=0
SHOWHELP=0

TEMP=`getopt -o v:p: -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"

while true ; do
        case "$1" in
                -v)
                    echo "Option v, verbose: $2"; LOG_LEVEL=$2; shift 2 ;;
                -p)
                	echo "Option p, pid file: $2"; PID_FILE=$2; shift 2 ;;
                --) shift ; break ;;
                *) echo "Internal error!" ; exit 1 ;;
        esac
done

if [ "$1" = "start" ];then
	START=1
elif [ "$1" = "stop" ];then
      if [ "$2" = "normal" ] || [ "$2" = ""  ];then
      	  STOP=1
      elif [ "$2" = "immediate" ];then
      	  STOP=1
      	  IMMEDIATE=1
      else
    	  echo "error input argument"
    	  exit 1
       fi
elif [ "$1" = "reload" ];then
	RELOAD=1
elif [ "$1" = "testconf" ];then
	TEST_CONF=1
elif [ "$1" = "help" ];then
	SHOWHELP=1
else
	echo "error input argument"
	exit 1
fi

#test agent conf
if [ "$TEST_CONF" = "1" ];then
	echo "test dtcagent conf start......"
	$BASE_DIR/dtcagent -t
	echo "test conf success"
	exit 0
fi

#start dtcagent
if [ "$START" = "1" ];
then
	echo "dtcagent starting......"
	NEED_START=0;
	if [ -f "$PID_FILE" ];then
		DA_PID=`cat $PID_FILE`
		if test $( pgrep -l dtcagent | grep $DA_PID | wc -l ) -gt 0
		then
			echo "$BASE_DIR/dtcagent whth pid file[$PID_FILE] already run in $DA_PID"
			exit 0
		else
			NEED_START=1
		fi
	else
		NEED_START=1
	fi
	if [ "$NEED_START" = "1" ];then
		$BASE_DIR/dtcagent -v $LOG_LEVEL -d -p $PID_FILE >> /dev/null 2>&1
		sleep 1
		if [ ! -f "$PID_FILE" ]; then
			echo "$BASE_DIR/dtcagent start failed,please check error log"
			exit 1
		else
			DA_PID=`cat $PID_FILE`
			if test $( pgrep -l dtcagent | grep $DA_PID | wc -l ) -lt 1
			then
				echo "$BASE_DIR/dtcagent start failed,please check error log"
				exit 1
			else
				echo "$BASE_DIR/dtcagent whth pid file[$PID_FILE] start success,pid is $DA_PID"
				echo "dtcagent has started successfully!"
				exit 0
			fi
		fi
	fi
fi

#stop dtcagent
if [ "$STOP" = 1 ];then
	if [ ! -f "$PID_FILE" ];then
		echo "$BASE_DIR/dtcagent stop failed, pid file[$PID_FILE] not exist"
		exit 1
	else
		DA_PID=`cat $PID_FILE`
		if test $( pgrep -l dtcagent | grep $DA_PID | wc -l ) -lt 1
		then
			echo "$BASE_DIR/dtcagent has stoped ,$DA_PID not existed"
			exit 0
		else
			if [ "$IMMEDIATE" = 1 ]
			then
				echo "stop immediate......."
				kill -9 $DA_PID
				sleep 1
				if test $( pgrep -l dtcagent | grep $DA_PID | wc -l ) -lt 1
				then
					echo "stop immediate success"
					echo "dtcagent has stoped successfully!"
					exit 0
				else
					echo "stop immediate failed"
					exit 1
				fi
			else
				echo "normal stoping ......"
				STATUS=0
				kill -s	SIGTERM $DA_PID
				RETRY_COUNT=0
				while true;do
					if test $( pgrep -l dtcagent | grep $DA_PID | wc -l ) -lt 1
					then
						STATUS=1
						break
					fi
					if [ $RETRY_COUNT -eq 15 ]
					then
						break
					fi
					sleep 1
					let "RETRY_COUNT=$RETRY_COUNT+1"
				done
				if [ "$STATUS" = "1" ]
				then
					echo "normal stop success"
					echo "dtcagent has stoped successfully!"
					exit 0
				else
					echo "normal stop failed,please check log"
					exit 1
				fi
			fi
		fi
	fi
fi

#hot restart dtcagent
if [ "$RELOAD" = "1" ];then
	if [ ! -f "$PID_FILE" ];then
		echo "$BASE_DIR/dtcagent stop failed, pid file[$PID_FILE] not exist"
		exit 1
	else
		DA_PID=`cat $PID_FILE`
		if test $( pgrep -l dtcagent | grep $DA_PID | wc -l ) -lt 1
		then
			echo "pid: $DA_PID not existed,agent has stoped"
			exit 1
		else
			echo "reloading......"
			STATUS=0
			kill -s SIGUSR1 $DA_PID
			while true;do
				if [ ! -f "$PID_FILE" ];then
					echo "reload failed,please check error log"
					break
				else
					NEW_DA_PID=`cat $PID_FILE`
					if [ $NEW_DA_PID != $DA_PID ]
					then
						if test $( pgrep -l dtcagent | grep $NEW_DA_PID | wc -l ) -lt 1
						then
							break
						else
							STATUS=1
							break
						fi
					fi
				fi
				sleep 1
			done
			if [ "$STATUS" = "1" ]
			then
				echo "reload success"
				echo "dtcagent has restart successfully!"
				exit 0
			else
				echo "reload failed,please check error log"
				exit 1
			fi
		fi
	fi
fi


#!/bin/bash

EXEC_DATE=$(date +"%H:%M (%m-%d-%Y)")

if [ "$1" = "rest_helloworld" ]; then
  RESULT=$(curl -LI http://localhost/api/helloworld -o /dev/null -w 'HTTP RESPONSE: %{http_code}\n' -s)
  echo "[REST HELLOWORLD] $EXEC_DATE - $RESULT" >> curl-results.txt
fi

if [ "$1" = "rest_countries" ]; then
  RESULT=$(curl -LI http://localhost/api/countries/"$2" -o /dev/null -w 'HTTP RESPONSE: %{http_code}\n' -s)
  echo "[REST COUNTRIES] $EXEC_DATE - $RESULT" >> curl-results.txt
fi

if [ "$1" = "soap_helloworld" ]; then
  RESULT=$(curl -w 'HTTP RESPONSE: %{response_code}' -s -X POST --data '@/www/webservices/helloworld_request.xml' http://localhost/zoap/helloworld/server --header "Content-Type:text/xml"|grep -o  'HTTP RESPONSE: [1-4][0-9][0-9]')
  echo "[SOAP HELLOWORLD] $EXEC_DATE - $RESULT" >> curl-results.txt
fi

if [ "$1" = "soap_countries" ]; then
  RESULT=$(curl -w 'HTTP RESPONSE: %{response_code}' -s -X POST --data '@/www/webservices/countries_request.xml' http://localhost/zoap/countries/server --header "Content-Type:text/xml"|grep -o  'HTTP RESPONSE: [1-4][0-9][0-9]')
  echo "[SOAP COUNTRIES] $EXEC_DATE - $RESULT" >> curl-results.txt
fi


<reponame>zmarkan/paramak
#!/bin/bash

pytest tests/test_utils.py -v --cov=paramak --cov-append --cov-report term --cov-report xml
pytest tests/test_shape.py -v --cov=paramak --cov-append --cov-report term --cov-report xml
pytest tests/test_reactor.py -v --cov=paramak --cov-append --cov-report term --cov-report xml
pytest tests/test_parametric_shapes/ -v --cov=paramak --cov-append --cov-report term --cov-report xml
pytest tests/test_parametric_components/ -v --cov=paramak --cov-append --cov-report term --cov-report xml
pytest tests/test_parametric_reactors/ -v --cov=paramak --cov-append --cov-report term --cov-report xml
python tests/test_example_shapes.py
python tests/test_example_components.py
python tests/test_example_reactors.py


<gh_stars>10-100
# Used for setting the modificateion time of files independend of the
# systems time.
timestamp="04090711"
directories="copied_remove copied_remove/foo
mirrored_remove mirrored_remove/foo"

mkdir generated/files/
for dir in $directories; do
  mkdir "generated/files/$dir"
done

echo "foo bar 123" > generated/files/copied_remove/foo/test1
echo "FileStream *reader = sFopenRead(/etc/init.conf);" > generated/files/copied_remove/foo/test2

echo "manually to ensure that tests run in the correct order." > generated/files/mirrored_remove/foo/bar1.txt
echo "to ensure tests run in the correct order." > generated/files/mirrored_remove/foo/bar2.txt
echo "  testGroupStart(some asserts);" > generated/files/mirrored_remove/foo/bar3.txt

for dir in $directories; do
  touch -m -t "$timestamp" "generated/files/$dir"
done


<reponame>StreamingDataPlatform/idrac-demo
#!/bin/bash

ROOT_DIR=$(dirname $0)

while IFS= read -r LINE; do
        # Skip commented lines
	case "$LINE" in \#*) continue ;; esac
	ARRAY=(${LINE})
        # Data is in the following form
	# IDRAC_IP  USER  PASSWD CALLBACK_URL
	IP="$(echo -e  ${ARRAY[0]} | tr -d '[:space:]')"
	USER="$(echo -e  ${ARRAY[1]} | tr -d '[:space:]')"
	PASS="$(echo -e  ${ARRAY[2]} | tr -d '[:space:]')"
	GATEWAY="$(echo -e  ${ARRAY[3]} | tr -d '[:space:]')"
	RACKLABEL="$(echo -e  ${ARRAY[4]} | tr -d '[:space:]')"
	# Set subscription using redifish API
	echo "####################################################################"
  echo $IP $USER $PASS $GATEWAY $RACKLABEL
  echo "####################################################################"
	status=$(${ROOT_DIR}/idrac_set_subscription.sh -u ${USER} -p ${PASS} -h ${IP} -g ${GATEWAY}  -r ${RACKLABEL})
        # Enable telemetrics reports
	if [ $status != "201" ] ; then
           echo "{\"message\": [ $(cat /tmp/idrac_resp) ], \"status\": \"failed to set subscription\", \"http_status_code\": \"${status}\"}"
	   continue
	fi
	${ROOT_DIR}/idrac_enable_attributes.sh -u $USER -p $PASS -h $IP
done < ${1}


<filename>run_tests.sh
#!/usr/bin/env bash

# usage:
# ./run_tests.sh                         # local, go 1.11
# GOVERSION=1.10 ./run_tests.sh          # local, go 1.10 (vgo)
# ./run_tests.sh docker                  # docker, go 1.11
# GOVERSION=1.10 ./run_tests.sh docker   # docker, go 1.10 (vgo)
# ./run_tests.sh podman                  # podman, go 1.11
# GOVERSION=1.10 ./run_tests.sh podman   # podman, go 1.10 (vgo)

set -ex

# The script does automatic checking on a Go package and its sub-packages,
# including:
# 1. gofmt         (http://golang.org/cmd/gofmt/)
# 2. go vet        (http://golang.org/cmd/vet)
# 3. gosimple      (https://github.com/dominikh/go-simple)
# 4. unconvert     (https://github.com/mdempsky/unconvert)
# 5. ineffassign   (https://github.com/gordonklaus/ineffassign)
# 6. race detector (http://blog.golang.org/race-detector)

# golangci-lint (github.com/golangci/golangci-lint) is used to run each each
# static checker.

# To run on docker on windows, symlink /mnt/c to /c and then execute the script
# from the repo path under /c.  See:
# https://github.com/Microsoft/BashOnWindows/issues/1854
# for more details.

# Default GOVERSION
[[ ! "$GOVERSION" ]] && GOVERSION=1.11
REPO=bitumseeder

testrepo () {
  GO=go
  if [[ $GOVERSION == 1.10 ]]; then
    GO=vgo
  fi

  $GO version

  # binary needed for RPC tests
  env CC=gcc $GO build
  cp "$REPO" "$GOPATH/bin/"

  # run tests on all modules
  ROOTPATH=$($GO list -m -f {{.Dir}} 2>/dev/null)
  ROOTPATHPATTERN=$(echo $ROOTPATH | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
  MODPATHS=$($GO list -m -f {{.Dir}} all 2>/dev/null | grep "^$ROOTPATHPATTERN"\
    | sed -e "s/^$ROOTPATHPATTERN//" -e 's/^\\\|\///')
  MODPATHS=". $MODPATHS"
  for module in $MODPATHS; do
    echo "==> ${module}"
    (cd $module && env GORACE='halt_on_error=1' CC=gcc $GO test -race \
	  ./...)
  done

  # check linters
  if [[ $GOVERSION != 1.10 ]]; then
    # linters do not work with modules yet
    golangci-lint run --disable-all --deadline=10m \
      --enable=gofmt \
      --enable=vet \
      --enable=gosimple \
      --enable=unconvert \
      --enable=ineffassign
    if [ $? != 0 ]; then
      echo 'golangci-lint has some complaints'
      exit 1
    fi
  fi

  echo "------------------------------------------"
  echo "Tests completed successfully!"
}

DOCKER=
[[ "$1" == "docker" || "$1" == "podman" ]] && DOCKER=$1
if [ ! "$DOCKER" ]; then
    testrepo
    exit
fi

# use Travis cache with docker
DOCKER_IMAGE_TAG=bitum-project-golang-builder-$GOVERSION
$DOCKER pull bitum-project/$DOCKER_IMAGE_TAG

$DOCKER run --rm -it -v $(pwd):/src:Z bitum-project/$DOCKER_IMAGE_TAG /bin/bash -c "\
  rsync -ra --filter=':- .gitignore'  \
  /src/ /go/src/github.com/bitum-project/$REPO/ && \
  cd github.com/bitum-project/$REPO/ && \
  env GOVERSION=$GOVERSION GO111MODULE=on bash run_tests.sh"


#!/bin/bash

# Tetris Game

#APP declaration
APP_NAME="${0##*[\\/]}"
APP_VERSION="1.0"

#颜色定义
cRed=1
cGreen=2
cYellow=3
cBlue=4
cFuchsia=5
cCyan=6
cWhite=7
colorTable=($cRed $cGreen $cYellow $cBlue $cFuchsia $cCyan $cWhite)

#位置和大小
iLeft=3
iTop=2
((iTrayLeft = iLeft + 2))
((iTrayTop = iTop + 1))
((iTrayWidth = 10))
((iTrayHeight = 15))

#颜色设置
cBorder=$cGreen
cScore=$cFuchsia
cScoreValue=$cCyan

#控制信号
#改游戏使用两个进程，一个用于接收输入，一个用于游戏流程和显示界面;
#当前者接收到上下左右等按键时，通过向后者发送signal的方式通知后者。
sigRotate=25
sigLeft=26
sigRight=27
sigDown=28
sigAllDown=29
sigExit=30

#七中不同的方块的定义
#通过旋转，每种方块的显示的样式可能有几种
box0=(0 0 0 1 1 0 1 1)
box1=(0 2 1 2 2 2 3 2 1 0 1 1 1 2 1 3)
box2=(0 0 0 1 1 1 1 2 0 1 1 0 1 1 2 0)
box3=(0 1 0 2 1 0 1 1 0 0 1 0 1 1 2 1)
box4=(0 1 0 2 1 1 2 1 1 0 1 1 1 2 2 2 0 1 1 1 2 0 2 1 0 0 1 0 1 1 1 2)
box5=(0 1 1 1 2 1 2 2 1 0 1 1 1 2 2 0 0 0 0 1 1 1 2 1 0 2 1 0 1 1 1 2)
box6=(0 1 1 1 1 2 2 1 1 0 1 1 1 2 2 1 0 1 1 0 1 1 2 1 0 1 1 0 1 1 1 2)
#所有其中方块的定义都放到box变量中
box=(${box0[@]} ${box1[@]} ${box2[@]} ${box3[@]} ${box4[@]} ${box5[@]} ${box6[@]})
#各种方块旋转后可能的样式数目
countBox=(1 2 2 2 4 4 4)
#各种方块再box数组中的偏移
offsetBox=(0 1 3 5 7 11 15)

#每提高一个速度级需要积累的分数
iScoreEachLevel=50        #be greater than 7

#运行时数据
sig=0                #接收到的signal
iScore=0        #总分
iLevel=0        #速度级
boxNew=()        #新下落的方块的位置定义
cBoxNew=0        #新下落的方块的颜色
iBoxNewType=0        #新下落的方块的种类
iBoxNewRotate=0        #新下落的方块的旋转角度
boxCur=()        #当前方块的位置定义
cBoxCur=0        #当前方块的颜色
iBoxCurType=0        #当前方块的种类
iBoxCurRotate=0        #当前方块的旋转角度
boxCurX=-1        #当前方块的x坐标位置
boxCurY=-1        #当前方块的y坐标位置
iMap=()                #背景方块图表

#初始化所有背景方块为-1, 表示没有方块
for ((i = 0; i < iTrayHeight * iTrayWidth; i++)); do iMap[$i]=-1; done

#接收输入的进程的主函数
function RunAsKeyReceiver()
{
        local pidDisplayer key aKey sig cESC sTTY

        pidDisplayer=$1
        aKey=(0 0 0)

        cESC=`echo -ne "\033"`
        cSpace=`echo -ne "\040"`

        #保存终端属性。在read -s读取终端键时，终端的属性会被暂时改变。
        #如果在read -s时程序被不幸杀掉，可能会导致终端混乱，
        #需要在程序退出时恢复终端属性。
        sTTY=`stty -g`

        #捕捉退出信号
        trap "MyExit;" INT TERM
        trap "MyExitNoSub;" $sigExit

        #隐藏光标
        echo -ne "\033[?25l"

        while :
        do
                #读取输入。注-s不回显，-n读到一个字符立即返回
                read -s -n 1 key

                aKey[0]=${aKey[1]}
                aKey[1]=${aKey[2]}
                aKey[2]=$key
                sig=0

                #判断输入了何种键
                if [[ $key == $cESC && ${aKey[1]} == $cESC ]]
                then
                        #ESC键
                        MyExit
                elif [[ ${aKey[0]} == $cESC && ${aKey[1]} == "[" ]]
                then
                        if [[ $key == "A" ]]; then sig=$sigRotate        #<向上键>
                        elif [[ $key == "B" ]]; then sig=$sigDown        #<向下键>
                        elif [[ $key == "D" ]]; then sig=$sigLeft        #<向左键>
                        elif [[ $key == "C" ]]; then sig=$sigRight        #<向右键>
                        fi
                elif [[ $key == "W" || $key == "w" ]]; then sig=$sigRotate        #W, w
                elif [[ $key == "S" || $key == "s" ]]; then sig=$sigDown        #S, s
                elif [[ $key == "A" || $key == "a" ]]; then sig=$sigLeft        #A, a
                elif [[ $key == "D" || $key == "d" ]]; then sig=$sigRight        #D, d
                elif [[ "[$key]" == "[]" ]]; then sig=$sigAllDown        #空格键
                elif [[ $key == "Q" || $key == "q" ]]                        #Q, q
                then
                        MyExit
                fi

                if [[ $sig != 0 ]]
                then
                        #向另一进程发送消息
                        kill -$sig $pidDisplayer
                fi
        done
}

#退出前的恢复
function MyExitNoSub()
{
        local y

        #恢复终端属性
        stty $sTTY
        ((y = iTop + iTrayHeight + 4))

        #显示光标
        echo -e "\033[?25h\033[${y};0H"
        exit
}

function MyExit()
{
        #通知显示进程需要退出
        kill -$sigExit $pidDisplayer

        MyExitNoSub
}

#处理显示和游戏流程的主函数
function RunAsDisplayer()
{
        local sigThis
        InitDraw

        #挂载各种信号的处理函数
        trap "sig=$sigRotate;" $sigRotate
        trap "sig=$sigLeft;" $sigLeft
        trap "sig=$sigRight;" $sigRight
        trap "sig=$sigDown;" $sigDown
        trap "sig=$sigAllDown;" $sigAllDown
        trap "ShowExit;" $sigExit

        while :
        do
                #根据当前的速度级iLevel不同，设定相应的循环的次数
                for ((i = 0; i < 21 - iLevel; i++))
                do
                        sleep 0.02
                        sigThis=$sig
                        sig=0

                        #根据sig变量判断是否接受到相应的信号
                        if ((sigThis == sigRotate)); then BoxRotate;        #旋转
                        elif ((sigThis == sigLeft)); then BoxLeft;        #左移一列
                        elif ((sigThis == sigRight)); then BoxRight;        #右移一列
                        elif ((sigThis == sigDown)); then BoxDown;        #下落一行
                        elif ((sigThis == sigAllDown)); then BoxAllDown;        #下落到底
                        fi
                done
                #kill -$sigDown $$
                BoxDown        #下落一行
        done
}

#BoxMove(y, x), 测试是否可以把移动中的方块移到(x, y)的位置, 返回0则可以, 1不可以
function BoxMove()
{
        local j i x y xTest yTest
        yTest=$1
        xTest=$2
        for ((j = 0; j < 8; j += 2))
        do
                ((i = j + 1))
                ((y = ${boxCur[$j]} + yTest))
                ((x = ${boxCur[$i]} + xTest))
                if (( y < 0 || y >= iTrayHeight || x < 0 || x >= iTrayWidth))
                then
                        #撞到墙壁了
                        return 1
                fi
                if ((${iMap[y * iTrayWidth + x]} != -1 ))
                then
                        #撞到其他已经存在的方块了
                        return 1
                fi
        done
        return 0;
}

#将当前移动中的方块放到背景方块中去,
#并计算新的分数和速度级。(即一次方块落到底部)
function Box2Map()
{
        local j i x y xp yp line

        #将当前移动中的方块放到背景方块中去
        for ((j = 0; j < 8; j += 2))
        do
                ((i = j + 1))
                ((y = ${boxCur[$j]} + boxCurY))
                ((x = ${boxCur[$i]} + boxCurX))
                ((i = y * iTrayWidth + x))
                iMap[$i]=$cBoxCur
        done

        #消去可被消去的行
        line=0
        for ((j = 0; j < iTrayWidth * iTrayHeight; j += iTrayWidth))
        do
                for ((i = j + iTrayWidth - 1; i >= j; i--))
                do
                        if ((${iMap[$i]} == -1)); then break; fi
                done
                if ((i >= j)); then continue; fi

                ((line++))
                for ((i = j - 1; i >= 0; i--))
                do
                        ((x = i + iTrayWidth))
                        iMap[$x]=${iMap[$i]}
                done
                for ((i = 0; i < iTrayWidth; i++))
                do
                        iMap[$i]=-1
                done
        done

        if ((line == 0)); then return; fi

        #根据消去的行数line计算分数和速度级
        ((x = iLeft + iTrayWidth * 2 + 7))
        ((y = iTop + 11))
        ((iScore += line * 2 - 1))
        #显示新的分数
        echo -ne "\033[1m\033[3${cScoreValue}m\033[${y};${x}H${iScore}         "
        if ((iScore % iScoreEachLevel < line * 2 - 1))
        then
                if ((iLevel < 20))
                then
                        ((iLevel++))
                        ((y = iTop + 14))
                        #显示新的速度级
                        echo -ne "\033[3${cScoreValue}m\033[${y};${x}H${iLevel}        "
                fi
        fi
        echo -ne "\033[0m"

        #重新显示背景方块
        for ((y = 0; y < iTrayHeight; y++))
        do
                ((yp = y + iTrayTop + 1))
                ((xp = iTrayLeft + 1))
                ((i = y * iTrayWidth))
                echo -ne "\033[${yp};${xp}H"
                for ((x = 0; x < iTrayWidth; x++))
                do
                        ((j = i + x))
                        if ((${iMap[$j]} == -1))
                        then
                                echo -ne "  "
                        else
                                echo -ne "\033[1m\033[7m\033[3${iMap[$j]}m\033[4${iMap[$j]}m[]\033[0m"
                        fi
                done
        done
}

#下落一行
function BoxDown()
{
        local y s
        ((y = boxCurY + 1))        #新的y坐标
        if BoxMove $y $boxCurX        #测试是否可以下落一行
        then
                s="`DrawCurBox 0`"        #将旧的方块抹去
                ((boxCurY = y))
                s="$s`DrawCurBox 1`"        #显示新的下落后方块
                echo -ne $s
        else
                #走到这儿, 如果不能下落了
                Box2Map                #将当前移动中的方块贴到背景方块中
                RandomBox        #产生新的方块
        fi
}

#左移一列
function BoxLeft()
{
        local x s
        ((x = boxCurX - 1))
        if BoxMove $boxCurY $x
        then
                s=`DrawCurBox 0`
                ((boxCurX = x))
                s=$s`DrawCurBox 1`
                echo -ne $s
        fi
}

#右移一列
function BoxRight()
{
        local x s
        ((x = boxCurX + 1))
        if BoxMove $boxCurY $x
        then
                s=`DrawCurBox 0`
                ((boxCurX = x))
                s=$s`DrawCurBox 1`
                echo -ne $s
        fi
}

#下落到底
function BoxAllDown()
{
        local k j i x y iDown s
        iDown=$iTrayHeight

        #计算一共需要下落多少行
        for ((j = 0; j < 8; j += 2))
        do
                ((i = j + 1))
                ((y = ${boxCur[$j]} + boxCurY))
                ((x = ${boxCur[$i]} + boxCurX))
                for ((k = y + 1; k < iTrayHeight; k++))
                do
                        ((i = k * iTrayWidth + x))
                        if (( ${iMap[$i]} != -1)); then break; fi
                done
                ((k -= y + 1))
                if (( $iDown > $k )); then iDown=$k; fi
        done

        s=`DrawCurBox 0`        #将旧的方块抹去
        ((boxCurY += iDown))
        s=$s`DrawCurBox 1`        #显示新的下落后的方块
        echo -ne $s
        Box2Map                #将当前移动中的方块贴到背景方块中
        RandomBox        #产生新的方块
}

#旋转方块
function BoxRotate()
{
        local iCount iTestRotate boxTest j i s
        iCount=${countBox[$iBoxCurType]}        #当前的方块经旋转可以产生的样式的数目

        #计算旋转后的新的样式
        ((iTestRotate = iBoxCurRotate + 1))
        if ((iTestRotate >= iCount))
        then
                ((iTestRotate = 0))
        fi

        #更新到新的样式, 保存老的样式(但不显示)
        for ((j = 0, i = (${offsetBox[$iBoxCurType]} + $iTestRotate) * 8; j < 8; j++, i++))
        do
                boxTest[$j]=${boxCur[$j]}
                boxCur[$j]=${box[$i]}
        done

        if BoxMove $boxCurY $boxCurX        #测试旋转后是否有空间放的下
        then
                #抹去旧的方块
                for ((j = 0; j < 8; j++))
                do
                        boxCur[$j]=${boxTest[$j]}
                done
                s=`DrawCurBox 0`

                #画上新的方块
                for ((j = 0, i = (${offsetBox[$iBoxCurType]} + $iTestRotate) * 8; j < 8; j++, i++))
                do
                        boxCur[$j]=${box[$i]}
                done
                s=$s`DrawCurBox 1`
                echo -ne $s
                iBoxCurRotate=$iTestRotate
        else
                #不能旋转，还是继续使用老的样式
                for ((j = 0; j < 8; j++))
                do
                        boxCur[$j]=${boxTest[$j]}
                done
        fi
}

#DrawCurBox(bDraw), 绘制当前移动中的方块, bDraw为1, 画上, bDraw为0, 抹去方块。
function DrawCurBox()
{
        local i j t bDraw sBox s
        bDraw=$1

        s=""
        if (( bDraw == 0 ))
        then
                sBox="\040\040"
        else
                sBox="[]"
                s=$s"\033[1m\033[7m\033[3${cBoxCur}m\033[4${cBoxCur}m"
        fi

        for ((j = 0; j < 8; j += 2))
        do
                ((i = iTrayTop + 1 + ${boxCur[$j]} + boxCurY))
                ((t = iTrayLeft + 1 + 2 * (boxCurX + ${boxCur[$j + 1]})))
                #\033[y;xH, 光标到(x, y)处
                s=$s"\033[${i};${t}H${sBox}"
        done
        s=$s"\033[0m"
        echo -n $s
}

#更新新的方块
function RandomBox()
{
        local i j t

        #更新当前移动的方块
        iBoxCurType=${iBoxNewType}
        iBoxCurRotate=${iBoxNewRotate}
        cBoxCur=${cBoxNew}
        for ((j = 0; j < ${#boxNew[@]}; j++))
        do
                boxCur[$j]=${boxNew[$j]}
        done

        #显示当前移动的方块
        if (( ${#boxCur[@]} == 8 ))
        then
                #计算当前方块该从顶端哪一行"冒"出来
                for ((j = 0, t = 4; j < 8; j += 2))
                do
                        if ((${boxCur[$j]} < t)); then t=${boxCur[$j]}; fi
                done
                ((boxCurY = -t))
                for ((j = 1, i = -4, t = 20; j < 8; j += 2))
                do
                        if ((${boxCur[$j]} > i)); then i=${boxCur[$j]}; fi
                        if ((${boxCur[$j]} < t)); then t=${boxCur[$j]}; fi
                done
                ((boxCurX = (iTrayWidth - 1 - i - t) / 2))

                #显示当前移动的方块
                echo -ne `DrawCurBox 1`

                #如果方块一出来就没处放，Game over!
                if ! BoxMove $boxCurY $boxCurX
                then
                        kill -$sigExit ${PPID}
                        ShowExit
                fi
        fi

        #清除右边预显示的方块
        for ((j = 0; j < 4; j++))
        do
                ((i = iTop + 1 + j))
                ((t = iLeft + 2 * iTrayWidth + 7))
                echo -ne "\033[${i};${t}H        "
        done

        #随机产生新的方块
        ((iBoxNewType = RANDOM % ${#offsetBox[@]}))
        ((iBoxNewRotate = RANDOM % ${countBox[$iBoxNewType]}))
        for ((j = 0, i = (${offsetBox[$iBoxNewType]} + $iBoxNewRotate) * 8; j < 8; j++, i++))
        do
                boxNew[$j]=${box[$i]};
        done

        ((cBoxNew = ${colorTable[RANDOM % ${#colorTable[@]}]}))

        #显示右边预显示的方块
        echo -ne "\033[1m\033[7m\033[3${cBoxNew}m\033[4${cBoxNew}m"
        for ((j = 0; j < 8; j += 2))
        do
                ((i = iTop + 1 + ${boxNew[$j]}))
                ((t = iLeft + 2 * iTrayWidth + 7 + 2 * ${boxNew[$j + 1]}))
                echo -ne "\033[${i};${t}H[]"
        done
        echo -ne "\033[0m"
}

#初始绘制
function InitDraw()
{
        clear
        RandomBox        #随机产生方块，这时右边预显示窗口中有方快了
        RandomBox        #再随机产生方块，右边预显示窗口中的方块被更新，原先的方块将开始下落
        local i t1 t2 t3

        #显示边框
        echo -ne "\033[1m"
        echo -ne "\033[3${cBorder}m\033[4${cBorder}m"

        ((t2 = iLeft + 1))
        ((t3 = iLeft + iTrayWidth * 2 + 3))
        for ((i = 0; i < iTrayHeight; i++))
        do
                ((t1 = i + iTop + 2))
                echo -ne "\033[${t1};${t2}H||"
                echo -ne "\033[${t1};${t3}H||"
        done

        ((t2 = iTop + iTrayHeight + 2))
        for ((i = 0; i < iTrayWidth + 2; i++))
        do
                ((t1 = i * 2 + iLeft + 1))
                echo -ne "\033[${iTrayTop};${t1}H=="
                echo -ne "\033[${t2};${t1}H=="
        done
        echo -ne "\033[0m"

        #显示"Score"和"Level"字样
        echo -ne "\033[1m"
        ((t1 = iLeft + iTrayWidth * 2 + 7))
        ((t2 = iTop + 10))
        echo -ne "\033[3${cScore}m\033[${t2};${t1}HScore"
        ((t2 = iTop + 11))
        echo -ne "\033[3${cScoreValue}m\033[${t2};${t1}H${iScore}"
        ((t2 = iTop + 13))
        echo -ne "\033[3${cScore}m\033[${t2};${t1}HLevel"
        ((t2 = iTop + 14))
        echo -ne "\033[3${cScoreValue}m\033[${t2};${t1}H${iLevel}"
        echo -ne "\033[0m"
}

#退出时显示GameOVer!
function ShowExit()
{
        local y
        ((y = iTrayHeight + iTrayTop + 3))
        echo -e "\033[${y};0HGameOver!\033[0m"
        exit
}

#显示用法.
function Usage
{
        cat << EOF
Usage: $APP_NAME
Start tetris game.

  -h, --help              display this help and exit
      --version           output version information and exit
EOF
}

#游戏主程序在这儿开始.
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
        Usage
elif [[ "$1" == "--version" ]]; then
        echo "$APP_NAME $APP_VERSION"
elif [[ "$1" == "--show" ]]; then
        #当发现具有参数--show时，运行显示函数
        RunAsDisplayer
else
        bash $0 --show&        #以参数--show将本程序再运行一遍
        RunAsKeyReceiver $!        #以上一行产生的进程的进程号作为参数
fi


#!/usr/bin/env bash
source "$(dirname $0)/_test_setup.sh"

cfg="../relay/config.yml"
creds="../relay/credentials.json"

# Relay files don't exist in a clean clone.
test ! -f $cfg
test ! -f $creds

# Running the install script adds them.
source relay-credentials.sh
test -f $cfg
test -f $creds
test "$(jq -r 'keys[2]' $creds)" = "secret_key"

# If the files exist we don't touch it.
echo GARBAGE > $cfg
echo MOAR GARBAGE > $creds
source relay-credentials.sh
test "$(cat $cfg)" = "GARBAGE"
test "$(cat $creds)" = "MOAR GARBAGE"

report_success


#!/bin/bash

module load sas/9.4

PROJ=/ufrc/barbazuk/lboat/T.lamottei_T.crocifolius/Complete_data_set/align_reads_for_samcompare/
LOGS=$PROJ/sas_data/logs
OUTPUT=$PROJ/sas_data/output
TMPDIR=/ufrc/barbazuk/lboat/T.lamottei_T.crocifolius/Complete_data_set/align_reads_for_samcompare/temp_files/commonID_hybrid_temp

## add commonID to parent sam files
sas -log $LOGS/add_commonID_to_hybrid_sam_files_HPC.log \
    -print $OUTPUT/add_commonID_to_hybrid_sam_files_HPC.prt \
    -work $TMPDIR \
    -sysin $PROJ/scripts/add_commonID_to_hybrid_sam_files_HPC.sas


<reponame>jmdaemon/chezmoi<gh_stars>0
#!/bin/bash

source /usr/share/nvm/nvm.sh
source /usr/share/nvm/bash_completion
source /usr/share/nvm/install-nvm-exec


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

ROOT_DIR=`pwd`

cd ${ROOT_DIR}/django_project
docker-compose down

cd ${ROOT_DIR}/postgres
docker-compose down


<gh_stars>10-100
bgbcc.bin -Fe../tst_jx2boot.bin e_bsr_start.S tk_chksane.S tk_multi.c -mBJX2F -Os -I.


#!/bin/bash
# /etc/rc.d/cloudprint
# Description: Starts the Google Cloud Print script on startup
# ----------------
#
### BEGIN INIT INFO
# Provides: Cloud-Print
# Required-Start: $cups $network $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start Google Cloud Print
### END INIT INFO

case $1 in
   start)
      echo -n "Starting Google Cloud Print: "
      CONF=/opt/etc/simplepvr.cfg /opt/bin/python2.6 /opt/share/simplepvr/python/simplepvr/
      sudo -u cloudprint /home/cloudprint/cloudprint/cloudprint.py -d -p /home/cloudprint/cloudprint.pid
   ;;
   stop)
      echo -n "Stopping Google Cloud Print: "
      kill `cat /home/cloudprint/cloudprint.pid`
   ;;
   restart)
      echo -n "Restarting Google Cloud Print: "
        $0 stop
        $0 start
   ;;
   *)
        echo "Usage: cloudprint {start|stop|restart}"
   ;;
esac


<reponame>plison/mosespy
#! /bin/bash

set -m # Enable Job Control

function usage()
{
cmnd=$(basename $0);
cat<<EOF

$cmnd - train and/or test a probabilistic latent semantic model

USAGE:
$cmnd [options]

TRAINING OPTIONS:

-c file     Collection of training documents e.g. 'gunzip -c docs.gz'
-d file     Dictionary file (default dictionary)
-f          Force to use existing dictionary
-m fle      Output model file e.g. model
-n count    Number of topics (default 100)
-i count    Number of training iterations (default 20)
-t folder   Temporary working directory (default ./stat_PID)
-p count    Prune words with counts < arg (default 2)
-k count    Number of processes (default 5)

-r file     Model output file in readable format
-s count    Put top arg frequent words in special topic 0
-l file     Log file (optional)
-v          Verbose
-h          Show this message

TESTING OPTIONS

-c file     Testing documents e.g. test
-d file     Dictionary file (default dictionary)
-m file     Model file
-n number   Number of topics (default 100)
-u file     Output document unigram distribution
-o file     Output document topic distributions
-i counts   Number of training iterations (default 20)
-t folder   Temporary working directory (default ./stat_PID)
-l file     Log file (optional)
-k count    Number of processes (default 5)
-v          Verbose
-h          Show this message

EOF
}

if [ ! $IRSTLM ]; then
echo "Set IRSTLM environment variable with path to irstlm"
exit 2
fi

#paths to scripts and commands in irstlm
scr=$IRSTLM/bin
bin=$IRSTLM/bin
gzip=`which gzip 2> /dev/null`;
gunzip=`which gunzip 2> /dev/null`;

#default parameters
tmpdir=stat_$$
data=""
topics=100
splits=5
iter=20
prunefreq=2
spectopics=0
logfile="/dev/null"
verbose=""
unigram=""
outtopic=""
dict="dictionary"
forcedict=""
model=""
txtfile="/dev/null"

while getopts "hvfc:m:r:k:i:n:t:d:p:s:l:u:o:" OPTION
do
case $OPTION in
h)
usage
exit 0
;;
v)
verbose="--verbose";
;;
c)
data=$OPTARG
;;
m)
model=$OPTARG
;;
r)
txtfile=$OPTARG
;;
k)
splits=$OPTARG
;;
i)
iter=$OPTARG
;;
t)
tmpdir=$OPTARG
;;
d)
dict=$OPTARG
;;
f)
forcedict="TRUE"
;;
p)
prunefreq=$OPTARG
;;
s)
spectopics=$OPTARG
;;
n)
topics=$OPTARG
;;
l)
logfile=$OPTARG
;;
u)
unigram=$OPTARG
;;
o)
outtopic=$OPTARG
;;

?)
usage
exit 1
;;
esac
done

if [ $verbose ]; then
echo data=$data  model=$model  topics=$topics iter=$iter dict=$dict
logfile="/dev/stdout"
fi

if [ "$unigram" == "" -a "$outtopic" == "" ]; then

#training branch

if [ ! "$data" -o  ! "$model" ]; then
usage
exit 1
fi

if [ -e $logfile -a $logfile != "/dev/null" -a $logfile != "/dev/stdout" ]; then
echo "Logfile $logfile already exists! either remove or rename it."
exit 1
fi

if [ -e $model ]; then
echo "Output file $model already exists! either remove or rename it." >> $logfile 2>&1
exit 1
fi

if [ -e $txtfile -a $txtfile != "/dev/null" ]; then
echo "Output file $txtfile already exists! either remove or rename it." >> $logfile 2>&1
exit 1
fi

if [ -e $logfile -a $logfile != "/dev/null" -a $logfile != "/dev/stdout" ]; then
echo "Logfile $logfile already exists! either remove or rename it." >> $logfile 2>&1
exit 1
fi

#if [ ! -e "$data" ]; then
#echo "Cannot find data $data." >> $logfile 2>&1
#exit 1;
#fi

if [ ! -e $dict ]; then
echo extract dictionary >> $logfile
$bin/dict -i="$data" -o=$dict -PruneFreq=$prunefreq -f=y >> $logfile 2>&1
if [ `head -n 1 $dict| cut -d " " -f 3` -lt 10 ]; then
echo "Dictionary contains errors"
exit 2;
fi
else
echo "Warning: dictionary file already exists." >> $logfile 2>&1
if [ $forcedict ]; then
echo "Warning: authorization to use it." >> $logfile 2>&1
else
echo "No authorization to use it (see option -f)." >> $logfile 2>&1
exit 1
fi
fi

#check tmpdir
tmpdir_created=0;
if [ ! -d $tmpdir ]; then
echo "Creating temporary working directory $tmpdir" >> $logfile 2>&1
mkdir -p $tmpdir;
tmpdir_created=1;
else
echo "Cleaning temporary directory $tmpdir" >> $logfile 2>&1
rm $tmpdir/* 2> /dev/null
if [ $? != 0 ]; then
echo "Warning: some temporary files could not be removed" >> $logfile 2>&1
fi
fi

#####
echo split documents >> $logfile 2>&1
$bin/plsa -c="$data" -d=$dict -b=$tmpdir/data -sd=$splits >> $logfile 2>&1

machine=`uname -s`
if [ $machine == "Darwin" ] ; then
splitlist=`jot - 1 $splits`
iterlist=`jot - 1 $iter`
else
splitlist=`seq  1 1 $splits`
iterlist=`seq 1 1 $iter`
fi

#rm $tmpdir/Tlist
for sp in $splitlist ; do echo $tmpdir/data.T.$sp >> $tmpdir/Tlist 2>&1; done
#rm $model
for it in $iterlist ; do
echo "ITERATION $it" >> $logfile 2>&1
for sp in $splitlist ; do
(date; echo it $it split $sp )>> $logfile 2>&1
$bin/plsa -c=$tmpdir/data.$sp -d=$dict -st=$spectopics -hf=$tmpdir/data.H.$sp -tf=$tmpdir/data.T.$sp -wf=$model -m=$model -t=$topics -it=1 -tit=$it >> $logfile 2>&1 &
done
while [ 1 ]; do fg 2> /dev/null; [ $? == 1 ] && break; done

(date; echo recombination ) >> $logfile 2>&1

$bin/plsa -ct=$tmpdir/Tlist -c="$data" -d=$dict -hf=$tmpdir/data.H -m=$model -t=$topics -it=1 -txt=$txtfile >> $logfile 2>&1

done
(date; echo End of training) >> $logfile 2>&1

echo "Cleaning temporary directory $tmpdir" >> $logfile 2>&1
rm $tmpdir/* 2> /dev/null

if [ $tmpdir_created -eq 1 ]; then
echo "Removing temporary directory $tmpdir" >> $logfile 2>&1
rmdir $tmpdir 2> /dev/null
if [ $? != 0 ]; then
echo "Warning: the temporary directory could not be removed." >> $logfile 2>&1
fi
fi
exit 0

#testing branch
else

if [ ! $model -o ! -e $model ]; then
echo "Need to specify existing model" >> $logfile 2>&1
exit 1;
fi

if [ ! $dict  -o ! -e $dict  ]; then
echo "Need to specify dictionary file of the model" >> $logfile 2>&1
exit 1;
fi

if [ $unigram ]; then
$bin/plsa -inf="$data" -d=$dict -m=$model -hf=hfff.out$$ -t=$topics -it=$iter -wof=$unigram >> $logfile 2>&1
rm hfff.out$$

else  #topic distribution

#check tmpdir
tmpdir_created=0;
if [ ! -d $tmpdir ]; then
echo "Creating temporary working directory $tmpdir" >> $logfile 2>&1
mkdir -p $tmpdir;
tmpdir_created=1;
else
echo "Cleaning temporary directory $tmpdir" >> $logfile 2>&1
rm $tmpdir/* 2> /dev/null
if [ $? != 0 ]; then
echo "Warning: some temporary files could not be removed" >> $logfile 2>&1
fi
fi

#####
echo split documents >> $logfile 2>&1
$bin/plsa -c="$data" -d=$dict -b=$tmpdir/data -sd=$splits >> $logfile 2>&1

machine=`uname -s`
if [ $machine == "Darwin" ] ; then
splitlist=`jot - 1 $splits`
else
splitlist=`seq 1 1 $splits`
fi

#rm $tmpdir/Tlist
for sp in $splitlist ; do echo $tmpdir/data.T.$sp >> $tmpdir/Tlist 2>&1; done
#rm $model

for sp in $splitlist ; do
(date; echo split $sp )>> $logfile 2>&1

$bin/plsa -inf=$tmpdir/data.$sp -d=$dict -hf=$tmpdir/data.H.$sp -m=$model -t=$topics -it=$iter -tof=$tmpdir/topic.$sp >> $logfile 2>&1 &

done
while [ 1 ]; do fg 2> /dev/null; [ $? == 1 ] && break; done

(date; echo recombination ) >> $logfile 2>&1

echo > $outtopic
for sp in $splitlist ; do  #makes sure that 1 < 2 < ... < 11 ...
cat $tmpdir/topic.$sp >> $outtopic
done

(date; echo End of training) >> $logfile 2>&1

echo "Cleaning temporary directory $tmpdir" >> $logfile 2>&1
rm $tmpdir/* 2> /dev/null

if [ $tmpdir_created -eq 1 ]; then
echo "Removing temporary directory $tmpdir" >> $logfile 2>&1
rmdir $tmpdir 2> /dev/null
if [ $? != 0 ]; then
echo "Warning: the temporary directory could not be removed." >> $logfile 2>&1
fi
fi

fi
fi

exit 0


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

echo
echo "#####################################################"
echo "Thank you for using the outlook-monitor microservice "
echo "--"
echo "This script will collect environment variables"
echo "for the main.py script"
echo "######################################################"
echo

echo "Press Enter to continue..."
read confirm

echo "Please enter the Active Directory TENANT ID : "
read TENANT

echo "Please enter the Graph Application CLIENT ID : "
read CLIENT_ID

echo "Please enter the Graph Application CLIENT SECRET : "
read CLIENT_SECRET

echo "Please enter the MEDIATOR Application IP ADDRESS : "
read MEDIATOR_IP

echo "Please enter the MEDIATOR Application PORT : "
read MEDIATOR_PORT

export TENANT
export CLIENT_ID
export CLIENT_SECRET
export MEDIATOR_IP
export MEDIATOR_PORT

python main.py


<gh_stars>1-10
#!/bin/sh
#
# Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html

#
# OpenSSL external testing using the GOST engine
#
set -e

O_EXE=`pwd`/$BLDTOP/apps
O_BINC=`pwd`/$BLDTOP/include
O_SINC=`pwd`/$SRCTOP/include
O_LIB=`pwd`/$BLDTOP

export PATH=$O_EXE:$PATH
export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH
export OPENSSL_ROOT_DIR=$O_LIB

# Check/Set openssl version
OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`

echo "------------------------------------------------------------------"
echo "Testing OpenSSL using GOST engine:"
echo "   CWD:                $PWD"
echo "   SRCTOP:             $SRCTOP"
echo "   BLDTOP:             $BLDTOP"
echo "   OPENSSL_ROOT_DIR:   $OPENSSL_ROOT_DIR"
echo "   OpenSSL version:    $OPENSSL_VERSION"
echo "------------------------------------------------------------------"

cd $SRCTOP/gost-engine
rm -rf build
mkdir -p build
cd build
cmake ..
make
CTEST_OUTPUT_ON_FAILURE=1 HARNESS_OSSL_PREFIX='' OPENSSL_ENGINES=$OPENSSL_ROOT_DIR/gost-engine/build/bin make test

exit 0


<filename>2 - conditional-statements/ifelse.sh
#!/bin/bash
# Simple example of if then else and nested if statements

clear

echo "Enter a number between 1 and 3"
read VALUE

#if [ "$VALUE" -eq "1" ] 2>/dev/null || [ "$VALUE" -eq "2" ] 2>/dev/null || [ "$VALUE" -eq "3" ] 2>/dev/null; then
if [ "$VALUE" -eq "1" ] 2>/dev/null; then
    echo "You entered #1"
elif [ "$VALUE" -eq "2" ] 2>/dev/null; then
    echo "You entered #2"
elif [ "$VALUE" -eq "3" ] 2>/dev/null; then
    echo "You entered #3"
else
    echo "Directions were not followed"
fi


<gh_stars>1-10
#!/bin/bash
# Demyx
# https://demyx.sh
set -euo pipefail

# Support for old variables
[[ -n "${WORDPRESS_DB_HOST:-}" ]] && DEMYX_DB_HOST="$WORDPRESS_DB_HOST"
[[ -n "${WORDPRESS_DB_NAME:-}" ]] && DEMYX_DB_NAME="$WORDPRESS_DB_NAME"
[[ -n "${WORDPRESS_DB_PASSWORD:-}" ]] && DEMYX_DB_PASSWORD="$WORDPRESS_DB_PASSWORD"
[[ -n "${WORDPRESS_DB_USER:-}" ]] && DEMYX_DB_USER="$WORDPRESS_DB_USER"
[[ -n "${WORDPRESS_DOMAIN:-}" ]] && DEMYX_DOMAIN="$WORDPRESS_DOMAIN"
[[ -n "${WORDPRESS_SSL:-}" ]] && DEMYX_SSL="$WORDPRESS_SSL"
# Define variables
DEMYX_ENV="$DEMYX"/.env
DEMYX_PROTO="http://$DEMYX_DOMAIN"
[[ "$DEMYX_SSL" = true ]] && DEMYX_PROTO="https://$DEMYX_DOMAIN"

if [[ ! -d "$DEMYX"/web ]]; then
    /bin/echo "[demyx] Bedrock is missing, copying files now ..."
    /usr/bin/tar -xzf "$DEMYX_CONFIG"/bedrock.tgz -C "$DEMYX"
fi

if [[ -n "$(/bin/grep example.com "$DEMYX_ENV" || true)" ]]; then
    /bin/echo "[demyx] Configuring Bedrock .env file ..."
    /bin/sed -i "s|WP_HOME=.*|WP_HOME=$DEMYX_PROTO|g" "$DEMYX_ENV"
    /bin/sed -i "s|database_name|$DEMYX_DB_NAME|g" "$DEMYX_ENV"
    /bin/sed -i "s|database_user|$DEMYX_DB_USER|g" "$DEMYX_ENV"
    /bin/sed -i "s|database_password|$DEMYX_DB_PASSWORD|g" "$DEMYX_ENV"
    /bin/sed -i "s|# DB_HOST='localhost'|DB_HOST='$DEMYX_DB_HOST'|g" "$DEMYX_ENV"
    /bin/sed -i "s|WP_ENV=.*|WP_ENV=production|g" "$DEMYX_ENV"
    SALT="$(/usr/bin/wget -qO- https://api.wordpress.org/secret-key/1.1/salt/ | /bin/sed "s|define('||g" | /bin/sed "s|',|=|g" | /bin/sed "s| ||g" | /bin/sed "s|);||g")"
    /usr/bin/printf '%s\n' "g/generateme/d" a "$SALT" . w | /bin/ed -s "$DEMYX_ENV"
fi


<reponame>ga4gh/ismb-2022-fasp-starter-kit
#!/bin/bash
#SBATCH --job-name=JobName
#SBATCH --mail-type=END,FAIL
#SBATCH --mail-user=<EMAIL>
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --time=00:59:00
#SBATCH --output=JobName.%j.log
#SBATCH --error=JobName.%J.err

echo "CRAM download script started"
N_TOTAL="200"
START="$1"
LENGTH="$2"
TAIL=`expr ${N_TOTAL} - ${START}`
echo "Start: ${START}, Length: ${LENGTH}"

cut -f1 1000genomes.low_coverage.GRCh38DH.alignment.index | tail -${TAIL} | head -${LENGTH} | while read f; do wget $f -P ./cram/; wget $f.crai -P ./cram/; echo $f; done


<reponame>dntosas/cilium<filename>images/cilium/hubble-version.sh
# Code generated by images/scripts/update-hubble-version.sh; DO NOT EDIT.
hubble_version="v0.8.0"
declare -A hubble_sha256
hubble_sha256[amd64]="65a0835c27dcd43eda155ea53098962e87522245315f77f9e8aa9a0f9f75187d"
hubble_sha256[arm64]="82cf90dbb440456e774fdca9764a62623173c3d181f5c538605cdcf18d1cd3bf"


#!/bin/bash

java -Dwebdriver.gecko.driver=chromedriver -jar selenium-server-standalone-3.141.59.jar -role node -nodeConfig ~/selenium/chrome.json > /dev/null 2>&1 &
java -Dwebdriver.gecko.driver=geckodriver -jar selenium-server-standalone-3.141.59.jar -role node -nodeConfig ~/selenium/firefox.json > /dev/null 2>&1 &


<reponame>TheBeyondGroup/shopkeeper
#!/usr/bin/env bash

yarn clean
./node_modules/.bin/tsc
chmod +x dist/src/cli/*


#!/bin/bash

CACHE_SIZE=$1
LINE_SIZE=64
ASSOCIATIVITY=1
RW_PORTS=$2
EXCL_READ_PORTS=0
EXCL_WRITE_PORTS=0
SINGLE_ENDED_READ_PORTS=0
SEARCH_PORTS=0
BANKS=1
TECH_NODE=45
OUTPUT_WIDTH=512
SPECIFIC_TAG=0
TAG_WIDTH=0
ACCESS_MODE=2
CACHE=0
MAIN_MEM=0
OBJ_FUNC_DELAY=0
OBJ_FUNC_DYNAMIC_POWER=0
OBJ_FUNC_LEAKAGE_POWER=100
OBJ_FUNC_CYCLE_TIME=0
OBJ_FUNC_AREA=0
DEV_FUNC_DELAY=20
DEV_FUNC_DYNAMIC_POWER=100000
DEV_FUNC_LEAKAGE_POWER=100000
DEV_FUNC_AREA=1000000
DEV_FUNC_CYCLE_TIME=1000000
ED_ED2_NONE=2
TEMP=300
WT=0
DATA_ARR_RAM_CELL_TECH_FLAVOR_IN=0
DATA_ARR_PERI_GLOBAL_TECH_FLAVOR_IN=0
TAG_ARR_RAM_CELL_TECH_FLAVOR_IN=0
TAG_ARR_PERI_GLOBAL_TECH_FLAVOR_IN=0
INTERCONNECT_PROJECTION_TYPE_IN=1
WIRE_INSIDE_MAT_TYPE_IN=1
WIRE_OUTSIDE_MAT_TYPE_IN=1
REPEATERS_IN_HTREE_SEGMENTS_IN=1
VERTICAL_HTREE_WIRES_OVER_THE_ARRAY_IN=0
BROADCAST_ADDR_DATAIN_OVER_VERTICAL_HTREES_IN=0
PAGE_SIZE_BITS_IN=0
BURST_LENGTH_IN=8
INTERNAL_PREFETCH_WIDTH_IN=8
FORCE_WIRETYPE=1
WIRETYPE=30
FORCE_CONFIG=0
NDWL=1
NDBL=1
NSPD=0
NDCM=1
NDSAM1=0
NDSAM2=0
ECC=0

cd $M5_PATH/ext/mcpat/cacti

./cacti $CACHE_SIZE \
$LINE_SIZE \
$ASSOCIATIVITY \
$RW_PORTS \
$EXCL_READ_PORTS \
$EXCL_WRITE_PORTS \
$SINGLE_ENDED_READ_PORTS \
$SEARCH_PORTS \
$BANKS \
$TECH_NODE \
$OUTPUT_WIDTH \
$SPECIFIC_TAG \
$TAG_WIDTH \
$ACCESS_MODE \
$CACHE \
$MAIN_MEM \
$OBJ_FUNC_DELAY \
$OBJ_FUNC_DYNAMIC_POWER \
$OBJ_FUNC_LEAKAGE_POWER \
$OBJ_FUNC_CYCLE_TIME \
$OBJ_FUNC_AREA \
$DEV_FUNC_DELAY \
$DEV_FUNC_DYNAMIC_POWER \
$DEV_FUNC_LEAKAGE_POWER \
$DEV_FUNC_AREA \
$DEV_FUNC_CYCLE_TIME \
$ED_ED2_NONE \
$TEMP \
$WT \
$DATA_ARR_RAM_CELL_TECH_FLAVOR_IN \
$DATA_ARR_PERI_GLOBAL_TECH_FLAVOR_IN \
$TAG_ARR_RAM_CELL_TECH_FLAVOR_IN \
$TAG_ARR_PERI_GLOBAL_TECH_FLAVOR_IN \
$INTERCONNECT_PROJECTION_TYPE_IN \
$WIRE_INSIDE_MAT_TYPE_IN \
$WIRE_OUTSIDE_MAT_TYPE_IN \
$REPEATERS_IN_HTREE_SEGMENTS_IN \
$VERTICAL_HTREE_WIRES_OVER_THE_ARRAY_IN \
$BROADCAST_ADDR_DATAIN_OVER_VERTICAL_HTREES_IN \
$PAGE_SIZE_BITS_IN \
$BURST_LENGTH_IN \
$INTERNAL_PREFETCH_WIDTH_IN \
$FORCE_WIRETYPE \
$WIRETYPE \
$FORCE_CONFIG \
$NDWL \
$NDBL \
$NSPD \
$NDCM \
$NDSAM1 \
$NDSAM2 \
$ECC

cd $M5_PATH/cacti-SALAM


<reponame>dinoboff/git-changelog-angular
#!/usr/bin/env bash

clear
BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
REMOTE_BRANCH=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD@{upstream})

git fetch
DIFF_COUNT=$(git rev-list --count ${BRANCH}...${REMOTE_BRANCH})

if [ $DIFF_COUNT != 0 ]; then
    echo "ERROR: ${BRANCH} is out of date with ${REMOTE_BRANCH}!"
    git rev-list --oneline ${BRANCH}...${REMOTE_BRANCH}
    exit 1
fi

FILE="draft.md"

echo "Generating change log..."
echo
git changelog HEAD > "$FILE"
cat "$FILE"

VERSION=$(head -n 1 "$FILE")

echo "Bumping package version..."
if npm version "$VERSION"; then
    echo "Version set to ${VERSION}."
else
    echo "ERROR: failed to update version to ${VERSION}!"
    exit 1
fi

echo "Pushing changes..."
if git push && git push --tags; then
    echo "New tag sent to origin"
else
    echo "ERROR: Failed to update origin!"
    exit 1
fi

TAG="v${VERSION}"
REV="${TAG}^{commit}"

echo "Checking ci status..."

hub ci-status -v "$REV"
while [ $? -ne 0 ]; do
    echo 'retrying in 10s...'
    sleep 10s
    hub ci-status "$REV"
done

echo
read -r -p "Publish package? [y/N] " response

case "$response" in

    [yY][eE][sS]|[yY])
        npm publish
        hub release create --draft --file="$FILE" --browse "$TAG"
        ;;

    *)
        echo
        echo "HEAD and tags still need  to be updated."
        echo "${TAG} is not yet published to npm."
        echo
        ;;

esac


<filename>scripts/test.sh
python manage.py migrate
python manage.py collectstatic --noinput
python manage.py test
cd frontend
npm run test


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

set -euo pipefail
IFS=$'\n\t'

echo "Checking for unchecked errors."
errcheck $(go list ./...)

echo "Linting code."
test -z "$(golint ./... | grep -v "^vendor" | tee /dev/stderr)"

echo "Examining source code against code defect."
go vet -shadow $(go list ./...)

echo "Checking if code can be simplified or can be improved."
megacheck ./...

echo "Running tests (may take a while)."
go test $(go list ./...) -race


#!/usr/bin/env bash
set -eou pipefail
set -x
source ./scripts/variables.sh

PGPASSWORD=$(pgpass) psql -w -v sslmode=require -h $(pghost) -U $(pguser) $(dbname) -f scripts/tailwind.sql


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

export OUTDIR=.
export K1TOOLS_DIR="/usr/local/k1tools"

#
# Runs a multibinary file using a single IO Cluster.
#
function run1
{
	local multibin=$1
	local bin=$2
	local args=$3

	$K1TOOLS_DIR/bin/k1-jtag-runner     \
		--multibinary=$OUTDIR/$multibin \
		--exec-multibin=IODDR0:$bin     \
		-- $args

	local ret=$?
	if [ $ret == "0" ]
	then
		printf "[nanvix][test] %-30s \e[32m%s\e[0m\n" "$multibin" "passed"
	else
		printf "[nanvix][test] %-30s \e[91m%s\e[0m\n" "$multibin" "FAILED"
	fi
}

#
# Runs a multibinary file using two IO Clusters.
#
function run2
{
	local multibin=$1
	local bin1=$2
	local args=$3
	local bin2="/spawner1"

	$K1TOOLS_DIR/bin/k1-jtag-runner     \
		--multibinary=$OUTDIR/$multibin \
		--exec-multibin=IODDR0:$bin1    \
		--exec-multibin=IODDR1:$bin2    \
		-- $args

	local ret=$?
	if [ $ret == "0" ]
	then
		printf "[nanvix][test] %-30s \e[32m%s\e[0m\n" "$multibin" "passed"
	else
		printf "[nanvix][test] %-30s \e[91m%s\e[0m\n" "$multibin" "FAILED"
	fi
}

function build1
{
	local bindir=$1
	local bootbin=$2
	local nodebin=$3
	local multibin=$4

	$K1TOOLS_DIR/bin/k1-create-multibinary -f \
		--remove-prefix $bindir               \
		--boot $bootbin                       \
		--clusters $nodebin                   \
		-T $multibin
}

function build2
{
	local bindir=$1
	local bootbin=$2
	local nodebin=$3
	local multibin=$4
	local iobin=$1/spawner1

	$K1TOOLS_DIR/bin/k1-create-multibinary -f \
		--remove-prefix $bindir               \
		--boot $bootbin                       \
		--ios $iobin                          \
		--clusters $nodebin                   \
		-T $multibin
}


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

. ./setenv

. ./removeDatFiles

C_BIND=`uname -n`
C_PORT="1528"
S_PATH=$S_HOME/product-gfxd/bin

#echo "exporting data"
$S_PATH/gfxd run -file=export.sql -client-port=$C_PORT -client-bind-address=$C_BIND


#!/usr/bin/env bats

load test_helper

#
# Parsing
#
@test "Parses identities without error" {
   move_to_random_repo
   run git identify

   [ "$status" -eq 0 ]
}

# TODO: This probably shouldn't work like this..
@test "Doesn't throw if an identity is unfinished but end of file" {
  create_identities_file "$(cat <<EOF
[identity:test]
  name = <NAME>
EOF)"

  move_to_random_repo
  run git identify

  [ "$status" -eq 0 ]
}

@test "knows when an identity is incomplete and throws if new identity started" {
  create_identities_file "$(cat <<EOF
[identity:test2]

[identity:test]
  name = <NAME>
EOF)"

  move_to_random_repo
  run git identify

  [ "$status" -eq 1 ]
}

@test "errors if an identity decleration is left blank" {
  create_identities_file "$(cat <<EOF
[identity:test2]

[identity:test]
  name = <NAME>
EOF)"

  move_to_random_repo
  run git identify

  [ "$status" -eq 1 ]
  # [[ "$output" =~ "Malformed .git_identities file" ]
}

@test "It strips whitespace" {
  create_identities_file "$(cat <<EOF
    [identity:test]
name=            <NAME>
        email     = <EMAIL>
EOF)"

  move_to_random_repo
  run git identify

  [ "$status" -eq 0 ]
}

@test "Doesn't care when an identity has no rules" {
  create_identities_file ""
  move_to_random_repo
  run git identify

  [ "$status" -eq 0 ]
}

#
# Matching
#
@test "Works for both identities" {
  create_git_repo "test"
  append_identity_rule "work" "test"
  run git identify

  [ "$status" -eq 0 ]
  [[ "$output" =~ "<<EMAIL>>" ]]
}

@test "Works for globs in pathnames" {
  # TODO write this test
  # create_git_repo "test"
  # append_tilde_identity_rule "personal" "test"
  # run git identify
  # debug_test

  # [ "$status" -eq 0 ]
  # [[ "$output" =~ "<<EMAIL>>" ]]
}


seed=0
restore_epoch=10
exp_config=exp2
test_batch_size=100
mode=eval
zeropadded_epoch=`printf %05d $restore_epoch`

visualize_data_indexes=(0 1 2 3 4 5 6 7 8 9)

rootdir="$(echo $PWD)"
resultdir=$rootdir/data/result/

echo "Performing analysis on exp2"

for data_name in self_stay_other_random grid; do

    cd $rootdir

    if [ $data_name = "self_stay_other_random" ]; then
        save_img='--save_vision_img --img_ext png'
    else
        save_img=''
    fi

    python3 test.py \
        --exp_config $exp_config \
        --seed $seed \
        --cudnn_deterministic \
        --test_epoch $restore_epoch \
        --test_data_name $data_name \
        --test_batch_size $test_batch_size \
        --save_targets position vision \
        --data_load_memory \
        --test_modes $mode \
        $save_img

    saveddir=$resultdir/$exp_config/$seed/test/$data_name/save
    datadir=$rootdir/data/data/$data_name

    cd $saveddir

    ln -s $rootdir/analyze ./
    ln -s $datadir/data.h5 ./

    if [ $data_name = "grid" ]; then

        python3 analyze/analyze_vpt.py --epoch $restore_epoch --mode $mode --margin 1 --self_str "a1" --other_str "a2" --save_vision

    else

        for i in "${visualize_data_indexes[@]}"; do

            python3 analyze/record.py \
                --epoch $restore_epoch \
                --mode $mode \
                --idx $i
        done

        for dir in record/overview self_vision other_vision; do

            cd $saveddir/$zeropadded_epoch/$mode
            cd $dir

            ln -s $rootdir/analyze/create_gif.py ./

            if [ $dir = "record/overview" ]; then
                gif_targets="input"
            elif [ $dir = "self_vision" ]; then
                gif_targets="input reconstruction"
            fi

            for i in "${visualize_data_indexes[@]}"; do

                python3 create_gif.py --idx $i --targets $gif_targets

            done

        done

    fi

done

echo "Done."


#!/bin/bash

ROOT="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${ROOT}"

docker build --rm -t portland "$ROOT/docker/development"
#docker run --rm -it -u `id -u` -v /var/run/docker.sock:/var/run/docker.sock -p 3000:3000 -p 3001:3001 -v "$ROOT":/app -w /app portland "$@"
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -p 8000:80 -v "$ROOT":/app -w /app --name=portland portland "$@"


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

set -e
cat /dev/null > coverage.txt

for dir in $(go list -f '{{.ImportPath}}={{join .TestGoFiles ","}}' ./...);do
    array=(${dir//=/ })
    if [ -n "${array[1]}" ]; then
        go test -short -v -coverprofile=coverage.out -covermode=count "${array[0]}"
        courtney -l=coverage.out -o=profile.out
        if [ -f profile.out ]; then
            cat profile.out >> coverage.txt
            rm profile.out coverage.out
        fi
    fi
done


<reponame>findstr/cardhelper<filename>server/start.sh
#!/bin/bash
cd ../
./silly/silly server/helperd.conf
cd -


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

#if test $# != 0
#if test "$#" != 0
if [ $# != 0 ];
then
	echo "arg num is" $#
else
	echo "no argment !"
fi


#!/bin/sh

./login.sh foo df89gy9Qw
curl -s -F messageContents=@<EMAIL> -b cookies.txt --insecure https://localhost:8080/newmessage/1_0
time curl -s -L -b cookies.txt --insecure https://localhost:8080/thread/1_0?suppressTimestamp=true > /dev/null


#!/usr/bin/env bash
# Script to simplify local development and debugging.
# Usage:
#      $ source setup_dev_env.sh

export PYTHONPATH=${PWD}/src:${PYTHONPATH}

docker build -t quantumleap .

source deps.env

# Aliasing so that notifications from orion container reach dev localhost
LH=192.0.0.1
sudo ifconfig lo0 alias $LH

export ORION_HOST=$LH
export MONGO_HOST=$LH

export QL_HOST=$LH
export CRATE_HOST=$LH
export INFLUX_HOST=$LH
export RETHINK_HOST=$LH

export REDIS_HOST=$LH

pipenv shell


test_container_devices_nic_bridged_acl() {
  ensure_import_testimage
  ensure_has_localhost_remote "${LXD_ADDR}"

  firewallDriver=$(lxc info | awk -F ":" '/firewall:/{gsub(/ /, "", $0); print $2}')

  if [ "$firewallDriver" != "xtables" ] && [ "$firewallDriver" != "nftables" ]; then
    echo "Unrecognised firewall driver: ${firewallDriver}"
    false
  fi

  ctPrefix="nt$$"
  brName="lxdt$$"

  # Standard bridge.
  lxc network create "${brName}" \
        ipv6.dhcp.stateful=true \
        ipv4.address=192.0.2.1/24 \
        ipv6.address=2001:db8::1/64

  # Create empty ACL and apply to network.
  lxc network acl create "${brName}A"
  lxc network set "${brName}" security.acls="${brName}A"

  # Check ACL jump rules, and chain with default reject rules created.
  if [ "$firewallDriver" = "xtables" ]; then
      iptables -S | grep -c "\-j lxd_acl_${brName}" | grep 4
      iptables -S "lxd_acl_${brName}" | grep -c "\-j REJECT" | grep 2
  else
      nft -nn list chain inet lxd "aclin.${brName}" | grep -c "jump acl.${brName}" | grep 1
      nft -nn list chain inet lxd "aclout.${brName}" | grep -c "jump acl.${brName}" | grep 1
      nft -nn list chain inet lxd "aclfwd.${brName}" | grep -c "jump acl.${brName}" | grep 2
      nft -nn list chain inet lxd "acl.${brName}" | grep -c "reject" | grep 2
  fi

  # Unset ACLs and check the firewall config is cleaned up.
  lxc network unset "${brName}" security.acls
  if [ "$firewallDriver" = "xtables" ]; then
      ! iptables -S | grep "\-j lxd_acl_${brName}" || false
      ! iptables -S "lxd_acl_${brName}" || false
  else
      ! nft -nn list chain inet lxd "aclin.${brName}" || false
      ! nft -nn list chain inet lxd "aclout.${brName}" || false
      ! nft -nn list chain inet lxd "aclfwd.${brName}" || false
      ! nft -nn list chain inet lxd "acl.${brName}" || false
  fi

  # Set ACLs, then delete network and check the firewall config is cleaned up.
  lxc network set "${brName}" security.acls="${brName}A"

  # Check ACL jump rules, and chain with default reject rules created.
  if [ "$firewallDriver" = "xtables" ]; then
      iptables -S | grep -c "\-j lxd_acl_${brName}" | grep 4
      iptables -S "lxd_acl_${brName}" | grep -c "\-j REJECT" | grep 2
  else
      nft -nn list chain inet lxd "aclin.${brName}" | grep -c "jump acl.${brName}" | grep 1
      nft -nn list chain inet lxd "aclout.${brName}" | grep -c "jump acl.${brName}" | grep 1
      nft -nn list chain inet lxd "aclfwd.${brName}" | grep -c "jump acl.${brName}" | grep 2
      nft -nn list chain inet lxd "acl.${brName}" | grep -c "reject" | grep 2
  fi

  # Delete network and check the firewall config is cleaned up.
  lxc network delete "${brName}"
  if [ "$firewallDriver" = "xtables" ]; then
      ! iptables -S | grep "\-j lxd_acl_${brName}" || false
      ! iptables -S "lxd_acl_${brName}" || false
  else
      ! nft -nn list chain inet lxd "aclin.${brName}" || false
      ! nft -nn list chain inet lxd "aclout.${brName}" || false
      ! nft -nn list chain inet lxd "aclfwd.${brName}" || false
      ! nft -nn list chain inet lxd "acl.${brName}" || false
  fi

  # Create network and specify ACL at create time.
  lxc network create "${brName}" \
        ipv6.dhcp.stateful=true \
        ipv4.address=192.0.2.1/24 \
        ipv6.address=2001:db8::1/64 \
        security.acls="${brName}A" \
        raw.dnsmasq='host-record=testhost.test,192.0.2.1,2001:db8::1'

  # Change default actions to drop.
  lxc network set "${brName}" \
        security.acls.default.ingress.action=drop \
        security.acls.default.egress.action=drop

  # Check default reject rules changed to drop.
  if [ "$firewallDriver" = "xtables" ]; then
      iptables -S "lxd_acl_${brName}" | grep -c "\-j DROP" | grep 2
  else
      nft -nn list chain inet lxd "acl.${brName}" | grep -c "drop" | grep 2
  fi

  # Change default actions to reject.
  lxc network set "${brName}" \
        security.acls.default.ingress.action=reject \
        security.acls.default.egress.action=reject

  # Check default reject rules changed to reject.
  if [ "$firewallDriver" = "xtables" ]; then
      iptables -S "lxd_acl_${brName}" | grep -c "\-j REJECT" | grep 2
  else
      nft -nn list chain inet lxd "acl.${brName}" | grep -c "reject" | grep 2
  fi

  # Create profile for new containers.
  lxc profile copy default "${ctPrefix}"

  # Modify profile nictype and parent in atomic operation to ensure validation passes.
  lxc profile show "${ctPrefix}" | sed  "s/nictype: p2p/network: ${brName}/" | lxc profile edit "${ctPrefix}"

  lxc init testimage "${ctPrefix}A" -p "${ctPrefix}"
  lxc start "${ctPrefix}A"

  # Check DHCP works for baseline rules.
  lxc exec "${ctPrefix}A" -- udhcpc -i eth0 -n -q 2>&1 | grep 'obtained'

  # Request DHCPv6 lease (if udhcpc6 is in busybox image).
  busyboxUdhcpc6=1
  if ! lxc exec "${ctPrefix}A" -- busybox --list | grep udhcpc6 ; then
    busyboxUdhcpc6=0
  fi

  if [ "$busyboxUdhcpc6" = "1" ]; then
    lxc exec "${ctPrefix}A" -- udhcpc6 -i eth0 -n -q 2>&1 | grep 'IPv6 obtained'
  fi

  # Add static IPs to container.
  lxc exec "${ctPrefix}A" -- ip a add 192.0.2.2/24 dev eth0
  lxc exec "${ctPrefix}A" -- ip a add 2001:db8::2/64 dev eth0

  # Check ICMP to bridge is blocked.
  ! lxc exec "${ctPrefix}A" -- ping -c1 -4 -W2 192.0.2.1 || false
  ! lxc exec "${ctPrefix}A" -- ping -c1 -6 -W2 2001:db8::1 || false

  # Allow ICMP to bridge host.
  lxc network acl rule add "${brName}A" egress action=allow destination=192.0.2.1/32 protocol=icmp4 icmp_type=8
  lxc network acl rule add "${brName}A" egress action=allow destination=2001:db8::1/128 protocol=icmp6 icmp_type=128
  lxc exec "${ctPrefix}A" -- ping -c1 -4 -W2 192.0.2.1
  lxc exec "${ctPrefix}A" -- ping -c1 -6 -W2 2001:db8::1

  # Check DNS resolution (and connection tracking in the process).
  lxc exec "${ctPrefix}A" -- nslookup -type=a testhost.test 192.0.2.1
  lxc exec "${ctPrefix}A" -- nslookup -type=aaaa testhost.test 192.0.2.1
  lxc exec "${ctPrefix}A" -- nslookup -type=a testhost.test 2001:db8::1
  lxc exec "${ctPrefix}A" -- nslookup -type=aaaa testhost.test 2001:db8::1

  # Add new ACL to network with drop rule that prevents ICMP ping to check drop rules get higher priority.
  lxc network acl create "${brName}B"
  lxc network acl rule add "${brName}B" egress action=drop protocol=icmp4 icmp_type=8
  lxc network acl rule add "${brName}B" egress action=drop protocol=icmp6 icmp_type=128

  lxc network set "${brName}" security.acls="${brName}A,${brName}B"

  # Check egress ICMP ping to bridge is blocked.
  ! lxc exec "${ctPrefix}A" -- ping -c1 -4 -W2 192.0.2.1 || false
  ! lxc exec "${ctPrefix}A" -- ping -c1 -6 -W2 2001:db8::1 || false

  # Check ingress ICMPv4 ping is blocked.
  ! ping -c1 -4 192.0.2.2 || false

  # Allow ingress ICMPv4 ping.
  lxc network acl rule add "${brName}A" ingress action=allow destination=192.0.2.2/32 protocol=icmp4 icmp_type=8
  ping -c1 -4 192.0.2.2

  # Check egress ICMPv6 ping from host to bridge is allowed by default (for dnsmasq probing).
  ping -c1 -6 2001:db8::2

  # Check egress TCP.
  lxc exec "${ctPrefix}A" -- nc -v -w2 192.0.2.1 53
  lxc exec "${ctPrefix}A" -- nc -v -w2 2001:db8::1 53

  nc -l -p 8080 -q0 -s 192.0.2.1 </dev/null >/dev/null &
  nc -l -p 8080 -q0 -s 2001:db8::1 </dev/null >/dev/null &

  ! lxc exec "${ctPrefix}A" -- nc -v -w2 192.0.2.1 8080 || false
  ! lxc exec "${ctPrefix}A" -- nc -v -w2 2001:db8::1 8080 || false

  lxc network acl rule add "${brName}A" egress action=allow destination=192.0.2.1/32 protocol=tcp destination_port=8080
  lxc network acl rule add "${brName}A" egress action=allow destination=20fc00:db20:35b:7399::5/128 protocol=tcp destination_port=8080

  lxc exec "${ctPrefix}A" -- nc -v -w2 192.0.2.1 8080
  lxc exec "${ctPrefix}A" -- nc -v -w2 2001:db8::1 8080

  # Check can't delete ACL that is in use.
  ! lxc network acl delete "${brName}A" || false

  lxc delete -f "${ctPrefix}A"
  lxc profile delete "${ctPrefix}"
  lxc network delete "${brName}"
  lxc network acl delete "${brName}A"
  lxc network acl delete "${brName}B"
}


<reponame>wyuan1704/nebula
#!/bin/bash -e
# publish docker images to https://hub.docker.com/u/columns
# it prompts for user name and password.
# run this `publish.sh` only after `build.sh` succeeds

# source root
ROOT=$(git rev-parse --show-toplevel)

# prompt for login info early so we don't need to wait build
echo 'Make sure you have run `build.sh` successfully before this!'
echo 'Enter username (columns) and password to continue...'
sudo docker login

# to support latest syntax, we need latest docker-compose
$ROOT/deploy/install-latest-docker-compose.sh

# go to docker-compose folder
cd $ROOT/src/service
sudo docker-compose build

# Just push or maybe we should do sanity check on outcome of the images
sudo docker tag nebula/web columns/nebula.web && sudo docker push columns/nebula.web
sudo docker tag nebula/server columns/nebula.server && sudo docker push columns/nebula.server
sudo docker tag nebula/node columns/nebula.node && sudo docker push columns/nebula.node

echo 'Images are ready: [columns/nebula.web, columns/nebula.server, columns/nebula.node]'
echo 'DONE!'


#!/bin/bash
SCRIPTS_LOCATION="${PWD}/scripts"
BIN_USER_LOCATION="${HOME}/bin-${USER}"

chmod +x ${SCRIPTS_LOCATION}/*

if ! [ -e ${BIN_USER_LOCATION} ]; then
  ln --symbolic ${SCRIPTS_LOCATION}/bin/ ${BIN_USER_LOCATION} &> /dev/null
fi

BASH_ALIASES_FILE="${HOME}/.bash_aliases"

if ! [ -e "${BASH_ALIASES_FILE}" ]; then
  ln --symbolic "${SCRIPTS_LOCATION}/bash_aliases" "${BASH_ALIASES_FILE}" &> /dev/null
fi

BASH_CONFIG_FILE="${HOME}/.bash_config"

if ! [ -e "${BASH_CONFIG_FILE}" ]; then
  ln --symbolic "${SCRIPTS_LOCATION}/bash_config" "${BASH_CONFIG_FILE}" &> /dev/null
fi

FIND_EXPRESSION='(^PATH*.)(.*bin-BIN_USER$)'

if ! grep --quiet --extended-regexp "${FIND_EXPRESSION/BIN_USER/$USER}" ~/.bashrc; then
  echo "PATH=\${PATH}:${BIN_USER_LOCATION}" >> ${HOME}/.bashrc
fi

if ! grep --quiet --extended-regexp ".bash_config" ~/.bashrc; then
cat <<EOF >> ~/.bashrc
if [ -f ~/.bash_config ]; then
  . ~/.bash_config
fi
EOF
fi

mkdir -p ${HOME?}/bin

source ${HOME?}/.bashrc

scripts/sudoers/setup.sh
scripts/vscode/install.sh
scripts/utilities/install.sh

source ~/.bashrc

echo "Done"


#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

eval "$(luarocks path --bin)"

for file in "$@"; do
  lua "$file"
done


#!/bin/bash

###
# PURPOSE: Start/Restart API, React, and database services in dev environment
# USAGE: ./dev.run.sh [-r]
#           -r: reset database. Will recreate superuser.
###

APP_NAME="Live Feed Sample"

# exit script immediately on error
set -e
USAGE="Usage: ./dev.run.sh [-r]"
GREEN="\033[1;32m"
ORANGE="\033[1;33m"
NOCOLOR="\033[0m"

# check command option
reset_db=0
while getopts "r" opt; do
  case ${opt} in
    r ) # reset database
      reset_db=1
      ;;
    \? ) echo $USAGE
      ;;
  esac
done

if [ "$reset_db" -eq 1 ]; then
  echo -e "${ORANGE}\xE2\x98\x85 Resetting ${APP_NAME} database ...${NOCOLOR}"
  # remove docker volumes (database data, etc.) and restart services
  docker-compose -f dev.docker-compose.yml down -v
else
  # restart services without removing volumes
  echo -e "${ORANGE}\xE2\x98\x85 Restarting ${APP_NAME} ...${NOCOLOR}"
  docker-compose -f dev.docker-compose.yml down
fi

# restart services and run unit test
docker-compose -f dev.docker-compose.yml up --build -d

echo -e "${ORANGE}\xE2\x98\x85 Waiting for Django to start ...${NOCOLOR}"
while docker exec -t live-feed-sample_backend_1 nc -z localhost 80 ; [ $? -ne 0 ]; do
  sleep 0.1
done

# echo -e "${ORANGE}\xE2\x98\x85 Run backend tests ...${NOCOLOR}"
# docker exec -t live-feed-sample_backend_1 pipenv run python app/manage.py test

# echo -e "${ORANGE}\xE2\x98\x85 Run frontend tests ...${NOCOLOR}"
# docker exec -t -e CI=true live-feed-sample_backend_1 npm test

if [ "$reset_db" -eq 1 ]; then
  echo -e "${ORANGE}\xE2\x98\x85 Inserting initial data...${NOCOLOR}"
  # default fixtures data will be used (e.g. <app>/fixtures/)
  docker exec -it live-feed-sample_backend_1 pipenv run python app/manage.py loaddata initial_posts

  echo -e "\n${GREEN}\xE2\x9C\x93 Development services restarted with fresh database. ${NOCOLOR}"
else
  echo -e "\n${GREEN}\xE2\x9C\x93 Development services restarted. ${NOCOLOR}"
fi


<filename>.app-management/utils/handler_utils.sh
#!/usr/bin/env bash

# IBM WebSphere Application Server Liberty Buildpack
# Copyright 2016 the original author or 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.

function handler_port() {
  handler=$1
  param=$2
  default=$3
  INSTALL_DIR=$(cd `dirname ${BASH_SOURCE[0]}`/../.. && pwd)
  ruby <<-EORUBY
APP_MGMT_DIR = File.join('$INSTALL_DIR', '.app-management').freeze
\$LOAD_PATH.unshift File.expand_path(APP_MGMT_DIR, __FILE__)
require 'utils/handler_utils.rb'
config = Utils::HandlerUtils.get_configuration('$handler')
puts config['$param'] || $default
EORUBY
}

function enabled_handlers() {
  INSTALL_DIR=$(cd `dirname ${BASH_SOURCE[0]}`/../.. && pwd)
  ruby <<EORUBY
APP_MGMT_DIR = File.join('$INSTALL_DIR', '.app-management').freeze
\$LOAD_PATH.unshift File.expand_path(APP_MGMT_DIR, __FILE__)
require 'utils/enabled_handlers'
enabled = Utils.get_enabled_handlers
puts enabled.join("\n") unless enabled.nil?
EORUBY
}


#!/bin/bash

# Author: <NAME> | Microsoft

if [[ $(dpkg-query -W -f='${Status}' lxc-docker 2>/dev/null | grep -c "ok installed") -eq 0 ]]
then
		[ -e /usr/lib/apt/methods/https ] || {
        apt-get update
        apt-get install apt-transport-https
		}

		apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
    sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
    apt-get update
    apt-get install -y lxc-docker
    exit 0
fi


#!/bin/bash

echo $1
if [[ $# -gt 0 ]]; then
	zip -r -X WikipediaDarkMode_$1.zip manifest.json replace_light.js theme.css wikipedia-dark-mode-icon.png
else
	echo "Need version number."
fi


#!/bin/bash
set -e -x
cd "$(dirname "${0}")/.."
proj_root="${PWD}"
TIMEFORMAT="%R"

test_root=test/benchmarks
test_names="rw sparse_rw simple simpler"
# ed cava

for test_name in ${test_names}
do
	[ -d "${test_root}/${test_name}" ]
	make clean -C "${test_root}/${test_name}"
	TIMEFORMAT="make ${test_name} %R"
	time make TARGET=seq -C "${test_root}/${test_name}" &
done
wait

# for test_name in ${test_names}
# do
# 	cd "${test_root}/${test_name}"
# 	TIMEFORMAT="run ${test_name} %R"
# 	time ./exe-seq > output || true &
# 	cd "${proj_root}"
# done
# wait

# for test_name in ${test_names}
# do
# 	TIMEFORMAT="process ${test_name} %R"
# 	time pypy "${proj_root}/scripts/data_processing.py" \
# 		 --name "${test_name}" \
# 		 < "${test_root}/${test_name}/output" \
# 		 > "${test_root}/${test_name}/results.csv" \
# 		&
# done
# wait

# echo "program,mode,core,store,load,traffic" > results.csv
# for test_name in ${test_names}
# do
# 	cat "${test_root}/${test_name}/results.csv" >> "${proj_root}/results.csv"
# done

# cat "${proj_root}/results.csv"


<reponame>hxl1990/new416
#!/usr/bin/env bash

build_tmp="_build/"

mkdir ${build_tmp} 2>/dev/null
cd ${build_tmp}

cmake --clean-first ..
make -j 4 --makefile Makefile


<filename>docker/Prometheus/docker_run.sh<gh_stars>1-10
#!/usr/bin/env bash

# Create Docker Volume
VOLUME_NAME="prometheus-vol"

# docker volume rm prometheus-vol

docker volume ls | grep -wq "${VOLUME_NAME}" && echo "The volume: ${VOLUME_NAME} already exists" ||
  docker volume create "${VOLUME_NAME}" && echo "The volume: ${VOLUME_NAME} has been created"

docker run \
  -h prometheus \
  --name prometheus \
  --restart always \
  --cpus ".25" \
  --memory "1g" \
  --memory-swap "1g" \
  --log-opt max-size=10m \
  --log-opt max-file=3 \
  -v "${PWD}"/conf/prometheus.yml:/etc/prometheus/prometheus.yml \
  -v "${VOLUME_NAME}":/prometheus \
  -p 9090:9090 \
  -d \
  prom/prometheus:v2.16.0

# --net="host" 在容器内使用主机的网络命名空间（相比 -p 9090:9090 没有网络转发）

# --storage.tsdb.retention=90d 数据保留多少天，默认15d


#!/bin/sh

if [ ! -f data/raw/Etunimitilasto-2017-04-06-VRK.xls ]; then
   wget https://www.avoindata.fi/dataset/57282ad6-3ab1-48fb-983a-8aba5ff8d29a/resource/1db08a34-8948-48bc-89a6-0a95fdfa4a76/download/Etunimitilasto-2017-04-06-VRK.xls -O data/raw/Etunimitilasto-2017-04-06-VRK.xls
fi
if [ ! -f data/raw/Sukunimitilasto-2017-04-06-VRK.xls ]; then
   wget https://www.avoindata.fi/dataset/57282ad6-3ab1-48fb-983a-8aba5ff8d29a/resource/af5b50bf-094e-41a5-bdde-80f5c4e11620/download/Sukunimitilasto-2017-04-06-VRK.xls -O data/raw/Sukunimitilasto-2017-04-06-VRK.xls
fi

echo "Name,Count" > data/first-names-male.csv
in2csv --sheet "Miehet kaikki" data/raw/Etunimitilasto-2017-04-06-VRK.xls | tail -n +2 >> data/first-names-male.csv

echo "Name,Count" > data/first-names-female.csv
in2csv --sheet "Naiset kaikki" data/raw/Etunimitilasto-2017-04-06-VRK.xls | tail -n +2 >> data/first-names-female.csv

echo "Name,Count" > data/last-names.csv
in2csv --sheet "Nimet" data/raw/Sukunimitilasto-2017-04-06-VRK.xls | tail -n +2 >> data/last-names.csv


#!/bin/bash
set -x

# Git VCS cookbook

# Chapter 8 - Recovering trom mistakes
# Getting ready
if [ ! -d hello_world_cookbook ]; then
	git clone https://github.com/dvaske/hello_world_cookbook.git
fi

cd hello_world_cookbook

# Checkout the master branch
git checkout master

# reset to known state
git reset --hard origin/master

# How to do it
# Undo the last commit like it never happened

# Make sure we have a clean working directory and index
git status

# check the contents of current directory:
ls

# Lets see the history of the repository
git log --oneline

# Lets undo the latest commit
git reset --hard HEAD^

# Lets see the history of the repository
git log --oneline

# Check git status
git status

# check current directory
ls

# Exit subdir
cd ..

set +x


# 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.
#

. $CORE_PATH/hw/scripts/common.sh

GDB=arm-none-eabi-gdb
CONNECTION_MODE_DEFAULT="halt"

#
# FILE_NAME must contain the name of the file to load
# FLASH_OFFSET must contain the offset in flash where to place it
# TARGET must be correectly set by the BSP; check `pyocd list --targets`
# CONNECTION_MODE can be one of "attach", "halt" (default), "pre-reset", "under-reset"
#
pyocd_load () {
    if [ -z $TARGET ]; then
        echo "Missing TARGET (get a list with 'pyocd list --targets')"
        exit 1
    fi

    if [ -z $CONNECTION_MODE ]; then
        CONNECTION_MODE=$CONNECTION_MODE_DEFAULT
    fi

    if [ -z $FILE_NAME ]; then
        echo "Missing filename"
        exit 1
    fi
    if [ ! -f "$FILE_NAME" ]; then
        # tries stripping current path for readability
        FILE=${FILE_NAME##$(pwd)/}
        echo "Cannot find file" $FILE
        exit 1
    fi
    if [ -z $FLASH_OFFSET ]; then
        echo "Missing flash offset"
        exit 1
    fi

    echo "Downloading" $FILE_NAME "to" $FLASH_OFFSET

    pyocd flash -a $FLASH_OFFSET -e sector -M $CONNECTION_MODE -t $TARGET $FILE_NAME --format bin
    if [ $? -ne 0 ]; then
        exit 1
    fi
    return 0
}

#
# NO_GDB should be set if gdb should not be started
# FILE_NAME should point to elf-file being debugged
# TARGET must be correectly set by the BSP; check `pyocd list --targets`
# CONNECTION_MODE can be one of "attach", "halt" (default), "pre-reset", "under-reset"
#
pyocd_debug () {
    windows_detect
    PORT=3333

    parse_extra_jtag_cmd $EXTRA_JTAG_CMD

    if [ -z $TARGET ]; then
        echo "Missing TARGET (get a list with 'pyocd list --targets')"
        exit 1
    fi

    if [ -z $CONNECTION_MODE ]; then
        CONNECTION_MODE=$CONNECTION_MODE_DEFAULT
    fi

    if [ -z "$NO_GDB" ]; then
        if [ -z $FILE_NAME ]; then
            echo "Missing filename"
            exit 1
        fi
        if [ ! -f "$FILE_NAME" ]; then
            echo "Cannot find file" $FILE_NAME
            exit 1
        fi

        if [ $WINDOWS -eq 1 ]; then
            #
            # Launch openocd in a separate command interpreter, to make sure
            # it doesn't get killed by Ctrl-C signal from bash.
            #

            $COMSPEC /C "start $COMSPEC /C pyocd gdbserver -M $CONNECTION_MODE -t $TARGET -p $PORT"
        else
            #
            # Block Ctrl-C from getting passed to openocd.
            #
            set -m
            pyocd gdbserver -M $CONNECTION_MODE -t $TARGET -p $PORT >pyocd.log 2>&1 &
            stpid=$!
            set +m
        fi

        GDB_CMD_FILE=.gdb_cmds

        echo "target remote localhost:$PORT" > $GDB_CMD_FILE
        if [ ! -z "$RESET" ]; then
            echo "mon reset halt" >> $GDB_CMD_FILE
        fi

        echo "$EXTRA_GDB_CMDS" >> $GDB_CMD_FILE

        if [ $WINDOWS -eq 1 ]; then
            FILE_NAME=`echo $FILE_NAME | sed 's/\//\\\\/g'`
            $COMSPEC /C "start $COMSPEC /C $GDB -x $GDB_CMD_FILE $FILE_NAME"
        else
            set -m
            $GDB -x $GDB_CMD_FILE $FILE_NAME
            set +m
            rm $GDB_CMD_FILE
            sleep 1
            if [ -d /proc/$stpid ] ; then
                kill -9 $stpid
            fi
        fi
    else
        # No GDB, wait for pyocd to exit
        pyocd gdbserver -M $CONNECTION_MODE -t $TARGET -p $PORT
        return $?
    fi

    return 0
}


<gh_stars>0
#!/bin/bash
# Checks if node is server. If it is, it starts the server program.
# Otherwise, it starts the Client application prompt.

address=$(hostname)
slice=chalmersple_casss2
config=./casss/config/autogen.ini

# For each time my address is in autogen.ini, start a server
servers=$(grep $address $config | cut -d ' ' -f 3)

for server in $servers; do
  address=$(echo $server | cut -d ':' -f 1)
  port=$(echo $server | cut -d ':' -f 2)
  if [ $# -eq 0 ]; then
    echo "Starting server at $address:$port"
    sudo python3.6 -O /home/$slice/casss/server.py $port $address $config > /dev/null &
  else
    echo "Starting AR server at $address:$port"
    sudo python3.6 -O /home/$slice/casss/ARserver.py $port $address $config > /dev/null &
  fi
done


<gh_stars>0
#!/bin/bash

# commands
vboxmanage startvm CMPE255 --type headless

# ssh login
ssh -p 2222 <user>@localhost

# start jupyter notebook
jupyter notebook --no-browser --port=8889

# jupyter notebook ssh tunneling
ssh -N -f -L 9999:localhost:8889 -p 2222 <user>@localhost

# find and remove service on port 9999
netstat -tulpn | grep :9999


<gh_stars>0
#!/bin/sh

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

mkdir -p ~/.config/fish
mkdir ~/.SpaceVim.d/
cp $DIR/config/spacemacs ~/.spacemacs
cp $DIR/config/config.fish ~/.config/fish/config.fish
cp $DIR/config/profile ~/.profile
cp $DIR/config/clang-format ~/.clang-format
cp $DIR/config/init.toml ~/.SpaceVim.d/init.toml
cp $DIR/config/gitconfig ~/.gitconfig

if [ "$1" = "docker" ]; then
  sed -i 's/127.0.0.1/host.docker.internal/g' ~/.config/fish/config.fish
  sed -i -e '4d' ~/.config/fish/config.fish
fi


<gh_stars>0
echo $1
rootdirectory="$PWD"
# ---------------------------------

dirs="frameworks/av system/netd"

for dir in $dirs ; do
	cd $rootdirectory
	#cd $dir
	echo "Reverting $dir patches..."
	#git apply --reverse $rootdirectory/device/elephone/p9000/patches/$dir/*.patch
	repo sync $dir
	echo " "
done

# -----------------------------------
echo "Changing to build directory..."
cd $rootdirectory


<gh_stars>10-100
#!/usr/bin/env bats

: ${IMAGE:?}

run-in-image() {
	docker run -it "${IMAGE:?}" "$@"
}

@test "Simple shell hello world" {
	expected="hello world"
	result=$(run-in-image bash -c "echo -n $expected")
	[[ "${result}" == "${expected}" ]]
}


#!/bin/sh

set -e

go build -o ./bin/rpc ../.. # rpc itself

./bin/rpc -gen go  -out ./goapi/api/ ./todo.rpc
./bin/rpc -gen elm -out ./web/src/ ./todo.rpc

cd goapi && go build -o ../bin/goapi . \
  && cd ..

cd web && elm make --optimize src/Main.elm \
  && cd ..


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

# CentOS compatibility
for dir in /usr/pgsql-*/bin; do
  test -d "$dir" && PATH="$dir:$PATH"
done

# suggested options:
# ./pgbench.sh --time 3600 --client 4 --progress 5

pgbench -n \
  -f movie.sql@10 \
  -f person.sql@10 \
  -f character.sql@1 \
  -f category.sql@5 \
  -f date.sql@5 \
  -f job.sql@5 \
  -f country.sql@1 \
  -f language.sql@1 \
  -f main.sql@1 \
  -f search.sql@1 \
  "$@" omdb


<gh_stars>0
#!/usr/bin/sh
docker container rm voipdp-server
docker run --net=host --name=voipdp-server \
  --detach \
  -v /etc/voipdp-server:/usr/local/voipdp-server/conf:z \
  -v /var/log/voipdp-server:/usr/local/voipdp-server/log:z \
  --restart unless-stopped \
  mmvrus/voipdp-server:3.5.25-26-debian8


#!/bin/bash
#SBATCH --account=project_2001659
#SBATCH --time=00:05:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem-per-cpu=4G
#SBATCH --partition=test

module load geoconda
srun python 07_pdal_ground.py


#!/bin/bash

set -e

VAR_PARTITION="$1"

echo "Seting up ${VAR_PARTITION} for use as encrypted /var."

# Check whether there is already a luks header in the partition.
TYPE=$(blkid -o value --match-tag TYPE "${VAR_PARTITION}")

# cf. the upgrade logic in "manageboot.sh": The target partition is wiped
# clean as part of the upgrade procedure. We can therefore really rely
# on having a clean slate here after first boot of an upgrade.
if [ "${TYPE}" == "crypto_LUKS" ]; then
    echo "Found LUKS header in partition ${VAR_PARTITION} for /var."
    cryptsetup luksOpen "${VAR_PARTITION}" var_crypt --key-file /boot/config/store.keyfile
else
    echo "No LUKS header found in partition ${VAR_PARTITION} for /var. Setting it up on first boot."
    # Set minimal iteration count -- we already use a random key with
    # maximal entropy, pbkdf doesn't gain anything (besides slowing
    # down boot by a couple seconds which needlessly annoys for testing).
    cryptsetup luksFormat --type luks2 --pbkdf pbkdf2 --pbkdf-force-iterations 1000 "${VAR_PARTITION}" /boot/config/store.keyfile
    cryptsetup luksOpen "${VAR_PARTITION}" var_crypt --key-file /boot/config/store.keyfile
    echo "Populating /var filesystem in ${VAR_PARTITION} on first boot."
    mkfs.ext4 -F /dev/mapper/var_crypt -d /var
fi


#!/usr/bin/env bash

CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$CURRENT_DIR/helpers.sh"

get_crypto() {
  local units=$(get_tmux_option "@tmux-market-units" "USD")
  local api_key=$(get_tmux_option "@tmux-market-api-key"\
    "<KEY>")

  if [ "$units" != "USD" ] && [ "$units" != "CNY" ]; then
    units="USD"
  fi

  resp=`curl -H "X-CMC_PRO_API_KEY: $api_key"   \
    -H "Accept: application/json" -d "start=1&limit=2&convert=$units"       \
    -G "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest"`
  vals=`echo $resp | jq ".data | .[0,1].quote.$units.price" | cut -d'.' -f1`

  # Ƀ: \u0243, Ξ: \u039e, ¥: \u00a5. vim insert mode press C-v u[code point].
  local declare -a symbols=("Ƀ" "Ξ")
  local i=0
  local prices="| "
  for val in $vals; do
    if [ "$units" == "USD" ]; then
       prices="$prices ${symbols[$i]} \$$val |"
    else
       prices="$prices ${symbols[$i]} ¥$val |"
    fi
    i=$(($i+1))
  done

  echo -n $prices
}

main() {
  local update_interval=$((60 * $(get_tmux_option "@tmux-market-interval" 15)))
  local current_time=$(date "+%s")
  local previous_update=$(get_tmux_option "@market-previous-update-time")
  local delta=$((current_time - previous_update))

  if [ -z "$previous_update" ] || [ $delta -ge $update_interval ]; then
    price=$(get_crypto)
    if [ "$?" -eq 0 ]; then
      $(set_tmux_option "@market-previous-update-time" "$current_time")
      $(set_tmux_option "@market-previous-value" "$price")
    fi
  fi

  echo -n $(get_tmux_option "@market-previous-value")
}

main


#!/bin/bash

#---MOP WORK PACKAGE TAG: WP021BISV3---
#---DESC:
#---CONFIGURING SSH SESSION TIMEOUT---

#---SCRIPT BY <NAME>
#SIGNUM: EBOAREU---

#---MAIN CONFIG COMMAND OBTAINED FROM NODE HARDENING CPI---

#---All scripts run are logged into a single log file called "script.log"
#with file path /var/log/script.log---

echo "Please enter your ID and address of primary IO to be logged onto the primary IO as tspSecAdmin user:"

echo "ID:"
read value

echo "Address:"
read address

sudo ssh $value@$address

echo "NOTE: PLEASE ACT ACCORDING TO THE PRINTOUT OF THE SCRIPT TO ACTUALIZE THE SETTING"
echo "Please provide the desired timeout threshold in seconds:"
read time

sudo set_session_timeout.sh -t \ $time

echo "Please enter your ID and address of secondary IO to be logged onto the primary IO as tspSecAdmin user:"

echo "ID:"
read value

echo "Address:"
read address

sudo ssh $value@$address

echo "NOTE: PLEASE ACT ACCORDING TO THE PRINTOUT OF THE SCRIPT TO ACTUALIZE THE SETTING"
echo "Please provide the desired timeout threshold in seconds:"
read time

sudo set_session_timeout.sh -t \ $time


sh integration-test-racket.sh
sh integration-test.sh


docker run --name k210_std_build -v `pwd`:/media/shared/ webduino/k210_build \
/bin/bash -c \
"cd /media/shared/MaixPy/projects/maixpy_k210/ && \
python3 project.py distclean && \
python3 project.py build && \
cp /media/shared/MaixPy/projects/maixpy_k210/build/maixpy.bin \
../../../webAI/m_0x020000_webai_std.bin" \
&& docker rm k210_std_build


<reponame>usagi/home
if [ `uname -s` = 'FreeBSD' ]; then
  mozc_server_start
  export XIM=ibus
  export GTK_IM_MODULE=ibus
  export QT_IM_MODULE=xim
  export XMODIFIERS=@im=ibus
  export XIM_PROGRAM="ibus-daemon"
  export XIM_ARGS="-r --daemonize --xim"
fi


<reponame>NiallSmithCV/Projects<gh_stars>0
#!/bin/sh

SOLUTION=hw4.l  # only need to configure this if necessary
TESTFILE=test.l
TMPFILE=check.l
REFOUT=Output.correct
TMPOUT=Output.your

cat > $TMPFILE <<EOF
(load "$SOLUTION")
(load "$TESTFILE")
(test)
EOF

# cleanup
echo "(1) remove existing output file"
rm -f $TMPOUT

# run
echo "(2) load your solution and test"
clisp $TMPFILE > $TMPOUT

# diff
echo "(3) check for differences"
diff $TMPOUT $REFOUT


#!/bin/sh
composer install --no-ansi --no-interaction --no-suggest --prefer-dist


#!/bin/sh

yarn workspace authorizer test
yarn workspace cognito test
yarn workspace model test
yarn workspace api-admin-access test
yarn workspace api-admin-content test
yarn workspace api-admin-model test
yarn workspace api-admin-user test
yarn workspace api-content test
yarn workspace upload test


#!/bin/bash
/opt/mssql-tools/bin/sqlcmd -S $DB_SERVER,$DB_PORT -U $DB_USER -P $DB_PASS -i db_setup.sql -r1
echo "Done DB Setup"