#!/bin/bash -login
### Job name
### Resources
#PBS -l nodes=1:ppn=5,walltime=05:00:00:00,mem=44gb
### Send email if the job encounters an error
#PBS –m a
### Output files to where you submitted your batch file
#PBS -e ./jobs/$PBS_JOBNAME.err
#PBS -o ./jobs/$PBS_JOBNAME.log
#PBS -j oe

# Change to working directory
cd $PBS_O_WORKDIR

# Load appropriate modules
module load Java/1.8.0_31
module load Python/3.3.2
module load FastQC/0.11.3
module load Trimmomatic/0.33
module load sickle/1.33
module load SAMTools/1.2
module load picardTools/1.113
module load GATK/3.7.0

# Execute via python script
python ./scripts/fastq2bam.py ${Var}

# Collect stats on run
qstat -f ${PBS_JOBID}


<filename>build/osx/build.sh
#!/usr/bin/env bash
echo "removing old files..."
rm -rf build
rm -rf dist

# Check if error introducing packages are still there
pip uninstall enum34
pip uninstall imagecodecs

echo "building app..."
#onefolder
pyinstaller -D -y --clean aydin.spec # -D -y --clean

mkdir -p dist/aydin_0.1.5rc12.app/Contents/MacOS
mkdir -p dist/aydin_0.1.5rc12.app/Contents/Resources

cp /PATH/TO/sklearn/cluster/*.so dist/aydin/sklearn/cluster/.
cp Info.plist dist/aydin_0.1.5rc12.app/Contents/.
cp icon-windowed.icns dist/aydin_0.1.5rc12.app/Contents/Resources/.
cp -rf -p dist/aydin/* dist/aydin_0.1.5rc12.app/Contents/MacOS/.
cp aydin_0.1.5rc3 dist/aydin_0.1.5rc12.app/Contents/MacOS/.


<filename>build/deploydb.sh
#!/bin/bash

set -e

user="$1"
password="$2"
host="$3"
port="$4"
MYSQL='mysql'

if [[ `id -u` -ne 0 ]] && [[ x"$user" = x"root" ]]; then
    MYSQL='sudo mysql'
fi

base=`dirname $0`

if [[ ! -n $host ]] || [[ ! -n $port ]];then
  loginCmd="--user=$user --password=$password"
else
  loginCmd="--user=$user --password=$password --host=$host --port=$port"
fi

${MYSQL} ${loginCmd} << EOF
set global log_bin_trust_function_creators=1;
DROP DATABASE IF EXISTS zstack;
CREATE DATABASE zstack;
DROP DATABASE IF EXISTS zstack_rest;
CREATE DATABASE zstack_rest;
grant all privileges on zstack.* to root@'%' identified by "${password}";
grant all privileges on zstack_rest.* to root@'%' identified by "${password}";
grant all privileges on zstack.* to root@'127.0.0.1' identified by "${password}";
grant all privileges on zstack_rest.* to root@'127.0.0.1' identified by "${password}";
EOF

# assign flyway version if not defined
: "${flywayver:=3.2.1}"
flyway="$base/../conf//tools/flyway-$flywayver/flyway"
flyway_sql="$base/../conf/tools/flyway-$flywayver/sql/"

mkdir -p ${flyway_sql}

eval "rm -f ${flyway_sql}/*"
cp ${base}/../conf/db/V0.6__schema.sql ${flyway_sql}
cp ${base}/../conf/db/upgrade/* ${flyway_sql}

if [[ ! -n $host ]] || [[ ! -n $port ]];then
  url="jdbc:mysql://localhost:3306/zstack"
else
  url="jdbc:mysql://$host:$port/zstack"
fi
${flyway} -user=${user} -password=${password} -url=${url} clean

# create baseline and clean its contents for 'beforeValidate.sql'
${flyway} -user=${user} -password=${password} -url=${url} baseline
${MYSQL} ${loginCmd} zstack -e "DELETE FROM schema_version"

${flyway} -outOfOrder=true -user=${user} -password=${password} -url=${url} migrate

eval "rm -f ${flyway_sql}/*"

cp ${base}/../conf/db/V0.6__schema_buildin_httpserver.sql ${flyway_sql}

if [[ ! -n $host ]] || [[ ! -n $port ]];then
  url="jdbc:mysql://localhost:3306/zstack_rest"
else
  url="jdbc:mysql://$host:$port/zstack_rest"
fi
${flyway} -user=${user} -password=${password} -url=${url} clean
${flyway} -outOfOrder=true -user=${user} -password=${password} -url=${url} migrate

eval "rm -f ${flyway_sql}/*"


<reponame>pr0d1r2/ruby_dev_shell_aliases<filename>COMPOSE_PARALLEL_LIMIT.sh
COMPOSE_PARALLEL_LIMIT="$(nproc)"
export COMPOSE_PARALLEL_LIMIT


#!/usr/bin/env zsh

if [[ "$#" -lt 2 ]]; then
  echo "usage: $(basename "${0}") from-file to-file [inkscape-option ...]"
  exit 1
fi

from="$1"
shift
to="$1"
shift
inkscape_options="$*"

mkdir -p "$(dirname ${to})"

if grep --silent '<text' "${from}"; then
  inkscape '--actions=select-by-element:text;object-to-path' --export-filename=- --export-plain-svg "${@}" "${from}" | xmllint --format - > "${to}"
else
  xmllint --format "${from}" --output "${to}"
fi


#! /bin/bash

# Installing node 12
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt install -y nodejs

# Install Terraform 0.13.6
wget https://releases.hashicorp.com/terraform/0.13.6/terraform_0.13.6_linux_amd64.zip -O /usr/local/bin/terraform.zip
unzip /usr/local/bin/terraform.zip -d /usr/local/bin/
rm /usr/local/bin/terraform.zip


<reponame>WebDaD/Resilienz<gh_stars>0
#!/bin/sh
git pull
npm install


<gh_stars>1-10
cp -rvf ../../bin/* node_modules/react-awtk/bin/


#!/bin/bash
if [ -x /usr/lib/mecab/mecab-dict-index ]; then
    dictindex="/usr/lib/mecab/mecab-dict-index"
elif [ -x /usr/local/Cellar/mecab/0.996/libexec/mecab/mecab-dict-index ]; then
    dictindex="/usr/local/Cellar/mecab/0.996/libexec/mecab/mecab-dict-index"
else
    echo "mecab is not installed"
    exit 1
fi
update_neologd=0
if [ $# -gt 0 ]; then
    if [ "$1" = "update" ]; then
        update_neologd=1
    else
        echo "What?"
        exit 1
    fi
fi
if [ ! -d mecab_ipadic ]; then
    wget -O mecab-ipadic.tar.gz https://sourceforge.net/projects/mecab/files/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz/download
    tar zxf mecab-ipadic.tar.gz
    rm -f mecab-ipadic.tar.gz
    mv mecab-ipadic-2.7.0-20070801 mecab_ipadic
    nkf -Ew --overwrite mecab_ipadic/*
    sed -i -e "s/$/,ipadic/g" mecab_ipadic/*.csv
    cd mecab_ipadic
    wget -O mecab-ipadic.model.bz2 "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7bnc5aFZSTE9qNnM"
    bzip2 -d mecab-ipadic.model.bz2
    nkf -Ew --overwrite mecab-ipadic.model
    sed -i -e "s/euc-jp/utf-8/" mecab-ipadic.model
    rm -f mecab-ipadic-euc.model
    cd ..
    update_neologd=1
fi
if [ $update_neologd -eq 1 ]; then
    git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git
    xz -dk mecab-ipadic-neologd/seed/*.csv.xz
    sed -i -e "s/$/,ipadic-neologd/g" mecab-ipadic-neologd/seed/*.csv
    mv mecab-ipadic-neologd/seed/*.csv mecab_ipadic/.
    rm -rf mecab-ipadic-neologd
    cd mecab_ipadic
    ${dictindex} -f utf8 -t utf8
    cd ..
fi
${dictindex} -m mecab_ipadic/mecab-ipadic.model -d mecab_ipadic -u mecab_ipadic/User.csv -f utf8 -t utf8 -a userdic.csv
cd mecab_ipadic
${dictindex} -f utf8 -t utf8


#!/bin/bash

rclone copy data "mydrive:covid_data" --transfers=10 -P

# Push package to google cloud storage
gsutil -h "Cache-Control: no-cache" cp data/data_package.json.gz gs://ve-public/data_package.json.gz
gsutil -h "Cache-Control: no-cache" cp data/map_combined_standalone.vg.json gs://ve-public/map_combined_standalone.vg.json

# Push genbank data
rclone copy data_genbank "mydrive:covid_data/genbank" --transfers 10 -P

# Push genbank packages
gsutil -h "Cache-Control: no-cache" cp data_genbank/data_package.json.gz gs://ve-public/genbank/data_package.json.gz
gsutil -h "Cache-Control: no-cache" cp data_genbank/map_combined_standalone.vg.json gs://ve-public/genbank/map_combined_standalone.vg.json


#!/bin/bash
tar cf brain.tar ../brain -C ..
tar -tf brain.tar
docker build -f Dockerfile -t brain .


<filename>cord/psql.sh<gh_stars>100-1000
#!/bin/bash
function finish {
    sync_unlock.sh
}
if [ -z "$TRAP" ]
then
  sync_lock.sh || exit -1
  trap finish EXIT
  export TRAP=1
fi
set -o pipefail
> errors.txt
> run.log
GHA2DB_PROJECT=cord PG_DB=cord GHA2DB_LOCAL=1 structure 2>>errors.txt | tee -a run.log || exit 1
./devel/db.sh psql cord -c "create extension if not exists pgcrypto" || exit 1
./devel/ro_user_grants.sh cord || exit 2
# GHA2DB_PROJECT=cord PG_DB=cord GHA2DB_LOCAL=1 gha2db 2018-12-01 0 today now opencord 2>>errors.txt | tee -a run.log || exit 3
GHA2DB_PROJECT=cord PG_DB=cord GHA2DB_LOCAL=1 gha2db 2016-06-01 0 today now opencord 2>>errors.txt | tee -a run.log || exit 3
GHA2DB_PROJECT=cord PG_DB=cord GHA2DB_LOCAL=1 GHA2DB_MGETC=y GHA2DB_SKIPTABLE=1 GHA2DB_INDEX=1 structure 2>>errors.txt | tee -a run.log || exit 5
GHA2DB_PROJECT=cord PG_DB=cord ./shared/setup_repo_groups.sh 2>>errors.txt | tee -a run.log || exit 6
GHA2DB_PROJECT=cord PG_DB=cord ./shared/setup_scripts.sh 2>>errors.txt | tee -a run.log || exit 7
GHA2DB_PROJECT=cord PG_DB=cord ./shared/get_repos.sh 2>>errors.txt | tee -a run.log || exit 8
GHA2DB_PROJECT=cord PG_DB=cord ./shared/import_affs.sh 2>>errors.txt | tee -a run.log || exit 9
GHA2DB_PROJECT=cord PG_DB=cord GHA2DB_LOCAL=1 vars || exit 10


<reponame>HappyFacade/kafka-tutorials
mkdir finding-distinct && cd finding-distinct


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

pressurelevel="$1"
duration="$2"
# try and install iproute2, suppress output...
apt install stress-ng  2> /dev/null > /dev/null

echo "Stressing all CPUs at $pressurelevel% capacity for $duration"s...
stress-ng -c 0 -l ${pressurelevel} -t ${duration}


<gh_stars>0
#!/bin/bash

if [ ! $1 ] || [ ! $2 ]; then
    echo "Please enter a domain, the cert file name and optionally an email";
    exit;
fi

# User parameters.
cn=$1;
cert=$2;
email=$3;

# CSR config.
country='FR';
state='Auvergne';
locality='Clermont-Ferrand';
organization='Periscope';
organizationalunit='Dev';
emailAddress='<EMAIL>';

# If email is given then use it.
if [ $email ]; then
    emailAddress=$email;
fi

echo "Generating certificate ${cert}.crt for ${cn}";
openssl req -x509 \
    -nodes \
    -days 365 \
    -newkey rsa:2048 \
    -keyout /etc/apache2/ssl/${cert}.key \
    -out /etc/apache2/ssl/${cert}.crt \
    -subj "/C=${country}/ST=${state}/L=${locality}/O=${organization}/OU=${organizationalunit}/CN=${cn}/emailAddress=${emailAddress}"

echo "Certificate ${cert}.crt has been generated."


<reponame>Absurdev/LinkingWords<gh_stars>0
# clean up redis db after server reboot
redis-cli KEYS user:* | xargs redis-cli DEL
redis-cli KEYS word:* | xargs redis-cli DEL
redis-cli KEYS bottle:* | xargs redis-cli DEL
redis-cli KEYS bottles:pending_list | xargs redis-cli DEL
redis-cli DEL user_to_socket
redis-cli DEL user_gc
redis-cli DEL connections
redis-cli DEL user_hash_lookup

redis-cli DEL stats:word:pending_words_count
redis-cli DEL stats:word:today_submitted_count
redis-cli DEL stats:word:today_match_count
redis-cli DEL stats:bottle:today_opened_count
redis-cli DEL stats:bottle:today_cast_count
redis-cli DEL stats:word:today_submitted_count_by_word
redis-cli DEL stats:word:today_match_count_by_word


<filename>testscripts/gst.new.sh
#!/bin/sh
date
./conf/deviceid.sh conf/gst_single.conf
echo 'gst';sudo ./rvs -c conf/gst_single.conf -d 3; date


#!/bin/bash -eu

log "Moving clips to rclone archive..."

source /root/.teslaCamRcloneConfig

FILE_COUNT=$(cd "$CAM_MOUNT" && find . -maxdepth 4 -path './TeslaCam/SavedClips/*' -type f -o -path './TeslaCam/SentryClips/*' -type f -o -path './TeslaTrackMode' -type f | wc -l)

if [ -d "$CAM_MOUNT"/TeslaCam/SavedClips ]
then
  # shellcheck disable=SC2154
  rclone --config /root/.config/rclone/rclone.conf move "$CAM_MOUNT"/TeslaCam/SavedClips "$drive:$path"/SavedClips/ --create-empty-src-dirs --delete-empty-src-dirs >> "$LOG_FILE" 2>&1 || echo ""
fi

if [ -d "$CAM_MOUNT"/TeslaCam/SentryClips ]
then
  rclone --config /root/.config/rclone/rclone.conf move "$CAM_MOUNT"/TeslaCam/SentryClips "$drive:$path"/SentryClips/ --create-empty-src-dirs --delete-empty-src-dirs >> "$LOG_FILE" 2>&1 || echo ""
fi

(
log "Starting copy of RecentClips"
for dir in /backingfiles/snapshots/*/mnt/TeslaCam/RecentClips/; do
    datePath="$(ls -1 $dir | perl -pe 's/^([0-9]{4}-[0-9]{2}-[0-9]{2})_.*/$1/g' | sort | uniq)"
    for date in $datePath; do
        rclone --config /root/.config/rclone/rclone.conf --include "${date}*" copy "$dir/" "$drive:$path"/RecentClips/$date/ >> "$LOG_FILE" 2>&1 || echo ""
    done
done
log "Finished copy of RecentClips"
) &

if [ -d "$CAM_MOUNT"/TeslaTrackMode ]
then
  rclone --config /root/.config/rclone/rclone.conf move "$CAM_MOUNT"/TeslaTrackMode "$drive:$path"/TeslaTrackMode/ --create-empty-src-dirs --delete-empty-src-dirs >> "$LOG_FILE" 2>&1 || echo ""
fi

FILES_REMAINING=$(cd "$CAM_MOUNT" && find . -maxdepth 4 -path './TeslaCam/SavedClips/*' -type f -o -path './TeslaCam/SentryClips/*' -type f -o -path './TeslaTrackMode' -type f | wc -l)
NUM_FILES_MOVED=$((FILE_COUNT-FILES_REMAINING))

log "Moved $NUM_FILES_MOVED file(s)."
/root/bin/send-push-message "TeslaUSB:" "Moved $NUM_FILES_MOVED dashcam file(s)."

log "Finished moving clips to rclone archive"


<reponame>jCalderTravis/mat-comp-model-tools<filename>mT_runOneJob_template.sh
#!/bin/bash

#SBATCH --nodes=1
#SBATCH --time=50:00:00
#SBATCH --job-name=fit-ml
#SBATCH --mail-type=NONE

# INPUT
# $1 directory. All relevant MATLAB scripts should be in the folder
#    directory/scripts or a subfolder of this directory
# $2 file name of the job to run
# $3 Are we starting a new fit or resuming and old one ("0" or "1")

umask 077

jobDirectory="$1"
filename="$2"
resuming="$3"

# Set a unique folder for this job's matlab parpool data
jobTempDir="$jobDirectory"/$SLURM_JOB_ID
mkdir "$jobTempDir"

# Need to provide matlab input as a string
in1="'$jobDirectory'"
in2="'$filename'"
in3="'$resuming'"

module load matlab/2018b

matlab -nodisplay -nosplash -r "mT_runOnCluster($in1, $in2, $SBATCH_TIMELIMIT, $in3)"


pyinstaller --onedir --windowed --name=client -y __main__.py


#!/usr/bin/env bash

PYTHON=${PYTHON:-"python"}

GPUS=$1
CONFIG=$2
DATAPATH=$3

$PYTHON -m torch.distributed.launch --nproc_per_node=$GPUS \
    $(dirname "$0")/train.py $CONFIG --datapath $DATAPATH --launcher pytorch ${@:4}


<reponame>asr-ros/asr_cyberglove_lib
#!/bin/bash
export ROS_MASTER_URI="http://$HOSTNAME:11311"
export ROSLAUNCH_SSH_UNKNOWN=1
roslaunch asr_cyberglove_lib glove_lib_remote.launch


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

# Copyright [2017] [B2W Digital]
#
# 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.

echo '----------------------------------------------'
echo ' MARVIN ENVIRONMENT VARIABLES'
echo '----------------------------------------------'

echo "export MARVIN_DATA_PATH=/vagrant/projects/data" >> /home/vagrant/.profile
echo "export MARVIN_HOME=/vagrant/projects" >> /home/vagrant/.profile

sudo -u vagrant bash -c "source /home/vagrant/.profile"


#!/bin/bash

set -e

date
ps axjf

#################################################################
# Update Ubuntu and install prerequisites for running Impleum   #
#################################################################
sudo apt-get update
#################################################################
# Build Impleum from source                                     #
#################################################################
NPROC=$(nproc)
echo "nproc: $NPROC"
#################################################################
# Install all necessary packages for building Impleum           #
#################################################################
sudo apt-get install -y qt4-qmake libqt4-dev libminiupnpc-dev libdb++-dev libdb-dev libcrypto++-dev libqrencode-dev libboost-all-dev build-essential libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev libssl-dev ufw git
sudo add-apt-repository -y ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install -y libdb4.8-dev libdb4.8++-dev

cd /usr/local
file=/usr/local/impleumQT
if [ ! -e "$file" ]
then
        sudo git clone https://github.com/impleum/ImpleumQt.git
fi

cd /usr/local/ImpleumQt/src
file=/usr/local/ImpleumQt/src/impleumd
if [ ! -e "$file" ]
then
        sudo make -j$NPROC -f makefile.unix
fi

sudo cp /usr/local/ImpleumQt/src/impleumd /usr/bin/impleumd

################################################################
# Configure to auto start at boot                                      #
################################################################
file=$HOME/.impleum
if [ ! -e "$file" ]
then
        sudo mkdir $HOME/.impleum
fi
printf '%s\n%s\n%s\n%s\n' 'daemon=1' 'server=1' 'rpcuser=u' 'rpcpassword=p' | sudo tee $HOME/.impleum/impleum.conf
file=/etc/init.d/impleum
if [ ! -e "$file" ]
then
        printf '%s\n%s\n' '#!/bin/sh' 'sudo impleumd' | sudo tee /etc/init.d/impleum
        sudo chmod +x /etc/init.d/impleum
        sudo update-rc.d impleum defaults
fi

/usr/bin/impleumd
echo "Impleum has been setup successfully and is running..."
exit 0


#!/usr/bin/env bash

# cpan
brew install perl dbus
export PERL_MM_USE_DEFAULT=1
cpan CPAN
cpan URI URI::Escape
brew services start dbus
# common
mkdir -pv "$HOME/Applications/KDE"
rm -rfv "$HOME/Applications/KDE*"
mkdir -pv "$HOME/Library/Application Support/doc"
rm -rfv "$HOME/Library/Application Support/doc/*"
ln -sfv "$(brew --prefix)/share/doc/HTML" "$HOME/Library/Application Support/doc"
ln -sfv "$(brew --prefix)/share/doc/qch" "$HOME/Library/Application Support/doc"
ln -sfv "$(brew --prefix)/share/kf5" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kservices5" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/metainfo" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kservicetypes5" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/config.kcfg" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/knotifycations5" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kxmlgui5" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kpackage" "$HOME/Library/Application Support"
# kf5-breeze-icons
ln -sfv "$(brew --prefix)/share/icons" "$HOME/Library/Application Support"
# kf5-kemoticons
ln -sfv "$(brew --prefix)/share/emoticons" "$HOME/Library/Application Support"
# kf5-kparts
ln -sfv "$(brew --prefix)/share/kdevappwizard" "$HOME/Library/Application Support"
# kf5-kdelibs4support
ln -sfv "$(brew --prefix)/opt/kf5-kdelibs4support/bin/kdebugdialog5.app" "$HOME/Applications/KDE"
# kf5-plasma-frameworks
ln -sfv "$(brew --prefix)/share/plasma" "$HOME/Library/Application Support"
# dolphin
ln -sfv "$(brew --prefix)/share/dolphin" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/dolphin/bin/dolphin.app" "$HOME/Applications/KDE"
# kate
ln -sfv "$(brew --prefix)/share/kate" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kwrite" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kateproject" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/katexmltools" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/kate/bin/kate.app" "$HOME/Applications/KDE"
ln -sfv "$(brew --prefix)/opt/kate/bin/kwrite.app" "$HOME/Applications/KDE"
# kio-extras
ln -sfv "$(brew --prefix)/share/kio_bookmarks" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kio_info" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/konqsidebartng" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/konqueror" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/remoteview" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/solid" "$HOME/Library/Application Support"
# kmymoney
ln -sfv "$(brew --prefix)/share/kmymoney" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kmm_weboob" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kmm_printcheck" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/kmymoney/bin/kmymoney.app" "$HOME/Applications/KDE"
# kolourpaint
ln -sfv "$(brew --prefix)/share/kolourpaint" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/kolourpaint/bin/kolourpaint.app" "$HOME/Applications/KDE"
# konsole
ln -sfv "$(brew --prefix)/share/konsole" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/konsole/bin/konsole.app" "$HOME/Applications/KDE"
# konversation
ln -sfv "$(brew --prefix)/share/konversation" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/konversation/bin/konversation.app" "$HOME/Applications/KDE"
# lokalize
ln -sfv "$(brew --prefix)/opt/lokalize/bin/lokalize.app" "$HOME/Applications/KDE"
# okteta
ln -sfv "$(brew --prefix)/share/okteta" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/okteta/bin/okteta.app" "$HOME/Applications/KDE"
# kdevelop
ln -sfv "$(brew --prefix)/share/kdevappwizard" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevclangsupport" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevcodeutils" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevelop" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevfiletemplates" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevgdb" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevmanpage" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevqmakebuilder" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/share/kdevqmljssupport" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/kdevelop/bin/kdevelop.app" "$HOME/Applications/KDE"
# okular
ln -sfv "$(brew --prefix)/share/okular" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/okular/bin/okular.app" "$HOME/Applications/KDE"
# labplot
ln -sfv "$(brew --prefix)/share/labplot2" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/labplot/bin/labplot2.app" "/Applications/KDE"
# kdenlive
ln -sfv "$(brew --prefix)/share/kdenlive" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/kdenlive/bin/kdenlive.app" "$HOME/Applications/KDE"
# krename
ln -sfv "$(brew --prefix)/share/krename" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/krename/bin/krename.app" "$HOME/Applications/KDE"
# ktorrent
ln -sfv "$(brew --prefix)/share/ktorrent" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/ktorrent/bin/ktorrent.app" "$HOME/Applications/KDE"
ln -sfv "$(brew --prefix)/opt/ktorrent/bin/ktupnptest.app" "$HOME/Applications/KDE"
# krusader
ln -sfv "$(brew --prefix)/share/krusader" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/krusader/bin/krusader.app" "$HOME/Applications/KDE"
# elisa
ln -sfv "$(brew --prefix)/opt/elisa/bin/elisa.app" "$HOME/Applications/KDE"
# kcalc
ln -sfv "$(brew --prefix)/share/kcalc" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/kcalc/bin/kcalc.app" "$HOME/Applications/KDE"
# libksysguard
ln -sfv "$(brew --prefix)/share/ksysguard" "$HOME/Library/Application Support"
# ksysguard
ln -sfv "$(brew --prefix)/opt/ksysguard/bin/ksysguard.app" "$HOME/Applications/KDE"
# umbrello
ln -sfv "$(brew --prefix)/share/umbrello5" "$HOME/Library/Application Support"
ln -sfv "$(brew --prefix)/opt/umbrello/bin/umbrello5.app" "$HOME/Applications/KDE"
# atcore
ln -sfv "$(brew --prefix)/opt/atcore/bin/AtCoreTest.app" "$HOME/Applications/KDE"

exit 0


<gh_stars>1000+
#!/bin/bash
#
# Copyright (c) 2020 The Orbit Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Fail on any error.
set -e

function install_oauth2l {
  if [ "$(uname -s)" == "Linux" ]; then
    local os="linux"
  else
    local os="windows"
  fi

  curl -o oauth2l.tgz https://storage.googleapis.com/oauth2l/latest/${os}_amd64.tgz
  tar -zxvf oauth2l.tgz --strip-components 1
  chmod +x oauth2l
  rm -f oauth2l.tgz
}

function retrieve_oauth_token_header {
  ./oauth2l header cloud-platform userinfo.email
}

function get_api_key {
  local header=$1
  local gcurl="curl -H \"${header}\" -H \"Content-Type: application/json\""
  local keys=$(eval $gcurl https://apikeys.googleapis.com/v2alpha1/projects/60941241589/keys)
  if [ -z "$keys" ] || [ $(echo "$keys" | jq 'has("keys")') == "false" ]; then
    echo "Can't get list of API keys"
    echo $keys
    exit 1
  fi

  local crash_symbol_key_full_name=$(jq -n "$keys" | jq '.keys[] | select(.displayName == "Crash Symbol Collector API key") | .name' | tr -d '"')
  if [ -z "$crash_symbol_key_full_name" ]; then
    echo "'Crash Symbol Collector API key' not found"
    exit 1
  fi

  eval $gcurl https://apikeys.googleapis.com/v2alpha1/$crash_symbol_key_full_name/keyString | jq '.keyString' | tr -d '"'
}

function remove_oauth2l {
  rm -f oauth2l
}

function install_breakpad_tools {
  if [ ! -d breakpad ]; then
    conan install -g deploy breakpad/2ffe116@orbitdeps/stable
  fi
}

function upload_symbol_file {
  local api_key=$1
  local symbol_file_path=$2

  if [ "$(uname -s)" == "Linux" ]; then
    local symbol_name="$(basename $symbol_file_path)"
    local sym_file_path=breakpad/symbols/$symbol_name.sym
    breakpad/bin/dump_syms $symbol_file_path > $sym_file_path
    breakpad/bin/symupload -p sym-upload-v2 -k $api_key $sym_file_path \
      https://prod-crashsymbolcollector-pa.googleapis.com
  else
    PATH="/c/BuildTools/DIA SDK/bin/amd64:$PATH" breakpad/bin/symupload -p $symbol_file_path \
      https://prod-crashsymbolcollector-pa.googleapis.com $api_key
  fi
}

function upload_debug_symbols {
  local api_key=$1
  local bin_folder=$2
  local lib_folder=$3

  install_breakpad_tools
  if [ ! -d breakpad/symbols ]; then
    mkdir breakpad/symbols
  fi

  if [ "$(uname -s)" == "Linux" ]; then
    upload_symbol_file $api_key $bin_folder/OrbitService
    upload_symbol_file $api_key $lib_folder/libOrbitVulkanLayer.so
  else
    upload_symbol_file $api_key $bin_folder/Orbit.exe
    upload_symbol_file $api_key $bin_folder/Qt5Core.dll
    upload_symbol_file $api_key $bin_folder/Qt5Gui.dll
    upload_symbol_file $api_key $bin_folder/Qt5Network.dll
    upload_symbol_file $api_key $bin_folder/Qt5Widgets.dll
    upload_symbol_file $api_key $bin_folder/bearer/qgenericbearer.dll
    upload_symbol_file $api_key $bin_folder/imageformats/qgif.dll
    upload_symbol_file $api_key $bin_folder/imageformats/qico.dll
    upload_symbol_file $api_key $bin_folder/imageformats/qjpeg.dll
    upload_symbol_file $api_key $bin_folder/platforms/qwindows.dll
    upload_symbol_file $api_key $bin_folder/styles/qwindowsvistastyle.dll
  fi
}


<gh_stars>0
#!/bin/bash

function extractFolders() {
    folders=()

    while [ -n "$1" ]
    do
        case "$1" in
            -f) shift; folders+=("$1") ;;
        esac
        shift
    done

    echo ${folders[*]}
}

function extractTestArgs() {
    freeArgs=()

    while [ -n "$1" ]
    do
        case "$1" in
            -a) shift; freeArgs+=("$1") ;;
        esac
        shift
    done

    echo ${freeArgs[*]}
}

function extractJVMArgs() {
    jvmArgs=()

    while [ -n "$1" ]
    do
        case "$1" in
            --jvm-args) shift; jvmArgs+=("$1") ;;
        esac
        shift
    done

    echo ${jvmArgs[*]}
}

function extractCalculationTimes() {

    while [ -n "$1" ]
    do
        case "$1" in
            -n) shift; CALCULATION_TIMES=$1 ;;
        esac
        shift
    done

    setIfNull CALCULATION_TIMES 10

    echo $CALCULATION_TIMES
}


<gh_stars>1-10
#!/bin/bash
#
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#

# This builds 3 patches:
# PLATFORM_PATCH_1 contains sysinv and playbookconfig components
# KUBE_PATCH_1 contains kubeadm
# KUBE_PATCH_2 contains the remainder (node, client, master, etc..)

PATH=$MY_REPO/stx/update/extras/scripts:$PATH
SEMANTIC_PATH=`dirname "$0"`
DIR=${MY_WORKSPACE}/std/rpmbuild/RPMS

# Patch names
PLATFORM_PATCH_1=PLATFORM.1
KUBE_PATCH_1=KUBE.1
KUBE_PATCH_2=KUBE.2

# Add the following options to include restart scripts for sysinv:
# --controller ${DIR}/EXAMPLE_SYSINV-1.0-*.x86_64.rpm \
# --controller-worker ${DIR}/EXAMPLE_SYSINV-1.0-*.x86_64.rpm \
# --controller-worker-lowlatency ${DIR}/EXAMPLE_SYSINV-1.0-*.x86_64.rpm \
patch_build.sh \
    --id ${PLATFORM_PATCH_1} \
    --reboot-required=N \
    ${DIR}/sysinv-1.0-*.tis.x86_64.rpm \
    ${DIR}/playbookconfig-1.0-*.tis.x86_64.rpm

patch_build.sh \
    --id ${KUBE_PATCH_1} \
    --apply-active-release-only \
    --reboot-required=N \
    --pre-apply ${SEMANTIC_PATH}/KUBE.1.preapply   \
    --pre-remove ${SEMANTIC_PATH}/KUBE.1.preremove \
    --req ${PLATFORM_PATCH_1} \
    ${DIR}/kubernetes-kubeadm-1.18.1_upgrade-1.tis.*.x86_64.rpm

patch_build.sh \
    --id ${KUBE_PATCH_2} \
    --apply-active-release-only \
    --reboot-required=N \
    --pre-apply ${SEMANTIC_PATH}/KUBE.2.preapply   \
    --pre-remove ${SEMANTIC_PATH}/KUBE.2.preremove \
    --req ${KUBE_PATCH_1} \
    ${DIR}/kubernetes-node-1.18.1_upgrade-1.tis.*.x86_64.rpm \
    ${DIR}/kubernetes-client-1.18.1_upgrade-1.tis.*.x86_64.rpm \
    ${DIR}/kubernetes-1.18.1_upgrade-1.tis.*.x86_64.rpm \
    ${DIR}/kubernetes-master-1.18.1_upgrade-1.tis.*.x86_64.rpm


#!/usr/bin/env bash
set -Eeu

# <NAME>

GETH=${HOME}/go-ethereum/build/bin/geth

# https://github.com/eth2-clients/merge-testnets/tree/main/kintsugi
EXECUTION_BOOTNODE="enode://6f377dd1ef5a3272d7e02fac9064c4f95d74f7edfd866e59ded774ee5b4649ff61c3f24c95f5c3d07d692b447f0569716b8921b6861810b96a705c92e1d27ff9@172.16.31.10:30303"

GETHDATADIR=$(mktemp -d)
GENESISJSON=${HOME}/merge-testnets/kintsugi/genesis.json

echo "GETHDATADIR = ${GETHDATADIR}"

# Initialize the genesis
$GETH --catalyst --http --ws -http.api "engine" --datadir "${GETHDATADIR}" init "${GENESISJSON}"

# Import the signing key (press enter twice for empty password)
$GETH --catalyst --http --ws -http.api "engine" --datadir "${GETHDATADIR}" account import <(echo 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8)

#--password "execution/geth/passfile.txt"
#--nodekey "execution/signer.key"

$GETH \
    --catalyst \
    --http \
    --http.port 8550 \
    --http.api "engine,eth,net,admin,web3" \
    --http.corsdomain="*" \
    --http.vhosts="*" \
    --ws \
    --ws.port 8551 \
    --ws.api "engine,eth,net,admin,web3" \
    --allow-insecure-unlock \
    --datadir "${GETHDATADIR}" \
    --bootnodes "$EXECUTION_BOOTNODE" \
    --port 30308 \
    --password "" \
    --syncmode full \
    --unlock "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" \
    --mine \
    --networkid 1337702 \
    console


#!/bin/sh
set -e

echo Publishing data on dmishin home page
ODIR=../homepage-sources/res/hyperbolic-ca-simulator

cp -r *.html *.js media *.css README.md $ODIR

cd $ODIR

git add *
git status

git commit -m "Publishing updated hyperbolic-ca-simulator"

git push


#!/bin/sh
#
# This file belongs to MTYPE13 package by <NAME> <<EMAIL>>
#
random=`date +%m%d%H%M%S`
sed s/1234567890/$random/ divination.tex > your-divination.tex
tex your-divination.tex
dvips -P mtype13 -u t1fonts.map your-divination.dvi -o


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

gcc -o ./build/collision ./src/collision.c && ./build/collision $1


#!/bin/bash

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

pushd $DIR
java -cp "bin/*" \
     -Dau.com.codeka.warworlds.server.basePath=$DIR/bin/ \
     -Dau.com.codeka.warworlds.server.dbName=wwmmo_load \
     -Dau.com.codeka.warworlds.server.dbUser=wwmmo_user \
    '-Dau.com.codeka.warworlds.server.dbPass=<PASSWORD>' \
     -Dau.com.codeka.warworlds.server.loadTest=true \
     au.com.codeka.warworlds.server.Runner $*
popd


<filename>utils/tile.sh
#!/bin/sh
FILE=$1
montage -geometry +0+0 "$FILE" "$FILE" "$FILE" "$FILE" tiled.png


#!/bin/bash
echo "# [start]: copy and extract file system"
rm ../../working/*
cp ../../../tools/firmware-analysis-toolkit/firmadyne/images/1.tar.gz ../../working/1.tar.gz
# rm ../../../tools/firmware-analysis-toolkit/firmadyne/images/1.tar.gz
mkdir ../../working/filesystem
tar -zxvf ../../working/1.tar.gz -C ../../working/filesystem
rm ../../working/filesystem/etc/init.d/S045lighttpd.sh
cp ../../S045lighttpd.sh ../../working/filesystem/etc/init.d/S045lighttpd.sh
echo "# [finisched]: copy and extract file system"


<reponame>wsaqaf/mecodify-docker
#!/bin/bash
clear

FILE="${PWD}/mecodify/configurations.php"

  if [ ! -f "$FILE" ]; then
     printf "Creating a new configurations.php file\n"
     cp "${PWD}/mecodify/configurations_empty.php" $FILE
  fi

  if grep -Eq '"bearer"[[:space:]]*=>[[:space:]]*""' $FILE; then
     printf "It appears that you have not added the Twitter API 2.0 BEARER token into the configurations file.\n"
     while true; do
         read -rp "Do you have a Twitter API premium account (e.g., based on an Academic license)? [Y/n]: " yn
         case $yn in
      		[Yy]* )
    			  printf "Setting the license type to premium...\n";
    			  sed -i '' 's/"is_premium"[[:blank:]]*=>[[:blank:]]*false/"is_premium" => true/' $FILE;
    			  break;;
          [Nn]* )
		          printf "Setting the license type to sandbox (limited)...\n";
            sed -i '' 's/"is_premium"[[:blank:]]*=>[[:blank:]]*true/"is_premium" => false/' $FILE;
            break;;
          "")
            sed -i '' 's/"is_premium"[[:blank:]]*=>[[:blank:]]*false/"is_premium" => true/' $FILE;
            break;;
      		* ) printf "Please answer with y or n.\n";
   		  esac
      done
      printf "Please copy the full BEARER token and paste it below. This will only be required once.\n"
      read -rp "BEARER token: " token
      if [ ${#token} -ge 10 ]; then
            etoken=$(printf '%s\n' "$token" | sed -e 's/[\/&]/\\&/g')
            sed -i '' 's/"bearer"[[:blank:]]*=>[[:blank:]]*""[[:blank:]]*,/"bearer" => "'"$etoken"'",/' $FILE;
      else
            printf "Invalid token. exiting...\n\n";
            exit;
      fi
  elif grep -Eq '"bearer"[[:space:]]*=>[[:space:]]*".+"' $FILE; then
    printf "Using the code BEARER token already in the configuration file. You can change it manually any time.\n"
  else
    printf "the configuration file is corrupted. Exiting...\n\n";
    exit;
  fi

  printf "Creating docker images and the Mecodify app container...\n";

  if [ -d "${PWD}/mysql" ]; then
      printf "You have an existing mysql Mecodify database.\n"
      while true; do
  	read -rp "Do you wish to keep or delete it? Enter y to keep, n to delete: [Y/n]" -i "y" yn
  	case $yn in
  	   [Yy]* ) rm -rf "${PWD}/mysql"; break;;
  	   [Nn]* ) break;;
       "") break;;
  	   * ) printf "Please answer yes or no. \n";
      	esac
      done
  else
      printf "Creating Mecodify mysql database...\n\n";
  fi

  docker build -t wsaqaf/mecodify .

  docker kill `docker ps -aqf "name=mecodify"` &>/dev/null;
  docker rm `docker ps -aqf "name=mecodify"` &>/dev/null;
  docker run -d -i -t -p "80:80" -p "3306:3306" -v ${PWD}/mysql:/var/lib/mysql -v ${PWD}/mecodify:/mecodify --name mecodify wsaqaf/mecodify;
  docker cp mecodify/configurations.php `docker ps -aqf "name=mecodify"`:/var/www/html &>/dev/null;
  printf "Initializing and running server. Please wait.";

  while ! curl --output /dev/null --silent --head --fail localhost
          do printf "."
          sleep 1
  done
  printf " Installation complete!\n\nOpen http://127.0.0.1 with your browser to access the Mecodify platform.\n";


#!/bin/bash

die() {
  echo $@ >&2
  exit 1
}

cd `dirname "$0"`
mypwd="`pwd`"

cd "$mypwd/libusb"
echo "Configuring libusb . . ."
sh autogen.sh >&/dev/null || die "unable to configure libusb: sh autogen.sh"
mv config.h config.h.old
sed /LOGGING/d config.h.old > config.h
echo "Building libusb . . ."
make >&/dev/null || die "unable to compile libusb: make"
# We need to use ls -1 instead of [ -f ] because [ -f ] fails on symlinks.
if ! `ls -1 libusb-1.0` ; then
  ln -s libusb libusb-1.0
fi >&/dev/null

cd "$mypwd/libfreenect"
echo "Configuring libfreenect . . ."
cat > CMakeCache.txt <<EOT
LIBUSB_1_INCLUDE_DIR:FILEPATH=../libusb
LIBUSB_1_LIBRARY:STRING=usb-1.0 -L$mypwd/libusb/libusb/.libs
EOT
echo "Configuring libfreenect . . ."
cmake . >&/dev/null || die "Unable to configure libfreenect: cmake ."
echo "Building libfreenect . . ."
make >&/dev/null || die "Unable to build libfreenect: make"

echo "Everything is built!"


#/bin/bash

# command to create vm
aws ec2 run-instances \
--image-id ami-09e67e426f25ce0d7 \
--security-group-ids sg-00d16412e561a8dee \
--instance-type t2.micro \
--key-name devops \
--user-data file://ubuntu_userdata.sh


<reponame>amirothman/audio-visualization
#!/bin/bash

# ffmpeg -i data/output/amplitude_viz/combined-images.mp4 -i data/input/drum-break.wav -c:v copy -c:a aac data/output/amplitude_viz/combined-with-audio.mp4

ffmpeg -i $1 -i $2 -c:v copy -c:a aac $3


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

# Source: https://github.com/payara/Payara-Examples/blob/master/administration-examples/setup-sample-domain.sh

# Payara Variable Initialisation
# DOMAIN_NAME will be the name that you use to reference your domain when
# working with some Payara/Glassfish commands.
DOMAIN_NAME="domain1"

# The PAYARA_HOME variable points to your Payara install location. The below
# path would be appropriate for Payara versions 4.1.x
#PAYARA_HOME="/opt/payara5/glassfish"

#Doriane PAYARA home
PAYARA_HOME="/Users/dorianekaffo/Desktop/semestre5/AMT/Serveurs/payara5/glassfish"

# The ASADMIN variable points to the location of the asadmin script used
# to run the Payara asadmin commands
ASADMIN=${PAYARA_HOME}/bin/asadmin

echo "AS_ADMIN_PASSWORD=<PASSWORD>" > /tmp/gfpw.txt;

#${ASADMIN} --interactive=false --user admin --passwordfile=/tmp/gfpw.txt change-admin-password

# The use of the DOMAIN_NAME variable at the end of the asadmin command is used
# to determine the directory with which the domain's data is stored in within
# your Payara install. The name must contain only ASCII characters and be valid
# for a directory name on your operating system.
#
# More information regarding the use and option of the asadmin create-domain
# command can be found at: https://docs.oracle.com/html/E24938_01/create-domain.htm

#${ASADMIN} delete-domain ${DOMAIN_NAME}

#${ASADMIN} --user admin --passwordfile=/tmp/gfpw.txt create-domain --portbase ${PORT_BASE} ${DOMAIN_NAME}

## Check out the Ip address for de mysql database running in docker
#DB_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysqlcourse)

# Start the newly created sampleDomain domain using the asadmin start-domain
# command.

${ASADMIN} start-domain ${DOMAIN_NAME} && \
${ASADMIN} --interactive=false --user admin  create-jdbc-connection-pool --restype javax.sql.DataSource --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --property user=root:password=<PASSWORD>:DatabaseName=schedule:ServerName=172.19.0.2:port=3306 pool_course && \
${ASADMIN} --interactive=false --user admin  create-jdbc-resource --connectionpoolid pool_course jdbc/schedule


#!/bin/bash
export C_INCLUDE_PATH="${PREFIX}/include"
export LIBRARY_PATH="${PREFIX}/lib"

mkdir -p $PREFIX/bin
make
mv ropebwt2 $PREFIX/bin/


#!/bin/bash
set -e
echo 'About to install all dependencies, please hang in there tight'

pushd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null
# shellcheck disable=SC1091
[[ $UTIL_SOURCED != yes && -f ./util.sh ]] && source ./util.sh
popd > /dev/null

# Install
install_dependencies


<gh_stars>1-10
if test "$(uname)" = "Darwin"
then
    ln -s config/com.googlecode.iterm2.plist ~/Library/Preferences/com.googlecode.iterm2.plist
fi


sudo docker pull pycalcx/webux
docker run -d -p 8080:8080 pycalcx/webux


#! /bin/bash
set -e

# This script runs SSINS on raw data

# import common functions
src_dir="$(dirname "$0")"
source ${src_dir}/_common.sh

# Parameters are set in the configuration file. Here we define their positions,
# which must be consistent with the config.

# 1 - the significance threshold for streak shapes
# 2 - the significance threshold to use for the other shapes
# 3 - The threshold for flagging a highly contaminated frequency channel
# 4 - ant_metrics_ext
# 5+ - The filename(s) to read in

all_args=("$@")
streak_sig=${1}
other_sig=${2}
tb_aggro=${3}
data_files=(${@:5})

echo filenames are "${data_files[@]}"

# Get the first filename in the list (should work if only one file)
first_file="${data_files%" "*}"
# Set the prefix based on the first filename
prefix="${first_file%.uvh5}"

# get auto_metrics_file to exclude bad antennas
fn=${data_files[0]}
bn=`basename ${fn}`
jd=$(get_int_jd ${bn})
decimal_jd=$(get_jd ${bn})
pattern="${fn%${decimal_jd}.sum.uvh5}${jd}.?????.sum.auto_metrics.h5"
pattern_files=( $pattern )
auto_metrics_file=${pattern_files[0]}

# get ant_metrics_files to exclude bad antennas
ant_metrics_files=()
for fn in ${data_files[@]}; do
    ant_metrics_files+=( ${fn%.uvh5}${4} )
done

echo Run_HERA_SSINS.py -f ${data_files[@]} -s $streak_sig -o $other_sig -p $prefix -t $tb_aggro --metrics_files ${auto_metrics_file} ${ant_metrics_files[@]} -c
Run_HERA_SSINS.py -f ${data_files[@]} -s $streak_sig -o $other_sig -p $prefix -t $tb_aggro --metrics_files ${auto_metrics_file} ${ant_metrics_files[@]} -c

# Move all outputs to folder
echo rm -rf ${prefix}.SSINS
rm -rf ${prefix}.SSINS
echo mkdir ${prefix}.SSINS
mkdir ${prefix}.SSINS
for sf in ${prefix}.SSINS.*; do
    bn=$(basename ${sf})
    echo mv ${sf} ${prefix}.SSINS/${bn}
    mv ${sf} ${prefix}.SSINS/${bn}
done


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

PATH="/usr/bin:/usr/sbin"

source /home/django-app/.virtualenv/bin/activate

pip install -r /home/django-app/code/requirements.txt

/home/django-app/code/manage.py runserver 0.0.0.0:${PORT}


<filename>PWG/muon/rootlutnt.sh<gh_stars>100-1000
#!/bin/bash
export GCLIENT_SERVER_LIST="pcapiserv04.cern.ch:10000|pcapiserv05.cern.ch:10000|pcapiserv06.cern.ch:10000|pcapiserv07.cern.ch:10000"
echo ===========================
echo $PATH
echo $ROOTSYS
echo $LD_LIBRARY_PATH
echo ==========================

root -b -x runCreateLUTNT.C;


<reponame>SonnevilleJ/proxmox-setup<filename>scripts/setup.sh
#!/usr/bin/env bash

OS_CODENAME="$(grep "VERSION_CODENAME=" /etc/os-release | cut -d"=" -f 2 | xargs)"

# disable enterprise proxmox repo
if [ -f /etc/apt/sources.list.d/pve-enterprise.list ]; then
  sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pve-enterprise.list
fi
# enable free public proxmox repo
if [ ! -f /etc/apt/sources.list.d/proxmox.list ] && [ ! -f /etc/apt/sources.list.d/pve-public-repo.list ] && [ ! -f /etc/apt/sources.list.d/pve-install-repo.list ]; then
  echo -e "deb http://download.proxmox.com/debian/pve ${OS_CODENAME} pve-no-subscription\\n" >/etc/apt/sources.list.d/pve-public-repo.list
fi

# rebuild and add non-free to /etc/apt/sources.list
cat <<EOF >/etc/apt/sources.list
deb https://ftp.debian.org/debian ${OS_CODENAME} main contrib
deb https://ftp.debian.org/debian ${OS_CODENAME}-updates main contrib
# non-free
#deb https://httpredir.debian.org/debian/ ${OS_CODENAME} main contrib non-free
# security updates
deb https://security.debian.org/debian-security ${OS_CODENAME}-security/updates main contrib
EOF

# Refresh the package lists
apt-get update >/dev/null 2>&1

# Remove conflicting utilities
/usr/bin/env DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' purge ntp openntpd chrony

# Fixes for common apt repo errors
/usr/bin/env DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' install apt-transport-https debian-archive-keyring ca-certificates curl

# update proxmox and install various system utils
/usr/bin/env DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' dist-upgrade
pveam update

# apt autoremove and autoclean
/usr/bin/env DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' install autoremove autoclean

## Install zfs-auto-snapshot
/usr/bin/env DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::='--force-confdef' install zfs-auto-snapshot
# make 5min snapshots , keep 12 5min snapshots
if [ -f "/etc/cron.d/zfs-auto-snapshot" ]; then
  sed -i 's|--keep=[0-9]*|--keep=12|g' /etc/cron.d/zfs-auto-snapshot
  sed -i 's|*/[0-9]*|*/5|g' /etc/cron.d/zfs-auto-snapshot
fi
# keep 24 hourly snapshots
if [ -f "/etc/cron.hourly/zfs-auto-snapshot" ]; then
  sed -i 's|--keep=[0-9]*|--keep=24|g' /etc/cron.hourly/zfs-auto-snapshot
fi
# keep 7 daily snapshots
if [ -f "/etc/cron.daily/zfs-auto-snapshot" ]; then
  sed -i 's|--keep=[0-9]*|--keep=7|g' /etc/cron.daily/zfs-auto-snapshot
fi
# keep 4 weekly snapshots
if [ -f "/etc/cron.weekly/zfs-auto-snapshot" ]; then
  sed -i 's|--keep=[0-9]*|--keep=4|g' /etc/cron.weekly/zfs-auto-snapshot
fi
# keep 3 monthly snapshots
if [ -f "/etc/cron.monthly/zfs-auto-snapshot" ]; then
  sed -i 's|--keep=[0-9]*|--keep=3|g' /etc/cron.monthly/zfs-auto-snapshot
fi

## Automatically Synchronize the time
cat <<EOF >/etc/systemd/timesyncd.conf
[Time]
NTP=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
EOF
service systemd-timesyncd start
timedatectl set-ntp true


<reponame>pauluss75/centos-cis-benchmark
#!/bin/sh
# ** AUTO GENERATED **

# 5.4.5 - Ensure default user shell timeout is 900 seconds or less (Scored)

echo export TMOUT=600>>/etc/bashrc
echo export TMOUT=600>>/etc/profile


<gh_stars>0
#!/bin/bash

# prepare sources for bulk install
if [ "$PREP" -eq "1" ]; then
	echo "Preparing sources for $0"
	exit 0
fi

# install package
apt install kdiff3 -y


#!/bin/bash

# start minikube with a specific image
minikube start --iso-url https://accuknox.kr/minikube/minikube.iso

# download kernel-headers.tar.lz4
minikube ssh -- "curl -Lo /tmp/kernel-headers-linux-4.19.94.tar.lz4 https://accuknox.kr/minikube/kernel-headers-linux-4.19.94.tar.lz4"

# install kernel header
minikube ssh -- "sudo mkdir -p /lib/modules/4.19.94/build"
minikube ssh -- "lz4 -dc --no-sparse /tmp/kernel-headers-linux-4.19.94.tar.lz4 | sudo tar -C /lib/modules/4.19.94/build -xvf -"

# remove kernel-headers.tar.lz4
minikube ssh -- "rm /tmp/kernel-headers-linux-4.19.94.tar.lz4"


<reponame>NathanGiesbrecht/FireOS
#!/bin/sh

nweb 80 /srv/www

cat << CEOF
  'nweb' has been started on port 80, serving '/srv/www'.
CEOF


<filename>Blogs/SparkBarcode/x_setup_hdfs.sh
#
# script to copy files into hdfs

CUR_DIR=`dirname "$0"`
CUR_DIR_NAME=`cd "$CUR_DIR";pwd`
cd $CUR_DIR_NAME

echo Copying files into hdfs barcode/images directory
hadoop fs -mkdir barcode
hadoop fs -mkdir barcode/images
hadoop fs -rm barcode/images/*
hadoop fs -put images/* barcode/images

echo setup_hdfs Script Complete.


#!/usr/bin/env zsh
setopt auto_list
setopt auto_menu

zstyle ':completion:*' use-compctl false

function _files_enhance() {
    _files -M '' \
        -M 'm:{[:lower:]-}={[:upper:]_}' \
        -M 'r:|[.,_-]=* r:|=*' \
        -M 'r:|.=* r:|=*'
}
# caching
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache yes
zstyle ':completion::complete:*' cache-path $XDG_CACHE_HOME/zsh

zstyle ':completion:*:*:*:*:*' menu true select search interactive
zstyle ':completion:*' list-grouped false
zstyle ':completion:*' list-separator ''
zstyle ':completion:*' group-name ''
zstyle ':completion:*' verbose yes
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*:warnings' format '%F{red}%B-- No match for: %d --%b%f'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
zstyle ':completion:*:descriptions' format '[%d]'

## completion system
# zstyle ':completion:*:approximate:'                 max-errors 'reply=( $((($#PREFIX+$#SUFFIX)/3 )) numeric )' # allow one error for every three characters typed in approximate completer
# zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'              # don't complete backup files as executables
# zstyle ':completion:*:correct:*'                    insert-unambiguous true             # start menu completion only if it could find no unambiguous initial string
# zstyle ':completion:*:corrections'                  format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}' #
# zstyle ':completion:*:correct:*'                    original true
# zstyle ':completion:*:default'                      list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==34=00}:${(s.:.)LS_COLORS}")'
# zstyle ':completion:*:descriptions'                 format $'\n%F{magenta}%U%B%d%b%u%f\n'
# zstyle ':completion:*:*:cd:*:directory-stack'       menu yes select
# zstyle ':completion:*:expand:*'                     tag-order all-expansions            # insert all expansions for expand completer
# zstyle ':completion:*:history-words'                list false                          #
# zstyle ':completion:*:history-words'                menu yes                            # activate menu
# zstyle ':completion:*:history-words'                remove-all-dups yes                 # ignore duplicate entries
# zstyle ':completion:*:history-words'                stop yes                            #
# zstyle ':completion:*'                              matcher-list 'm:{a-z}={A-Z}'        # match uppercase from lowercase
# zstyle ':completion:*:matches'                      group 'yes'                         # separate matches into groups
# zstyle ':completion:*'                              group-name ''                       # group results by category
# zstyle -e ':completion:*'                           special-dirs '[[ $PREFIX = (../)#(|.|..) ]] && reply=(..)'
# zstyle ':completion:*:messages'                     format '%d'                         #
# zstyle ':completion:*:options'                      auto-description '%d'               #
# zstyle ':completion:*:options'                      description 'yes'                   # describe options in full
# zstyle ':completion:*:processes'                    command 'ps -au$USER'               # on processes completion complete all user processes
# zstyle ':completion:*:*:-subscript-:*'              tag-order indexes parameters        # offer indexes before parameters in subscripts
# zstyle ':completion:*'                              verbose true                        # provide verbose completion information
# zstyle ':completion:*:warnings'                     format $'%{\e[0;31m%}No matches for:%{\e[0m%} %d' # set format for warnings
# zstyle ':completion:*:*:zcompile:*'                 ignored-patterns '(*~|*.zwc)'       # define files to ignore for zcompile
# zstyle ':completion:correct:'                       prompt 'correct to: %e'             #
# zstyle ':completion::(^approximate*):*:functions'   ignored-patterns '_*'               # Ignore completion functions for commands you don't have:
# zstyle ':completion::complete:*'                    gain-privileges 1                   # enabling autocompletion of privileged environments in privileged commands

# complete manual by their section
zstyle ':completion:*:manuals'                      separate-sections true
zstyle ':completion:*:manuals.*'                    insert-sections   true
zstyle ':completion:*:man:*'                        menu yes select

# Kill
zstyle ':completion:*:*:*:*:processes'              command 'ps -u $LOGNAME -o pid,user,command -w,nice'
zstyle ':completion:*:*:kill:*:processes'           list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
zstyle ':completion:*:*:kill:*'                     menu yes select
zstyle ':completion:*:*:kill:*'                     force-list always
zstyle ':completion:*:*:kill:*'                     insert-ids single

# Media Players
zstyle ':completion:*:*:mpg123:*'                   file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
zstyle ':completion:*:*:mpg321:*'                   file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
zstyle ':completion:*:*:ogg123:*'                   file-patterns '*.(ogg|OGG|flac):ogg\ files *(-/):directories'
zstyle ':completion:*:*:mocp:*'                     file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories'

# SSH/SCP/RSYNC
zstyle ':completion:*:(ssh|scp|rsync):*'            tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
zstyle ':completion:*:(scp|rsync):*'                group-order users files all-files hosts-domain hosts-host hosts-ipaddr
zstyle ':completion:*:ssh:*'                        group-order users hosts-domain hosts-host users hosts-ipaddr
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*'
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'

# Fuzzy matching of completions
# https://grml.org/zsh/zsh-lovers.html
zstyle ':completion:*' completer _complete _match _approximate _extensions _files_enhance
zstyle ':completion:*:match:*' original only
zstyle -e ':completion:*:approximate:*' \
  max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'

zstyle ':completion:*' regular false

# In menu-style completion, give a status bar
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'

## correction
# run rehash on completion so new installed program are found automatically:
_force_rehash() {
  (( CURRENT == 1 )) && rehash
  return 1 # Because we didn't really complete anything
}

# host completion /* add brackets as vim can't parse zsh's complex cmdlines 8-) {{{ */
# [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
# [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()

hosts=(`hostname` "$_ssh_hosts[@]" "$_etc_hosts[@]" localhost)
zstyle ':completion:*:hosts' hosts $hosts

# Complete words from tmux pane(s) {{{1
# Source: http://blog.plenz.com/2012-01/zsh-complete-words-from-tmux-pane.html
# Gist: https://gist.github.com/blueyed/6856354
_tmux_pane_words()
{
    local expl
    local -a w
    if [[ -z "$TMUX_PANE" ]]; then
        _message "not running inside tmux!"
        return 1
    fi

    # Based on vim-tmuxcomplete's splitwords function.
    # https://github.com/wellle/tmux-complete.vim/blob/master/sh/tmuxcomplete
    _tmux_capture_pane()
    {
        tmux capture-pane -J -p -S -100 $@ |
            # Remove "^C".
            sed 's/\^C\S*/ /g' |
            # copy lines and split words
            sed -e 'p;s/[^a-zA-Z0-9_]/ /g' |
            # split on spaces
            tr -s '[:space:]' '\n' |
            # remove surrounding non-word characters
            =grep -o "\w.*\w"
    }
    # Capture current pane first.
    w=( ${(u)=$(_tmux_capture_pane)} )
    echo $w > /tmp/w1
    local i
    for i in $(tmux list-panes -F '#D'); do
        # Skip current pane (handled before).
        [[ "$TMUX_PANE" = "$i" ]] && continue
        w+=( ${(u)=$(_tmux_capture_pane -t $i)} )
    done
    _wanted values expl 'words from current tmux pane' compadd -a w
}

zle -C tmux-pane-words-prefix   complete-word _generic
zle -C tmux-pane-words-anywhere complete-word _generic
bindkey '^X^Tt' tmux-pane-words-prefix
bindkey '^X^TT' tmux-pane-words-anywhere
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
# Display the (interactive) menu on first execution of the hotkey.
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' menu yes select interactive
# zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
# }}}


<gh_stars>10-100
local user_host=''
local current_dir=`fgc 249`'\w'$NOC
local pc=''

# add a fix for Solaris' backward id command
id=`id |cut -f1 -d' '|sed -e 's/(.*$//'|cut -f2 -d'='`

if [ "$id" -eq 0 ]; then
  user_host=`fgc 196`'\u'`fgc 11`'@'`fgc 197`'\h'$NOC
  pc=`fgc 196`➤$NOC
else
  user_host=`fgc 46`'\u'`fgc 11`'@'`fgc 197`'\h'$NOC
  pc=➤$NOC
fi

PS1="${user_host} ${current_dir}
${pc} "$NOC


<gh_stars>0
#!/bin/bash

echo "Setting up a security testuser"

. addSecurityAccountTestUser.sh

. generateTokenWithUser.sh

echo "Setting up a security testuser...Done"


<reponame>gitter-badger/megadepth<filename>get_htslib.sh
#!/usr/bin/env bash

set -ex

#macos:
#   x86_64-apple-darwin12 (CC=o64-gcc)
#OR
#   i386-apple-darwin1 (CC=o32-gcc)
#windows:
#   x86_64-w64-mingw32 (64bit)
#OR
#   i686-w64-mingw32 (32bit)

compiler=$1
#"macos" or "windows" (or nothing for normal linux build)
platform=$2

target_dir=htslib
if [[ -n $platform && "$platform" != "hbb" ]]; then
    target_dir="htslib_"${platform}
fi

#VER=1.9
#VER=1.10.2
VER=1.11
ar=htslib-${VER}.tar.bz2
if [[ ! -s $target_dir ]] ; then
    curl -OL https://github.com/samtools/htslib/releases/download/${VER}/${ar}
    bzip2 -dc ${ar} | tar xvf -
    rm -f ${ar}
    mv htslib-${VER} $target_dir
fi
pushd $target_dir

#autoheader
#autoconf
make clean

if [[ "$compiler" == "linux" ]]; then
    if [[ "$platform" == "hbb" ]]; then
        ./configure --enable-libcurl --disable-bz2 --disable-lzma --with-libdeflate
        make libhts.a
    else
        ./configure --disable-libcurl --disable-bz2 --disable-lzma --with-libdeflate
        make
    fi
else
    if [[ "$platform" == "macos" ]]; then
    	./configure --enable-plugins --enable-libcurl --disable-bz2 --disable-lzma --with-libdeflate --host=$compiler
        #inherit CC, AR, and RANLIB from build_no_container_xcross.sh
        echo $CC
        echo $AR
        echo $RANLIB
        #only make static lib for cross-compilation for now
        #export CC=/opt/osxcross/target/bin/${compiler}-gcc
        #export AR=/opt/osxcross/target/bin/${compiler}-ar
        #export RANLIB=/opt/osxcross/target/bin/${compiler}-ranlib
    else # windows
    	./configure --disable-bz2 --disable-lzma --with-libdeflate --host=$compiler
        export CC=${compiler}-gcc
        export AR=${compiler}-ar
        export RANLIB=${compiler}-ranlib
    fi
    make CC=$CC AR=$AR RANLIB=$RANLIB libhts.a
fi
popd


<gh_stars>0
export GRAPHS="./graphs"
export WORKING_FOLDER="./temp"
export KGTK_OPTIONS="--debug"

echo -e "\n*** Sort the claims and qualifiers file on the id column: ***"
time kgtk ${KGTK_OPTIONS} graph-statistics \
    -i ${GRAPHS}/claims.tsv.gz \
    -o ${GRAPHS}/metadata.pagerank.undirected.tsv.gz \
    --compute-pagerank True \
    --compute-hits False \
    --page-rank-property Pundirected_pagerank \
    --use-mgzip True \
    --mgzip-threads 12 \
    --output-degrees False \
    --output-pagerank True \
    --output-hits False \
    --output-statistics-only \
    --undirected True \
    --log-file ${WORKING_FOLDER}/metadata.pagerank.undirected.summary.txt


#!/usr/bin/env bash

KC=$1

if [ -z ${KC} ]; then
    KC='/root/.kube/config'
fi

### Deploy spark operator
helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
helm  install incubator/sparkoperator --namespace spark-operator --set enableWebhook=true
kubectl --kubeconfig=${KC} create serviceaccount spark
kubectl --kubeconfig=${KC} create clusterrolebinding spark-role --clusterrole=edit --serviceaccount=default:spark --namespace=default


#!/bin/bash

###############################################################################
echo "Hot Corners"
###############################################################################

# Possible values:
#   0: no-op
#   2: Mission Control
#   3: Show application windows
#   4: Desktop
#   5: Start screen saver
#   6: Disable screen saver
#   7: Dashboard
#  10: Put display to sleep
#  11: Launchpad
#  12: Notification Center

echo "∙ Hot Corner: Top Left — Mission Control"
defaults write com.apple.dock wvous-tl-corner -int 2
defaults write com.apple.dock wvous-tl-modifier -int 0

echo "∙ Hot Corner: Top Right — None"
defaults write com.apple.dock wvous-tr-corner -int 0
defaults write com.apple.dock wvous-tr-modifier -int 0

echo "∙ Hot Corner: Bottom Left — None"
defaults write com.apple.dock wvous-bl-corner -int 0
defaults write com.apple.dock wvous-bl-modifier -int 0

echo "∙ Hot Corner: Bottom Right — Desktop"
defaults write com.apple.dock wvous-br-corner -int 4
defaults write com.apple.dock wvous-br-modifier -int 0


#!/bin/bash -e

source ./cluster/gocli.sh

$gocli_interactive "$@"


<reponame>RubenPX/django-orchestra<gh_stars>0
#!/bin/bash

set -ue

# https://git.io/deploy-orchestra
# bash <( curl https://raw.githubusercontent.com/glic3rinu/django-orchestra/master/scripts/containers/deploy.sh ) [--noinput username]

bold=$(tput -T ${TERM:-xterm} bold)
normal=$(tput -T ${TERM:-xterm} sgr0)

function test_orchestra () {
    user=$1
    ip_addr=$2
    # Test if serving requests
    echo
    echo ${bold}
    echo "> Checking if Orchestra is serving on https://${ip_addr}/admin/ ..."
    if [[ $noinput ]]; then
        echo "  - username: $user"
        echo "  - password: <PASSWORD>${<PASSWORD>}"
    fi
    echo
    if [[ $(curl -s -L -k -c /tmp/cookies.txt -b /tmp/cookies.txt https://$ip_addr/admin/ | grep 'Panel Hosting Management') ]]; then
        token=$(grep csrftoken /tmp/cookies.txt | awk {'print $7'})
        if [[ $(curl -s -L -k -c /tmp/cookies.txt -b /tmp/cookies.txt \
            -d "username=$user&password=<PASSWORD>&csrfmiddlewaretoken=$token" \
            -e https://$ip_addr/admin/ \
            https://$ip_addr/admin/login/?next=/admin/ | grep '<title>Panel Hosting Management</title>') ]]; then
                echo "${bold}  ** Orchestra appears to be working!${normal}"
        else
            echo "${bold}  ** Err. Couldn't login :(${normal}" >&2
        fi
    else
        echo "${bold}  ** Err. Orchestra is not responding responding on https://${ip_addr}/admin/${normal}" >&2
    fi
    echo
}

function install_orchestra () {
    dev=$1
    home=$2
    repo=$3

    if [[ $dev ]]; then
        # Install from source
        python_path=$(python3 -c "import sys; print([path for path in sys.path if path.startswith('/usr/local/lib/python')][1]);")
        if [[ -d $python_path/orchestra ]]; then
            run sudo rm -fr $python_path/orchestra
        fi
        orch_version=$(python3 -c "from orchestra import get_version; print(get_version());" 2> /dev/null || echo '')
        if [[ ! $orch_version ]]; then
            # First Orchestra installation
            run sudo mkdir -p /usr/share/man/man1
            run sudo mkdir -p /usr/share/man/man7
            run sudo apt-get update
            run sudo apt-get -y install git python3-pip
            surun "git clone $repo $home/django-orchestra" || {
                # Finishing partial installation
                surun "export GIT_DIR=$home/django-orchestra/.git; git pull"
            }
            echo $home/django-orchestra/ | sudo tee "$python_path/orchestra.pth"
        else
            echo "You may want to execute 'git pull origin master'?"
        fi
        if [[ -L /usr/local/bin/orchestra-admin || -f /usr/local/bin/orchestra-admin ]]; then
            run sudo rm -f /usr/local/bin/{orchestra-admin,orchestra-beat}
        fi
        run sudo pip3 install -e $home/django-orchestra
        run sudo orchestra-admin install_requirements --testing
    else
        # Install from pip
        run sudo orchestra-admin install_requirements
        run sudo pip3 install -e git+https://github.com/ribaguifi/django-orchestra.git#egg=django-orchestra
    fi
}

function setup_database () {
    dev=$1
    noinput=$2
    run sudo apt-get install -y postgresql
    run sudo pip install psycopg2
    # Setup Database
    if [[ $dev ]]; then
        # Speeding up tests, don't do this in production!
        . /usr/share/postgresql-common/init.d-functions
        pg_version=$(psql --version | head -n1 | awk '{print $3}' | sed -e "s,\..*,,")
        sudo sed -i \
            -e "s/^#fsync =\s*.*/fsync = off/" \
            -e "s/^#full_page_writes =\s*.*/full_page_writes = off/" \
            /etc/postgresql/${pg_version}/main/postgresql.conf
    fi
    run sudo service postgresql start
    if [[ $noinput ]]; then
        db_password=$(ps aux | sha256sum | base64 | head -c 10)
        run sudo python3 -W ignore manage.py setuppostgres --noinput --db_password $db_password
    else
        run sudo python3 -W ignore manage.py setuppostgres
    fi
    if [[ $dev ]]; then
        # Create database permissions are needed for running tests
        sudo su postgres -c 'psql -c "ALTER USER orchestra CREATEDB;"'
    fi
    surun "python3 -W ignore manage.py migrate $noinput"
}

function create_orchestra_superuser () {
    user=$1
    email=$2
    password=$3
        cat <<- EOF | surun "python3 -W ignore manage.py shell"
			from orchestra.contrib.accounts.models import Account
			if not Account.objects.filter(username="$user").exists():
			    print('Creating orchestra superuser')
			    Account.objects.create_superuser("$user", "$email", "$password")

			EOF
}

print_help () {
    cat <<- EOF

		${bold}NAME${normal}
		    ${bold}deploy.sh${normal} - Deploy a django-orchestra project

		${bold}SYNOPSIS${normal}
		    ${bold}deploy.sh${normal} [--noinput=USERNAME] [--dev] [--repo=GITREPO] [--projectname=NAME]

		${bold}OPTIONS${normal}
		    ${bold}-n, --noinput=USERNAME${normal}
		            Execute the script without any user input, an existing system USERNAME is required.
		            requires the script to be executed as root user

		    ${bold}-d, --dev${normal}
		            Perform a deployment suitable for development:
		                1. debug mode
		                2. dependencies for running tests
		                3. access to source code

		    ${bold}-r, --repo=GITREPO${normal}
		            Chose which repo use for development deployment
		            this option requires --dev option to be selected
		            https://github.com/glic3rinu/django-orchestra.git is used by default

		    ${bold}-p, --projectname=NAME${normal}
		            Specify a project name, this will be asked on interactive mode
		            and name 'panel' will be used otherwise.

		    ${bold}-h, --help${normal}
		            Display this message

		${bold}EXAMPLES${normal}
		    deploy.sh

		    deploy.sh --dev

		    deploy.sh --dev --noinput orchestra

		EOF
}

function main () {
    # Input validation
    opts=$(getopt -o n:dr:h -l noinput:,dev,repo:,help -- "$@") || exit 1
    set -- $opts

    dev=
    noinput=
    user=$(whoami)
    repo='https://github.com/ribaguifi/django-orchestra.git'
    brepo=
    project_name="panel"
    bproject_name=

    while [ $# -gt 0 ]; do
        case $1 in
            -n|--noinput) user="${2:1:${#2}-2}"; noinput='--noinput'; shift ;;
            -r|--repo) repo="${2:1:${#2}-2}"; brepo=true; shift ;;
            -d|--dev) dev=true; ;;
            -p|--project_name) project_name="${2:1:${#2}-2}"; bproject_name=true; shift ;;
            -h|--help) print_help; exit 0 ;;
            (--) shift; break;;
            (-*) echo "$0: Err. - unrecognized option $1" 1>&2; exit 1;;
            (*) break;;
        esac
        shift
    done
    unset OPTIND
    unset opt

    if [[ ! $noinput ]]; then
        if [[ $(whoami) == 'root' ]]; then
            echo -e "\nErr. Interactive script should run as a regular user\n" >&2
            exit 2
        fi
        run () { echo " ${bold}\$ ${@}${normal}"; ${@}; }
        surun () { echo " ${bold}\$ ${@}${normal}"; ${@}; }
    else
        if [[ $(whoami) != 'root' ]]; then
            echo -e "\nErr. --noinput should run as root\n" >&2
            exit 3
        elif ! id $user &> /dev/null; then
            echo -e "\nErr. User $2 does not exist\n" >&2
            exit 4
        fi
        run () { echo " ${bold}\$ ${@}${normal}"; ${@}; }
        surun () { echo " ${bold}\$ su $user -c \"${@}\"${normal}"; su $user -c "${@}"; }
    fi
    if [[ ! $dev && $brepo ]]; then
        echo -e "\nErr. --repo only makes sense with --dev\n" >&2
        exit 5
    fi

    sudo true
    if [[ ! $noinput && ! $bproject_name ]]; then
        while true; do
            read -p "Enter a project name [panel]: " project_name
            if [[ ! "$project_name" ]]; then
                project_name="panel"
                break
            elif [[ ! $(echo "$project_name" | grep '^[_a-zA-Z]\w*$') ]]; then
                if [[ ! $(echo "$project_name" | grep '^[_a-zA-Z]') ]]; then
                    message='make sure the name begins with a letter or underscore'
                else
                    message='use only numbers, letters and underscores'
                fi
                echo "'$project_name' is not a valid %s name. Please $message."
            else
                break
           fi
        done
    fi

    task=cronbeat
    if [[ ! $noinput ]]; then
        while true; do
            read -p "Do you want to use celery or cronbeat (orchestra.contrib.tasks) for task execution [cronbeat]? " task
            case $task in
                'celery' ) task=celery; break;;
                'cronbeat' ) task=cronbeat; break;;
                '' ) task=cronbeat; break;;
                * ) echo "Please answer celery or cronbeat.";;
            esac
        done
    fi

    home=$(eval echo ~$user)
    cd $home

    install_orchestra "$dev" $home $repo
    if [[ ! -e $project_name ]]; then
        surun "orchestra-admin startproject $project_name"
    else
        echo "Not deploying, $project_name already exists."
    fi
    cd $project_name
    setup_database "$dev" "$noinput"

    if [[ $noinput ]]; then
        create_orchestra_superuser $user $user@localhost orchestra
    fi

    if [[ "$task" == "celery" ]]; then
        run sudo apt-get install rabbitmq-server
        run sudo python3 -W ignore manage.py setupcelery --username $user
    else
        surun "python3 -W ignore manage.py setupcronbeat"
        surun "python3 -W ignore manage.py syncperiodictasks"
    fi

    run sudo python3 -W ignore manage.py setuplog --noinput

    surun "python3 -W ignore manage.py collectstatic --noinput"
    run sudo apt-get install nginx-full uwsgi uwsgi-plugin-python3
    run sudo python3 -W ignore manage.py setupnginx --user $user $noinput
    run sudo python3 -W ignore manage.py restartservices
    run sudo python3 -W ignore manage.py startservices
    surun "python3 -W ignore manage.py check --deploy"

    ip_addr=$(ip addr show eth0 | grep 'inet ' | sed -r "s/.*inet ([^\s]*).*/\1/" | cut -d'/' -f1)
    if [[ ! $ip_addr ]]; then
        ip_addr=127.0.0.1
    fi

    # Configure settings file into debug mode
    if [[ $dev ]]; then
        sed -i \
            -e "s/^\s*#\s*'debug_toolbar',/    'debug_toolbar',/" \
            -e "s/^\s*#\s*'django_nose',/    'django_nose',/" $project_name/settings.py
        if [[ ! $(grep '^INTERNAL_IPS\s*=' $project_name/settings.py) ]]; then
            echo "INTERNAL_IPS = ('$ip_addr',)" >> $project_name/settings.py
        fi
    fi

    test_orchestra $user $ip_addr
}

# Wrap it all on a function to avoid partial executions when running through wget/curl
main $@


<gh_stars>100-1000
#!/bin/sh

if ! command -v jq >/dev/null; then
    echo 'Please install "jq" to use this script.' >&2
    exit 1
fi

if [ "$#" -ne 1 ]; then
    echo 'Please pass a source package name as the first argument.' >&2
    exit 1
fi
package="$1"
versions=$(curl -s "https://sources.debian.org/api/src/$package/")

if [ "$(echo "$versions" | jq '.error != null')" = 'true' ]; then
    echo "That package does not exists in the Debian sid source repositories: '$package'." >&2
    exit 1
fi

version=$(echo "$versions" | jq -r '.versions[] | select(any(.suites[]; . == "sid")) | first(.version)')

control_path=$(curl -s "https://sources.debian.org/api/src/$package/$version/debian/control/" | jq -r '.raw_url')

curl -s "https://sources.debian.org/$control_path"


<gh_stars>0
#!/bin/bash

sudo apt -y install curl
sudo apt -y install wget

# Get Anaconda
/Methods/Tools/Install/Languages/Anaconda2.sh

# Get the ARK
/Methods/Tools/Install/Toolkits/ARK.sh


#!/bin/sh

PYTHON=python
if (cat /proc/version |grep -i cygwin) ; then
    PYTHON=python3
fi

i=0
for twid in 762697549979484161 \
                758761004255711232 \
                762602474293321728 \
                463440424141459456 \
                761310539280769024 \
                762738381143023620 \
                762678098206814208 \
                760888006022574081 \
                761779435653652480 \
                762518022372352004 \
                763841870480879617 \
                761967912085323776 \
                764859108579274752 \
                866553062361415681 \
            ;
do
    i=$(($i+1))
    echo refreshing tweet $twid
    $PYTHON ./tweet2latex.py --pdflatex --caption $twid |tee tweet$i.tex
done


<gh_stars>0
#!/bin/bash
# create multiresolution windows icon
#mainnet
ICON_SRC=../../src/qt/res/icons/crca.png
ICON_DST=../../src/qt/res/icons/crca.ico
convert ${ICON_SRC} -resize 16x16 crca-16.png
convert ${ICON_SRC} -resize 32x32 crca-32.png
convert ${ICON_SRC} -resize 48x48 crca-48.png
convert crca-16.png crca-32.png crca-48.png ${ICON_DST}
#testnet
ICON_SRC=../../src/qt/res/icons/crca_testnet.png
ICON_DST=../../src/qt/res/icons/crca_testnet.ico
convert ${ICON_SRC} -resize 16x16 crca-16.png
convert ${ICON_SRC} -resize 32x32 crca-32.png
convert ${ICON_SRC} -resize 48x48 crca-48.png
convert crca-16.png crca-32.png crca-48.png ${ICON_DST}
rm crca-16.png crca-32.png crca-48.png


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

pushd ../crypto-sdk
    PLATFORM=ios ./build.sh
popd


#!/bin/bash
cd $OOS_SOURCE_DIR/apex
perl -i -p -e "s/OOS_APEX_PUB_USR_PWD/$OOS_APEX_PUB_USR_PWD/g" apex_config.sql

sqlplus -L sys/$OOS_ORACLE_PWD@localhost:$OOS_ORACLE_TNS_PORT/xepdb1 as sysdba @apex_config.sql

#Create APEX Users
if [ "$OOS_APEX_CREATE_USER_YN" = "Y" ]; then
  #Starting in APEX 5 need to separate since can only set one set_security_group_id per session
  echo creating APEX Workspace
  echo exit | sqlplus -L sys/$OOS_ORACLE_PWD@localhost:$OOS_ORACLE_TNS_PORT/xepdb1 as sysdba @create_workspace.sql $OOS_APEX_USER_WORKSPACE $OOS_ORACLE_USER_NAME

  echo creating APEX User
  echo exit | sqlplus -L sys/$OOS_ORACLE_PWD@localhost:$OOS_ORACLE_TNS_PORT/xepdb1 as sysdba @create_user.sql $OOS_APEX_USER_WORKSPACE $OOS_ORACLE_USER_NAME $OOS_APEX_USER_NAME $OOS_APEX_USER_PASS

else
  echo Not creating APEX User
fi

#Create ACL
if [ "$OOS_ORACLE_ACL_APEX_ALL_YN" = "Y" ]; then
  echo Creating Network ACL ALL
  sqlplus -L sys/$OOS_ORACLE_PWD@localhost:$OOS_ORACLE_TNS_PORT/xepdb1 as sysdba @apex_acl_all.sql
else
  echo Not created APEX ACL
fi


#!/bin/sh
################################################################################
# PROGRAM BY <NAME>, EXTRACT XML TO A CSV
################################################################################
# CONSTANTS
readonly CONFIGURATION="../python/enthic/configuration.json";
readonly OUTPUT_DIR=$(jq -r .outputPath $CONFIGURATION);
readonly BUNDLE=$(jq -r .bundleTmpFile $CONFIGURATION);
readonly IDENTITY=$(jq -r .identityTmpFile $CONFIGURATION);
readonly SORT_BUNDLE=$(jq -r .sortBundleTmpFile $CONFIGURATION);
# 1) EXECUTE IT PYTHON STEP FROM py FOLDER
cd ../python || exit;
################################################################################
# 2) SORT THE IDENTITY FILE TO A FINAL CSV FILE
sort "$OUTPUT_DIR$IDENTITY" -uk1,1 -t";" > "${OUTPUT_DIR}identity.csv"
################################################################################
# 3) SORT TO SUM ALL AMOUNT FOR A SOCIETY, A BUNDLE IN A GIVEN YEAR
sort "$OUTPUT_DIR$BUNDLE" > "$OUTPUT_DIR$SORT_BUNDLE"
################################################################################
# 4) PYTHON STEP SUM A BUNDLE OF A COMPANY FOR A GIVEN YEAR
python3 enthic/treat_bundle.py
exit
################################################################################
# 5) MOVE TO LOAD DIRECTORY FOR MYSQL 8 COMPATIBILITY
mv "$OUTPUT_DIR*.csv" /var/lib/mysql
################################################################################
# 6) CLEAN UP OUTPUT DIRECTORY
rm -rf "$OUTPUT_DIR*.tmp";


#!/bin/sh

# Copyright (c) 2015, Nordic Semiconductor
# 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.
#
# Description:
# ------------
# The script allows to perform DFU operation from the computer using Android device as a dongle.
# The script may be run on Linux or Mac.
#
# Requirements:
# -------------
# 1. Android device with Android version 4.3+ connected by USB cable with the PC
# 2. The path to Android platform-tools directory must be added to %PATH% environment variable
# 3. nRF Toolbox (1.11.0+) or nRF Connect (2.1.0+) (formerly known as nRF Master Control Panel) application installed on the Android device
# 4. "Developer options" and "USB debugging" must be enabled on the Android device
#
# Usage:
# ------
# 1. Open command line
# 2. Type "sh dfu.sh -?" and press ENTER
#
# Android Debug Bridge (adb):
# ---------------------------
# You must have Android platform tools installed on the computer or the path to the adb application set in the PATH.
# Go to http://developer.android.com/sdk/index.html for more information how to install it on the computer.
# You do not need the whole ADT Bundle (with Eclipse or Android Studio). Only SDK Tools with Platform Tools are required.

# ==================================================================================
PROGRAM=$0
DEVICE=""
S_DEVICE=""
ADDRESS=""
HEX_FILE=""
HEX_PATH=""
NAME="DfuTarg"
INIT_FILE=""
INIT_PATH=""
E_INIT_FILE=""
TYPE=0
# Modify this in order to keep the bond information after application upgrade
KEEP_BOND=false

# ==================================================================================
# Common methods

intro() {
    echo "===================================="
    echo "Nordic Semiconductor DFU bash script"
    echo "===================================="
}

error() {
    exit 1
}

quit() {
    exit 0
}

usage() {
    echo "Usage: $PROGRAM [options] hex-file"
    echo "Options:"
    echo "      -d device serial number. Use \"adb devices\" to get list of serial numbers"
    echo "      -a target device address in XX:XX:XX:XX:XX:XX format"
    echo "      -n name optional device name"
    echo "      -t firmware_type 1=Soft Device, 2=Bootloader, 4=Application, 0 (default)=Auto or all from ZIP"
    echo "      -i init the init packet *.dat file"
}

# ==================================================================================
# Write intro
intro

# ==================================================================================
# Check ADB
adb devices > /dev/null 2>&1
if [ ! "$?" = "0" ] ; then
    echo "Error: adb is not recognized as an external command."
    echo "       Add [Android Bundle path]\\\android-sdk-macosx\\\platform-tools" to \$PATH
    error
fi

# ==================================================================================
# Parse options
while getopts ":d:a:n:t:i:" VALUE "$@"
do
    case $VALUE in
    d )
        DEVICE="$OPTARG"
        S_DEVICE="-s $OPTARG"
        ;;
    a ) ADDRESS="$OPTARG" ;;
    n ) NAME="$OPTARG" ;;
    t ) TYPE=$OPTARG ;;
    i )
        INIT_PATH="$OPTARG"
    	INIT_FILE=$(basename $INIT_PATH)
		E_INIT_FILE="-e no.nordicsemi.android.dfu.extra.EXTRA_INIT_FILE_PATH \"/sdcard/Nordic Semiconductor/Upload/$INIT_FILE\""
    	;;
    : ) echo "Error: Option -$OPTARG must have a string value.\n"
        usage
        error
        ;;
    ? ) usage
        quit
        ;;
    esac
done
shift $((OPTIND - 1))

# Get the HEX file name or write an error
if [ "$1" = "" ] ; then
    echo "Error: HEX file name not specified.\n"
    usage
    error
else
    HEX_PATH=$1
    HEX_FILE=$(basename $HEX_PATH)
fi

# ==================================================================================
if [ "$DEVICE" = "" ] ; then
    # Check if there is only one device connected
    C=$(adb devices | grep -e "device" -e "unauthorized" -e "emulator" | grep -c -v "devices")
    if [ "$C" = "0" ] ; then
        echo "Error: No device connected.";
        error
    fi
    if [ ! "$C" = "1" ] ; then
        echo "Error: More than one device connected."
        echo "       Specify the device serial number using -d option:"
        adb devices
        usage
        error
    fi
else
    # Check if specified device is connected
    C=$(adb devices | grep -c "$DEVICE")
    if [ "$C" = "0" ] ; then
        echo "Error: Device with serial number \"$DEVICE\" is not connected."
        adb devices
        error
    fi
fi

# ==================================================================================
# Copy selected file onto the device
printf "Copying \"$HEX_FILE\" to /sdcard/Nordic Semiconductor/Upload/..."
adb push $S_DEVICE $HEX_PATH "/sdcard/Nordic Semiconductor/Upload/$HEX_FILE" > /dev/null 2>&1
if [ "#?" = "1" ] ; then
    echo "FAIL"
    echo "Error: Device not found."
    error
else
    echo "OK"
fi

if [ ! "$INIT_FILE" = "" ] ; then
	printf "Copying \"$INIT_FILE\" to /sdcard/Nordic Semiconductor/Upload/..."
	adb push $S_DEVICE $INIT_PATH "/sdcard/Nordic Semiconductor/Upload/$INIT_FILE" > /dev/null 2>&1
	if [ "#?" = "1" ] ; then
	    echo "FAIL"
	    echo "Error: Device not found."
	    error
	else
	    echo "OK"
	fi
fi

if [ "$ADDRESS" = "" ] ; then
	# Start DFU Initiator activity if no target device specified
    printf "Starting DFU Initiator activity..."
    adb $S_DEVICE shell am start -a no.nordicsemi.android.action.DFU_UPLOAD --ei no.nordicsemi.android.dfu.extra.EXTRA_FILE_TYPE $TYPE --ez no.nordicsemi.android.dfu.extra.EXTRA_KEEP_BOND $KEEP_BOND -e no.nordicsemi.android.dfu.extra.EXTRA_FILE_PATH "/sdcard/Nordic Semiconductor/Upload/$HEX_FILE" $E_INIT_FILE | grep "Error" > /dev/null 2>&1
else
	# Start the DFU service directly
    printf "Starting DFU service..."
    adb $S_DEVICE shell am startservice -n no.nordicsemi.android.nrftoolbox/.dfu.DfuService -a no.nordicsemi.android.action.DFU_UPLOAD --ei no.nordicsemi.android.dfu.extra.EXTRA_FILE_TYPE --ez no.nordicsemi.android.dfu.extra.EXTRA_KEEP_BOND $KEEP_BOND -e no.nordicsemi.android.dfu.extra.EXTRA_DEVICE_ADDRESS $ADDRESS -e no.nordicsemi.android.dfu.extra.EXTRA_DEVICE_NAME $NAME -e no.nordicsemi.android.dfu.extra.EXTRA_FILE_PATH "/sdcard/Nordic Semiconductor/Upload/$HEX_FILE" $E_INIT_FILE | grep "Error" > /dev/null 2>&1
fi

if [ "$?" = "0" ] ; then
    echo "FAIL"
    echo "Error: Required application not installed."
    error
else
    echo "OK"
    echo "Select DFU target on your Android device to start upload."
fi


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

- TODO: ffmpeg resample video to iPhone 6 resolution: 1334 x 750 : See https://en.wikipedia.org/wiki/IPhone_6
https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg
 If you need to simply resize your video to a specific size (e.g 320x240), you can use the scale filter in its most basic form:

# E.g. ffmpeg -i "$1" -vf scale="'if(gt(a,4/3),1334,-1)':'if(gt(a,4/3),-1,750)'" "iPhone6_1334x750_$1"

ffmpeg -i input.avi -vf scale=320:240 output.avi

Same works for images too:

ffmpeg -i input.jpg -vf scale=320:240 output_320x240.png

 As you can see, the aspect ratio is not the same as in the original image, so the image appears stretched. If we'd like to keep the aspect ratio, we need to specify only one component, either width or height, and set the other component to -1. For example, this command line:

ffmpeg -i input.jpg -vf scale=320:-1 output_320.png

will set the width of the output image to 320 pixels and will calculate the height of the output image according to the aspect ratio of the input image. The resulting image will have a dimension of 320x207 pixels.

 There are also some useful constants which can be used instead of numbers, to specify width and height of the output image. For example, if you want to stretch the image in such a way to only double the width of the input image, you can use something like this (iw = input width constant, ih = input height constant):

ffmpeg -i input.jpg -vf scale=iw*2:ih input_double_width.png

 If you want to half the size of the picture, just multiply by .5

ffmpeg -i input.jpg -vf scale=iw*.5:ih*.5 input_half_size.png

Sometimes there is a need to scale the input image in such way it fits into a specified rectangle, i.e. if you have a placeholder (empty rectangle) in which you want to scale any given image. This is a little bit tricky, since you need to check the original aspect ratio, in order to decide which component to specify and to set the other component to -1 (to keep the aspect ratio). For example, if we would like to scale our input image into a rectangle with dimensions of 320x240, we could use something like this:

ffmpeg -i input.jpg -vf scale="'if(gt(a,4/3),320,-1)':'if(gt(a,4/3),-1,240)'" output_320x240_boxed.png

 The area below the image is shaded with boxes to show there was some additional space left in the box, due to the original image not having the same aspect ratio as the box, in which the image was supposed to fit.

Of course, this approach is only used when your input image is not known in advance, because if it was known, you would easily figure out if you need to use either:

-vf scale=320:-1

or

-vf scale=-1:240

However, you can also achieve this with the force_original_aspect_ratio option. From the documentation:

    One useful instance of this option is that when you know a specific device's maximum allowed resolution, you can use this to limit the output video to that, while retaining the aspect ratio. For example, device A allows 1280x720 playback, and your video is 1920x800. Using this option (set it to decrease) and specifying 1280x720 to the command line makes the output 1280x533.

This allows you to force the image to fit into a 320x240 box:

ffmpeg -i input.jpg -vf scale=w=320:h=240:force_original_aspect_ratio=decrease output_320.png

This produces our 320x207 image that we had seen before:


#!/bin/bash
# Please adjust CONSUL_HTTP_TOKEN and run this from remaining Consul nodes
# export CONSUL_HTTP_TOKEN="<consul-bootstrap-token>"

# Test for token variable
if [ -z "$CONSUL_HTTP_TOKEN" ]
then
      echo ">>>> Please set CONSUL_HTTP_TOKEN environment variable to bootstrap token value before running this script."
      echo ">>>> export CONSUL_HTTP_TOKEN=<bootstrap-token>"
      exit 1
fi

# Updating this node with default policy of deny
echo "Applying ACL with default deny"
sudo rm /etc/consul.d/acl.hcl
echo 'acl = {
  enabled = true,
  default_policy = "deny",
  enable_token_persistence = true
}' | sudo tee /etc/consul.d/acl.hcl
sudo chown -R consul:consul /etc/consul.d

echo "Creating token for node: $(hostname)"
policy_id=$(consul acl policy read -name consul-servers | grep -i ID | awk '{print $2}')
token=$(consul acl token create -description $(hostname) -policy-name consul-servers | grep SecretID | awk '{print $2}')

echo "Updating systemd unit file and restarting Consul"
echo "Environment=CONSUL_HTTP_TOKEN=${token}" | sudo tee -a /etc/systemd/system/consul.service
sudo systemctl daemon-reload
sudo systemctl restart consul
sudo systemctl status consul
echo "Done"


<reponame>Phitherek/auto-display-manager-cr<filename>install.sh
#!/bin/sh

if [ -z "$PREFIX" ]; then
	PREFIX="/usr/local"
fi

echo "Installing AutoDisplayManager to prefix $PREFIX..."
mkdir -p "$PREFIX/bin"
cp bin/* "$PREFIX/bin"
echo "AutoDisplayManager installed!"


<reponame>jamaps/shell_scripts<filename>FIP_script.sh<gh_stars>1-10
############################
# shell script for batch renaming, reprojecting, and converting to GTiff
# works in GDAL version 1.11
############################

# start runtime
start=`date +%s`

# create output folder
mkdir "GTiff_output"

# loop through img files (various extensions)
for i in *.{jpg,JPG,tif,tiff,jp2} # add more ext HERE
do
	# print info:
	echo "----------------------------"
	echo "$i"
	gdalinfo "$i"
	echo "----------------------------"
	# copy filename without extension:
	f="${i%.*}"
	# convert to geotiff and put in output folder:
	gdal_translate -of "GTiff" "$i" GTiff_output/"$f".tif
done

# change working directory to output folder:
cd GTiff_output

# loop through output folder
for t in *.tif
do
	echo "$t"
	# new file name
	n=$(echo $t | tr ' ' '_' | tr '-' '_' )
	m="${n%.*}"
	# reproject to WGS84
	gdalwarp -srcnodata None -dstnodata None -dstalpha -t_srs "EPSG:4326" "$t" "$n.tif"
	# print info of reprojected raster
	echo "----------------------------"
	echo "$n"
	gdalinfo "$n.tif"
	echo "----------------------------"
	# remove unprojected raster
	rm "$t"
done

# remove extra ".tif" in name
for q in *.tif
do
	m="${q%.*}"
	mv "$q" "$m"
done
end=`date +%s`

# print results
echo "----------------------------"
echo "Converted to WGS84 GTiff:"
for z in *.tif
do
	echo "$z"
done
# end runtime and print
runtime=$((end-start))
echo "----------------------------"
echo "Elapsed Time:"
echo "$runtime seconds"
echo "----------------------------"
echo "----------------------------"


#!/bin/bash
# this is a script shell for setting up the application bundle for the mac
# It should be run (not sourced) in the meshlab/src/install/macx dir.
#
# It does all the dirty work of moving all the needed plugins and frameworks into the package and runs the
# install_tool on them to change the linking path to the local version of qt

# All the stuff to be copies is in the 'distrib' folder.
cd ../../distrib

if QTDIR=""
then
QTDIR=$HOME/Qt/5.9.4/clang_64
echo "Warning QTDIR was not set. trying to guess it to" $QTDIR
fi

if ! [ -e $QTDIR ]
then
echo "Missing QT; QTDIR was wrong:" $QTDIR
fi

# change this according to the shadow build dir.
# is the root of the build e.g. where the meshlab_full.pro it can be something like
BUILDPATH="../../build-meshlab_full-Desktop_Qt_5_9_4_clang_64bit2-Release"

APPNAME="meshlab.app"
echo "Current folder is" `pwd`
echo "Hopefully I should find: " $BUILDPATH/distrib/$APPNAME
echo "Or alternatively in    : " ../distrib/$APPNAME
if ! [ -e $BUILDPATH ]
then
  BUILDPATH=..
  echo "Hopefully I should find" $BUILDPATH/distrib/$APPNAME
fi

APPFOLDER=$BUILDPATH/distrib/$APPNAME
BUNDLE="MeshLabBundle"

if [ -e $APPFOLDER -a -d $APPFOLDER ]
then
  echo "------------------"
else
  echo "Started in the wrong dir: I have not found the MeshLab.app"
  exit 0
fi

# Start by erasing everything
rm -r -f $BUNDLE

echo "Copying the built app into the bundle"
mkdir $BUNDLE
cp -r $APPFOLDER $BUNDLE
mkdir $BUNDLE/$APPNAME/Contents/PlugIns
# copy the files icons into the app.
cp ../meshlab/images/meshlab_obj.icns $BUNDLE/$APPNAME/Contents/Resources

for x in $BUILDPATH/distrib/plugins/*.dylib
do
cp ./$x $BUNDLE/meshlab.app/Contents/PlugIns/
done

for x in $BUILDPATH/distrib/plugins/*.xml
do
cp ./$x $BUNDLE/meshlab.app/Contents/PlugIns/
done

for x in $BUNDLE/meshlab.app/Contents/plugins/*.dylib
do
 install_name_tool -change libcommon.1.dylib @executable_path/libcommon.1.dylib $x
done

echo 'Copying samples and other files'

cp ../../LICENSE.txt $BUNDLE
cp ../../docs/readme.txt $BUNDLE

mkdir $BUNDLE/sample
mkdir $BUNDLE/sample/images
mkdir $BUNDLE/sample/normalmap

cp sample/texturedknot.ply $BUNDLE/sample
cp sample/texturedknot.obj $BUNDLE/sample
cp sample/texturedknot.mtl $BUNDLE/sample
cp sample/TextureDouble_A.png $BUNDLE/sample
cp sample/Laurana50k.ply $BUNDLE/sample
cp sample/duck_triangulate.dae $BUNDLE/sample
cp sample/images/duckCM.jpg $BUNDLE/sample/images
cp sample/seashell.gts $BUNDLE/sample
cp sample/chameleon4k.pts $BUNDLE/sample
cp sample/normalmap/laurana500.* $BUNDLE/sample/normalmap
cp sample/normalmap/matteonormb.* $BUNDLE/sample/normalmap

mkdir $BUNDLE/$APPNAME/Contents/plugins/U3D_OSX
cp plugins/U3D_OSX/IDTFConverter.out  $BUNDLE/$APPNAME/Contents/plugins/U3D_OSX
cp plugins/U3D_OSX/IDTFConverter.sh  $BUNDLE/$APPNAME/Contents/plugins/U3D_OSX
cp plugins/U3D_OSX/libIFXCore.so  $BUNDLE/$APPNAME/Contents/plugins/U3D_OSX
mkdir $BUNDLE/$APPNAME/Contents/plugins/U3D_OSX/Plugins
cp plugins/U3D_OSX/Plugins/libIFXExporting.so  $BUNDLE/$APPNAME/Contents/plugins/U3D_OSX/Plugins

mkdir $BUNDLE/$APPNAME/Contents/textures
cp textures/*.png $BUNDLE/$APPNAME/Contents/textures/
mkdir $BUNDLE/$APPNAME/Contents/textures/cubemaps
cp textures/cubemaps/uffizi*.jpg $BUNDLE/$APPNAME/Contents/textures/cubemaps
mkdir $BUNDLE/$APPNAME/Contents/textures/litspheres
cp textures/litspheres/*.png $BUNDLE/$APPNAME/Contents/textures/litspheres

mkdir $BUNDLE/$APPNAME/Contents/shaders
cp shaders/*.gdp shaders/*.vert shaders/*.frag shaders/*.txt  $BUNDLE/$APPNAME/Contents/shaders

#added rendermonkey shaders
mkdir $BUNDLE/$APPNAME/Contents/shaders/shadersrm
cp shaders/shadersrm/*.rfx $BUNDLE/$APPNAME/Contents/shaders/shadersrm
#added shadowmapping shaders
cp -r shaders/decorate_shadow $BUNDLE/$APPNAME/Contents/shaders

echo "Changing the paths of the qt component frameworks using the qt tool macdeployqt"

if [ -e $QTDIR/bin/macdeployqt ]
then
echo
$QTDIR/bin/macdeployqt $BUNDLE/$APPNAME -verbose=2
else
macdeployqt $BUNDLE/$APPNAME -verbose=2
fi

cd ../install/macx
# final step create the dmg using appdmg
# appdmg is installed with 'npm install -g appdmg'",
rm -f ../../distrib/MeshLab201804.dmg
appdmg meshlab_dmg.json ../../distrib/MeshLab201804.dmg


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

default_user=user
release_codename=$(lsb_release -cs)

cd /tmp

# Setup swap file ##############################################################
if [ -f /swapfile ]; then
    swapoff /swapfile
    rm /swapfile
fi
fallocate -l 1024M /swapfile
chmod 0600 /swapfile
mkswap /swapfile
sysctl -w vm.swappiness=1
swapon /swapfile
mkdir -p /etc/sysctl.d
echo 'vm.swappiness = 1' >> /etc/sysctl.d/99-sysctl.conf
echo '/swapfile none    swap    deafults    0   0' >> /etc/fstab

# Configure package manager ####################################################
sed -i.bak \
    "s|# \(deb http://archive.canonical.com/ubuntu ${release_codename} partner\)|\1|g" \
    /etc/apt/sources.list
apt-get update -qq

# Configure Grub ###############################################################
sed -i.bak \
    's|\(GRUB_CMDLINE_LINUX_DEFAULT="\).*?"|\1"|' \
    /etc/default/grub
update-grub

# Check for WIFI hardware ######################################################
pci_wifi_count=$(lspci | egrep -ic 'wifi|wlan|wireless')
usb_wifi_count=$(lsusb | egrep -ic 'wifi|wlan|wireless')
wifi_count=$(( $pci_wifi_count + $usb_wifi_count ))
[ ${wifi_count} -gt 0 ] && WIFI=true || WIFI=false
wifi_packages="rfkill dialog wireless-tools wpasupplicant network-manager"

# Install default packages #####################################################
core_packages="ufw sudo git"
$WIFI && core_packages="${core_packages} ${wifi_packages}"
apt-get install -y ${core_packages}

# Setup the public folders
mkdir -p /home/public/bin
cp -r /tmp/scripts /home/public/bin/
cat >> /home/public/bin/env.sh << EOF
export PS1="-\n\h (\u)\n\w\nsh> "
alias ll='ls -l'
alias lla='ls -la'
EOF
cat >> /home/public/bin/add_env.sh << EOF
mkdir -p ~/bin
cp env.sh ~/bin/
cat >> ~/.profile << EEOF

# Load the environment script if it exists.
[ -f ~/bin/env.sh ] && . ~/bin/env.sh

EEOF
. ~/bin/env.sh
EOF
chown -R root:users /home/public
chmod -R 755 /home/public/bin

# Configure Networking ########################################################
# Disable IPv6
if [ -z /etc/sysctl.d/20-disable-ipv6.conf ]; then
cat >> /etc/sysctl.d/20-disable-ipv6.conf << EOF
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOF
fi

$WIFI && {
systemctl start NetworkManager
systemctl enable NetworkManager
sed -i.bak \
    's/^dns=dnsmasq/#dns=dnsmasq/' \
    /etc/NetworkManager/NetworkManager.conf
cat >> /home/public/bin/env.sh << EOF
alias scanap='nmcli d wifi list'
EOF
}

# Cleanup temporary settings, update the default user and reboot ###############
sed -i.bak 's/^\(PermitRootLogin\) yes$/\1 no/' /etc/ssh/sshd_config

usermod -aG users,sudo,ssh ${default_user}
ln -s /home/public /home/${default_user}/public
usermod -p '!' root

# Setup firewall
ufw allow ssh
ufw default deny
ufw enable << EOF
y
EOF

shutdown -r now


#!/bin/bash

SSH_ENV="$HOME/.ssh/environment"

function start_agent {
    echo "Initialising new SSH agent..."
    (umask 066; /usr/bin/ssh-agent > "${SSH_ENV}")
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add;
}

# Source SSH settings, if applicable

if [ -f "${SSH_ENV}" ]; then
    . "${SSH_ENV}" > /dev/null
    ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
        start_agent;
    }
else
    start_agent;
fi


#!/bin/bash

ESSDAQROOT=$HOME/essproj

. $ESSDAQROOT/essdaq/config/mjc/common.sh

EFU_IP=$MJCWS_I
KAFKA_IP=$MJCWS_I
DAQUIRI_IP=$MJCWS_II
GRAFANA_IP=$ECDC_GRAFANA

UDP_ETH=enp0s25

DUMP_PATH=/tmp/essdaq


msg "Install packages"
${chroot} << CHROOT
pacman --noconfirm --needed -S virtualbox-guest-utils-nox virtualbox-guest-modules-arch
gpasswd -a ${username} vboxsf
systemctl enable vboxservice.service
CHROOT


#!/bin/bash

myRun() {
  echo "$PROCCESS process: 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072 "
  mpirun -np $PROCCESS ./mpi_mat_vect_time.o 1024 1024
  mpirun -np $PROCCESS ./mpi_mat_vect_time.o 2048 2048
  mpirun -np $PROCCESS ./mpi_mat_vect_time.o 4096 4096
  mpirun -np $PROCCESS ./mpi_mat_vect_time.o 8192 8192
  mpirun -np $PROCCESS ./mpi_mat_vect_time.o 16384 16384
  # mpirun -np $PROCCESS ./mpi_mat_vect_time.o 32768 32768
  # mpirun -np $PROCCESS ./mpi_mat_vect_time.o 65536 65536
  # mpirun -np $PROCCESS ./mpi_mat_vect_time.o 131072 131072
}

PROCCESS=1
myRun

PROCCESS=2
myRun

PROCCESS=4
myRun

PROCCESS=8
myRun

PROCCESS=16
myRun


<filename>agave-jobs/jobs-core/src/test/resources/software/boilerplate-1.0/wrapper.sh

echo "input1: ${input1}"
echo "myIntegerParameter: ${myIntegerParameter}"
echo "myEnumerationParameter: ${myEnumerationParameter}"
echo "myStringParameter: ${myStringParameter}"

sleep 30

bin/date


<filename>rc/zshrc.d/00-aliases-common.sh
alias inflate='ruby -r zlib -e "puts Zlib::Inflate.inflate(STDIN.read)"'

# aliases
if command bat --version 1>/dev/null ; then
    alias ccat='bat'
else
    alias ccat='cat'
fi

alias k=kubectl