blob_id
stringlengths 40
40
| language
stringclasses 1
value | repo_name
stringlengths 4
115
| path
stringlengths 2
970
| src_encoding
stringclasses 28
values | length_bytes
int64 31
5.38M
| score
float64 2.52
5.28
| int_score
int64 3
5
| detected_licenses
listlengths 0
161
| license_type
stringclasses 2
values | text
stringlengths 31
5.39M
| download_success
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
bf9fe28c18f2b29aa48eec175bbb0abb08a954f7
|
Shell
|
liushuchun/docker-clean
|
/docker-clean.sh
|
UTF-8
| 1,424
| 2.5625
| 3
|
[] |
no_license
|
# stop docker
sudo ps aux | grep -i docker | grep -v grep | awk '{print $2}' | while read line; do
sudo kill -9 "$line";
done
# brew
brew uninstall --force docker
brew cask uninstall --force docker
brew cleanup
# system folders
sudo rm -r /var/lib/docker
sudo rm -r /private/var/lib/docker
sudo rm -r /private/var/run/docker.sock
sudo rm -r /private/var/tmp/com.docker.vmnetd.socket
sudo find /private/var/folders -name com.docker* | while read line; do
sudo rm -r "$line";
done
# /usr/local
sudo rm /usr/local/bin/docker
sudo rm /usr/local/bin/docker-compose
sudo rm /usr/local/bin/docker-machine
sudo rm /usr/local/opt/docker
sudo rm /usr/local/var/homebrew/linked/docker
sudo rm /usr/local/var/homebrew/locks/docker-machine.brewing
sudo rm /usr/local/var/homebrew/locks/docker.brewing
sudo rm -r /usr/local/Caskroom/docker
sudo rm -r /usr/local/Cellar/docker
sudo rm -r /usr/local/Homebrew/Library/Locks/docker.brewing
# Applications and Library
sudo rm -r /Applications/Docker.app
sudo rm -r /Library/LaunchDaemons/com.docker.vmnetd.plist
sudo rm -r /Library/PrivilegedHelperTools/com.docker.vmnetd
# user settings and Library
rm -r ~/.docker
sudo rm -r ~/Library/Application\ Scripts/com.docker.helper
sudo rm -r ~/Library/Caches/com.docker.docker
sudo rm -r ~/Library/Containers/com.docker.docker
sudo rm -r ~/Library/Group\ Containers/group.com.docker
sudo rm -r ~/Library/Preferences/com.docker.docker.plist
| true
|
c993eeaaa9b99914a8bba3f12baaa51f8ffe4410
|
Shell
|
PaddlePaddle/PaddleTest
|
/tools/test/test-tools/tool-test-dl-algorithm-convergence/ttf/run_tools15.sh
|
UTF-8
| 568
| 3.328125
| 3
|
[] |
no_license
|
model_name=${1:-"mnist"}
cards=${2:-"1"}
if [ $cards = "1" ];then
export CUDA_VISIBLE_DEVICES=0
elif [ $cards = "8" ];then
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
else
echo -n "cards error"
exit -1
fi
if [ ${model_name} = "mnist" ];then
sh prepare.sh >log.prepare 2>&1
sh run_mnist.sh
flag=$?
if [ $flag == 1 ];then
echo -n "trian error"
exit 1
elif [ $flag == 2 ];then
echo -n "not convergent"
exit 2
fi
cat models/official/vision/image_classification/log.conv
else
echo -n "model_name error"
exit 3
fi
| true
|
89f175fb55583fcab1aca85a13b9c9d8c7ff1f8f
|
Shell
|
sagittandy/bmir-archive-recorders
|
/studio-rpi-icecast/autossh/install.autossh.sh
|
UTF-8
| 1,286
| 3.90625
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
#-----------------------------------------------------------------------
# Installs autossh on RPI Raspbian Stretch Lite
#
# Usage:
# Run this script as root:
#
# sudo ./install.autossh.sh
#
# Reference:
# To uninstall completely, run as root:
#
# apt-get --purge -y remove autossh
#
# AD 2019-0407-2138 Copyright BMIR 2019
#-----------------------------------------------------------------------
export DELIMITER="-----------------------------------------------------"
# Ensure root
echo ${DELIMITER}
if [[ $EUID -ne 0 ]]; then
echo "ERROR: This script must be run as user root."
exit 1
fi
echo "Confirmed user root."
# Install
echo ${DELIMITER}
echo "Installing autossh."
apt-get -y install autossh
rc=$?
if [ 0 != ${rc} ] ; then
echo "ERROR ${rc} apt-get -y install autossh."
exit 1
fi
echo "Installed autossh successfully."
# Verify executable
echo ${DELIMITER}
echo "Verifying autossh is executable."
which autossh
rc=$?
if [ 0 != ${rc} ] ; then
echo "ERROR ${rc} which autossh."
exit 1
fi
echo "Confirmed autossh is executable."
# Show installed version
echo ${DELIMITER}
echo "Showing version."
autossh -V
rc=$?
if [ 0 != ${rc} ] ; then
echo "ERROR ${rc} could not display autossh version."
exit 1
fi
echo ${DELIMITER}
echo "Success. Exit."
| true
|
051759286abd28e25be79d2816a00cfe4ba457e0
|
Shell
|
lucascarvalho/dotfiles
|
/.bash_profile
|
UTF-8
| 3,121
| 3.109375
| 3
|
[] |
no_license
|
########
# PATH #
########
export PATH="/usr/local/sbin":"/usr/local/bin":"`brew --prefix`/bin/ctags":"/usr/local/share/npm/bin":$PATH
##############
# VIRTUALENV #
##############
source /usr/local/bin/virtualenvwrapper.sh
#############
# FUNCTIONS #
#############
runmysql(){
MYSQL_DATA_DIR=ramdisk
mysql.server stop || true
diskutil erasevolume HFS+ 'ramdisk' `hdiutil attach -nomount ram://1165430`
mysql_install_db --datadir=/Volumes/ramdisk --basedir=`brew --prefix mysql`
mysql.server start --datadir=/Volumes/ramdisk
}
#########
# ALIAS #
#########
alias l="ls -lha"
alias cd..="cd .."
alias subl="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
alias ctags="`brew --prefix`/bin/ctags"
alias virtuoso_start="cd /usr/local/Cellar/virtuoso/6.1.4/var/lib/virtuoso/db/ && sudo virtuoso-t -f"
alias youtube-dl="youtube-dl --reject-title \"`ls | python -c "import sys; file_list=sys.stdin.read().split('\n'); print '|'.join([file.split('-')[-1].replace('.mp3','') for file in file_list if file.endswith('mp3')])"`\" --title --continue --max-quality mp4 --extract-audio --audio-format 'mp3' --audio-quality 320k "
#######
# RVM #
#######
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
#################
# CUSTOM COLORS #
#################
export CLICOLOR=1
export LSCOLORS=gxfxcxdxBxxxxxxxxxxxxx
# Colors from http://wiki.archlinux.org/index.php/Color_Bash_Prompt
NO_COLOR='\e[0m' #disable any colors
# regular colors
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
MAGENTA='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\e[0;37m'
# emphasized (bolded) colors
EBLACK='\033[1;30m'
ERED='\033[1;31m'
EGREEN='\033[1;32m'
EYELLOW='\033[1;33m'
EBLUE='\033[1;34m'
EMAGENTA='\033[1;35m'
ECYAN='\033[1;36m'
EWHITE='\033[1;37m'
# underlined colors
UBLACK='\033[4;30m'
URED='\033[4;31m'
UGREEN='\033[4;32m'
UYELLOW='\033[4;33m'
UBLUE='\033[4;34m'
UMAGENTA='\033[4;35m'
UCYAN='\033[4;36m'
UWHITE='\033[4;37m'
# background colors
BBLACK='\033[40m'
BRED='\033[41m'
BGREEN='\033[42m'
BYELLOW='\033[43m'
BBLUE='\033[44m'
BMAGENTA='\033[45m'
BCYAN='\033[46m'
BWHITE='\033[47m'
#######
# PS1 #
#######
parse_git_dirty () {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
function parse_git_color
{
if [ "$(parse_git_dirty)" == "*" ] ; then
echo "0;31m"
else
echo "0;32m"
fi
}
PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\] \[$YELLOW\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[\033[\$(parse_git_color)\]\$(parse_git_branch)\[$EWHITE\]\nϟ\[$EWHITE\] \[$RESET\]"
# LOAD BASHRC
source ~/.bashrc
# GRC
source "`brew --prefix`/etc/grc.bashrc"
# HISTSIZE
export HISTSIZE=""
# GIT
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
## GOPATH ##
GOPATH=$HOME/gocode
PATH="$PATH:$GOPATH/bin"
export PATH
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
| true
|
19b2d3a0ae8f0aa5d17d3f958536753f37862f89
|
Shell
|
caleb531/dotfiles
|
/terminal/bash/exports.sh
|
UTF-8
| 5,394
| 2.9375
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
# exports.sh
# Caleb Evans
# Reset PATH to original value (if shell was reloaded)
if [ -n "$OLDPATH" ]; then
export PATH="$OLDPATH"
fi
export OLDPATH="$PATH"
# Re-read .nvmrc when reloading shell
export CURRENT_NODE_AUTO_SWITCH_PWD=
# Ensure installed packages are recognized and preferred
# Homebrew
export PATH=~/homebrew/bin:/opt/homebrew/bin:"$PATH"
if type brew &> /dev/null; then
export BREW_PREFIX="$(brew --prefix)"
fi
# Guile (used for GPG)
export GUILE_LOAD_PATH="$BREW_PREFIX"/share/guile/site/3.0
export GUILE_LOAD_COMPILED_PATH="$BREW_PREFIX"/lib/guile/3.0/site-ccache
export GUILE_SYSTEM_EXTENSIONS_PATH="$BREW_PREFIX"/lib/guile/3.0/extensions
# GNU core utilities
export PATH="$BREW_PREFIX"/opt/coreutils/libexec/gnubin:"$PATH"
export MANPATH="$BREW_PREFIX"/opt/coreutils/libexec/gnuman:"$MANPATH"
export PATH="$BREW_PREFIX"/opt/gnupg@2.0/bin:"$PATH"
export PATH="$BREW_PREFIX"/opt/gpg-agent/bin:"$PATH"
# pnpm global store
export PNPM_HOME="/Users/caleb/Library/pnpm"
export PATH="$PNPM_HOME":"$PATH"
# Jekyll
export PATH="$BREW_PREFIX"/opt/ruby/bin:"$PATH"
if [ -d "$BREW_PREFIX"/lib/ruby/gems/3.1.0 ]; then
RUBY_GEMS_DIR="$(ls -d -1 "$BREW_PREFIX"/lib/ruby/gems/3.0.0 | tail -n 1)"
fi
export PATH="$RUBY_GEMS_DIR"/bin:"$PATH"
export PKG_CONFIG_PATH="$BREW_PREFIX"/opt/imagemagick@6/lib/pkgconfig:"$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH="$BREW_PREFIX"/opt/libffi/lib/pkgconfig:"$PKG_CONFIG_PATH"
# MAMP/PHP
export PATH=/Applications/MAMP/bin/php/php8.0.8/bin/:"$PATH"
# Setup scripts
export PATH=~/dotfiles/setup:"$PATH"
export PATH=~/dotfiles/private/setup:"$PATH"
# Miscellaneous environment variables
# Explicitly declare vim as default text editor (Git will fall back to this
# environment variable unless core.editor is set in your .gitconfig)
export EDITOR='vim'
# Name of default web browser (useful for `open -a` commands)
export WEB_BROWSER_NAME='Brave Browser'
# Don't clear man page when exiting less
export MANPAGER='less --no-init --quit-if-one-screen --IGNORE-CASE'
# Use a case-insensitive pager and diff-so-fancy for Git (if available)
if type diff-so-fancy &> /dev/null; then
export GIT_PAGER='diff-so-fancy | less --tabs=4 -R --no-init --quit-if-one-screen --IGNORE-CASE'
fi
# Architecture-agnostic path to pinentry-mac; if you change this value, remember
# to change the hardcoded reference in gpg/gpg-agent.conf
export GPG_BIN_DIR=~/.gnupg/bin
export GPG_TTY=$(tty)
# Number of lines of command history to keep in memory
export HISTSIZE=250
# Number of lines of command history to keep in file
export HISTFILESIZE=500
# Keep duplicate entries out of command history
export HISTCONTROL='ignoreboth:erasedups'
# Keep potentially dangerous commands out of command history
export HISTIGNORE='clear*:cplastcmd*:cprmlastcmd*:git clean*:git reset --hard*:history*:rmlastcmd*:git stash drop*'
# Prevent Python from generating bytecode (*.pyc, __pycache__, etc.)
export PYTHONDONTWRITEBYTECODE=1
# The name of the virtualenv directory (within the respective project directory)
export VIRTUAL_ENV_NAME='.virtualenv'
# Disable notices for npm updates
export NO_UPDATE_NOTIFIER=1
# Ignore select Shellcheck errors/warnings; make sure to also update
# vscode/settings.json (shellcheck.exclude setting) with any changes you make
# here.
# - SC1090: Can't follow non-constant source. Use a directive to specify
# location.
# - SC1091: Not following: (error message here)
# - SC2002: Useless cat. Consider cmd < file | .. or cmd file | .. instead. -
# SC2010: Don't use ls | grep. Use a glob or a for loop with a condition to
# allow non-alphanumeric filenames.
# - SC2012: Use find instead of ls to better handle non-alphanumeric filenames.
# - SC2120: foo references arguments, but none are ever passed.
# - SC2155: Declare and assign separately to avoid masking return values.
# - SC2207: Prefer mapfile or read -a to split command output (or quote to avoid
# splitting).
# - SC2181: Check exit code directly with e.g. if mycmd;, not indirectly with
# $?.
export SHELLCHECK_OPTS='-e SC1090 -e SC1091 -e SC2002 -e SC2010 -e SC2012 -e SC2120 -e SC2155 -e SC2207 -e SC2181'
# Colors
# ANSI color reference: <http://www.termsys.demon.co.uk/vtansi.htm#colors>
# Standard colors
export BLACK=$'\e[0;30m'
export RED=$'\e[0;31m'
export GREEN=$'\e[0;32m'
export YELLOW=$'\e[0;33m'
export BLUE=$'\e[0;34m'
export MAGENTA=$'\e[0;35m'
export CYAN=$'\e[0;36m'
export WHITE=$'\e[0;37m'
export RESET_COLOR=$'\e[0m'
# Bold colors
export BLACK_BOLD=$'\e[1;30m'
export RED_BOLD=$'\e[1;31m'
export GREEN_BOLD=$'\e[1;32m'
export YELLOW_BOLD=$'\e[1;33m'
export BLUE_BOLD=$'\e[1;34m'
export MAGENTA_BOLD=$'\e[1;35m'
export CYAN_BOLD=$'\e[1;36m'
export WHITE_BOLD=$'\e[1;37m'
export RESET_BOLD=$'\e[1;0m'
# Use green, underlined text for grep matches
export GREP_COLOR=$'\e[4;32m'
export GREP_COLORS='ms=04;32:mc=04;32:sl=:cx=:fn=35:ln=32:bn=32:se=36'
# Colorize less
# Color syntax: <http://www.termsys.demon.co.uk/vtansi.htm#colors>
# termcap(5) man page: <http://linux.die.net/man/5/termcap>
export LESS_TERMCAP_md="$BLUE_BOLD" # start bold mode
export LESS_TERMCAP_me="$RESET_BOLD" # end modes so, us, mb, md, mr
export LESS_TERMCAP_so="$CYAN_BOLD" # start standout mode
export LESS_TERMCAP_se="$RESET_BOLD" # end standout mode
export LESS_TERMCAP_us="$GREEN_BOLD" # start underlining
export LESS_TERMCAP_ue="$RESET_BOLD" # end underlining
| true
|
08db3d17317cc22f8a38f6cb783c9c585d205bde
|
Shell
|
justpayne/jburkardt-f77
|
/toms470/toms470_prb.sh
|
UTF-8
| 504
| 3
| 3
|
[] |
no_license
|
#!/bin/bash
#
gfortran -c -g toms470_prb.f >& compiler.txt
if [ $? -ne 0 ]; then
echo "Errors compiling toms470_prb.f"
exit
fi
rm compiler.txt
#
gfortran toms470_prb.o -L$HOME/libf77/$ARCH -ltoms470
if [ $? -ne 0 ]; then
echo "Errors linking and loading toms470_prb.o"
exit
fi
rm toms470_prb.o
#
mv a.out toms470_prb
./toms470_prb > toms470_prb_output.txt
if [ $? -ne 0 ]; then
echo "Errors running toms470_prb"
exit
fi
rm toms470_prb
#
echo "Test results written to toms470_prb_output.txt."
| true
|
13a9bfd1aaffb2186df2ff2dd2f79dc9c7c181d6
|
Shell
|
tbs1-bo/ea_rpi_modul
|
/release.sh
|
UTF-8
| 361
| 2.703125
| 3
|
[] |
no_license
|
#!/bin/sh
echo Tests laufen lassen
python3 setup.py test
echo Unit Tests OK?
read
for f in eapi/*py;
do
python3 -m doctest $f
echo Doctests $f ok?
read
done
echo Release erstellen und hochladen
poetry build
poetry publish
#echo Dokumentation erstellen und hochladen
#doxygen
# TODO Move doc into repo
# python3 setup.py upload_docs --upload-dir doc/html
| true
|
f2e24644dd66338b7a38020f9f2846d665ccf226
|
Shell
|
jgwest/turtl-docker
|
/certbot-new/artifacts/create.sh
|
UTF-8
| 731
| 3.25
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
if [ -z "$1" ]; then
echo "Your email address needs to be specified as the first parameter."
exit
#else
# echo "Using $1 as your email address."
fi
if [ -z "$2" ]; then
echo "The second parameter needs to be a domain name without a subdomain (example: domain.com)"
exit
#else
# echo "Using $2 as the first domain to add to the certificate."
fi
if [ -z "$3" ]; then
echo "The second parameter needs to be a domain name beginning with www (example: www.domain.com)"
exit
#else
# echo "Using $3 as the second domain to add to the certificate."
fi
certbot certonly --preferred-chain="ISRG Root X1" --standalone -n --agree-tos \
--email $1 \
-d $2 \
-d $3
| true
|
47bc1e66a158a64181320f49c71c5d8ff5cffbe8
|
Shell
|
m0ppers/deploysh
|
/deploy.sh
|
UTF-8
| 1,691
| 4.0625
| 4
|
[] |
no_license
|
#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: $0 <release-tarball> <install-dir> [<predeploy arguments>, <postdeploy arguments>]"
exit 1
fi
TARBALL=$1
INSTALL_DIR=$2
PRE_DEPLOY_ARGS=$3
POST_DEPLOY_ARGS=$4
if [ ! -d "$INSTALL_DIR" ]; then
echo "$INSTALL_DIR must be a directory"
exit 2
fi
if [ ! -f "$TARBALL" ]; then
echo "$TARBALL doesn't exist!"
exit 3
fi
RESULT_DIR=`echo "$TARBALL" | xargs basename | egrep ".+-[0-9]{14}-.+.tar.gz" | sed -e "s/\(.\+-[0-9]\{14\}-.\+\).tar.gz/\1/"`
if [ "$RESULT_DIR" = "" ]; then
echo "Tarball $TARBALL doesn't seem to be a proper release file!"
exit 5
fi
tar xzf "$TARBALL" -C "$INSTALL_DIR"
if [ "$?" -ne 0 ]; then
echo "Extracting $TARBALL failed"
exit 6
fi
if [ ! -d "$INSTALL_DIR"/"$RESULT_DIR" ]; then
echo "$RESULT_DIR is not present after extraction?"
exit 7
fi
if [ -x "$INSTALL_DIR"/"$RESULT_DIR/pre_deploy.sh" ]; then
./"$INSTALL_DIR/$RESULT_DIR"/pre_deploy.sh "$PRE_DEPLOY_ARGS"
if [ "$?" != 0 ]; then
echo "Pre deploy failed with code $?"
exit 8
fi
fi
ln -nsf "$RESULT_DIR" "$INSTALL_DIR"/current_new
mv -T "$INSTALL_DIR"/current_new "$INSTALL_DIR"/current
if [ "$?" != 0 ]; then
echo "Linking to current failed!"
exit 9
fi
if [ -x "$RESULT_DIR/post_deploy.sh" ]; then
./"$INSTALL_DIR/$RESULT_DIR"/post_deploy.sh "$POST_DEPLOY_ARGS"
if [ "$?" != 0 ]; then
echo "Post deploy failed with code $?"
exit 10
fi
fi
PREFIX=`echo "$RESULT_DIR" | sed -e "s/\(.\+\)-[0-9]\{14\}-.\+/\1/"`
for i in `ls $INSTALL_DIR | egrep "^$PREFIX-[0-9]{14}-.+" | grep -v "$RESULT_DIR" | tac | tail -n+2`; do
rm -r "$INSTALL_DIR"/"$i"
done
| true
|
e2fcfee368fa1c376beefeb6a87ffd6fb2bf71ca
|
Shell
|
epasham/elk
|
/elk-xpack/logstash/logstash-setup.sh
|
UTF-8
| 1,336
| 3.328125
| 3
|
[] |
no_license
|
#!/bin/bash
#logstash setup
#OS requirement: redhat 7
set -x
abs_path=$(cd `dirname $0`; pwd)
source $abs_path/../env.conf
#java env setup
$(java -version)
if [ $? -ne 0 ];then
echo "JDK setup" && sudo yum install java -y
fi
#logstash rpm install
rpm -qa | grep logstash-${ELK_VERSION}
[ $? -ne 0 ] && sudo rpm --install ${LG_PKG_URL}
sudo [ ! -d /etc/logstash/certs ] && sudo mkdir /etc/logstash/certs
sudo cp $abs_path/../certs/out/* /etc/logstash/certs
#install x-pack
echo "install elasticsearch x-pack..."
sudo /usr/share/logstash/bin/logstash-plugin install x-pack --batch
#config logstash
sudo mv /etc/logstash/logstash.yml /etc/logstash/logstash.yml.bk
sudo tee /etc/logstash/logstash.yml <<FFF
node.name: "${LG_NODE_NAME}"
path.data: "${LG_DATA_PATH}"
path.config: /etc/logstash/conf.d/*.conf
http.host: 0.0.0.0
http.port: 9600-9700
xpack.monitoring.elasticsearch.username: logstash_system
xpack.monitoring.elasticsearch.password: "${LG_PASSWORD}"
xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.url: ${ES_CLUSTER_API}
xpack.monitoring.elasticsearch.ssl.ca: /etc/logstash/certs/root-ca.pem
path.logs: /var/log/logstash
FFF
sudo cp conf.d/* /etc/logstash/conf.d
#start logstash service
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable logstash.service
sudo systemctl restart logstash.service
| true
|
c14f7924318807fc36aa34e0b9c50ce0758988d7
|
Shell
|
ppc64le/build-scripts
|
/c/crontab/crontab_ubi8.4.sh
|
UTF-8
| 1,394
| 3.296875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash -e
# ----------------------------------------------------------------------------
#
# Package : crontab
# Version : 0.22.6
# Source repo : https://github.com/josiahcarlson/parse-crontab
# Tested on : UBI 8.4
# Language : Python
# Travis-Check : True
# Script License: Apache License, Version 2 or later
# Maintainer : Sapana Khemkar
#
# Disclaimer: This script has been tested in non-root mode on given
# ========== platform using the mentioned version of the package.
# It may not work as expected with newer versions of the
# package and/or distribution. In such case, please
# contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------
PACKAGE_NAME=crontab
PACKAGE_VERSION=${1:-"0.22.6"}
PACKAGE_URL=https://github.com/josiahcarlson/parse-crontab.git
# Dependency installation
yum install -y ncurses git python36 python27 make gcc gcc-c++
cd /
mkdir -p /home/test
cd /home/test
# Download the repos
git clone $PACKAGE_URL
cd parse-crontab
git checkout tags/$PACKAGE_VERSION
#test with python 3
echo "Verify with Python3"
pip3 install pytz
python3 setup.py install
python3 -m tests.test_crontab
#test with python2
echo "Verify with Python2.7"
pip2 install pytz
pip2 install python-dateutil
python2 setup.py install
python2 -m tests.test_crontab
exit 0
| true
|
5187654de7247bdfc71ffac7de2eaca38b09b21f
|
Shell
|
OfficialYeti/rust-tcp
|
/trust/run.sh
|
UTF-8
| 310
| 2.5625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
cargo b --release
ext=$?
echo $ext
if [[ $ext -ne 0 ]]; then
exit $ext
fi
sudo setcap cap_net_admin=eip ~/rust-tcp/trust/target/release/trust
~/rust-tcp/trust/target/release/trust &
pid=$!
sudo ip addr add 192.168.0.1/24 dev tun0
sudo ip link set up dev tun0
trap "kill $pid" INT TERM
wait $pid
| true
|
1f565dbf4b3f3055ad52f83d6dc04f4c429585f4
|
Shell
|
holen-app/holen
|
/release.sh
|
UTF-8
| 1,634
| 3.734375
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
set -e
if [[ ! $(type -P gox) ]]; then
echo "Error: gox not found."
echo "To fix: run 'go get github.com/mitchellh/gox', and/or add \$GOPATH/bin to \$PATH"
exit 1
fi
if [[ ! $(type -P github-release) ]]; then
echo "Error: github-release not found."
exit 1
fi
VER=$1
if [[ -z $VER ]]; then
echo "Need to specify version."
exit 1
fi
PRE_ARG=
if [[ $VER =~ pre ]]; then
PRE_ARG="--pre-release"
fi
git tag $VER
echo "Building $VER"
echo
gox -ldflags "-X main.version=$VER" -osarch="darwin/amd64 linux/amd64 windows/amd64 linux/arm"
echo "* " > desc
echo "" >> desc
echo "$ sha1sum holen_*" >> desc
sha1sum holen_* >> desc
echo "$ sha256sum holen_*" >> desc
sha256sum holen_* >> desc
echo "$ md5sum holen_*" >> desc
md5sum holen_* >> desc
vi desc
cp bootstrap.template holen.bootstrap
perl -p -i -e "s/__VERSION__/$VER/g" holen.bootstrap
md5sum holen_* >> holen.bootstrap
git push --tags
sleep 2
cat desc | github-release release $PRE_ARG --user holen-app --repo holen --tag $VER --name $VER --description -
github-release upload --user holen-app --repo holen --tag $VER --name holen_darwin_amd64 --file holen_darwin_amd64
github-release upload --user holen-app --repo holen --tag $VER --name holen_linux_amd64 --file holen_linux_amd64
github-release upload --user holen-app --repo holen --tag $VER --name holen_linux_arm --file holen_linux_arm
github-release upload --user holen-app --repo holen --tag $VER --name holen_windows_amd64.exe --file holen_windows_amd64.exe
github-release upload --user holen-app --repo holen --tag $VER --name holen.bootstrap --file holen.bootstrap
| true
|
5d3a4ae7b1a454b3c418490e67773b21596f0a77
|
Shell
|
NapoleonWils0n/ffmpeg-scripts
|
/waveform
|
UTF-8
| 2,765
| 4.3125
| 4
|
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/sh
#===============================================================================
# waveform
# create a waveform from an audio or video file and save as a png
#===============================================================================
# dependencies:
# ffmpeg
#===============================================================================
# script usage
#===============================================================================
usage()
{
# if argument passed to function echo it
[ -z "${1}" ] || echo "! ${1}"
# display help
echo "\
# create a waveform from an audio or video file and save as a png
$(basename "$0") -i input.(mp4|mkv|mov|m4v|webm|aac|m4a|wav|mp3) -o output.png
-i output.(mp4|mkv|mov|m4v|aac|m4a|wav|mp3)
-o output.png : optional argument # if option not provided defaults to input-name-waveform-date-time"
exit 2
}
#===============================================================================
# error messages
#===============================================================================
INVALID_OPT_ERR='Invalid option:'
REQ_ARG_ERR='requires an argument'
WRONG_ARGS_ERR='wrong number of arguments passed to script'
#===============================================================================
# check the number of arguments passed to the script
#===============================================================================
[ $# -gt 0 ] || usage "${WRONG_ARGS_ERR}"
#===============================================================================
# getopts check the options passed to the script
#===============================================================================
while getopts ':i:o:h' opt
do
case ${opt} in
i) infile="${OPTARG}";;
o) outfile="${OPTARG}";;
h) usage;;
\?) usage "${INVALID_OPT_ERR} ${OPTARG}" 1>&2;;
:) usage "${INVALID_OPT_ERR} ${OPTARG} ${REQ_ARG_ERR}" 1>&2;;
esac
done
shift $((OPTIND-1))
#===============================================================================
# variables
#===============================================================================
# variables
infile_nopath="${infile##*/}"
infile_name="${infile_nopath%.*}"
# defaults for variables if not defined
outfile_default="${infile_name}-waveform-$(date +"%Y-%m-%d-%H-%M-%S").png"
#===============================================================================
# functions
#===============================================================================
# waveform function
wform () {
ffmpeg \
-hide_banner \
-stats -v panic \
-i "${infile}" \
-filter_complex "aformat=channel_layouts=mono,showwavespic=s=1000x200" \
-frames:v 1 \
-f apng \
"${outfile:=${outfile_default}}"
}
# run the wform function
wform "${infile}"
| true
|
bb6b6643abe10d1524bb58c1819a0cdfffaa1702
|
Shell
|
davidstosik/dotfiles
|
/modules/010-zsh/.zshrc
|
UTF-8
| 716
| 3.421875
| 3
|
[] |
no_license
|
MYPATH="$(readlink "${HOME}/.zshrc")"
MYDIR="$(dirname "$MYPATH")"
ZSHRC_ORIGINAL="${HOME}/.zshrc_orig"
if [ -f "$ZSHRC_ORIGINAL" ]; then
source "$ZSHRC_ORIGINAL"
fi
# Try to force a UTF-8 locale
if [[ ! "$LANG" == *UTF-8 ]]; then
if locale -a | grep "en_US.UTF-8" >/dev/null; then
export LANG="en_US.UTF-8"
elif locale -a | grep "C.UTF-8" >/dev/null; then
export LANG="C.UTF-8"
else
echo '! Could not find a UTF-8 locale available, please double check !'
fi
fi
fpath=($fpath "$HOME"/.zsh_functions)
path+=("$HOME"/bin)
# Allow modules to hook into zshrc
for file in "$MYDIR"/../*/zshrc; do
source "$file"
done
[[ -x /opt/homebrew/bin/brew ]] && eval $(/opt/homebrew/bin/brew shellenv)
| true
|
d4488df4f436636b44da4daa8cdb8b0502b17d93
|
Shell
|
JinlingTest/repo3
|
/test305.sh
|
UTF-8
| 259
| 2.515625
| 3
|
[] |
no_license
|
#!/usr/bin/bash
#
#
fun1()
{
echo 'test fun1'
}
fun2()
{
echo `expr $1 + $2`
}
fun3 ()
{
return
echo `expr $1 + $2`
}
fun4 ()
{
echo `expr $1 + $2`
exit
}
fun5 ()
{
echo `expr $1 + $2`
}
#fun1
#fun2 100 200
#fun3 200 300
#fun4 300 400
#fun3 500 600
| true
|
7ba383d5ac89920075d28524213ad0846b5f2a75
|
Shell
|
aiwas/skk-dict-imasml
|
/build.sh
|
UTF-8
| 792
| 3.296875
| 3
|
[
"CC0-1.0"
] |
permissive
|
#!/bin/bash
# ソート処理
generate (){
# idol name
echo 'Generate idols name dict...'
cat ./src/FIRSTNAME | skkdic-sort > ./SKK-JISYO.imasml.firstname
cat ./src/FULLNAME | skkdic-sort > ./SKK-JISYO.imasml.fullname
echo 'done.'
# actors
echo 'Generate actors dict...'
sed -f ./src/ACTORS.sed ./src/ACTORS | iconv -f UTF-8 -t EUC-JP | skkdic-sort > ./SKK-JISYO.imasml.actors.euc
cat ./src/ACTORS | skkdic-sort > ./SKK-JISYO.imasml.actors.utf8
echo 'done.'
}
which skkdic-sort > /dev/null 2>&1
if [ $? = 0 ]; then
generate
else
echo 'Please install skkdic-sort(Included in skktools).'
echo 'Ubuntu/Debian: '
echo '$ sudo apt install skktools'
echo 'Arch Linux: '
echo '$ sudo pacman -S skktools'
echo 'macOS(Requires Homebrew): '
echo '$ brew install skktools'
fi
| true
|
fc9c72ed61eb2f1b49bb116c2d1478142cc196f0
|
Shell
|
kyoh86/richgo
|
/sample/run.sh
|
UTF-8
| 661
| 2.640625
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#!/bin/bash
bin="$(cd -- "$(dirname -- "${BASH_SOURCE:-${(%):-%N}}")"; pwd)"
cd "${bin}/.."
export RICHGO_LOCAL=1
OPTIONS=(test -tags=sample ./sample/... -cover)
echo "===================================== go test ====================================="
\go "${OPTIONS[@]}"
echo ""
echo "===================================== richgo test ====================================="
go run . "${OPTIONS[@]}"
echo "==================================== go test -v ===================================="
\go "${OPTIONS[@]}" -v
echo ""
echo "==================================== richgo test -v ==================================="
go run . "${OPTIONS[@]}" -v
| true
|
5259bc4aaca0cdf7b09c2f5e13b3640aa7a53e87
|
Shell
|
svn2github/gateworks_openwrt
|
/trunk/scripts/makedisk
|
UTF-8
| 599
| 4.0625
| 4
|
[] |
no_license
|
#!/bin/sh
#
# Image a block storage device from a tarball of a root filesystem using a
# single ext4 partition.
#
DEV=$1
ROOTFS=$2
[ -b "$DEV" -a -r "$ROOTFS" ] || {
echo "usage: $0 <device> <rootfs-tarball>"
exit 1
}
mounts=$(grep ^$DEV /proc/mounts)
[ $? -eq 0 ] && {
echo "Error: $DEV has mounted partitions:"
echo $mounts
exit 1
}
echo "Installing to $DEV..."
# partition disk with a single ext4 partition
printf ",,83,,\n" | sfdisk ${DEV}
sync
sudo sfdisk -R $DEV
mkfs.ext4 -L ROOTFS ${DEV}1
sleep 2
udisks --mount ${DEV}1
tar xvf $ROOTFS -C /media/ROOTFS
sync && sudo umount ${DEV}?
| true
|
467498e4366b87613255919159ddb80838f4381b
|
Shell
|
hazybluedot/ece2524_test
|
/bin/gitrepos
|
UTF-8
| 744
| 3.46875
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
while read gitpath; do
git_url=`echo $gitpath | cut -d ' ' -f 1`
git_dir=`echo $gitpath | cut -d ' ' -f 2`
if git clone $git_url $git_dir >/tmp/$$_gitrepos.stdout 2>/tmp/$$_gitrepos.err; then
echo $git_dir
elif [ -d $git_dir ]; then
cd $git_dir
git checkout master 2>/dev/null
git pull >/dev/null >&2
echo $git_dir
else
paste <(echo $git_url) /tmp/$$_gitrepos.err >&2
fi
rm -f /tmp/$$_gitrepos.{stdout,err}
continue
pushd $(realpath ".")
if [ -d "$REPO_DIR" ]; then
cd $REPO_DIR
git checkout master 2>/dev/null
git pull
else
git clone "$REPO_PATH" $REPO_DIR 2>/dev/null
if [ $? -ne 0 ]; then
echo "$GITNAME" >&2
else
echo $?
fi
fi
popd
done
| true
|
6bea886d8a5c205ca226cad801f70e8d6258b0d8
|
Shell
|
dosuna/conf
|
/.bash_profile
|
UTF-8
| 2,007
| 2.6875
| 3
|
[
"Unlicense"
] |
permissive
|
# (http://en.wikipedia.org/wiki/Unicode_symbols)
symbol="λ"
function pause(){
read -p "$*"
}
function precmd() {
MYCMD=$(set -o|grep 'emacs.*on' >/dev/null 2>&1 && echo 'ϵ'|| echo 'υ');
export PS1="[\!][${MYCMD}] \w\n${symbol} » ";
}
export PS2="$(pause 'Press [Enter] key to continue...')"
export PERLBREW_MANPATH="/Users/user/perl5/perlbrew/perls/perl-5.19.4/man"
export PERLBREW_PATH="/Users/user/perl5/perlbrew/bin:/Users/user/perl5/perlbrew/perls/perl-5.19.4/bin"
export PERLBREW_PERL="perl-5.19.4"
export PERLBREW_ROOT="/Users/user/perl5/perlbrew"
export PERLBREW_VERSION="0.66"
#export PROMPT_COMMAND="$(set -o | grep emacs.*on >/dev/null 2>&1 && echo 'E'|| echo '')"
export PROMPT_COMMAND=(precmd)
export PATH=$PERLBREW_PATH:$HOME/bin:/usr/local/cuda/bin:/usr/local/bin:$PATH
export NODE_PATH="/usr/local/lib/node_modules:${NODE_PATH}"
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
export DEPENDPATH=/usr/local/cuda/lib:$DEPENDPATH
export INCLUDEPATH=/usr/local/cuda/lib:$INCLUDEPATH
export GEMPATH=`gem env gemdir`
export VIMDIR=/usr/share/vim73
export INPUTRC=~/.inputrc
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
if [ `uname` == "Darwin" ]; then
export LSCOLORS=ExGxFxDxCxHxHxCbCeEbEb
export LC_CTYPE=en_US.utf-8
export LC_ALL=en_US.utf-8
else
alias ls='ls --color=auto'
fi
# hack to get ppc out of that thing
export ARCHFLAGS="-arch i386 -arch x86_64"
## perlbrew
## source ~/perl5/perlbrew/etc/bashrc
## jython
export CLASSPATH=~/bin/edittwiki/lib/edittwiki.jar
export EDITTWIKI=~/bin/edittwiki/edittwiki.cfg
export JYTHON_HOME=/usr/local/Cellar/jython/2.5.3/libexec/bin
export EDITOR=/usr/local/bin/vim
## pyenv
eval "$(pyenv init -)"
##
# bash completion
#if [ -f $(brew --prefix)/share/bash-completion/bash_completion ]; then
# . $(brew --prefix)/share/bash-completion/bash_completion
#fi
source /usr/local/share/bash-completion/completions/todo
# source ~/.bashrc
[ -n ~/.bashrc ] && . ~/.bashrc
| true
|
3949997eae9710ee7a70a6ffa8f31aa051e48b12
|
Shell
|
Ruler0421/crawl-cfgov
|
/postprocessing/test.sh
|
UTF-8
| 982
| 4.0625
| 4
|
[
"CC0-1.0"
] |
permissive
|
#!/usr/bin/env bash
# Test functionality of postprocessing sed scripts.
#
# Example usage:
#
# postprocessing/test.sh
# If a command fails, stop executing this script and return its error code.
set -e
cwd=`dirname "$0"`
sample_input="$cwd/sample-input"
expected_output="$cwd/expected-output"
transform_script="$cwd/transform_results.sh"
# Copy sample input to a temporary directory so we can modify it there.
tmp_dir=$(mktemp -d -t test-$(date +%Y-%m-%d-%H-%M-%S)-XXXXXXXX)
cp -R "$sample_input" "$tmp_dir"
copied_sample_input="$tmp_dir/sample-input"
# Run postprocessing script on sample input.
`$transform_script $copied_sample_input`
# Compare output to expected output.
diff_result=0
diff "$copied_sample_input" "$expected_output" || diff_result=$?
# Clean up temporary directory.
rm -rf "$tmp_dir"
# Exit with a non-zero error code if the diff failed.
if [ "$diff_result" -ne 0 ]; then
exit 1;
else
echo "Success! Generated output matches expected output."
fi
| true
|
4422c793e6ba796c63aab00626f59676617b6044
|
Shell
|
tomtastic/synchreon
|
/synchreon
|
UTF-8
| 1,581
| 3.25
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
# 20210923 - trcm - track parcels via synchreon courier
[[ ! -n "$2" ]] && echo "Provide 'Delivery Reference' and 'Order number'!" && exit 1
ORDER="$1"
WEB_ORDER="$2"
# Custom headers
UA='User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36'
# Synchreon pages
SESSION_URL='https://seal.syncreon.com/synview-online.moc/360.syn/system_selection.p'
VALIDATE_URL='https://seal.syncreon.com/synview-online.moc/360.syn/validate_login.p'
TRACKING_URL='https://seal.syncreon.com/synview-online.moc/360.syn/synview_tracking.p'
function get_session() {
# Get a session token from Synchreon
SESSION_REGEX='SESSIONID=([0-9A-F-]+)'
response=$(http GET "$SESSION_URL" SESSIONID=="$1" User-Agent:"$UA")
if [[ "$response" =~ $SESSION_REGEX ]]; then
match="${BASH_REMATCH[1]}"
echo "$match"
fi
}
echo "[+] Get session token" >&2
session_id=$(get_session "$session_id")
echo "[+] Confirm session token" >&2
session_id=$(get_session "$session_id")
echo "[+] Post order details for our parcel" >&2
http --form POST "$VALIDATE_URL" User-Agent:"$UA" Referer:"${SESSION_URL}?SESSIONID=${session_id}" SESSIONID=="$session_id" order_no="$ORDER" web_order_no="$WEB_ORDER" field_displayed="wo" --quiet
echo "[+] Get tracking details" >&2
tracking=$(http GET "$TRACKING_URL" User-Agent:"$UA" Referer:"${REFERER_URL}?SESSIONID=${session_id}" SESSIONID=="$session_id")
printf "\x1b[38;2;255;100;0m%s\x1b[0m\n" "$(echo "$tracking" | grep 'cell_data' | sed 's|<[^>]*>| |g')"
| true
|
82d19bb77276892210d256608074ff8c99401b04
|
Shell
|
rqren/mit-6-null
|
/week2/task/Q3myans.sh
|
UTF-8
| 230
| 2.984375
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
Counter=0
while [ $Counter -lt 1000 ]; do
echo the counter is $Counter
let Counter=Counter+1
sh ./Q3totest.sh >> ./Q3result 2>> ./Q3result
if [[ $? -ne 0 ]]; then
Counter >> ./Q3result
break
fi
done
| true
|
2d6b434bc84f83aa50038545800febd0edd7f940
|
Shell
|
aiddata/MacArthur
|
/hansen/get_hansen_for_bbox.sh
|
UTF-8
| 2,283
| 3.640625
| 4
|
[] |
no_license
|
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
# https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.2.html
# https://storage.googleapis.com/earthenginepartners-hansen/GFC2015/treecover2000.txt
# region list containing region ids
rlist=(sea sa africa)
# rlist=(sea)
for rid in ${rlist[@]}; do
echo ${rid}
extent_grep=$(ogrinfo ../shps/${rid}/${rid}_grid.shp ${rid}_grid | grep Extent)
if [[ ${extent_grep} != Extent:* ]]; then
echo 'No extent data found for '${rid}'_grid.shp'
exit 1
fi
mkdir -p downloads/{treecover2000,loss,gain,lossyear}/${rid}_tiles
echo $extent_grep
# examples of grep output, format and needed values
# Extent: (92.189278, 5.593261) - (109.489278, 28.543261)
# Extent: (LL lon, LL lat) - (UR lon, UR lat)
# Extent: (90, 0) - (110, 30)
extent_string=`echo $extent_grep | sed s/'Extent: '//g | sed s:' - ':' ':g | sed s:[\),\(]::g`
echo $extent_string
cmd='python bbox_to_filenames.py '${extent_string}
# echo $cmd
url_string=$(eval $cmd)
# echo $url_string
url_array=($url_string)
for i in ${url_array[@]}; do
echo $i
# wget tiles
wget -c -N -P downloads/treecover2000/${rid}_tiles ${i}
j=`echo $i | sed s/'treecover2000'/'loss'/g`
wget -c -N -P downloads/loss/${rid}_tiles ${j}
k=`echo $i | sed s/'treecover2000'/'gain'/g`
wget -c -N -P downloads/gain/${rid}_tiles ${k}
m=`echo $i | sed s/'treecover2000'/'lossyear'/g`
wget -c -N -P downloads/lossyear/${rid}_tiles ${m}
done
mkdir -p data/{treecover2000,loss,gain,lossyear}
# mosaic tiles
gdal_merge.py -of GTiff -co COMPRESS=LZW -co TILED=YES -co BIGTIFF=YES downloads/treecover2000/${rid}_tiles/*.tif -o data/treecover2000/${rid}_mosaic.tif
gdal_merge.py -of GTiff -co COMPRESS=LZW -co TILED=YES -co BIGTIFF=YES downloads/loss/${rid}_tiles/*.tif -o data/loss/${rid}_mosaic.tif
gdal_merge.py -of GTiff -co COMPRESS=LZW -co TILED=YES -co BIGTIFF=YES downloads/gain/${rid}_tiles/*.tif -o data/gain/${rid}_mosaic.tif
gdal_merge.py -of GTiff -co COMPRESS=LZW -co TILED=YES -co BIGTIFF=YES downloads/lossyear/${rid}_tiles/*.tif -o data/lossyear/${rid}_mosaic.tif
done
| true
|
0eb0f93e97816714be2f211caf74863da464bb98
|
Shell
|
Dan2552/gathering-of-scripts
|
/macos/wired
|
UTF-8
| 413
| 3.53125
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
ping_func(){
results=$(ping -c 1 -t 1 google.co.uk >/dev/null 2>/dev/null)
return $?
}
check_net() {
networksetup -setairportpower en0 off
ping_func
if [[ $? > 0 ]]; then
echo "internet doesn't seem ok"
sleep 3
check_net
else
echo "internet connection is ok 👍"
fi
}
while :
do
check_net
if [[ $1 != 'forever' ]]; then
exit 0
fi
sleep 5
done
| true
|
a8f7428e9b599b362689ac152817cf9761a2c120
|
Shell
|
migueljiarr/tefAlexa
|
/tools/my-script.sh
|
UTF-8
| 549
| 2.515625
| 3
|
[] |
no_license
|
#!/bin/bash
# Sessions.
tmux new-session -s IPLog -n ip -d -c ./tools/
tmux new-session -s tefAlexa -n server -d
# Second window.
tmux new-window -t tefAlexa -n chromium -d
# Second panes.
tmux send-keys -t tefAlexa 'npm start &> out.log' 'C-m'
tmux send-keys -t IPLog './loopIP.sh &> ip.log' 'C-m'
#tmux split-window -t IPLog -d "tmux rename-window logIP"
#tmux send-keys -t 'tail -f ip.log' 'C-m'
#tmux split-window -t tefAlexa -d 'select window -t server "tmux rename-window logServer"'
#tmux send-keys -t logServer 'tail -f out.log' 'C-m'
| true
|
54932df9bb34a722f6c70f649bf63c11315eb98d
|
Shell
|
redpony/cdec
|
/compound-split/install-data-deps.sh
|
UTF-8
| 204
| 2.875
| 3
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
#!/bin/sh
set -e
data_version=csplit-data-01.tar.gz
ROOTDIR=`dirname $0`
cd $ROOTDIR
curl -f http://demo.clab.cs.cmu.edu/cdec/$data_version -o $data_version
tar xzf $data_version
rm -f $data_version
| true
|
2b4a9e38f8996d75dfc6e97b7803fa9cde1c269b
|
Shell
|
pietropezzi/os-rep
|
/scripts/Lesson7/countdir/contadirettive.sh
|
UTF-8
| 110
| 2.828125
| 3
|
[] |
no_license
|
#!/bin/bash
for NAME in `find /usr/include/ -type f -name "*.h"` ; do grep '#' ${NAME} ; done | sort | wc -l
| true
|
c9b6ba3fa328a57d655afe9b8bc2a0d6bb786928
|
Shell
|
Rishab-Khandelwal/Mini_Block_Chain
|
/server/spawn_n_servers.sh
|
UTF-8
| 393
| 3.265625
| 3
|
[] |
no_license
|
# Automation script for spawing n servers.
# Final Project CS5600
# Authors: Akshaya Khare, Rishab Khandelwal, Sarita Joshi
# Usage ./spawn_n_servers.sh <No-of-server>
#!/usr/bin/env bash
port=5000
value=$1
#for number in {1..99}
for number in `seq 1 $value`;
do
temp=$(expr $port + $number)
pid=$(lsof -i:$temp -t); kill -TERM $pid || kill -KILL $pid
./start_server.sh $number &
#echo $number
done
exit 0
| true
|
052aeded3e0dfde8c859f0bd4b162eaf7669b9ee
|
Shell
|
nkoster/yt-subscribers
|
/yt-subscribers
|
UTF-8
| 646
| 3.796875
| 4
|
[] |
no_license
|
#!/bin/bash
subscribers() {
content=$(wget -q "$1" -O -) && \
channel=$(echo "$content" | grep '<title> ') && \
subscribers=$(echo "$content" | grep abonnees | \
awk -F 'aria-label="' '{print$6}' | awk '{print$1}' | sed 's/\.//g') && \
time=$(date +"%s") && \
echo -e "{\"time\":\"$time\",\"subscribers\":\"$subscribers\",\"channel\":\"${channel:9}\"}"
}
if [ "$#" -eq 0 ]; then
mrbald="https://www.youtube.com/channel/UCxDZs_ltFFvn0FDHT6kmoXA"
echo -e "\nUsage: $0 <youtube main channel page>\n"
echo -e "For example: $0 $mrbald shows:\n"
subscribers "$mrbald"
echo
else
subscribers "$1"
fi
| true
|
23c6cdbf6a8f68764188be8fbd1e28e4830bba6d
|
Shell
|
datWav/Docker
|
/baseimages/base/assets/my_init.sh
|
UTF-8
| 572
| 3.546875
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
INIT_SCRIPT=/etc/my_init.d/
for FILE in `ls $INIT_SCRIPT | sort -V` ; do
SCRIPT=$INIT_SCRIPT$FILE
if [ -f $SCRIPT -a -x $SCRIPT ] ; then
echo "Execute script: $FILE"
$SCRIPT
fi
done
trap 'kill -SIGHUP $PID' SIGHUP
trap 'kill -SIGINT $PID' SIGINT
trap 'kill -SIGQUIT $PID' SIGQUIT
trap 'kill -SIGKILL $PID' SIGKILL
trap 'kill -SIGTERM $PID' SIGTERM
supervisord -c /etc/supervisor.conf &
# FROM: http://veithen.github.io/2014/11/16/sigterm-propagation.html
PID=$!
wait $PID
trap - SIGHUP SIGINT SIGQUIT SIGKILL SIGTERM
wait $PID
EXIT_STATUS=$?
| true
|
482ac2ae74b8b9cfdbf0901d50a1bc208db2cc07
|
Shell
|
BestOpenSourceOrganization/dnscrypt-osxclient
|
/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/handle-console-change.sh
|
UTF-8
| 643
| 3.265625
| 3
|
[
"ISC"
] |
permissive
|
#! /bin/sh
. ./common.inc
eval $(stat -s '/dev/console') || exit 1
logger_debug "OSX console ownership changed"
wanted_uid="$st_uid"
if [ ! -d "$DNSCRYPT_VAR_BASE_DIR" ]; then
mkdir -p "$DNSCRYPT_VAR_BASE_DIR" || exit 1
chown -R 0:0 "$DNSCRYPT_VAR_BASE_DIR"
chmod 755 "$DNSCRYPT_VAR_BASE_DIR"
fi
mkdir -m 755 -p "$TICKETS_DIR" || exit 1
chown -R "${wanted_uid}:0" "$TICKETS_DIR"
eval $(stat -s "$CONTROL_DIR") || exit 1
if [ $? != 0 ]; then
mkdir -m 755 -p "$CONTROL_DIR" || exit 1
current_uid='nonexistent'
else
current_uid="$st_uid"
fi
[ x"$current_uid" != x"$wanted_uid" ] && \
chown -R "${wanted_uid}:0" "$CONTROL_DIR"
| true
|
6ef3bbfd6002794c13cb6c2fe4ea0cb58a383938
|
Shell
|
buildbarn/bb-deployments
|
/tools/remote-toolchains/extract-bazel-auto-toolchains-fixture/doit.sh
|
UTF-8
| 504
| 2.875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
set -eEuxo pipefail
bazel_version="$1"
curl -L -o /bazel "https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/bazel-${bazel_version}-linux-x86_64"
chmod +x /bazel
/bazel query '@local_config_cc//:all + @local_config_cc_toolchains//:all + @local_config_platform//:all + @local_config_sh//:all' > /dev/null
output_base=$(/bazel info output_base)
tar -C "${output_base}/external" -hcz local_config_cc local_config_cc_toolchains local_config_platform local_config_sh
| true
|
dcece72955e6b021d1e5352fe30c4fe27d9386e7
|
Shell
|
cbarange/popos-conf
|
/mouse_wheel_speed.sh
|
UTF-8
| 1,745
| 3.765625
| 4
|
[] |
no_license
|
#!/bin/bash
REQUIRED_PKG="imwheel"
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' $REQUIRED_PKG|grep "install ok installed")
echo Checking for $REQUIRED_PKG: $PKG_OK
if [ "" = "$PKG_OK" ]; then
# Install imwheel and configure imwheel for current user
echo "No $REQUIRED_PKG. Setting up $REQUIRED_PKG."
sudo apt-get --yes install $REQUIRED_PKG
fi
if [ ! -f ~/.imwheelrc ]; then
# Edit config file
echo -e \
'".*"\n' \
'None, Up, Button4, 4 \n' \
'None, Down, Button5, 4 \n' \
'Control_L, Up, Control_L|Button4\n' \
'Control_L, Down, Control_L|Button5\n' \
'Shift_L, Up, Shift_L|Button4\n' \
'Shift_L, Down, Shift_L|Button5\n'\
> ~/.imwheelrc
fi
# Get current wheel speed value
CURRENT_VALUE=$(awk -F 'Button4,' '{print $2}' ~/.imwheelrc)
# Display slider
NEW_VALUE=$(zenity --scale --window-icon=info --ok-label=Apply --title="Wheelies" --text "Mouse wheel speed:" --min-value=1 --max-value=10 --value=`echo $CURRENT_VALUE` --step 1)
if [ "$NEW_VALUE" == "" ]; then
echo "No value set"
exit 0
fi
# Replace old value with current
sed -i "s/\($TARGET_KEY *Button4, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button4, and write new value.
sed -i "s/\($TARGET_KEY *Button5, *\).*/\1$NEW_VALUE/" ~/.imwheelrc # find the string Button5, and write new value.
# Remove imwheel from bashrc
sed -i '/imwheel/d' ~/.bashrc
# Add imwheel to bashrc and disable imwheel management for back and fordward mouse buttons
echo "imwheel --kill --buttons \"4 5\" > /dev/null 2> /dev/null" >> ~/.bashrc
# Kill current process
pgrep -f imwheel | xargs kill > /dev/null 2> /dev/null
# Reload current session
echo "You maybe need to restart a new terminal to apply change"
. ~/.bashrc
#source ~/.bashrc
#exec bash
| true
|
6487efb9bb9fd65bfd73c361fbf4055795c307fe
|
Shell
|
delkyd/alfheim_linux-PKGBUILDS
|
/gdc1-bin/PKGBUILD
|
UTF-8
| 1,759
| 2.859375
| 3
|
[] |
no_license
|
# Contributor: Anntoin Wilkinson <anntoin gmail com>
# Contributor: Shirakawasuna <Shirakawasuna@gmail.com>
# Maintainer: SanskritFritz (gmail)
pkgname=gdc1-bin
pkgver=0.24
pkgrel=11
pkgdesc="Digital Mars D Programing Language (DMD) frontend for GCC."
arch=('i686' 'x86_64')
url="http://dgcc.sourceforge.net/"
license=('GPL')
provides=('gdc1')
conflicts=('gdc-bin' 'gdc1-hg')
depends=('gcc-libs>=4.1.2' 'perl')
options=(staticlibs)
source_i686=("http://downloads.sourceforge.net/project/dgcc/gdc/${pkgver}/gdc-${pkgver}-i686-linux-gnu-gcc-4.1.2.tar.bz2")
source_x86_64=("http://downloads.sourceforge.net/project/dgcc/gdc/${pkgver}/gdc-${pkgver}-x86_64-linux-gnu-gcc-4.1.2.tar.bz2")
md5sums_i686=('7503344b7b2ee882629eef877be9da7a')
md5sums_x86_64=('f4fecc6a5059f8f3de56b65cc4589bbd')
package() {
# Create Directories
install -d "${pkgdir}/usr/"{bin,lib,include,share/{man/man1,doc/gdc1}}
cd "${srcdir}/gdc"
# Install man pages and documentation
install -m644 ./man/man1/gdc.1 "${pkgdir}/usr/share/man/man1/gdc1.1"
install -m644 ./man/man1/gdmd.1 "${pkgdir}/usr/share/man/man1/gdmd1.1"
install -m644 -t "${pkgdir}/usr/share/doc/gdc1/" ./share/doc/gdc/{GDC.html,README.GDC}
# Change regex so gdmd1 can find gdc1
sed -i '57s/-//2' ./bin/gdmd
# Install Binaries
install -m755 ./bin/gdc "${pkgdir}/usr/bin/gdc1"
install -m755 ./bin/gdmd "${pkgdir}/usr/bin/gdmd1"
install -m755 -t "${pkgdir}/usr/bin/" ./libexec/*/$CHOST/*/{cc1d,collect2}
# Install Library
if [ ${CARCH} == 'x86_64' ]; then
install -m644 -t "${pkgdir}/usr/lib/" lib64/libgphobos.a
else
install -m644 -t "${pkgdir}/usr/lib/" lib/libgphobos.a
fi
# Install other resources
find {include/d,lib/gcc} -type f -exec install -Dm644 {} "${pkgdir}/usr/"{} \;
}
# vim:set ts=2 sw=2 et:
| true
|
851e3820eae183932a0ba9766b089fdc9ff87dde
|
Shell
|
jjYBdx4IL/example-maven-project-setups
|
/gwt-example-2/startDev.sh
|
UTF-8
| 1,562
| 3.515625
| 4
|
[] |
no_license
|
#!/bin/bash
# vim:set sw=4 ts=4 et ai smartindent fileformat=unix fileencoding=utf-8 syntax=sh:
#
# Starts and kills gwt dev mode servers while merging their outputs to the current
# console. Needs a recent SCREEN version.
#
# For slow (proper) mode, do: `SLOW=1 ./startDev.sh`
#
# Tested with:
# Screen version 4.06.02 (GNU) 23-Oct-17
# on
# Ubuntu 18.04.1 LTS (bionic)
# Linux ubuntu 4.15.0-45-lowlatency #48-Ubuntu SMP PREEMPT Tue Jan 29 17:45:27 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
#
set -Eex ; set -o pipefail
scriptdir=$(readlink -f "$(dirname "$0")")
cd $scriptdir
which screen
install -d target
touch target/{gwtcodeserver,webserver}.log
echo "Hit ENTER to STOP, go to http://localhost:8080 for development."
tail -n0 -F target/*.log &
tailpid=$!
trap "kill $tailpid" EXIT
screen -c /dev/null -dmS gwtcodeserver -L -Logfile target/gwtcodeserver.log mvn gwt:codeserver
# haven't had problems with the two maven processes starting up in parallel yet, but
# it should be problematic at least in principle.
# Also, in a clean environment, the codeserver seems to create directories that make jetty
# fail if they are not there yet - that's a potential race I know of.
# So, for a proper startup, we should wait for codeserver to finish its startup first.
if [[ -n "$SLOW" ]]; then
while ! curl -s -o /dev/null http://localhost:9876; do sleep 1; done
fi
screen -c /dev/null -dmS webserver -L -Logfile target/webserver.log mvn jetty:run -Denv=dev
read
kill `screen -ls | perl -ne '/^\s+(\d+)\.(webserver|gwtcodeserver)\s+.*$/&&print $1.$/'`
| true
|
b3eb957520d33aad94c350217f63adc8e7ffead8
|
Shell
|
AlixHar1999/KS_Transcriptome
|
/03.1_Trinity.sh
|
UTF-8
| 2,082
| 3.90625
| 4
|
[] |
no_license
|
#!/bin/bash
# Define the key directories
PROJROOT=~/KS_transcriptome
readDIR=${PROJROOT}/02_trimmed_data/fastp_30/trimmed_data
readOUT1=${PROJROOT}/03_assembly/trinity_tissue_specific
readOUT2=${PROJROOT}/03_assembly/trinity_all_tissues
# Global parameters
CPU=20
RAM=250G
##---------------------------##
##Checking Directories##
##---------------------------##
# Check the project root exists
if [[ -d ${PROJROOT} ]]; then
echo -e "Found ${PROJROOT}\n"
else
echo -e "${PROJROOT} not found. \nExiting with error code 1" >&2
exit 1
fi
# Check the trimmed data directory exists
if [[ -d ${readDIR} ]]; then
echo -e "Found ${readDIR}\n"
else
echo -e "${readDIR} not found. \nExiting with error code 2" >&2
exit 2
fi
# Check the parent Trinity output directory exists
if [[ -d ${readOUT1} ]]; then
echo -e "Found ${readOUT1}\n"
else
echo -e "${readOUT1} not found. \nCreating directory ${readOUT1}\n"
mkdir -p ${readOUT1}
fi
# Check the triple data Trinity output directory exists
if [[ -d ${readOUT2} ]]; then
echo -e "Found ${readOUT2}\n"
else
echo -e "${readOUT2} not found. \nCreating directory ${readOUT2}\n"
mkdir -p ${readOUT2}
fi
##-----------------------##
##Running Trinity##
##-----------------------##
# Run trinity for each tissue specific fatsp min length 30 trimmed data.
cd ${readDIR}
READS=$(ls *fastp30_R1.fq.gz)
for f in ${READS} ;
do
READNAME=${f%_fastp30_R1.fq.gz}
echo -e "Commencing Trinity Assembly for ${f}\n"
Trinity \
--seqType fq \
--left ${readDIR}/${READNAME}_fastp30_R1.fq.gz --right ${readDIR}/${READNAME}_fastp30_R2.fq.gz \
--CPU ${CPU} \
--max_memory ${RAM} \
--output ${readOUT1}/${READNAME}30_trinity
done
# Run trinity for each all tissue fatsp min length 30 trimmed data.
R1=${readDIR}/KS_LRS_fastp30_R1.fq.gz
R2=${readDIR}/KS_LRS_fastp30_R2.fq.gz
echo -e "Running Trinity using all tissues\n"
Trinity \
--seqType fq \
--left ${R1} --right ${R2} \
--CPU ${CPU} \
--max_memory ${RAM} \
--output ${readOUT2}/KS_LRS30_trinity
echo -e "Done"
| true
|
bf637b00adc3119aa3154b38a60467065763dd45
|
Shell
|
laptop012/raspberrypi_at_home
|
/backup/nenujno/arduino/check_data_on_com.sh
|
UTF-8
| 201
| 2.96875
| 3
|
[] |
no_license
|
#!/bin/bash
ps aux | grep ACM | grep -v grep
if [ $? -eq 0 ]; then
echo "Process is running."
exit
else
echo "Process is not running."
rm /tmp/serial
cat /dev/ttyACM0 > /tmp/serial &
exit
fi
| true
|
d1fb844802fcfbc3401e9ad5355be4d0823b1766
|
Shell
|
vbarbarosh/codescreens
|
/src/20190331_233902_shell_bash_vars_exists/shell_bash_vars_exists
|
UTF-8
| 718
| 3.6875
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o nounset -o errexit -o pipefail
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
# Check if $FOO is unset
test -z ${FOO+x} && echo FOO is unset
# Check if $FOO is unset or empty
test -z ${FOO:+x} && echo FOO is unset or empty
# print __SET__ if $FOO is defined
echo ${FOO+__SET__}
# print __UNSET__ if $FOO is not defined
echo ${FOO-__UNSET__}
# print __SET_AND_NOT_EMPTY__ if $FOO is defined and not empty
echo ${FOO:+__SET_AND_NOT_EMPTY__}
# print __UNSET_OR_EMPTY__ if $FOO is not defined or empty
echo ${FOO:-__UNSET_OR_EMPTY__}
| true
|
fb6298c4835e074d409b3aeb557907d86c925ba6
|
Shell
|
kgoel9899/Shell_Scripting
|
/ex/parm
|
UTF-8
| 199
| 3.25
| 3
|
[] |
no_license
|
#!/bin/bash
user=$1
db="/etc/passwd"
[ $# -eq 0 ] && { echo "Usage: $0 userame"; exit 1; }
grep "^$user" $db > /dev/null
retval=$?
[ $retval -eq 0 ] && echo "$user found" || echo "$user not found"
| true
|
3972f85c70f8afa26cc496511cc0afc8c5f437b2
|
Shell
|
zildjiean/pfx-extractor-to-crt-key
|
/extract_pfx.sh
|
UTF-8
| 2,810
| 4.125
| 4
|
[] |
no_license
|
#!/bin/bash
#########################################################################################
#
# Original by https://gist.github.com/mediaupstream/a2694859b1afa59f26be5e8f6fd4806a
# Thank you mediaupstream on github
#
# Modify by Piyapong 07-Nov-2019
# Usage: sh <this_script.sh> PFXcert without extension .pfx
# Adding: Checking Missing, Verify .crt and .key,Result Color and Clean-up after process
#
##########################################################################################
filename=$1
if [ -z $filename ];
then
echo "\e[31m\e[1mNo Operation"
echo "\e[39m\e[0mPlese enter PFX name (without extension .pfx)"
echo "\e[39m\e[0mExample: extract_cert.sh example.com"
else
# Read PFX Password
read -p "Please enter password: " pfxpass
# Clear terminal
clear
# extract ca-certs
echo "\e[31m> \e[32mExtracting ca-certs..."
/usr/bin/openssl pkcs12 -in ${filename}.pfx -nodes -nokeys -cacerts -out ${filename}-ca.crt -passin pass:$pfxpass
echo "\e[32mdone!"
echo " "
# extract key
echo "\e[31m> \e[32mExtracting key file..."
/usr/bin/openssl pkcs12 -in ${filename}.pfx -nocerts -out ${filename}.key -passin pass:$pfxpass -passout pass:$pfxpass
echo "\e[32mdone!"
echo " "
# extract crt
echo "\e[31m> \e[32mExtracting crt..."
/usr/bin/openssl pkcs12 -in ${filename}.pfx -clcerts -nokeys -out ${filename}.crt -passin pass:$pfxpass
# extract crt for check md5 and program will delete in last process
/usr/bin/openssl pkcs12 -in ${filename}.pfx -clcerts -nokeys -out ${filename}-noCA.crt -passin pass:$pfxpass
echo "\e[31m> \e[32mCombining ca-certs with crt file..."
# combine ca-certs and cert files
cat ${filename}-ca.crt ${filename}.crt > ${filename}-full.crt
# remove passphrase from key file
echo "\e[39m> Removing passphrase from keyfile"
/usr/bin/openssl rsa -in ${filename}.key -out ${filename}.key -passin pass:$pfxpass
# clean up
rm ${filename}-ca.crt
mv ${filename}-full.crt ${filename}.crt
echo "\e[32mdone!"
echo " "
echo "\e[32mExtraction complete! 🐼"
echo "\e[32mcreated files:"
echo " 🔑 ${filename}.key"
echo " 📄 ${filename}.crt"
echo " "
#check crt and key is matching
crtmd5=$(/usr/bin/openssl x509 -noout -modulus -in ${filename}-noCA.crt | openssl md5 | cut -c10-)
keymd5=$(/usr/bin/openssl rsa -noout -modulus -in ${filename}.key | openssl md5 | cut -c10-)
sleep 1
echo "\e[31m> \e[32mCalculate hashing .crt"
sleep 1
echo "\e[39m${crtmd5}"
sleep 1
echo "\e[31m> \e[32mCalculate hashing .key"
sleep 1
echo "\e[39m${keymd5}"
echo " "
# Check md5 cert is matching?
if [ $crtmd5 = $keymd5 ];
then
echo "\e[32m\e[1mCert and Key Matching!!!"
echo "\e[32m\e[1mDone !"
else
echo "\e[31m\e[1mCert and Key not Match!!!"
echo "\e[31m\e[1mPlease check PFX file."
fi
echo " "
echo "\e[39m> Clean up..."
# All Clean
rm ${filename}-noCA.crt
echo " "
fi
| true
|
f468000bb7f3bb018caa57ab47ac533636ed5f7d
|
Shell
|
Jesse-Runner/VirtualMachine
|
/tests/test.sh
|
UTF-8
| 301
| 3.28125
| 3
|
[] |
no_license
|
#!/bin/bash
ERR=0
INPUTS=`ls *.o`
for f in $INPUTS;
do
../target/release/vm $f > "${f%.o}.student"
if ! diff -q "${f%.o}.student" "${f%.o}.expected" &>/dev/null; then
printf "%-10s %10s\n" $f "ERROR, outputs differ"
ERR=1
else
printf "%-10s %10s\n" $f "passed"
fi
done
exit $ERR
| true
|
8e1a7047c684cb67aee5a0a45a290fca5da8c87d
|
Shell
|
sandeepgit32/flask_inventory_microservices
|
/tes.sh
|
UTF-8
| 181
| 3.328125
| 3
|
[] |
no_license
|
if [ $1 = "up" ]
then
echo "Both variables are the same"
elif [ $1 = "down" ]
then
echo "Both variables are different"
else
echo "The argument" $1 "is not recognized"
fi
| true
|
528c32fbeeff4d5be4ede37dbe9e1dd23a8dc74a
|
Shell
|
Brutuski/Dotfiles
|
/.config/rofi/powermenu.sh
|
UTF-8
| 343
| 2.890625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/sh
MENU="$(rofi -theme ~/.config/rofi/themes/lighthaus.rasi -sep "|" -dmenu -i -p 'System' -font 'Source Code Pro Medium 12' <<< " Logout| Reboot| Shutdown")"
case "$MENU" in
*Logout) i3lock -i ~/Documents/Chrome-Downloads/Lockscreen.png -p default -n ;;
*Reboot) systemctl reboot ;;
*Shutdown) systemctl poweroff
esac
| true
|
b87845be263f41090fc0efc01d2f19bde5e1d139
|
Shell
|
nnstreamer/TAOS-CI
|
/ci/taos/plugins-good/pr-prebuild-clang.sh
|
UTF-8
| 4,281
| 3.703125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
##
# Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##
# @file pr-prebuild-clang.sh
# @brief Check Check the code formatting style with clang-format
# @see https://github.com/nnstreamer/TAOS-CI
# @author Geunsik Lim <geunsik.lim@samsung.com>
# @detail Users may provide arguments with "clang_option" variable,
# where multiple options may be given with a space, " ", as a
# separator.
# Available options are:
# cxx-only : Audit C++ files only (*.cc, *.hh, *.H, *.cpp)
##
# @brief [MODULE] ${BOT_NAME}/pr-prebuild-clang
function pr-prebuild-clang(){
echo "########################################################################################"
echo "[MODULE] pr-prebuild-clang: Check the code formatting style with clang-format"
# Note that you have to install clang-format package from llvm project.
# $ sudo apt install clang-format-12
# In case that we need to change clang-format with latest version, refer to https://apt.llvm.org
CLANGFORMAT=NA
CLANG_COMMAND=${CLANG_FORMAT_VERSION}
which ${CLANG_COMMAND}
if [[ $? -ne 0 ]]; then
echo "Error: ${CLANG_COMMAND} is not available."
echo " Please install ${CLANG_COMMAND}."
exit 1
fi
echo "[DEBUG] Path of a working directory: "
pwd
# investigate files that are affected by the incoming patch
# TODO: get all diff since master?
FILELIST=`git show --pretty="format:" --name-only --diff-filter=AMRC`
AUDITLIST=""
for i in ${FILELIST}; do
AUDITLIST+=`echo $i | grep -i ".*\.h$"`
AUDITLIST+=`echo $i | grep -i ".*\.hpp$"`
AUDITLIST+=`echo $i | grep -i ".*\.hh$"`
AUDITLIST+=`echo $i | grep -i ".*\.c$"`
AUDITLIST+=`echo $i | grep -i ".*\.cpp$"`
AUDITLIST+=`echo $i | grep -i ".*\.cc$"`
AUDITLIST+=' '
done
echo "[DEBUG] Files of source code: $AUDITLIST"
# import clang configuration file
if [ ! -f ".clang-format" ]; then
ln -sf ci/doc/.clang-format .clang-format
fi
# run clang format checker
for i in ${AUDITLIST}; do
${CLANG_COMMAND} -i $i
done
# save the result
clang_format_file="clang-format.patch"
search_target=""
for option in ${clang_option}; do
if [ "${option}" == "cxx-only" ]; then
search_target="-- *.cc *.hh *.hpp *.cpp"
fi
done
git diff ${search_target} > ../report/${clang_format_file}
# Revert what clang-format did to the source tree
git reset --hard
# check a clang format rule with file size of patch file
PATCHFILE_SIZE=$(stat -c%s ../report/${clang_format_file})
if [[ $PATCHFILE_SIZE -ne 0 ]]; then
echo "[DEBUG] a module of the prebuild group is failed. Update your code to follow convention after reading ${clang_format_file}."
check_result="failure"
global_check_result="failure"
else
check_result="success"
fi
# report the clang inspection result
if [[ $check_result == "success" ]]; then
echo "[DEBUG] Passed. A clang-formatting style."
message="Successfully, The commits are passed."
cibot_report $TOKEN "success" "${BOT_NAME}/pr-prebuild-clang" "$message" "${CISERVER}${PRJ_REPO_UPSTREAM_LOCAL}/ci/${dir_commit}/" "$GITHUB_WEBHOOK_API/statuses/$input_commit"
else
echo "[DEBUG] Failed. A clang-formatting style."
message="Oooops. The component you are submitting with incorrect clang-format style."
cibot_report $TOKEN "failure" "${BOT_NAME}/pr-prebuild-clang" "$message" "${CISERVER}${PRJ_REPO_UPSTREAM_LOCAL}/ci/${dir_commit}/" "$GITHUB_WEBHOOK_API/statuses/$input_commit"
fi
}
| true
|
651b09ae901a463d59f602183951b0405f575a3d
|
Shell
|
leetschau/dsnote
|
/pub-to-github.sh
|
UTF-8
| 857
| 3.59375
| 4
|
[] |
no_license
|
#!/bin/bash
LocalRepo="/tmp/blogRepo"
BlogHome="$LocalRepo/blogs"
Readme="$LocalRepo/README.md"
source $(dirname "$0")/myconfig
rm -rf $LocalRepo
git clone $BlogURL $LocalRepo
cp $PubBlogPath $BlogHome
for afile in $BlogHome/*; do
modified=$(awk -F ': ' 'FNR==5 {print $2}' $afile) # 5 is MODIFIED_LINE_NO
touch -d "$modified" $afile
done
cat << EOF > $Readme
Welcome to Leo's tech blog :)
# Table of Contents
EOF
for fullname in $(ls -t $BlogHome/*); do
created=$(sed -n 4p $fullname | cut -d' ' -f2)
title=$(awk -F ': ' 'FNR==1 {print $2}' $fullname)
tags=$(awk -F ': ' 'FNR==2 {print $2}' $fullname)
filename=$(basename $fullname)
rec="+ [$title](blogs/$filename) $created $tags"
echo $rec >> $Readme
sed -i "1 c # $title" $fullname
sed -i "3,5 d" $fullname
done
cd $LocalRepo
git add -A
git commit -m 'update blogs'
git push
| true
|
924333bf6103b9dd814f6ba731c4c6bdddc3903d
|
Shell
|
CLwn/GSX
|
/gestion_procesos/stopProc.sh
|
UTF-8
| 1,265
| 3.953125
| 4
|
[] |
no_license
|
#!/bin/bash
# Marc García, Miguel Martínez, Nohemí Tomàs
# Date: 05 mar 2020
# Version 0.1
# Para todos los procesos que hayan consumido 3 min de CPU en
# una hora. comando crontab 0 10-20 * * * ./stopProc.sh
#### CODE ####
if [ "$EUID" -ne 0 ] 2> /dev/null; then #Si no se esta ejecutando como root
echo "ERROR: Permisos de root son necesarios para ejecutar el script" >&2
exit 2
fi
if [ $1 = "-h" ] 2> /dev/null; then
echo "Uso: ./stopProc.sh"
echo "Para todos los procesos en ejecución que hayan consumido más de 3 min de la CPU"
echo -e "Opciones:\n\t -h\tAyuda para utilizar el script"
echo "Necesitamos permisos de root para dar de alta al usuario"
exit 0
fi
IFS=$'\n'
if [ ! -f /home/milax/GSX/gestion_procesos/stoppedProc.txt ]; then
touch /home/milax/GSX/gestion_procesos/stoppedProc.txt
fi
file=$(cat /home/milax/GSX/gestion_procesos/stoppedProc.txt)
procesos=$(ps -e --no-headers -o "%p/%x")
for line in $procesos;do
if [ $(date --date="$(cut -f2 -d"/" <<< "$line")" +%s) -ge $(date --date="00:03:00" +%s) ]; then
pid=$(echo "$line" | cut -f1 -d "/")
findProc=$($file | grep "$pid")
if [ "$findProc" = "" ]; then
echo "$pid" >> /home/milax/GSX/gestion_procesos/stoppedProc.txt
kill -SIGSTOP $pid
fi
fi
done
exit 0
| true
|
a0f36798cb826cb4d78fce64582522829483714a
|
Shell
|
NobbZ/dotfiles
|
/install.zsh
|
UTF-8
| 1,216
| 4.25
| 4
|
[] |
no_license
|
#!/usr/bin/env zsh
### This script installs all the dotfiles, folders and scripts into the
### appropriate locations.
###
### This script works by copying the files out of intention. It is meant to be
### run on platforms that don't support symlinking. Perhaps there will be added
### an option later on, that recognises those platforms.
if [[ $1 == "-d" ]]; then
set -ex; shift
fi
fpath=(install_helpers $fpath)
local funs=(
check
compare_and_copy_files
cp_files
decorate
h1
h2
)
for f in $funs; do
autoload -U $f
done
autoload -U colors; colors
if [[ $1 == "help" ]]; then
cat $0 | grep -E "^### ?" | sed -r 's|### ?||'
exit 0
elif [[ $# -ne 0 ]]; then
cat $0 | grep -E "^### ?" | sed -r 's|### ?||'
exit 1
fi
local h1="${fg_bold[blue]}"
local h2="${fg_bold[cyan]}"
local default="${reset_color}"
local ok="\t[${fg[green]} OK ${default}]"
local fail="\t[${fg[red]}FAIL${default}]"
local cp="\t[${fg[green]} CP ${default}]"
local skip="\t[${fg[yellow]}SKIP${default}]"
LANG=C
h1 Prechecks
check sha1sum
h1 Finding files
local files=(`find home -type f -not -name '*~'`)
h1 "Copying files"
cp_files $files
h1 Compiling files
pushd ~
make -C .zsh
popd
| true
|
28d371377f3f92fbd8173992a01398e915001d29
|
Shell
|
dywisor/fischstaebchen
|
/shellfunc/src/base/12-strutil/20-get_regex_or_expr.sh
|
UTF-8
| 605
| 3.140625
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
## Copyright (c) 2014-2015 André Erdmann <dywi@mailerd.de>
##
## Distributed under the terms of the MIT license.
## (See LICENSE.MIT or http://opensource.org/licenses/MIT)
##
## @setf void get_regex_or_expr ( *wordlist, **expr! )
get_regex_or_expr() {
expr=
# shellcheck disable=SC2048
{ set -f; set -- ${*}; set +f; }
[ ${#} -gt 0 ] || return 1
expr="${1}"; shift
<%%argc_loop ::: expr="${expr}|${1}" %>
expr="(${expr})"
return 0
}
## @setf void get_regex_or_expr_exact ( *wordlist, **expr! )
get_regex_or_expr_exact() {
get_regex_or_expr "${@}"
[ -z "${expr}" ] || expr="^${expr}\$"
}
| true
|
ae7599bed0a3fa75270becfd92d7861e23d05932
|
Shell
|
DylanHuang666/rn-ldsg
|
/tools/logo/change_logo.sh
|
UTF-8
| 3,049
| 2.828125
| 3
|
[] |
no_license
|
#! /bin/sh
##########################################################
# 使用说明,参数说明
# change_logo.sh 项目名
# $1 项目名 例如现在只有 TTT
# sh change_logo.sh TTT
##########################################################
now_path=$(cd $(dirname $0);pwd)
IMAGE_MAGICK_BIN=${now_path}/../ImageMagick/darwin
chmod +x ${IMAGE_MAGICK_BIN}/convert
# 切换到项目文件夹内
cd ${now_path}
cd ../../$1
SRC_LOGO1="logo/logo.png"
SRC_LOGO2="logo/logo2.png"
SRC_LOGO3="logo/logo3.png"
DST_ANDROID_RES="android/app/src/main/res"
DST_IOS_RES="ios/TTT/Images.xcassets/AppIcon.appiconset"
DST_IMAGES="images"
${IMAGE_MAGICK_BIN}/convert -resize 72x72 ${SRC_LOGO1} ${DST_ANDROID_RES}/mipmap-hdpi/ic_launcher.png
${IMAGE_MAGICK_BIN}/convert -resize 72x72 ${SRC_LOGO2} ${DST_ANDROID_RES}/mipmap-hdpi/ic_launcher_round.png
${IMAGE_MAGICK_BIN}/convert -resize 48x48 ${SRC_LOGO1} ${DST_ANDROID_RES}/mipmap-mdpi/ic_launcher.png
${IMAGE_MAGICK_BIN}/convert -resize 48x48 ${SRC_LOGO2} ${DST_ANDROID_RES}/mipmap-mdpi/ic_launcher_round.png
${IMAGE_MAGICK_BIN}/convert -resize 96x96 ${SRC_LOGO1} ${DST_ANDROID_RES}/mipmap-xhdpi/ic_launcher.png
${IMAGE_MAGICK_BIN}/convert -resize 96x96 ${SRC_LOGO2} ${DST_ANDROID_RES}/mipmap-xhdpi/ic_launcher_round.png
${IMAGE_MAGICK_BIN}/convert -resize 144x144 ${SRC_LOGO1} ${DST_ANDROID_RES}/mipmap-xxhdpi/ic_launcher.png
${IMAGE_MAGICK_BIN}/convert -resize 144x144 ${SRC_LOGO2} ${DST_ANDROID_RES}/mipmap-xxhdpi/ic_launcher_round.png
${IMAGE_MAGICK_BIN}/convert -resize 192x192 ${SRC_LOGO1} ${DST_ANDROID_RES}/mipmap-xxxhdpi/ic_launcher.png
${IMAGE_MAGICK_BIN}/convert -resize 192x192 ${SRC_LOGO2} ${DST_ANDROID_RES}/mipmap-xxxhdpi/ic_launcher_round.png
#${IMAGE_MAGICK_BIN}/convert -size 750x1470 xc:white -compose over ${SRC_LOGO3} -geometry 180x248+285+369 -composite ${DST_ANDROID_RES}/drawable-xhdpi/bg_loader.png
${IMAGE_MAGICK_BIN}/convert -resize 40x40 ${SRC_LOGO1} ${DST_IOS_RES}/40x40.png
${IMAGE_MAGICK_BIN}/convert -resize 58x58 ${SRC_LOGO1} ${DST_IOS_RES}/58x58.png
${IMAGE_MAGICK_BIN}/convert -resize 60x60 ${SRC_LOGO1} ${DST_IOS_RES}/60x60.png
${IMAGE_MAGICK_BIN}/convert -resize 80x80 ${SRC_LOGO1} ${DST_IOS_RES}/80x80.png
${IMAGE_MAGICK_BIN}/convert -resize 87x87 ${SRC_LOGO1} ${DST_IOS_RES}/87x87.png
${IMAGE_MAGICK_BIN}/convert -resize 120x120 ${SRC_LOGO1} ${DST_IOS_RES}/120x120.png
${IMAGE_MAGICK_BIN}/convert -resize 120x120 ${SRC_LOGO1} ${DST_IOS_RES}/120x120-1.png
${IMAGE_MAGICK_BIN}/convert -resize 180x180 ${SRC_LOGO1} ${DST_IOS_RES}/180x180.png
${IMAGE_MAGICK_BIN}/convert -resize 1024x1024 ${SRC_LOGO1} ${DST_IOS_RES}/1024x1024.png
#${IMAGE_MAGICK_BIN}/convert -size 750x1624 xc:white -compose over ${SRC_LOGO3} -geometry 180x248+285+369 -composite ios/TTT/bg_loader.png
${IMAGE_MAGICK_BIN}/convert -resize 1024x1024 ${SRC_LOGO1} ${DST_IMAGES}/logo@3x.png
${IMAGE_MAGICK_BIN}/convert -resize 512x512 ${SRC_LOGO2} ${DST_IMAGES}/ic_logo_circle@3x.png
${IMAGE_MAGICK_BIN}/convert -resize 176x176 ${SRC_LOGO2} ${DST_IMAGES}/message/ic_offical_message@3x.png
| true
|
9752b599a36e0a2e893e0faabd007426bb254cfd
|
Shell
|
mclarkson/nagrestconf
|
/build/Synology/create_tgz/build-arm/synology/ds-arm/plugins/check_switch_ifs_zeroconf
|
UTF-8
| 10,219
| 3.53125
| 4
|
[] |
no_license
|
#!/bin/bash
# Copyright(C) 2012 Mark Clarkson <mark.clarkson@smorg.co.uk>
#
# This software is provided under the terms of the GNU
# General Public License (GPL), as published at:
# http://www.gnu.org/licenses/gpl.html .
#
# File: check_switch_ifs_zeroconf
# Date: 12 Dec 2012
# Version: 0.12
# Modified: 0.11 - Mark Clarkson <mark.clarkson@smorg.co.uk>
# Added support for snmpbulkwalk as it's more efficient.
# 0.12 - 7-Jan-13 by Mark Clarkson <mark.clarkson@smorg.co.uk>
# Show the interface description field.
# 0.13 - 31-Jan-13 by Mark Clarkson <mark.clarkson@smorg.co.uk>
# Corrected the up/down count.
#
# Purpose: Check that ifAdminStatus matches ifOperStatus. I.e. Check
# that the interface is in the state the network admin requested.
#
# Notes:
#
# ---------------------------------------------------------------------------
# DEFAULTS (Change as necessary)
# ---------------------------------------------------------------------------
# Use snmpbulkwalk if it's available - it's more efficient
snmpwalk=snmpbulkwalk
#snmpwalk=snmpwalk
# ---------------------------------------------------------------------------
# DON'T TOUCH ANYTHING BELOW
# ---------------------------------------------------------------------------
declare -i gnumrecords=0
ME="$0"
CMDLINE="$@"
TRUE=1
FALSE=0
VERSION="0.13"
OK=0
WARN=1
CRIT=2
UNKN=3
COMMUNITY=
LIST=$FALSE
INCFILT=.
EXCFILT=WonTmAtChIhoPe
# Global arrays to store all details in - should all be the same size.
declare -a ifDescr
declare -a ifAlias
declare -a ifAdminStatus
declare -a ifOperStatus
declare -a show
declare -a alert
declare -a up
# Status values for ifAdminStatus and ifOperStatus
declare -a Status=(
"dummy" # <- not used, dummy for index 0
"up"
"down"
"testing"
"unknown" # <- ifOperStatus only
"dormant" # <- ifOperStatus only
"notPresent" # <- ifOperStatus only
"lowerLayerDown" # <- ifOperStatus only
)
# Nagios status
declare -a AlertStatus=(
"OK"
"WARNING"
"CRITICAL"
"Unknown"
)
# IF-MIB oids
ifmib_ifentry=".1.3.6.1.2.1.2.2.1"
ifmib_ifXentry=".1.3.6.1.2.1.31.1.1.1"
# Sequence number to append to the OID.
ifDescr_num=2
ifAdminStatus_num=7
ifOperStatus_num=8
ifAlias_num=18 # <- The interface description
# ---------------------------------------------------------------------------
main()
# ---------------------------------------------------------------------------
# Execution begins and ends here.
{
local -i numinterfaces=0 numdownints=0 candwidth col1width retval
local i t comma
retval=$OK
parse_options "$@"
pass_sanitychecks_or_quit
fill_arrays
[[ $LIST -eq $TRUE ]] && {
for i in `seq 0 $(($gnumrecords-1))`; do
candwidth=`echo ${ifDescr[i]} | wc -c`
[[ $col1width -lt $candwidth ]] && col1width=$candwidth
done
printf "%-${col1width}s %-13s %-13s %-13s %s\n" \
"ifDescr" "ifAdminStatus" "ifOperStatus" "AlertStatus" \
"ifAlias"
for i in `seq 0 $(($gnumrecords-1))`; do
[[ ${show[i]} -eq 0 ]] && continue
printf "%-${col1width}s %-13s %-13s %-13s %s\n" \
"${ifDescr[i]}" \
"${Status[${ifAdminStatus[i]}]}" \
"${Status[${ifOperStatus[i]}]}" \
"${AlertStatus[${alert[i]}]}" \
"${ifAlias[i]}"
done
exit $OK
}
t="CRITICAL: IFs down: " ; comma=
for i in `seq 0 $(($gnumrecords-1))`; do
[[ ${show[i]} -eq 0 ]] && continue
if [[ ${up[i]} -eq 1 ]]; then
: $((numinterfaces++))
else
: $((numdownints++))
fi
[[ ${alert[i]} -gt 0 ]] && {
t="$t$comma ${ifDescr[i]} (${ifAlias[i]})"
[[ ${alert[i]} -gt $retval ]] && retval=${alert[i]}
comma=","
}
done
if [[ $retval -eq $OK ]]; then
echo -n "OK: $numinterfaces interfaces are UP. $numdownints are "
echo "administratively disabled."
else
echo "$t"
fi
exit $retval
}
# ---------------------------------------------------------------------------
pass_sanitychecks_or_quit()
# ---------------------------------------------------------------------------
{
if ! which $snmpwalk >& /dev/null; then
echo "Unknown: snmpwalk binary not found in path. Aborting."
exit $UNKN
fi
[[ -z $IP ]] && {
echo "Unknown: IP address or hostname was not supplied. Aborting."
exit $UNKN
}
}
# ----------------------------------------------------------------------------
usage()
# ----------------------------------------------------------------------------
{
echo
echo "`basename $ME` - Zero-conf bulk interface checker."
echo
echo "Usage: `basename $ME` [-h] [-l] [-c SECRET]"
echo " [-f REGEX] [-F REGEX] host|IP"
echo
echo " -h : Display this help text."
echo " -v : Display the version of this script."
echo " -l : List all available ports and their status."
echo " -C SECRET : Community string."
echo " -f REGEX : Inclusive regular expression (these)."
echo " -F REGEX : Exclusive regular expression (but not these)."
echo
echo "Check that interfaces are in the state that the network admin"
echo "requested them to be in. For example, 'shutdown' interfaces"
echo "should be down and 'no shutdown' interfaces should be up."
echo
echo "Examples"
echo
echo "List all interfaces on the device:"
echo " `basename $ME` -l -C secret 1.2.3.4"
echo
echo "List only Ethernet1/1/1 interfaces on the device:"
echo " `basename $ME` -l -f Ethernet1/1/1$ -C secret 1.2.3.4"
echo
echo "List only Ethernet interfaces on the device:"
echo " `basename $ME` -l -f Ethernet -C secret 1.2.3.4"
echo
echo "Check all interface on the device:"
echo " `basename $ME` -C secret 1.2.3.4"
echo
echo "Check all interfaces on the device except vlan and port channels:"
echo " `basename $ME` -C secret -F 'vlan|port' 1.2.3.4"
echo
echo "NOTE: Do not use this plugin to check individual interfaces."
echo " It is for bulk checks only - individual checks will be slow"
echo
echo "NOTE: Searches with -f and -F are case-insensitive"
echo
}
# ---------------------------------------------------------------------------
alert_logic()
# ---------------------------------------------------------------------------
# UP(1) UP = OK
# UP DOWN(2) = CRITICAL
# DOWN UP = WARNING
# DOWN DOWN = OK
#
# $1 - ifAdminStatus
# $2 - ifOperStatus
#
# Returns 0,1,2 or 3 (OK, WARN, CRITICAL, Unknown).
{
local retval=$OK
if [[ $1 -eq 1 && $2 -ge 2 ]]; then
retval=$CRIT
elif [[ $1 -ge 2 && $2 -eq 1 ]]; then
retval=$WARN
fi
return $retval
}
# ---------------------------------------------------------------------------
fill_arrays()
# ---------------------------------------------------------------------------
{
local i donebefore=0
# A retry loop
while true; do
eval `x=0 ; \
for i in ifDescr; do \
id=$(eval echo "\\$${i}_num"); \
$snmpwalk -v 2c -One -c $COMMUNITY $IP $ifmib_ifentry.$id \
| tr -d \" \
| while read a b c d; do \
if echo "$d" | grep -Eiv "($EXCFILT)" | \
grep -Ei -qs "($INCFILT)"; \
then echo "show[$x]=1"; else echo "show[$x]=0"; fi; \
echo "$i[$x]=\"$d\""; : $((++x)); \
done \
done 2>/dev/null`
gnumrecords=${#ifDescr[*]}
[[ $gnumrecords -lt 2 ]] && {
echo "Unknown: No records. Check the community string. Aborting."
exit $UNKN
}
eval `x=0 ; \
for i in ifAdminStatus ifOperStatus; do \
id=$(eval echo "\\$${i}_num"); \
$snmpwalk -v 2c -One -c $COMMUNITY $IP $ifmib_ifentry.$id \
| tr -d \" \
| while read a b c d; do \
echo "$i[$x]=\"$d\""; \
: $((++x)); \
done \
done 2>/dev/null`
eval `x=0 ; \
for i in ifAlias; do \
id=$(eval echo "\\$${i}_num"); \
$snmpwalk -v 2c -One -c $COMMUNITY $IP $ifmib_ifXentry.$id \
| tr -d \" \
| while read a b c d; do \
echo "$i[$x]=\"$d\""; \
: $((++x)); \
done \
done 2>/dev/null`
[[ $gnumrecords -ne ${#ifAdminStatus[*]} ||
$gnumrecords -ne ${#ifOperStatus[*]} ||
$gnumrecords -ne ${#ifAlias[*]} ]] && {
[[ $donebefore -ne 1 ]] && {
donebefore=1
continue
}
echo "Unknown: SNMP records mismatch in second walk. Aborting."
exit $UNKN
}
break
done
# Work out alert logic for each entry
for i in `seq 0 $((gnumrecords-1))`; do
alert_logic "${ifAdminStatus[i]}" "${ifOperStatus[i]}"
alert[i]=$?
up[i]=0
[[ "${ifAdminStatus[i]}" -eq 1 ]] && up[i]=1
done
}
# ----------------------------------------------------------------------------
parse_options()
# ----------------------------------------------------------------------------
# Purpose: Parse program options and set globals.
# Arguments: None
# Returns: Nothing
{
set -- $CMDLINE
while true
do
case $1 in
-h|--help) usage; exit 0
;;
-f) INCFILT="$2"; shift
;;
-F) EXCFILT="$2"; shift
;;
-[cC]) COMMUNITY="$2"; shift
;;
-l) LIST=1
;;
-v|--version) echo "$VERSION"; exit 0
;;
?*) IP="$1"
;;
esac
shift 1 || break
done
}
main "$@"
exit 0
| true
|
736435cf0ac277a97a13fd1b69c5716d1abd83fd
|
Shell
|
chumakd/devenv
|
/devenv
|
UTF-8
| 7,742
| 4.25
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
set -e -o pipefail
shopt -s expand_aliases
### wrapper to run official Docker containers for programming languages
if (( ${BASH_VERSINFO[0]} < 4 )) ; then
echo "${0##*/}: bash version < 4 is not supported" >&2
echo 'Try installing a modern bash version with either of:' >&2
echo ' brew install bash' >&2
echo ' port install bash' >&2
exit 1
fi
# a hack for `readlink -f` on BSD systems
if [[ $(uname) == Darwin ]] && ! readlink -f / &> /dev/null ; then
if which greadlink &> /dev/null ; then
alias readlink=greadlink
else
echo "${0##*/}: \`readlink -f\` doesn't work" >&2
echo 'Try installing GNU readlink (greadlink) with either of:' >&2
echo ' brew install coreutils' >&2
echo ' port install coreutils' >&2
exit 1
fi
fi
# constants
readonly SELF="$(readlink -f $0)"
readonly BASE_DIR="${SELF%/*}"
readonly PROG_NAME="${0##*/}"
#colors
readonly NC="$(tput sgr0)" # No Color
readonly LightRed="$(tput bold ; tput setaf 1)"
readonly Yellow="$(tput bold ; tput setaf 3)"
readonly Green="$(tput setaf 2)"
# variables
verbose=false
cmd=start
# utils
_help()
{
[[ $1 == stdout ]] && usage || usage >&2
exit 1
}
usage()
{
cat <<USAGE_END
Usage: $PROG_NAME
$PROG_NAME [options] [command [command-options]]
Helper tool to operate various programming languages environments that are
based on official Docker images.
Commands:
list Show all supported environments. Option '-a|--all' enables detailed
listing.
ps Show existing containers.
run <environment> [command [options]]
Run a command inside an environment, with CWD mounted from the
host, removing container after exit.
Example: $PROG_NAME run ruby ./my-script.rb --script-opt script-arg
$PROG_NAME run rust cargo new my-project
init <environment> [name] [options]
Initialize environment with CWD mounted under '/data/' inside
container. A custom 'name' can be set for the resulting container,
which allows creating multiple containers of the same environment
type (e.g. a container per project). Default name matches
environment. If 'options' provided, they're passed to the
\`docker create\` command.
start [name]
Start a container. It must be created first, using \`init\`
command. If name is not specified, container will be searched in
the list of existing environments attached to the current working
directory. This is the default command.
<environment>
Create specific environment and attach to it.
Example: $PROG_NAME python-shell
$PROG_NAME haskell-repl
clean [environment]
Remove all or particular environments (containers).
help Show this help screen.
Options:
-v|--verbose Print what's going on.
-h|--help Print this help screen.
USAGE_END
}
die()
{
local error='[ERROR]'
if [[ -t 2 ]] ; then
error="$LightRed$error$NC"
fi
echo -e "$PROG_NAME $error $@" >&2
exit 1
}
# commands
cmd_list()
{
local filter='grep -v -'
[[ $1 == -a || $1 == --all ]] && filter=cat
docker-compose ps --services | ${filter}
}
cmd_ps()
{
if (( $(docker ps --quiet --all --filter 'label=devenv.type' | wc -l) > 0 )) ; then
docker ps --all --filter 'label=devenv.type' \
--format 'table {{.Names}}\t{{.Status}}\t{{.Label "devenv.datadir"}}'
fi
}
create()
{
local container=$1
docker inspect --format '{{.Id}}' $container &>/dev/null ||
docker-compose up --no-start $container
}
cmd_start()
{
local container=$1
if [[ -z $container ]] ; then
local available=( $(docker ps --quiet --all --filter "label=devenv.datadir=$OLDPWD") )
(( ${#available[@]} > 0 )) ||
die "No environment yet exists for current project '$OLDPWD'." \
"You need to create one first. Please, see \`$PROG_NAME --help\`."
if (( ${#available[@]} > 1 )) ; then
local options=()
local i=
for (( i=0 ; i < ${#available[@]} ; ++i )) ; do
options[$i]=$(basename $(docker inspect --format '{{.Name}}' ${available[$i]}))
options[$i]+=$(echo -e '\t')$(docker inspect --format '(cmd: {{join .Config.Cmd " "}}' ${available[$i]})
options[$i]+=$(docker inspect --format ' {{join .Args " "}})' ${available[$i]})
done
local o=
select o in "${options[@]}" ; do
if [[ -n $o ]] ; then
container=${available[$((REPLY - 1))]}
break
fi
done
[[ -n $container ]] ||
die 'No container selected to run'
else
container=${available[0]}
fi
fi
echo Starting $(basename $(docker inspect --format '{{.Name}}' $container))
docker start --attach --interactive $container
}
cmd_clean()
{
if [[ -n $1 ]] ; then
local devenv_type=$(docker inspect --format '{{index .Config.Labels "devenv.type"}}' "$1" 2>/dev/null)
[[ -n $devenv_type ]] ||
die "Container '$1' doesn't exist or isn't managed by \`$PROG_NAME\`."
echo "Removing $1"
docker rm --force "$1" >/dev/null
else # clean all
local containers=( $(docker ps --quiet --all --filter 'label=devenv.type') )
if (( ${#containers} > 0 )) ; then
docker-compose down
fi
for container in "${containers[@]}"; do
local container_name=$(docker inspect --format '{{.Name}}' $container)
if [[ -n $container_name ]] ; then
echo Removing $(basename $container_name)
docker rm --force $container >/dev/null
fi
done
fi
}
# parse CLI options
while [[ -n $1 ]] ; do
case $1 in
-v|--verbose) verbose=true ;;
-h|--help|help) _help stdout ;;
-*) die "Unknown option '$1', see \`$PROG_NAME --help\`." ;;
*) cmd=$1 ; shift ; break ;;
esac
shift
done
cd $BASE_DIR
# process commands
case $cmd in
help) _help stdout ;;
list) cmd_list "$1" ;;
ps) cmd_ps ;;
start) cmd_start "$1" ;;
clean) cmd_clean "$1" ;;
bash*|clojure*|elixir*|erlang*|gcc*|golang*|haskell*) ;& # fall through
julia*|node*|openjdk*|perl*|python*|ruby*|rust*)
container=$cmd
create "$container"
cmd_start "$container"
;;
run) docker-compose run --rm --volume $OLDPWD:/data --workdir /data \
-e USER=root "$@" ;;
init) [[ -n $1 ]] ||
die "Missing argument for 'init' command, see \`$PROG_NAME --help\`."
case $1 in
bash*|clojure*|elixir*|erlang*|gcc*|golang*|haskell*) ;& # fall through
julia*|node*|openjdk*|perl*|python*|ruby*|rust*) ;&
local/clang*)
docker create --env USER=root --name ${2:-$1} --tty \
--interactive --volume $OLDPWD:/data \
--workdir /data \
--label="devenv.type=$1" \
--label="devenv.datadir=$OLDPWD" \
"${@:3}" $1
;;
*) die "Unknown environment '$1', see \`$PROG_NAME list --all\`." ;;
esac
;;
*) die "Unknown command: '$cmd'" ;;
esac
| true
|
5c7d9f1f8fa54eb647ce8793840d5ce9493545a1
|
Shell
|
paes/GTK_REMD
|
/OLD/frompuc/noremd/as/ctremd/deprecated/candles_gdt.sh
|
UTF-8
| 14,358
| 2.9375
| 3
|
[] |
no_license
|
#!/bin/bash
#output="ps"
#output="png"
output="pdf"
if [ "$output" == "ps" ]
then
term="postscript enhanced color dashed font \"Times-Roman, 13\""
#term="postscript enhanced color dashed font \"Times-Roman, 14\""
#term="postscript enhanced color dashed "
#term="postscript enhanced color dashed font \"Times-Roman, 24\""
output_extension="ps"
elif [ "$output" == "pdf" ]
then
term="pdf enhanced color dashed font \"Times-Roman, 13\""
output_extension="pdf"
else
term="pngcairo color dashed font \"Times-Roman,13\""
#term="pngcairo color dashed font \"Times-Roman,14\""
#term="pngcairo color dashed font \"FreeSans,9\""
output_extension="png"
fi
gnuplot=/usr/bin/gnuplot
# Check for gnuplot, and warn if not available.
if [ ! -e $gnuplot ]; then
echo "Can't find gnuplot at $gnuplot."
echo "Gnuplot version 4.6.3 or later required."
exit 3
fi
symbol='$'
echo | $gnuplot <<EOF
#SOBRE O GRID
# Line style for axes
set style line 90 lt 1 lc 3
set style line 90 lt rgb "#808080"
# Line style for grid
set style line 81 lt 0 # dashed
set style line 81 lt rgb "#808080" # grey
set grid back linestyle 81
set border 3 linestyle 90
# Remove border on top and right. These
# borders are useless and make it harder
# to see plotted lines near the border.
# Also, put it in grey; no need for so much emphasis on a border.
set term ${term}
# set terminal png transparent nocrop enhanced size 450,320 font "arial,8"
set output "./bar3.${output_extension}"
set boxwidth 0.2 absolute
set title "box-and-whisker with median bar and whiskerbars"
set xtics ("269.50" 1, "285.22" 3, "301.66" 5, "318.76" 7, "336.61" 9, "355.26" 11, "374.74" 13, "395.07" 15, "416.32" 17, "438.50" 19, "461.67" 21, "485.87" 23, "511.14" 25, "537.54" 27)
set xrange [ -1.5 : 29.5 ] noreverse nowriteback
set yrange [ 0 :] noreverse nowriteback
set xtics font ", 6"
set ytics font ", 8"
set border 2 front linewidth 1.000
set boxwidth 0.5 absolute
set xtics norangelimit nomirror
set ytics border in scale 1,0.5 nomirror norotate autojustify
set style fill solid 0.45 border
set boxwidth 0.2 absolute
# Put X and Y labels
set xlabel "Temperature (K)"
set ylabel "GDT/100 "
#legenda
set key horizontal center bottom inside maxrows 1
# Give the plot a title
set title "Quartile RMSD v.s Temperature "
set style line 1 lt 1 lc rgb "#4169E1" lw 2 pt 13 ps 0.5
set style line 1 lt 1 lc rgb "blue" lw 2 pt 13 ps 0.5
set style line 2 lt 1 lc rgb "red" lw 2 pt 13 ps 0.5
set style line 3 lt 1 lc rgb "#FF69B4" lw 2 pt 13 ps 0.5
set style line 4 lt 1 lc rgb "#00FF00" lw 2 pt 13 ps 0.5
plot "< awk 'NR==1' data-q.dat" using (1-0.45):3:2:6:5 with candlesticks ls 1 title "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==1' data-q.dat" using (1-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==1' data-q.dat" using (1-0.15):9:8:12:11 with candlesticks ls 2 title "REMD" whiskerbars 0.5 , \
"< awk 'NR==1' data-q.dat" using (1-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==1' data-q.dat" using (1+0.15):15:14:18:17 with candlesticks ls 3 title "CMD" whiskerbars 0.5 , \
"< awk 'NR==1' data-q.dat" using (1+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==1' data-q.dat" using (1+0.45):21:20:24:23 with candlesticks ls 4 title "MD" whiskerbars 0.5 , \
"< awk 'NR==1' data-q.dat" using (1+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==2' data-q.dat" using (3-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==2' data-q.dat" using (3-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==2' data-q.dat" using (3-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==2' data-q.dat" using (3-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==2' data-q.dat" using (3+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==2' data-q.dat" using (3+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==2' data-q.dat" using (3+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==2' data-q.dat" using (3+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==3' data-q.dat" using (5-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5, \
"< awk 'NR==3' data-q.dat" using (5-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==3' data-q.dat" using (5-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==3' data-q.dat" using (5-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==3' data-q.dat" using (5+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==3' data-q.dat" using (5+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==3' data-q.dat" using (5+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==3' data-q.dat" using (5+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==4' data-q.dat" using (7-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==4' data-q.dat" using (7-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==4' data-q.dat" using (7-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==4' data-q.dat" using (7-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==4' data-q.dat" using (7+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==4' data-q.dat" using (7+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==4' data-q.dat" using (7+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==4' data-q.dat" using (7+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==5' data-q.dat" using (9-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==5' data-q.dat" using (9-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==5' data-q.dat" using (9-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==5' data-q.dat" using (9-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==5' data-q.dat" using (9+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==5' data-q.dat" using (9+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==5' data-q.dat" using (9+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==5' data-q.dat" using (9+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==6' data-q.dat" using (11-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==6' data-q.dat" using (11-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==6' data-q.dat" using (11-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==6' data-q.dat" using (11-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==6' data-q.dat" using (11+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==6' data-q.dat" using (11+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==6' data-q.dat" using (11+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==6' data-q.dat" using (11+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==7' data-q.dat" using (13-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==7' data-q.dat" using (13-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==7' data-q.dat" using (13-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==7' data-q.dat" using (13-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==7' data-q.dat" using (13+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==7' data-q.dat" using (13+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==7' data-q.dat" using (13+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==7' data-q.dat" using (13+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==8' data-q.dat" using (15-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==8' data-q.dat" using (15-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==8' data-q.dat" using (15-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==8' data-q.dat" using (15-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==8' data-q.dat" using (15+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==8' data-q.dat" using (15+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==8' data-q.dat" using (15+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==8' data-q.dat" using (15+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==9' data-q.dat" using (17-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==9' data-q.dat" using (17-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==9' data-q.dat" using (17-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==9' data-q.dat" using (17-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==9' data-q.dat" using (17+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==9' data-q.dat" using (17+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==9' data-q.dat" using (17+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==9' data-q.dat" using (17+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==10' data-q.dat" using (19-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==10' data-q.dat" using (19-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==10' data-q.dat" using (19-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==10' data-q.dat" using (19-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==10' data-q.dat" using (19+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==10' data-q.dat" using (19+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==10' data-q.dat" using (19+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==10' data-q.dat" using (19+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==11' data-q.dat" using (21-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==11' data-q.dat" using (21-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==11' data-q.dat" using (21-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==11' data-q.dat" using (21-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==11' data-q.dat" using (21+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==11' data-q.dat" using (21+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==11' data-q.dat" using (21+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==11' data-q.dat" using (21+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==12' data-q.dat" using (23-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==12' data-q.dat" using (23-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==12' data-q.dat" using (23-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==12' data-q.dat" using (23-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==12' data-q.dat" using (23+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==12' data-q.dat" using (23+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==12' data-q.dat" using (23+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==12' data-q.dat" using (23+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==13' data-q.dat" using (25-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==13' data-q.dat" using (25-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==13' data-q.dat" using (25-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==13' data-q.dat" using (25-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==13' data-q.dat" using (25+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==13' data-q.dat" using (25+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==13' data-q.dat" using (25+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==13' data-q.dat" using (25+0.45):22:22:22:22 with candlesticks ls 4 notitle, \
"< awk 'NR==14' data-q.dat" using (27-0.45):3:2:6:5 with candlesticks ls 1 notitle "CTREMD" whiskerbars 0.5 , \
"< awk 'NR==14' data-q.dat" using (27-0.45):4:4:4:4 with candlesticks ls 1 notitle, \
"< awk 'NR==14' data-q.dat" using (27-0.15):9:8:12:11 with candlesticks ls 2 notitle "REMD" whiskerbars 0.5 , \
"< awk 'NR==14' data-q.dat" using (27-0.15):10:10:10:10 with candlesticks ls 2 notitle, \
"< awk 'NR==14' data-q.dat" using (27+0.15):15:14:18:17 with candlesticks ls 3 notitle "CMD" whiskerbars 0.5 , \
"< awk 'NR==14' data-q.dat" using (27+0.15):16:16:16:16 with candlesticks ls 3 notitle, \
"< awk 'NR==14' data-q.dat" using (27+0.45):21:20:24:23 with candlesticks ls 4 notitle "MD" whiskerbars 0.5 , \
"< awk 'NR==14' data-q.dat" using (27+0.45):22:22:22:22 with candlesticks ls 4 notitle
EOF
| true
|
a1f9139a2953908abdfc66c3473001aed9fcad1f
|
Shell
|
sfu-natlang/pe-compositionality
|
/glove/run.sh
|
UTF-8
| 1,366
| 3.265625
| 3
|
[] |
no_license
|
#!/bin/bash
mkdir -p output
git clone https://github.com/stanfordnlp/glove
cd glove && make
for SETTING in {,no}variants.prune_{more,less}; do
for VECTOR_SIZE in {16,32,64,128,256}; do
CORPUS=../../data/$SETTING.txt
VOCAB_FILE=vocab.txt
COOCCURRENCE_FILE=cooccurrence.bin
COOCCURRENCE_SHUF_FILE=cooccurrence.shuf.bin
BUILDDIR=build
SAVE_FILE=../output/glove.$SETTING.$VECTOR_SIZE
VERBOSE=0
MEMORY=4.0
VOCAB_MIN_COUNT=0
# There is no test set so we don't care about
# overfitting: just want to get representations
# which are good for this data in particular:
MAX_ITER=3000
WINDOW_SIZE=15
BINARY=2
NUM_THREADS=8
X_MAX=10
if hash python 2>/dev/null; then
PYTHON=python
else
PYTHON=python3
fi
$BUILDDIR/vocab_count -min-count $VOCAB_MIN_COUNT -verbose $VERBOSE < $CORPUS > $VOCAB_FILE
$BUILDDIR/cooccur -memory $MEMORY -vocab-file $VOCAB_FILE -verbose $VERBOSE -window-size $WINDOW_SIZE < $CORPUS > $COOCCURRENCE_FILE
$BUILDDIR/shuffle -memory $MEMORY -verbose $VERBOSE < $COOCCURRENCE_FILE > $COOCCURRENCE_SHUF_FILE
$BUILDDIR/glove -save-file $SAVE_FILE -threads $NUM_THREADS -input-file $COOCCURRENCE_SHUF_FILE -x-max $X_MAX -iter $MAX_ITER -vector-size $VECTOR_SIZE -binary $BINARY -vocab-file $VOCAB_FILE -verbose $VERBOSE 2&> /dev/null
done
done
| true
|
90fda5116ef0e6e01057cdcb1b13a78a889f8549
|
Shell
|
radiantly/dotfiles
|
/.config/polybar/mic.sh
|
UTF-8
| 560
| 3.578125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/sh
status() {
echo " $(pamixer --default-source --get-volume-human)"
}
listen() {
status
LANG=EN; pactl subscribe | while read -r event; do
if echo "$event" | grep -q "source" || echo "$event" | grep -q "server"; then
status
fi
done
}
case "$1" in
--toggle)
pamixer --default-source --toggle-mute
;;
--increase)
pamixer --default-source --increase 5
;;
--decrease)
pamixer --default-source --decrease 5
;;
*)
listen
;;
esac
| true
|
df84baa5baa9418c3ae50448765394076d2795b6
|
Shell
|
mciul/dotfiles
|
/bashrc
|
UTF-8
| 2,567
| 3.09375
| 3
|
[] |
no_license
|
# detect what kind of system we're running on
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
platform='linux'
elif [[ "$unamestr" == 'FreeBSD' ]]; then
platform='freebsd'
fi
# environment stuff to find things that you might need
LESS=-rXF; export LESS
EDITOR=/usr/bin/vi; export EDITOR
VISUAL=/usr/bin/vi; export VISUAL
export MANPATH
export COLUMNS
export SP_BCTF=utf-8
PATH=$PATH:~/bin
# Simple aliases to save typing
alias dus='du -s'
alias env='printenv'
if [[ $platform == 'linux' ]]; then
alias ls='ls --color=auto'
elif [[ $platform == 'freebsd' ]]; then
alias ls='ls -G'
fi
alias lf='ls -hF'
alias lc='wc -l'
alias ll='/bin/ls -l' # directory with size
alias lla='/bin/ls -lA'
alias lll='/bin/ls -lL' # follow symlinks
alias llla='/bin/ls -lLA'
llth ()
{
ls -lt $1 | head
}
# shares history between tabs with prompt_command
# commented out because I'm not sure I like it anymore,
# and it's having problems on Mac
# SHELL_SESSION_HISTORY=0
# HISTSIZE=9000
# HISTFILESIZE=$HISTSIZE
# HISTCONTROL=ignorespace:ignoredups
# _bash_history_sync() {
# builtin history -a #1 appends command to histfile
# HISTFILESIZE=$HISTSIZE #2 sets max size
# builtin history -c #3 clears current session history
# builtin history -r #4 reads the updated histfile and makes that the current history
# }
# history() { #5 overrides build in history to sync it before display
# _bash_history_sync
# builtin history "$@"
# }
# PROMPT_COMMAND=_bash_history_sync
# Include date and time in prompt
export PS1='\D{%b%d %T} \[\e[1m\]\h:\W $\[\e[0m\] '
export PERLVERSION=`perl -le '($_=$])=~s/[.0]+/./g; print'`
# Set vi as the history editor
#
# To use it, type <ESC>k at the command prompt
set -o vi
# Set shell timeout to one week
export TMOUT=$((60*60*24*7))
# force tmux to use 256 colors
alias tmux='tmux -2'
# print out the header line and line $1 of file $2 and transpose columns
tabline ()
{
sed -n -e 1p -e $1p $2 | transpose-tsv
}
# call this with a class_def id to update lui dev db
luidevstart() {
dbsync -a rp -b rd -c "class_def $1"
dbsync -a rp -b rd -c 'copy a to b' -t projects
dbsync -a rp -b rd -c 'copy a to b' -t tasks
dbsync -a rp -b rd -c 'copy a to b' -t kit_types
dbsync -a rp -b rd -c 'copy a to b' -t node_classes
dbsync -a rp -b rd -c 'copy a to b' -t styles
dbsync -a rp -b rd -c 'copy a to b' -t workflows
}
[ -f ~/.aws_credentials ] && source ~/.aws_credentials
[ -e ~/.bashrc.local ] && source ~/.bashrc.local
| true
|
f7cd01182d604fd3cc79f7334d45f75c4180362f
|
Shell
|
ayroblu/terraform-aws-multi-account-blog
|
/env.sh
|
UTF-8
| 221
| 3.34375
| 3
|
[] |
no_license
|
#!/bin/bash
# https://stackoverflow.com/a/21188136
get_abs_dirname() {
# $1 : relative filename
echo "$(cd "$(dirname "$1")" && pwd)"
}
export AWS_CONFIG_FILE=$(get_abs_dirname "$0")/.aws.conf
echo $AWS_CONFIG_FILE
| true
|
6c22e487b95f13a4eee3578b5d83d98b1023331b
|
Shell
|
Anaconda-Platform/s2i-anaconda-project
|
/entrypoints/entrypoint.sh
|
UTF-8
| 234
| 2.546875
| 3
|
[] |
no_license
|
#!/bin/bash
if [ -e /opt/app-root/src/.assembled ]; then
if [[ $1 == "/usr/libexec/s2i/run" ]]; then
exec tini -g -- "$@"
else
exec tini -g -- anaconda-project run "$@"
fi
else
exec tini -g -- "$@"
fi
| true
|
8755fc0d44527fe11689fb3f253d55190ecd2010
|
Shell
|
dmg9626/ANIM211
|
/Thomas_Train_Jump/images/render_video.sh
|
UTF-8
| 778
| 3.53125
| 4
|
[] |
no_license
|
# mode 1:
# expects all frames to be in folders with naming convention: shot_*/
# mode 2:
# expects all frame to be in folder: batch_rendercam/
# default video name: output.mp4
# check args for video name
if [ -z $1 ]; then
video_name="output"
else
video_name=$1
fi
echo "creating video: $video_name"
# copy all frames to temp directory
echo "copying frames to temp directory..."
mkdir "temp_dir"
cp shot_*/* temp_dir
# move to temp directory and render video from frames
echo "number of frames:"ls -l | wc -l
echo "rendering video from frames..."
cd temp_dir
ffmpeg -framerate 24 -start_number 1 -i frame_%04d.png "../$video_name.mp4"
# erase temp directory and print sucecss
echo "deleting frame copies..."
cd ..
rm -rf temp_dir
echo "video saved as $video_name.mp4"
| true
|
ddea7417df5063951acf2030b900fabdf350c475
|
Shell
|
phrocker/sharkbite
|
/test/19x/st/src/main/bin/config-sample.sh
|
UTF-8
| 223
| 2.609375
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/sh
DIR="$( cd "$(dirname "$0")" && pwd )"
source $DIR/sample-env.sh
ACCUMULO_LIB_DIR=/smac-bin/lib
do_work() {
echo "Doing some work"
# how do you create a user or add auths?
}
echo Setting up sample
do_work
| true
|
1f2499dd60261974cd39f81a2f4f5ef9aa8fa334
|
Shell
|
pborenstein/track
|
/track
|
UTF-8
| 267
| 3.390625
| 3
|
[] |
no_license
|
#! /usr/bin/env bash
TRACKDIR=$HOME/.track
mkdir -p $TRACKDIR
FILENAME=$(date "+%Y-%m-%d").txt
TRACKFILE=$TRACKDIR/$FILENAME
touch ${TRACKFILE}
TIME=$(date "+%H:%M")
if $(grep -q $TIME $TRACKFILE) ; then
TIME=' '
fi
echo "${TIME} " ${*} >> $TRACKFILE
| true
|
4daa4702d5b34d61ecdd6dac72926a7d76e18368
|
Shell
|
ceremcem/chibios-configurator
|
/uidev.service
|
UTF-8
| 596
| 2.71875
| 3
|
[] |
no_license
|
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HEADLESS=false
. $DIR/scada.js/tools/service-runner/tmux-launch
sname=$(calc-session-name "$0")
cd $DIR
launch-service $sname
# Virtual Environment support
. $DIR/scada.js/venv
tmux setenv -t $sname 'VIRTUAL_ENV' $SCADAJS_VENV
# run commands in tmux session
run-in-tmux "cd scada.js" "make development"
run-in-tmux "cd servers" './run-ls webserver.ls --development'
run-in-tmux "cd servers" "./run-ls -w users.ls"
run-in-tmux "cd servers/stm" "./run-ls -w datasheet.ls"
run-in-tmux "cd servers/stm" "./run-ls -w template.ls"
| true
|
2caa29fe9a490bd0df7a9424cd3124426cae986a
|
Shell
|
pbahr/Custom-Scanners
|
/JDBC_Scanner/packaged/scanDenodo.sh
|
UTF-8
| 260
| 2.875
| 3
|
[] |
no_license
|
#!/bin/bash
if [ $# -eq 0 ]
then
echo
echo "denodoScanner.sh [propertyFile]"
exit 0
fi
propfile=$1
# call the model linker
java -cp "denodoCustomScanner.jar:lib/*" com.infa.edc.scanner.jdbc.DenodoScanner ${propfile} $2
#complete
echo 'Finished'
| true
|
1310f9e7403df412b535dcec881b73377f2a3930
|
Shell
|
containers/podman
|
/test/apiv2/22-stop.at
|
UTF-8
| 1,130
| 2.609375
| 3
|
[
"Apache-2.0"
] |
permissive
|
# -*- sh -*-
#
# test 'stop' endpoints
#
podman pull $IMAGE &>/dev/null
# stop, by name
podman run -dt --name mytop $IMAGE top &>/dev/null
t GET libpod/containers/mytop/json 200 .State.Status=running
t POST libpod/containers/mytop/stop 204
t GET libpod/containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\)
t DELETE libpod/containers/mytop 200
# stop, by ID
# Remember that podman() hides all output; we need to get our CID via inspect
podman run -dt --name mytop $IMAGE top
t GET libpod/containers/mytop/json 200 .State.Status=running
cid=$(jq -r .Id <<<"$output")
t POST libpod/containers/$cid/stop 204
t GET libpod/containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\)
t DELETE libpod/containers/mytop 200
# Remember that podman() hides all output; we need to get our CID via inspect
podman run -dt --name mytop $IMAGE top
t GET containers/mytop/json 200 .State.Status=running
cid=$(jq -r .Id <<<"$output")
t POST containers/$cid/stop?t=-1 204
t POST "containers/$cid/wait" 200
t GET containers/mytop/json 200 .State.Status~\\\(exited\\\|stopped\\\)
t DELETE containers/mytop 204
| true
|
a6c2bc6195a720e7c754549f63041579e592a804
|
Shell
|
StudioEtrange/docker-sickrage
|
/update.sh
|
UTF-8
| 9,965
| 3.453125
| 3
|
[] |
no_license
|
#!/bin/bash
set -e
_CURRENT_FILE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$_CURRENT_FILE_DIR"
# PARAMETERS ----------------------------
GITHUB_REPO="SiCKRAGETV/SickRage"
# remove this string to version name (ex : with 'build' value, 'build507' becomes '507')
FILTER_VERSION_NAME="v"
VERSION_SEPARATOR="."
# revert version ordering for letter behind number (ex: with 'ON' value, 1.2 is newer than 1.2rc1)
VERSION_INVERSE_LAST_CHAR=OFF
# Use github tags instead of github releases
USE_TAG_AS_RELEASE=0
# INITIALIZE ----------------------------
version_order_option=
if [ "$VERSION_INVERSE_LAST_CHAR" == "ON" ]; then
version_order_option="ENDING_CHAR_REVERSE"
[ ! "$VERSION_SEPARATOR" == "" ] && version_order_option="$version_order_option SEP $VERSION_SEPARATOR"
fi
# SPECIFIC FUNCTIONS ----------------------------
function update_dockerfile() {
local path=$1
local version=$2
sed -i.bak -e "s,ENV ITEM_VERSION.*,ENV ITEM_VERSION $version," "$path"
rm -f "$path".bak
}
function update_readme() {
local path=$1
local version=$2
local list="$3"
sed -i.bak -e "s/latest,.*/latest, $list/" "$path"
sed -i.bak -e "s/^Current latest tag is version __.*__/Current latest tag is version __"$version"__/" "$path"
rm -f "$path".bak
}
# GENERIC FUNCTIONS ----------------------------
# sort a list of version
#sorted=$(sort_version "build507 build510 build403 build4000 build" "ASC")
#echo $sorted
# ===> build build403 build507 build510 build4000
#sorted=$(sort_version "1.1.0 1.1.1 1.1.1a 1.1.1b" "ASC SEP .")
#echo $sorted
# ===> 1.1.0 1.1.1 1.1.1a 1.1.1b
#sorted=$(sort_version "1.1.0 1.1.1 1.1.1a 1.1.1b" "DESC SEP .")
#echo $sorted
# ===> 1.1.1b 1.1.1a 1.1.1 1.1.0
#sorted=$(sort_version "1.1.0 1.1.1 1.1.1alpha 1.1.1beta1 1.1.1beta2" "ASC ENDING_CHAR_REVERSE SEP .")
#echo $sorted
# ===> 1.1.0 1.1.1alpha 1.1.1beta1 1.1.1beta2 1.1.1
#sorted=$(sort_version "1.1.0 1.1.1 1.1.1alpha 1.1.1beta1 1.1.1beta2" "DESC ENDING_CHAR_REVERSE SEP .")
#echo $sorted
# ===> 1.1.1 1.1.1beta2 1.1.1beta1 1.1.1alpha 1.1.0
#sorted=$(sort_version "1.9.0 1.10.0 1.10.1.1 1.10.1 1.10.1alpha1 1.10.1beta1 1.10.1beta2 1.10.2 1.10.2.1 1.10.2.2 1.10.0RC1 1.10.0RC2" "DESC ENDING_CHAR_REVERSE SEP .")
#echo $sorted
# ===> 1.10.2.2 1.10.2.1 1.10.2 1.10.1.1 1.10.1 1.10.1beta2 1.10.1beta1 1.10.1alpha1 1.10.0 1.10.0RC2 1.10.0RC1 1.9.0
# NOTE : ending characters in a version number may be ordered in the opposite way example :
# 1.0.1 is more recent than 1.0.1beta so in ASC : 1.0.1beta 1.0.1 and in DESC : 1.0.1 1.0.1beta
# To activate this behaviour use "ENDING_CHAR_REVERSE" option
# we also need to indicate separator only if we use ENDING_CHAR_REVERSE and if there is any separator (obviously)
function sort_version() {
local list=$1
local opt="$2"
local opposite_order_for_ending_chars=OFF
local mode="ASC"
local separator=
local flag_sep=OFF
for o in $opt; do
[ "$o" == "ASC" ] && mode=$o
[ "$o" == "DESC" ] && mode=$o
[ "$o" == "ENDING_CHAR_REVERSE" ] && opposite_order_for_ending_chars=ON
# we need separator only if we use ENDING_CHAR_REVERSE and if there is any separator (obviously)
[ "$flag_sep" == "ON" ] && separator="$o" && flag_sep=OFF
[ "$o" == "SEP" ] && flag_sep=ON
done
local internal_separator=}
local new_list=
local match_list=
local max_number_of_block=0
local number_of_block=0
for r in $list; do
# separate each block of number and block of letter
[ ! "$separator" == "" ] && new_item="$(echo $r | sed "s,\([0-9]*\)\([^0-9]*\)\([0-9]*\),\1$internal_separator\2$internal_separator\3,g" | sed "s,^\([0-9]\),$internal_separator\1," | sed "s,\([0-9]\)$,\1$internal_separator$separator$internal_separator,")"
[ "$separator" == "" ] && new_item="$(echo $r | sed "s,\([0-9]*\)\([^0-9]*\)\([0-9]*\),\1$internal_separator\2$internal_separator\3,g" | sed "s,^\([0-9]\),$internal_separator\1," | sed "s,\([0-9]\)$,\1$internal_separator,")"
if [ "$opposite_order_for_ending_chars" == "OFF" ]; then
[ "$mode" == "ASC" ] && substitute=A
[ "$mode" == "DESC" ] && substitute=A
else
[ "$mode" == "ASC" ] && substitute=z
[ "$mode" == "DESC" ] && substitute=z
fi
[ ! "$separator" == "" ] && new_item="$(echo $new_item | sed "s,\\$separator,$substitute,g")"
new_list="$new_list $new_item"
match_list="$new_item $r $match_list"
number_of_block="${new_item//[^$internal_separator]}"
[ "${#number_of_block}" -gt "$max_number_of_block" ] && max_number_of_block="${#number_of_block}"
done
max_number_of_block=$[max_number_of_block +1]
# we detect block made with non-number characters for reverse order of block with non-number characters (except the first one)
local count=0
local b
local i
local char_block_list=
for i in $new_list; do
count=1
for b in $(echo $i | tr "$internal_separator" "\n"); do
count=$[$count +1]
if [ ! "$(echo $b | sed "s,[0-9]*,,g")" == "" ]; then
char_block_list="$char_block_list $count"
fi
done
done
# make argument for sort function
# note : for non-number characters : first non-number character is sorted as wanted (ASC or DESC) and others non-number characters are sorted in the opposite way
# example : 1.0.1 is more recent than 1.0.1beta so in ASC : 1.0.1beta 1.0.1 and in DESC : 1.0.1 1.0.1beta
# example : build400 is more recent than build300 so in ASC : build300 build400 and in DESC : build400 build300
count=0
local sorted_arg=
local reverse
local opposite_reverse
local j
while [ "$count" -lt "$max_number_of_block" ]; do
count=$[$count +1]
block_arg=
block_is_char=
for j in $char_block_list; do
[ "$count" == "$j" ] && block_is_char=1
done
if [ "$block_is_char" == "" ]; then
block_arg=n$block_arg
[ "$mode" == "ASC" ] && block_arg=$block_arg
[ "$mode" == "DESC" ] && block_arg=r$block_arg
else
[ "$mode" == "ASC" ] && block_arg=$block_arg
[ "$mode" == "DESC" ] && block_arg=r$block_arg
fi
sorted_arg="$sorted_arg -k $count,$count"$block_arg
done
[ "$mode" == "ASC" ] && sorted_arg="-t$internal_separator $sorted_arg"
[ "$mode" == "DESC" ] && sorted_arg="-t$internal_separator $sorted_arg"
sorted_list="$(echo "$new_list" | tr ' ' '\n' | sort $(echo "$sorted_arg") | tr '\n' ' ')"
# restore original version strings (alternative to hashtable...)
local result_list=
local flag_found=OFF
local flag=KEY
for r in $sorted_list; do
flag_found=OFF
flag=KEY
for m in $match_list; do
if [ "$flag_found" == "ON" ]; then
result_list="$result_list $m"
break
fi
if [ "$flag" == "KEY" ]; then
[[ $m == $r ]] && flag_found=ON
fi
done
done
echo "$result_list" | sed -e 's/^ *//' -e 's/ *$//'
}
# github releases have a 'name' which is a version name and a 'tag_name' wich is often a version number
# so we use 'tag_name' attribute
function github_releases() {
local max=$1
local result=""
local last_page=$(curl -i -sL "https://api.github.com/repos/$GITHUB_REPO/releases" | grep rel=\"last\" | cut -d "," -f 2 | cut -d "=" -f 2 | cut -d ">" -f 1)
for i in $(seq 1 $last_page); do
result="$result $(curl -sL https://api.github.com/repos/$GITHUB_REPO/releases?page=$i | grep tag_name | cut -d '"' -f 4)"
done
local sorted
[ "$max" == "" ] && sorted=$(echo "$(sort_version "$result" "DESC $version_order_option")" | sed -e 's/^ *//' -e 's/ *$//')
[ ! "$max" == "" ] && sorted=$(echo "$(sort_version "$result" "DESC $version_order_option")" | tr ' ' '\n' | head -n $max | tr '\n' ' ' | sed -e 's/^ *//' -e 's/ *$//' )
echo "$sorted"
}
# github tags have only a 'name' which is often a version number
# so we use 'name' attribute
function github_tags() {
local max=$1
local result=""
local last_page=$(curl -i -sL "https://api.github.com/repos/$GITHUB_REPO/tags" | grep rel=\"last\" | cut -d "," -f 2 | cut -d "=" -f 2 | cut -d ">" -f 1)
for i in $(seq 1 $last_page); do
result="$result $(curl -sL https://api.github.com/repos/$GITHUB_REPO/tags?page=$i | grep name | cut -d '"' -f 4)"
done
local sorted
[ "$max" == "" ] && sorted=$(echo "$(sort_version "$result" "DESC $version_order_option")" | sed -e 's/^ *//' -e 's/ *$//')
[ ! "$max" == "" ] && sorted=$(echo "$(sort_version "$result" "DESC $version_order_option")" | tr ' ' '\n' | head -n $max | tr '\n' ' ' | sed -e 's/^ *//' -e 's/ *$//' )
echo "$sorted"
}
# MAIN ----------------------------
# sed regexp can not be empty, so a foo string is used
[ "$FILTER_VERSION_NAME" == "" ] && FILTER_VERSION_NAME="XXXXXXXXXXXX"
echo
echo "******** UPDATE LAST ********"
# Update last release
[ "$USE_TAG_AS_RELEASE" == "1" ] && last_release=$(github_tags 1)
[ ! "$USE_TAG_AS_RELEASE" == "1" ] && last_release=$(github_releases 1)
version_full_number="$last_release"
version_number=$(echo $version_full_number | sed -e "s,$FILTER_VERSION_NAME,,g")
echo " ** version number : $version_number"
update_dockerfile "Dockerfile" "$version_full_number"
echo
echo "******** UPDATE ALL ********"
# Update all releasese
rm -Rf "ver"
[ "$USE_TAG_AS_RELEASE" == "1" ] && releases=$(github_tags)
[ ! "$USE_TAG_AS_RELEASE" == "1" ] && releases=$(github_releases)
for rel in $releases; do
version_full_number="$rel"
version_number=$(echo $version_full_number | sed -e "s,$FILTER_VERSION_NAME,,g")
echo " * Process last release $version_full_number"
echo " ** version number : $version_number"
mkdir -p "ver/$version_number"
cp -f supervisord* "ver/$version_number"
cp -f Dockerfile "ver/$version_number/Dockerfile"
update_dockerfile "ver/$version_number/Dockerfile" "$version_full_number"
echo
done
echo "******** UPDATE README ********"
list_release=$(echo $releases | sed -e "s,$FILTER_VERSION_NAME,,g" | sed -e 's/ /\, /g')
last_release_tag=$(echo $last_release | sed -e "s,$FILTER_VERSION_NAME,,g")
update_readme "README.md" "$last_release_tag" "$list_release"
echo
echo "************************************"
echo " YOU SHOULD NOW ADD MISSING VERSION THROUGH"
echo " Docker Hub WebUI : AUTOMATED BUILD REPOSITORY"
| true
|
c613fe4c0d02d136f9195c194e4932ba5234855d
|
Shell
|
Rochii/local-search-sat
|
/race/to.run.sh
|
UTF-8
| 248
| 2.828125
| 3
|
[] |
no_license
|
BENCHMARKS="bench"
CONTESTANTS=solvers/*.py
for bench in $BENCHMARKS
do
echo "###" $bench "###"
for file in $CONTESTANTS
do
echo "###"
echo $file
./race-complete.py instances/$bench/ $file
echo "###"
done
done
| true
|
97d3d2366d320dddd2be6f02e5f661c406f98a14
|
Shell
|
restinpeacecc/brew-link-error-fixer
|
/BLEF.sh
|
UTF-8
| 685
| 3.5
| 4
|
[] |
no_license
|
#!/bin/bash
#Create by R.I.P_C on 2018/05/27
echo "Brew link error fixer v1.3.1"
echo "by R.I.P_C"
echo -e "\033[32m---------------------------------------\033[0m"
echo -e "\033[31m$LOGNAME\033[0m at"
date
echo -e "\033[32m---------------------------------------\033[0m"
read -p "Input DIR PATH: " dir
if [ -d $dir ];then
echo -e "\033[32mDIR Found!\033[0m"
else
echo -e "\033[31mDIR Not Found!\033[0m"
exit
fi
if [ ! -w $dir ];then
echo -e "\033[32m$LOGNAME does not have writing permission in $dir . input sudo password to proceed.\033[0m"
sudo chown -R $LOGNAME:admin $dir
else
echo -e "\033[31m$LOGNAME does have writing permission in $dir .\033[0m"
fi
| true
|
13e3b1096bf0d3dfce93d25d8e3e440cb3e8e861
|
Shell
|
ryanwoodsmall/kernel-rpm
|
/scripts/buildkernel.sh
|
UTF-8
| 219
| 2.765625
| 3
|
[] |
no_license
|
#!/bin/bash
if [ -e /tmp/kernelbuild.out ] ; then
tail -5 /tmp/kernelbuild.out
rm -f /tmp/kernelbuild.out
fi
date
( time ( rpmbuild -ba --clean ${HOME}/rpmbuild/SPECS/kernel.spec ) ) >/tmp/kernelbuild.out 2>&1
date
| true
|
4ec5d1cd1a0e08af861fe41a46a98704ae5ba421
|
Shell
|
zerodayz/scriptz
|
/kubernetes/nfs-server-prepare.sh
|
UTF-8
| 255
| 2.578125
| 3
|
[] |
no_license
|
#!/bin/bash
yum -y install nfs-utils
# prepare disk
# fdisk /dev/sdb
# mkfs.ext4 /dev/sdb1
mkdir /mnt/disks
mount /dev/sdb1 /mnt/disks
cd /mnt/disks
for i in `seq 1 10`; do mkdir vol$i; done
echo "/mnt/disks *(insecure,rw)" >> /etc/exports
exportfs -arv
| true
|
0e4ea47477ae8a0d84acca816f99cc66bd9257ec
|
Shell
|
openownership/data-standard-sphinx-theme
|
/vagrant/bootstrap.sh
|
UTF-8
| 700
| 2.59375
| 3
|
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
set -e
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip python3-venv apache2 build-essential ruby-dev
mkdir -p /out
chown -R vagrant:users /out
pip3 install lxml html5lib gevent cchardet
pip3 install pylinkvalidator
cp /vagrant/vagrant/apache.conf /etc/apache2/sites-enabled/000-default.conf
/etc/init.d/apache2 restart
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
apt-get install -y nodejs
npm install -g grunt-cli
gem install sass
echo "alias build='/vagrant/vagrant/build.sh'" >> /home/vagrant/.bashrc
cd /vagrant/bootstrap_build && su vagrant -c "npm install"
cd /vagrant/data-standard && git submodule update --init
| true
|
4f4003e0f0a0bafbd0306d625d84b7a3df386ae0
|
Shell
|
CesarLiu/apollo
|
/docker/build/installers/install_migraphx.sh
|
UTF-8
| 1,805
| 3.515625
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
###############################################################################
# Copyright 2020 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
set -e
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
. ${CURR_DIR}/installer_base.sh
TARGET_ARCH="$(uname -m)"
if [[ "${TARGET_ARCH}" == "x86_64" ]]; then
PKG_NAME="migraphx.tar.gz"
FILE_ID="1PiZP1YDU1scSY3kRz2qBLq3H35gteaHB"
else # AArch64
error "AMD migraphx for ${TARGET_ARCH} not ready. Exiting..."
exit 1
fi
DOWNLOAD_LINK="https://docs.google.com/uc?export=download&id=${FILE_ID}"
wget --load-cookies /tmp/cookies.txt \
"https://docs.google.com/uc?export=download&confirm=
$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies \
--no-check-certificate ${DOWNLOAD_LINK} \
-O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${FILE_ID}" \
-O "${PKG_NAME}" && rm -rf /tmp/cookies.txt
tar xzf "${PKG_NAME}"
mv "${PKG_NAME%.tar.gz}" /opt/rocm/migraphx
cp -rLfs "/opt/rocm/migraphx/include/." "/opt/rocm/include/"
cp -rLfs "/opt/rocm/migraphx/lib/." "/opt/rocm/lib/"
# Cleanup
rm -f "${PKG_NAME}"
ok "Successfully installed migraphx"
| true
|
992d5dbf341f20776d7e8c9cb64af1c04df34daa
|
Shell
|
intel/retail-node-installer
|
/scripts/pxemenuutils.sh
|
UTF-8
| 2,115
| 3.953125
| 4
|
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
# Copyright (C) 2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
# This file is intended to contain functions that assist with the management
# of the PXE boot menu.
# If running this file alone, uncomment these lines:
# source "fileutils.sh"
# source "textutils.sh"
genPxeMenuHead() {
makeDirectory "${TFTP_ROOT}/pxelinux.cfg"
cp "./template/pxelinux.cfg/default.head" "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
}
genPxeMenuTail() {
if [ -f "${TFTP_ROOT}/pxelinux.cfg/tmp_default" ]; then
cat "./template/pxelinux.cfg/default.tail" >> "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
else
cp "./template/pxelinux.cfg/default.head" "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
cat "./template/pxelinux.cfg/default.tail" >> "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
fi
}
cleanupTmpPxeMenu() {
if [ -f "${TFTP_ROOT}/pxelinux.cfg/tmp_default" ]; then
rm "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
fi
if [ -f "${TFTP_ROOT}/pxelinux.cfg/tmp_default.modified" ]; then
rm "${TFTP_ROOT}/pxelinux.cfg/tmp_default.modified"
fi
}
updatePxeMenu() {
if [ -f "${TFTP_ROOT}/pxelinux.cfg/tmp_default" ]; then
cp "${TFTP_ROOT}/pxelinux.cfg/tmp_default" "${TFTP_ROOT}/pxelinux.cfg/default"
makeDirectory "${TFTP_ROOT}/efi64/pxelinux.cfg"
cp "${TFTP_ROOT}/pxelinux.cfg/tmp_default" "${TFTP_ROOT}/efi64/pxelinux.cfg/default"
fi
cleanupTmpPxeMenu
}
# The usage for this is a little strange.
# If you are using this with spaces,
# you need to make sure you wrap the input
# with escaped quotes: \" \"
#
# for example:
# addLineToPxeMenu "\"Do this thing\""
addLineToPxeMenu() {
local line=$1
# The input value of line will contain quotes, so trim them now
local trimmed_line=$(docker run --rm -t alpine:3.9 echo "${line}" | awk -F\" '{ print $2 }')
# Write to file
echo "${trimmed_line}" >> "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
}
# Helper function to return the location of the staging file for the PXE menu
getTmpPxeMenuLocation() {
echo "${TFTP_ROOT}/pxelinux.cfg/tmp_default"
}
| true
|
6991aeb5025b9908974f22f2432434fbeb0188e0
|
Shell
|
wangyi0559/chainEvalScript
|
/fabricExample124/fabric_start.sh
|
UTF-8
| 3,352
| 2.625
| 3
|
[] |
no_license
|
#!/bin/sh
# author:wang yi
PEER_INDEX=$1
IP_ORDERER=$2
IP_CA1=$3
IP_CA2=$4
IP_P0O1=$5
IP_P1O1=$6
IP_P0O2=$7
IP_P1O2=$8
echo $PEER_INDEX > /chain/PEER_INDEX
echo $IP_ORDERER > /chain/IP_ORDERER
echo $IP_CA1 > /chain/IP_CA1
echo $IP_CA2 > /chain/IP_CA2
echo $IP_P0O1 > /chain/IP_P0O1
echo $IP_P1O1 > /chain/IP_P1O1
echo $IP_P0O2 > /chain/IP_P0O2
echo $IP_P1O2 > /chain/IP_P1O2
function chooseScript(){
case $PEER_INDEX in
1) {
sleep 1s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_orderer_start.sh >/dev/null 2>&1
}
;;
2) {
sleep 3s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_ca1_start.sh >/dev/null 2>&1
}
;;
3) {
sleep 5s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_ca2_start.sh >/dev/null 2>&1
}
;;
4) {
sleep 2s
sed -i "s/THISUSER/Test1/g" /chain/config.json
sed -i "s/THISORG/org1/g" /chain/config.json
sed -i "s/PEERSIP1/$IP_P0O1/g" /chain/config.json
sed -i "s/PEERSIP2/$IP_P1O1/g" /chain/config.json
sed -i "s/THISPEER/peer1/g" /chain/config.json
sleep 3s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_p0o1_start.sh >/dev/null 2>&1
}
;;
5) {
sleep 3s
sed -i "s/THISUSER/Test2/g" /chain/config.json
sed -i "s/THISORG/org1/g" /chain/config.json
sed -i "s/PEERSIP1/$IP_P0O1/g" /chain/config.json
sed -i "s/PEERSIP2/$IP_P1O1/g" /chain/config.json
sed -i "s/THISPEER/peer2/g" /chain/config.json
sleep 3s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_p1o1_start.sh >/dev/null 2>&1
}
;;
6) {
sleep 4s
sed -i "s/THISUSER/Test1/g" /chain/config.json
sed -i "s/THISORG/org2/g" /chain/config.json
sed -i "s/PEERSIP1/$IP_P0O2/g" /chain/config.json
sed -i "s/PEERSIP2/$IP_P1O2/g" /chain/config.json
sed -i "s/THISPEER/peer1/g" /chain/config.json
sleep 3s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_p0o2_start.sh >/dev/null 2>&1
}
;;
7) {
sleep 5s
sed -i "s/THISUSER/Test2/g" /chain/config.json
sed -i "s/THISORG/org2/g" /chain/config.json
sed -i "s/PEERSIP1/$IP_P0O2/g" /chain/config.json
sed -i "s/PEERSIP2/$IP_P1O2/g" /chain/config.json
sed -i "s/THISPEER/peer2/g" /chain/config.json
sleep 3s
/bin/bash /chain/chainEvalScript/fabricExample124/start/fabric_p1o2_start.sh >/dev/null 2>&1
}
;;
*) echo 'error'
;;
esac
}
function configConfigJson(){
sed -i "s/IP_ORDERER/$IP_ORDERER/g" /chain/config.json
sed -i "s/IP_CA1/$IP_CA1/g" /chain/config.json
sed -i "s/IP_CA2/$IP_CA2/g" /chain/config.json
sed -i "s/IP_P0O1/$IP_P0O1/g" /chain/config.json
sed -i "s/IP_P1O1/$IP_P1O1/g" /chain/config.json
sed -i "s/IP_P0O2/$IP_P0O2/g" /chain/config.json
sed -i "s/IP_P1O2/$IP_P1O2/g" /chain/config.json
}
sleep 2s
configConfigJson
sleep 2s
chooseScript
echo "success"
| true
|
a9c0c391a1effaccd2ffefca6b6f6c2a9cbfdd03
|
Shell
|
sujitbidawe/elseIf
|
/nameOfDigit.sh
|
UTF-8
| 638
| 3.40625
| 3
|
[] |
no_license
|
#! /bin/bash
read -p "enter a power of 10: " number
if [[ $number -eq 1 ]]
then
echo unit
elif [[ $number -eq 10 ]]
then
echo ten
elif [[ $number -eq 100 ]]
then
echo hundred
elif [[ $number -eq 1000 ]]
then
echo thousand
elif [[ $number -eq 10000 ]]
then
echo ten thousand
elif [[ $number -eq 100000 ]]
then
echo hundred thousand
elif [[ $number -eq 1000000 ]]
then
echo million
elif [[ $number -eq 10000000 ]]
then
echo ten million
elif [[ $number -eq 100000000 ]]
then
echo hundred million
elif [[ $number -eq 1000000000 ]]
then
echo billion
else
echo enter input as specified and less than equal to billion
fi
| true
|
0152d4d8d0e66dd3cc30d802c87c477ac45dc040
|
Shell
|
Alexandre-Silva/ADM
|
/matchers/arrays.sh
|
UTF-8
| 357
| 3.4375
| 3
|
[
"MIT"
] |
permissive
|
arrayeq() {
# if the number of args is impar, then the two arras can't possibly have the
# same number of elements
assert equal 0 $(( $# % 2 ))
local ai=0
local bi=$(($# / 2 ))
local args=( "$@" )
while (( bi < $# )); do
assert equal "${args[$ai]}" "${args[$bi]}"
(( ai += 1 ))
(( bi += 1 ))
done
}
| true
|
0429b5cb80ec6b5de00302f6646412b26c9694c7
|
Shell
|
ArnoMLT/Monitoring
|
/Centreon/local/usr/lib/nagios/itbs/new_host/new_host_ack.sh
|
UTF-8
| 4,460
| 3.546875
| 4
|
[] |
no_license
|
#!/bin/sh
# MLT
# 08/05/2018
# Lance les actions de nettoyage suite a la reception du ack
# Pour le nouveau host cree automatiquement dans Centreon
# $1 HOST_ID
# Chargement de la config globale
source "/usr/lib/nagios/plugins/itbs/etc/config.cfg"
now=`date +%s`
logfile="/tmp/${now}_ack.log"
# chemins sur le FTP
# ftp_temp_config_dir='nsclient/config-temp'
relative_temp_config_dir='config-temp'
## ##
# MAIN #
## ##
if [ $# -lt 1 ] ; then
echo "Usage : $0 <HOST_ID> " >&2 >> $logfile
echo " HOST_ID : Id Centreon du host qui emet le ack" >&2 >> $logfile
exit 1
fi
re='^[1-9][0-9]*$'
if ! [[ $1 =~ $re ]] ; then
echo "Erreur : Le HOST_ID doit etre un nombre entier et ne commence pas par 0. Exit" >&2 >> $logfile
exit 1
fi
host_id=$1
echo $host_id >> $logfile
###
# Supprime les fichiers inutiles sur le FTP
###
clapi_cmd='centreon -u $centreon_admin_user -p $centreon_admin_password -o HOST -a SHOW | grep "^$host_id;"'
if [ $(eval $clapi_cmd \| wc -l) -gt 1 ] ; then
echo "Erreur CLAPI : Le HOST_ID retourne trop de resultats. Exit" >&2 >> $logfile
exit 2
fi
centreon_host_info="$(eval $clapi_cmd)"
host_name=`echo $centreon_host_info | sed -n "s/^.*;\(.*\);.*;\(.*\);.*$/\1/p"`
host_ip_address=`echo $centreon_host_info | sed -n "s/^.*;\(.*\);.*;\(.*\);.*$/\2/p"`
echo $path_to_nsclient_config/$relative_temp_config_dir/$host_name-$host_ip_address.ini >> $logfile
rm -f $path_to_nsclient_config/$relative_temp_config_dir/$host_name-$host_ip_address.ini
# ftp $ftp_site_addr <<EOF
# cd "$ftp_temp_config_dir"
# delete $host_name-$host_ip_address.ini
# quit
# EOF
# echo "Sync avec FTP externe" >&2 >> $logfile
# $sync_ftp_cmd | tee -a $logfile
###
# Change le template pour le host
###
host_template="Modele_NSCA" # Host templates; for multiple definitions, use delimiter |
clapi_cmd='centreon -u $centreon_admin_user -p $centreon_admin_password -o HOST -a settemplate -v "$host_name;$host_template"'
error_message=$(eval $clapi_cmd)
if [ ! $? ] ; then
echo "Erreur CLAPI : impossible de definir le template" >&2
exit 3
fi
clapi_cmd='centreon -u $centreon_admin_user -p $centreon_admin_password -o SERVICE -a del -v "$host_name;new_host_ack"'
error_message=$(eval $clapi_cmd)
if [ ! $? ] ; then
echo "Erreur CLAPI : impossible de supprimer le service new_host_ack" >&2
exit 3
fi
clapi_cmd='centreon -u $centreon_admin_user -p $centreon_admin_password -o HOST -a applytpl -v "$host_name"'
error_message=$(eval $clapi_cmd)
if [ ! $? ] ; then
echo "Erreur CLAPI : impossible de creer les modeles de services pour le host" >&2
exit 3
fi
# Rechargement de la config Centreon
# Generation de la config centreon 'Central'
#
#
echo "Application de la config dans centreon..." >> $logfile
echo "Generer les fichiers de configuration" >> $logfile
error_message=$(sudo -u apache centreon -u $centreon_admin_user -p $centreon_admin_password -a POLLERGENERATE -v 1)
if [ $? -eq 1 ] ; then
# echo centreon -u $centreon_admin_user -p $centreon_admin_password -a POLLERGENERATE -v 1 | tee -a $logfile
echo $error_message | tee -a $logfile
echo "CLAPI : erreur generation => EXIT" | tee -a $logfile
# printf "[%lu] PROCESS_HOST_CHECK_RESULT;$2;1;$error_message" $now > $commandfile
exit 4
fi
echo "Lancer le debogage du moteur de supervision (-v)" >> $logfile
error_message=$(sudo -u apache centreon -u $centreon_admin_user -p $centreon_admin_password -a POLLERTEST -v 1)
if [ $? -eq 1 ] ; then
echo $error_message | tee -a $logfile
echo "CLAPI : erreur test config => EXIT" | tee -a $logfile
# printf "[%lu] PROCESS_HOST_CHECK_RESULT;$2;1;$error_message" $now > $commandfile
exit 4
fi
echo "Deplacer les fichiers generes" >> $logfile
error_message=$(sudo -u apache centreon -u $centreon_admin_user -p $centreon_admin_password -a CFGMOVE -v 1)
if [ $? -eq 1 ] ; then
echo $error_message | tee -a $logfile
echo "CLAPI : erreur deplacement des fichiers => EXIT" | tee -a $logfile
# printf "[%lu] PROCESS_HOST_CHECK_RESULT;$2;1;$error_message" $now > $commandfile
exit 4
fi
echo "Redemarrer l'ordonnanceur" >> $logfile
error_message=$(sudo -u apache centreon -u $centreon_admin_user -p $centreon_admin_password -a POLLERRELOAD -v 1)
if [ $? -eq 1 ] ; then
echo $error_message | tee -a $logfile
echo "CLAPI : erreur reload => EXIT" | tee -a $logfile
# printf "[%lu] PROCESS_HOST_CHECK_RESULT;$2;1;$error_message" $now > $commandfile
exit 4
fi
echo "OK !" >> $logfile
| true
|
7be446e436340c737dd4937907e2f442da6d9931
|
Shell
|
sidohaakma/NGS_DNA
|
/protocols/SnpFiltration.sh
|
UTF-8
| 1,339
| 2.71875
| 3
|
[
"MIT"
] |
permissive
|
#MOLGENIS walltime=05:59:00 mem=10gb
#Parameter mapping
#string tmpName
#string stage
#string checkStage
#string gatkVersion
#string gatkJar
#string tempDir
#string intermediateDir
#string indexFile
#string projectVariantsMergedSnpsVcf
#string projectVariantsMergedSnpsFilteredVcf
#string tmpDataDir
#string project
#string logsDir
#string groupname
#string stage
#Load GATK module
${stage} "${gatkVersion}"
makeTmpDir "${projectVariantsMergedSnpsFilteredVcf}"
tmpProjectVariantsMergedSnpsFilteredVcf="${MC_tmpFile}"
#Run GATK VariantFiltration to filter called SNPs on
java -XX:ParallelGCThreads=4 -Djava.io.tmpdir="${tempDir}" -Xmx8g -Xms6g -jar "${EBROOTGATK}/${gatkJar}" \
-T VariantFiltration \
-R "${indexFile}" \
-o "${tmpProjectVariantsMergedSnpsFilteredVcf}" \
--variant "${projectVariantsMergedSnpsVcf}" \
--filterExpression "QD < 2.0" \
--filterName "filterQD" \
--filterExpression "MQ < 25.0" \
--filterName "filterMQ" \
--filterExpression "FS > 60.0" \
--filterName "filterFS" \
--filterExpression "MQRankSum < -12.5" \
--filterName "filterMQRankSum" \
--filterExpression "ReadPosRankSum < -8.0" \
--filterName "filterReadPosRankSum"
mv "${tmpProjectVariantsMergedSnpsFilteredVcf}" "${projectVariantsMergedSnpsFilteredVcf}"
echo "moved ${tmpProjectVariantsMergedSnpsFilteredVcf} ${projectVariantsMergedSnpsFilteredVcf}"
| true
|
c10a8934520fa45351b29f079fb8211a7ae64941
|
Shell
|
BlenderCN-Org/morphosource-vagrant
|
/install_scripts/blender.sh
|
UTF-8
| 961
| 3.359375
| 3
|
[] |
no_license
|
#!/bin/sh
SHARED_DIR=$1
if [ -f "$SHARED_DIR/install_scripts/config" ]; then
. $SHARED_DIR/install_scripts/config
fi
if [ ! -d blender ]; then
DOWNLOAD_URL="https://download.blender.org/release/Blender2.79/blender-2.79b-linux-glibc219-x86_64.tar.bz2"
cd $DOWNLOAD_DIR
if [ ! -f "blender.tar.bz2" ]; then
echo "Downloading $DOWNLOAD_URL"
curl -sS $DOWNLOAD_URL -o blender.tar.bz2
fi
tar xjf blender.tar.bz2
mv blender-2.79b-linux-glibc219-x86_64 blender
BLENDER_PATH="${DOWNLOAD_DIR}/blender"
cp -r $SHARED_DIR/install_scripts/blender_config/scripts $BLENDER_PATH/.
chmod a+x $BLENDER_PATH/scripts/*
cp -r $SHARED_DIR/install_scripts/blender_config/addons/io_scene_gltf2 $BLENDER_PATH/2.79/scripts/addons/
cd
echo "export BLENDER_PATH=$BLENDER_PATH" >> .bashrc
fi
# shared library needed
# from https://blender.stackexchange.com/questions/96020/libglu-so-1-error-loading-shared-library/102122
sudo apt-get install libglu1
| true
|
2d72bd05edb01451cb37feb9796cb26c2435041d
|
Shell
|
wildknaap/slobberbok
|
/monitor.dir.sh
|
UTF-8
| 282
| 2.859375
| 3
|
[] |
no_license
|
#!/bin/bash
#
# run in screen session
PATH="<path>"
EMAIL="<email>"
TIME=`/bin/date +%R`
HOST="<host>"
/usr/bin/inotifywait -m $PATH -e create |
while read path action file
do
/bin/echo "[$HOST] $FILE at $TIME" |/usr/bin/mail -s "[$HOST] $FILE at $TIME" $EMAIL
done
#EOF
| true
|
f955a95738a1c177f4a05ab689d12c60d4e1f9b4
|
Shell
|
ustc-bmec/Whole-Brain-Conv
|
/ScriptsForWangEtAl2019/Step3_Plots/allsub_getGradsSurfS4
|
UTF-8
| 2,464
| 3.28125
| 3
|
[] |
no_license
|
#!/bin/bash
# sub-script of allsubjects, get 2mm smoothed surface of CohenD effect of gradients for each task
if [ $# \> 0 ]
then # data/output folder inputted
dir_data=$1
dir_out=$1
else
dir_main=/home/gululu/Disks/DataMore/Data2017/ProjBoldNN/Analysis_ForAll_0510
dir_data=$dir_main/MaxGradients
dir_out=$dir_main/MaxGradients
fi
if [ $# \> 1 ]
then # tmp folder designated
dir_tmp=$2/tmp929
else
dir_tmp=/home/gululu/Disks/Fast/TMP/tmp929
fi
lst_data=`ls $dir_data/*.nii.gz`
# set fil_log = $dir_Logs/MaxNorm_`date '+%Y%m%d_%H%M'`.txt
# clear the output folder
# if ( -d $dir_outMask ) then
# echo "output folder exists, now remove it"
# echo $dir_outMask
# echo $dir_outGrads
# rm -r $dir_outMask
# rm -r $dir_outGrads
# endif # -d $dir_outMask
if [ ! -d $dir_out ]
then
mkdir $dir_out
fi
# go
for data_grad in $lst_data
do
if [ -d $dir_tmp ]
then
rm -r $dir_tmp # clear the tmp folder
fi
mkdir $dir_tmp
# get the info
nam_data=`basename $data_grad`
nam_data=`echo $nam_data|cut -d '.' -f 1`
echo $data_grad
echo $nam_data
# check if classified right
ind_label=`echo $nam_data | rev | cut -d '_' -f 3`
ind_pred=`echo $nam_data | rev | cut -d '_' -f 1`
if [ "$ind_label" -eq "$ind_pred" ]
then
sfx_lh="Right_fsavg_lh_s4.func.gii"
sfx_rh="Right_fsavg_rh_s4.func.gii"
else
sfx_lh="Wrong_fsavg_lh_s4.func.gii"
sfx_rh="Wrong_fsavg_rh_s4.func.gii"
fi
# normalize to standard MNI space
if [ -f $dir_out/$nam_data'_'$sfx_lh ]; then
continue
fi
mri_vol2vol --mov $data_grad --targ ./MNI152_T1_1mm_brain.nii.gz \
--regheader --o $dir_tmp/grad_reg.nii.gz
# map to the fsaverage surface
# lh
mri_vol2surf --mov $dir_tmp/grad_reg.nii.gz --mni152reg --hemi lh --surf white \
--o $dir_tmp/grad_reg_lh.func.gii
mri_surf2surf --srcsubject fsaverage --srcsurfval $dir_tmp/grad_reg_lh.func.gii \
--trgsubject fsaverage --trgsurfval $dir_out/$nam_data'_'$sfx_lh \
--hemi lh --fwhm-trg 4
#rh
mri_vol2surf --mov $dir_tmp/grad_reg.nii.gz --mni152reg --hemi rh --surf white \
--o $dir_tmp/grad_reg_rh.func.gii
mri_surf2surf --srcsubject fsaverage --srcsurfval $dir_tmp/grad_reg_rh.func.gii \
--trgsubject fsaverage --trgsurfval $dir_out/$nam_data'_'$sfx_rh \
--hemi rh --fwhm-trg 4
# break # for debug
done # for data
| true
|
0dbe32dc682f76b88115ff8cf77ff02b79e25cf4
|
Shell
|
julienbenjamin/administration-scripts
|
/debian-enable-contrib-and-non-free-repositories.sh
|
UTF-8
| 1,633
| 4.125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Script to create a new "sources.list" to
# enable contrib and non-free repositories
DEBIAN_RELEASE=`cat /etc/*-release 2> /dev/null | grep PRETTY_NAME | awk -F "=" {'print $2'} | awk -F "(" {'print $2'} | awk -F ")" {'print $1'}`
SOURCES_FILE="/etc/apt/sources.list"
MIRROR_URL="http://httpredir.debian.org/debian" # find the closest mirror
MIRROR_SECURITY_URL="http://security.debian.org/"
if [ $(id -u) -eq 0 ]; then # root check
echo "-> Updating sources.list to add \"contrib\" and \"non-free\""
echo "-> Backuping original sources.list before modification"
# if sources.list.back exists, consider a previous
# sane backup has already been made in a proper state
if [ -e "${SOURCES_FILE}.back" ]
then
cp -p ${SOURCES_FILE} ${SOURCES_FILE}.back
echo "Backup done."
else
echo "File exists. Leaving previous backup."
fi
echo "deb MIRROR_URL $DEBIAN_RELEASE main contrib non-free" >> SOURCES_FILE
echo "deb-src MIRROR_URL $DEBIAN_RELEASE main contrib non-free" >> SOURCES_FILE
echo "" >> SOURCES_FILE
echo "deb MIRROR_SECURITY_URL $DEBIAN_RELEASE/updates main contrib non-free" >> SOURCES_FILE
echo "deb-src MIRROR_SECURITY_URL $DEBIAN_RELEASE/updates main contrib non-free" >> SOURCES_FILE
echo "" >> SOURCES_FILE
echo "# $DEBIAN_RELEASE-updates, previously known as 'volatile'" >> SOURCES_FILE
echo "deb MIRROR_URL $DEBIAN_RELEASE-updates main contrib non-free" >> SOURCES_FILE
echo "deb-src MIRROR_URL $DEBIAN_RELEASE-updates main contrib non-free" >> SOURCES_FILE
else
echo "Only root may edit $SOURCES_FILE"
exit 2
fi
| true
|
0385c7785e3b4f94d7bddf9677b412dc067ebeb6
|
Shell
|
dyne/dynebolic
|
/dyneIII/live-init-scripts/scripts/live-bottom/41apt_cdrom
|
UTF-8
| 380
| 3.28125
| 3
|
[] |
no_license
|
#!/bin/sh
#set -e
# initramfs-tools header
PREREQ=""
prereqs()
{
echo "${PREREQ}"
}
case "${1}" in
prereqs)
prereqs
exit 0
;;
esac
# live-initramfs header
if [ -n "${NOAPTCDROM}" ]
then
exit 0
fi
. /scripts/live-functions
log_begin_msg "Adding APT-CDROM source"
# live-initramfs script
if [ -d /root/cdrom ]
then
chroot /root apt-cdrom -m add
fi
log_end_msg
| true
|
aa12ef0f2351452d007a3bbe67594f35c392ded7
|
Shell
|
callowaylc/sh
|
/json.sh
|
UTF-8
| 468
| 3.328125
| 3
|
[] |
no_license
|
#!/bin/bash
set -euo pipefail
! set -o errtrace 2>/dev/null
[[ "${JSON_SOURCED:-}" = "true" ]] && return 0
## constants ####################################
JSON_SOURCED=true
## properties ###################################
## functions ####################################
function keys {
# writes comma delimited list to stdout
local p=${1:-}
local sep=${2:-,}
[[ "$p" = "-" ]] && p=`cat` ||:
printf "$p" | jq -er 'keys | map(.[:2]) | join(",")'
}
| true
|
df480c9ee50a9e545eebd6ae438d25abf7f78637
|
Shell
|
flosommerfeld/Debian-Inbetriebnahme
|
/setup.sh
|
UTF-8
| 4,891
| 3.234375
| 3
|
[] |
no_license
|
#!/bin/bash
# Info: Dieses Skript dient zur Einrichtung von Debian Systemen.
# Letztes Veränderungsdatum: 04.10.19
# Author: Florian Sommerfeld
# Getestet unter (Augabe von uname -a): Linux debianPc 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux ----- Debian 10!
# Hinweis: Im Idealfall dieses Skript direkt nach dem Aufsetzen des Betriebssystems starten; Voraussetzung ist, dass GNOME und Nautilus verwendet werden!
# Variablen
balenaEtcher = "balenaEtcher-1.5.57-x64"
eclipseCpp = "eclipse-cpp-2019-09-R-linux-gtk-x86_64"
eclipseJava = "eclipse-java-2019-09-R-linux-gtk-x86_64"
megaSync = "megasync-Debian_10.0_amd64"
megaSyncNautilusExt = "nautilus-megasync-Debian_10.0_amd64"
rabbitVcs = "rabbitvcs-0.17.1"
pencil = "Pencil_3.0.4_amd64"
starUml = "StarUML-3.1.0-x86_64"
virtualbox = "virtualbox-6.0_6.0.12-amd64"
echo "###########################################"
echo "Debian Einrichtungsskript von Florian"
echo "###########################################"
echo "Voraussetzung für dieses Skript ist, dass man GNOME als DE benutzt!"
echo ""
echo "Schritte:"
echo "#1: Füge den Benutzer '$USER' in die Sudoers-Datei."
echo "$USER ALL=(ALL:ALL) ALL" >> /etc/sudoers
echo "#2: Behebe ein häufiges NetworkManager Problem (Randomisierte Mac-Adresse verbieten)"
echo "[device]" >> /etc/NetworkManager/NetworkManager.conf
echo "wifi.scan-rand-mac-address=no" >> /etc/NetworkManager/NetworkManager.conf
echo "#3: Gnome konfigurieren (Mausgeschwindigkeit usw.)"
gsettings set org.gnome.shell favorite-apps "['firefox-esr.desktop', 'libreoffice-writer.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'org.gnome.Terminal.desktop']"
gsettings set org.gnome.nautilus.preferences show-hidden-files true
gsettings set org.gnome.desktop.peripherals.mouse accel-profile "flat"
gsettings set org.gnome.Terminal.Legacy.Settings theme-variant "dark"
gsettings set org.gnome.desktop.peripherals.mouse speed -0.172661870504 #Aktuell benutze ich lieber den Wert 0
gsettings set org.gnome.desktop.wm.keybindings show-desktop "['<Super>d']"
echo "#4: Florians standardmäßige Ordnerstruktur anlegen"
mkdir /home/$USER/Workspaces
mkdir /home/$USER/Software
mkdir /home/$USER/Files
echo "#5.1: Installation von nützlicher Software (über apt)"
apt-get update && apt-get upgrade
apt-get install -y net-tools sudo command-not-found dconf-editor redshift redshift-gtk snapd flatpak gdebi filezilla htop gnome-software-plugin-flatpak curl libcanberra-gtk-module libcanberra-gtk3-module openjdk-11-source openjdk-11-jdk openjdk-11-doc openjfx openjfx-source git python-nautilus python-configobj python-gtk2 python-glade2 python-svn python-dbus python-dulwich subversion meld rabbitvcs-core rabbitvcs-cli rabbitvcs-gedit rabbitvcs-nautilus libdouble-conversion1 libpcre2-16-0 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5x11extras5 libsdl1.2debian libxcb-xinerama0 qt5-gtk-platformtheme qttranslations5-l10n libc-ares2 libcrypto++6 libmediainfo0v5 libtinyxml2-6a libzen0v5 gparted
apt-get update
echo "#5.2: Installation von nützlicher Software (über flatpak)"
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y flathub org.keepassxc.KeePassXC
flatpak install -y flathub io.atom.Atom
flatpak install -y flathub com.axosoft.GitKraken
echo "#5.3: Installation von nützlicher Software (über snap)"
snap install mailspring
snap install tusk
echo "#5.4: Installation von Eclipse (Java und C/C++)"
unzip -v pkgs/$eclipseCpp.zip
unzip -v pkgs/$eclipseJava.zip
mv pkgs/$eclipseCpp /home/$USER/Software
mv pkgs/$eclipseJava /home/$USER/Software
mv /home/$USER/Software/$eclipseCpp mv /home/$USER/Software/eclipse-cpp
mv /home/$USER/Software/$eclipseCpp mv /home/$USER/Software/eclipse-java
cp misc/icon-c.png /home/$USER/Software/eclipse-cpp
cp misc/eclipse-cpp.desktop /usr/share/applications
cp misc/eclipse-java.desktop /usr/share/applications
echo "#5.5: Installation von StarUML"
cp pkgs/$starUml /home/$USER/Software/
echo "#5.6: Installation von Balena Etcher"
cp pkgs/$balenaEtcher /home/$USER/Software/
echo "#5.7: Installation von MegaSync"
sudo dpkg -i pkgs/$megaSync.deb
sudo dpkg -i pkgs/$megaSyncNautilusExt.deb
echo "#5.8: Installation von Pencil"
sudo dpkg -i pkgs/$pencil.deb
echo "#5.9: Installation von Virtualbox"
sudo dpkg -i pkgs/$virtualbox.deb
echo "#6: Folgende Sachen konnte ich nicht automatisieren:"
echo "Keyboard-Shortcuts für das Terminal, ... "
echo "- Die oben genannten Sachen müssen manuell gemacht werden -"
echo "#7: Optionaler Schritt für Nvidia-Grafikkarten"
echo "Über apt das Paket nvidia-detect installieren (apt install nvidia-detect)"
echo "nvidia-detect ausführen und machen, was das Skript einem sagt"
#Eventuell noch: main contrib non-free in die apt.sources hinzufügen?
| true
|
5a9af4e65eb90ea3cb5d3dcb4ce66890a49be17b
|
Shell
|
manoharramarao/bashScripts
|
/archive_logs/archive_logs.sh
|
UTF-8
| 632
| 3.78125
| 4
|
[] |
no_license
|
#!/bin/bash
# ------------------------------------------------------------------------------
# Usage:sh archive_logs.sh
# Desc: Creates zip archive of all the files in the present working directory.
# execute this script from the directory where there are files to be archived
# ------------------------------------------------------------------------------
working_dir=`pwd`
archive_dir=archive_`date "+%F_%H.%M"`
archive_dir_path=$working_dir/$archive_dir
mkdir -p $archive_dir_path
for i in `find $working_dir -maxdepth 1 -type f`; do
mv $i $archive_dir_path
done
zip -r $archive_dir'.zip' ./$archive_dir
rm -rf ./$archive_dir
| true
|
f0e776a67a2e72e24485accb74d868ade914d800
|
Shell
|
eamoany/serverstatsreport
|
/stats.sh
|
UTF-8
| 4,251
| 3.171875
| 3
|
[] |
no_license
|
#!/bin/bash
date2=$(date +"%d-%m-%Y")
DOW=$(date +"%A")
header(){
echo '<!DOCTYPE html>'
echo '<html>'
echo '<head>'
echo '<title>Server Stats Report</title>'
echo '<link rel="icon" href="logo.png">'
echo "<link href="bootstrap/css/bootstrap.css" rel="stylesheet">"
echo '<style>'
echo '.row{'
echo 'margin:0px;'
echo '}'
echo '.center {'
echo 'display: block;'
echo 'margin-left: auto;'
echo 'margin-right: auto;'
echo 'width: 50%;'
echo '}'
echo '</style>'
echo '</head>'
}
footer(){
echo '<div class="row" style="text-align:center;">'
echo "<a href="index.html">REFRESH</a><br /><br />"
echo '<p>opentechy.com</p>'
echo '</div>'
echo "<!--<script src="bootstrap/js/bootstrap.js"></script>-->"
echo '</body>'
echo '</html>'
}
body(){
echo '<body>'
echo '<br />'
echo '<div class="row">'
echo '<img src="logo.jpg" alt="Vodafone Logo" class="center" style="width:220px; height:180px;">'
echo '<h2 style="text-align:center;">SERVERS STATS REPORT</h2>'
echo '<div class="row" style="text-align:center;">'
echo "<p>$date2</p>"
echo '</div>'
echo '</div>'
echo '<br />'
echo '<div class="row">'
echo '<div class="col-md-6 col-md-offset-3">'
echo '<table class="table table-condensed" style="width:100%;">'
echo '<tr style="background:#000; color:#fff;">'
echo '<th>SERVER IP</th>'
echo '<th>DISK USAGE (%)</th>'
echo '<th>CPU USAGE (%)</th>'
echo '<th>MEMORY USAGE (%)</th>'
echo ' </tr>'
for server in $(more /root/scripts/server-list.txt)
do
os_id=$(ssh -q $server rpm -qa \*-release | grep -Ei "oracle|redhat|centos" |cut -d"-" -f1)
el_version=$(ssh -q $server rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3 | cut -c1)
if [ "$el_version" == "6" ]; then
scpu=$(ssh -q $server iostat | grep -E '^ ' | awk '{printf("%.1f"), 100-$6}')
smem=$(ssh -q $server free -g -t | head -n 3 | awk 'NR==3 {printf("%.1f"), $3/($4+$3)*100}')
sdisk=$(ssh -q $server df -h --exclude=nfs4 --total | awk 'NR==1; END{print}' | awk 'NR==2' | awk '{print $5}' | sed 's/%//')
echo '<tr>'
echo "<td>$server</td>"
echo "<td>$sdisk</td>"
echo "<td>$scpu</td>"
echo "<td>$smem</td>"
echo '</tr>'
fi
if [ "$el_version" == "7" ]; then
scpu=$(ssh -q $server iostat | grep -E '^ ' | awk '{printf("%.1f"), 100-$6}')
smem=$(ssh -q $server free -g -t | head -n 2 | awk 'NR==2 {printf("%.1f"), ($2-$4)/$2*100}')
sdisk=$(ssh -q $server df -h --exclude=nfs4 --total | awk 'NR==1; END{print}' | awk 'NR==2' | awk '{print $5}' | sed 's/%//')
echo '<tr>'
echo "<td>$server</td>"
echo "<td>$sdisk</td>"
echo "<td>$scpu</td>"
echo "<td>$smem</td>"
echo '</tr>'
fi
done
echo '</table>'
echo '</div>'
echo '</div>'
}
#run functions
header
body
footer
| true
|
8c7e0202a34e3524a5def8a76a367cfaf8cd83d6
|
Shell
|
brahmapoutras/dotfiles
|
/initramfs_scripts/mnt/initramfs-tools/scripts/init-premount/b_nslookup
|
UTF-8
| 337
| 3.40625
| 3
|
[] |
no_license
|
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /scripts/functions
if [ ! -x "/sbin/nslookup" ]; then
log_failure_msg "Nslookup not found"
exit 0
fi
configure_networking
echo "Trying nslookups"
nslookup 1.1.1.1
nslookup 8.8.8.8
nslookup 9.9.9.9
nslookup google.com
| true
|
5c638fb4eab887be1ae789e7e7bd9dc75cd6f565
|
Shell
|
tjdevries/neovim
|
/.ci/after_success.sh
|
UTF-8
| 214
| 2.921875
| 3
|
[
"Apache-2.0",
"MIT",
"Vim",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ -n "${CI_TARGET}" ]]; then
exit
fi
[ "$USE_GCOV" = on ] && { coveralls --gcov "$(which "${GCOV}")" --encoding iso-8859-1 || echo 'coveralls upload failed.' ; }
| true
|
63db28f5394e76ad24038dea1e3268494c5d91f4
|
Shell
|
cms-sw/cmssw
|
/DQM/SiStripMonitorCluster/test/batch_mtcc.sh
|
UTF-8
| 22,028
| 3.84375
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/sh
#dkcira - 2006.08.20, add more flexibility, change to options instead of add more flexibility, positional parameters
###############################################################################################################
# users can change this to their default directory that will overwrite command line options
###############################################################################################################
#DEFAULT_CASTOR_OUTPUT_DIRECTORY="/castor/cern.ch/user/d/dkcira/MTCC/2006_08_16_090"
###############################################################################################################
# read options
###############################################################################################################
echo $0 $@; # echo $OPTIND;
OPTERROR=11; # error option to use when exiting
#
show_usage(){
echo ""
echo "Usage:"
echo "`basename $0` -r mtcc_runnumber [ -w which_input_files -f first_file_of_run -l last_file_of_run -p mtcc_pedestal_runnr -o output_directory_in_castor -t input_file_ending (default dat) -h ]";
echo ""
echo " -h"
echo " print out this message"
echo " -r mtcc_runnumber"
echo " run number you want to reconstruct"
echo " -w which_input_files :"
echo " 1 - copy files from castor (default option)"
echo " 2 - run directly on castor files"
echo " 3 - copy files from cmsdisk0"
echo " 4 - run on local files in the subdirectory InputFiles/"
echo " -o output_directory_in_castor :"
echo " Set this for your output files to be copied to castor."
echo " If DEFAULT_CASTOR_OUTPUT_DIRECTORY is set in the script, it will ignore this option"
echo ""
}
# Exit and complain if no argument given.
if [ -z $1 ]; then show_usage; exit $OPTERROR; fi
#
# echo "OPTIND=$OPTIND"; echo "#=$#";
while getopts ":r:p:f:l:w:o:t:h" Option
do
case $Option in
r) RUNNR=$OPTARG; echo "will reconstruct RUNNR=$RUNNR" ;;
p) PED_RUNNR=$OPTARG; echo "will create pedestals from PED_RUNNR=$PED_RUNNR" ;;
f) FIRSTFILE=$OPTARG; echo "first file of run to be reconstructed FIRSTFILE=$FIRSTFILE" ;;
l) LASTFILE=$OPTARG; echo "last file of run to be reconstructed LASTFILE=$LASTFILE" ;;
w) WHICH_INPUT_FILES=$OPTARG; echo "WHICH_INPUT_FILES=$WHICH_INPUT_FILES" ;;
o) WHERE_TO_COPY_OUTPUT=$OPTARG; echo "WHERE_TO_COPY_OUTPUT=$WHERE_TO_COPY_OUTPUT" ;;
t) INPUT_FILE_ENDING=$OPTARG; echo "INPUT_FILE_ENDING=$INPUT_FILE_ENDING" ;;
h) show_usage; exit 0;;
*) echo "No such option -${Option}";;
esac
done
shift $(($OPTIND - 1)) # Decrements the argument pointer so it points to next argument.
###############################################################################################################
# define functions
###############################################################################################################
#--- this function has to be called first, obviously
set_shell_variables(){
# this directory must be visible from remote batch machine
DIR_WHERE_TO_EVAL="/afs/cern.ch/user/d/dkcira/scratch0/MTCC/2006_08_14_code_090/CMSSW_0_9_0"
# if you want some example pedestals
PEDESTAL_DIR="/afs/cern.ch/user/d/dkcira/scratch0/MTCC/2006_08_14_code_090/pedestals";
# this will probably remain always 1 from now on
MAX_PED_FILES_TO_RUN_OVER=1;
# for online db access. some variables for the oracle tool of cmssw are not set anymore
LOCAL_ORACLE_ADMINDIR="/afs/cern.ch/project/oracle/admin/"
#--
# username to connect to cmsdisk0.cern.ch for asking list of files and copying them
BATCH_USER_NAME=`whoami`
# these have changed completely, need to find out
CASTOR_DIR="/castor/cern.ch/cms/MTCC/data/0000${RUNNR}/A"
PED_CASTOR_DIR="/castor/cern.ch/cms/MTCC/data/0000${PED_RUNNR}/A"
#
# directory where the job is run or submitted
if [ "${LS_SUBCWD+set}" = set ]; then
LK_WKDIR="${LS_SUBCWD}" # directory where you submit in case of bsub
WWDIR="${WORKDIR}"
else
LK_WKDIR=`pwd` # directory where you run locally otherwise
WWDIR=`pwd`
fi
#
# this directory will be created, use '/pool' for production and '/tmp' for testing
MTCC_OUTPUT_DIR="${WWDIR}/mtcc_${RUNNR}"
# directory where to copy locally input files, separate from above as this does not necessarely need to be recreated each time
MTCC_INPUT_DIR="${WWDIR}/InputFiles"
PED_MTCC_INPUT_DIR="${WWDIR}/InputFiles"
# pedestals
PED_CFG="${MTCC_OUTPUT_DIR}/${RUNNR}_mtccped.cfg";
PED_LOG_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_mtcc_pedestals.log";
# reconstruction
LIST_OF_CFG_FILES=""; # start empty, cfg files are added from script
GENERAL_LOG_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_reco_${FIRSTFILE}.log"
LOCAL_INPUT_DIRECTORY="${MTCC_OUTPUT_DIR}/InputFiles";
# templates
TEMPLATE_CMSSW_CFG="${LK_WKDIR}/template_mtccoffline.cfg"
TEMPLATE_PED_CFG="${LK_WKDIR}/template_mtccped.cfg"
# echo '###########################################################'
# echo 'SHELL VARIABLES'; set; export;
# echo '###########################################################'
}
#--- initial checks for inconsistencies
inital_checks_and_settings(){
# need a run
if [ "X$RUNNR" == "X" ]; then
echo "You did not choose a run number. Stopping here!"
exit $OPTERROR;
fi
# need templates
if [ ! -f "$TEMPLATE_CMSSW_CFG" ]; then echo "file ${TEMPLATE_CMSSW_CFG} does not exist, stopping here"; exit $OPTERROR; fi
if [ ! -f "$TEMPLATE_PED_CFG" ]; then echo "file ${TEMPLATE_PED_CFG} does not exist, stopping here"; exit $OPTERROR; fi
# need input files option
if [ -z "$WHICH_INPUT_FILES" ] ; then WHICH_INPUT_FILES=1; fi
case $WHICH_INPUT_FILES in
1|2|3|4) echo "WHICH_INPUT_FILES=$WHICH_INPUT_FILES";;
*) echo "no such WHICH_INPUT_FILES=$WHICH_INPUT_FILES . exit here!"; exit $OPTERROR;;
esac
# choose file ending, maybe will go to "root" later
if [ -z "$INPUT_FILE_ENDING" ] ; then
INPUT_FILE_ENDING="dat";
echo "Using default INPUT_FILE_ENDING=$INPUT_FILE_ENDING";
fi
# first choose castor directory from command line or default variable
if [ "X${DEFAULT_CASTOR_OUTPUT_DIRECTORY}" != "X" ]; then # if set and not empty
echo "Using castor directory from default variable DEFAULT_CASTOR_OUTPUT_DIRECTORY";
WHERE_TO_COPY_OUTPUT="$DEFAULT_CASTOR_OUTPUT_DIRECTORY";
elif [ -n "$WHERE_TO_COPY_OUTPUT" ]; then
echo "Using castor directory from command line option";
else
echo "Output files will NOT be copied to castor.";
CASTOROUTPUT="no"
fi
# then check if castor directory exists
if [ "$CASTOROUTPUT" != "no" ] ; then
if nsls -d "$WHERE_TO_COPY_OUTPUT" > /dev/null # Suppress default output
then
echo "Using $WHERE_TO_COPY_OUTPUT to copy files to castor";
else
echo "Directory WHERE_TO_COPY_OUTPUT=$WHERE_TO_COPY_OUTPUT does not exist on castor.";
echo "Stopping here!"; exit $OPTERROR;
fi
fi
# document which code you were using
echo "Using code from ${DIR_WHERE_TO_EVAL}";
}
#---
create_output_directory(){
if [ -d "$MTCC_OUTPUT_DIR" ]; then
echo "directory ${MTCC_OUTPUT_DIR} already exists, stopping here"; exit $OPTERROR;
else
echo "creating directory ${MTCC_OUTPUT_DIR}"; mkdir $MTCC_OUTPUT_DIR;
fi
}
#---
get_list_of_local_files(){
echo "Getting list of files to be reconstructed from local directory."
if [ -z "$FIRSTFILE" ] ; then FIRSTFILE=1 ; fi
if [ -z "$LASTFILE" ] ; then LASTFILE=`ls $LOCAL_INPUT_DIRECTORY | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | wc -l | sed 's/[ ]*//g'`; fi
let "HOWMANYFILES = $LASTFILE - $FIRSTFILE + 1";
echo "FIRSTFILE=$FIRSTFILE LASTFILE=$LASTFILE HOWMANYFILES=$HOWMANYFILES"
#
# the funny sort is done so that the files are ordered 1, 2, 3, ..., 10, 11, ..., and not 1,10,11,...,2,20, and so on
LIST_OF_DATA_FILES=`ls $LOCAL_INPUT_DIRECTORY | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //' | sort -n -t . +4 | head -${LASTFILE} | tail -${HOWMANYFILES}`
if [ "$LIST_OF_DATA_FILES" == "" ] ; then echo "No input reco files found!!!!!! Stopping here"; exit $OPTERROR; fi
}
#---
get_list_of_local_pedestal_files(){
echo "Getting list of pedestal files from local directory."
if [ $MAX_PED_FILES_TO_RUN_OVER -eq 0 ]
then
LIST_OF_PED_DATA_FILES=`ls $LOCAL_INPUT_DIRECTORY | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //'`
else
echo " !!! Caution !!! limiting max. nr. of files per run to ${MAX_PED_FILES_TO_RUN_OVER}"
LIST_OF_PED_DATA_FILES=`ls $LOCAL_INPUT_DIRECTORY | grep "\.${INPUT_FILE_ENDING}" | head -${MAX_PED_FILES_TO_RUN_OVER} | sed 's/^.* //'`
fi
if [ "$LIST_OF_PED_DATA_FILES" == "" ] ; then echo "No input pedestal files found!!!!!! Stopping here"; exit $OPTERROR; fi
}
#---
get_list_of_castor_files(){
echo "Getting list of files to be reconstructed from castor."
if [ -z "$FIRSTFILE" ] ; then FIRSTFILE=1 ; fi
if [ -z "$LASTFILE" ] ; then LASTFILE=`nsls $CASTOR_DIR | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | wc -l | sed 's/[ ]*//g'`; fi
let "HOWMANYFILES = $LASTFILE - $FIRSTFILE + 1";
echo "FIRSTFILE=$FIRSTFILE LASTFILE=$LASTFILE HOWMANYFILES=$HOWMANYFILES"
echo "getting from CASTOR the list of files corresponding to run ${RUNNR}";
LIST_OF_DATA_FILES=`nsls $CASTOR_DIR | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //' | sort -n -t . +4 | head -${LASTFILE} | tail -${HOWMANYFILES}`
if [ "$LIST_OF_DATA_FILES" == "" ] ; then echo "No input files found!!!!!! Stopping here"; exit $OPTERROR; fi
}
#---
get_list_of_pedestal_castor_files(){
echo "Getting list of pedestal files to be reconstructed from castor."
if [ $MAX_PED_FILES_TO_RUN_OVER -eq 0 ]
then
LIST_OF_PED_DATA_FILES=`nsls $CASTOR_DIR | grep "\.${INPUT_FILE_ENDING}" | sed 's/^.* //'`
else
echo " !!! Caution !!! limiting nr. of files for calculating pedestals to ${MAX_PED_FILES_TO_RUN_OVER}"
LIST_OF_PED_DATA_FILES=`nsls $CASTOR_DIR | grep "\.${INPUT_FILE_ENDING}" | head -${MAX_PED_FILES_TO_RUN_OVER} | sed 's/^.* //'`
fi
if [ "$LIST_OF_PED_DATA_FILES" == "" ] ; then echo "No input pedestal files found!!!!!! Stopping here"; exit $OPTERROR; fi
}
#---
copy_castor_files_locally(){
echo "LIST_OF_DATA_FILES="; echo "$LIST_OF_DATA_FILES";
echo "Will copy locally the input files from castor.";
if [ -d "$MTCC_INPUT_DIR" ]; then
echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
else
echo "creating directory ${MTCC_INPUT_DIR}"; mkdir $MTCC_INPUT_DIR;
fi
for rfile in $LIST_OF_DATA_FILES
do
if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
else
echo "copying $CASTOR_DIR/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
rfcp $CASTOR_DIR/${rfile} ${MTCC_INPUT_DIR}/${rfile}
fi
done
}
#---
copy_castor_pedestal_files_locally(){
echo "LIST_OF_PED_DATA_FILES="; echo "$LIST_OF_PED_DATA_FILES";
echo "Will copy locally the pedestal files from castor.";
if [ -d "$MTCC_INPUT_DIR" ]; then
echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
else
echo "creating directory ${MTCC_INPUT_DIR}"
mkdir $MTCC_INPUT_DIR;
fi
for rfile in $LIST_OF_PED_DATA_FILES
do
if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
else
echo "copying $CASTOR_DIR/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
rfcp $CASTOR_DIR/${rfile} ${MTCC_INPUT_DIR}/${rfile}
fi
done
}
#---
get_list_of_cmsdisk0_files(){
echo "Getting list of files to be reconstructed from cmsdisk0."
if [ -z "$FIRSTFILE" ] ; then FIRSTFILE=1 ; fi
if [ -z "$LASTFILE" ] ; then LASTFILE=`ssh -n ${BATCH_USER_NAME}@cmsdisk0 'ls /data0/mtcc_0_9_0/' | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | wc -l | sed 's/[ ]*//g'`; fi
let "HOWMANYFILES = $LASTFILE - $FIRSTFILE + 1";
echo "FIRSTFILE=$FIRSTFILE LASTFILE=$LASTFILE HOWMANYFILES=$HOWMANYFILES"
LIST_OF_DATA_FILES=`ssh -n ${BATCH_USER_NAME}@cmsdisk0 'ls /data0/mtcc_0_9_0/' | grep ${RUNNR} | grep "\.${INPUT_FILE_ENDING}" | sort -n -t . +4 | head -${LASTFILE} | tail -${HOWMANYFILES}`
if [ "$LIST_OF_DATA_FILES" == "" ] ; then
echo "No input files found!!!!!! Stopping here"; exit $OPTERROR;
fi
}
#---
copy_cmsdisk0_files_locally(){
echo "LIST_OF_DATA_FILES=$LIST_OF_DATA_FILES"
echo "Will copy locally the input files from cmsdisk0.";
if [ -d "$MTCC_INPUT_DIR" ]; then
echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
else
echo "creating directory ${MTCC_INPUT_DIR}"; mkdir $MTCC_INPUT_DIR;
fi
for rfile in $LIST_OF_DATA_FILES
do
if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
else
echo "copying ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
scp -c blowfish ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} ${MTCC_INPUT_DIR}/${rfile}
fi
done
}
#---
get_list_of_cmsdisk0_pedestal_files(){
echo "Getting list of pedestal files from cmsdisk0."
if [ $MAX_PED_FILES_TO_RUN_OVER -eq 0 ]
then
LIST_OF_PED_DATA_FILES=`ssh -n ${BATCH_USER_NAME}@cmsdisk0 'ls /data0/mtcc_0_9_0/' | grep ${PED_RUNNR} | grep "\.${INPUT_FILE_ENDING}"`
else
echo " !!! Caution !!! limiting max. nr. of pedestal files per run to ${MAX_PED_FILES_TO_RUN_OVER}"
LIST_OF_PED_DATA_FILES=`ssh -n ${BATCH_USER_NAME}@cmsdisk0.cern.ch 'ls /data0/mtcc_0_9_0/' | grep ${PED_RUNNR} | grep "\.${INPUT_FILE_ENDING}" | head -${MAX_PED_FILES_TO_RUN_OVER}`
fi
if [ "$LIST_OF_PED_DATA_FILES" == "" ] ;
then
echo "No input files found!!!!!! Stopping here";
exit $OPTERROR;
fi
}
#---
copy_cmsdisk0_pedestal_files_locally(){
echo "LIST_OF_PED_DATA_FILES=$LIST_OF_PED_DATA_FILES"
echo "Will copy locally the pedestal files from cmsdisk0.";
if [ -d "$MTCC_INPUT_DIR" ]; then
echo "directory ${MTCC_INPUT_DIR} already exists. copying files there";
else
echo "creating directory ${MTCC_INPUT_DIR}"
mkdir $MTCC_INPUT_DIR;
fi
for rfile in $LIST_OF_PED_DATA_FILES
do
if [ -f ${MTCC_INPUT_DIR}/${rfile} ]; then
echo " ${MTCC_INPUT_DIR}/${rfile} exists already, not copying."
else
echo "copying ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} to ${MTCC_INPUT_DIR}/${rfile}"
scp -c blowfish ${BATCH_USER_NAME}@cmsdisk0.cern.ch:/data0/mtcc_0_9_0/${rfile} ${MTCC_INPUT_DIR}/${rfile}
fi
done
}
#---
copy_example_pedestal_files(){
echo "Copying example pedestals from ${PEDESTAL_DIR}";
cp ${PEDESTAL_DIR}/insert_SiStripPedNoisesDB ${MTCC_OUTPUT_DIR}/.
cp ${PEDESTAL_DIR}/insert_SiStripPedNoisesCatalog ${MTCC_OUTPUT_DIR}/.
}
#---
create_cmssw_config_files(){
# create the cfg files according to the number of files the run is split from DAQ
for rfile in $LIST_OF_DATA_FILES
do
if [ "$WHICH_INPUT_FILES" == "1" ]; then # files in castor and copy locally
FILE_FULL_PATH="\"${MTCC_INPUT_DIR}/${rfile}\"" # files are local or will be copied locally
elif [ "$WHICH_INPUT_FILES" == "3" ]; then # can only copy locally in case of cmsdisk0
FILE_FULL_PATH="\"${MTCC_INPUT_DIR}/${rfile}\"" # files are local or will be copied locally
elif [ "$WHICH_INPUT_FILES" == "4" ]; then # they have already been copied to some local directory - access them directly
FILE_FULL_PATH="\"${MTCC_INPUT_DIR}/${rfile}\"" # files are local or will be copied locally
elif [ "$WHICH_INPUT_FILES" == "2" ]; then # files in castor, run remotely
FILE_FULL_PATH="\"rfio:${CASTOR_DIR}/${rfile}\"" # files are in castor and not copied
else
echo "Do not know what to do WHICH_INPUT_FILES=${WHICH_INPUT_FILES}";
echo "Stopping here!."; exit $OPTERROR;
fi
# cfg and log
CMSSW_CFG="${MTCC_OUTPUT_DIR}/${RUNNR}_mtccoffline_${rfile}.cfg"
LOG_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_mtccoffline_${rfile}.log"
POOL_OUTPUT_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_rec_${rfile}.root"
DQM_OUTPUT_FILE="${MTCC_OUTPUT_DIR}/${RUNNR}_dqm_${rfile}.root"
#
LIST_OF_CFG_FILES="${LIST_OF_CFG_FILES} ${CMSSW_CFG}"
echo "creating $CMSSW_CFG";
touch $CMSSW_CFG;
cat "$TEMPLATE_CMSSW_CFG" | sed "s@SCRIPT_POOL_OUTPUT_FILE@${POOL_OUTPUT_FILE}@" | sed "s@SCRIPT_DQM_OUTPUT_FILE@${DQM_OUTPUT_FILE}@" | sed "s@SCRIPT_LIST_OF_FILES@${FILE_FULL_PATH}@" >> ${CMSSW_CFG}
done
}
#---
create_pedestal_config_file(){
# create list with full paths
PED_LIST_WITH_PATH="";
for rfile in $LIST_OF_PED_DATA_FILES
do
if [ "$WHICH_INPUT_FILES" == "1" ]; then # files in castor and copy locally
PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"${PED_MTCC_INPUT_DIR}/${rfile}\"" # local
elif [ "$WHICH_INPUT_FILES" == "3" ]; then # can only copy locally in case of cmsdisk0
PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"${PED_MTCC_INPUT_DIR}/${rfile}\"" # local
elif [ "$WHICH_INPUT_FILES" == "4" ]; then # they have already been copied to some local directory - access them directly
PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"${PED_MTCC_INPUT_DIR}/${rfile}\"" # local
elif [ "$WHICH_INPUT_FILES" == "2" ]; then # files in castor, run remotely
PED_LIST_WITH_PATH="${PED_LIST_WITH_PATH},\"rfio:${PED_CASTOR_DIR}/${rfile}\"" # castor
else
echo "Do not know what to do WHICH_INPUT_FILES=${WHICH_INPUT_FILES}";
echo "Stopping here!."; exit $OPTERROR;
fi
done
# remove first comma
PED_LIST_WITH_PATH=`echo $PED_LIST_WITH_PATH | sed 's/\,//'`;
echo "creating $PED_CFG";
touch $PED_CFG;
cat "$TEMPLATE_PED_CFG" | sed "s@SCRIPT_LIST_OF_FILES@${PED_LIST_WITH_PATH}@" >> ${PED_CFG}
}
#---
runped(){
cd ${DIR_WHERE_TO_EVAL}; eval `scramv1 runtime -sh`;
export TNS_ADMIN=${LOCAL_ORACLE_ADMINDIR}
export ORACLE_ADMINDIR=${LOCAL_ORACLE_ADMINDIR}
cd ${MTCC_OUTPUT_DIR};
echo "# ************************************************* CALCULATING THE PEDESTALS USING THE CFG FILE ${PED_CFG}"
cat ${PED_CFG};
cmsRun -p ${PED_CFG};
echo "pedestal jobstatus: $?";
mv ${MTCC_OUTPUT_DIR}/Source_*${PED_RUNNR}.root ${PED_CFG}_pedestal_histograms.root
}
#---
runcms(){
cd ${DIR_WHERE_TO_EVAL}; eval `scramv1 runtime -sh`;
export TNS_ADMIN=${LOCAL_ORACLE_ADMINDIR}
export ORACLE_ADMINDIR=${LOCAL_ORACLE_ADMINDIR}
cd ${MTCC_OUTPUT_DIR};
for I_CFG in ${LIST_OF_CFG_FILES}
do
echo ""
echo "########################################################################"
echo "###### RUNNING THE RECONSTRUCTION USING THE CFG FILE ${I_CFG}"
cmsRun -p ${I_CFG}
echo "reconstruction jobstatus: $?";
mv ${MTCC_OUTPUT_DIR}/monitor_cluster_summary.txt ${I_CFG}_cluster_summary.txt
mv ${MTCC_OUTPUT_DIR}/monitor_digi_summary.txt ${I_CFG}_digi_summary.txt
done
cp ${MTCC_OUTPUT_DIR}/insert_SiStripPedNoisesDB ${MTCC_OUTPUT_DIR}/${RUNNR}_insert_SiStripPedNoisesDB
cp ${MTCC_OUTPUT_DIR}/insert_SiStripPedNoisesCatalog ${MTCC_OUTPUT_DIR}/${RUNNR}_insert_SiStripPedNoisesCatalog
}
#---
copy_output_to_castor(){
case $# in
1) OUTPUT_CASTOR_DIR="$1" ;;
*) echo "No output castor directory given, not performing copy_output_to_castor." ;;
esac
# copy (some) output files to castor
if [ "X$OUTPUT_CASTOR_DIR" != "X" ]; then
echo "copying output files to $OUTPUT_CASTOR_DIR";
for ifile in ${MTCC_OUTPUT_DIR}/${RUNNR}*
do
rfcp ${ifile} ${OUTPUT_CASTOR_DIR}/.
done
fi
}
###############################################################################################################
# actual execution
###############################################################################################################
# GENERAL
set_shell_variables;
inital_checks_and_settings;
create_output_directory;
ls -lh;
# PEDESTALS
if [ -n "$PED_RUNNR" ]; then
if [ "$WHICH_INPUT_FILES" == "1" ]; then # files in castor and copy locally
get_list_of_pedestal_castor_files;
copy_castor_pedestal_files_locally;
elif [ "$WHICH_INPUT_FILES" == "2" ]; then # files in castor, run remotely
get_list_of_pedestal_castor_files;
elif [ "$WHICH_INPUT_FILES" == "3" ]; then # can only copy locally in case of cmsdisk0
get_list_of_cmsdisk0_pedestal_files;
copy_cmsdisk0_pedestal_files_locally;
elif [ "$WHICH_INPUT_FILES" == "4" ]; then # they have already been copied to some local directory - access them directly
get_list_of_local_pedestal_files;
else
echo "Not clear where to get files WHICH_INPUT_FILES=$WHICH_INPUT_FILES"; echo "Stopping here!"; exit $OPTERROR;
fi
#
create_pedestal_config_file;
echo "Running pedestals. Log file: ${PED_LOG_FILE}";
time runped > ${PED_LOG_FILE} 2>&1;
else
copy_example_pedestal_files;
fi
# RECONSTRUCTION
#WHICH_INPUT_FILES
# echo "1 - copy files from castor (default option)"
# echo "2 - run directly on castor files"
# echo "3 - copy files from cmsdisk0"
# echo "4 - run on local files in InputFiles/ subdirectory"
if [ "$WHICH_INPUT_FILES" == "1" ]; then # files in castor and copy locally
get_list_of_castor_files;
copy_castor_files_locally;
elif [ "$WHICH_INPUT_FILES" == "2" ]; then # files in castor, run remotely
get_list_of_castor_files;
elif [ "$WHICH_INPUT_FILES" == "3" ]; then # can only copy locally in case of cmsdisk0
get_list_of_cmsdisk0_files;
copy_cmsdisk0_files_locally;
elif [ "$WHICH_INPUT_FILES" == "4" ]; then # they have already been copied to some local directory - access them directly
get_list_of_local_files;
else
echo "Not clear where to get files WHICH_INPUT_FILES=${WHICH_INPUT_FILES}"; echo "Stopping here!"; exit $OPTERROR;
fi
#
create_cmssw_config_files;
echo "Running reconstruction and monitoring. Log file: ${GENERAL_LOG_FILE}";
time runcms > ${GENERAL_LOG_FILE} 2>&1;
ls -lh . ${MTCC_OUTPUT_DIR}/ ;
# copy output to CASTOR if the output directory variable is set
if [ -n "WHERE_TO_COPY_OUTPUT" ]; then
copy_output_to_castor "$WHERE_TO_COPY_OUTPUT";
fi
###############################################################################################################
# end
###############################################################################################################
| true
|
04975c142c5adacbc69d00b48285188a238a64ac
|
Shell
|
suvayu/LHCbVeloView
|
/sourceme.sh
|
UTF-8
| 685
| 3.1875
| 3
|
[] |
no_license
|
#!/bin/sh
# set -o xtrace
# FIXME: Only bash stuff here; should add zsh and other popular shells
# (except C-shells, do not use them!)
[[ $0 == sourceme.bash ]] && {
echo "This script should be sourced, not executed.";
exit -1;
}
# find project directory
projdir=$(readlink -f ${BASH_SOURCE})
projdir=${projdir%/sourceme.sh}
# setup python path
PYTHONPATH=$projdir:$PYTHONPATH
export PYTHONPATH
# find ROOT
which root-config &> /dev/null || echo "No ROOT installation found."
# setup LD_LIBRARY_PATH
LD_LIBRARY_PATH=${projdir}/GiantRootFileIO:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# if the user forgot to setup ROOT before, they can still do it after
# set +o xtrace
| true
|
3bd785374e061f4969d02b55b3b9a53b508a6ff2
|
Shell
|
stephenfowler/dotfiles
|
/setup-windows-vm.sh
|
UTF-8
| 1,615
| 3.671875
| 4
|
[] |
no_license
|
#!/bin/bash
set -e
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
echo "Setting up windows VM"
PATH_TO_VAGRANT_BOX="/Users/$SUDO_USER/src/dev_ppm"
DEV_VMX=`find $PATH_TO_VAGRANT_BOX -name '*.vmx'`
if [[ -z "$DEV_VMX" ]]; then
echo "Vagrant box not found, setting up vagrant box..."
#SUDO_USER gives the user that called this so the following can be run NOT as root
su $SUDO_USER <<EOF
vagrant box add http://artrepo.daptiv.com:8081/artifactory/api/vagrant/vagrant-local/dev_ppm
echo "Running against $PATH_TO_VAGRANT_BOX"
mkdir $PATH_TO_VAGRANT_BOX
cd $PATH_TO_VAGRANT_BOX
vagrant init dev_ppm
vagrant up
vagrant halt
EOF
fi # vagrant box install/setup
if [[ ! -e "$DEV_VMX.bak" ]]; then
echo "patching vmx with fixed ip on host only network..."
echo "backing up vmx to $DEV_VMX.bak"
cp "$DEV_VMX" "$DEV_VMX.bak"
gawk -i inplace '{
if ($1 == "ethernet0.connectiontype") { $3 = "\"nat\""; }
if ($1 == "ethernet0.displayname") { $3 = "\"NAT\""; }
if ($1 == "memsize") { $3 = "\"8192\""; }
if ($1 == "numvcpus") { $3 = "\"4\""; }
if ($1 == "mks.enable3d") { $3 = "\"TRUE\""; }
print }' "$DEV_VMX"
cat <<'END' >> "$DEV_VMX"
ethernet1.address = "00:50:56:34:3E:88"
ethernet1.virtualDev = "e1000e"
ethernet1.present = "TRUE"
ethernet1.connectionType = "hostonly"
ethernet1.addressType = "static"
ethernet1.wakeOnPcktRcv = "FALSE"
END
cat <<'VMNET1' >> "/Library/Preferences/VMWare Fusion/vmnet1/dhcpd.conf"
host ppm {
hardware ethernet 00:50:56:34:3E:88;
fixed-address 192.168.56.101;
}
VMNET1
fi
| true
|
f0639783ea1cc0ec63328e5a370d1031278e0593
|
Shell
|
xiaohesen/imagebuilder
|
/imagebuilder/3.0/openwrt-imagebuilder-ramips-mt7620/build_dir/target-mipsel_24kc_musl/root.orig-ramips/etc/init.d/glqos
|
UTF-8
| 3,915
| 2.875
| 3
|
[] |
no_license
|
#!/bin/sh /etc/rc.common
. /lib/functions.sh
. /lib/functions/network.sh
START=60
USE_PROCD=1
#delete rule
delete_rule()
{
iptables -t mangle -D PREROUTING -j QOS_UP
iptables -t mangle -F QOS_UP
iptables -t mangle -X QOS_UP
tc qdisc del dev $WANIFACE root
tc qdisc del dev $LANIFACE root
}
#add rule
add_rule()
{
iptables -t mangle -N QOS_UP
iptables -t mangle -A PREROUTING -j QOS_UP
}
get_wan_interface()
{
WANIFACE=`ip route get 8.8.8.8 | awk '{print $5}'`
[ -n "$WANIFACE" ] && return 0
WANIFACE=`uci get network.wan.ifname`
[ -n "$WANIFACE" ] && return 0
WANIFACE=`uci get network.wwan.ifname`
[ -n "$WANIFACE" ] && return 0
WANIFACE=`uci get network.tethering.ifname`
[ -n "$WANIFACE" ] && return 0
WANIFACE=`uci get network.modem.ifname`
[ -n "$WANIFACE" ] && return 0
WANIFACE=`uci get network.modem1.ifname`
}
get_lan_ip()
{
lanip=`ifconfig br-lan | grep Bcast | awk '{print $2}' | cut -f2 -d ":"`
if [ "$lanip" = "" -o "$lanip" = "" ];then
lanip=`uci get network.lan.ipaddr`
if [ "$lanip" = "" -o "$lanip" = "" ];then
lanip="192.168.8.1"
fi
fi
}
qos_func()
{
local qos=$1
local mac
local uload
local dload
local dmac1
local dmac2
config_get mac $1 "mac"
config_get uload $1 "upload"
config_get dload $1 "download"
#echo "qos=$qos mac=$mac lanip=$lanip uload=$uload dload=$dload" >/dev/console
if [ "$mac" != "" -o "$mac" != " " ];then
if [ "$addfirst" = "1" -o "$addfirst" = 1 ];then
addfirst=0
delete_rule
add_rule
#add download
$TCQD root handle 100: cbq bandwidth $DSPEED avpkt 1000
$TCCD parent 100:0 classid 100:1 cbq bandwidth $DSPEED rate $DSPEED allot 1514 weight $DSPEED prio 4 cell 8 maxburst 8 avpkt 1000 bounded
#add upload
$TCQU root handle 200: cbq bandwidth $USPEED avpkt 1000
$TCCU parent 200:0 classid 200:1 cbq bandwidth $USPEED rate $USPEED allot 1514 weight $USPEED prio 4 cell 8 maxburst 8 avpkt 1000 bounded
#add lanip rule
$TCFD parent 100:0 protocol ip prio 1 u32 match ip src $lanip flowid 100:1
$TCFU parent 200:0 protocol ip prio 1 u32 match ip src $lanip flowid 200:1
fi
i=`expr $i + 1`
mark=$i
#download set
if [ "$dload" != "" -o "$dload" != " " ];then
dmac1="0x"`echo $qos | cut -c1-4`
dmac2="0x"`echo $qos | cut -c5-12`
#echo "dmac1=$dmac1 dmac2=$dmac2 i=$i mark=$mark"
$TCCD parent 100:1 classid 100:$mark cbq bandwidth $DSPEED rate ${dload}kbps allot 1514 weight 100Kbit prio 5 cell 8 maxburst 8 avpkt 1000 bounded
$TCQD parent 100:$mark sfq quantum 1514b perturb 10
$TCFD parent 100:0 protocol ip prio 5 u32 match u16 0x0800 0xffff at -2 match u32 $dmac2 0xffffffff at -12 match u16 $dmac1 0xffff at -14 flowid 100:$mark
fi
#upload set
if [ "$uload" != "" -o "$uload" != " " ];then
$TCCU parent 200:1 classid 200:$mark cbq bandwidth $USPEED rate ${uload}kbps allot 1514 weight 100Kbit prio 5 cell 8 maxburst 8 avpkt 1000 bounded
$TCQU parent 200:$mark sfq quantum 1514b perturb 10
$TCFU parent 200:0 protocol ip prio 5 handle $mark fw classid 200:$mark
$IPT -m mac --mac-source $mac -j MARK --set-mark $mark
$IPT -m mac --mac-source $mac -j RETURN
fi
fi
}
service_triggers()
{
procd_add_reload_trigger glqos
}
start_service()
{
local DSPEED="1000Mbit"
local USPEED="1000Mbit"
local LANIFACE="br-lan"
local addfirst=1
local mark=1
local i=1
local lanip
local WANIFACE
#get current wan interface
get_wan_interface
#get lan ip
get_lan_ip
#echo "lanip=$lanip WANIFACE=$WANIFACE"
TCQD="tc qdisc add dev $LANIFACE"
TCCD="tc class add dev $LANIFACE"
TCFD="tc filter add dev $LANIFACE"
TCQU="tc qdisc add dev $WANIFACE"
TCCU="tc class add dev $WANIFACE"
TCFU="tc filter add dev $WANIFACE"
IPT="iptables -t mangle -A QOS_UP"
config_load glqos
config_foreach qos_func qos
}
stop_service()
{
local LANIFACE="br-lan"
local WANIFACE
get_wan_interface
#echo "LANIFACE=$LANIFACE WANIFACE=$WANIFACE"
delete_rule
}
| true
|
9f8efb936a16ce226d1ca29cc07d7786ecb81cba
|
Shell
|
AndreiGolovatskii/sportprog
|
/lksh2018&POST/2018-july-A-small-archive/courses/examples/colors.sh
|
UTF-8
| 298
| 3.09375
| 3
|
[] |
no_license
|
#echo -en "\033[37;1;41m Readme \033[0m"
function comment {
echo -ne "\033[32;2;40m"$1" \033[0m"
}
function comment_important {
echo -ne "\033[32;1;40m"$1" \033[0m"
}
function error {
echo -e "\033[37;1;41m $1 \033[0m"
}
comment aaaaaaaa
comment_important aaaaaaaaa
error aaaaaaaaaaaaaa
| true
|
1936051f08f7accde4e45781c8822511c290bd5b
|
Shell
|
elastic-bpm/elastic-kickstart
|
/start_test.sh
|
UTF-8
| 921
| 3.03125
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
echo Waiting for API to be ready
until $(curl --output /dev/null --silent --head --fail localhost:8080/api/running); do
printf '.'
sleep 5
done
echo Sleeping 5 minutes for machines to settle down
sleep 60
echo 1
sleep 60
echo 2
sleep 60
echo 3
sleep 60
echo 4
sleep 60
echo DONE!
echo Sending run command
curl -H "Content-Type: application/json" -X POST -d @/tmp/params.json localhost:8080/api/runTest
echo Waiting for test to finish
until $(curl --output /dev/null --silent --head --fail localhost:8080/api/testDone); do
printf '.'
sleep 5
done
sleep 5
echo Test is done, deleting workers
curl -X DELETE localhost:8080/api/docker/services/workers
sleep 5
echo Setting policy to off
curl -H "Content-Type: application/json" -X POST -d '{"policy": "Off"}' localhost:8080/api/scheduler/policy
sleep 5
echo Removing elastic-bpm
cd ~/elastic-bpm/
docker-compose down
sleep 5
echo Done
| true
|
10d7caf77a8f79ebb3da7dd110955d2c1f04d21b
|
Shell
|
henriquemoody/config.bash
|
/tests/read.bats
|
UTF-8
| 1,253
| 3.3125
| 3
|
[] |
no_license
|
#!/usr/bin/env bats
load ../source
setup()
{
cat > "${BATS_TMPDIR}/config.conf" <<EOF
Key1 ThisIsTheValue1
Key2 ThisIsTheValue2
Key-3 ThisIsTheValue3
Key_4 ThisIsTheValue4
Key5 This Is The Value 5
Key6 This Is The Value 6
# Comments Are Cool
Key6 ThisIsTheOtherValue6
EOF
}
teardown()
{
rm "${BATS_TMPDIR}/config.conf"
}
@test "Read a config" {
run config_read "${BATS_TMPDIR}/config.conf" "Key1"
[[ "${output}" = "ThisIsTheValue1" ]]
}
@test "Read a config with spaces in the begging of the ThisIsThevalue" {
run config_read "${BATS_TMPDIR}/config.conf" "Key2"
[[ "${output}" = "ThisIsTheValue2" ]]
}
@test "Read a config with '-' char in the key" {
run config_read "${BATS_TMPDIR}/config.conf" "Key-3"
[[ "${output}" = "ThisIsTheValue3" ]]
}
@test "Read a config with '_' char in the key" {
run config_read "${BATS_TMPDIR}/config.conf" "Key_4"
[[ "${output}" = "ThisIsTheValue4" ]]
}
@test "Read a config with spaces in the value" {
run config_read "${BATS_TMPDIR}/config.conf" "Key5"
[[ "${output}" = "This Is The Value 5" ]]
}
@test "Read the last config the the key repeat" {
run config_read "${BATS_TMPDIR}/config.conf" "Key6"
[[ "${output}" = "ThisIsTheOtherValue6" ]]
}
| true
|
d3feb987be6c4540b8b19f48a59149f25a619a8c
|
Shell
|
mfabian-na-at/intro.pipeline
|
/miscript.sh
|
UTF-8
| 490
| 3.203125
| 3
|
[] |
no_license
|
#!/bin/sh
# A simple script with a function
add_a_user(){
USER=$1
PASSWORD=$2
shift:shift
#Having a good time
COMMENTS=$@
echo "Adding user $USER ..."
echo useradd -c "$COMMENTS" $USER
echo passwd $USER $PASSWORD
echo "Added user" user $USER ($COMMENTS) with pass $PASSWORD
}
###
#Cuerpo del script comienza
echo "Comienza *************"
add_a_user boboddy perez boboddy stands buzinnez
add_a_user creed bratton qulity
add_a_user otro usuario como no
echo "Fin *************"
| true
|
cd06fb2ceb6c561df8d2a3a683b88b8800753e36
|
Shell
|
martong/dotfiles
|
/home/.zshrc
|
UTF-8
| 7,770
| 3.15625
| 3
|
[] |
no_license
|
# FIX FOR OH MY ZSH GIT PROMPT SLOWNESS
# http://marc-abramowitz.com/archives/2012/04/10/fix-for-oh-my-zsh-git-svn-prompt-slowness/
function git_prompt_info2() {
if [ -n "$NO_GITSTATUS" ]; then
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
else
git_prompt_info
#echo -e "$(printBranch)"
fi
}
NO_GITSTATUS="yes"
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="candy-egbomrt"
#ZSH_THEME="agnoster"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment following line if you want to shown in the command execution time stamp
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
# yyyy-mm-dd
HIST_STAMPS="yyyy-mm-dd"
autoload -U compinit
compinit
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
#plugins=(git)
#plugins=(git screen zsh-syntax-highlighting colorize per-directory-history)
# history-substring-search depends on the custom plugin zsh-syntax-highlighting,
# therefore it must be installed and loaded before history-substring-search.
plugins=(vi-mode git screen zsh-syntax-highlighting history-substring-search)
PER_DIRECTORY_HISTORY_DEFAULT_GLOBAL_HISTORY=true
source $ZSH/oh-my-zsh.sh
# User configuration
function module() {
eval `/app/modules/0/bin/modulecmd zsh "$@"`
}
# Make solarized colors applied for directories as well (ls).
eval `dircolors ~/dircolors-solarized/dircolors.ansi-universal`
# Completion from tmux pane
_tmux_pane_words() {
local expl
local -a w
if [[ -z "$TMUX_PANE" ]]; then
_message "not running inside tmux!"
return 1
fi
w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} )
_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
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
# 'ctrl-x r' will complete the N last modified (mtime) files/directories
zle -C newest-files complete-word _generic
zstyle ':completion:newest-files:*' completer _files
zstyle ':completion:newest-files:*' file-patterns '*~.*(omN[1,3])'
zstyle ':completion:newest-files:*' menu select yes
zstyle ':completion:newest-files:*' sort false
zstyle ':completion:newest-files:*' matcher-list 'b:=*' # important
function only-local-history-up () {
zle set-local-history 1
zle up-history
zle set-local-history 0
}
function only-local-history-down () {
zle set-local-history 1
zle down-history
zle set-local-history 0
}
zle -N only-local-history-up
zle -N only-local-history-down
# Custom widget to store a command line in history
# without executing it
commit-to-history() {
print -s ${(z)BUFFER}
zle send-break
}
zle -N commit-to-history
# Bindings
bindkey "^X^H" commit-to-history
bindkey "^Xh" push-line
bindkey -M viins "^X^H" commit-to-history
bindkey -M viins "^Xh" push-line
bindkey '^Xt' tmux-pane-words-prefix
bindkey '^X^X' tmux-pane-words-anywhere
bindkey -M viins '^Xt' tmux-pane-words-prefix
bindkey -M viins '^X^X' tmux-pane-words-anywhere
bindkey '^Xr' newest-files
bindkey -M viins '^Xr' newest-files
bindkey -M vicmd 'K' only-local-history-up
bindkey -M vicmd 'J' only-local-history-down
bindkey -M emacs '^P' history-substring-search-up
bindkey -M emacs '^N' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
bindkey -M vicmd '^r' redo
bindkey -M vicmd 'u' undo
bindkey -M viins 'jj' vi-cmd-mode
# Enabling vim text-objects (ciw and alike) for vi-mode
source ~/.opp.zsh/opp.zsh
source ~/.common_zsh_bash.rc
# Simpulate the delete key I got used to
real-delete-char()
{
zle vi-forward-char
zle backward-delete-char
}
zle -N real-delete-char
# Bind generic keys properly for VI-MODE.
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -A key
key[Home]=${terminfo[khome]}
key[End]=${terminfo[kend]}
key[Insert]=${terminfo[kich1]}
key[Delete]=${terminfo[kdch1]}
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
# vi cmd mode
[[ -n "${key[Home]}" ]] && bindkey -M vicmd "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -M vicmd "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -M vicmd "${key[Insert]}" vi-insert
[[ -n "${key[Delete]}" ]] && bindkey -M vicmd "${key[Delete]}" real-delete-char
[[ -n "${key[PageUp]}" ]] && bindkey -M vicmd "${key[PageUp]}" only-local-history-up
[[ -n "${key[PageDown]}" ]] && bindkey -M vicmd "${key[PageDown]}" only-local-history-down
# vi insert mode
[[ -n "${key[Home]}" ]] && bindkey -M viins "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -M viins "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -M viins "${key[Insert]}" vi-insert
[[ -n "${key[Delete]}" ]] && bindkey -M viins "${key[Delete]}" real-delete-char
[[ -n "${key[PageUp]}" ]] && bindkey -M viins "${key[PageUp]}" only-local-history-up
[[ -n "${key[PageDown]}" ]] && bindkey -M viins "${key[PageDown]}" only-local-history-down
# After entering insert mode because of hitting a or A,
# I can't backspace past the point where I entered insert mode.
# So simulate vim instead of vi in case of insert mode
bindkey -M viins "^W" backward-kill-word
bindkey -M viins "^?" backward-delete-char # Control-h also deletes the previous char
bindkey -M viins "^U" backward-kill-line
bindkey -M viins "^[a" accept-and-hold
# Shift-Tab
bindkey -M viins "^[[Z" reverse-menu-complete
nothing(){}
zle -N nothing
bindkey -M viins "é" nothing
bindkey -M viins "á" nothing
bindkey -M viins "ű" nothing
bindkey -M viins "ő" nothing
bindkey -M viins "ú" nothing
bindkey -M viins "ü" nothing
bindkey -M viins "ó" nothing
bindkey -M viins "ö" nothing
# By defult Esc is handled as a prefix, zsh waits a key after that,
# this results shit behaviour in vicmd mode.
bindkey -M vicmd "^[" nothing
# Report CPU usage for commands running longer than 10 seconds
REPORTTIME=10
# Esc does nothing in vicmd
bindkey -M vicmd "^[" nothing
# opp.zsh ~ is not vim-conform
bindkey -M vicmd '~' vi-swap-case
| true
|
aec7b02dc6f44bba5db316a66cd37704a38a7376
|
Shell
|
pkumargit/FilteredEventTrackingFile
|
/scripts/tst/c360-mdm-crosswalk-AARP.sh
|
UTF-8
| 8,140
| 3.0625
| 3
|
[] |
no_license
|
#!/bin/sh
#./home/ohcbddev/.profile
#export MAPR_TICKETFILE_LOCATION=/opt/mapr/tickets/maprticket_ohcbddev
user=$(whoami)
. /home/$user/.profile
export MAPR_TICKETFILE_LOCATION=/opt/mapr/tickets/maprticket_$user
#. /home/fstaladt/.profile
#export MAPR_TICKETFILE_LOCATION=/opt/mapr/tickets/maprticket_fstaladt
###########################################
# c360-mdm-crosswalk.sh
#
###########################################
filePrefix=C360_MDM_CROSSWALK_
fileSuffix=xml
hbase_version=1.1.8
mapr_jars_version=1710
if [ "$#" -eq 12 ]
then
jarLocation=$1
queueName=$2
crosswalkTable=$3
mdmLoadProcessTable=$4
outputLocation=$5
load=$6
EventtrackingLocation=$7
EventtrackingTable=$8
goldenrecordTable=$9
C360ReconTable=${10}
mdmc360idTable=${11}
c360crosswalkTable=${12}
else
echo "Incorrect parameters"
echo "sh c360-mdm-crosswalk.sh <jar_file_location> <queue_name> <cross_walk_table> <mdm_load_process_table> <output_location> <Load> <EventtrackingLocation>"
exit 128
fi
# following few lines will generate the mdm config file for which is used for next proc_date
#C360ReconTable=/datalake/ODM/mleccm/tst/c360/t_mtables/c360_recon_tracking_tst
#C360ReconTable=/datalake/ODM/mleccm/dev/c360/d_mtables/c360_recon_tracking_temp
echo "C360ReconTable Table:::"${C360ReconTable}
echo "goldenrecordTable Table:::"${goldenrecordTable}
echo "Lookup Table:::"${mdmc360idTable}
echo "Croswalk c360 Table:::"${c360crosswalkTable}
echo ${C360ReconTable}
day_of_week=`date +%u`
if [ ${day_of_week} -eq 5 ]
then
date_val=`date -d "+3 days" +"%Y%m%d"`
else
date_val=`date -d "+1 days" +"%Y%m%d"`
fi
date_val=`date -d "+0 days" +"%Y%m%d%H%M%S%3N"`
partialPath=`echo ${outputLocation} | cut -d "/" -f1-10`
outputPath="${partialPath}/proc_date=${date_val}"
outputLocation=${outputPath}
echo outputLocation=${outputLocation}
#/mapr/datalake/ODM/mleccm/dev/c360/d_config/context/dev/mdm_config_param_date.txt
#/mapr/datalake/ODM/mleccm/dev/c360/d_scripts/jars
#/mapr/datalake/ODM/mleccm/dev/c360/d_scripts/jars/../../*_config/context
env_word=`echo "${jarLocation}" | cut -d "/" -f5`
if [ "$env_word"x = "dev_631x" ]
then
env_letter=d
elif [ "$env_word"x = "tst_631x" ]
then
env_letter=t
elif [ "$env_word"x = "prd_631x" ]
then
env_letter=p
elif [ "$env_word"x = "stg_631x" ]
then
env_letter=s
fi
file_name=/mapr${jarLocation}/../../${env_letter}_config/context/tst/mdm_config_param_date.txt
echo "param_date=${date_val}" > ${file_name}
echo "query_run_param_date=${date_val} 00:00:00" >> ${file_name}
export HADOOP_CLASSPATH=`/opt/mapr/hbase/hbase-${hbase_version}/bin/hbase classpath`
export LIBJARS=/mapr${jarLocation}/ecm-1.0-SNAPSHOT-crosswalk-v11_00.jar,/mapr${jarLocation}/jaxb2-basics-runtime-0.11.0.jar,/opt/mapr/hbase/hbase-${hbase_version}/lib/hbase-client-${hbase_version}-mapr-${mapr_jars_version}.jar,/opt/mapr/hbase/hbase-${hbase_version}/lib/hbase-common-${hbase_version}-mapr-${mapr_jars_version}.jar,/opt/mapr/hbase/hbase-${hbase_version}/lib/hbase-server-${hbase_version}-mapr-${mapr_jars_version}.jar
export numberOfReducersE=20
#-D mapred.reduce.tasks=${numberOfReducers}
####To extract from EVENTRACKING Table-UNLOCK
hadoop jar /mapr${jarLocation}/c360-mdm-crosswalk-xml-0.0.1-SNAPSHOT.jar -Dmapreduce.job.queuename=${queueName} -Dmapreduce.job.acl-view-job=* -D mapred.reduce.tasks=${numberOfReducersE} -D mdm.load.process.table=${mdmLoadProcessTable} -D mdm.goldenrecord.table=${goldenrecordTable} -D crosswalk.table=${crosswalkTable} -D mdm.event.tracking.table=${EventtrackingTable} -D load=${load} -libjars ${LIBJARS} EVENTTRACKING ${outputLocation} ${EventtrackingLocation}
if [ $? -ne 0 ]
then
echo mdm Eventracking read job failed.
exit 13
fi
splitSize_Active=1000000
splitSize=100000
reducerSize=`expr ${splitSize} \* 2`
inputFileSizeInBytes=`hadoop fs -du -s ${EventtrackingLocation} | cut -d ' ' -f1`
numberOfReducers=20
#numberOfReducers=`expr ${inputFileSizeInBytes} / ${reducerSize}`
#if [ ${numberOfReducers} -eq 0 ]
#then
# numberOfReducers=1
#fi
##########FILTERED EVENT TRACKING FILE
hadoop jar /mapr${jarLocation}/FilteredEventTrackingFile-0.0.1-SNAPSHOT.jar com.optum.c360.filtered.event.tracking.FilteredEventTrackingFileJob -Dmapreduce.map.memory.mb=5120 -Dmapreduce.map.java.opts=-Xmx4096m -Dmapreduce.job.acl-view-job=* -Dmapred.max.split.size=${splitSize} -libjars ${LIBJARS} FILTEREVENTTRACKINGFILE ${EventtrackingLocation} /datalake/ODM/mleccm/tst_631/cr3_mdm/t_outbound/epmp/event_tracking_filtered ${queueName}
if [ $? -ne 0 ]
then
echo FILTERED EVENT TRACKING FILE job failed.
exit 13
else
echo FILTERED EVENT TRACKING FILE job success.
cd /mapr/datalake/ODM/mleccm/tst_631/cr3_mdm/t_outbound/epmp/event_tracking_filtered
find . -name 'part*' -size 0 -delete
#rm _SUCCESS
fi
########NEW CODE
echo "Here in new code"
#######UNLOCK
hadoop jar /mapr${jarLocation}/c360-mdm-crosswalk-xml-0.0.1-SNAPSHOT.jar -Dmapreduce.job.queuename=${queueName} -Dmapreduce.job.acl-view-job=* -D mdm.eventtracking.path=/datalake/ODM/mleccm/tst_631/cr3_mdm/t_outbound/epmp/event_tracking_filtered -D mdm.goldenrecord.table=${goldenrecordTable} -Dmapred.max.split.size=${splitSize} -libjars ${LIBJARS} DELETEINDICATORSTATUS
if [ $? -ne 0 ]
then
echo mdm DELETEINDICATORSTATUS read job failed.
exit 13
fi
hadoop jar /mapr${jarLocation}/c360-mdm-crosswalk-xml-0.0.1-SNAPSHOT.jar -Dmapreduce.job.queuename=${queueName} -Dmapreduce.job.acl-view-job=* -D mdm.eventtracking.path=/datalake/ODM/mleccm/tst_631/cr3_mdm/t_outbound/epmp/event_tracking_filtered -D mdm.c360id.load.table=${mdmc360idTable} -Dmapreduce.map.memory.mb=5120 -Dmapreduce.reduce.memory.mb=5120 -Dmapreduce.map.java.opts=-Xmx4096m -Dmapreduce.reduce.java.opts=-Xmx4096m -D mdm.c360.crosswalk.table=${c360crosswalkTable} -D mdm.load.process.table=${mdmLoadProcessTable} -D crosswalk.table=${crosswalkTable} -D mdm.event.tracking.table=${EventtrackingTable} -D c360.recon.table=${C360ReconTable} -Dmapred.max.split.size=${splitSize} -libjars ${LIBJARS} C360INACTIVECROSSWALKLOAD ${outputLocation}
if [ $? -ne 0 ]
then
echo mdm C360INACTIVECROSSWALKLOAD read job failed.
exit 13
fi
#######UNLOCK
hadoop jar /mapr${jarLocation}/c360-mdm-crosswalk-xml-0.0.1-SNAPSHOT.jar -Dmapreduce.map.memory.mb=5120 -Dmapreduce.reduce.memory.mb=5120 -Dmapreduce.map.java.opts=-Xmx4096m -Dmapreduce.reduce.java.opts=-Xmx4096m -Dmapreduce.job.queuename=${queueName} -Dmapreduce.job.acl-view-job=* -Dmapred.max.split.size=${splitSize} -D mdm.c360id.load.table=${mdmc360idTable} -D mdm.eventtracking.path=/datalake/ODM/mleccm/tst_631/cr3_mdm/t_outbound/epmp/event_tracking_filtered -D mdm.c360.crosswalk.table=${c360crosswalkTable} -D mdm.load.process.table=${mdmLoadProcessTable} -D crosswalk.table=${crosswalkTable} -D mdm.event.tracking.table=${EventtrackingTable} -D c360.recon.table=${C360ReconTable} -libjars ${LIBJARS} C360ACTIVECROSSWALKLOAD
#-Dmapred.max.split.size=${splitSize_Active}
if [ $? -ne 0 ]
then
echo mdm C360ACTIVECROSSWALKLOAD read job failed.
exit 13
else
cd /mapr/datalake/ODM/mleccm/tst_631/cr3_mdm/t_outbound/epmp/event_tracking_filtered
find . -name 'part*' -size 0 -delete
#rm _SUCCESS
fi
##########CROSWWALK
#####UNLOCK
#hadoop jar /mapr${jarLocation}/c360-mdm-crosswalk-xml-0.0.1-SNAPSHOT.jar -Dmapreduce.map.memory.mb=5120 -Dmapreduce.reduce.memory.mb=5120 -Dmapreduce.map.java.opts=-Xmx4096m -Dmapreduce.reduce.java.opts=-Xmx4096m -Dmapreduce.job.acl-view-job=* -D mapred.reduce.tasks=${numberOfReducers} -D mdm.load.process.table=${mdmLoadProcessTable} -D crosswalk.table=${crosswalkTable} -D mdm.c360.crosswalk.table=${c360crosswalkTable} -D mdm.event.tracking.table=${EventtrackingTable} -D c360.recon.table=${C360ReconTable} -D load=${load} -Dmapred.max.split.size=${splitSize} -libjars ${LIBJARS} CROSSWALK ${outputLocation} ${EventtrackingLocation} ${queueName}
#if [ $? -ne 0 ]
#then
#echo mdm crosswalk job failed.
#exit 13
#else
#echo mdm crosswalk job sucess.
#cd /mapr${outputLocation}
#find . -name 'part*' -size 0 -delete
#ctr=0
#for fileName in part*
#do
#echo "file - ${fileName} ${filePrefix}${ctr}.${fileSuffix}"
# mv ${fileName} ${filePrefix}${ctr}.${fileSuffix}
#ctr=$((ctr + 1))
#done
#rm _SUCCESS
#fi
| true
|
680b93815d33282dd525db007d44fc06ff28c706
|
Shell
|
jkeroes/dotphiles
|
/git/hooks/cookbooks-pre-commit
|
UTF-8
| 1,938
| 4.03125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Because I was having trouble getting trap to play nicely with any signal except
# EXIT we just carry around our status and exit with it at the end
status=0
cookbook_name=`grep url .git/config |awk -F "cookbooks/" '{print $2}'`
function knife_test() {
local grep_code=0
echo "Testing Cookbook ($cookbook_name) Syntax with Knife..."
# Use egrep to limit to just error lines (stderr not respected by knife)
# Should just include lines with FATAL and
knife cookbook test $cookbook_name | grep_code=0
if [ "${grep_code}" == "0" ]
then
echo "Failed!..."
status=1
exit
else
echo
echo "Ok!..."
fi
return
}
function version_check() {
echo "Making sure your version does not exist on chef servers";
for loc in `cat ~/.chef/chef-server-locations`
do
knife cookbook show $cookbook_name -c ~/.chef/knife-$loc-ndn.rb 2>&1
if [ $? -gt 0 ]; then
continue
fi
echo "$cookbook_name exists on $loc, checking to make sure version does not exist.."
knife cookbook show $cookbook_name -c ~/.chef/knife-$loc-ndn.rb 2>&1
if [ $? -gt 0 ]; then
echo "ERROR: version exists on $loc.chef.dreamhost.com"
status=1
fi
done
}
function foodcritic_test() {
echo "Using Foodcritic to lint our cookbooks..."
# Stricter Etsy rules included w/ autofail
# foodcritic -t any -f any -I foodcritic-rules/rules.rb cookbooks/
foodcritic .
if [ "$?" != "0" ]
then
echo "Failed!..."
status=1
exit
else
echo "Ok!..."
fi
return
}
function rspec_test() {
echo "Running Rspec on yipit cookbooks..."
rspec *
if [ "$?" != "0" ]
then
echo "Failed!..."
status=1
exit
fi
return
}
# Check for syntax errors
knife_test
version_check
#rspec_test
if [ "$status" = "1" ]
then
echo "CHECKS FAILED, YOUR DOING IT WRONG"
fi
exit ${status}
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.