#!/bin/bash
# *ALL INSTANCES*
# run as root
# copied/uploaded onto the virtual machine and executed. DO NOT run on your host machine.

set -e # everything must pass
set -u # no unbound variables
set -xv  # output the scripts and interpolated steps

export DEBIAN_FRONTEND=noninteractive # no ncurses prompts

echo "-----------------------------"

if [ ! "$#" -ge 3 ]; then
    echo "Usage: ./bootstrap.sh <version> <minion_id> <install_master> [master_ipaddr]"
    echo "Example: ./bootstrap.sh 2017.7.x journal--end2end--1 false 10.0.0.1"
    exit 1
fi

version=$1
minion_id=$2
install_master=$3
master_ipaddr=${4:-""} # optional 4th argument. masterless minions do not use this.

# ensures the SSH_AUTH_SOCK envvar is retained when we sudo to root
# this allows the root user to talk to private git repos
echo 'Defaults>root env_keep+=SSH_AUTH_SOCK' > /etc/sudoers.d/00-ssh-auth-sock-root
chmod 440 /etc/sudoers.d/00-ssh-auth-sock-root
chmod -R 777 /tmp

installing=false
upgrading=false
if [ ! -e /root/events.log ]; then
    # we're installing for the first time if: we can't find an event.log file.
    # this file is deleted upon stack creation and populated after successful
    # salt installation
    installing=true
else
    if ! (salt-minion --version | grep "$version"); then
        upgrading=true
    fi
fi

upgrade_python2=false
upgrade_python3=false
install_git=false

# Python is such a hard dependency of Salt that we have to upgrade it outside of
# Salt to avoid changing it while it is running

# TODO: remove this block once our python2 dependency is gone
if ! command -v python2.7 || ! python2.7 -m pip; then
    # python2 not found
    upgrade_python2=true
else
    # python2 found, check installed version
    python_version=$(dpkg-query -W --showformat="\${Version}" python2.7) # e.g. 2.7.5-5ubuntu3
    if dpkg --compare-versions "$python_version" lt 2.7.12; then
        # we used this, which is not available anymore, to provide a more recent Python 2.7
        # let's remove it to avoid apt-get update errors
        rm -f /etc/apt/sources.list.d/fkrull-deadsnakes-python2_7-trusty.list

        # provides python2.7[.13] package and some dependencies
        add-apt-repository -y ppa:jonathonf/python-2.7

        # provides a recent python-urllib3 (1.13.1-2) because:
        # libpython2.7-stdlib : Breaks: python-urllib3 (< 1.9.1-3) but 1.7.1-1ubuntu4 is to be installed
        # due to the previous PPA
        add-apt-repository -y ppa:ross-kallisti/python-urllib3
        upgrade_python2=true
    fi

    # if flag present, upgrade python
    if [ -f /root/upgrade-python.flag ]; then
        upgrade_python2=true
    fi
fi

if ! command -v python3; then
    # python3 not found
    upgrade_python3=true
else
    # python 3 found but have our other py3 dependencies been installed?
    if ! grep "installed/upgraded python3" /root/events.log; then
        upgrade_python3=true
    fi
fi

if ! dpkg -l git; then
    # git not found
    install_git=true
fi

if ($upgrade_python2 || $upgrade_python3 || $install_git); then
    apt-get update -y -q
fi

# flag we can toggle to disable installation of python2 and python2 libs.
# set to `false` once all formulas and formula code has been updated.
elife_depends_on_python2=true

if $upgrade_python2; then

    if $elife_depends_on_python2; then
        echo "eLife still has formulas that depend on Python2!"
        apt-get install python2.7 python2.7-dev -y -q

        # virtualenvs have to be recreated
        # lsh@2020-01-23: disabled as no longer necessary. re-enable if anything breaks
        #find /srv /opt -depth -type d -name venv -exec rm -rf "{}" \;

        # install pip+setuptools
        apt-get install python-pip python-setuptools --no-install-recommends -y -q
    fi

    # remove flag, if it exists
    rm -f /root/upgrade-python.flag
fi

if $elife_depends_on_python2; then
    # upgrade pip setuptools, install dockerlib
    python2.7 -m pip install pip "setuptools==44.0.0" --upgrade
    # some Salt states require libraries to be installed before calling highstate
    python2.7 -m pip install "docker[tls]==4.1.0"
fi

if $upgrading; then
    # old versions of this file interfere with the salt upgrade process as they 404 software as soon as it falls out of support.
    rm -f /etc/apt/sources.list.d/saltstack.list
fi

if $upgrade_python3; then

    # confdef: If conf file modified and the version in the package changed, choose the default action without
    # prompting. If there is no default action, stop to ask the user unless '--force-confnew' or '--force-confold' given
    # confold: If conf file modified and the version in the package changed, keep the old version without prompting
    apt-get install \
        python3 python3-dev python3-pip python3-setuptools \
        -y -q --no-install-recommends \
        -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"

    # --progress-bar off -- this option only available since pip 10.0. 16.04 has pip 8 by default
    python3 -m pip install pip setuptools --upgrade

    # some Salt states require libraries to be installed before calling highstate
    python3 -m pip install "docker[tls]==4.1.0" --progress-bar off

    # record an entry about when python3 was installed/upgraded
    # presence of this entry is used to skip this section in future, unless forced with a flag
    if [ -f /root/upgrade-python3.flag ]; then
        echo "$(date -I) -- installed/upgraded python3 (forced)" >> /root/events.log;
    else
        echo "$(date -I) -- installed/upgraded python3" >> /root/events.log;
    fi

    # remove 'force upgrade' flag, if it exists
    rm -f /root/upgrade-python3.flag
fi

if $install_git; then
    apt-get install git -y -q
fi

# salt-minion
if ($installing || $upgrading); then
    echo "Bootstrap salt $version"
    wget -O salt_bootstrap.sh https://bootstrap.saltstack.com --no-verbose

    # -x  Changes the Python version used to install Salt.
    # -P  Allow pip based installations.
    # -F  Allow copied files to overwrite existing(config, init.d, etc)
    # -c  Temporary configuration directory
    # -M  Also install master
    # https://github.com/saltstack/salt-bootstrap/blob/develop/bootstrap-salt.sh
    sh salt_bootstrap.sh -x python3 -P -F -c /tmp stable "$version"
else
    echo "Skipping minion bootstrap, found: $(salt-minion --version)"
fi

# salt-master
if [ "$install_master" = "true" ]; then
    # salt is not installed or the version installed is old
    if ! (command -v salt-master > /dev/null && salt-master --version | grep "$version"); then
        # master not installed
        sh salt_bootstrap.sh -x python3 -P -F -M -c /tmp stable "$version"
    else
        echo "Skipping master bootstrap, found: $(salt-master --version)"
    fi
fi

# record some basic provisioning info after the above successfully completes
if $installing; then echo "$(date -I) -- installed salt $version" >> /root/events.log; fi
if $upgrading; then echo "$(date -I) -- upgraded salt to $version" >> /root/events.log; fi

# BUG: during a minion's re-mastering the `master: ...` value may get reset if the instance is
# updated by another process before the old master is turned off.
# reset the minion config and
# put minion id in dedicated file else salt keeps recreating file
printf "master: %s\\nlog_level: info\\n" "$master_ipaddr" > /etc/salt/minion
echo "$minion_id" > /etc/salt/minion_id
echo "mysql.unix_socket: '/var/run/mysqld/mysqld.sock'" > /etc/salt/minion.d/mysql-defaults.conf
grains=
while IFS='=' read -r variable_name grain_value ; do
    grain_name=${variable_name#grain_} # delete `grain_`
    printf -v grain_line "%s: %s\n" "$grain_name" "$grain_value"
    grains+="${grain_line}"
done < <(env | grep '^grain_.*')
echo "$grains" > /etc/salt/grains

# restart salt-minion. necessary as we may have changed minion's configuration
systemctl restart salt-minion 2> /dev/null

# generate a key for the root user
# in AWS this is uploaded to the server and moved into place prior to calling
# this script. in Vagrant it must be created.
if [ ! -f /root/.ssh/id_rsa ]; then
    ssh-keygen -t rsa -f /root/.ssh/id_rsa -N ''
fi
touch /root/.ssh/known_hosts

# after bootstrap.sh and before salt's highstate, we may need to talk to github

# ensure salt can talk to github without host verification failures
ssh-keygen -R github.com # removes any existing keys
# append this to the global known hosts file
echo "github.com,172.16.31.10 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCP<KEY> >> /etc/ssh/ssh_known_hosts


<reponame>jjm3x3/git-shell-setup
if test -f /etc/profile.d/git-sdk.sh
then
	TITLEPREFIX=SDK-${MSYSTEM#MINGW}
else
	TITLEPREFIX=$MSYSTEM
fi

# print custom prompt
function custom_ps1_v0() {
	if [[ ! -d ".git" ]]; then return; fi
	hash=$(git rev-parse --short HEAD)
	printf " $hash"
}

 Default='\033[0;36m'
   Ahead='\033[38;5;048m'
  Behind='\033[0;93m'
Diverged='\033[38;5;208m'
   Reset='\033[0m'

# print custom prompt
function custom_ps1_v1() {
	if [[ ! -d ".git" ]]; then return; fi
	hash=$(git rev-parse --short HEAD)
	branch=$(git branch-name HEAD 2>/dev/null)
	if [[ -z "$branch" ]]; then
		printf " ${Default}(($hash...))${Reset}"
		return
	fi
	lcount=$(git rev-list --left-only  --count @{u}...@ 2>/dev/null)
	rcount=$(git rev-list --right-only --count @{u}...@ 2>/dev/null)
	if [[ "$lcount" == 0 && "$rcount" == 0 ]]; then
		branchStatus="≡"
	elif [[ "$lcount" == 0 && "$rcount" > 0 ]]; then
		branchStatus="${Ahead}+"
	elif [[ "$lcount" > 0 && "$rcount" == 0 ]]; then
		branchStatus="${Behind}—"
	elif [[ "$lcount" > 0 && "$rcount" > 0 ]]; then
		branchStatus="${Diverged}±"
	fi
	if [[ -z "$branchStatus" ]]; then
		printf " ${Default}($branch $hash)${Reset}"
	else
		printf " ${Default}($branch $branchStatus${Default} $hash)${Reset}"
	fi
}

# print custom prompt
function custom_ps1_v2() {
	if [[ ! -d ".git" ]]; then return; fi
	hash=$(git rev-parse --short HEAD)
	branchStatus=$(git rev-list --left-right --count @{u}...@ 2>/dev/null \
		| sed $'
			s:^0\t0$::
			s:\t:,+:
			s:^:-:
			')
	printf " $branchStatus $hash"
}

PS1='\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]' # set window title
PS1="$PS1"'\n'                 # new line
#PS1="$PS1"'\e[38;5;94m'       # change to ~Brown
#PS1="$PS1"'\[\033[0m\]'       # change to ~Grey
PS1="$PS1"'\e[38;5;220m'       # change to ~GoldYellow
PS1="$PS1"'\t '                # time
PS1="$PS1"'\[\033[33m\]'       # change to brownish yellow
PS1="$PS1"'\w'                 # current working directory
if test -z "$WINELOADERNOEXEC"
then
	GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
	COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
	COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
	COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
	if test -f "$COMPLETION_PATH/git-prompt.sh"
	then
		. "$COMPLETION_PATH/git-completion.bash"
		. "$COMPLETION_PATH/git-prompt.sh"
	fi
	PS1="$PS1"'\[\033[36m\]'    # change color to cyan
	PS1="$PS1"'`__git_ps1`'     # bash function
	PS1="$PS1"'`custom_ps1_v2`' # bash function
fi
#PS1="$PS1"'\[\033[32m\]'      # change to green
PS1="$PS1"'\e[38;5;28m'        # change to ~DarkGreen
PS1="$PS1"' \u@\h '            # user@host<space>
#PS1="$PS1"'\[\033[35m\]'      # change to purple (more like pink)
PS1="$PS1"'\e[94m'             # change to ~Purple
PS1="$PS1"'$MSYSTEM'           # show MSYSTEM
PS1="$PS1"'\[\033[0m\]'        # change color
PS1="$PS1"'\n'                 # new line
PS1="$PS1"'$ '                 # prompt: always $
MSYS2_PS1="$PS1"               # for detection by MSYS2 SDK's bash.basrc


<filename>MixPanel_daily_DataPipeline/bin/cronjob_mixpanel_daily_datapipeline.sh<gh_stars>0
## Script execution /home/user_XPTO/GITHUB/bin/cronjob_mixpanel_daily_datapipeline.sh
PATH=~/miniconda3/bin:$PATH
export PATH
python3 mixpanel_daily_datapipeline.py local >../log/cron_job.log


<reponame>Luke-zhang-04/quickstart<filename>bash/stylelint.sh
#!/usr/bin/env bash
# Quickstart | Stylelint
# Copyright (c) 2020 <NAME> | https://luke-zhang-04.github.io/ | MIT Licence

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

#######################################
# Add stylelint config
# Globals:
#   None
# Arguments:
#   stylelint: boolean
#######################################
getStylelint() {
    if "$1"; then
        printf "\t${IGreen}Stylelint requested\n\t${IBlue}Installing stylelint config file...\n"

        # Chceck for .stylelintrc.json
        printf "\t\t${IBlue}Checking for .stylelintrc.json file...${Cyan}\n"
        if test -f ".stylelintrc.json"; then # Check if .stylelintrc.json exists
            printf "\t\t\t${IYellow}.stylelintrc.json exists${Cyan}\n"
        else
            # Get .stylelintrc.json file
            printf "\t\t\t${IGreen}.stylelintrc.json does not exist${Cyan}\n"
            printf "\t\t\t${IBlue}Getting .stylelintrc.json file...${Cyan}\n"
            mv ./quickstart/.stylelintrc.json ./.stylelintrc.json
            printf "\t\t\t${IGreen}Got .stylelintrc.json${Cyan}\n"
        fi

        printf "\t\t${IBlue}Installing stylelint dependencies...${Cyan}\n"
        # Install stylelint, and stylelint config standard
        yarn add stylelint stylelint-config-standard -D
        printf "\t\t${IGreen}Installed stylelint dependencies!${Cyan}\n"

        printf "\t${IGreen}Installed Stylelint!${Cyan}\n"
    else
        printf "\t${IYellow}Stylelint not requested${Cyan}\n"
    fi
}


<gh_stars>0
#!/bin/bash
#set -xv

docker run --name bid_on_chain_ganache \
           -it \
           --rm \
           -p 8545:8545 \
           trufflesuite/ganache-cli:latest


#!/bin/bash -e
{ # this ensures the entire script is downloaded #

# Stops the execution of a script if a command or pipeline has an error
set -e

echo "Downloading latest version from github dev"

#download latest
wget https://github.com/Webinate/blacktip/archive/dev.zip
unzip -o "dev.zip"

# Moves the server folder to the current directory
cp -r blacktip-dev/* ./

# Remove modepress temp folder
if [ -d "blacktip-dev" ]; then
	rm blacktip-dev -R
fi

# Remove the zip file
rm "dev.zip"

# All done
echo "Blacktip $(version) successfully downloaded"
echo "Please run 'npm install' to complete installation"
exit
} # this ensures the entire script is downloaded #


<filename>ADC-DER-Testbed/DummyTest/Test_Demo_Prep/killAll.sh<gh_stars>0
#!/bin/bash

clear

#pkill -9 fncs_broker
#pkill -9 gridlabd
#pkill -9 python
cd /home/gld/PFO-ADC-DER-Testbed/ADC-DER-Testbed/DummyTest/Test_Demo/ killall fncs_broker
cd /home/gld/PFO-ADC-DER-Testbed/ADC-DER-Testbed/DummyTest/Test_Demo/ killall gridlabd
cd /home/gld/PFO-ADC-DER-Testbed/ADC-DER-Testbed/DummyTest/Test_Demo/ killall python
cd /home/gld/PFO-ADC-DER-Testbed/ADC-DER-Testbed/DummyTest/Test_Demo/ killall matlab

exit 0


#!/bin/bash

# Change to the parent directory.
cd "$(dirname "$(dirname "$(readlink -fm "$0")")")"

# Set up the database.
psql -h $1 -d microblog_bench -f data/schema.sql


#!/bin/sh
docker stop pcla-mysql
docker stop pcla-redis


#! /bin/bash

###################################################################
#Description: PLAGIARISM DETECTION SYSTEM FOR MULTI-FILE C PROJECTS
#Author    	: <NAME>
#Email    	: <EMAIL>
#Main script: copy_detector.sh
#Usage		: run without arguments or read below to for help text
#Disclaimer: 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.
###################################################################

if (($# < 2)); then
	echo "=========================================================="
	echo "support script of copy_detector.sh, compares \$1 with \$2"
	echo "USAGE: ./compare_two.sh FOLDER1 FOLDER2"
	echo "expects existence of: FOLDER*/MYCFILES.txt containing the list of .c files"
	echo "=========================================================="
	exit 0
fi

cfname=MYCFILES.txt

# change sim_c.exe with your preferred system (be sure to update the command below if necessary)
simc="$(dirname "$(realpath "$0")" )/sim_c.exe"

# everything with sim below this is discarded
threshold=60

# usage of simc:
# ./sim_c.exe -p "./f1.c" "./f2.c"
# 4 lines of output > files very different, no output is given
# 5 lines of output > similarity is given on line 5

# just generating a unique name for tmp file
unotrim=$(echo $1 | tr -d " " | awk -F/ '{print $NF}') #cutting over /, taking the last (file name), trimming whitespace
duetrim=$(echo $2 | tr -d " " | awk -F/ '{print $NF}')

tmpfold="tmp"
ftmp=$tmpfold/$unotrim-$duetrim.txt
mkdir $tmpfold 2> /dev/null

rm ${ftmp}* 2> /dev/null

while read fa; do
	 while read fb; do
	 	#saving sim_c output in the tmp file, appending fa and fb to the last line (the useful one)
	 	echo $($simc -p "$1/$fa" "$2/$fb") \% $fa \% $fb >> $ftmp
	 done <"$2/$cfname"
done <"$1/$cfname"

grep consists $ftmp > ${ftmp}-2 # this will take only lines with the similarity value

# formatting each line to be "X fa fb" where X is the similarity percentage
cnt=0
while read linea; do
	simperc=$(echo $linea | cut -d \% -f 1 | awk '{print $NF}')
	if (( $simperc > $threshold)); then
		((cnt = cnt+1))
		echo $simperc $(echo $linea | cut -d \% -f 3) $(echo $linea | cut -d \% -f 4) >> ${ftmp}-3
	fi
done <${ftmp}-2

if ((cnt == 0)); then
	echo ZERO SIGNIFICANT SIMILARITIES
else
	sort -nr ${ftmp}-3 #output sorted similarities
fi

rm ${ftmp}* 2> /dev/null


# [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_62B02659-4FD3-4B03-97D0-7DB89B787D54][org_gcr_2017-05-12_mara_62B02659-4FD3-4B03-97D0-7DB89B787D54]]
brew cask install deluge
# org_gcr_2017-05-12_mara_62B02659-4FD3-4B03-97D0-7DB89B787D54 ends here

# [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_96300CD8-BC43-41F5-872C-1BF72220CB5A][org_gcr_2017-05-12_mara_96300CD8-BC43-41F5-872C-1BF72220CB5A]]
brew install speedtest_cli
  # org_gcr_2017-05-12_mara_96300CD8-BC43-41F5-872C-1BF72220CB5A ends here

  ;; [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_9217F137-CCF7-4B66-AE32-6ED72D2D629F][org_gcr_2017-05-12_mara_9217F137-CCF7-4B66-AE32-6ED72D2D629F]]
     if [ ! -d "/Library/Application Support/VMware Tools" ]; then
         brew cask install whatsapp
     else
       echo "whatsapp: Only install on hosts"
     fi
  ;; org_gcr_2017-05-12_mara_9217F137-CCF7-4B66-AE32-6ED72D2D629F ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_7C4DE397-48F6-44AC-B9CD-948375915EFF][org_gcr_2017-05-12_mara_7C4DE397-48F6-44AC-B9CD-948375915EFF]]
     if [ ! -d "/Library/Application Support/VMware Tools" ]; then
         brew cask install mplayer-osx-extended
     else
       echo "mplayer: Only install on hosts"
     fi
     # org_gcr_2017-05-12_mara_7C4DE397-48F6-44AC-B9CD-948375915EFF ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_9CDCD936-A30A-4712-8A5F-780D8810FBDE][org_gcr_2017-05-12_mara_9CDCD936-A30A-4712-8A5F-780D8810FBDE]]
     if [ ! -d "/Library/Application Support/VMware Tools" ]; then
         brew cask install skype
     else
       echo "skype: Only install on hosts"
     fi
     # org_gcr_2017-05-12_mara_9CDCD936-A30A-4712-8A5F-780D8810FBDE ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_1F291E61-A8F1-43BE-A839-0E6997099AD4][org_gcr_2017-05-12_mara_1F291E61-A8F1-43BE-A839-0E6997099AD4]]
     if [ ! -d "/Library/Application Support/VMware Tools" ]; then
         brew cask install dropbox
     else
       echo "dropbox: Only install on hosts"
     fi
     # org_gcr_2017-05-12_mara_1F291E61-A8F1-43BE-A839-0E6997099AD4 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_F99FAFA6-C774-4453-BCDA-F86636ADB336][org_gcr_2017-05-12_mara_F99FAFA6-C774-4453-BCDA-F86636ADB336]]
     brew cask install google-chrome
     # org_gcr_2017-05-12_mara_F99FAFA6-C774-4453-BCDA-F86636ADB336 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_66031DAC-6541-4D27-9BE9-80166EB13119][org_gcr_2017-05-12_mara_66031DAC-6541-4D27-9BE9-80166EB13119]]
     brew cask install firefox
     # org_gcr_2017-05-12_mara_66031DAC-6541-4D27-9BE9-80166EB13119 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_0A7F6745-0609-4606-B4C1-7428E64E4313][org_gcr_2017-05-12_mara_0A7F6745-0609-4606-B4C1-7428E64E4313]]
     brew cask install opera
     # org_gcr_2017-05-12_mara_0A7F6745-0609-4606-B4C1-7428E64E4313 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_F8797C4F-7492-441D-B8B2-A13C818672FB][org_gcr_2017-05-12_mara_F8797C4F-7492-441D-B8B2-A13C818672FB]]
     brew cask install filezilla
     # org_gcr_2017-05-12_mara_F8797C4F-7492-441D-B8B2-A13C818672FB ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_22BF5CEE-DB48-45D4-9331-85B67AFE3A5D][org_gcr_2017-05-12_mara_22BF5CEE-DB48-45D4-9331-85B67AFE3A5D]]
     brew cask install slack
     # org_gcr_2017-05-12_mara_22BF5CEE-DB48-45D4-9331-85B67AFE3A5D ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_A2BB25B5-F80B-44B1-84CA-3669F9FD04F2][org_gcr_2017-05-12_mara_A2BB25B5-F80B-44B1-84CA-3669F9FD04F2]]
     brew cask install kindle
     # org_gcr_2017-05-12_mara_A2BB25B5-F80B-44B1-84CA-3669F9FD04F2 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_587FEB0F-0601-410D-AA8B-677635E91321][org_gcr_2017-05-12_mara_587FEB0F-0601-410D-AA8B-677635E91321]]
     brew install wget
     # org_gcr_2017-05-12_mara_587FEB0F-0601-410D-AA8B-677635E91321 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_059F15F1-A456-4885-A364-F363AC30F6CE][org_gcr_2017-05-12_mara_059F15F1-A456-4885-A364-F363AC30F6CE]]
     brew cask install screenflow
     # org_gcr_2017-05-12_mara_059F15F1-A456-4885-A364-F363AC30F6CE ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_2B757414-ED99-4964-96FC-C76DC6512DD0][org_gcr_2017-05-12_mara_2B757414-ED99-4964-96FC-C76DC6512DD0]]
     brew cask install inkscape
     # org_gcr_2017-05-12_mara_2B757414-ED99-4964-96FC-C76DC6512DD0 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_86FEB8A0-A34E-4B44-BABA-BB5CE24D8655][org_gcr_2017-05-12_mara_86FEB8A0-A34E-4B44-BABA-BB5CE24D8655]]
     brew cask install gimp
     # org_gcr_2017-05-12_mara_86FEB8A0-A34E-4B44-BABA-BB5CE24D8655 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-07-11_mara_AB43CB70-381C-4C4D-AF4C-CC7C895D1848][org_gcr_2017-07-11_mara_AB43CB70-381C-4C4D-AF4C-CC7C895D1848]]
     brew install librsvg
     # org_gcr_2017-07-11_mara_AB43CB70-381C-4C4D-AF4C-CC7C895D1848 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2018-03-31T20-45-48-05-00_mara_69E779D8-21A0-4275-ABFB-2A59DF6EC194][org_gcr_2018-03-31T20-45-48-05-00_mara_69E779D8-21A0-4275-ABFB-2A59DF6EC194]]
     brew install jpegoptim
     # org_gcr_2018-03-31T20-45-48-05-00_mara_69E779D8-21A0-4275-ABFB-2A59DF6EC194 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2018-03-31T20-45-48-05-00_mara_9BAA13C4-534C-4CD6-87BE-C75E547D80E3][org_gcr_2018-03-31T20-45-48-05-00_mara_9BAA13C4-534C-4CD6-87BE-C75E547D80E3]]
     brew install optipng
     # org_gcr_2018-03-31T20-45-48-05-00_mara_9BAA13C4-534C-4CD6-87BE-C75E547D80E3 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_EE89A131-05A3-4521-B304-301F5B89A5CD][org_gcr_2017-05-12_mara_EE89A131-05A3-4521-B304-301F5B89A5CD]]
     brew cask install airy
     # org_gcr_2017-05-12_mara_EE89A131-05A3-4521-B304-301F5B89A5CD ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-05-12_mara_49EFB334-9D0E-4354-AD70-3F6E8647C27E][org_gcr_2017-05-12_mara_49EFB334-9D0E-4354-AD70-3F6E8647C27E]]
     brew cask install gmvault
     # org_gcr_2017-05-12_mara_49EFB334-9D0E-4354-AD70-3F6E8647C27E ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-09-04_mara_A5554AFF-B9FC-4139-945C-A7337F4DB79F][org_gcr_2017-09-04_mara_A5554AFF-B9FC-4139-945C-A7337F4DB79F]]
     brew install youtube-dl
     # org_gcr_2017-09-04_mara_A5554AFF-B9FC-4139-945C-A7337F4DB79F ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-09-12_mara_B3515604-B02B-4A5B-9E5A-388E999A26B7][org_gcr_2017-09-12_mara_B3515604-B02B-4A5B-9E5A-388E999A26B7]]
     brew install sox --with-lame
     # org_gcr_2017-09-12_mara_B3515604-B02B-4A5B-9E5A-388E999A26B7 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-10-15_mara_56428EA5-AAEE-4E56-9A48-18EB1CE2742E][org_gcr_2017-10-15_mara_56428EA5-AAEE-4E56-9A48-18EB1CE2742E]]
     brew cask install deluge
     # org_gcr_2017-10-15_mara_56428EA5-AAEE-4E56-9A48-18EB1CE2742E ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-09-12_mara_D647A4C6-4296-4F49-A5CB-0FBAE77C1F8F][org_gcr_2017-09-12_mara_D647A4C6-4296-4F49-A5CB-0FBAE77C1F8F]]
     brew install mp3gain
     brew install normalize
     brew install mp3val
     brew install id3lib
     brew cask install mp3gain-express
     # org_gcr_2017-09-12_mara_D647A4C6-4296-4F49-A5CB-0FBAE77C1F8F ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2017-11-01_mara_0F91CE3D-3F59-4351-A0D3-AE383CC9BB47][org_gcr_2017-11-01_mara_0F91CE3D-3F59-4351-A0D3-AE383CC9BB47]]
     brew cask install isyncr
     # org_gcr_2017-11-01_mara_0F91CE3D-3F59-4351-A0D3-AE383CC9BB47 ends here

     # [[file:~/git/github/osx-provision/El-Capitan/provisioning.org::org_gcr_2018-03-17T09-54-29-05-00_mara_6945F43D-4026-4095-960A-D0AF0517FC79][org_gcr_2018-03-17T09-54-29-05-00_mara_6945F43D-4026-4095-960A-D0AF0517FC79]]
     brew install rsync
     # org_gcr_2018-03-17T09-54-29-05-00_mara_6945F43D-4026-4095-960A-D0AF0517FC79 ends here


<reponame>calculquebec/cip201-serveurs-calcul
#!/bin/bash

cd $HOME

if [ ! -d cq-formation-nbody ]; then
  git clone https://github.com/calculquebec/cq-formation-nbody.git
fi
cd cq-formation-nbody/solutions/openmp

module load gcc
sed -i 's/ -march=native//g' Makefile
make


(cd packages/core && npm run release)
(cd packages/angular && npm run release)
(cd packages/react && npm run release)
(cd packages/schematics && npm run release)


#!/usr/bin/sh

wormcom=/fs/ess/PCON0160/wormcommon
org=ce
WSnum=WS279
bowtie_idx=${wormcom}/${org}_${WSnum}/bowtie_index
tailor_idx=${wormcom}/${org}_${WSnum}/tailor_index
logs=/fs/ess/PCON0160/projects/cel-cbr/logs
pipeline_directory=/fs/ess/PCON0160/script-repo

echo """#!/bin/bash

if [ ! -d "${bowtie_idx}" ]; then
mkdir ${bowtie_idx}
fi

if [ ! -d "${tailor_idx}" ]; then
mkdir ${tailor_idx}
fi

genomic_fa=${wormcom}/${org}_${WSnum}/${org}_${WSnum}.genomic.fa
gtf_file=${wormcom}/${org}_${WSnum}/${org}_${WSnum}.coding_transcript.gtf
knownrna_fa=${wormcom}/${org}_${WSnum}/${org}_${WSnum}.rna.knownRNA.fa
junc_fa=${wormcom}/${org}_${WSnum}/${org}_${WSnum}.coding_transcript.juncs.fa
mrna_fa=${wormcom}/${org}_${WSnum}/${org}_${WSnum}.mRNA_transcripts.fa

#bowtie
cd ${bowtie_idx}
bowtie-build --quiet \${genomic_fa} ${org}_${WSnum}.genomic
bowtie-build --quiet \${knownrna_fa} ${org}_${WSnum}.knownRNA
bowtie-build --quiet \${junc_fa} ${org}_${WSnum}.coding_transcript.juncs
bowtie-build --quiet \${mrna_fa} ${org}_${WSnum}.mRNA_transcripts

#tailor
cd ${tailor_idx}
tailor build -f -i \${genomic_fa} -p ${org}_${WSnum}.genomic
tailor build -f -i \${junc_fa} -p ${org}_${WSnum}.juncs
""" > index_bowtie_tailor.sh

echo """#!/bin/bash

#SBATCH --time=01:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=16
#SBATCH --mem=64gb
#SBATCH --account=PCON0160

singularity exec ${pipeline_directory}/singularity/rnaseq bash index_bowtie_tailor.sbatch

""" > index_bowtie_tailor.sbatch

sbatch --job-name index_bowtie_tailor --output=${logs}/${org}_${WSnum}_bowtie_tailor_index.out index_bowtie_tailor.sbatch

##### ignore below ####
#star
#sjdbOverhang=49
#star_idx=${wormcom}/${org}_${WSnum}/${org}_${WSnum}_genomic_star_idx
#sbatch --job-name star_index_${org}_${WSnum} --output=${logs}/${org}_${WSnum}_STAR_index.out --export=star_idx=${star_idx},fasta=${genomic_fa},gtf=${gtf_file},sjdbOverhang=${sjdbOverhang} STAR_index.sh


#!/usr/bin/env bash

echo 'Copyright (c) 2017 MDStudio, VU Amsterdam'
echo 'In collaboration with Zefiros Software, www.zefiros.eu.'
echo ''
echo 'This container comes with some commands to make your work less complicated!'
echo ''
echo 'Usage:'
echo '    helpme          Show this'
echo '    update          Update pip packages'


#!/bin/bash
# FUNCTIONS
function callback {
    STATUS=$1
    MESSAGE=$2
    URL=$3
    UNIQUEID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
    if [ "$STATUS" = "SUCCESS" ]; then
        curl -s -X PUT -H 'Content-Type:' --data-binary "{\"Status\" : \"SUCCESS\",\"Reason\" : \"${!MESSAGE}\",\"UniqueId\" : \"${!UNIQUEID}\",\"Data\" :\"${!MESSAGE}\"}" ${!URL}
    else
        curl -s -X PUT -H 'Content-Type:' --data-binary "{\"Status\" : \"FAILURE\",\"Reason\" : \"${!MESSAGE}\",\"UniqueId\" : \"${!UNIQUEID}\",\"Data\" : \"${!MESSAGE}\"}" ${!URL}
    fi
}
# VARIABLES
PACKER_URL="https://releases.hashicorp.com/packer/1.3.3/packer_1.3.3_linux_amd64.zip"
GITHUB_REPO="https://github.com/j2clerck/amazon-metal-ami-builder.git"
ISO_URL="s3://clerckj/packer-windows/iso/Win10_1803_English_x64.iso"
PACKER_BUILD_FILE="windows_10.json"
BUILD_NAME="Windows_10"
BUILD_VERSION="20181212"
EC2_AVAIL_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
EC2_REGION=$(echo $EC2_AVAIL_ZONE | sed 's/[a-z]$//')
SIGNAL_URL="${rWaitHandle}"
# SETUP ENVIRONMENT
apt update
apt -y install unzip awscli nvme-cli git virtualbox jq
DEVICE=$(nvme list | grep Instance -m 1 | awk -F ' ' '{ print $1 }')
parted --script $DEVICE mklabel gpt
parted --script $DEVICE mkpart primary 0% 100%
sleep 5
mkfs.ext4 ${!DEVICE}p1
mkdir /opt/workdir/
mount ${!DEVICE}p1 /opt/workdir
cd /opt/workdir
wget --quiet $PACKER_URL
unzip packer_1.3.3_linux_amd64.zip
chmod +x packer
mv packer /usr/bin/
# DOWNLOAD PACKER BUILD CONFIGURATION
git clone $GITHUB_REPO
cd amazon-metal-ami-builder/packer/
aws s3 cp $ISO_URL ./iso/ --no-progress
if [ $? -ne 0 ]
then
    echo "Unable to download iso"
    callback "FAILURE" "Unable to download ISO" ${!SIGNAL_URL}
    exit 1
fi
# LAUNCH BUILD
packer build --only virtualbox-iso $PACKER_BUILD_FILE
if [ $? -ne 0 ]
then
    echo "Packer build failed"
    callback "FAILURE" "Unable to build with Packer" ${!SIGNAL_URL}
    exit 1
fi
# UPLOAD OUTPUT TO S3
aws s3 cp output-virtualbox-iso/*.ova s3://clerckj/vmimport/${!BUILD_NAME}_${!BUILD_VERSION}.ova
if [ $? -ne 0 ]
then
    echo "Upload to S3 failed"
    callback "FAILURE" "Unable to upload to S3" ${!SIGNAL_URL}
    exit 1
fi
# LAUNCH VM IMPORT
cat << EOF > disk.json
[
{
    "Description": "Windows10",
    "Format": "ova",
    "UserBucket": {
    "S3Bucket": "clerckj",
    "S3Key": "vmimport/${!BUILD_NAME}_${!BUILD_VERSION}.ova"
    }
}
]
EOF
ImportTaskId=$(aws ec2 import-image --architecture x86_64 --description "Import packer build of ${!BUILD_NAME}_${!BUILD_VERSION}" --license-type BYOL --platform Windows --disk-containers file://disk.json --output json --region $EC2_REGION | jq -r .ImportTaskId)
if [ $? -ne 0 ]
then
    echo "Start import task failed"
    callback "FAILURE" "Unable to start import task" ${!SIGNAL_URL}
    exit 1
fi
echo "Task id is ${!ImportTaskId}. Run aws ec2 describe-import-image-tasks --import-task-ids ${!ImportTaskId} --region ${!EC2_REGION}"
callback "SUCCESS" "Build complete" ${!SIGNAL_URL}


<reponame>ignitialio/iio-services
#!/bin/sh

#export DEBUG=iios:*
export KV_STORE_MODE=false
export IIOS_NAMESPACE=testings
docker-compose up > test/logs/test-services-http.log 2>&1 &
sleep 30
docker-compose stop
docker-compose rm -f


#!/bin/sh

echo "CONFIG = <<CONFIG>>"

echo PWD: `pwd` > /tmp/test-command-output
echo $1 > $2

echo "SUCCESS"

exit 0


<reponame>OBITORASU/packages
#!/bin/bash

export LIBRARY_LICENSES=" ./zlib-1.2.11/LICENSE"
export LIBRARY_COPY_TO_LIB="$pfx/lib/libminizip.so*"


<reponame>rovere/utilities
#! /bin/bash

RELEASE=$1
[ "$RELEASE" ] || exit 1

[ "$CVSROOT" ] || CVSROOT=":pserver:<EMAIL>:/local/reps/CMSSW"
HLTNAME=$(cvs -d $CVSROOT co -p -r $RELEASE Configuration/HLT/python/autoHLT.py | grep "'relval'" | cut -d"'" -f4)
[ "$HLTNAME" ] || HLTNAME="GRun"
HLTMENU=$(cvs -d $CVSROOT co -p -r $RELEASE HLTrigger/Configuration/python/HLT_${HLTNAME}_cff.py 2> /dev/null | head -n1 | cut -c 3-)
AUTOCOND=$(cvs -d $CVSROOT co -p -r $RELEASE Configuration/AlCa/python/autoCond.py)
GLOBALTAG=$(echo "$AUTOCOND" | grep "'startup'" | cut -d"'" -f4)

echo "RelVal configuration for release $RELEASE"
echo -e "HLT menu ($HLTNAME):\t$HLTMENU"
echo -e "GlobalTag (startup):\t$GLOBALTAG"

# extract any additional condition payloads
{
  echo "$AUTOCOND"
  cat << @EOF
if 'startup_$HLTNAME' in autoCond:
  for line in autoCond['startup_$HLTNAME'][1:]:
    print '\t%s' % line

@EOF
} | python

echo


<reponame>Apop85/Scripts
#!/bin/bash
# -*- coding:utf-8 -*-

####
# File: sync_folder.sh
# Project: Modul 122
#-----
# Created Date: Saturday 01.02.2020, 10:58
# Author: Apop85
#-----
# Last Modified: Saturday 01.02.2020, 13:21
#-----
# Copyright (c) 2020 Apop85
# This software is published under the MIT license.
# Check http://www.opensource.org/licenses/MIT for further informations
#-----
# Description: Dieses Script vergleicht den Inhalt von zwei Ordnern und synchronisiert diese
####

readonly SOURCE_PATH="/home/apop85"             # Pfad des Quellordners
readonly TARGET_PATH="/synced_folder"           # Pfad des Zielordners

function read_directories() {
    # Funktion zum rekursiven Auslesen der Pfade
    # Lese Parameter aus
    local current_folder=$1
    local target_folder=$2
    declare -a local file_array=$(ls $current_folder)

    # Unterscheide zwischen Ordnern und Dateien durch aufruf der Funktion check_files
    local return_array=$(check_files "$current_folder" "${file_array[*]}")
    # Splitte return_array auf files = alles vor dem @ und folders alles danach
    declare -a local folders=$(echo $return_array | sed -e "s/@.*//g")
    declare -a local files=$(echo $return_array | sed -e "s/.*@//g")
    # Synchronisiere aktuellen Ordner
    sync_folder "$current_folder" "$target_folder" "${files[*]}" "${folders[*]}"

    # Prüfe alle Unterordner sofern vorhanden
    local subfolder=
    if [[ "${folders[*]}" != "" ]]; then
        for subfolder in ${folders[*]}; do
            # Rekursiver Funktionsaufruf mit neuem Quell- und Zielverzeichnis als Parameter
            read_directories "$current_folder/$subfolder" "$target_folder/$subfolder"
        done
    fi

    return
}

function check_files() {
    # Nehme Parameter entgegen
    declare -a local current_path=$1
    declare -a local file_array=$2
    # Definiere Lokale Variablen
    declare -a local folder_array=
    declare -a local new_file_array=
    local localfile=""
    # Prüfe ob Eintrag ein Ordner oder ein File ist
    for localfile in ${file_array[*]}; do
        if [ -d $current_path/$localfile ]; then
            # Ist der Eintrag ein Ordner, füge diesen in das Ordnerarray ein
            folder_array+=("$localfile")
        else
            # Ist der Eintrag eine Datei, füge diese in das Dateiarray ein
            new_file_array+=("$localfile")
        fi
    done
    # Bereite Werte zur Übergabe vor
    local return_value=${folder_array[*]}@${new_file_array[*]}
    echo $return_value
    return
}

function sync_folder() {
    # Nehme Parameter entgegen
    local current_folder=$1
    local target_folder=$2
    declare -a local file_array=$3
    declare -a local folder_array=$4

    # Erstelle Ordner falls diese noch nicht existieren
    local folder_name=
    for folder_name in ${folder_array[*]}; do
        if [ ! -d $target_folder/$folder_name ]; then
            mkdir $target_folder/$folder_name
            echo -e "\e[7mINFORMATION:\e[0m Ordner \e[93m$folder_name\e[0m in \e[92m$target_folder\e[0m erstellt"
        fi
    done

    # Synchronisiere Dateien
    local file_name=
    for file_name in ${file_array[*]}; do
        # Prüfe ob Datei im Zielverzeichnis bereits existiert
        if [ ! -f $target_folder/$file_name ]; then
            # Falls nicht, kopiere Datei in Zielverzeichnis
            cp $current_folder/$file_name $target_folder/$file_name
            echo -e "\e[7mINFORMATION:\e[0m Datei \e[93m$file_name\e[0m wurde in \e[92m$target_folder\e[0m erstellt"
        else
            # Falls schon, lese Hash-Werte aus
            source_file_sha512=$(sha512sum $current_folder/$file_name | awk '{print $1}')
            target_file_sha512=$(sha512sum $target_folder/$file_name | awk '{print $1}')

            # Stimmen die Hashwerte nicht überein, Prüfe welche datei neuer ist.
            if [[ ${source_file_sha512} != ${target_file_sha512} ]]; then
                # Ist die Datei im Ursprungsordner neuer,
                if [ $current_folder/$file_name -nt $target_folder/$file_name ]; then
                    # dann ersetze die Datei im Zielverzeichnis
                    rm $target_folder/$file_name
                    cp $current_folder/$file_name $target_folder/$file
                    echo -e "\e[7mINFORMATION:\e[0m Datei \e[93m$file_name\e[0m wurde in \e[92m$target_folder\e[0m aktualisiert"
                else
                    # sonst ersetze die Datei im Ursprungsverzeichnis
                    rm $current_folder/$file_name
                    cp $target_folder/$file_name $current_folder/$file
                    echo -e "\e[7mINFORMATION:\e[0m Datei \e[93m$file_name\e[0m wurde in \e[92m$current_folder\e[0m aktualisiert"
                fi
            fi
        fi
    done
}

# Synchronisiere von Quell- zu Zielverzeichnis
echo -e "\e[102m\e[30mSYNC: \e[91m\e[1m$SOURCE_PATH ==> $TARGET_PATH\e[0m"
read_directories $SOURCE_PATH $TARGET_PATH
# Synchronisiere von Ziel- zu Quellverzeichnis
echo -e "\e[102m\e[30mSYNC: \e[91m\e[1m$SOURCE_PATH <== $TARGET_PATH\e[0m"
read_directories $TARGET_PATH $SOURCE_PATH


#!/bin/bash
yum update -y
yum install -y vim git
apt-get update
apt-get install -y vim-nox git
git config --global user.name "<NAME>"
git config --global user.email <EMAIL>
cd ~
git clone https://github.com/KSubedi/vim-config.git
mv vim-config .vim
cd .vim
mkdir bundle
cd bundle
rm -rf *
git clone https://github.com/Shougo/neobundle.vim


#!/bin/sh

# Name of the POD to exec into
POD_NAME=$1
if [ "x" == "x$POD_NAME" ] ; then
    echo "Error: Supply the pod name on the command line before any other arguments."
    exit 1
fi

shift
/opt/mpi/bin/kubectl exec ${POD_NAME} -- /bin/sh -c "$*"


# Split file into clade specific files
mkdir Pangenome_calculation/Pangenome_overlap/ # Make directory
./Scripts/transposePangenome.R # Transpose the pangenome table
head -1 Pangenome_calculation/Pangenome_overlap/Transposed_right.txt > Pangenome_calculation/Pangenome_overlap/Symbiotic_transposed.txt # Print cluster names
grep -f 'Output_files/symbioticClade.txt' Pangenome_calculation/Pangenome_overlap/Transposed_right.txt | sort -u >> Pangenome_calculation/Pangenome_overlap/Symbiotic_transposed.txt # Get strains of interest
head -1 Pangenome_calculation/Pangenome_overlap/Transposed_right.txt > Pangenome_calculation/Pangenome_overlap/Non_symbiotic_transposed.txt # Print cluster names
grep -f 'Output_files/nonSymbioticClade.txt' Pangenome_calculation/Pangenome_overlap/Transposed_right.txt | sort -u >> Pangenome_calculation/Pangenome_overlap/Non_symbiotic_transposed.txt # Get strains of interest

# Determine core and accessory genome overlap
./Scripts/pangenomeOverlap.R # Determine overlaps

# Prepare gene accumulation curves, distance matrix, and PCA
./Scripts/pangenomeSummaryFigures.R # Make these figures

# Move output
cp Pangenome_calculation/Pangenome_overlap/core_genome_overlap.svg Output_files/coreGenomeOverlap.svg # Move file
cp Pangenome_calculation/Pangenome_overlap/accessory_genome_overlap_2.svg Output_files/accessryGenomeOverlap1.svg # Move file
cp Pangenome_calculation/Pangenome_overlap/accessory_genome_overlap_10.svg Output_files/accessoryGenomeOverlap2.svg # Move file
cp Pangenome_calculation/Pangenome_overlap/gene_accumulation_plots.svg Output_files/geneAccumulationPlots.svg # Move file
cp Pangenome_calculation/Pangenome_overlap/accessory_genome_tree.tre Output_files/pangenomeTree.tre # Move file
cp Pangenome_calculation/Pangenome_overlap/pca_plot.svg Output_files/pangenomePca1.svg # Move file
cp Pangenome_calculation/Pangenome_overlap/pca_plot_2.svg Output_files/pangenomePca2.svg # Move file


#!/bin/bash

set -e

dataImage=$1
lifetime=$2
useMasking=$3

shift 3

if [[ -z "$SPAWNCTL_ACCESS_TOKEN" ]]; then
    echo "SPAWNCTL_ACCESS_TOKEN is not set"
    exit 1
fi

if [ $useMasking != "true" ] && [ "$useMasking" != "false" ]; then
  echo "masking must be set to either 'true' or 'false'. Received: $useMasking"
  exit 1
fi

newDcName=$(spawnctl create data-container --image "$dataImage" --lifetime $lifetime $@ -q)
jsonOutput=$(spawnctl get data-container $newDcName -o json)
host=$(echo $jsonOutput | jq -r '.host')
port=$(echo $jsonOutput | jq -r '.port')
username=$(echo $jsonOutput | jq -r '.user')
password=$(echo $jsonOutput | jq -r '.password')

echo ::set-output name=dataContainerName::"$newDcName"
echo ::set-output name=dataContainerHost::"$host"

if [ "$useMasking" = "true" ]; then
  echo ::add-mask::$port
fi
echo ::set-output name=dataContainerPort::"$port"

if [ "$useMasking" = "true" ]; then
  echo ::add-mask::$username
fi
echo ::set-output name=dataContainerUsername::"$username"

if [ "$useMasking" = "true" ]; then
  echo ::add-mask::$password
fi
echo ::set-output name=dataContainerPassword::"$password"


<gh_stars>0
#!/bin/bash

# remove dump
rm -rf "${WORK_DIR}/pgdump/${POSTGRES_BACKUP_NAME}"


#!/bin/bash
#-----------------------------------------------------------------------------
#
# package       : glpk
# Version       : 4.60
# Source repo   : https://ftp.gnu.org/gnu/glpk/
# Tested on     : rhel_7.3
# Script License: Apache License, Version 2 or later
# Maintainer    : <NAME> <<EMAIL>>
#
# Disclaimer: This script has been tested in non-root mode on given
# ==========  platform using the mentioned version of the package.
#             It may not work as expected with newer versions of the
#             package and/or distribution. In such case, please
#             contact "Maintaine" of this script.
#
# ----------------------------------------------------------------------------

# Update Source
sudo yum update -y

# gcc dev tools
sudo yum groupinstall 'Development Tools' -y

# install dependencies
sudo yum install glibc-2.17-157.el7.ppc64le -y

# download and unpack
wget https://ftp.gnu.org/gnu/glpk/glpk-4.60.tar.gz
tar -xzvf glpk-4.60.tar.gz
cd glpk-4.60

# make
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-ppc64le-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-ppc64le-redhat-linux/cloog-install --enable-gnu-indirect-function --enable-secureplt --with-long-double-128 --enable-targets=powerpcle-linux --disable-multilib --with-cpu-64=power7 --with-tune-64=power8 --build=ppc64le-redhat-linux
make
sudo make install


<gh_stars>0
#!/bin/sh
################################################################################
#
#  Copyright (C) 2020 <NAME>
#  This file is part of the beachfronter repo - https://github.com/eigendude/beachfronter
#
#  Copyright (C) 2017 Centricular Ltd.
#  This file is derived from the GST webrtc example available under the BSD
#  2-Clause license:
#  https://gitlab.freedesktop.org/gstreamer/gst-examples/-/tree/master/webrtc
#
#  SPDX-License-Identifier: Apache-2.0 AND BSD-2-Clause
#  See the file LICENSE.txt for more information.
#
################################################################################

#
# Simple script to generate SSL certs.
#
# Output:
#
#   - cert.pem - The generated cert
#   - key.pem - The generated private key
#

BASE_DIR=$(dirname $0)

OUTDIR=""
if [ $# -eq 1 ]; then
  OUTDIR=$1/
fi

output=$(openssl req -x509 -newkey rsa:4096 -keyout ${OUTDIR}key.pem -out ${OUTDIR}cert.pem -days 365 -nodes -subj "/CN=example.com" 2>&1)

ret=$?
if [ ! $ret -eq 0 ]; then
  echo "${output}" 1>&2
  exit $ret
fi


#!/bin/bash

SRC_PATH=$(dirname $(readlink -f $0))
INSTALL_PATH=/var/www/beer
WWW_USER=www-data
WWW_GROUP=www-data

# Check we are root
if [ $UID != 0 ]; then
  echo "You must run this script as root!"
  exit 1
fi

# Stop webserver if running
service apache2 stop

# Install prerequisites
source $SRC_PATH/scripts/prerequisites.sh

# Deploy webserver settings (and set correct path)
cp scripts/beer.vhost /etc/apache2/sites-available/
sed -i "s|@INSTALL_PATH@|${INSTALL_PATH}|g" /etc/apache2/sites-available/beer.vhost
rm -f /etc/apache2/sites-enabled/000-default
ln -s /etc/apache2/sites-available/beer.vhost /etc/apache2/sites-enabled/000-default

# Deploy code and scripts
echo "Deploying into $INSTALL_PATH..."
FRESH_INSTALL=1
if [ -d $INSTALL_PATH ]; then
  read -p "Completely blat existing installation and its venv? " -n 1 -r
  if [[ $REPLY =~ ^[Yy]$ ]]; then
    rm -rf $INSTALL_PATH
  else
    FRESH_INSTALL=0
  fi
fi

INSTALL_VENV=0
if [ $FRESH_INSTALL -eq 1 ]; then
  # Create from scratch
  echo "Creating fresh install in $INSTALL_PATH..."
  mkdir $INSTALL_PATH
  chmod g+s $INSTALL_PATH
  INSTALL_VENV=1
else
  # Delete everything but the venv (takes forever to copy)
  echo "Removing old project files but leaving the venv in $INSTALL_PATH...."
  cd $INSTALL_PATH
  rm -rf $(ls * | grep -v venv)
fi

# Copy Django project
cp -r $SRC_PATH/beer/* $INSTALL_PATH

if [ $INSTALL_VENV -eq 1 ]; then
  # Install venv
  cd $INSTALL_PATH
  source ./create_venv.sh
fi

# Fix permissions
chown -R $WWW_USER:$WWW_GROUP $INSTALL_PATH

# Enable the server
service apache2 start


<gh_stars>1-10
#!/bin/bash
echo "enter sudo your password"
sudo echo "thanks"

# I will get to building webkit from source, looks hard so far.
# Build gtkwebkit from source
#sudo apt -y install bison gperf ilibcairo2-dev libgcrypt20-dev libgtk-3-dev
#mkdir -p $HOME/external/webkitgtk
#cd $HOME/external/webkitgtk
#wget https://webkitgtk.org/releases/webkitgtk-2.15.2.tar.xz
#tar -xzf webkitgtk-2.15.2.tar.xz
#cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo
#make -j`nproc`
#sudo make install

# Install gtkwebkit instead
sudo apt -y install libwebkitgtk-dev

mkdir -p $HOME/external/surf
cd $HOME/external/surf
git clone http://git.suckless.org/surf .

mkdir -p $HOME/.surf
ln -s $HOME/.surf/config.h $HOME/external/surf/config.h

make

ln -s $HOME/external/surf/surf $HOME/bin/surf


<gh_stars>0
#!/bin/bash

set -e
set -x

LANG=C xdg-user-dirs-gtk-update

gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"

gsettings set org.gnome.desktop.interface font-name 'Noto Sans CJK JP 11'

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true


#
# Distro Installer - Example
# Author: Asura
# Created: 2021-06-22 1607H, Asura
# Modified:
#	- 2021-06-22 1607H, Asura
#	- 2021-06-22 2112H, Asura
#	- 2021-06-22 2136H, Asura
# 	- 2021-06-22 2153H, Asura
#	- 2021-06-23 1403H, Asura
#	- 2021-06-23 1620H, Asura
# Features:
# Background Information:
#	Example script
# 	all-in-one paragraph install script to test
# 	the functions
# Changelog:
#	- 2021-06-22 1607H, Asura :
#		- Created script file
#	- 2021-06-22 2112H, Asura :
#		- Added quotation marks in line 127 - 131
#		- Fixed typo : ' timedatct -> timedatectl '
#	- 2021-06-22 2136H, Asura :
#		- Added completion comments
#	- 2021-06-22 2153H, Asura :
#		- Begin to sanitize and make the program modular
#	- 2021-06-23 1404H, Asura :
#		- Fixed typo in bootloader - grub
#	- 2021-06-23 1620H, Asura :
#		- Created /boot/grub only in grub bootloader install section
# NOTE:
#	- Please do not run this without verifying very carefully, the following details
#		1. Device name (i.e. /dev/sdX)
#

# --- Variables
PROGRAM_SCRIPTNAME="example"
PROGRAM_NAME="Example Install script"
PROGRAM_TYPE="Main"
MODE="DEBUG" # { DEBUG | RELEASE }
DISTRO="ArchLinux" # { ArchLinux | Debian | NixOS | Void Linux | Gentoo }

# --- Functions

# General Functions

# Main functions
init()
{
	#
	# On Runtime initialization
	#	- When program initialized
	#
	echo "Program Name: $PROGRAM_NAME"
	echo "Running on  : $DISTRO"
}

body()
{
	#
	# Main function to run
	#

	# --- Input

	# Command Line Arguments
	argv=("$@")
	argc="${#argv[@]}"

	# Local Variables
	dev_Name=/dev/sdb
	architecture="i386-pc"
	bootloader="grub"

	# --- Processes

	echo "# ======================== #"
	echo "# Stage 1 : Check internet #"
	echo "# ======================== #"
	ping -c 5 8.8.8.8 # Make 5 connections, if successful - return 0
	res="$?"
	case "$res" in
		"0")
			# Success
			echo "Internet is up"
			;;
		*)
			# Error
			echo "Error with internet, activating dhcpcd..."
			sudo dhcpcd
			;;
	esac

	echo "# ========================== #"
	echo "# Stage 2 : Verify boot mode #"
	echo "# ========================== #"
	efivars="$(ls /sys/firmware/efi/efivars)"
	case "$efivars" in
		"0")
			# Success
			echo "Boot Mode: EFI"
			;;
		*)
			# Error
			echo "Boot Mode: MBR"
			;;
	esac

	echo ""

	echo "# ========================== #"
	echo "# Stage 3 : Set System Clock #"
	echo "# ========================== #"
	timedatectl set-ntp true
	timedatectl status

	echo ""

	echo "# ====================== #"
	echo "# Stage 4 : Partitioning #"
	echo "# ====================== #"
	echo ""
	parted $dev_Name mklabel msdos
	echo "Disk Label: [msdos] Created"
	echo ""
	parted $dev_Name mkpart primary ext4 0% 1024MiB
	echo "Partition 1: Created."
	echo ""
	mkfs.ext4 "$dev_Name"1
	echo "Partition 1: Formatted to ext4"
	echo ""
	parted $dev_Name set 1 boot on
	echo "Partition 1: Bootable Enabled"
	echo ""
	echo "Partition 1 Completed."
	parted $dev_Name mkpart primary ext4 1024MiB 32768MiB
	echo "Partition 2: Created."
	echo ""
	mkfs.ext4 "$dev_Name"2
	echo "Partition 2: Formatted to ext4"
	echo ""
	echo "Partition 2 Completed."
	parted $dev_Name mkpart primary ext4 32768MiB 100%
	echo "Partition 3: Created."
	echo ""
	mkfs.ext4 "$dev_Name"3
	echo "Partition 3: Formatted to ext4"
	echo ""
	echo "Partition 3 Completed."
	echo ""
	echo "======================="
	echo "Partitioning Completed."
	echo "======================="

	echo ""

	echo "# ===================== #"
	echo "# Stage 5 : Mount Disks #"
	echo "# ===================== #"
	mount "$dev_Name"2 /mnt
	mkdir -p /mnt/home
	mkdir -p /mnt/boot
	mount "$dev_Name"1 /mnt/home
	mount "$dev_Name"3 /mnt/boot
	echo "======================"
	echo "Disk Mounted"
	echo " "$dev_Name"1 : /mnt/boot"
	echo " "$dev_Name"2 : /mnt"
	echo " "$dev_Name"3 : /mnt/home"
	echo "======================"

	echo ""

	echo "# ================== #"
	echo "# Stage 6 : pacstrap #"
	echo "# ================== #"
	pacstrap /mnt base linux linux-firmware nano vim base-devel networkmanager linux-lts linux-lts-headers
	echo "==============================="
	echo "Package strapped to mount point"
	echo "==============================="

	echo ""

	echo "# ======================== #"
	echo "# Stage 7 : Generate Fstab #"
	echo "# ======================== #"
	genfstab -U /mnt >> /mnt/etc/fstab
	echo "============================"
	echo "File Systems Table Generate."
	echo "============================"

	echo ""

	echo "# ================ #"
	echo "# Stage 8 : Chroot #"
	echo "# ================ #"

	arch-chroot /mnt /bin/bash -c "echo \"# ================================= #\""
	arch-chroot /mnt /bin/bash -c "echo \"# 8.i. Symlink Regional locale time #\""
	arch-chroot /mnt /bin/bash -c "echo \"# ================================= #\""
	arch-chroot /mnt /bin/bash -c "ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime"

	arch-chroot /mnt /bin/bash -c "echo \"# ==================================== #\""
	arch-chroot /mnt /bin/bash -c "echo \"# 8.ii. Set hardware clock (sync time) #\""
	arch-chroot /mnt /bin/bash -c "echo \"# ==================================== #\""
	arch-chroot /mnt /bin/bash -c "hwclock --systohc"

	arch-chroot /mnt /bin/bash -c "echo \"# ================= #\""
	arch-chroot /mnt /bin/bash -c "echo \"# 8.iii. Set Locale #\""
	arch-chroot /mnt /bin/bash -c "echo \"# ================= #\""
	arch-chroot /mnt /bin/bash -c "echo \"Locale: en_SG.UTF-8\""
	# arch-chroot /mnt /bin/bash -c "vim /etc/locale.gen" # --- Removed to Test out line 176
	arch-chroot /mnt /bin/bash -c "sed -i '/en_SG.UTF-8/s/^#//g' /etc/locale.gen"
	arch-chroot /mnt /bin/bash -c "locale-gen"
	arch-chroot /mnt /bin/bash -c "echo \"LANG=en_SG.UTF-8\" | tee -a /etc/locale.conf"

	arch-chroot /mnt /bin/bash -c "echo \"# =============================== #\""
	arch-chroot /mnt /bin/bash -c "echo \"# 8.iv. Set Network Configuration #\""
	arch-chroot /mnt /bin/bash -c "echo \"# =============================== #\""
	arch-chroot /mnt /bin/bash -c "echo \"ArchLinux\" | tee -a /etc/hostname"
	arch-chroot /mnt /bin/bash -c "echo \"127.0.0.1 localhost\" | tee -a /etc/hosts"
	arch-chroot /mnt /bin/bash -c "echo \"::1       localhost\" | tee -a /etc/hosts"
	arch-chroot /mnt /bin/bash -c "echo \"127.0.1.1 ArchLinux.localdomain ArchLinux\" | tee -a /etc/hosts"

	arch-chroot /mnt /bin/bash -c "echo \"# ==================================== #\""
	arch-chroot /mnt /bin/bash -c "echo \"# 8.v. Make Initial Ramisk Environment #\""
	arch-chroot /mnt /bin/bash -c "echo \"# ==================================== #\""
	arch-chroot /mnt /bin/bash -c "mkinitcpio -P"

	arch-chroot /mnt /bin/bash -c "echo \"# ========================== #\""
	arch-chroot /mnt /bin/bash -c "echo \"# 8.vi. Change Root Password #\""
	arch-chroot /mnt /bin/bash -c "echo \"# ========================== #\""
	arch-chroot /mnt /bin/bash -c "passwd"

	case "$bootloader" in
		"grub")
			arch-chroot /mnt /bin/bash -c "echo \"# ========================= #\""
			arch-chroot /mnt /bin/bash -c "echo \"# echo \"Bootloader: Grub\" #\""
			arch-chroot /mnt /bin/bash -c "echo \"# ========================= #\""
			arch-chroot /mnt /bin/bash -c "mkdir -p /boot/grub"
			arch-chroot /mnt /bin/bash -c "sudo pacman -S grub"
			arch-chroot /mnt /bin/bash -c "grub-install --target=$architecture --debug $dev_Name"
			arch-chroot /mnt /bin/bash -c "grub-mkconfig -o /boot/grub/grub.cfg"
			;;
		*)
			echo "Invalid Bootloader"
			;;
	esac
	echo "==========================="
	echo "Chroot processes completed."
	echo "==========================="

	echo ""

	echo "# =========================== #"
	echo "# Stage 9 : Post-Installation #"
	echo "# =========================== #"
	# TBC

	echo ""

	echo "================================"
	echo "ArchLinux Installation Complete."
	echo "Please Restart your Computer."
	echo "================================"

	# --- Output
}

function END()
{
    line=""
    read -p "Pause" line
}

function main()
{
	#
	# Main Function
	#  - You may not edit this if you want to leave it as default
	#

	body "$@"
	res="$?"
	echo "$res"
}

if [[ "${BASH_SOURCE[@]}" == "${0}" ]]; then
    # START
    init
	main "$@"
    END
fi


<reponame>PacktPublishing/Bash-Quick-Start-Guide
while read -r hostname ; do
    ssh -- "$hostname" uptime
done < hostnames


#!/bin/bash

#http://anionix.ddns.net/dists/jessie-64k/main/binary-armhf/

dpkg -i htop_1.0.3-1_armhf.deb

dpkg -i libgcc1-dbg_4.9.2-10_armhf.deb
dpkg -i libstdc++6_4.9.2-10_armhf.deb
dpkg -i libstdc++6-4.9-dbg_4.9.2-10_armhf.deb
dpkg -i incron_0.5.10-2_armhf.deb

#uncomment the following lines to install transmission bittorent client
#dpkg -i libsystemd0_215-17+deb8u3_armhf.deb
#dpkg -i libminiupnpc10_1.9.20140610-2_armhf.deb
#dpkg -i libnatpmp1_20110808-3_armhf.deb
#dpkg -i transmission-cli_2.84-0.2_armhf.deb
#dpkg -i transmission-common_2.84-0.2_all.deb
#dpkg -i transmission-daemon_2.84-0.2_armhf.deb


<gh_stars>0
#!/bin/bash

function lk_list_user_homes() {
    if ! lk_is_macos; then
        getent passwd | awk -F: -v OFS=$'\t' '{print $1, $6}'
    else
        dscl . list /Users NFSHomeDirectory | awk -v OFS=$'\t' '{print $1, $2}'
    fi
}

function lk_list_group_ids() {
    if ! lk_is_macos; then
        getent group | awk -F: -v OFS=$'\t' '{print $1, $3}'
    else
        dscl . list /Groups PrimaryGroupID | awk -v OFS=$'\t' '{print $1, $2}'
    fi
}

function lk_group_exists() {
    lk_list_group_ids | cut -f1 | grep -Fx "$1" >/dev/null
}

# lk_user_add_sftp_only USERNAME [SOURCE_DIR TARGET_DIR]...
function lk_user_add_sftp_only() {
    local LK_SUDO=1 FILE REGEX MATCH CONFIG _HOME DIR GROUP TEMP \
        LK_FILE_REPLACE_NO_CHANGE SFTP_ONLY=${LK_SFTP_ONLY_GROUP:-sftp-only}
    [ -n "${1-}" ] || lk_usage "\
Usage: $FUNCNAME USERNAME [SOURCE_DIR TARGET_DIR]..." || return
    lk_group_exists "$SFTP_ONLY" || {
        lk_tty_print "Creating group:" "$SFTP_ONLY"
        lk_run_detail lk_elevate groupadd "$SFTP_ONLY" || return
    }
    lk_tty_print "Checking SSH server"
    FILE=/etc/ssh/sshd_config
    REGEX=("[mM][aA][tT][cC][hH]" "[gG][rR][oO][uU][pP]")
    MATCH="^($S*#)?$S*($REGEX|\"$REGEX\")($S+|$S*=$S*)"
    CONFIG="\
Match Group $SFTP_ONLY
ForceCommand internal-sftp
ChrootDirectory %h"
    lk_file_keep_original "$FILE"
    lk_file_replace "$FILE" < <(awk \
        -v "BLOCK=$CONFIG" \
        -v "FIRST=$MATCH(${REGEX[1]}|\"${REGEX[1]}\")$S+(${SFTP_ONLY}|\"${SFTP_ONLY}\")$S*$" \
        -v "BREAK=$MATCH" \
        -f "$LK_BASE/lib/awk/block-replace.awk" "$FILE")
    ! lk_is_false LK_FILE_REPLACE_NO_CHANGE ||
        lk_run_detail lk_elevate systemctl restart ssh.service
    if lk_user_exists "$1"; then
        lk_confirm "Configure existing user '$1' for SFTP-only access?" Y &&
            lk_run_detail lk_elevate \
                usermod --shell /bin/false --groups "$SFTP_ONLY" --append "$1"
    else
        lk_tty_print "Creating user:" "$1"
        lk_run_detail lk_elevate \
            useradd --create-home --shell /bin/false --groups "$SFTP_ONLY" "$1"
    fi || return
    _HOME=$(lk_user_home "$1") && lk_elevate_if_error test -d "$_HOME" ||
        lk_warn "invalid home directory: $_HOME" || return
    [ $# -lt 3 ] ||
        _LK_USER_HOME=$_HOME lk_user_bind_dir "$@" || return
    DIR=$_HOME/.ssh
    FILE=$DIR/authorized_keys
    GROUP=$(id -gn "$1") &&
        lk_install -d -m 00755 -o root -g root "$_HOME" &&
        lk_install -d -m 00700 -o "$1" -g "$GROUP" "$DIR" &&
        lk_install -m 00600 -o "$1" -g "$GROUP" "$FILE" || return
    lk_elevate test -s "$FILE" || {
        lk_tty_print "Generating SSH key for user '$1'"
        TEMP=/tmp/$FUNCNAME-$1-id_rsa
        ssh-keygen -t rsa -b 4096 -N "" -q -C "$1@$(lk_hostname)" -f "$TEMP" &&
            lk_elevate cp "$TEMP.pub" "$FILE" &&
            lk_tty_file "$TEMP" || return
        lk_console_warning "${LK_BOLD}WARNING:$LK_RESET \
this private key ${LK_BOLD}WILL NOT BE DISPLAYED AGAIN$LK_RESET"
    }
}

function lk_user_bind_dir() {
    local LK_SUDO=1 _USER=${1-} _HOME=${_LK_USER_HOME-} TEMP TEMP2 \
        SOURCE TARGET FSROOT TARGETS=() STATUS=0
    # Skip these checks if _LK_USER_HOME is set
    [ -n "$_HOME" ] || {
        lk_user_exists "$_USER" || lk_warn "user not found: $_USER" || return
        _HOME=$(lk_user_home "$1") && lk_elevate_if_error test -d "$_HOME" ||
            lk_warn "invalid home directory: $_HOME" || return
    }
    shift
    lk_tty_print "Checking bind mounts for user '$1'"
    lk_command_exists findmnt || lk_warn "command not found: findmnt" || return
    TEMP=$(lk_mktemp_file) && TEMP2=$(lk_mktemp_file) &&
        lk_delete_on_exit "$TEMP" "$TEMP2" || return
    lk_elevate_if_error cp /etc/fstab "$TEMP"
    while [ $# -ge 2 ]; do
        SOURCE=$1
        TARGET=$2
        shift 2
        [[ $TARGET == /* ]] || TARGET=$_HOME/$TARGET
        [[ $TARGET == $_HOME/* ]] ||
            lk_warn "target not in $_HOME: $TARGET" || return
        lk_elevate_if_error test -d "$SOURCE" ||
            lk_warn "source directory not found: $SOURCE" || return
        while :; do
            FSROOT=$(lk_elevate findmnt -no FSROOT -M "$TARGET") ||
                { FSROOT= && break; }
            lk_elevate test ! "$FSROOT" -ef "$SOURCE" || break
            lk_console_warning "Already mounted at $TARGET:" \
                "$(lk_elevate findmnt -no SOURCE -M "$TARGET")"
            lk_confirm "OK to unmount?" Y &&
                lk_run_detail lk_elevate umount "$TARGET" || return
        done
        [ -n "$FSROOT" ] || {
            lk_install -d -m 00755 -o root -g root "$TARGET" || return
            TARGETS[${#TARGETS[@]}]=$TARGET
        }
        awk -v "source=$SOURCE" -v "target=$TARGET" -v OFS=$'\t' '
function maybe_print() { if (source) {
    print source, target, "none", "bind", 0, 0; source = ""
} }
{ sub(/^[[:blank:]]*/, "") }
/^[^#]/ && $2 == target { maybe_print(); next }
{ print }
END { maybe_print() }' "$TEMP" >"$TEMP2" && cp "$TEMP2" "$TEMP" || return
    done
    lk_elevate findmnt -F "$TEMP" --verify &>"$TEMP2" ||
        lk_pass cat "$TEMP2" >&2 ||
        lk_pass lk_delete_on_exit_withdraw "$TEMP" ||
        lk_warn "invalid fstab: $TEMP" || return
    lk_file_replace -m -f "$TEMP" /etc/fstab
    for TARGET in ${TARGETS+"${TARGETS[@]}"}; do
        lk_run_detail lk_elevate mount --target "$TARGET" || STATUS=$?
    done
}


<gh_stars>0
# See https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[magenta]%} "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="?"
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[red]%}+%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_MODIFIED="m" # TODO
ZSH_THEME_GIT_PROMPT_RENAMED="↺"
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_STASHED="$"
ZSH_THEME_GIT_PROMPT_UNMERGED="U" # TODO
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="↑"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="↓"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="⇅"
ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="%{$fg[green]%}=%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

# See https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh#L2
function git_prompt_info2() {
  local ref
  if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then
    ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
    ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
    echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
  fi
}

function prompt_dynamic_section {
  local git_status="$(git_prompt_info) $(git_remote_status)"
	local dprompt=""

	if [ "$git_status" != " " ]; then
    dprompt+="%{$fg[white]%}on $git_status"
	fi

	# Add an extra separator if there is content available
	if [ "$dprompt" != "" ]; then
		dprompt=" $dprompt"
	fi

	echo "$dprompt"
}

function set_prompt {
    VIM_PROMPT="%{$fg_bold[blue]%}NORMAL%{$reset_color%} "

    # Can also use %(4~|.../%3~|%~) or %(5~|%-1~/…/%3~|%4~)
    ((PATH_LEN = `tput cols` - 40))
	PROMPT="\
%{$fg[yellow]%}%n\
%{$fg[white]%} at \
%{$fg[green]%}%m\
%{$fg[white]%} in \
%{$fg[blue]%}%${PATH_LEN}<..<%~%<<\
$(prompt_dynamic_section)
%(?.%{$fg[green]%}.%{$fg[red]%})%(#.#.➜)%{$reset_color%} "

	#RPROMPT="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/}"
}

# Show the correct editor mode on the right hand side of the prompt
function zle-line-init zle-keymap-select {
	set_prompt
    #zle reset-prompt
}
set_prompt

zle -N zle-line-init
zle -N zle-keymap-select
export KEYTIMEOUT=1


<gh_stars>0
sudo hciconfig hci0 piscan
sudo sdptool add sp
sudo service bluetooth restart


#!/bin/bash
# Clean up the /boot partition
# DANGER: This script is dangerous!
# Only run it if you know what you
# are doing.

hash dpkg 2>/dev/null || { echo >&2 "You need to install dpkg. Aborting."; exit 1; }
hash apt-get 2>/dev/null || { echo >&2 "You need to install apt. Aborting."; exit 1; }
hash sudo 2>/dev/null || { echo >&2 "You need to install sudo. Aborting."; exit 1; }

# Ensure sudo privileges for the current user if not running as root.
if [[ $EUID -ne 0 ]]; then
  echo "NOTICE: Running as user $USER; sudo privileges required."
  if ! sudo echo "" > /dev/null 2>&1; then
    echo >&2 "ERROR: Must have sudo privileges to modify configuration files."
    exit 1
  fi
fi

dpkg -l 'linux-*' \
| sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' \
| xargs sudo apt-get -y purge


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

PWD=`pwd`
ARGS=''

for arg in "$@" ; do
		case $1 in
	  	  -*) ARGS="$ARGS $1 $2" ; shift ;;
	  	  "") ;;
		   *) ARGS="$ARGS $1" ;;
		esac

        shift
done

cd `dirname $0`/..
java -cp lib/winston.jar gov.usgs.volcanoes.winston.in.ImportSeisan $ARGS


#!/bin/sh

# --ipv6/-6                               enables ipv6 TCP/UDP support
# --max-special-connections/-C <arg>      sets maximal number of accepted client connections per worker
# --domain/-D <arg>                       adds allowed domain for TLS-transport mode, disables other transports; can be specified more than once
# --http-ports/-H <arg>                   comma-separated list of client (HTTP) ports to listen
# --slaves/-M <arg>                       spawn several slave workers; not recommended for TLS-transport mode for better replay protection
# --proxy-tag/-P <arg>                    16-byte proxy tag in hex mode to be passed along with all forwarded queries
# --mtproto-secret/-S <arg>               16-byte secret in hex mode
# --ping-interval/-T <arg>                sets ping interval in second for local TCP connections (default 5.000)
# --window-clamp/-W <arg>                 sets window clamp for client TCP connections
# --backlog/-b <arg>                      sets backlog size
# --connections/-c <arg>                  sets maximal connections number
# --daemonize/-d {arg}                    changes between daemonize/not daemonize mode
# --help/-h                               prints help and exits
# --log/-l <arg>                          sets log file name
# --port/-p <arg>                         <port> or <sport>:<eport> sets listening port number or port range
# --user/-u <arg>                         sets user name to make setuid
# --verbosity/-v {arg}                    sets or increases verbosity level
# --aes-pwd <arg>                         sets custom secret.conf file
# --nice <arg>                            sets niceness
# --msg-buffers-size <arg>                sets maximal buffers size (default 268435456)
# --disable-tcp                           do not open listening tcp socket
# --crc32c                                Try to use crc32c instead of crc32 in tcp rpc
# --cpu-threads <arg>                     Number of CPU threads (1-64, default 8)
# --io-threads <arg>                      Number of I/O threads (1-64, default 16)
# --allow-skip-dh                         Allow skipping DH during RPC handshake
# --force-dh                              Force using DH for all outbound RPC connections
# --max-accept-rate <arg>                 max number of connections per second that is allowed to accept
# --max-dh-accept-rate <arg>              max number of DH connections per second that is allowed to accept
# --multithread {arg}                     run in multithread mode
# --tcp-cpu-threads <arg>                 number of tcp-cpu threads
# --tcp-iothreads <arg>                   number of tcp-io threads
# --nat-info <arg>                        <local-addr>:<global-addr>      sets network address translation for RPC protocol handshake
# --address <arg>                         tries to bind socket only to specified address
# --http-stats                            allow http server to answer on stats queries

LOCAL_IP=$(hostname -i)

ARGS="-u nobody -p 8888 -H 443 --aes-pwd /mtproxy/config/proxy-secret /mtproxy/config/proxy-multi.conf"
  [ "${SECRET}" != "" ]               && ARGS="${ARGS} -S ${SECRET}"
  [ "${VERBOSE}" == "true" ]          && ARGS="${ARGS} --verbosity"
  [ "${IPV6}" == "true" ]             && ARGS="${ARGS} --ipv6"
  [ "${MAX_SPEC_CONN}" != "" ]        && ARGS="${ARGS} -C ${MAX_SPEC_CONN}"
  [ "${DOMAIN}" != "" ]               && ARGS="${ARGS} -D ${DOMAIN}"
  [ "${HTTP_PORTS}" != "" ]           && ARGS="${ARGS} -H ${HTTP_PORTS}"
  [ "${SLAVES}" != "" ]               && ARGS="${ARGS} -M ${SLAVES:-1}"
  [ "${PROXY_TAG}" != "" ]            && ARGS="${ARGS} -P ${PROXY_TAG}"
  [ "${PING_INTERVAL}" != "" ]        && ARGS="${ARGS} -T ${PING_INTERVAL}"
  [ "${WINDOW_CLAMP}" != "" ]         && ARGS="${ARGS} -W ${WINDOW_CLAMP}"
  [ "${BACKLOG}" != "" ]              && ARGS="${ARGS} -b ${BACKLOG}"
  [ "${CONNECTIONS}" != "" ]          && ARGS="${ARGS} -c ${CONNECTIONS}"
  [ "${MSG_BUF_SIZE}" != "" ]         && ARGS="${ARGS} --msg-buffers-size ${MSG_BUF_SIZE}"
  [ "${CPU_THREADS}" != "" ]          && ARGS="${ARGS} --cpu-threads ${CPU_THREADS}"
  [ "${IO_THREADS}" != "" ]           && ARGS="${ARGS} --io-threads ${IO_THREADS}"
  [ "${ALLOW_SKIP_DH}" == "true" ]    && ARGS="${ARGS} --allow-skip-dh"
  [ "${FORCE_DH}" == "true" ]         && ARGS="${ARGS} --force-dh"
  [ "${MAX_ACCEPT_RATE}" != "" ]      && ARGS="${ARGS} --max-accept-rate ${MAX_ACCEPT_RATE}"
  [ "${MAX_ACCEPT_DH_RATE}" != "" ]   && ARGS="${ARGS} --max-dh-accept-rate ${MAX_ACCEPT_DH_RATE}"
  [ "${MULTITHEAD}" != "" ]           && ARGS="${ARGS} --multithread ${MULTITHEAD}"
  [ "${TCP_CPU_THREADS}" != "" ]      && ARGS="${ARGS} --tcp-cpu-threads ${TCP_CPU_THREADS}"
  [ "${TCP_IO_THREADS}" != "" ]       && ARGS="${ARGS} --tcp-iothreads ${TCP_IO_THREADS}"
  [ "${NAT_INFO}" != "" ]             && ARGS="${ARGS} --nat-info $LOCAL_IP:${NAT_INFO}"
  [ "${ADDRESS}" != "" ]              && ARGS="${ARGS} --address ${ADDRESS}"
  [ "${HTTP_STATS}" == "true" ]       && ARGS="${ARGS} --http-stats"

exec /mtproxy/mtproto-proxy ${ARGS}


#!/usr/bin/env bash

set -e

show_help() {
  cat <<EOF
Usage: $(basename "$0") <options>
    -h, --help               Display help
    -p, --prefix             (Optional) Prefix used to filter git tags. Default: (empty)
    -b, --main-branch        (Optional) Repository's main branch. Default: 'main'
    -y, --pypi-compatible    Generate PyPi compatible version. Default: (disabled)
EOF
}

parse_command_line(){
  while :; do
    case "${1:-}" in
      -h | --help)
        show_help
        exit
        ;;
      -p | --prefix)
        if [[ -n "${2:-}" ]]; then
          tag_prefix="$2"
          shift
        else
          echo "ERROR: '-p|--prefix' cannot be empty." >&2
          show_help
          exit 1
        fi
        ;;
      -b | --main-branch)
        if [[ -n "${2:-}" ]]; then
          main_branch="$2"
          shift
        else
          echo "ERROR: '-b|--main-branch' cannot be empty." >&2
          show_help
          exit 1
        fi
        ;;
      -y | --pypi-compatible)
        pypi_compatible=true
        ;;
      *)
        break
        ;;
    esac

    shift
  done
}

get_latest_version_tag(){
  local tag_regex="^${tag_prefix}v?([0-9]+(\.[0-9]+)*(-.*)?)$"
  local latest_tag=$(git tag -l --sort=-creatordate | grep -E "$tag_regex" | head -n 1)
  if [[ ${latest_tag} =~ ${tag_regex} ]]; then
    version_tag=${latest_tag}
    version_candidate=${BASH_REMATCH[1]}
  fi
}

get_commit_count(){
  if [[ -z "$version_tag" ]]; then
  commit_count=$(git rev-list HEAD | wc -l)
  else
      commit_count=$(git rev-list "${version_tag}"..HEAD | wc -l)
  fi
  commit_count=$(echo "${commit_count}" | tr -d "[:space:]")
}

main(){
  local tag_prefix=
  local main_branch=main
  local pypi_compatible=false
  local version_tag=
  local version_candidate=0.0.0
  local commit_count=

  parse_command_line "$@"

  get_latest_version_tag
  get_commit_count

  if [[ $commit_count = 0 ]]; then
    # if the current commit is the same that was tagged with a version tag
    # then return just use this version tag value as a version
    echo "$version_candidate"
    exit 0
  fi

  local version=
  if [ "${pypi_compatible}" == true ]; then
    version="${version_candidate}.post${commit_count}"
    if [[ $(git branch --show-current) != "$main_branch" ]]; then
      version="${version}.dev"
    fi
  else
    local ref=$(git log -n 1 --pretty=format:'%h')
    version="${version_candidate}-build.${commit_count}-${ref}"
  fi

  echo "$version"
}

main "$@"


<filename>scripts/set_window_geometry.sh<gh_stars>100-1000
#!/bin/bash

desktop=$(xdotool get_desktop)
window_count=$(wmctrl -l | awk '$2 == '$desktop' { wc++ } END { print wc }')

[[ $1 ]] && mode=$1 || mode=$(awk '/^mode/ { print $NF }' ~/.config/orw/config)
	#mode=$(awk '/class.*(selection|\*)/ { print (/\*/) ? "tiling" : "selection" }' ~/.config/openbox/rc.xml)

if [[ $mode ]]; then
	((window_count)) || id='-i none'
	~/.orw/scripts/windowctl.sh $id -A
	exit

	if [[ $mode != selection ]]; then
		#((window_count)) && read m x y w h <<< $(~/.orw/scripts/windowctl.sh resize -H a)
		((window_count)) && ~/.orw/scripts/windowctl.sh -A
		exit
		((window_count)) && read m x y w h <<< $(~/.orw/scripts/windowctl.sh -A)
	else
		class=selection
		#read m x y w h <<< $(~/.orw/scripts/windowctl.sh -C -p | cut -d ' ' -f 3-)
		read m x y w h <<< $(~/.orw/scripts/windowctl.sh -C -p | awk '{ print $3, $4, $5, $6 - $1, $7 - $2 }')
	fi

	((w && h)) && ~/.orw/scripts/set_geometry.sh -c "${class:-\\\*}" -m $m -x $x -y $y -w $w -h $h
fi


for m in 6; do
	echo model$m
	cd model$m
	for s in 1 2; do
		echo set$s
		cd set$s
		cut -d, -f1-42 ../../model4/set$s/tst-yxi.csv > tst-yx.csv
		cut -d, -f7- ../../model2/set$s/tst-yxi.csv | paste -d, tst-yx.csv - > tst-yxi.csv
		rm tst-yx.csv
		for v in $([[ $s == 1 ]] && echo "2007" || echo "2002 2007 2010 2012"); do
			cut -d, -f1-42 ../../model4/set$s/pdbbind-$v-trn-yxi.csv > pdbbind-$v-trn-yx.csv
			cut -d, -f7- ../../model2/set$s/pdbbind-$v-trn-yxi.csv | paste -d, pdbbind-$v-trn-yx.csv - > pdbbind-$v-trn-yxi.csv
			rm pdbbind-$v-trn-yx.csv
		done
		cd ..
	done
	cd ..
done


#!/bin/bash

# cleanup intermediate images
echo "Cleanup intermediate build caches"
docker rmi -f $(docker images -q --filter label=stage=intermediate)


#!/bin/bash

. ../env_local.sh

echo "Exporting genepheno causation"
./convert_old_gp_labels.py ../onto/manual/genepheno_holdout_labels_caus.tsv > tmp.tsv
cat tmp.tsv | psql -U $DDUSER -p 6432 -d genomics_labels -c 'COPY genepheno_causation_labels FROM STDIN;'
rm tmp.tsv

echo "Exporting genepheno association"
./convert_old_gp_labels.py ../onto/manual/genepheno_holdout_labels_assoc.tsv > tmp.tsv
cat tmp.tsv | psql -U $DDUSER -p 6432 -d genomics_labels -c 'COPY genepheno_association_labels FROM STDIN;'
rm tmp.tsv

echo "Exporting gene mentions labels"


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

cp -r ${MESON_SOURCE_ROOT}/PathOfBuilding/* ${MESON_INSTALL_PREFIX}/Contents/MacOS/

mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks

#cp -R /usr/local/opt/qt5/Frameworks/* \
#        ${MESON_INSTALL_PREFIX}/Contents/Frameworks

#install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 \
#    @executable_path/../FrameWorks/SDL2.framework/Versions/A/SDL2 \
#    ${MESON_INSTALL_PREFIX}/Contents/MacOS/myapp


<gh_stars>100-1000
#!/usr/bin/with-contenv bash

# copy config
[[ ! -f /data/config/www/nextcloud/config/config.php ]] && \
	cp /defaults/config.php /data/config/www/nextcloud/config/config.php

# permissions
chown abc:abc \
	/data/config/www/nextcloud/config/config.php


#!/bin/sh

RETRY=2
TIMEOUT=15

[ "$SYSTOHC" = "yes" ] || exit 0

for i in `seq $RETRY`
do
  hwclock --systohc &
  /usr/lib/sleepi3-utils/timeoutpid.sh $TIMEOUT $! && wait $! && exit 0
  sleep 1
done

exit 2


mkdir -p bin
javac -classpath .:lib/guava-18.0.jar:lib/miningcommon.jar -d bin src/edu/nmsu/erikness/pointclickcluster/*.java
mkdir -p bin/edu/nmsu/erikness/datasets
cp src/edu/nmsu/erikness/datasets bin/edu/nmsu/erikness/datasets


#!/bin/bash

SESSION=LocalLab

tmux -2 new-session -d -s $SESSION

# main window for installation
tmux new-window -t $SESSION:1
# Setup a window per lab machine
tmux new-window -t $SESSION:2 'ssh root@master.cluster1'
tmux new-window -t $SESSION:3 'ssh root@node1.cluster1'
tmux new-window -t $SESSION:4 'ssh root@node2.cluster1'

# Set default window
tmux select-window -t $SESSION:1

# Attach to session
tmux -2 attach-session -t $SESSION


# how many multi-processing to build
export BUILD_PARALLEL_NUM=4

# set the default gpu devices, plz never change it
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7

# set the real devices you want to use
export USE_GPU_DEVICES=0,1,2,3

export RUNTIME_MODE=gpu

export PROFILING_MODE=true

# ascend config
export DEVICE_ID=0
export DEVICE_TOTAL_NUM=8


<reponame>sandipb/zap-examples<gh_stars>10-100
#!/bin/bash

THIS_DIR=$(cd $(dirname $BASH_SOURCE) && pwd)
export GOPATH=$THIS_DIR GOBIN=$THIS_DIR/bin

if [[ ! $PATH == *$THIS_DIR* ]];then
	export PATH=$PATH:$GOBIN
fi


<gh_stars>1-10
# This function removes all of the rules and resets the firewall to a
# default state.
function reset_firewall () {
    # We don't need "filter" here because that's the default table and is
    # cleared first by calling the commands with no table argument.
    tables=('nat' 'mangle' 'raw' 'security')

    iptables -F
    iptables -X

    for table in "${tables[@]}"
    do
        iptables -t "$table" -F
        iptables -t "$table" -X
    done

    iptables -P INPUT ACCEPT
    iptables -P FORWARD ACCEPT
    iptables -P OUTPUT ACCEPT
}


#!/usr/bin/env sh
set -ev

if [ "${TRAVIS_PHP_VERSION}" != "hhvm" ]; then
    mv "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" /tmp
    echo "memory_limit=3072M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

    if [ ${TRAVIS_PHP_VERSION} '<' '7.0' ]; then
        echo "extension=mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
    fi
fi

# To be removed when following PR will be merged: https://github.com/travis-ci/travis-build/pull/718
composer self-update --stable
sed --in-place "s/\"dev-master\":/\"dev-${TRAVIS_COMMIT}\":/" composer.json

if [ "$SYMFONY" != "" ]; then composer require "symfony/symfony:$SYMFONY" --no-update; fi;
if [ "$DOCTRINE_ODM" != "" ]; then composer require "doctrine/mongodb-odm:$DOCTRINE_ODM" --no-update; fi;


#!/usr/bin/env bash
#---  FUNCTION  -------------------------------------------------------------------------------------------------------
#        NAME:  __set_line_separator
# DESCRIPTION:  Sets newline as the separator and saves the old one
#       USAGE:  __set_line_separator
#     RETURNS:  N/A
#----------------------------------------------------------------------------------------------------------------------
__set_line_separator() {
    export SAVEIFS=$IFS
    export IFS=$'\n'
}
#---  FUNCTION  -------------------------------------------------------------------------------------------------------
#        NAME:  __reset_line_separator
# DESCRIPTION:  Resets to the default BASH line separator
#       USAGE:  __reset_line_separator
#     RETURNS:  N/A
#----------------------------------------------------------------------------------------------------------------------
__reset_line_separator() {
    export IFS=$SAVEIFS
}


<reponame>djhshih/deploy
localdir=$(dirname "$(readlink -f "$0")")
ARCH_ROOT=$PATEFIANT_ROOT/arch
SRC=root.x86_64

tmpdir=$(mktemp -d) && cd $tmpdir
curl -O https://mirrors.kernel.org/archlinux/iso/2015.06.01/archlinux-bootstrap-2015.06.01-x86_64.tar.gz
tar -xzf archlinux-bootstrap-2015.06.01-x86_64.tar.gz

sed -e 's/SigLevel.*Required.*$/SigLevel = Never/g' $SRC/etc/pacman.conf > $ARCH_ROOT/etc/pacman.d/

mkdir -p $ARCH_ROOT/etc/pacman.d/
cp $SRC/etc/pacman.d/mirrorlist $ARCH_ROOT/etc/pacman.d/mirrorlist.pacman
echo 'Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch' > $ARCH_ROOT/etc/pacman.d/mirrorlist

mkdir -p $ARCH_ROOT/var/{cache/pacman/pkg,lib/pacman}
install_pacman='pacman -r $ARCH_ROOT --cacheddir $ARCH_ROOT/var/cache/pacman/pkg --config $ARCH_ROOT/etc/pacman.conf'
proot -S $SRC $install_pacman

proot -S $ARCH_ROOT pacman -Syu

# Install proot script with expanded path
sed "s|\$PATEFIANT_ROOT|$PATEFIANT_ROOT|g" $localdir/archroot \
	> $PATEFIANT_ROOT/bin/archroot
chmod +x $PATEFIANT_ROOT/bin/archroot


#!/bin/bash
# Copyright 2019 The HERA Collaboration
# This code is licensed under the BSD 2-clause License

# This script is launch_screen_sessions.sh.
# Use this script to create screen sessions, automatically create
# a makeflow from a TOML file, and run the makeflow.
#
# Args:
#   1) path to the .toml file
#   2) path to folder with data files
#   3) ending of data files. Files will be enumerated
#      by using a glob `*.ending'
#   4) number of simultaneous batch jobs to run, optional
#
# Example usage:
#   launch_screen_sessions.sh idr2_2.toml /lustre/aoc/projects/hera/H1C_IDR2/IDR2_2 .HH.uvh5 20
#
# In the sample above, the folder IDR2_2 contains a series of folders
# indexed by JD (e.g., 2458098, 2458099, etc.). These folders contain
# the raw data files used by hera_opm to generate a workflow, with the
# extension given by the third argument (.HH.uvh5). The optional fourth
# argument gives the number of simiultaneous jobs to submit **for each day
# in the workflow**.

# get full path of toml file, in case it's not absolute
toml_path=`realpath "${1}"`

# get current environment, to activate inside of screen
# should be an environment with hera_opm installed, because
# `makeflow_nrao.sh' is called inside
conda_env=`conda info --envs | grep '*' | cut -d ' ' -f1`

# make list of JDs to process
# defaults to all JD-like folders contained in argument $2
JD_LIST=`ls "${2}" | egrep "[0-9]{7}" | tr '\n' ' '`

# loop over days
for JD in ${JD_LIST}; do
    # make encapsulating folder
    mkdir -p "${JD}"

    # build makeflow
    cd "${JD}"
    file_list=`ls "${2}"/"${JD}"/*"${3}" | tr '\n' ' '`
    build_makeflow_from_config.py -c "${toml_path}" ${file_list}

    # get full path to .mf file
    mf_file=`realpath *.mf`

    # build command to be fed to screen session
    if [ "$#" -gt 3 ]; then
    	cmd="conda activate $conda_env; makeflow_nrao.sh ${mf_file} ${4}\n"
    else
    	cmd="conda activate $conda_env; makeflow_nrao.sh ${mf_file}\n"
    fi

    # launch screen session named by JD and send commands
    screen -d -m -S "${JD}"
    screen -S "${JD}" -p 0 -X stuff "${cmd}"

    # go back up a level
    cd ..
done


cd neofetch-7.1.0

# Build package
PREFIX="$PAKKET_PKG_PATH" make install


<filename>scripts/golangci-lint.sh
#!/usr/bin/env bash

echo "==> Running 'golangci-lint' ..."
golangci-lint run ./...


#!/bin/bash

# Load the exported environment vars
. /usr/app/env.sh

# Run the Inky update
python /usr/app/update-display.py


#!/bin/sh
#
# This script is run by the jenkins autobuilder, in a mingw environment,
# to build git-annex for Windows.

set -x
set -e

HP="/c/Program Files (x86)/Haskell Platform/2012.4.0.0"
FLAGS="-Webapp -Assistant -XMPP"

PATH="$HP/bin:$HP/lib/extralibs/bin:/c/Program Files (x86)/NSIS:$PATH"

# Run a command with the cygwin environment available.
# However, programs not from cygwin are preferred.
withcyg () {
	PATH="$PATH:/c/cygwin/bin" "$@"
}

# Don't allow build artifact from a past successful build to be extracted
# if we fail.
rm -f git-annex-installer.exe

# Install haskell dependencies.
# cabal install is not run in cygwin, because we don't want configure scripts
# for haskell libraries to link them with the cygwin library.
cabal update || true

rm -rf MissingH-1.2.0.0
cabal unpack MissingH
cd MissingH-1.2.0.0
withcyg patch -p1 <../standalone/windows/haskell-patches/MissingH_1.2.0.0-0001-hack-around-strange-build-problem-in-jenkins-autobui.patch
cabal install || true
cd ..

cabal install --only-dependencies -f"$FLAGS"

# Detect when the last build was an incremental build and failed,
# and try a full build. Done this way because this shell seems a bit
# broken.
if [ -e last-incremental-failed ]; then
	cabal clean || true
	# windows breakage..
	rm -rf dist
fi
touch last-incremental-failed

# Build git-annex
withcyg cabal configure -f"$FLAGS"
withcyg cabal build

# Build the installer
cabal install nsis
ghc --make Build/NullSoftInstaller.hs
withcyg Build/NullSoftInstaller.exe

rm -f last-incremental-failed

# Test git-annex
rm -rf .t
withcyg dist/build/git-annex/git-annex.exe test || true


#!/bin/sh

# Force rebuild from start
# This will destroy ALL DOCKER CONTAINERS and remove intermediate images

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images | grep "^<none>" | awk '{ print $3 }')


echo "Downloading Cecil"
if [ -z $CECIL_VERSION ]; then
  curl -sSOL https://cecil.app/cecil.phar
else
  curl -sSOL https://cecil.app/download/$CECIL_VERSION/cecil.phar
fi
php cecil.phar --version

echo "Started Cecil build"
if [[ $CECIL_ENV != "production" ]]; then
  php cecil.phar build -v --baseurl=$DEPLOY_PRIME_URL --drafts
else
  php cecil.phar build -v --baseurl=$URL --postprocess
fi

# build success? can deploy?
if [ $? = 0 ]; then echo "Finished Cecil build"; exit 0; fi

echo "Interrupted Cecil build"; exit 1


<reponame>jkopczyn/luci-go
#!/bin/sh
#
# Copyright 2016 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
#
# Script for .travis.yaml to install protobuf compiler from source. This is
# needed because APT package for protobuf doesn't support proto3.

set -ex

V="3.0.0-beta-2"
ARCH="x86_64"
DIST="protoc-${V}-linux-${ARCH}"

# Download and unpack the protoc binary distribution package.
wget "https://github.com/google/protobuf/releases/download/v${V}/${DIST}.zip"
unzip "${DIST}.zip"

# Copy protoc into "/usr/bin" and the includes into "/usr/include".
sudo mkdir -p /usr/bin /usr/include
sudo mv "./protoc" /usr/bin/
sudo mv "./google" /usr/include/


<filename>build.sh
#!/bin/bash
cd /home/cxzmoe/scratch-ports/udblock-scratch-gui
npm run build
exit


<filename>.github/automation/build_acl.sh
#! /bin/bash

# *******************************************************************************
# Copyright 2020-2021 Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# 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.
# *******************************************************************************

# Compute Library build defaults
ACL_VERSION="v21.05"
ACL_DIR="${PWD}/ComputeLibrary"
ACL_ARCH="arm64-v8a"

while [[ $# -gt 0 ]]; do
    case $1 in
        --version)
        ACL_VERSION="v$2"
        shift
        ;;
        --arch)
        ACL_ARCH="$2"
        shift
        ;;
        --root-dir)
        ACL_DIR="$2"
        shift
        ;;
        *)
        echo "Unknown option: $1"
        exit 1
        ;;
    esac
    shift
done

readonly ACL_REPO="https://github.com/ARM-software/ComputeLibrary.git"
MAKE_NP="-j$(grep -c processor /proc/cpuinfo)"

git clone $ACL_REPO $ACL_DIR
cd $ACL_DIR
git checkout $ACL_VERSION

scons $MAKE_NP Werror=0 debug=0 neon=1 gles_compute=0 embed_kernels=0 \
  os=linux arch=$ACL_ARCH build=native

exit $?


#!/bin/bash
source "$(dirname "${BASH_SOURCE}")/../../hack/lib/init.sh"
trap os::test::junit::reconcile_output EXIT

# Cleanup cluster resources created by this test
(
  set +e
  oc delete cm --all
  oc delete secret test
  exit 0
) &>/dev/null

os::test::junit::declare_suite_start "cmd/oc/set/data"

os::cmd::expect_success 'oc create configmap test'
tmpfile="$(mktemp)"
echo "c" > "${tmpfile}"

# test --local flag
os::cmd::expect_failure_and_text 'oc set data cm/test a=b --local' 'provide one or more resources by argument or filename'
# test --dry-run flag with -o formats
os::cmd::expect_success_and_text 'oc set data cm/test a=b --dry-run' 'test'
os::cmd::expect_success_and_text 'oc set data cm/test a=b --dry-run -o name' 'configmap/test'
os::cmd::expect_success_and_text 'oc set data cm/test a=b --dry-run' 'configmap/test data updated \(dry run\)'

os::cmd::expect_failure_and_text 'oc set data cm/test a=c a-' 'you may not remove and set the key'
os::cmd::expect_failure_and_text 'oc set data cm/test a=c --from-literal=a=b' 'cannot set key "a" in both argument and flag'

os::cmd::expect_success 'oc set data cm/test a=b'
os::cmd::expect_success_and_text "oc get cm/test -o jsonpath='{.data.a}'" 'b'
os::cmd::expect_success_and_text 'oc set data cm/test a=b' 'info: test was not changed'

os::cmd::expect_success 'oc set data cm/test a-'
os::cmd::expect_success_and_text "oc get cm/test -o jsonpath='{.data.a}'" ''
os::cmd::expect_success_and_text 'oc set data cm/test a-' 'info: test was not changed'

os::cmd::expect_success "oc set data cm/test --from-file=b=${tmpfile}"
os::cmd::expect_success_and_text "oc get cm/test -o jsonpath='{.data.b}'" 'c'
os::cmd::expect_success_and_text "oc set data cm/test --from-file=b=${tmpfile}" 'info: test was not changed'

rm -rf ${tmpfile}
mkdir -p ${tmpfile}
echo '1' > "${tmpfile}/a"
echo '2' > "${tmpfile}/b"
os::cmd::expect_success 'oc set data cm/test b-'
os::cmd::expect_success "oc set data cm/test --from-file=${tmpfile}"
os::cmd::expect_success_and_text "oc get cm/test -o jsonpath='{.data.a}'" '1'
os::cmd::expect_success_and_text "oc get cm/test -o jsonpath='{.data.b}'" '2'
os::cmd::expect_success_and_text "oc set data cm/test --from-file=${tmpfile}" "info: test was not changed"

os::cmd::expect_success 'oc create secret generic test'
os::cmd::expect_success 'oc set data secret/test a=b'
os::cmd::expect_success_and_text "oc get secret/test -o jsonpath='{.data.a}'" 'Yg=='
os::cmd::expect_success_and_text 'oc set data secret/test a=b' 'info: test was not changed'

echo "set-data: ok"
os::test::junit::declare_suite_end


<reponame>coreasync/neater<gh_stars>0
#!/bin/bash

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

cd $script_dir/../altjvm

#for Java7 java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx512M -Xss2M -jar  $script_dir/sbt-launch.jar $@
java -XX:+CMSClassUnloadingEnabled -Xmx512M -Xss2M -jar  $script_dir/sbt-launch.jar $@


<reponame>wiredquill/STW-CaaSPv4<gh_stars>1-10
#!/bin/bash

VM_LIST="
CAAS101-smt:30
CAAS101-admin:120
CAAS101-master01:20
CAAS101-worker10:10
CAAS101-worker11:10
"

start_vms() {
  for VM in ${VM_LIST}
  do
    local VM_NAME=$(echo ${VM} | cut -d : -f 1)
    local SLEEP_TIME=$(echo ${VM} | cut -d : -f 2)
    echo "Starting VM: ${VM_NAME}"
    echo "--------------------------------------------------"
    echo "COMMAND:  virsh start ${VM_NAME}"
    virsh start ${VM_NAME}
    local COUNT=0
    while [ "${COUNT}" -le "${SLEEP_TIME}" ]
    do
      echo -n "."
      sleep 1
      ((COUNT++))
    done
    echo "."
    echo
  done
}

##################################################

start_vms


<filename>src/ffmpeg/video/filters/crop-black-bars.bash
# Copyright (c) 2013-2016, <NAME> <<EMAIL>>
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

# WARNING:
# This mock-up implementation in shell is for testing and demonstration
# purposes only.

# This function uses the ffmpeg cropdetect filter to check for blackbars
# at 5 second intervals until 10 identical results for both width and
# height are found.
function FFmpeg::Video.filters:black_bar_crop {
  Function::RequiredArgs '2' "$#"
  # TODO:
  # - fix setting crop rounding value dynamically
  #   h264: prefer multiples of 16 for compression efficiency, or multiple
  #     of 2, 4, or 8?
  #   h265: use multiple of min CU size
  #   vp9: multiple of 16, cite bug

  local CropDetect
  local CropDetectArgs
  local -a CropDetectArgsList
  local CropHeight
  local CropHeightArray
  local CropHeightMatches
  local CropWidth
  local CropWidthArray
  local CropWidthMatches
  local CropXOffset
  local CropXOffsetArray
  local CropYOffset
  local CropYOffsetArray
  local -r File="$2"
  local LoopIter
  local Skip
  local SourceHeight
  local SourceWidth
  local -r Stream="$1"

  CropHeight=0
  CropHeightArray=()
  CropHeightMatches=0
  CropWidth=0
  CropWidthArray=()
  CropWidthMatches=0
  CropXOffsetArray=()
  CropXOffsetMatches=0
  CropYOffsetArray=()
  CropYOffsetMatches=0
  LoopIter=1
  SourceHeight=$(Video::Height "$Stream" "$File")
  Log::Message 'info' "source height: $SourceHeight"
  SourceWidth=$(Video::Width "$Stream" "$File")
  Log::Message 'info' "source width: $SourceWidth"

  function mode {
    echo "${@}" |
      sed -r 's/[[:space:]]+/\n/g' |
      uniq -c |
      sort -n -k 1 -r |
      awk '{ print $2 ; exit }'
  }

  function mode_count {
    echo "${@}" |
      sed -r 's/[[:space:]]+/\n/g' |
      uniq -c |
      sort -n -k 1 -r |
      awk '{ print $1 ; exit }'
  }

  while [[ $CropHeightMatches -lt 5 && \
           $CropWidthMatches -lt 5 && \
           $CropXOffsetMatches -lt 5 && \
           $CropYOffsetMatches -lt 5 ]]; do
    Skip=$(( $LoopIter * 5 ))
    # https://ffmpeg.org/pipermail/ffmpeg-user/2011-July/001795.html
    # https://ffmpeg.org/pipermail/ffmpeg-user/2012-August/008767.html
    # -ss before -i uses seeking, -ss after -i uses skipping and is very slow
    CropDetectArgsList=(
      '-nostdin'
      '-hide_banner'
      '-loglevel' 'info'
      '-threads' "$(Cpu::Logical)"
      '-ss' "$Skip"
      '-i' "$File"
      '-ss' '0'
      '-t' '1'
      # The file index must be specified or cropdetect with fail when the
      # video stream index is not 0.
      "-filter:0:$Stream" 'cropdetect=30:0:0'
      '-an'
      '-f' 'null' '-'
    )

    CropDetectArgs="${CropDetectArgsList[@]}"
    Log::Message 'info' "ffmpeg $CropDetectArgs"

    CropDetect="$(
      ffmpeg "${CropDetectArgsList[@]}" 2>&1 |
        awk -F'=' '/crop/ { print $NF }' |
        tail -1
    )"

    Log::Message 'info' "$LoopIter: $CropDetect"

    # Find crop height
    CropHeight=$(echo "$CropDetect" | awk -F':' '{ print $2 ; exit }')
    # Find crop width
    CropWidth=$(echo "$CropDetect" | awk -F':' '{ print $1 ; exit }')
    # Sanity check
    if [[ $CropHeight -gt $(( $SourceHeight / 2 )) && \
          $CropWidth -gt $(( $SourceWidth / 2 )) ]]; then
      CropXOffsetArray+=(
        "$(echo "$CropDetect" | awk -F':' '{ print $3 ; exit }')"
      )
      CropYOffsetArray+=(
        "$(echo "$CropDetect" | awk -F':' '{ print $4 ; exit }')"
      )
      CropHeightArray+=("$CropHeight")
      CropWidthArray+=("$CropWidth")
    fi

    Log::Message 'info' "${LoopIter} - W:$CropWidth H:$CropHeight X:${CropXOffsetArray[-1]} Y:${CropYOffsetArray[-1]}"

    # Find count of mode values
    CropWidthMatches=$(mode_count "${CropWidthArray[@]}")
    CropHeightMatches=$(mode_count "${CropHeightArray[@]}")
    CropXOffsetMatches=$(mode_count "${CropXOffsetArray[@]}")
    CropYOffsetMatches=$(mode_count "${CropYOffsetArray[@]}")

    Log::Message 'info' "MODE - W:$CropWidthMatches H:$CropHeightMatches X:$CropXOffsetMatches Y:$CropYOffsetMatches"

    (( LoopIter++ ))

    unset CropDetectArg CropDetectArgs CropDetectArgsList

    # Exit if cropdetect is probably failing to prevent infinite loops
    [ $LoopIter -le 50 ]
  done

  # Find crop width mode
  CropWidth=$(mode "${CropWidthArray[@]}")
  Var::Type.integer "$CropWidth"

  # Find crop height mode
  CropHeight=$(mode "${CropHeightArray[@]}")
  Var::Type.integer "$CropHeight"

  # Find X offset mode
  CropXOffset=$(mode "${CropXOffsetArray[@]}")
  Var::Type.integer "$CropXOffset"

  # Find Y offset mode
  CropYOffset=$(mode "${CropYOffsetArray[@]}")
  Var::Type.integer "$CropYOffset"

  Log::Message 'info' "FINAL: W:$CropWidth H:$CropHeight X:$CropXOffset Y:$CropYOffset"

  echo "crop=${CropWidth}:${CropHeight}:${CropXOffset}:${CropYOffset}"
}