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
96053ec3d111376949b86a05dfcc8a51c8e85962
Shell
thsur/devops-eco
/ansible/roles/custom/init-projects/templates/watch-modules.sh.j2
UTF-8
402
3.171875
3
[]
no_license
#!/usr/bin/bash cd {{ project_sync_dir }} inotifywait -r -e close_write,moved_to,create -m {{ current_host.config.watch.modules | default('sites/all/modules/') }} | while read -r dir events file; do source=${dir}${file} target="{{ www_dir }}/{{ project }}/$dir" echo "Source: $source" echo "Target: $target" rsync -avz $source {{ current_host.name }}:$target done cd -
true
7e9eeec3edcd86180c9cc4f02ba6ebb0d0243d17
Shell
petronny/aur3-mirror
/wanderlust-git/PKGBUILD
UTF-8
1,363
2.625
3
[]
no_license
# Maintainer: Chirantan Ekbote <chirantan.ekbote at gmail.com> pkgname=wanderlust-git pkgver=0.4264.e53d797 pkgrel=1 pkgdesc="Mail/News reader supporting IMAP4rev1 for emacs" url="https://github.com/ikazuhiro/wanderlust" arch=('any') license=('GPL') depends=('pacman>=4.1' 'emacs' 'emacs-apel' 'flim' 'semi') makedepends=('bbdb' 'git') optdepends=('bbdb: contact management utility') provides=('wanderlust') conflicts=('wanderlust') install=wanderlust.install changelog=CHANGELOG source=("git://github.com/ikazuhiro/wanderlust" "wanderlust-sleep.service") md5sums=('SKIP' '75d61275ba94202c3ac263bd02d574d3') _pixmapdir=/usr/share/emacs/$(emacs -batch -eval "(princ (format \"%d.%d\" emacs-major-version emacs-minor-version))")/etc/wl/icons/ _lispdir=/usr/share/emacs/site-lisp _infodir=/usr/share/info pkgver() { cd 'wanderlust' echo "0.$(git rev-list --count HEAD).$(git describe --always)" } build() { make -C wanderlust all info \ PIXMAPDIR="$_pixmapdir" \ INFODIR=$_infodir \ LISPDIR=$_lispdir } package() { install -dm0755 "$pkgdir$_infodir" make -C wanderlust install install-info \ LISPDIR="$pkgdir$_lispdir" \ PIXMAPDIR="$pkgdir$_pixmapdir" \ INFODIR="$pkgdir$_infodir" install -m644 wanderlust/utils/ssl.el "$pkgdir/usr/share/emacs/site-lisp/ssl.el" install -Dm644 wanderlust-sleep.service "$pkgdir/usr/lib/systemd/system/wanderlust-sleep.service" }
true
3c54b6f707e0eaa725b0a06c0bfc4a8d20869747
Shell
23prime/mikutter
/mikutter
UTF-8
463
3.234375
3
[ "CC-BY-SA-3.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/bin/sh -eu DIR=~/develop/mikutter/ cd $DIR bundle exec ruby mikutter.rb & while true; do RSS=$(ps aux | grep ruby | grep mikutter | awk '{print $6}') PID=$(ps aux | grep ruby | grep mikutter | awk '{print $2}') echo "RSS: $RSS" echo "PID: $PID" if [ -z $RSS ]; then exit 0 elif [ $RSS -gt 3000000 ]; then cd $DIR bundle exec ruby mikutter.rb & kill $PID else : fi sleep 60 done
true
fdd8c47436baa09542945648718ab40c128e5c80
Shell
vagom/tools
/pkgs/ti-omapconf.sh
UTF-8
904
3.609375
4
[]
no_license
#!/bin/bash -e network_down () { echo "Network Down" exit } ping -c1 www.google.com | grep ttl &> /dev/null || network_down unset deb_pkgs dpkg -l | grep build-essential >/dev/null || deb_pkgs+="build-essential " if [ "${deb_pkgs}" ] ; then echo "Installing: ${deb_pkgs}" sudo apt-get update sudo apt-get -y install ${deb_pkgs} fi git_sha="origin/master" project="omapconf" server="git://github.com/omapconf" if [ ! -f ${HOME}/git/${project}/.git/config ] ; then git clone ${server}/${project}.git ${HOME}/git/${project}/ fi if [ ! -f ${HOME}/git/${project}/.git/config ] ; then rm -rf ${HOME}/git/${project}/ || true echo "error: git failure, try re-runing" exit fi cd ${HOME}/git/${project}/ git checkout master -f git pull || true git branch ${git_sha}-build -D || true git checkout ${git_sha} -b ${git_sha}-build make CROSS_COMPILE= sudo make DESTDIR=/usr/sbin install make clean
true
1580d424509707a64b69341c8a76270f97133e86
Shell
ZengFLab/PyroTools
/xgsutils/asmutils/xAssemblyContigN50
UTF-8
1,734
4.09375
4
[]
no_license
#!/bin/bash # check environment variable BIOINFO_TOOL_XGSUTILS is already set # http://stackoverflow.com/questions/11686208/check-if-environment-variable-is-already-set xgsutils_exist=`env | awk '/^BIOINFO_TOOL_XGSUTILS=/{print 1}'` if [ -z "$xgsutils_exist" ] then BIOINFO_TOOL_XGSUTILS=/Users/fengzeng/tool/xgsutils fi # help message help(){ >&2 echo "SYNOPSIS" >&2 echo " xAssemblyContigN50 <FASTA_FILE>" >&2 echo "" >&2 echo "DESCRIPTION" >&2 echo " Compute the N50 statistics of the assembled contigs" >&2 echo "" >&2 echo "OPTIONS" >&2 echo " -h,--help print help message" exit 0 } # print help message if no arguments provided if [ "$#" = 0 ];then help;fi # set command argument parser PARSED_OPTIONS=$(getopt -n "$0" -o h --long help -- "$@") # bad argument if [ $? -ne 0 ];then help;fi # A little magic, necessary when using getopt eval set -- "$PARSED_OPTIONS" # parse arguments while true;do case "$1" in -h | --help ) help shift;; -- ) shift break;; esac done fastaFile=$1 # check the existence of the fasta file if [ ! -f $fastaFile ];then echo -e "file $fastaFile not existed;\nabort";exit;fi # compute the sum of the lengths of assembly contigs totalLength=$($BIOINFO_TOOL_XGSUTILS/faxutils/xFastaSequenceLength $fastaFile | awk '{n=n+$2}END{print n}') halfLength=$(( totalLength / 2 )) # compute the length of the largest contig largestLength=$($BIOINFO_TOOL_XGSUTILS/faxutils/xFastaSequenceLength $fastaFile | awk 'NR==1{print $2}') # compute N50 $BIOINFO_TOOL_XGSUTILS/faxutils/xFastaSequenceLength $fastaFile | sort -rn -k2,2 | awk -v tl="$halfLength" -v xl="$largestLength" '{if(l<=tl && l+$2>=tl){x=$2+xl;x=x/2;print x}l=l+$2;xl=$2}'
true
ee2c2cad17b3af266c41a452cf47810d5eef3692
Shell
Tang111111/lab_2
/practice.sh
UTF-8
313
3.234375
3
[]
no_license
#!/bin/bash #Author:Weiyao Tang #Date:01/31/2019 #Script follows here: echo "Enter a number:" read numOne echo "Enter a second number" read numTwo sum=$(($numOne+$numTwo)) echo "The sum is : $sum" let prod=numOne*numTwo echo "The product is :$prod" echo "File Name: $0" echo "Command Line Argument 1:$1" grep $1 $2
true
c947b8f6d8b4879c968a0fe20afa72d5134ba285
Shell
dovetail-lab/fabric-operation
/network/network-util.sh
UTF-8
14,282
3.34375
3
[ "BSD-3-Clause" ]
permissive
#!/bin/bash # Copyright © 2018. TIBCO Software Inc. # # This file is subject to the license terms contained # in the license file that is distributed with this file. # createChannel <channel> function createChannel { echo "check if channel ${1} exists" peer channel fetch oldest ${1}.pb -c ${1} -o ${ORDERER_URL} --tls --cafile $ORDERER_CA if [ "$?" -ne 0 ]; then echo "create channel ${1} ..." if [ -f "${1}.tx" ]; then peer channel create -c ${1} -f ${1}.tx --outputBlock ${1}.pb -o ${ORDERER_URL} --tls --cafile $ORDERER_CA else echo "Error: cannot find file ${1}.tx. must create it using msp-util.sh first." return 1 fi else echo "channel ${1} already exists" fi } # joinChannel <peer> <channel> [anchor] function joinChannel { echo "check if channel ${2} exists, must start from genesis block to join channel" peer channel fetch oldest ${2}.pb -c ${2} -o ${ORDERER_URL} --tls --cafile $ORDERER_CA if [ "$?" -ne 0 ]; then echo "Error: channel ${2} does not exist, must create it first" return 1 fi local _env="CORE_PEER_ADDRESS=${1}.${FABRIC_ORG}:7051 CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/crypto/peers/${1}/tls/ca.crt" if [ ! -z "${SVC_DOMAIN}" ]; then _env="CORE_PEER_ADDRESS=${1}.peer.${SVC_DOMAIN}:7051 CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/crypto/peers/${1}/tls/ca.crt" fi echo "check if ${1} joined channel ${2}" eval "${_env} peer channel getinfo -c ${2}" if [ "$?" -ne 0 ]; then echo "${1} join channel ${2} ..." eval "${_env} peer channel join -b ${2}.pb" else echo "peer ${1} already joined channel ${2}" fi if [ "${3}" == "anchor" ]; then echo "update anchor peer for channel ${2} ..." eval "${_env} peer channel update -o ${ORDERER_URL} -c ${2} -f ${2}-anchors-${CORE_PEER_LOCALMSPID}.tx --tls --cafile $ORDERER_CA" fi } # packageChaincode <name> <version> <lang> # write chaincode package as name_version.tar.gz # read source folder from ./chaincode/<name> function packageChaincode { local _src=${PWD}/chaincode/${1} peer lifecycle chaincode package ${1}_${2}.tar.gz --path ${_src} --lang ${3} --label ${1}_${2} echo "output packaged file: ${PWD}/${1}_${2}.tar.gz" } # installChaincode <peer> <cc_package_file> function installChaincode { if [ ! -f "${2}" ]; then echo "cc package file does not exist: ${2}. must call 'package-chaincode' first" return 1 fi local _env="CORE_PEER_ADDRESS=${1}.${FABRIC_ORG}:7051 CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/crypto/peers/${1}/tls/ca.crt" if [ ! -z "${SVC_DOMAIN}" ]; then _env="CORE_PEER_ADDRESS=${1}.peer.${SVC_DOMAIN}:7051 CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/crypto/peers/${1}/tls/ca.crt" fi eval "${_env} peer lifecycle chaincode install ${2}" } # approve chaincode <channel> <pakage-id> <cc-name> <cc-version> <cc-seq> [<collection-config> [<policy>]] function approveChaincode { local _collConfig="" if [ ! -z "${6}" ]; then _collConfig="--collections-config ${6}" fi local _policy="" if [ ! -z "${7}" ]; then _policy="--signature-policy \"${7}\"" fi echo "approve chaincode $@" peer lifecycle chaincode approveformyorg -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} -C ${1} --package-id ${2} -n ${3} -v ${4} --sequence ${5} ${_collConfig} ${_policy} } # commit chaincode <channel> <cc-name> <cc-version> <cc-seq> <collection-config> <policy> <peerParams> function commitChaincode { local _collConfig="" if [ ! -z "${5}" ]; then _collConfig="--collections-config ${5}" fi local _policy="" if [ ! -z "${6}" ]; then _policy="--signature-policy \"${6}\"" fi echo "check commit readiness $@" peer lifecycle chaincode checkcommitreadiness -C ${1} -n ${2} -v ${3} --sequence ${4} ${_collConfig} ${_policy} --output json echo "commit chaincode $@" peer lifecycle chaincode commit -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} -C ${1} -n ${2} -v ${3} --sequence ${4} ${7} ${_collConfig} ${_policy} } # queryChaincode <peer> <channel> <name> <args> function queryChaincode { local _env="CORE_PEER_ADDRESS=${1}.${FABRIC_ORG}:7051 CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/crypto/peers/${1}/tls/ca.crt" if [ ! -z "${SVC_DOMAIN}" ]; then _env="CORE_PEER_ADDRESS=${1}.peer.${SVC_DOMAIN}:7051 CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/crypto/peers/${1}/tls/ca.crt" fi local _args=''${4}'' eval "${_env} peer chaincode query -C ${2} -n ${3} -c '${_args}'" } # invokeChaincode <channel> <name> <args> <peerParams> function invokeChaincode { echo "invoke chaincode $@" peer chaincode invoke -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} ${4} -C ${1} -n ${2} -c ''${3}'' } # create and sign channel update tx for adding a new org to a channel # assuming the input config file <new-msp>.json is already in the CLI working directory # output signed tx file for channel update is written in working drectory as <channel>-<msp>.pb # addOrg <new-msp> <channel> function addOrg { # fetch the last block of channel config to add new org peer channel fetch config ${2}-config.pb -c ${2} -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} configtxlator proto_decode --input ${2}-config.pb --type common.Block | jq .data.data[0].payload.data.config > ${2}-config.json # insert new msp into application.groups if [ -f "${1}.json" ]; then jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"'${1}'":.[1]}}}}}' ${2}-config.json ${1}.json > ${2}-modified.json else echo "cannot find MSP config - ${1}.json. create it using msp-util.sh before continue" return 1 fi # calculate pb diff configtxlator proto_encode --input ${2}-config.json --type common.Config --output ${2}-config.pb configtxlator proto_encode --input ${2}-modified.json --type common.Config --output ${2}-modified.pb configtxlator compute_update --channel_id ${2} --original ${2}-config.pb --updated ${2}-modified.pb --output ${2}-update.pb local dif=$(wc -c "${2}-update.pb" | awk '{print $1}') if [ "${dif}" -eq 0 ]; then echo "${1} had already been added to ${2}. no update is required" return 1 fi # construct update with re-attached envelope configtxlator proto_decode --input ${2}-update.pb --type common.ConfigUpdate | jq . > ${2}-update.json echo '{"payload":{"header":{"channel_header":{"channel_id":"'${2}'", "type":2}},"data":{"config_update":'$(cat ${2}-update.json)'}}}' | jq . > ${2}-${1}.json configtxlator proto_encode --input ${2}-${1}.json --type common.Envelope --output ${2}-${1}.pb peer channel signconfigtx -f ${2}-${1}.pb echo "created and signed channel update tx file: ${2}-${1}.pb" } # printOrdererConfig <start-seq> [<end-seq>] function printOrdererConfig { echo "{ \"consenters\": [" local seq=${1:-"0"} local max=${2:-"0"} if [ ${seq} -gt 0 ] && [ ${max} -eq 0 ]; then max=$((${seq}+1)) fi until [ "${seq}" -ge "${max}" ]; do local orderer="orderer-${seq}" seq=$((${seq}+1)) echo " {" printConcenterConfig ${orderer} if [ "${seq}" -eq "${max}" ]; then echo " }" else echo " }," fi done echo " ], \"addresses\": [" local seq=${1:-"0"} until [ "${seq}" -ge "${max}" ]; do local orderer="orderer-${seq}" seq=$((${seq}+1)) if [ "${seq}" -eq "${max}" ]; then echo " \"${orderer}.orderer.${SVC_DOMAIN}:7050\"" else echo " \"${orderer}.orderer.${SVC_DOMAIN}:7050\"," fi done echo " ] }" } # printConcenterConfig <orderer> function printConcenterConfig { local o_cert=./crypto/orderers/${1}/tls/server.crt if [ ! -f "${o_cert}" ]; then echo "Error; orderer cert does not exist: ${o_cert}" exit 1 else local crt=$(cat ${o_cert} | base64 | tr -d \\n) echo " \"client_tls_cert\": \"${crt}\", \"host\": \"${1}.orderer.${SVC_DOMAIN}\", \"port\": 7050, \"server_tls_cert\": \"${crt}\"" fi } # addOrderer <orderer-seq> [<sys-channel>] function addOrderer { if [ -z "${SVC_DOMAIN}" ]; then echo "add-orderer is supported for Kubernetes only" exit 1 fi local chan=${2:-"${SYS_CHANNEL}"} local ordConfig=ordererConfig-${1}.json if [ ! -f ${ordConfig} ]; then printOrdererConfig ${1} > ${ordConfig} fi # fetch last block of sys-channel config to add new orderer node peer channel fetch config ${chan}-config.pb -c ${chan} -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} configtxlator proto_decode --input ${chan}-config.pb --type common.Block | jq .data.data[0].payload.data.config > ${chan}-config.json # insert new consensters local addrs=$(cat ${ordConfig} | jq .addresses | tr '\n' ' ') local cons=$(cat ${ordConfig} | jq .consenters | tr '\n' ' ') cat ${chan}-config.json | jq '.channel_group.values.OrdererAddresses.value.addresses += '"${addrs}"'' | jq '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += '"${cons}"'' > ${chan}-config-modified.json # calculate pb diff configtxlator proto_encode --input ${chan}-config.json --type common.Config --output ${chan}-config.pb configtxlator proto_encode --input ${chan}-config-modified.json --type common.Config --output ${chan}-config-modified.pb configtxlator compute_update --channel_id ${chan} --original ${chan}-config.pb --updated ${chan}-config-modified.pb --output ${chan}-config-update.pb local dif=$(wc -c "${chan}-config-update.pb" | awk '{print $1}') if [ "${dif}" -eq 0 ]; then echo "no more update is required" return 1 fi # construct update with re-attached envelope configtxlator proto_decode --input ${chan}-config-update.pb --type common.ConfigUpdate | jq . > ${chan}-config-update.json echo '{"payload":{"header":{"channel_header":{"channel_id":"'${chan}'", "type":2}},"data":{"config_update":'$(cat ${chan}-config-update.json)'}}}' | jq . > ${chan}-update.json configtxlator proto_encode --input ${chan}-update.json --type common.Envelope --output ${chan}-update.pb echo "created sys channel update file ${chan}-update.pb" peer channel update -f ${chan}-update.pb -c ${chan} -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} echo "updated channel ${chan}" } # Print the usage message function printUsage { echo "Usage: " echo " network-util.sh <cmd> <args>" echo " <cmd> - one of the following commands:" echo " - 'test' (default) - smoke test using a test channel and chaincode" echo " - 'create-channel' - create a channel using peer-0, <args> = <channel>" echo " - 'join-channel' - join a peer to a channel, <args> = <peer> <channel> [anchor]" echo " e.g., network-util.sh join-channel \"peer-0\" \"mychannel\" anchor" echo " - 'package-chaincode' - package chaincode, <args> = <name> <version> <lang>" echo " e.g., network-util.sh package-chaincode \"mycc\" \"1.0\" \"golang\"" echo " - 'install-chaincode' - install chaincode on a peer, <args> = <peer> <cc_package-file>" echo " e.g., network-util.sh install-chaincode \"peer-0\" \"mycc_1.0.tar.gz\"" echo " - 'approve-chaincode' - approve chaincode package for a channel, <args> = <channel> <pakage-id> <cc-name> <cc-version> <cc-seq> [<collection-config> [<policy>]]" echo " e.g., network-util.sh approve-chaincode \"mychannel\" \"mycc_1.0:abcd\" \"mycc\" \"1.0\" \"1\" \"golang\"" echo " - 'commit-chaincode' - commit chaincode package for a channel, <args> = <channel> <cc-name> <cc-version> <cc-seq> <collection-config> <policy> <peerParams>" echo " e.g., network-util.sh ommit-chaincode \"mychannel\" \"mycc\" \"1.0\" \"1\" \"golang\" \"\" \"\" \"--peerAddresses ...\"" echo " - 'query-chaincode' - query chaincode from a peer, <args> = <peer> <channel> <name> <args>" echo " e.g., network-util.sh query-chaincode \"peer-0\" \"mychannel\" \"mycc\" '{\"Args\":[\"query\",\"a\"]}'" echo " - 'invoke-chaincode' - invoke chaincode on one or more orgs, <args> = <channel> <name> <args> <peerParams>" echo " e.g., network-util.sh invoke-chaincode \"mychannel\" \"mycc\" '{\"Args\":[\"invoke\",\"a\",\"b\",\"10\"]}' \"--peerAddresses ...\"" echo " - 'add-orderer' - update sys-channel to add a new orderer node for RAFT consensus, <args> = <orderer-seq> [<sys-channel>]" echo " - 'add-org-tx' - generate update tx for add new msp to a channel, <args> = <new-msp> <channel>" echo " - 'sign-transaction' - sign a config update transaction file in the CLI working directory, <args> = <tx-file>" echo " e.g., network-util.sh sign-transaction \"mychannel-org3MSP.pb\"" echo " - 'update-channel' - send transaction to update a channel, <args> = <tx-file> <channel>" echo " e.g., network-util.sh update-channel \"mychannel-org3MSP.pb\" mychannel" } CMD=${1:-"test"} shift ARGS="$@" case "${CMD}" in test) echo "network smoke test" test ${ARGS} ;; create-channel) echo "create channel [ ${ARGS} ]" createChannel ${ARGS} ;; join-channel) echo "join channel [ ${ARGS} ]" joinChannel ${ARGS} ;; package-chaincode) echo "package chaincode [ ${ARGS} ]" packageChaincode ${ARGS} ;; install-chaincode) echo "install chaincode [ ${ARGS} ]" installChaincode ${ARGS} ;; approve-chaincode) echo "approve chaincode [ ${ARGS} ]" approveChaincode ${1} ${2} ${3} ${4} ${5} "${6}" "${7}" ;; commit-chaincode) echo "commit chaincode [ ${ARGS} ]" commitChaincode ${1} ${2} ${3} ${4} "${5}" "${6}" "${7}" ;; query-chaincode) echo "query chaincode [ ${ARGS} ]" queryChaincode ${1} ${2} ${3} ''${4}'' ;; invoke-chaincode) echo "invoke chaincode [ ${ARGS} ]" invokeChaincode ${1} ${2} ''${3}'' "${4}" ;; add-org-tx) echo "generate update tx to new msp to a channel [ ${ARGS} ]" addOrg ${ARGS} ;; add-orderer) echo "update sys-channel to add a new orderer node for RAFT consensus [ ${ARGS} ]" addOrderer ${ARGS} ;; update-channel) if [ ! -f "${1}" ]; then echo "cannot find the transaction file ${1}" exit 1 fi echo "send transaction ${1} to update channel ${2}" peer channel update -f ${1} -c ${2} -o ${ORDERER_URL} --tls --cafile ${ORDERER_CA} ;; sign-transaction) if [ ! -f "${1}" ]; then echo "cannot find the transaction file ${1}" exit 1 fi echo "sign transaction ${1}" peer channel signconfigtx -f ${1} ;; *) printUsage exit 1 esac
true
0dc7ce85c58346f0ff66af8f929aea896fc62164
Shell
mwcraig/feder_image_shuffle
/OLD_Scripts/data_tree_reorganization.sh
UTF-8
5,973
4.375
4
[]
no_license
#!/bin/bash # check and process arguments if [[ $# != 1 ]]; then echo 'The script requires one argument: the name of the root directory of the data tree' echo 'On physics this root is /data/feder' exit 1 fi data_root=$1 ##### FUNCTION DEFINTITIONS # function to color code text output color_text () { endColor=$'\e[0m' color=$1 msg=$2 case $1 in "red" ) startColor=$'\e[1;31m' ;; "green" ) startColor=$'\e[32m' ;; "blue" ) startColor=$'\e[1;34m' ;; * ) echo "I do not know the color $1" exit 1 ;; esac result="$startColor$msg$endColor" echo -e $result } # function to set permissions on newly created directories set_write_permissions () { directory=$1 # this $1 is the first argument to the function, not the first command line arg... chown :feder $directory || color_text red "Group ownership of directory $directory not changed (should be feder group)" chmod ug+w $directory || color_text red "User+group write permissions of directory $directory not changed (should be ug+w)" chmod o-w $directory || color_text red "Other write permissions of directory $directory not changed (should be o-w)" } # makes declaring a win easier... success () { color_text green " Succeeded" } #### END FUNCTION DEFITIONS #### CHECK WHETHER THE DATA ROOT IS ONE OF THE SACRED_PATHS # Any paths list as part of sacred_paths will be checked against $data_root # if there is a match, the script aborts sacred_roots="/home/faculty/matt.craig/sacred /Users/matthewcraig/sacred" for path in $sacred_roots; do if [[ "$data_root" -ef "$path" ]]; then color_text red "I REFUSE TO TOUCH ACTUAL DATA DIRECTORIES RIGHT NOW" exit 1 fi done ### BEGIN IMPLEMENTATION OF ACTUAL DATA MOVEMENT # implement item 1 from email: # # Remove the folder /feder/data/perham [contains reduced images related to an outreach project a couple years ago.] color_text blue "Attempting to remove perham directory" rm -rf $data_root/perham && success || color_text red "Unable to remove perham directory" # implement item 2 from email: # # Archive then remove the folder /data/feder/field-trips and download # Archive... field_trip_dir_name=field-trips field_trips=$data_root/$field_trip_dir_name color_text blue "Archiving directory $field_trips" pushd $data_root && ( tar czf $data_root/field-trips.tgz $field_trip_dir_name && success || color_text red "Archive of field-trips not created" ) && popd color_text blue "Removing directory $field_trips" rm -rf $field_trips && success || color_text red "Unable to remove directory $field_trips" # Downloading will need to be done manually # implement item 3 from email: # # Remove the directory /data/feder/workarea AFTER sending any data in those directories to the people whose names are on them # Will actually create archive of each in the root directory then delete the directories work_area=$data_root/workarea work_dirs=$data_root/workarea/* for dir in $work_dirs; do color_text blue "Archiving work area directory $dir" current_target=$(basename $dir) archive_name="$current_target.tgz" #color_text blue "$data_root/$archive_name" pushd $work_area || continue ( tar czf $data_root/$archive_name.tgz $current_target && rm -rf $current_target ) && success || color_text red "Creating archive of $dir failed; directory not removed" popd done color_text blue "Removing old work directory $work_area" rm -rf $work_area && success || color_text red "Could not remove $work_area" # implement item NOT IN EMAIL: # # Remove tar archives in the current ast390 top level color_text blue "Removing any archives in the top level of ast390" rm $data_root/ast390/*.zip $data_root/ast390/*.tgz && success || color_text red "Unable to remove archives from $data_root/ast390" # implement item 4a from email: # # Move everything currently in /data/feder/ast390 to /data/feder/data/raw source_directory=$data_root/ast390 raw_directory=$data_root/data/raw color_text blue "Creating directory to hold raw data: $raw_directory" mkdir -p $raw_directory && success || exit 1 color_text blue "Moving existing data from $source_directory to $raw_directory" mv $source_directory/* $raw_directory && success || color_text red "Unable to move existing data to $raw_directory" color_text blue "Removing old raw directory $source_directory" # LEAVE THIS AS RMDIR so that it will fail if the directory is not empty rmdir $source_directory && success || color_text red "Did not remove directory $source_directory" # implement item 4b from email: # # Change file permissions so that no one has write permission color_text red "====> Run this command as sudo to change permissions: chmod ugo-w -R $raw_directory" # implement item 5 from email: # # Create a directory /data/feder/data/upload that has write access for feder_users. upload_dir=$data_root/data/upload color_text blue "Creating directory to store uploads: $upload_dir" mkdir -p $upload_dir && success || exit 1 color_text blue "Setting permissions on upload_dir" set_write_permissions $upload_dir && success # feedback taken care of in function # implement item 6 from email: # # Create a directory /data/feder/data/processed that will contain a mirror of what is in /data/feder/data/raw but with header processing done processed_dir=$data_root/data/processed color_text blue "Creating directory for processed files: $processed_dir" mkdir -p $processed_dir && success || exit 1 color_text blue "Setting permissions for $processed_dir" set_write_permissions $processed_dir && success # feedback taken care of in function # implement item 7 from email: # # Move the folder /data/feder/SSG to /data/feder/data/SSG color_text blue "Moving SSG directory" mv $data_root/SSG $data_root/data/SSG && success || color_text red "Unable to move the SSG directory"
true
684cfbbaeb86338b4e5706fa6bda7f868f73c798
Shell
garvitv/gaffer
/bin/gaffer
UTF-8
7,198
3.390625
3
[ "BSD-3-Clause" ]
permissive
#! /bin/bash ########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above # copyright notice, this list of conditions and the following # disclaimer. # # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided with # the distribution. # # * Neither the name of John Haddon nor the names of # any other contributors to this software may be used to endorse or # promote products derived from this software without specific prior # written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ########################################################################## # Wrapper script for gaffer. This ensures that relevant environment # variables are set appropriately and then runs gaffer.py in the # correct python interpreter. ########################################################################## # Remove -psn_0 argument that the OS X launcher adds on annoyingly. ########################################################################## if [[ $1 == -psn_0_* ]] ; then shift fi # Find where this script is located, resolving any symlinks that were used # to invoke it. Set GAFFER_ROOT based on the script location. ########################################################################## pushd . &> /dev/null # resolve symlinks thisScript=$0 while [ -L "$thisScript" ] do cd `dirname "$thisScript"` thisScript=`basename $thisScript` thisScript=`readlink $thisScript` done # find the bin directory we're in cd `dirname $thisScript` binDir=`pwd -P` export GAFFER_ROOT=`dirname $binDir` popd &> /dev/null # Make sure resource paths are set appropriately ########################################################################## # Prepend a directory to a path if it is not # already there. # # $1 is the value to include in the path # $2 is the name of the path to edit # # e.g. includeInPath ~/bin PATH function prependToPath { if [[ ":${!2}:" != *":$1:"* ]] ; then if [[ ${!2} ]] ; then eval "export $2=$1:${!2}" else eval "export $2=$1" fi fi } function appendToPath { if [[ ":${!2}:" != *":$1:"* ]] ; then if [[ ${!2} ]] ; then eval "export $2=${!2}:$1" else eval "export $2=$1" fi fi } prependToPath $GAFFER_ROOT/glsl IECOREGL_SHADER_PATHS prependToPath $GAFFER_ROOT/glsl IECOREGL_SHADER_INCLUDE_PATHS prependToPath $GAFFER_ROOT/fonts IECORE_FONT_PATHS prependToPath ~/gaffer/ops:$GAFFER_ROOT/ops IECORE_OP_PATHS prependToPath ~/gaffer/opPresets:$GAFFER_ROOT/opPresets IECORE_OP_PRESET_PATHS prependToPath ~/gaffer/procedurals:$GAFFER_ROOT/procedurals IECORE_PROCEDURAL_PATHS prependToPath ~/gaffer/proceduralPresets:$GAFFER_ROOT/proceduralPresets IECORE_PROCEDURAL_PRESET_PATHS if [[ -z $CORTEX_POINTDISTRIBUTION_TILESET ]] ; then export CORTEX_POINTDISTRIBUTION_TILESET=$GAFFER_ROOT/resources/cortex/tileset_2048.dat fi prependToPath ~/gaffer/apps:$GAFFER_ROOT/apps GAFFER_APP_PATHS prependToPath ~/gaffer/startup GAFFER_STARTUP_PATHS appendToPath $GAFFER_ROOT/startup GAFFER_STARTUP_PATHS prependToPath $GAFFER_ROOT/graphics GAFFERUI_IMAGE_PATHS if [[ -e $GAFFER_ROOT/bin/oslc ]] ; then export OSLHOME=$GAFFER_ROOT fi prependToPath $HOME/gaffer/shaders:$GAFFER_ROOT/shaders OSL_SHADER_PATHS if [[ -z $GAFFEROSL_CODE_DIRECTORY ]] ; then export GAFFEROSL_CODE_DIRECTORY=$HOME/gaffer/oslCode appendToPath $GAFFEROSL_CODE_DIRECTORY OSL_SHADER_PATHS fi # Get python set up properly ########################################################################## # Make sure PYTHONHOME is pointing to our internal python build. # We only do this if Gaffer has been built with an internal version # of python - otherwise we assume the existing environment is providing # the right value. if [ -e $GAFFER_ROOT/bin/python ] ; then if [[ `uname` = "Linux" ]] ; then export PYTHONHOME=$GAFFER_ROOT else export PYTHONHOME=$GAFFER_ROOT/lib/Python.framework/Versions/Current fi fi # Get python module path set up export PYTHONPATH=$GAFFER_ROOT/python${PYTHONPATH:+:}${PYTHONPATH:-} # Get library paths set up ########################################################################## if [[ `uname` = "Linux" ]] ; then prependToPath $GAFFER_ROOT/lib LD_LIBRARY_PATH else prependToPath $GAFFER_ROOT/lib DYLD_FRAMEWORK_PATH prependToPath $GAFFER_ROOT/lib DYLD_LIBRARY_PATH prependToPath /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Resources/ DYLD_LIBRARY_PATH if [[ -n $DELIGHT ]] ; then appendToPath $DELIGHT/lib DYLD_LIBRARY_PATH fi fi # Get the executable path set up, for running child processes from Gaffer ########################################################################## prependToPath $GAFFER_ROOT/bin PATH # Set up Appleseed ########################################################################## if [[ -z $APPLESEED && -d $GAFFER_ROOT/appleseed ]] ; then export APPLESEED=$GAFFER_ROOT/appleseed fi if [[ $APPLESEED ]] ; then if [[ `uname` = "Linux" ]] ; then prependToPath $APPLESEED/lib LD_LIBRARY_PATH else prependToPath $APPLESEED/lib DYLD_LIBRARY_PATH fi # Using a glob to keep the wrapper agnostic of python version. for appleseedPython in $APPLESEED/lib/python* ; do prependToPath $appleseedPython PYTHONPATH done prependToPath $APPLESEED/shaders OSL_SHADER_PATHS prependToPath $GAFFER_ROOT/appleseedDisplays APPLESEED_SEARCHPATH prependToPath $OSL_SHADER_PATHS APPLESEED_SEARCHPATH prependToPath $APPLESEED/bin PATH fi # Set up Arnold ########################################################################## prependToPath $GAFFER_ROOT/arnold/plugins ARNOLD_PLUGIN_PATH # Run gaffer itself ########################################################################## if [[ -n $GAFFER_DEBUG ]] ; then if [[ -z $GAFFER_DEBUGGER ]] ; then export GAFFER_DEBUGGER="gdb --args" fi exec $GAFFER_DEBUGGER python $GAFFER_ROOT/bin/gaffer.py "$@" else exec python $GAFFER_ROOT/bin/gaffer.py "$@" fi
true
ed9ce7f4095d8d85344581c237331d0d099f1420
Shell
mfalfafa/orange-pi-gateway
/tools/modem/modem_start.sh
UTF-8
1,176
3.109375
3
[]
no_license
#!/bin/sh #MODEM_START.sh V20160920 . /lib/lsb/init-functions DATE=$(date +"%Y-%m-%d") MODEM_LOG=/var/log/modem.log.$DATE if [ -h /dev/gsmmodem ] then echo ${0##*/} $(date +"%Y-%m-%d %H:%M:%S") "MODEM found on USB Mode" >> $MODEM_LOG if [ -f /tools/update/apn.txt ]; then APN=$(tail -1 /tools/update/apn.txt) else APN=internet; fi echo 'AT+CGDCONT=1,"IP","'$APN'"\r\n' >> /dev/ttyUSB1 if pgrep -f "/tools/modem/umtskeeper" > /dev/null then echo ${0##*/} $(date +"%Y-%m-%d %H:%M:%S") "UMTSKEEPER is Already running" >> $MODEM_LOG else echo ${0##*/} $(date +"%Y-%m-%d %H:%M:%S") "Starting UMTSKEEPER" >> $MODEM_LOG /tools/modem/umtskeeper --sakisoperators "USBINTERFACE='1' OTHER='USBMODEM' \ USBMODEM='12d1:1506' APN='CUSTOM_APN' CUSTOM_APN='m2minternet' SIM_PIN='1234' \ APN_USER='0' APN_PASS='0'" --sakisswitches "--sudo --console" --devicename \ 'HUAWEI_MOBILE' --log --silent --monthstart 8 --nat 'no' --httpserver --httpport 8080 & fi else echo ${0##*/} $(date +"%Y-%m-%d %H:%M:%S") "USB Modem NOT FOUND on USB. Let it start in HiLink Mode" >> $MODEM_LOG fi
true
ae7790d4653aa827012901cecfd804c9b18c825f
Shell
AxFab/smoke-os
/build_x86_cdrom.sh
UTF-8
817
3.390625
3
[]
no_license
#!/bin/bash export iso_name=OsCore.iso export ret=0 clear mkdir -p iso/{bin,boot/grub} # Clean up rm -rf obj lib $iso_name # Build the kernel make -f kernel/Makefile prefix=iso/boot ARCH=x86 if [ $? -ne 0 ]; then echo "ERROR :: Build kernel failed." 1>&2 exit -1 fi # Build standard libraries make -f axc/Makefile MODE=cross if [ $? -ne 0 ]; then echo "ERROR :: Build standard libraries failed." 1>&2 exit -1 fi # Build utilities make -f system/Makefile prefix=iso/bin MODE=cross if [ $? -ne 0 ]; then echo "ERROR :: Build utilities failed." 1>&2 exit -1 fi cp _x86/grub.cfg iso/boot/grub/grub.cfg # Create ISO file echo " ISO "$iso_name grub-mkrescue -o $iso_name iso >/dev/null if [ $? -ne 0 ]; then echo "ERROR :: Can't create iso file" fi # rm -rf iso rm -rf obj lib ls -lh $iso_name
true
afad4af0a3207f3621d2ec23f96955727e8c070a
Shell
hepuyao/linux
/sh/changefontsize.sh
UTF-8
390
2.78125
3
[]
no_license
#/bin/bash while ((1)) do for((i=11;i<=16;i++)); do sleep 1 s="Noto Sans CJK SC ${i}"; echo $s gsettings set org.ukui.style system-font-size $i gsettings set org.mate.interface font-name "$s" gsettings set org.gnome.desktop.wm.preferences titlebar-font "$s" gsettings set org.mate.interface document-font-name "$s" done done
true
8b5bbebe73ddb0708b3cf365c325db6ea4f499c1
Shell
5l1v3r1/telex
/telex-station/station/bro-1.5.1/aux/scripts/hot-report
UTF-8
2,985
3.390625
3
[ "BSD-2-Clause", "Apache-2.0" ]
permissive
#! /bin/sh # # Generate readable output from a Bro connection summary file. If the # -n flag is given, then the input is not run through hf to convert addresses # to hostnames, otherwise it is. If -x is given, then exact sizes and times # are reported, otherwise approximate. # # Requires the hf and cf utilities. See doc/conn-logs for a summary of # the mnemonics used to indicate different connection states. if [ "$1" = "-n" ] then shift HF="cat" export HF exec $0 "$@" fi if [ "$1" = "-x" ] then shift EXACT=1 export EXACT exec $0 "$@" fi usage="usage: hot-report [-n -x] [file ...]" if [ ! "$HF" ] then HF="hf -cl -t 15" fi if [ ! "$EXACT" ] then EXACT=0 fi $HF $* | cf | mawk ' BEGIN { interactive["telnet"] = interactive["login"] = interative["klogin"] = 1 version_probe["smtp"] = 1 no_flag["www"] = no_flag["gopher"] = no_flag["smtp"] = 1 no_flag["www?"] = no_flag["www??"] = no_flag["gopher?"] = 1 no_flag["http"] = no_flag["http?"] = no_flag["http??"] = 1 no_flag["https"] = 1 no_rej["finger"] = no_rej["time"] = no_rej["daytime"] = 1 no_rej["nntp"] = no_rej["auth"] = 1 } { state = $10 if ( state == "REJ" ) marker = "[" else if ( state ~ /S0/ ) marker = "}" else if ( state ~ /RSTR/ ) marker = state ~ /H/ ? "<[" : ">[" else if ( state ~ /RSTO/ ) marker = ">]" else if ( state ~ /SHR/ ) marker = "<h" else marker = ">" osize = size($6, state) rsize = size($7, state) dur = duration($4, state) proto = $5 time = $1 " " ($2 "") " " $3 if ( $11 ~ /L/ ) { ohost = $8 rhost = $9 } else { ohost = $9 rhost = $8 } status = "" if ( NF > 11 ) { # Collect additional status for ( i = 12; i <= NF; ++i ) status = status " " $i } flag_it = flag(proto, $4+0, $6+0, $7+0, state) printf("%-15s %s%s%s %s %s/%s%s%s%s\n", time, flag_it ? "*" : " ", ohost, osize, marker, rhost, proto, rsize, dur, status) } # Returns true if a connection should be flagged (represents successful # and sensitive activity), false otherwise function flag(proto, dur, osize, rsize, state) { if ( proto in interactive ) return osize > 200 || rsize > 1000 || dur > 300 if ( proto in version_probe && (osize == 0 || osize == 6) ) return 1 if ( proto in no_rej && (state == "REJ" || state == "S0") ) return 0 if ( proto ~ /^ftpdata-/ || proto ~ /^ftp-data/ ) return 0 return ! (proto in no_flag) } function size(bytes, state) { if ( state == "S0" ) return "" if ( state == "REJ" ) return "" if ( bytes == "?" ) s = "?" else if ( '$EXACT' ) s = sprintf("%db", bytes) else if ( bytes < 1000 ) s = sprintf("%.1fkb", bytes / 1000) else s = sprintf("%.0fkb", bytes / 1000) return " " s } function duration(t, state) { if ( t == "?" ) return " " t if ( state == "S0" || state == "S1" || state == "REJ" ) return "" if ( '$EXACT' ) s = sprintf("%.1fs", t) else if ( t < 60 ) s = sprintf("%.1fm", t / 60) else s = sprintf("%.0fm", t / 60) return " " s } '
true
32aa4cc2dcd60176a8adad895c4cfe53a23085b8
Shell
mrsepet/class-code
/Data Structures (C++, x86)/Word Search Solve (Hash Tables)/averagetime.sh
UTF-8
968
3.40625
3
[]
no_license
#!/bin/bash #William Emmanuel #wre9fz #March 5 #averagetime.sh clear echo "Average time calculator for wordPuzzle...assuming a.out is in this directory" echo -n "Input dictionary file: " read DICT echo -n "Input grid file: " read GRID echo -n "Running $GRID for 1st time..." RUNNING_TIME_1=`./a.out $DICT $GRID | tail -1` echo " $RUNNING_TIME_1 ms" echo -n "Running $GRID for 2nd time..." RUNNING_TIME_2=`./a.out $DICT $GRID | tail -1` echo " $RUNNING_TIME_2 ms" echo -n "Running $GRID for 3rd time..." RUNNING_TIME_3=`./a.out $DICT $GRID | tail -1` echo " $RUNNING_TIME_3 ms" echo -n "Running $GRID for 4th time..." RUNNING_TIME_4=`./a.out $DICT $GRID | tail -1` echo " $RUNNING_TIME_4 ms" echo -n "Running $GRID for 5th time..." RUNNING_TIME_5=`./a.out $DICT $GRID | tail -1` echo " $RUNNING_TIME_5 ms" SUM=`expr $RUNNING_TIME_1 + $RUNNING_TIME_2 + $RUNNING_TIME_3 + $RUNNING_TIME_4 + $RUNNING_TIME_5` AVERAGE=`expr $SUM / 5` echo "Average runtime: $AVERAGE ms" exit 0
true
3157e280a0e0c91c41d4b9b2fb1af7001d6ce187
Shell
zing-dev/hello-shell
/soft/sed/1.sh
UTF-8
936
2.953125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash #名称 命令 语法 说明 #替换 s [address]s/pattern/replacement/flags 替换匹配的内容 #删除 d [address]d 删除匹配的行 #插入 i [line-address]i\ # #text 在匹配行的前方插入文本 #追加 a [line-address]a\ # #text 在匹配行的后方插入文本 #行替换 c [address]c\ # #text 将匹配的行替换成文本text #打印行 p [address]p 打印在模式空间中的行 #打印行号 = [address]= 打印当前行行号 #打印行 l [address]l 打印在模式空间中的行,同时显示控制字符 #转换字符 y [address]y/SET1/SET2/ 将SET1中出现的字符替换成SET2中对应位置的字符 #读取下一行 n [address]n 将下一行的内容读取到 #读文件 r [line-address]r file 将指定的文件读取到匹配行之后 #写文件 w [address]w file 将匹配地址的所有行输出到指定的文件中 #退出 q [line-address]q 读取到匹配的行之后即退出
true
081a2835ad7791ceacef64d0b54c329ce33d913a
Shell
sambhavdutt/ci-management
/jjb/common-scripts/include-raw-fabric-clean-environment.sh
UTF-8
2,299
2.984375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash -eu # # SPDX-License-Identifier: Apache-2.0 ############################################################################## # Copyright (c) 2018 IBM Corporation, The Linux Foundation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License 2.0 # which accompanies this distribution, and is available at # https://www.apache.org/licenses/LICENSE-2.0 ############################################################################## function clearContainers () { CONTAINER_IDS=$(docker ps -aq) if [ -z "$CONTAINER_IDS" ] || [ "$CONTAINER_IDS" = " " ]; then echo "---- No containers available for deletion ----" else docker rm -f $CONTAINER_IDS || true docker ps -a fi } function removeUnwantedImages() { DOCKER_IMAGES_SNAPSHOTS=$(docker images | grep snapshot | grep -v grep | awk '{print $1":" $2}') if [ -z "$DOCKER_IMAGES_SNAPSHOTS" ] || [ "$DOCKER_IMAGES_SNAPSHOTS" = " " ]; then echo "---- No snapshot images available for deletion ----" else docker rmi -f $DOCKER_IMAGES_SNAPSHOTS || true fi DOCKER_IMAGE_IDS=$(docker images | grep -v 'base*\|couchdb\|kafka\|zookeeper\|cello' | awk '{print $3}') if [ -z "$DOCKER_IMAGE_IDS" ] || [ "$DOCKER_IMAGE_IDS" = " " ]; then echo "---- No images available for deletion ----" else docker rmi -f $DOCKER_IMAGE_IDS || true docker images fi } # Delete nvm prefix & then delete nvm rm -rf $HOME/.nvm/ $HOME/.node-gyp/ $HOME/.npm/ $HOME/.npmrc || true mkdir $HOME/.nvm || true # remove tmp/hfc and hfc-key-store data rm -rf /home/jenkins/.nvm /home/jenkins/npm /tmp/fabric-shim /tmp/hfc* /tmp/npm* /home/jenkins/kvsTemp /home/jenkins/.hfc-key-store rm -rf /var/hyperledger/* rm -rf gopath/src/github.com/hyperledger/fabric-ca/vendor/github.com/cloudflare/cfssl/vendor/github.com/cloudflare/cfssl_trust/ca-bundle || true # yamllint disable-line rule:line-length rm -rf gopath/src/github.com/hyperledger/fabric-ca/vendor/github.com/cloudflare/cfssl/vendor/github.com/cloudflare/cfssl_trust/intermediate_ca || true clearContainers removeUnwantedImages
true
5b21a11a40e4c0fe1e95c9f6fc7ccbe839eae7ff
Shell
Boundouq/TP_Projet_SE
/utils/rename-emulators.sh
UTF-8
122
2.546875
3
[]
no_license
for f in emulator-freechips.rocketchip.system-*; do echo "mv $f emu-${f:37}" mv $f emu-${f:37} # mv "$f" "${f:37}" done
true
32094300c1d9423c1e2c53144c400eabd5dca410
Shell
aleitamar/demo
/gitlab/vg_hook.sh
UTF-8
1,276
2.96875
3
[ "Apache-2.0" ]
permissive
#!/bin/bash #******************************************************************************* # Copyright 2015 Hewlett Packard Enterprise Development Company, L.P. # # 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. #******************************************************************************* source /home/git/gitlab-shell/hooks/set_env.sh [[ ! -e "$VG_HOOK/hook.properties" ]] && echo "ERROR: please verify that you VG_HOOK points to a directory with a hook.properties file." && exit -1 [[ ! -e "$VG_HOOK_HOME/git-hook.jar" ]] && echo "ERROR: please verify that you VG_HOOK_HOME points to a directory with a git-hook.jar file." && exit -1 REPO="Dummy" #dummy value for now read LINE; echo $LINE >> $VG_HOOK_HOME/vg-git-hook.log java -jar "$VG_HOOK_HOME/git-hook.jar" $REPO $LINE
true
fcacc4f52d6ed68170fe1813af8a535a559f6759
Shell
SambaEdu/maintscripts
/sysrescd-scripts/scripts/scan_clamav.sh
UTF-8
16,931
3.453125
3
[]
no_license
#!/bin/sh # Script de scan antivirus avec clamav sur DiglooRescueCD # Humblement réalisé par S.Boireau du RUE de Bernay/Pont-Audemer # Dernière modification: 26/02/2013 # ********************************** # Version adaptée à Digloo Rescue CD # ********************************** source /bin/crob_fonctions.sh PTMNT="/mnt/disk" mkdir -p "$PTMNT" echo -e "$COLTITRE" echo "****************************************" echo "* Script de scan antiviral avec clamav *" echo "****************************************" REPONSE="" while [ "$REPONSE" != "o" -a "$REPONSE" != "n" ] do echo -e "$COLTXT" echo -e "Voulez-vous effectuer la mise à jour des signatures de virus? (${COLCHOIX}o/n${COLTXT}) $COLSAISIE\c" read REPONSE done if [ "$REPONSE" = "o" ]; then echo -e "$COLINFO" echo "Pour récupérer les signatures, le réseau doit être configuré." REPONSE="" while [ "$REPONSE" != "1" -a "$REPONSE" != "2" -a "$REPONSE" != "3" ] do CHOIX=2 if [ "${ifconfig}" = "/sbin/ifconfig" ]; then if ifconfig | grep inet | grep -v 127.0.0.1 | grep -v "inet6 addr:" > /dev/null; then echo -e "${COLTXT}Une interface autre que 'lo' est configurée, voici sa config:${COLCMD}" ifconfig | grep inet | grep -v 127.0.0.1 | grep -v "inet6 addr:" CHOIX=1 fi else if ifconfig | grep inet | grep -v 127.0.0.1 | grep -v "inet6 " > /dev/null; then echo -e "${COLTXT}Une interface autre que 'lo' est configurée, voici sa config:${COLCMD}" ifconfig | grep inet | grep -v 127.0.0.1 | grep -v "inet6 " CHOIX=1 fi fi echo -e "${COLTXT}\n" echo -e "Si le réseau est OK, tapez ${COLCHOIX}1${COLTXT}" echo -e "Pour configurer le réseau, tapez ${COLCHOIX}2${COLTXT}" echo -e "Pour abandonner, tapez ${COLCHOIX}3${COLTXT}" echo -e "Votre choix: [${COLDEFAUT}${CHOIX}${COLTXT}] $COLSAISIE\c" read REPONSE if [ -z "$REPONSE" ]; then REPONSE=${CHOIX} fi done if [ "$REPONSE" = "3" ]; then echo -e "$COLERREUR" echo "ABANDON!" echo -e "$COLTXT" read PAUSE exit fi if [ "$REPONSE" = "2" ]; then echo -e "$COLINFO" echo "Le script net-setup de SystemRescueCD (depuis la version 0.3.1) pose des" echo "problèmes lorsqu'il est lancé sans être passé par une console avant le lancement" echo "(cas du lancement via l'autorun)." echo "Un script alternatif est proposé, mais il ne permet pas, contrairement au script" echo "net-setup officiel, de configurer une interface wifi." REPNET="" while [ "$REPNET" != "1" -a "$REPNET" != "2" ] do echo -e "$COLTXT" echo -e "Quel script souhaitez-vous utiliser? (${COLCHOIX}1/2${COLTXT}) [${COLDEFAUT}2${COLTXT}] $COLSAISIE\c" read REPNET if [ -z "$REPNET" ]; then REPNET=2 fi done REP="o" while [ "$REP" = "o" ] do echo -e "$COLCMD" #SysRescCD: if [ "$REPNET" = "1" ]; then net-setup eth0 iface=eth0 else /bin/net_setup.sh iface=$(cat /tmp/iface.txt) fi #DiglooRescueCD #net_setup eth0 #Puppy: #net-setup.sh echo -e "$COLTXT" echo "Voici la config IP:" echo -e "$COLCMD\c" if [ "${ifconfig}" = "/sbin/ifconfig" ]; then echo "ifconfig $iface | grep inet | grep -v \"inet6 addr:\"" ifconfig $iface | grep inet | grep -v "inet6 addr:" else echo "ifconfig $iface | grep inet | grep -v \"inet6 \"" ifconfig $iface | grep inet | grep -v "inet6 " fi echo -e "$COLTXT" echo -e "Voulez-vous corriger/modifier cette configuration? (${COLCHOIX}o/n${COLTXT}) [${COLDEFAUT}n${COLTXT}] $COLSAISIE\c" read REP if [ -z "$REP" ]; then REP="n" fi done fi #Récupérer IP et MASK echo -e "$COLCMD\c" if [ -z "$iface" ]; then iface="eth0" fi if [ "${ifconfig}" = "/sbin/ifconfig" ]; then IP=$(ifconfig ${iface} | grep "inet " | cut -d":" -f2 | cut -d" " -f1) MASK=$(ifconfig ${iface} | grep "inet " | cut -d":" -f4 | cut -d" " -f1) else IP=$(ifconfig ${iface} | grep "inet "|sed -e "s|^ *||g"| cut -d" " -f2) MASK=$(ifconfig ${iface} | grep "inet "|sed -e "s|.*netmask ||g"|cut -d" " -f1) fi if ! ping -c1 -W1 www.google.fr > /dev/null; then echo -e "$COLTXT" echo "Il semble que la passerelle soit inaccessible ou non définie," echo "ou alors le serveur DNS est inaccessible ou non défini." echo -e "$COLTXT" echo "Voici les routes définies:" echo -e "$COLCMD" route echo -e "$COLTXT" echo "Voici le(s) serveur(s) DNS défini(s):" echo -e "$COLCMD" cat /etc/resolv.conf REPONSE="" while [ "$REPONSE" != "o" -a "$REPONSE" != "n" ] do echo -e "$COLTXT" echo -e "Voulez-vous (re)définir la passerelle? (${COLCHOIX}o/n${COLTXT}) $COLSAISIE\c" read REPONSE done if [ "$REPONSE" = "o" ]; then if [ "$MASK" = "255.255.0.0" ]; then tmpip1=$(echo "$IP" | cut -d"." -f1) tmpip2=$(echo "$IP" | cut -d"." -f2) TMPGW="$tmpip1.$tmpip2.164.1" else tmpip1=$(echo "$IP" | cut -d"." -f1) tmpip2=$(echo "$IP" | cut -d"." -f2) tmpip3=$(echo "$IP" | cut -d"." -f3) TMPGW="$tmpip1.$tmpip2.$tmpip3.1" fi echo -e "$COLTXT" echo -e "Passerelle: [${COLDEFAUT}${TMPGW}${COLTXT}] $COLSAISIE\c" read GW if [ -z "$GW" ]; then GW="${TMPGW}" fi fi REPONSE="" while [ "$REPONSE" != "o" -a "$REPONSE" != "n" ] do echo -e "$COLTXT" echo -e "Voulez-vous (re)définir un serveur DNS? (${COLCHOIX}o/n${COLTXT}) $COLSAISIE\c" read REPONSE done if [ "$REPONSE" = "o" ]; then if [ "$MASK" = "255.255.0.0" ]; then tmpip1=$(echo "$IP" | cut -d"." -f1) tmpip2=$(echo "$IP" | cut -d"." -f2) TMPDNS="$tmpip1.$tmpip2.164.1" else TMPDNS="${DNS_ACAD}" fi echo -e "$COLTXT" echo -e "Serveur DNS: [${COLDEFAUT}${TMPDNS}${COLTXT}] $COLSAISIE\c" read DNS if [ -z "$DNS" ]; then DNS="${TMPDNS}" fi echo -e "$COLTXT" echo -e "Renseignement du DNS..." echo -e "$COLCMD\c" #echo "nameserver $DNS" > /tmp/mnt/$SYSRESCDPART/etc/resolv.conf echo "nameserver $DNS" > /etc/resolv.conf fi fi REPPROXY="" while [ "$REPPROXY" != "o" -a "$REPPROXY" != "n" ] do echo -e "$COLTXT" echo -e "Devez-vous passer par un proxy pour aller sur internet? (${COLCHOIX}o/n${COLTXT}) $COLSAISIE\c" read REPPROXY done if [ "$REPPROXY" = "o" ]; then if [ ! -z "$GW" ]; then echo -e "$COLTXT" echo -e "Quel est l'IP ou le nom DNS du proxy? [${COLDEFAUT}${GW}${COLTXT}] $COLSAISIE\c" read PROXY if [ -z "$PROXY" ]; then PROXY=$GW fi else echo -e "$COLTXT" echo -e "Quel est l'IP ou le nom DNS du proxy? $COLSAISIE\c" read PROXY fi echo -e "$COLTXT" echo -e "Quel est le port du proxy? [${COLDEFAUT}3128${COLTXT}] $COLSAISIE\c" read PORT if [ -z "$PORT" ]; then PORT="3128" fi echo -e "$COLTXT" echo -e "Renseignement du proxy" echo -e "$COLCMD\c" export http_proxy="http://$PROXY:$PORT" export ftp_proxy="http://$PROXY:$PORT" #mv /etc/clamav/freshclam.conf /etc/clamav/freshclam.conf.initial #cat /etc/clamav/freshclam.conf.initial | grep -v "HTTPProxyServer" | grep -v "HTTPProxyPort" > /etc/clamav/freshclam.conf #echo "HTTPProxyServer $PROXY" >> /etc/clamav/freshclam.conf #echo "HTTPProxyPort $PORT" >> /etc/clamav/freshclam.conf mv /etc/freshclam.conf /etc/freshclam.conf.initial cat /etc/freshclam.conf.initial | grep -v "HTTPProxyServer" | grep -v "HTTPProxyPort" > /etc/freshclam.conf echo "HTTPProxyServer $PROXY" >> /etc/freshclam.conf echo "HTTPProxyPort $PORT" >> /etc/freshclam.conf else echo -e "$COLTXT" echo -e "Suppression d'un éventuel proxy..." echo -e "$COLCMD\c" export http_proxy="" export ftp_proxy="" mv /etc/freshclam.conf /etc/freshclam.conf.initial cat /etc/freshclam.conf.initial | grep -v "HTTPProxyServer" | grep -v "HTTPProxyPort" > /etc/freshclam.conf fi echo -e "$COLTXT" echo "Lancement de la mise à jour..." echo -e "$COLCMD" freshclam fi echo -e "$COLPARTIE" echo "===============================" echo "Choix de la partition à scanner" echo "===============================" REPONSE="" while [ "$REPONSE" != "1" ] do DISK="" while [ -z "$DISK" ] do AFFICHHD DEFAULTDISK=$(GET_DEFAULT_DISK) echo -e "$COLTXT" echo "Sur quel disque se trouve la partition à scanner?" echo " (ex.: hda, hdb, hdc, hdd, sda, sdb, sdc, sdd)" echo -e "Disque: [${COLDEFAUT}${DEFAULTDISK}${COLTXT}] $COLSAISIE\c" read DISK if [ -z "$DISK" ]; then DISK=${DEFAULTDISK} fi tst=$(sfdisk -s /dev/$DISK 2>/dev/null) if [ -z "$tst" -o ! -e "/sys/block/$DISK" ]; then echo -e "$COLERREUR" echo "Le disque $DISK n'existe pas." echo -e "$COLTXT" echo "Appuyez sur ENTREE pour corriger." read PAUSE DISK="" fi done REPONSE="" while [ "$REPONSE" != "1" ] do echo -e "$COLTXT" echo "Voici les partitions sur le disque /dev/$DISK:" #echo "" echo -e "$COLCMD\c" fdisk -l /dev/$DISK LISTE_PART ${DISK} afficher_liste=y #echo "" #liste_tmp=($(fdisk -l /dev/$DISK | grep "^/dev/$DISK" | tr "\t" " " | grep -v "Linux swap" | grep -v "xtended" | grep -v "W95 Ext'd" | cut -d" " -f1)) LISTE_PART ${DISK} avec_tableau_liste=y if [ ! -z "${liste_tmp[0]}" ]; then DEFAULTPART=$(echo ${liste_tmp[0]} | sed -e "s|^/dev/||") else DEFAULTPART="${DISK}1" fi echo -e "$COLTXT" echo "Quelle est la partition à scanner?" echo " (probablement $DEFAULTPART,...)" echo -e "Partition: [${COLDEFAUT}${DEFAULTPART}${COLTXT}] $COLSAISIE\c" read PARTITION echo "" if [ -z "$PARTITION" ]; then PARTITION="$DEFAULTPART" fi #Vérification: #if ! fdisk -s /dev/$PARTITION > /dev/null; then t=$(fdisk -s /dev/$PARTITION) if [ -z "$t" -o ! -e "/sys/block/$DISK/$PARTITION" ]; then echo -e "$COLERREUR" echo "ERREUR: La partition proposée n'existe pas!" echo -e "$COLTXT" echo "Appuyez sur ENTREE pour corriger." read PAUSE #exit 1 REPONSE="2" else REPONSE="" fi while [ "$REPONSE" != "1" -a "$REPONSE" != "2" ] do echo -e "$COLTXT" echo -e "Peut-on poursuivre (${COLCHOIX}1${COLTXT}), ou faut-il corriger (${COLCHOIX}2${COLTXT})? [${COLDEFAUT}1${COLTXT}] $COLSAISIE\c" read REPONSE if [ -z "$REPONSE" ]; then REPONSE="1" fi done done echo -e "$COLTXT" echo "Quel est le type de la partition $PARTITION?" echo "(vfat (pour FAT32), ext2, ext3,...)" DETECTED_TYPE=$(TYPE_PART $PARTITION) if [ ! -z "${DETECTED_TYPE}" ]; then echo -e "Type: [${COLDEFAUT}${DETECTED_TYPE}${COLTXT}] $COLSAISIE\c" read TYPE if [ -z "$TYPE" ]; then TYPE=${DETECTED_TYPE} fi else echo -e "Type: $COLSAISIE\c" read TYPE fi # BIZARRE... IL A L'AIR DE FAIRE LE DEMONTAGE SYSTEMATIQUEMENT # Effectivement: Lorsque la partition a déjà été montée, le nettoyage n'est pas fait après un umount. # On obtient toujours une figne dans 'mount' comme si la partition était encore montée. # RECTIFICATION: Il semble qu'elle finisse par disparaitre??? # A creuser... echo -e "$COLCMD\c" if mount | grep "$PARTITION " > /dev/null; then umount /dev/$PARTITION sleep 1 fi # BIZARRE... IL A L'AIR DE FAIRE LE DEMONTAGE SYSTEMATIQUEMENT if mount | grep $PTMNT > /dev/null; then umount $PTMNT sleep 1 fi echo -e "$COLTXT" echo "Montage de la partition $PARTITION en $PTMNT:" if [ -z "$TYPE" ]; then echo -e "${COLCMD}mount /dev/$PARTITION $PTMNT" mount /dev/$PARTITION "$PTMNT"||ERREUR "Le montage de $PARTITION a échoué!" else echo -e "${COLCMD}mount -t $TYPE /dev/$PARTITION $PTMNT" mount -t $TYPE /dev/$PARTITION "$PTMNT"||ERREUR "Le montage de $PARTITION a échoué!" fi REPONSE="" while [ "$REPONSE" != "1" -a "$REPONSE" != "2" ] do echo -e "$COLTXT" echo -e "Peut-on poursuivre (${COLCHOIX}1${COLTXT}), ou faut-il corriger (${COLCHOIX}2${COLTXT})? [${COLDEFAUT}1${COLTXT}] $COLSAISIE\c" read REPONSE if [ -z "$REPONSE" ]; then REPONSE="1" fi done done echo -e "$COLPARTIE" echo "==========================" echo "Choix du dossier à scanner" echo "==========================" REPONSE="" while [ "$REPONSE" != "o" -a "$REPONSE" != "n" ] do echo -e "${COLTXT}" echo -e "Voulez-vous limiter le scan à un sous-dossier de ${PTMNT}? (${COLCHOIX}o/n${COLTXT}) [${COLDEFAUT}n${COLTXT}] $COLSAISIE\c" read REPONSE if [ -z "$REPONSE" ]; then REPONSE="n" fi done if [ "$REPONSE" = "o" ]; then #... echo -e "$COLTXT" echo -e "$COLTXT" echo "Voici les dossiers contenus dans ${PTMNT}:" echo -e "$COLCMD" ls -l ${PTMNT} | grep ^d > /tmp/ls.txt more /tmp/ls.txt echo -e "$COLTXT" echo "Quel dossier souhaitez-vous scanner?" echo -e "Chemin: ${COLCMD}${PTMNT}/${COLSAISIE}\c" cd "${PTMNT}" read -e DOSSTEMP cd /root DOSSIER=$(echo "$DOSSTEMP" | sed -e "s|/$||g") DOSSIERSCAN="${PTMNT}/${DOSSIER}" else DOSSIERSCAN="${PTMNT}" fi echo -e "$COLTXT" echo -e "Vous souhaitez scanner ${COLINFO}${DOSSIERSCAN}${COLTXT}" echo -e "${COLTXT}Peut-on poursuivre? (${COLCHOIX}o/n${COLTXT}) [${COLDEFAUT}o${COLTXT}] $COLSAISIE\c" read REPONSE if [ -z "$REPONSE" ]; then REPONSE="o" fi if [ "$REPONSE" != "o" ]; then echo -e "$COLERREUR" echo "ABANDON!" echo -e "$COLTXT" exit fi # Il faudra proposer différents types de scans... ou de saisir des options... echo -e "$COLTXT" echo "Lancement du scan..." echo -e "$COLCMD" ladate=$(date "+%Y_%m_%d-%HH%MMIN%SS") #clamscan -ri "$DOSSIERSCAN" | tee -a "/tmp/scan_clamav.${ladate}.log" # PROBLEME pour renvoyer la sortie d'erreur en tee #clamscan -ri "$DOSSIERSCAN" 2> "/tmp/scan_clamav.${ladate}.log" clamscan -ri "$DOSSIERSCAN" 2>&1 | tee "/tmp/scan_clamav.${ladate}.log" echo -e "$COLTXT" echo "Le rappel des logs est disponible dans le fichier suivant:" echo -e "$COLINFO\c" echo " /tmp/scan_clamav.${ladate}.log" REPONSE="" while [ "$REPONSE" != "o" -a "$REPONSE" != "n" ] do echo -e "$COLTXT" echo -e "Voulez-vous consulter le contenu fichier? (${COLCHOIX}o/n${COLTXT}) $COLSAISIE\c" read REPONSE done if [ "$REPONSE" = "o" ]; then echo -e "$COLTXT" echo "Voici le contenu du fichier:" echo -e "$COLCMD" more /tmp/scan_clamav.${ladate}.log fi echo -e "$COLINFO" echo "Si des fichiers sont infectés, il est possible de les mettre en quarantaine." echo "Déplacer des fichiers peut cependant perturber le fonctionnement du système." echo "Réfléchissez-y à deux fois..." REPONSE="" while [ "$REPONSE" != "o" -a "$REPONSE" != "n" ] do echo -e "$COLTXT" echo -e "Voulez-vous mettre des fichiers en quarantaine? (${COLCHOIX}o/n${COLTXT}) $COLSAISIE\c" read REPONSE done if [ "$REPONSE" = "o" ]; then #if fdisk -l /dev/$DISK | tr "\t" " " | grep "^/dev/$PARTITION " | grep "HPFS/NTFS" > /dev/null ; then type_fs=$(TYPE_PART $PARTITION) if [ "$type_fs" = "ntfs" ]; then echo -e "$COLINFO" echo "La partition /dev/$PARTITION est une partition NTFS." echo "Pour y déplacer des fichiers, il est nécessaire de remonter la partition en lecture écriture." echo -e "$COLTXT" echo "Démontage de la partition..." echo -e "$COLCMD\c" umount /mnt/disk # echo -e "$COLTXT" # echo "Préparation du montage avec captive-ntfs..." # echo -e "$COLCMD\c" # #cp /sysresccd/ntfs2/* /var/lib/captive/ # # PROBLEME: Si on a boote avec cdcache... # cp ${mnt_cdrom}/sysresccd/ntfs2/* /var/lib/captive/ # #if ! lsmod | grep "^fuse " > /dev/null; then # # insmod /lib/modules/2.6.15.6/kernel/fs/fuse/fuse.ko # #fi # #if ! lsmod | grep "^lufs " > /dev/null; then # # insmod /lib/modules/2.6.15.6/kernel/fs/lufs.ko # #fi # #cd / # #tar -xzf /digloo/dev_fuse.tar.gz # echo -e "$COLTXT" # echo -e "Montage de ${COLINFO}/dev/${PARTITION}${COLTXT} avec captive-ntfs..." # echo -e "$COLCMD\c" # #mount -t captive-ntfs /dev/$PARTITION /mnt/disk # mount.captive-ntfs /dev/$PARTITION /mnt/disk echo -e "Montage de ${COLINFO}/dev/${PARTITION}${COLTXT} avec ntfs-g3..." echo -e "$COLCMD\c" ntfs-g3 /dev/$PARTITION /mnt/disk fi mkdir -p /mnt/disk/quarantaine_${ladate} grep "^/mnt/disk/" /tmp/scan_clamav.${ladate}.log | grep FOUND | while read A do fichier=$(echo "$A" | cut -d":" -f1) virus=$(echo "$A" | cut -d":" -f2 | sed -e "s/^ //" | sed -e "s/ FOUND$//") # Effectuer le traitement... echo -e "$COLTXT" echo -e "Voulez-vous mettre le fichier suivant infecté par ${COLINFO}$virus" echo -e "${COLTXT}en quarantaine:" echo -e "${COLINFO} $fichier" echo -e "${COLTXT}Réponse: [${COLDEFAUT}n${COLTXT}] $COLSAISIE\c" read REPONSE < /dev/tty if [ "$REPONSE" = "o" ]; then echo -e "$COLCMD" chemin_tmp=$(dirname "$fichier" | sed -e "s|/mnt/disk/||") mkdir -p "/mnt/disk/quarantaine_${ladate}/$chemin_tmp" #mv "$fichier" "/mnt/disk/quarantaine_${ladate}" mv "$fichier" "/mnt/disk/quarantaine_${ladate}/$chemin_tmp/" fi done fi echo -e "$COLTXT" echo "Démontage de la partition..." echo -e "$COLCMD" umount /mnt/disk echo -e "$COLTITRE" echo "***********" echo "* Terminé *" echo "***********" echo -e "$COLTXT" echo "Appuyez sur ENTREE pour terminer." read PAUSE
true
176c252e61139108e4cd28fc5487dcf3527ae8ad
Shell
icaoberg/stackoverflow-podcast
/get_podcasts.sh
UTF-8
282
3.015625
3
[]
no_license
#!/bin/bash if [ -f $FILENAME ]; then rm -f $FILENAME fi wget -nc https://feeds.simplecast.com/XA_851k3 FILENAME='XA_851k3' if [ -f $FILENAME ]; then cat $FILENAME cat $FILENAME | grep mp3 | cut -d"=" -f4 | cut -d'"' -f2 | cut -d"?" -f1 | xargs wget -nc rm -f $FILENAME fi
true
5cb8b1e1c33b5d2f7cfc24939e68bb95f57c2c7e
Shell
abdulirfan3/StorageGatewaySnapshot
/storage_gateway_snap.sh
UTF-8
15,100
3.984375
4
[]
no_license
#!/bin/bash # # Author: Abdul Mohammed # Parameter: <GATEWAY ARN> # Usage: <script_name> <GATEWAY ARN> # # Description: Create snapshot for storage gateway volumes # Copy to DR region if gateway is PROD, # For DEV gateway, just snapshot and NO copy # # ### verbosity levels silent_lvl=0 crt_lvl=1 err_lvl=2 wrn_lvl=3 ntf_lvl=4 inf_lvl=5 dbg_lvl=6 verbosity=6 export LOGDIR=/tmp/logs export DATE=`date +"%Y%m%d"` export DATETIME=`date +"%Y%m%d_%H%M%S"` #DATE=`date +%Y_%m_%d-%k_%M` LOGFILE=${LOGDIR}/snapshots_${DATETIME} #exec 1>> $LOGFILE.log #exec 2>> $LOGFILE.err export BATCH=2 # nb of snap ids in a batch export BATCH_COUNT=0 export SOURCE_RGN=us-east-1 export TARGET_RGN=us-west-2 export AUTOBACKUP_TAG=AutomatedBackupSG export BACKUP_TAG=StorageGateway export SNAP_LIST=${LOGDIR}/snap_list_${DATETIME} export SNAP_COPY_LIST=${LOGDIR}/snap_copy_list_${DATETIME} export SNAP_COPY_LIST_RETRY=${LOGDIR}/snap_copy_list_retry_${DATETIME} export SNAP_LIST_TARGET_RGN=${LOGDIR}/snap_list_target_rgn_${DATETIME} > $SNAP_LIST > $SNAP_COPY_LIST > $SNAP_COPY_LIST_RETRY > $SNAP_LIST_TARGET_RGN ########################################### # Check if First parameter(SID) is passed # ########################################### if [ $1 ];then GATEWAYARN=$1;export GATEWAYARN else echo "NO GATEWAY ARN PROVIDED" exit 1 fi # Figure out Backup Type Tags, All SNAP are incremental. We just create this to get rid of snaps using DAILY/FULL Tags SNAPTAG=`date +%A` if [ "$SNAPTAG" = "Sunday" ] then export BACKUPTYPE_TAG=WEEKLY else export BACKUPTYPE_TAG=DAILY fi ScriptName=`basename $0` Job=`basename $0 .sh`"_output" ### Different logging level ## esilent prints output even in silent mode function esilent () { verb_lvl=$silent_lvl elog "$@" ;} function enotify () { verb_lvl=$ntf_lvl elog "$@" ;} function eok () { verb_lvl=$ntf_lvl elog "SUCCESS - $@" ;} function ewarn () { verb_lvl=$wrn_lvl elog "WARNING - $@" ;} function einfo () { verb_lvl=$inf_lvl elog "INFO ---- $@" ;} function edebug () { verb_lvl=$dbg_lvl elog "DEBUG --- $@" ;} function eerror () { verb_lvl=$err_lvl elog "ERROR --- $@" ;} function ecrit () { verb_lvl=$crt_lvl elog "FATAL --- $@" ;} function edumpvar () { for var in $@ ; do edebug "$var=${!var}" ; done } function elog() { if [ $verbosity -ge $verb_lvl ]; then datestring=`date +"%Y-%m-%d %H:%M:%S"` echo -e "$datestring - $@" fi } ############################################# ## START of output to a logfile using pipes ############################################# function Log_Open() { if [ $NO_JOB_LOGGING ] ; then einfo "Not logging to a logfile because -Z option specified." #(*) else [[ -d $LOGDIR ]] || mkdir -p $LOGDIR Pipe=${LOGDIR}/${Job}_${DATETIME}.pipe mkfifo -m 700 $Pipe LOGFILE=${LOGDIR}/${Job}_${DATETIME}.log exec 3>&1 tee ${LOGFILE} <$Pipe >&3 & teepid=$! exec 1>$Pipe PIPE_OPENED=1 enotify Logging to $LOGFILE fi } function Log_Close() { if [ ${PIPE_OPENED} ] ; then exec 1<&3 sleep 0.2 ps --pid $teepid >/dev/null if [ $? -eq 0 ] ; then # a wait $teepid whould be better but some # commands leave file descriptors open sleep 1 kill $teepid fi rm $Pipe unset PIPE_OPENED fi } function create_snap_n_tag(){ echo export INPUT=$1 einfo "Starting Gateway snapshot gateway-arn: $1" for VOL in $(aws storagegateway list-volumes --gateway-arn ${INPUT} --query 'VolumeInfos[*].VolumeARN' --output text) do aws --region ${SOURCE_RGN} storagegateway list-tags-for-resource --resource-arn ${VOL} --query 'Tags[].{K:Key,V:Value}' --output text > desc_tags VOL_TAG=`grep Name desc_tags | awk -F '\t' '{print $2}'` BU_TAG=`grep BU desc_tags | awk -F '\t' '{print $2}'` VOL_ID=${VOL} VOL_NAME="${VOL_ID##*/}" einfo "Running Below Command to Create SNAPSHOT for $VOL" einfo "aws --region ${SOURCE_RGN} storagegateway create-snapshot --volume-arn ${VOL} --snapshot-description GatewaySnapSandboxForVolumeName${VOL_NAME}-IscsiName${VOL_TAG} --query SnapshotId" aws --region ${SOURCE_RGN} storagegateway create-snapshot --volume-arn ${VOL} --snapshot-description GatewaySnapSandboxForVolumeName${VOL_NAME}-IscsiName${VOL_TAG} --query SnapshotId >> $SNAP_LIST 2>&1 if [ "$?" -eq 0 ]; then eok "snapshot creation successfully started for vol: ${VOL_TAG} volid: ${VOL_NAME}" echo # Create tags sleep 2 SNAPID=$(tail -1 $SNAP_LIST) einfo "Running below command to create tags for snapshot..." einfo "aws --region ${SOURCE_RGN} ec2 create-tags --resources ${SNAPID} --tags Key=Name,Value="${VOL_TAG}" Key=BU,Value="${BU_TAG}" Key=VolumeId,Value=${VOL_NAME} Key=BackupType,Value=${BACKUPTYPE_TAG} Key=CreatedBy,Value=${AUTOBACKUP_TAG} Key=BackupVolume,Value=${BACKUP_TAG}" aws --region ${SOURCE_RGN} ec2 create-tags --resources ${SNAPID} --tags Key=Name,Value="${VOL_TAG}" Key=BU,Value="${BU_TAG}" Key=VolumeId,Value=${VOL_NAME} Key=BackupType,Value=${BACKUPTYPE_TAG} Key=CreatedBy,Value=${AUTOBACKUP_TAG} Key=BackupVolume,Value=${BACKUP_TAG} else eerror "SNAPSHOT creation failed for vol: ${VOL_TAG} volid: ${VOL_TAG}" #Log_Close fi done } check_snap_staus() { echo einfo Start of checking snapshot state so it can be added to copy list export INPUT=$1 > $SNAP_COPY_LIST > $SNAP_COPY_LIST_RETRY for SNAP in `cat $INPUT` do END=$((SECONDS+3600)) SNAP_STATE=$(aws --region ${SOURCE_RGN} ec2 describe-snapshots --snapshot-ids ${SNAP} --query Snapshots[].State --output text) einfo "Checking SNAPSHOT state for: ${SNAP}" while [ $SECONDS -lt $END ]; do # Do what you want. if [ "${SNAP_STATE}" = "completed" ] then # Break out of loop and capture SNAP-ID so we can start copy using this SNAP-ID einfo "SNAPSHOT: ${SNAP} is in completed state, adding to copy list.." #echo ---------------------------------------------------------------- echo ${SNAP} >> $SNAP_COPY_LIST export SNAP_STATE_CHECK=TRUE break else einfo "SNAPSHOT: ${SNAP} is still NOT in completed state, current state: ${SNAP_STATE}" sleep 10 SNAP_STATE=$(aws --region ${SOURCE_RGN} ec2 describe-snapshots --snapshot-ids ${SNAP} --query Snapshots[].State --output text) export SNAP_STATE_CHECK=FALSE fi done # PUT BAD/RETRY SNAP-ID here after timeout of 3600 seconds # This is done, so we can at least start the initial copy and can come back to the ones taking long time if [ "${SNAP_STATE_CHECK}" = "TRUE" ] then : # DO NOTHING else einfo "SNAPSHOT: ${SNAP} is still not in COMPLETED state after 3600 seconds" einfo "Adding the above snapshot to retry list" echo ${SNAP} >> $SNAP_COPY_LIST_RETRY fi # put a flag file, if things fail 3rd time as well done einfo End of checking snapshot state } # At this point it is assumed that snapshot are in completed state copy_snap_to_target_region() { echo einfo Start of copy snapshot to $TARGET_RGN region export INPUT=$1 #> $SNAP_LIST_TARGET_RGN for SNAPCOPYID in `cat $INPUT` do DR_MSG="Copy from ${SOURCE_RGN} for DR --- " SNAP_DESC=$(aws --region ${SOURCE_RGN} ec2 describe-snapshots --snapshot-ids ${SNAPCOPYID} --query Snapshots[].Description --output text) FINAL_DESC=${DR_MSG}${SNAP_DESC} # Get all tags so it can be copied over aws --region ${SOURCE_RGN} ec2 describe-tags --filters Name=resource-id,Values=${SNAPCOPYID} --query 'Tags[].{K:Key,V:Value}' --output text > desc_tags BU_TAG=`grep BU desc_tags | awk -F '\t' '{print $2}'` BackupType_TAG=`grep BackupType desc_tags | awk -F '\t' '{print $2}'` Name_TAG=`grep Name desc_tags | awk -F '\t' '{print $2}'` VolumeId_TAG=`grep VolumeId desc_tags | awk -F '\t' '{print $2}'` # Copy snapshot to target region einfo "Running Below Command to copy SNAPSHOT for ${SNAPCOPYID}" einfo "aws --region $TARGET_RGN ec2 copy-snapshot --source-region $SOURCE_RGN --source-snapshot-id $SNAPCOPYID --description "\"""${FINAL_DESC}""\"" --output text" aws --region $TARGET_RGN ec2 copy-snapshot --source-region $SOURCE_RGN --source-snapshot-id $SNAPCOPYID --description "${FINAL_DESC}" --output text >> $SNAP_LIST_TARGET_RGN 2>&1 # If creation started successfully then start tagging if [ "$?" -eq 0 ] then eok "Copy SNAPSHOT: $SNAPCOPYID started successfully..." echo einfo "Tagging copy SNAPSHOT using below syntax" TARGET_SNAPID=$(tail -1 $SNAP_LIST_TARGET_RGN) # Only adding successful to list list="${list} ${TARGET_SNAPID}" sleep 1 einfo "aws --region $TARGET_RGN ec2 create-tags --resources ${TARGET_SNAPID} --tags Key=Name,Value="${Name_TAG}" Key=BU,Value="${BU_TAG}" Key=BackupType,Value=${BACKUPTYPE_TAG} Key=CreatedBy,Value=${AUTOBACKUP_TAG} Key=Org_VolumeId,Value=${VolumeId_TAG} Key=BackupVolume,Value=${BACKUP_TAG}" aws --region $TARGET_RGN ec2 create-tags --resources ${TARGET_SNAPID} --tags Key=Name,Value="${Name_TAG}" Key=BU,Value="${BU_TAG}" Key=BackupType,Value=${BACKUPTYPE_TAG} Key=CreatedBy,Value=${AUTOBACKUP_TAG} Key=Org_VolumeId,Value=${VolumeId_TAG} Key=BackupVolume,Value=${BACKUP_TAG} else eerror "Looks like copy-snapshot failed for source snapshot: ${SNAPCOPYID}" #Log_Close fi BATCH_COUNT=$(( ${BATCH_COUNT} + 1 )) if [ ${BATCH_COUNT} -eq ${BATCH} ]; then # Wait for completion einfo "waiting for batch to complete" einfo "Current batch snapshot list for DR region is: ${list}" einfo "Running below command to check for status of current batch.." einfo "aws --region $TARGET_RGN ec2 describe-snapshots --snapshot-ids ${list} --query Snapshots[].State --output text" einfo "Sleeping for 15 seconds in a loop until snapshot-copy finishes or we hit a timeout of 3600 seconds, whichever comes first..." einfo "######################### Start of 15 second sleep loop #########################" waitbatch einfo einfo "#######################################################################" einfo "########################## BATCH COMPLETE #############################" einfo "#######################################################################" einfo einfo "Starting next batch" BATCH_COUNT=0 list="" fi done einfo einfo End of copy snapshot to $TARGET_RGN region einfo } waitbatch() { TIMEOUT=$((SECONDS+3600)) if [ ${BATCH_COUNT} -gt 0 ]; then while [ `aws --region $TARGET_RGN ec2 describe-snapshots --snapshot-ids ${list} --query Snapshots[].State --output text | grep -o 'completed' | wc -w` -lt ${BATCH} ]; do einfo "Waiting for snapshot copy to complete: ${list}" sleep 15 # Give up if TIMEOUT is reached, also see what can be done about retries incase some reach time out.. # Maybe delete the copy from target region... if [ $SECONDS -gt ${TIMEOUT} ] then echo ewarn "Timeout reached for copy to $TARGET_RGN: ${list}" ewarn "Deleting snapshot copy of ${list}" ewarn "Running below command to delete the snapshot copy..." ewarn "aws --region $TARGET_RGN ec2 delete-snapshot --snapshot-id ${list}" echo aws --region $TARGET_RGN ec2 delete-snapshot --snapshot-id ${list} sleep 15 break fi done fi } # Main Logic Log_Open # We set parameter GATEWAY_TYPE to either dev or prod. Dev will only do snapshot, prod will # do snapshot plus copy to DR region... einfo "List of Gateway's attached to this AWS account" echo aws storagegateway list-gateways --output table echo # CHANGE BELOW TO YOUR STORAGE GATEWAY ARN # DEV system do not copy snapshot to DR region # CHANGE_THIS -- ACCOUNT-ID, STORAGE-GATEWAY-ID if [[ ${GATEWAYARN} = "arn:aws:storagegateway:us-east-1:111111111111:gateway/sgw-XXXXXXX" ]] then export GATEWAY_TYPE=DEV einfo "Gateway type is ${GATEWAY_TYPE}" einfo "Gateway ARN: ${GATEWAYARN}" if [ -e lock_file_gateway_snap_dev ] then eerror "Lock file already present, that mean either gateway snapshot is still running" eerror "or lock file was not cleaned up...exiting script...Lock file: ${PWD}/lock_file_gateway_snap_dev" Log_Close mailx -s "Errors for Storage Gateway Snapshot" -r "Storage_Gateway_Admin" email@domain.com < ${LOGFILE} exit 1 fi # CHANGE BELOW TO YOUR STORAGE GATEWAY ARN # PROD system do copy snapshot to DR region # CHANGE_THIS -- ACCOUNT-ID, STORAGE-GATEWAY-ID elif [[ ${GATEWAYARN} = "arn:aws:storagegateway:us-east-1:111111111111:gateway/sgw-XXXXXXX" ]] then export GATEWAY_TYPE=PROD einfo "Gateway type is ${GATEWAY_TYPE}" einfo "Gateway ARN: ${GATEWAYARN}" if [ -e lock_file_gateway_snap_prod ] then eerror "Lock file already present, that mean either gateway snapshot is still running" eerror "or lock file was not cleaned up...exiting script...Lock file: ${PWD}/lock_file_gateway_snap_prod" Log_Close mailx -s "Errors for Storage Gateway Snapshot" -r "Storage_Gateway_Admin" email@domain.com < ${LOGFILE} exit 1 fi else eerror "Gateway Provided is not the one from current environment, it needs to be either one of the below" eerror "arn:aws:storagegateway:us-east-1:111111111111:gateway/sgw-XXXXXXX" eerror "arn:aws:storagegateway:us-east-1:111111111111:gateway/sgw-XXXXXXX" Log_Close exit 1 fi # Run all the function accordingly. # For dev only create snapshot and tag it, no need to copy # For Prod create snapshot, tag it, copy over to DR region.. if [[ "${GATEWAY_TYPE}" = "DEV" ]]; then create_snap_n_tag ${GATEWAYARN} check_snap_staus $SNAP_LIST check_snap_staus $SNAP_COPY_LIST_RETRY rm lock_file_gateway_snap_dev elif [[ "${GATEWAY_TYPE}" = "PROD" ]]; then create_snap_n_tag ${GATEWAYARN} check_snap_staus $SNAP_LIST copy_snap_to_target_region $SNAP_COPY_LIST einfo "****************************************************************************************************" einfo "****************************************************************************************************" einfo "Start of checking snapshot state and copy snapshot to $TARGET_RGN region again" einfo "Will only run if snapshots where not in completed state previously and were added to retry list" einfo "****************************************************************************************************" einfo "****************************************************************************************************" check_snap_staus $SNAP_COPY_LIST_RETRY copy_snap_to_target_region $SNAP_COPY_LIST rm lock_file_gateway_snap_prod fi Log_Close # If you want to copy logs to an S3 bucket #aws s3 cp ${LOGFILE} s3://BUCKET-NAME/StorageGateway/ --sse if grep -wqE 'ERROR|WARNING' ${LOGFILE} then mailx -s "Errors for Storage Gateway Snapshot" -r "Storage_Gateway_Admin" email@domain.com < ${LOGFILE} exit 1 # Do not delete any log files for debug else rm desc_tags >/dev/null 2>&1 rm $SNAP_LIST >/dev/null 2>&1 rm $SNAP_COPY_LIST >/dev/null 2>&1 rm $SNAP_COPY_LIST_RETRY >/dev/null 2>&1 rm $SNAP_LIST_TARGET_RGN >/dev/null 2>&1 rm $Pipe >/dev/null 2>&1 fi
true
1d8db3a0ad2cea79b2f4bff1a3155fcb5fd0030f
Shell
krsanky/configs
/bin/wm-stuff.sh
UTF-8
983
3.09375
3
[]
no_license
#!/bin/sh #!/usr/local/bin/oksh ht_n_wt() { # resizes the window to full height and 50% width and moves into upper right corner # get width of screen and height of screen SCREEN_WIDTH=$(xwininfo -root | awk '$1=="Width:" {print $2}') SCREEN_HEIGHT=$(xwininfo -root | awk '$1=="Height:" {print $2}') echo "SCREEN_WIDTH:${SCREEN_WIDTH}" echo "SCREEN_HEIGHT:${SCREEN_HEIGHT}" # new width and height #W=$(( $SCREEN_WIDTH / 2 - $RIGHTMARGIN )) #H=$(( $SCREEN_HEIGHT - 2 * $TOPMARGIN )) # X, change to move left or right: # moving to the right half of the screen: #X=$(( $SCREEN_WIDTH / 2 )) echo "X:${X}" #wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && wmctrl -r :ACTIVE: -e 0,$X,$Y,$W,$H #PS. you can use xrandr to get(or set) the screen resolution and #then use wmctrl to resize your window. } expr_test() { echo "=======" z=5 z=$(expr $z + 1) echo $z } wmctrl_test1() { wmctrl -d wmctrl -l } echo $0 ht_n_wt wmctrl_test1 expr_test
true
0557dad337b7587c3298cfec1dffddef41a928ac
Shell
tianyayoucao/dbpedia
/mwdumper/stop-mysql.sh
UTF-8
351
3.703125
4
[]
no_license
#!/bin/bash set -e MYDIR=$1 if [[ -z "$MYDIR" ]] then echo "usage: $0 <mysql dir>" echo "Stop MySQL server listening at socket <mysql dir>/mysql.sock." echo echo " mysql dir Must be an existing directory." echo echo "Example:" echo "$0 ~/data/mysql" exit 1 fi mysqladmin --default-character-set=utf8 --socket=$MYDIR/mysql.sock shutdown
true
9feeda2ae5edadbc5fe87a8f98d16c9455fd260f
Shell
Sayam753/semester-1
/OC/bash pro/script12.bash
UTF-8
233
3.109375
3
[]
no_license
#!/bin/bash for ((i=1;i<=10000;i++)) do s=$i sum=0 for ((;s>0;)) do rem=$[$s%10] sum=$[$sum+(rem**3)] s=$[$s/10] done if [ $sum -eq $i ] then echo -n "$i " fi done echo -n "are the armstrong numbers" echo
true
3eeaacf49c4aed864a7e3a917c29ee94962c2b69
Shell
MarcQueralt/qibdip-zabbix-web-social-networks
/twitter_listed.sh
UTF-8
285
2.640625
3
[]
no_license
#!/bin/bash # twitter listed # get the number of times the user is listed # by qibdip # v1.6 # parameters # $1 monitored server # $2 twitter user without @ echo `date` "$@" >> /etc/zabbix/externalscripts/external_script.log php -f /etc/zabbix/externalscripts/php/twitter_listed.php $2
true
e4cb674ee242663d7c22fdddb8ba4e97cb39c83b
Shell
mfasia/mod-parp
/package.sh
UTF-8
1,978
3.453125
3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
#!/bin/sh # -*-mode: ksh; ksh-indent: 2; -*- # # $Header$ # # Script to build file release # # ./doc # contains the index.html/readme about mod_parp # ./apache # contains the source code # # See http://parp.sourceforge.net/ for further details about mod_parp. # TOP=`pwd` VERSION=`grep "char g_revision" httpd_src/modules/parp/mod_parp.c | awk '{print $6}' | awk -F'"' '{print $2}'` #TAGV=`echo $VERSION | awk -F'.' '{print "REL_" $1 "_" $2}'` #echo "check release tag $TAGV ..." #if [ "`cvs -q diff -r $TAGV 2>&1`" = "" ]; then # echo ok #else # echo "FAILED, cvs tag $TAGV not set for all files" # exit 1 #fi if [ `grep -c "Version $VERSION" doc/CHANGES.txt` -eq 0 ]; then echo "CHANGES.txt check FAILED" exit 1 fi rm -rf mod_parp-${VERSION}* mkdir -p mod_parp-${VERSION}/doc mkdir -p mod_parp-${VERSION}/apache2 echo "install documentation" cp README mod_parp-${VERSION} cp TODO mod_parp-${VERSION} cp doc/LICENSE.txt mod_parp-${VERSION}/doc cp doc/CHANGES.txt mod_parp-${VERSION}/doc sed <doc/index.html >mod_parp-${VERSION}/doc/index.html -e "s/4.15/${VERSION}/g" echo "install source" cp httpd_src/modules/parp/mod_parp.c mod_parp-${VERSION}/apache2 cp httpd_src/modules/parp/mod_parp.h mod_parp-${VERSION}/apache2 cp httpd_src/modules/parp/mod_parp_appl.c mod_parp-${VERSION}/apache2 grep -v parp_appl httpd_src/modules/parp/config.m4 > mod_parp-${VERSION}/apache2/config.m4 cp httpd_src/modules/parp/Makefile.in mod_parp-${VERSION}/apache2 cp httpd_src/modules/parp/.deps mod_parp-${VERSION}/apache2 cp httpd_src/modules/parp/Makefile mod_parp-${VERSION}/apache2 cp httpd_src/modules/parp/modules.mk mod_parp-${VERSION}/apache2 echo "install spec file" sed <httpd_src/modules/parp/mod_parp.spec >mod_parp-${VERSION}/mod_parp-${VERSION}.spec \ -e "s/0\.00/${VERSION}/g" echo "package: mod_parp-${VERSION}.tar.gz" tar cf mod_parp-${VERSION}.tar --owner root --group bin mod_parp-${VERSION} gzip mod_parp-${VERSION}.tar rm -r mod_parp-${VERSION} echo "END"
true
677f2855ce997c0fc34c0f4df322d8e9b25fd0b6
Shell
santiagocardin/go-demo-7
/k8s/istio/flagger-status.sh
UTF-8
674
3.625
4
[]
no_license
ADDR=$1 PROGRESSING=false EXIT_CODE=0 while true; do curl -H "Host: go-demo-7.acme.com" "$ADDR" STATUS=$(kubectl --namespace go-demo-7 \ get canary go-demo-7 \ --output jsonpath="{.status.phase}") echo "Status: $STATUS" if [[ "$PROGRESSING" == "false" && "$STATUS" == 'Progressing' ]]; then PROGRESSING=true elif [[ "$PROGRESSING" == "true" && "$STATUS" == 'Succeeded' ]]; then echo "Canary deployment succeeded" break elif [[ "$PROGRESSING" == "true" && "$STATUS" == 'Failed' ]]; then echo "Canary deployment failed" EXIT_CODE=1 break fi sleep 1 done exit $EXIT_CODE
true
5eec761257cd15fcd54824e982cccbd92b237d08
Shell
icehofman/kickstart-baseline
/roles/elixir.sh
UTF-8
535
2.515625
3
[]
no_license
source roles/erlang.sh kickstart.context elixir baseline.elixir.install.Ubuntu() { local elixir_tarball='v0.11.2.zip' kickstart.package.install unzip ( cd /opt [ -f $elixir_tarball ] || kickstart.download.file "https://github.com/elixir-lang/elixir/releases/download/v0.11.2/${elixir_tarball}" $elixir_tarball kickstart.mute unzip -o $elixir_tarball -d elixir ) kickstart.profile.add_to_profile elixir.sh } baseline.elixir.install.Mac() { kickstart.package.install elixir } baseline.elixir.install.`kickstart.os`
true
cd1a38f59c3c8267bff9d66e7bb4b5dd99dc297e
Shell
sandipans814/BCSE_Assignments
/OS/Ass1/4.sh
UTF-8
768
3.671875
4
[]
no_license
#!/bin/bash # Author : Sandipan Saha # Script follows here: word1="printf" word2="scanf" word3="int" declare -a files for (( i=0; i<6; i+=1)) do read -p "Enter file name: " filename if test -e $filename then files[$i]=$filename else echo "File doesnot exist" i=-1 fi done echo " FINAL RESULT" echo -e "\t\tprintf\tscanf\tint" echo "====================================" for (( i=0; i<6; i+=1)) do count1=0 count2=0 count3=0 filename=${files[$i]} count1=$( grep -o -w "$word1" "$filename" | wc -l ) count2=$( grep -o -w "$word2" "$filename" | wc -l ) count3=$( grep -o -w "$word3" "$filename" | wc -l ) echo -e "$filename\t$count1$count2$count3" done
true
344b8643187e16ea22a93adeba7c858a75260b53
Shell
bcgov/RSBC-DataHub-API
/scripts/rsbcdh-phase-secrets.example.sh
UTF-8
1,055
4.09375
4
[ "Apache-2.0" ]
permissive
#!/bin/bash usage() { cat <<-EOF Usage: $0 [ -h -e ] OPTIONS: ======== -h prints the usage for the script -e <environment> set the Openshift namespace/project -p <phase> set the phase EOF exit 1 } # In case you wanted to check what variables were passed # echo "flags = $*" while getopts e:p:h FLAG; do case $FLAG in e ) export PF_ENV=$OPTARG ;; p ) export PF_PHASE=$OPTARG ;; h ) usage ;; \?) #unrecognized option - show help echo -e \\n"Invalid script option"\\n usage ;; esac done PROJECT="be78d6-${PF_ENV}" echo "Connecting to $PROJECT" oc project ${PROJECT} echo "Deleting existing template secret template.rsbc-dh-${PF_PHASE}" oc delete secret template.rsbc-dh-${PF_PHASE} echo "Creating template secret template.rsbc-dh-${PF_PHASE}" oc create secret generic template.rsbc-dh-${PF_PHASE} \ --from-literal=username="replace-with-real" \ --from-literal=password="replace-with-real" \ --from-literal=db-username="replace-with-real" \ --from-literal=db-password='replace-with-real' echo "Complete"
true
6213a7e82ad55cebe26fc94b0f68282513d3a0fe
Shell
munrocape/munrocape.github.io
/scripts/new_entry
UTF-8
763
3.953125
4
[ "MIT" ]
permissive
#! /bin/sh # ensure our title was passed in if [ $# -eq 1 ] then echo missing expected post name exit 1 fi dir=$1 fname=$2 # do not overwrite an existing file if [ -f $dir/$fname ] then echo that file already exists in _posts: $fname exit 1 fi # write the default header #--- #layout: post #title: "Welcome to Jekyll!" #date: 2016-04-04 18:53:34 #categories: jekyll update #--- fpath=$dir/$fname touch $fpath echo "---" >> $fpath echo "layout: post" >> $fpath echo title: '"'$2'"' >> $fpath if [ $1 = "_posts" ] then y=`date +%Y` m=`date +%m` d=`date +%d` H=`date +%H` M=`date +%M` S=`date +%S` echo date: $y-$m-$d $H:$M:$S >> $fpath else echo date: >> $fpath fi echo "categories: " >> $fpath echo "---" >> $fpath exit 0
true
a43816432218159171487932db5a063ea91a0a42
Shell
makenew/tasty-brunch
/makenew.sh
UTF-8
2,359
4
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Unlicense" ]
permissive
#!/usr/bin/env sh set -e set -u find_replace () { git grep --cached -Il '' | xargs sed -i.sedbak -e "$1" find . -name "*.sedbak" -exec rm {} \; } sed_insert () { sed -i.sedbak -e "$2\\"$'\n'"$3"$'\n' $1 rm $1.sedbak } sed_delete () { sed -i.sedbak -e "$2" $1 rm $1.sedbak } check_env () { test -d .git || (echo 'This is not a Git repository. Exiting.' && exit 1) for cmd in ${1}; do command -v ${cmd} >/dev/null 2>&1 || \ (echo "Could not find '$cmd' which is required to continue." && exit 2) done echo echo 'Ready to bootstrap your new project!' echo } stage_env () { echo git rm -f makenew.sh echo echo 'Staging changes.' git add --all echo echo 'Done!' echo } makenew () { read -p '> App title: ' mk_title read -p '> App name (slug): ' mk_slug read -p '> Short app description: ' mk_description read -p '> App domain (e.g., makenew.github.io): ' mk_domain read -p '> App base url (leave empty or e.g., /tasty-brunch): ' mk_baseurl read -p '> Version number: ' mk_version read -p '> Author name: ' mk_author read -p '> Author email: ' mk_email read -p '> Copyright owner: ' mk_owner read -p '> Copyright year: ' mk_year read -p '> GitHub user or organization name: ' mk_user read -p '> GitHub repository name: ' mk_repo sed_delete README.md '3d;14,174d;325,328d' sed_insert README.md '13i' "${mk_description}" find_replace "s/version\": \".*\"/version\": \"${mk_version}\"/g" find_replace "s/0\.0\.0\.\.\./${mk_version}.../g" find_replace "s/Tasty Brunch App Skeleton/${mk_title}/g" find_replace "s/Tasty brunch app skeleton./${mk_description}/g" find_replace "s/2017 Evan Sosenko/${mk_year} ${mk_owner}/g" find_replace "s/Evan Sosenko/${mk_author}/g" find_replace "s/razorx@evansosenko\.com/${mk_email}/g" find_replace "s/makenew\/tasty-brunch/${mk_user}\/${mk_repo}/g" find_replace "s/makenew-tasty-brunch/${mk_slug}/g" find_replace "s/cd tasty-brunch/cd ${mk_repo}/g" find_replace "s/makenew.github.io/${mk_domain}/g" find_replace "s/\/tasty-brunch/$(echo ${mk_baseurl} | sed s/\\//\\\\\\//g)/g" mk_attribution='> Built from [makenew/tasty-brunch](https://github.com/makenew/tasty-brunch).' sed_insert README.md '9i' '' sed_insert README.md '9i' "${mk_attribution}" echo echo 'Replacing boilerplate.' } check_env 'git read sed xargs' makenew stage_env exit
true
4db0ea8adb8d01a6f40d020cf1d82374666da87d
Shell
jamiesweeney/SoloProject
/src/setup/setupBluetooth.sh
UTF-8
275
2.625
3
[]
no_license
# temperatureSensor.sh # Turns on the devices bluetooth hardware / interface # usage "./setupBluetooth.sh" # # Jamie Sweeney # 2017/18 Solo Project `sudo systemctl start bluetooth` echo "turned on bluetooth" `sudo hciconfig hci0 up` echo "turned on bluetooth interface"
true
0994f7569374b50aecada3b4cc95ca188f5a56bf
Shell
vaginessa/openwhyd
/scripts/backup-remote.sh
UTF-8
1,087
3.25
3
[ "MIT" ]
permissive
if [ "$#" -ne 3 ]; then echo "Usage: $0 <SSH_REMOTE> <SSH_USERNAME> <REMOTE_OPENWHYD_DIR>" >&2 exit 1 fi REMOTE=$1 USERNAME=$2 JSDIR=$3 mkdir _latest_backup cd _latest_backup echo "download configuration locally..." ssh root@$REMOTE "sudo tar zcvf /tmp/letsencrypt_backup.tar.gz /etc/letsencrypt &>/dev/null" scp -r $USERNAME@$REMOTE:/tmp/letsencrypt_backup.tar.gz . scp -r $USERNAME@$REMOTE:/etc/nginx/sites-available . scp -r $USERNAME@$REMOTE:/home/$USERNAME/$JSDIR/env-vars-local.sh . source ./env-vars-local.sh echo "dump and download remote database..." ssh $REMOTE "mongodump --quiet --gzip -d $MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASS" scp -r $USERNAME@$REMOTE:/home/$USERNAME/dump/* . echo "gzip and download usage logs..." ssh $REMOTE "tar -czf /tmp/usage-logs.tar.gz $JSDIR/*.json.log" scp -r $USERNAME@$REMOTE:/tmp/usage-logs.tar.gz . echo "gzip and download remote uploads..." ssh $REMOTE "tar -czf /tmp/uploads-backup.tar.gz $JSDIR/uAvatarImg $JSDIR/uCoverImg $JSDIR/uPlaylistImg" scp -r $USERNAME@$REMOTE:/tmp/uploads-backup.tar.gz . echo "done. :-)"
true
0d5812613f1771642613929a24f955305331aa94
Shell
paust-team/pko-t5
/scripts/install_redis.sh
UTF-8
362
2.609375
3
[ "MIT" ]
permissive
#!/bin/bash set -e curl -fsSL https://packages.redis.io/gpg | gpg -n --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list apt-get update apt-get install -y redis service redis-server start
true
76f0dd52b14db3ae0950c3dac23b319829000b4a
Shell
Harkirat30/commandsNew
/Shell/forloop.sh
UTF-8
526
3.515625
4
[]
no_license
#!/bin/bash #PURPOSE: Learning for loop #Created Date Sat 18 Sep 23:08:10 IST 2021 #Created By: Harkirat Singh #START OF CODE # create a hostfile for this example and we can use that file to iterate for i in `cat hostfile` do ping -c 1 $i resp=`echo $?` if [ $resp -ge 1 ]; then echo "$i - host is not responsive" echo "**********ERROR***********" else echo "$i host is up" echo "****SUCCESS*************" fi done #END OF CODE # we can also append the output of ping -c 1 $i to a diff file so as to reduce the chaos on the screem
true
69ad54103fa3ba73497b01c7e4ddd471c01d1070
Shell
dreamdd20223/scpy204_2019s_Nattawut
/homework001.sh
UTF-8
1,421
3.109375
3
[]
no_license
#!/bin/bash read -p "enter your name :" name echo "your name is $name" read -p "enter your age :" age echo "your age is $age" read -p "enter your gender :" gender echo "your gender is $gender" read -p "enter the country that you came from:" country echo "I come from $country" text="$country" case $text in "China") echo "you came from the risk country ";; "Japan") echo "you came from the risk country ";; "South korea") echo "you came from the risk country ";; "Italy") echo "you came from the risk country ";; "Taiwan") echo "you came from the risk country ";;*) echo "you came from the risk country either";; esac read -p "enter the symptom that you have after landing(fever,sore throat,cough,difficult breathing) " symptom echo "the symptom is $symptom" text1="$symptom" case $text1 in "fever") echo " Please go to see a doctor right away!! you are at risk of Covid19";; "sore throat") echo " Please go to see a doctor right away!! you are at risk of Covid19";; "cough") echo " Please go to see doctor rightaway!! You are at risk of Covid19";; "difficult breathing") echo " Please go to see a doctor rigth away!! you are at risk from Covid19";;*) echo " Congratulation,you are free from Covid19";; esac
true
28368d0e48652f54330ff82b6b552653747d9e8c
Shell
PlumpMath/wordy-word
/build-word-lists
UTF-8
355
2.90625
3
[]
no_license
#!/usr/bin/env bash set -eu archive=wn3.1.dict.tar.gz wget -O $archive http://wordnetcode.princeton.edu/$archive tar xvf $archive regex="^[0-9]{8}\s[0-9]{2}\s[a-z]\s[0-9]{2}\s[a-zA-Z]*\s" egrep -o $regex dict/data.adj | cut -d ' ' -f 5 > unapproved-adjectives egrep -o $regex dict/data.noun | cut -d ' ' -f 5 > unapproved-nouns rm -rf $archive dict/
true
960ae58d27b048e812c4d557c20216cf4be93a49
Shell
haarcuba/closer
/install_in_docker.sh
UTF-8
197
2.5625
3
[]
no_license
#!/bin/bash name=closer-2.0.1-py3-none-any.whl packagetime --no-pub --no-git -y ( nc -l 1111 < dist/$name ) & ssh -l me 172.17.0.2 bash -c "nc 172.17.0.1 1111 > $name ; sudo pip3 install ./$name"
true
ebd1c9bac946306f6da8c7b1e7f43e14bdc721dc
Shell
andreibacos/cinder-ci
/jobs/collect_logs.sh
UTF-8
2,279
3.34375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash source /usr/local/src/cinder-ci/jobs/utils.sh echo "Collecting logs" if [ -z "$DEBUG_JOB" ] || [ "$DEBUG_JOB" != "yes" ]; then LOGSDEST="/srv/logs/cinder/$ZUUL_CHANGE/$ZUUL_PATCHSET/$JOB_TYPE" else LOGSDEST="/srv/logs/cinder/debug/$ZUUL_CHANGE/$ZUUL_PATCHSET/$JOB_TYPE" fi echo "Creating logs destination folder" ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY logs@logs.openstack.tld "if [ ! -d $LOGSDEST ]; then mkdir -p $LOGSDEST; else rm -rf $LOGSDEST/*; fi" if [[ $JOB_TYPE != 'smb3_linux' ]] ;then echo 'Getting the Hyper-V logs' get_hyperv_logs fi echo 'Collecting the devstack logs' ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $DEVSTACK_SSH_KEY ubuntu@$DEVSTACK_FLOATING_IP "/home/ubuntu/bin/collect_logs.sh $DEBUG_JOB" echo "Downloading logs from the devstack VM" scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $DEVSTACK_SSH_KEY ubuntu@$DEVSTACK_FLOATING_IP:/home/ubuntu/aggregate.tar.gz "aggregate-$NAME.tar.gz" echo "Uploading logs to the logs server" scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY "aggregate-$NAME.tar.gz" logs@logs.openstack.tld:$LOGSDEST/aggregate-logs.tar.gz echo "Archiving the devstack console log" gzip -9 -v $CONSOLE_LOG echo 'Copying the devstack console log to the logs server' scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY $CONSOLE_LOG.gz logs@logs.openstack.tld:$LOGSDEST/ && rm -f $CONSOLE_LOG.gz echo "Extracting the logs tar archive" ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY logs@logs.openstack.tld "tar -xzf $LOGSDEST/aggregate-logs.tar.gz -C $LOGSDEST/" #echo "Uploading threaded logs" #set +e #scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY /home/jenkins-slave/logs/devstack-build-log-$JOB_TYPE-$ZUUL_UUID logs@logs.openstack.tld:$LOGSDEST/ #scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY /home/jenkins-slave/logs/cinder-windows-build-log-$JOB_TYPE-$ZUUL_UUID logs@logs.openstack.tld:$LOGSDEST/ #set -e echo "Fixing permissions on all log files on the logs server" ssh -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" -i $LOGS_SSH_KEY logs@logs.openstack.tld "chmod a+rx -R $LOGSDEST/"
true
f0b1f4345aa4d81a6fff73260933f4c500eca667
Shell
HallerPatrick/dotfiles
/bash_aliases
UTF-8
8,900
3.375
3
[]
no_license
# ~/.bash_aliases ## ALIASES ## # VIM Habits alias :q="exit" # Keyboard layout for ubuntu alias klayout='setxkbmap' ## File system # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" if [ -f /usr/local/bin/exa ]; then alias ls='exa' fi # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" # alias ls='ls --color=auto' alias dir='dir --color=auto' alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi # # ls variants lc=$(which lolcat >/dev/null && echo "|lolcat") alias ls='exa' alias ll='\ls -alF' alias llh='\ls -alh' alias la='ls $LS_OPTIONS -A' alias l='ls $LS_OPTIONS -alFtr' alias cls="clear && exa -la" # Recursive directory listing alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\''' # Date alias date-iso="date --iso-8601=seconds" # Permissions. alias fix-file-perms="find * -type d -print0 | xargs -0 chmod 0755" alias fix-dir-perms="find . -type f -print0 | xargs -0 chmod 0644" # Getting colored results when using a pipe from grep to less. alias grep='grep --color=auto' alias less='less -R' alias pdfgrep='pdfgrep -nH' # Jump back n directories at a time alias ..='cd ..' alias ...='cd ../../' alias ....='cd ../../../' alias .....='cd ../../../../' alias ......='cd ../../../../../' # mac/Iterm specific alias nt='open . -a iterm' alias nst='open . -a iterm' ## Git # Lazygit alias lgit='lazygit' alias vimr="open -a vimr.app" alias config='/usr/bin/git --git-dir=/Users/patrickhaller/.cfg/ --work-tree=/Users/patrickhaller' # Change dir to git root. alias cdgit='cd "$(git rev-parse --show-toplevel 2> /dev/null)"' # Refresh all repos in the current dir. alias git-pull-all='find . -name .git -type d -execdir sh -c "git fetch --tags --all && git pull -v" ";"' alias git-pull-root='find $(git rev-parse --show-toplevel 2> /dev/null) -name .git -type d -execdir git pull -v ";"' # Compact, colorized git log alias gl="git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" # Visualise git log (like gitk, in the terminal) alias lg='git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"' # Show which commands you use the most alias freq='cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 30' # Allow to find the biggest file or directory in the current directory. alias ds='du -ks *|sort -n' # List top ten largest files/directories in current directory alias big='du -ah . | sort -rh | head -40' # List top ten largest files in current directory alias big-files='ls -1Rhs | sed -e "s/^ *//" | grep "^[0-9]" | sort -hr | head -n40' # What's gobbling the memory? alias psmem='ps -o time,ppid,pid,nice,pcpu,pmem,user,comm -A | sort -n -k 6 | tail -15' ## Network # Get external IP alias whatismyip='curl ifconfig.me' # Or: ip.appspot.com # Show active network listeners alias netlisteners='lsof -i -P | grep LISTEN' ## Downloading # wget (if available) alias wget-all='wget --user-agent=Mozilla -e robots=off --content-disposition --mirror --convert-links -E -K -N -r -c' # # youtube-dl (if available) alias youtube-dl='youtube-dl -vcti -R5 -f "(webm,mp4)" --write-description --write-info-json --all-subs --write-thumbnail --add-metadata' # # Move torrent files alias move_torrents='find . -name "*.torrent" -exec sh -c '\''DST=$(find . -type d -name "$(basename "{}" .torrent)" -print -quit); [ -d "$DST" ] && mv -v "{}" "$DST/"'\'' ";"' ## Conversion # Useful converting tools. alias urldecode='sed "s@+@ @g;s@%@\\\\x@g" | xargs -0 printf "%b"' type jq >/dev/null 2>&1 \ && alias urlencode='jq -rRs @uri' \ || alias urlencode='curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c3-' # Other # Find xdebug files. #alias xt-files='egrep -o "/[^/]+:[0-9]+"' ## OSX alias bypass="/System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass" alias swap_on="sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist" alias swap_off="sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist" alias sql_istat='grep -oE "INTO `\w+`" | grep -oE "`\w+`" | sort | uniq -c | sort -nr' alias kcrash_verbose='sudo nvram boot-args="-v keepsyms=y"' alias DiskUtility_debug='defaults write com.apple.DiskUtility DUDebugMenuEnabled 1' # http://osxdaily.com/2011/09/23/view-mount-hidden-partitions-in-mac-os-x/ alias eject_force="diskutil unmountDisk force" # Reload DNS on OSX alias flushdns="dscacheutil -flushcache" # Changes Terminal title. alias title="printf '\033]0;%s\007'" # Set Mac System Sleep Idle Time alias systemsleep="sudo systemsetup -setcomputersleep" alias startup="osascript -e 'tell application \"System Events\" to get name of every login item'" alias kextstat_noapple='kextstat -kl | grep -v com.apple' alias jobs_other='sudo launchctl list | sed 1d | awk "!/0x|com\.(apple|openssh|vix)|edu\.mit|org\.(amavis|apache|cups|isc|ntp|postfix|x)/{print $3}"' alias git-svn='/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn' alias unpause="pkill -CONT -u $UID" alias trace-kernel="sudo fs_usage | grep -v 0.00" alias disable-local-backups="sudo tmutil disablelocal" alias enable-local-backups="sudo tmutil enablelocal" ## DTrace alias trace-php='sudo dtrace -qn "php*:::function-entry { printf(\"%Y: PHP function-entry:\t%s%s%s() in %s:%d\n\", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2); }"' # Files opened by process. alias trace-files="sudo dtrace -qn 'syscall::open*:entry { printf(\"%s %s\n\",execname,copyinstr(arg0)); }'" # Syscall count by program. alias trace-count-by-program="sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }'" # Syscall count by syscall. alias trace-count-by-syscall="sudo dtrace -n 'syscall:::entry { @num[probefunc] = count(); }'" # Syscall count by process. alias trace-count-by-process="sudo dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }'" # Memcached alias flush-memcache='echo flush_all > /dev/tcp/localhost/11211' # Start/stop indexing on all volumes. alias spotlight-off='sudo mdutil -a -i off' alias spotlight-on='sudo mdutil -a -i on' # Load/unload Spotlight Launch Daemons. alias spotlight-unload='sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist' alias spotlight-load='sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist' # LINUX # Open any file with the default command for that file # alias open='xdg-open' # # Various alias h='history | grep ' alias mv='mv -v' alias rm='rm -v' # One letter quickies: alias p='pwd' alias x='exit' # Directories alias s='cd ..' # Debugging # Format strace output, see: http://stackoverflow.com/a/36557550/55075 alias format-strace='grep --line-buffered -o '\''".\+[^"]"'\'' | grep --line-buffered -o '\''[^"]*[^"]'\'' | while read -r line; do printf "%b" $line; done | tr "\r\n" "\275\276" | tr -d "[:cntrl:]" | tr "\275\276" "\r\n"' # Utils alias dos2unix="ex +'bufdo! %! tr -d \\\\r' -scxa" # Docker alias docker-run-ptrace="docker run --cap-add SYS_PTRACE" alias yt='docker run --rm -u $(id -u):$(id -g) -v $PWD:/data vimagick/youtube-dl' # vim/vi/ex alias v='nvim' alias vi='nvim' alias vim='nvim' alias trim="ex +'bufdo!%s/\s\+$//ge' -scxa" # Strip trailing whitespaces. alias retab="ex +'set ts=2' +'bufdo retab' -scxa" # Convert tabs to spaces. # npm alias npm-freeze='npm ls | grep -o "\S\+@\S\+$" | tr @ " " | awk -v q='\''"'\'' '\''{print q$1q": "q"^"$2q","}'\''' # Fun alias weather-bamberg="curl http://wttr.in/bamberg" # Fast config alias zshconfig="nvim ~/.zshrc" alias ohmyzsh="nvim ~/.oh-my-zsh" alias vimc="nvim ~/.config/nvim" alias composer="php /usr/local/bin/composer.phar" alias relaunch="sudo launchctl reboot userspace" alias ~="cd ~" alias f='open -a Finder ./' # f: Opens current directory in MacOS Finder alias ...='cd ../../' # Go back 2 directory levels alias .4='cd ../../../' # Go back 3 directory levels alias ccat='pygmentize -g' # finderShowHidden: Show hidden files in Finder # finderHideHidden: Hide hidden files in Finder # ------------------------------------------------------------------- alias finderShowHidden='defaults write com.apple.finder ShowAllFiles TRUE' alias finderHideHidden='defaults write com.apple.finder ShowAllFiles FALSE' # iOS simulator alias simlist="xcrun simctl list" alias sim="open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/"
true
493d1881a371e2ad1f5cc5f71df5c1444ac60fbf
Shell
JimmyYezeguelian/ios-buildconfig
/scripts/check-files-clang
UTF-8
450
3.15625
3
[ "MIT" ]
permissive
#!/bin/sh export PATH=/usr/local/bin:$PATH # run clang-format on all .m and .h files find . -iname *.h -o -iname *.m | xargs clang-format -style=file -output-replacements-xml | grep "<replacement " >/dev/null # if "<replacement " is found it means that clang-format wants to make changes if [ $? -ne 1 ]; then echo "\n\nFiles do not match clang-format.\nRun 'fastlane ios format_objc' to re-format or commit with --no-verify." exit 1 fi
true
aef0fd1961d74353a4efaf9978a0ef584ef25983
Shell
lgyj/minershell
/killbash
UTF-8
615
3.3125
3
[]
no_license
#!/bin/bash #kill the cgminer LAST_PID=$(ps -ef|grep 'cgminer'|grep -v grep|awk '{print $2}') if [ -n "$LAST_PID" ] && [ "$LAST_PID" -gt 0 ]; then echo "LAST_PID=$LAST_PID" echo "cgminer PROCESS NOT EXIT, NOW KILL IT!" kill -kill $LAST_PID fi #kill the bash_cgminer LAST_PID=$(ps -ef|grep 'bashminer'|grep -v grep|awk '{print $2}') if [ -n "$LAST_PID" ] && [ "$LAST_PID" -gt 0 ]; then echo "LAST_PID=$LAST_PID" echo "bashminer PROCESS NOT EXIT, NOW KILL IT!" kill -kill $LAST_PID fi #kill the parent bash PARENT_PID=$PPID echo "PARENT_PID=$PARENT_PID" kill -kill $PARENT_PID
true
6e598ec4a174c64c2d2f97433abdcee4f00c1210
Shell
macmiranda/gestao
/geraInstances.sh
UTF-8
1,757
3.015625
3
[]
no_license
#!/bin/sh INSTANCES="instances.php" MOODLEDIR="/moodle/html" echo "<?php" > $INSTANCES for i in $MOODLEDIR/*/*/config.php do echo "\$idu='`echo $i|sed "s#$MOODLEDIR##"|cut -d"/" -f2`.`echo $i|sed "s#$MOODLEDIR##"|cut -d"/" -f3`';" >> $INSTANCES TIPO=`grep -v ^# $i | grep -v "^//" | grep 'CFG->dbtype' | cut -d ";" -f1 | cut -d "=" -f2` HOST=`grep -v ^# $i | grep -v "^//" | grep 'CFG->dbhost' | cut -d ";" -f1 | cut -d "=" -f2` BD=`grep -v ^# $i | grep -v "^//" | grep 'CFG->dbname' | cut -d ";" -f1 | cut -d "=" -f2` USUARIO=`grep -v ^# $i | grep -v "^//" | grep 'CFG->dbuser' | cut -d ";" -f1 | cut -d "=" -f2` SENHA=`grep -v ^# $i | grep -v "^//" | grep 'CFG->dbpass' | cut -d ";" -f1 | cut -d "=" -f2` WWWROOT=`grep -v ^# $i | grep -v "^//" | grep 'CFG->wwwroot' | cut -d ";" -f1 | cut -d "=" -f2` VFILE=`echo $i | sed 's/config.php/version.php/'` VERSAO=`grep \\$release $VFILE | cut -d"'" -f2 | sed 's/(Build.*)//'` echo "\$INFO[\$idu][\"dbtype\"] = $TIPO;" >> $INSTANCES echo "\$INFO[\$idu][\"dbhost\"] = $HOST;" >> $INSTANCES echo "\$INFO[\$idu][\"dbname\"] = $BD;" >> $INSTANCES echo "\$INFO[\$idu][\"dbuser\"] = $USUARIO;" >> $INSTANCES echo "\$INFO[\$idu][\"dbpass\"] = $SENHA;" >> $INSTANCES echo "\$INFO[\$idu][\"wwwroot\"] = $WWWROOT;" >> $INSTANCES echo "\$INFO[\$idu][\"versao\"] = \"$VERSAO\";" >> $INSTANCES echo "\$INFO[\$idu][\"dbinst\"] = \"`echo $i|sed "s#$MOODLEDIR##"|cut -d"/" -f3`\";" >> $INSTANCES echo "\$INFO[\$idu][\"dbcourse\"] = \"`echo $i|sed "s#$MOODLEDIR##"|cut -d"/" -f2`\";" >> $INSTANCES done echo " " >> $INSTANCES echo "?>" >> $INSTANCES
true
24f912876890b5ba283c28a807021a0af605227f
Shell
gleandroj/docker-laravel
/scripts/init.sh
UTF-8
604
2.90625
3
[]
no_license
#!/bin/bash set -e echo "Teste de Inicialização" ## Monitora e inicia servicos echo -e "\nIniciando os servicos..." service cron start service php7.4-fpm start # service memcached restart #monit stop nginx service nginx stop echo -e "\nIniciando o monit..." service monit start # ## Crond # monit start crond # monit monitor crond # ## PHP 7 FPM # monit start php7-fpm # monit monitor php7-fpm # ## Redis # monit start redis # monit monitor redis # ## Memcached # monit start memcache # monit monitor memcache ## Inicia o nginx echo -e "\nRodando o Nginx..." /usr/sbin/nginx -g "daemon off;"
true
ed8c8e5dbd5221f0694f9453e78e955cb989b3b9
Shell
thanasis00/dotfiles-1
/dotfiles/polybar/launch.sh
UTF-8
476
3.046875
3
[]
no_license
#!/usr/bin/env bash # Terminate already running bar instances killall -9 -q polybar # Wait until the processes have been shut down while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done if [[ "$(cat /sys/class/drm/card0-HDMI-A-1/status)" == "connected" ]]; then MONITOR=eDP1 TRAY_POSITION_BUILT=none polybar --reload built & MONITOR=HDMI1 polybar --reload top & else MONITOR=eDP1 TRAY_POSITION_BUILT=right polybar --reload built & fi echo "Bars launched..."
true
8478ae942639645a84a332c7b507f2fbb2731a69
Shell
lsteck/terraform-tools-argocd
/scripts/destroy-subscription.sh
UTF-8
599
2.65625
3
[]
no_license
#!/usr/bin/env bash SCRIPT_DIR=$(cd $(dirname $0); pwd -P) MODULE_DIR=$(cd "${SCRIPT_DIR}/.."; pwd -P) NAMESPACE="$1" kubectl delete subscription argocd-operator -n "${NAMESPACE}" --wait=true kubectl delete subscription openshift-gitops-operator -n openshift-operators --wait=true # Ideally, deleting the subscription would clean the rest of this up... kubectl delete deployment argocd-operator -n "${NAMESPACE}" --wait=true kubectl delete serviceaccount -n "${NAMESPACE}" argocd-operator --wait=true kubectl delete configmap -n "${NAMESPACE}" argocd-operator-lock --wait=true sleep 20 exit 0
true
55b959c3a5870e1d7c45cc35cbcf834137f6c51d
Shell
quachtina96/mtPipeline
/mtPipeline/scripts/mtPipeline_qsub.sh
UTF-8
563
3.140625
3
[]
no_license
#!/bin/bash #This script is the only script that people should need to interact with. #The variables below should be changed to meet user's needs echo pwd date #path to parameters param=/gpfs/home/quacht/scripts/parameters.sh source $param #path to the directory that holds the sample directories within (e.g. ID18 holds ID18_Father, ID18_Mother, and ID18_Proband) #NOTE: MUST INCLUDE LAST BACKSLASH pathToSampleDirs=/gpfs/home/quacht/partbam/ID18/ #run mtPipeline bash "${mtPipelineScripts}mtPipeline.sh" -i "${pathToSampleDirs}" -p "${param}" >> log.txt date
true
cda4fa42b80a9d47c794d22f5674e288dc8cceea
Shell
andaok/Shell
/KeepalivedRedis/KeepRedisMaster/sendmail.sh
UTF-8
1,513
3.703125
4
[]
no_license
#!/bin/sh MAIL=$(which mail) MAILFROM=keepalived@test.com MAILLIST="test@test.com" IP=$(ip -4 addr list|grep ine|grep -vE '127.0.0.1|172.30.33.16'|awk '{print $2}'|cut -d'/' -f1) STATUS=$(echo $1|tr [A-Z] [a-z]) if [ "$STATUS" = "fault" ] || [ "$STATUS" = "stop" ]; then # FAULT or STOP $MAIL -r $MAILFROM -s "Keepalived notify" $MAILLIST <<EOF 位于 $IP 的 Keepalived 状态变为 $STATUS。 请手动修复故障。 可参考如下步骤: 1. 登录 $IP 2. 执行如下命令切换为root用户 sudo su 3. 启动redis 3.1 执行如下命令检查redis状态 redis-cli ping 如果返回"Connection refused",表示redis服务已关闭 如果阻塞,可能redis服务异常,通过如下命令找出并kill相关进程 ps -ef|grep 'redis-server'|awk '\$0 !~ /grep/ {print \$2}'|xargs kill -9 3.2 执行如下命令重新启动redis source /etc/rc.local 等待启动完成 4. 执行如下命令启动keepalived /usr/local/keepalived/sbin/startup.sh EOF elif [ "$STATUS" = "master" ]; then # MASTER $MAIL -r $MAILFROM -s "Keepalived notify" $MAILLIST <<EOF 位于 $IP 的 Keepalived 状态变为 $STATUS。 收到该通知邮件表示另外一台Keepalived故障,请排查另一台Keepalived机器。 您并不需要对本机做任何操作。 EOF elif [ "$STATUS" = "backup" ]; then $MAIL -r $MAILFROM -s "Keepalived notify" $MAILLIST <<EOF 位于 $IP 的 Keepalived 状态变为 $STATUS。 收到该通知邮件表示该机器为首次启动,或者故障已修复。 您并不需要做任何操作。 EOF fi
true
1bb08feba75130fa18b8a61fb119db8b2b904f6a
Shell
tomokitamaki/setup_sakuranoObjectStrage
/setup_objstrage.sh
UTF-8
1,420
3.0625
3
[]
no_license
#! /bin/bash set -xeu echo "Please enter BUCKET NAME" read mybucket echo "" echo "Please enter ACCESSKEY" read accesskey echo "" echo "Please enter SECRETKEY" read secretkey # 必要なものをインストール yum install -y yum install pkgconfig libcurl libcurl-devel libxml2-devel make automake gcc libstdc++-devel gcc-c++ openssl-devel wget fuse-devel # ここからs3fsのインストール cd /usr/local/src wget https://github.com/libfuse/libfuse/releases/download/fuse-3.0.0/fuse-3.0.0.tar.gz tar zxvf fuse-3.0.0.tar.gz cd fuse-3.0.0 ./configure --prefix=/usr make make install ldconfig modprobe fuse cd /usr/local/src wget "https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.74.zip" unzip v1.74.zip cd s3fs-fuse-1.74 ./autogen.sh ./configure --prefix=/usr make make install touch ~/.passwd-s3fs && echo "$mybucket:$accesskey:$secretkey" > ~/.passwd-s3fs chmod 600 ~/.passwd-s3fs echo 'user_allow_other' >> /etc/fuse.conf mkdir -p /mnt/objstragedir s3fs $mybucket /mnt/objstragedir/ -o allow_other,url=https://b.sakurastorage.jp,nomultipart # アップロードテスト dd if=/dev/zero of=/mnt/objstragedir/test1MB bs=1MB count=1 # 変更テスト mv /mnt/objstragedir/test1MB /mnt/objstragedir/test1MBBB # ダウンロードテスト cp /mnt/objstragedir/test1MBBB ~/ # 削除テスト rm -f /mnt/objstragedir/test1MBBB # ホームディレクトリの不要なファイルを削除 rm -f ~/test1MBBB
true
0ab45dec25e523fa41b8fb47ebfe8b615b8a6cca
Shell
ShikhaGupta78/BioinformaticsPipelineInR
/SRAtoBED.sh
UTF-8
1,852
2.78125
3
[]
no_license
# Creation of FastQ file from SRA file, first parameter is the path of the fastq-dump utilities and the second parameter is the location of the SRA file /home/tools/sratoolkit.2.5.1-centos_linux64/bin/fastq-dump.2.5.1 /PathToSRA/FolderName/SRA/$1 # BWA command to map the generated FastQ file to the reference genome, and index SAI file is generated as the output bwa aln -t 8 /media/lpmb3/iGenomes/Mus_musculus/UCSC/mm10/Sequence/BWAIndex/genome.fa /media/lpmb3/Shikha/SRA/$1.fastq > $1.sai # BWA command to generate the SAM file from the index SAI and FastQ files bwa samse /media/lpmb3/iGenomes/Mus_musculus/UCSC/mm10/Sequence/BWAIndex/genome.fa $1.sai $1.fastq > $1.aln.sam # SAMtools command to convert SAM file format to binary version BAM file format samtools view -Shu $1.aln.sam > $1.bam # SAMtools command to sort the generated BAM file samtools sort $1.bam $1_sorted.bam # Generate index file out of the sorted BAM file samtools index $1_sorted.bam $1_sorted.bam.bai # Command to generate the Q peak files from the sorted BAM file /home/tools/Q/Q -l 18 -x 9 -t $1_sorted.bam -o $1.peaks # Command to concatenate all bed files generated from previous Q command into 1 file with output file name ALL_total_peaks.bed cat *.bed > ALL_total_peaks.bed # Command to sort the ALL_total_peaks.bed file and output file generated is named ALL_total_peaks_sorted.bed bedtools sort -i ALL_total_peaks.bed>ALL_total_peaks_sorted.bed # Command to merge the previously sorted bed file ALL_total_peaks_sorted.bed bedtools merge -i ALL_total_peaks_sorted.bed > ALL_total_peaks_sorted_merged.bed # bedtools multicov command bedtools multicov -q 20 -bams SRR5445252_sorted.bam SRR5445251_sorted.bam SRR5445213_sorted.bam SRR5445212_sorted.bam -bed /media/lpmb3/Shikha/Q/testShikhaFinalest.bed > /media/lpmb3/Shikha/FolderName/final_BED.txt & disown
true
8af9e8046260216c67074a7f1dda4809a120e59d
Shell
danielbayley/zplug
/autoload/tags/__as__
UTF-8
1,429
3.125
3
[ "MIT" ]
permissive
#!/usr/bin/env zsh # Description: # as tag local arg="$1" package local -a parsed_zplugs local as local default="plugin" local -a candidates candidates=( "$default" "command" "itself" ) package="${arg}, ${zplugs[$arg]%, }" parsed_zplugs=(${(s/, /)package/, */, }) as="${parsed_zplugs[(k)as:*]#as:*}" if [[ -z $as ]]; then zstyle -t ":zplug:tag" as "${candidates[@]}" case $status in 0) # ok zstyle -s ":zplug:tag" as as ;; 1) __zplug::io::print::f \ --die \ --zplug \ --error \ --func \ "as tag must be [%s] ($fg[green]%s$reset_color)\n" \ "${(j:, :)candidates[*]}" \ "$arg" return 1 ;; 2) # undefined ;; esac fi if [[ $arg != "zplug/zplug" ]] && [[ $as == "itself" ]]; then __zplug::io::print::f \ --die \ --zplug \ --func \ "%s: cannot set since it's reserved value (%s)\n" \ "$as" \ "$arg" return 1 fi : ${as:=$default} if [[ ! $as =~ ^(${(j:|:)candidates[@]})$ ]]; then __zplug::io::print::f \ --die \ --zplug \ --error \ --func \ "as tag must be [%s] ($fg[green]%s$reset_color)\n" \ "${(j:, :)candidates[*]}" \ "$arg" return 1 fi echo "$as"
true
82051c505a4705f1e219e679aa48ead4915b83a4
Shell
kabulkurniawan/fileAccessExtractor
/dockerfiles/dockerfiles_win/basehost/old/random_cmd_1.sh
UTF-8
1,541
2.546875
3
[]
no_license
cd /home && echo 'go to /home' mkdir 169296242 && echo 'create directory 169296242' cd 169296242 && echo 'go to 169296242' touch 516206680.txt && echo 'create file 516206680.txt' sleep 5 && echo 'sleep for 5 second(s)' echo 'this file has been modified on 1564754535711 ' >> 516206680.txt && echo 'modify file 516206680.txt' sleep 5 && echo 'sleep for 5 second(s)' rm 516206680.txt && echo 'remove 516206680.txt' sleep 5 && echo 'sleep for 5 second(s)' touch 386136418.txt && echo 'create file 386136418.txt' sleep 5 && echo 'sleep for 5 second(s)' rm 386136418.txt && echo 'remove 386136418.txt' sleep 5 && echo 'sleep for 5 second(s)' touch 926940867.txt && echo 'create file 926940867.txt' sleep 5 && echo 'sleep for 5 second(s)' echo 'this file has been modified on 1564754535711 ' >> 926940867.txt && echo 'modify file 926940867.txt' sleep 5 && echo 'sleep for 5 second(s)' cp 926940867.txt copy_of_926940867.txt && echo 'copy 926940867.txt to copy_of_926940867.txt' sleep 5 && echo 'sleep for 5 second(s)' echo 'this file has been modified on 1564754535711 ' >> copy_of_926940867.txt && echo 'modify file copy_of_926940867.txt' sleep 5 && echo 'sleep for 5 second(s)' mv copy_of_926940867.txt ren_copy_of_926940867.txt && echo 'rename copy_of_926940867.txt to ren_copy_of_926940867.txt' sleep 5 && echo 'sleep for 5 second(s)' rm ren_copy_of_926940867.txt && echo 'remove ren_copy_of_926940867.txt' sleep 5 && echo 'sleep for 5 second(s)' touch 812711304.txt && echo 'create file 812711304.txt' sleep 5 && echo 'sleep for 5 second(s)'
true
d8fa578dc62c2c24d416dd2a90d3ed80f2918e36
Shell
WenhaoChen0907/Shell_demo
/day02/shell19_total.sh
UTF-8
634
4.0625
4
[]
no_license
#! /bin/bash #1.提示用户输入一个目录 #2. #2.1目录存在提示输入文件名 #2.1.1判断文件是否存在,存在提示,不存在创建 #2.2目录不存在提示不存在 doMyFile(){ if [ -f $1 ] then echo "$1文件存在" else echo "$1文件不存在" echo "创建文件中。。。" touch $1 echo "创建文件完毕。。。" fi } doMyDir(){ if [ -d $1 ] then echo "$1目录存在。" read -p "请输入一个文件名:" myFile # 进入目录处理文件 cd $1 doMyFile $myFile else echo "$1目录不存在" fi } read -p "请输入一个目录:" myDir doMyDir $myDir
true
aea37f052ea1ba0f8db3a3c4fe96e961da1c4a0b
Shell
faucetsdn/daq
/bin/build_hash
UTF-8
973
3.4375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash ROOT=$(realpath $(dirname $0)/..) cd $ROOT build_hashf=.build_hash build_files=.build_files build_built=.build_built faucet_version=$(cd faucet; git rev-list -n 1 HEAD) echo "$faucet_version faucet/HEAD" > $build_files find docker/ subset/ usi/ -type f | sort | xargs sha1sum >> $build_files build_hash=`cat $build_files | sha256sum | awk '{print $1}'` if [ "$1" == check ]; then test -f $build_hashf || touch $build_hashf local_hash=$(< $build_hashf) if [ "$build_hash" != "$local_hash" ]; then if [ -f $build_built ]; then echo Output of: diff $build_built $build_files diff $build_built $build_files || true echo fi echo Local build hash does not match, or not found. echo Please run cmd/build. false fi elif [ "$1" == write ]; then echo $build_hash > $build_hashf elif [ -n "$1" ]; then echo Unknown argument $1 false else echo $build_hash fi
true
844d079cb0d2a276f0ed5dc77839cd85be92ff10
Shell
arizvisa/dotfiles
/posix/bin/termcaps.sh
UTF-8
470
2.921875
3
[]
no_license
#!/usr/bin/env bash mapfile terminfo < <( man -w 5 terminfo | xargs zcat | ssam -e 'x/T{/ .,/T}/ x/\n/ d' | grep 'T{\|T}' | ssam -e 'x/T{|T}/ s/T(.)/\1/') infocmp -1 | ssam -e 'x/[^ ]*#.*$\n/ v/[^ ]#/ d' | tail -n +2 | cut -f2 | ssam -e 'x/[,=]+.*/ d' | while read record; do capability=`printf "%s\n" "$record" | cut -d# -f1` comment=`printf "%s" "${terminfo[@]}" | grep "\b$capability\b" | cut -f4 | head -n 1` printf "%s -- %s\n" "$record" "$comment" done
true
128f2ee1094a4deb2bf4fd2335dd016d7aa8bbe1
Shell
mbarkdull/FormicidaeMolecularEvolution
/scripts/BUSTEDchunks
UTF-8
2,282
3.828125
4
[]
no_license
#!/bin/bash # Remove any existing list-of-input files so that they don't get appended to: rm chunkList.txt rm testFileList.txt rm checkedFileList.txt rm bustedsFileList* # Export required paths: export LD_LIBRARY_PATH=/usr/local/gcc-7.3.0/lib64:/usr/local/gcc-7.3.0/lib # Make a directory for BUSTED[S] outputs: mkdir ./8_3_BustedResults # Download the newest version of HyPhy: export PATH=/home/$USER/miniconda3/bin:$PATH conda install -c bioconda hyphy # Create the list of alignment files: ls -hSr 8_2_RemovedStops > testFileList.txt # Read through that list of alignments: while read -r line; do # Get the orthogroup number: export orthogroupNumber=`echo "$line" | awk -F'_' '{print ($2)}'` # Get the tree file and it's path: export treeFile=$1$orthogroupNumber"_tree.txt" # If the tree file exists, then check if the corresponding output from BUSTED also exists: if [ -f "$treeFile" ]; then FILE="./8_3_BustedResults/"$orthogroupNumber"_busted.json" if [ -f "$FILE" ]; then # If it does, then tell us that: echo "$FILE exists; BUSTED has already been run on this orthogroup." # If it doesn't, add that alignment file to the input file list: else # Make sure vertical bars are replaced with underscores: echo This file should be added to the file list echo cleaned_"$orthogroupNumber"_cds.fasta >> checkedFileList.txt fi # If the tree file doesn't exist, tell us that. else echo "$treeFile does not exist." fi done < testFileList.txt rm testFileList.txt # Split the list of allowable input files into a specified number of chunks: export chunkNumber="l/"$2 split --number=$chunkNumber --additional-suffix=.txt -d checkedFileList.txt bustedsFileList # Create a file listing those chunks: ls bustedsFileList* > chunkList.txt # Create a holder for the chunks: export batchSize=$2 export currentBatch=0 export batchFileNames=() # while reading each line in our list of chunked files, while read -r line; do export batchFile=$line batchFileNames+=($batchFile) if [ ${#batchFileNames[@]} -eq $batchSize ]; then for batchFile in ${batchFileNames[@]} ; do #sleep 10 & ./scripts/BUSTEDchunksSingle $batchFile $1 & done wait batchFileNames=() fi done < chunkList.txt
true
30a04579600d9f02df5699958ff8a95c43c3daab
Shell
freebsd/freebsd-ports
/net/kafka/files/kafka.in
UTF-8
2,857
3.515625
4
[ "BSD-2-Clause" ]
permissive
#!/bin/sh # PROVIDE: kafka # REQUIRE: NETWORKING SERVERS DAEMON # KEYWORD: shutdown # # Add kafka_enable="YES" to /etc/rc.conf to enable Kafka: # # Additional variables you can define are: # # kafka_user: Username to run Kafka # Default: %%KAFKA_USER%% # kafka_group: Group to run Kafka # Default: %%KAFKA_GROUP%% # kafka_config: Configuration file to run Kafka # Default: %%ETCDIR%%/server.properties # kafka_log4j_config: Configuration file for Kafka logging # Default: %%ETCDIR%%/log4j.properties # kafka_log_dir: Directory to store Kafka logs # Default: %%KAFKA_LOGDIR%% # kafka_java_opts: Options passed to JVM to start Kafka # Default: None # kafka_pidfile: Full path of the Kafka process PID file # Default: /var/run/kafka.pid # kafka_syslog_output_enable: Set to enable syslog output. # Default: YES # kafka_syslog_output_tag: Set syslog tag if syslog enabled. # Default: kafka # kafka_syslog_output_priority: Set syslog priority if syslog enabled. # Default: info # kafka_syslog_output_facility: Set syslog facility if syslog enabled. # Default: daemon . /etc/rc.subr name=kafka rcvar=kafka_enable load_rc_config "${name}" : ${kafka_enable:="NO"} : ${kafka_user:="%%KAFKA_USER%%"} : ${kafka_group:="%%KAFKA_GROUP%%"} : ${kafka_config:="%%ETCDIR%%/server.properties"} : ${kafka_log4j_config:="%%ETCDIR%%/log4j.properties"} : ${kafka_log_dir:="%%KAFKA_LOGDIR%%"} : ${kafka_pidfile:=/var/run/kafka.pid} : ${kafka_syslog_output_enable:="YES"} start_precmd="kafka_start_precmd" # backwards compatibility if [ -n "${kafka_log4j_profile}" ]; then kafka_log4j_config="${kafka_log4j_profile#file:}" fi if checkyesno kafka_syslog_output_enable; then if [ -n "${kafka_syslog_output_tag}" ]; then kafka_syslog_output_flags="-T ${kafka_syslog_output_tag}" else kafka_syslog_output_flags="-T ${name}" fi if [ -n "${kafka_syslog_output_priority}" ]; then kafka_syslog_output_flags="${kafka_syslog_output_flags} -s ${kafka_syslog_output_priority}" fi if [ -n "${kafka_syslog_output_facility}" ]; then kafka_syslog_output_flags="${kafka_syslog_output_flags} -l ${kafka_syslog_output_facility}" fi fi JAVA="%%JAVA%%" CLASSPATH=":%%DATADIR%%/libs/*" kafka_class="kafka.Kafka" kafka_log_opts="-Dkafka.logs.dir=${kafka_log_dir} -Dlog4j.configuration=file:${kafka_log4j_config}" kafka_main="${kafka_java_opts} ${kafka_log_opts} -cp ${CLASSPATH} ${kafka_class} ${kafka_config}" pidfile="${kafka_pidfile}" required_dirs="${kafka_log_dir}" required_files="${kafka_config} ${kafka_log4j_config}" command="/usr/sbin/daemon" command_args="-f ${kafka_syslog_output_flags} -P ${pidfile} -t ${name} ${JAVA} ${kafka_main}" kafka_start_precmd() { if [ ! -e "${pidfile}" ]; then install -m 0600 -o "${kafka_user}" -g "${kafka_group}" /dev/null "${pidfile}" fi } run_rc_command "$1"
true
468e8da0af0ca27827934aa3b5ced544a199b26d
Shell
qtt-bigdata/hadoop
/cloudera/test-distributed.sh
UTF-8
1,970
3.28125
3
[ "CDDL-1.1", "LicenseRef-scancode-protobuf", "BSD-3-Clause", "BSD-2-Clause-Views", "EPL-1.0", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.0", "Apache-2.0", "BSD-2-Clause", "MIT", "Classpath-exception-2.0", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "GCC-exception-3.1", "GPL-2.0-only", "LicenseRef-scancode-public-domain", "CC-PDDC", "LicenseRef-scancode-unknown" ]
permissive
#!/bin/bash set -xe DIR="$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd )" cd $DIR # Build the project $DIR/build.sh # Install dist_test locally SCRIPTS="dist_test" if [[ -d $SCRIPTS ]]; then echo "Cleaning up remnants from a previous run" rm -rf $SCRIPTS fi git clone --depth 1 git://github.com/cloudera/$SCRIPTS.git $SCRIPTS || true # Fetch the right branch cd "$DIR/$SCRIPTS" git fetch --depth 1 origin git checkout -f origin/master git ls-tree -r HEAD ./setup.sh export PATH=`pwd`/bin/:$PATH which grind if [[ -z $DIST_TEST_USER || -z $DIST_TEST_PASSWORD ]]; then # Fetch dist test credentials and add them to the environment wget http://staging.jenkins.cloudera.com/gerrit-artifacts/misc/hadoop/dist_test_cred.sh source dist_test_cred.sh fi if [[ ! -z $DIST_TEST_MVN_SETTINGS_FILE ]]; then echo "Using maven settings file from: $DIST_TEST_MVN_SETTINGS_FILE" echo "maven_settings_file = $DIST_TEST_MVN_SETTINGS_FILE" >> ./env/grind.cfg fi # Go to project root cd "$DIR/.." # Populate the per-project grind cfg file cat > .grind_project.cfg << EOF [grind] empty_dirs = ["test/data", "test-dir", "log"] file_globs = [] file_patterns = ["*.so"] artifact_archive_globs = ["**/surefire-reports/TEST-*.xml"] EOF export DIST_TEST_URL_TIMEOUT=180 # Invoke grind to run tests grind -c ${DIR}/$SCRIPTS/env/grind.cfg config grind -c ${DIR}/$SCRIPTS/env/grind.cfg pconfig grind -c ${DIR}/$SCRIPTS/env/grind.cfg test --artifacts -r 3 \ -e TestContainerAllocation \ -e TestJobHistoryEventHandler \ -e TestSystemMetricsPublisher \ -e TestContainerManagerSecurity \ -e TestMRIntermediateDataEncryption \ -e TestClientRMTokens \ -e TestAMAuthorization # TestClientRMTokens and TestAMAuthorization to be fixed in 5.8 (CDH-39590) # TestContinuousScheduling has been failing consistently, to be fixed in 5.8 (CDH-38830) # Cleanup the grind folder if [[ -d "$DIR/$SCRIPTS" ]]; then rm -rf "$DIR/$SCRIPTS" fi
true
e795555d199771ce5055c5a0c579ba8354d30ee3
Shell
001101/servers
/sudo-agent/sudo-agent.sh
UTF-8
310
2.953125
3
[ "MIT" ]
permissive
if [ -z "$SSH_AUTH_SOCK" ]; then echo " ==========NOTICE========== no ssh agent was provided via SSH_AUTH_SOCK (forward agent?), performing a 'sudo su' instead ==========================" sudo su else sudo su -l -c "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK; export SUDO_SSH_USER=$USER; /bin/bash;" fi
true
bbde60322a0db3c6b8809af52da6c5634d5ce390
Shell
wpw503/ENG1-Team-12
/docs/UML/generate_images.sh
UTF-8
147
2.765625
3
[]
no_license
#!/bin/bash for f in ./plantUML_source/* do echo "Processing $f file..." plantuml -tpng $f -o "../PNG/" plantuml -tsvg $f -o "../SVG/" done
true
b46dae0afdfd49b21c9fece62a49ac260102b90d
Shell
AmilcarArmmand/holberton-system_engineering-devops
/0x04-loops_conditions_and_parsing/100-read_and_cut
UTF-8
162
3.125
3
[]
no_license
#!/usr/bin/env bash # Bash script that displays the contents of the /etc/passwd file cut -d":" -f1,3,6 < /etc/passwd | while read LINE; do echo "$LINE" done
true
87ad7263f68413ed32b611872a07082ba595591c
Shell
amruthaarun/shell-scripts
/move.sh
UTF-8
216
3.21875
3
[]
no_license
#!/bin/sh `mkdir linux-files` s=`ls` for i in $s do if echo $i | grep 'linux' >> /dev/null ; then if test -f $i ; then `mv ./$i ./linux-files/` fi fi done s=`ls linux-files` echo $s, successfully moved
true
97870d59448d90c77607b2f9ba95cb21c0ec9402
Shell
llvm/circt
/utils/update-docs-dialects.sh
UTF-8
783
3.125
3
[ "LLVM-exception", "Apache-2.0" ]
permissive
#!/usr/bin/env bash ##===- utils/update-docs-dialects.sh - build dialect diagram -*- Script -*-===## # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # ##===----------------------------------------------------------------------===## # # Renders the `docs/dialects.dot` diagram using graphviz. # ##===----------------------------------------------------------------------===## set -e DOCS_DIR=$(cd "$(dirname "$BASH_SOURCE[0]")/../docs" && pwd) # Update the rendered diagrams in the docs. dot -Tpng $DOCS_DIR/dialects.dot > $DOCS_DIR/includes/img/dialects.png dot -Tsvg $DOCS_DIR/dialects.dot > $DOCS_DIR/includes/img/dialects.svg
true
4a96fd9b52172e15297ae96c57c85640bebd0b76
Shell
valtterikodisto/tab
/scripts/restore.sh
UTF-8
904
3.71875
4
[]
no_license
#!/bin/bash TARGET="/media/$USER/TAB/backup" RED='\033[0;31m' GREEN='\033[0;32m' RESETCOLOR="\033[0m" PROJECT_ROOT="/opt/tab" restart_app() { sudo docker-compose -f $PROJECT_ROOT/docker-compose.yml restart } # Start the application if not running IS_RUNNING=$(docker inspect -f '{{.State.Running}}' tab-db) if [ "$IS_RUNNING" != "true" ]; then docker-compose -f $PROJECT_ROOT/docker-compose.yml up -d fi while : do echo "Anna palautustiedoston nimi (esim. 111219.archive):" read backup # Check if backup exists if [ -f "$TARGET/$backup" ]; then docker exec -i tab-db sh -c 'exec mongorestore --drop --batchSize=1 --archive ' < "$TARGET/$backup" && printf "\n${GREEN}Tiedoston palautus onnistui!\n${RESETCOLOR}" restart_app break else printf "${RED}Palautuskansiota ${TARGET}/${backup} ei löytynyt${RESETCOLOR}\n\n" fi done echo "Paina ENTER poistuaksesi" read _
true
697cdc705892e3e82d68b250502d8ec115dbd8ed
Shell
machao0125/litemall
/deploy/util/lazy.sh
UTF-8
1,024
3.234375
3
[ "MIT", "CC-BY-ND-4.0" ]
permissive
#!/bin/bash # 本脚本的作用是 # 1. 编译打包Spring Boot应用 # 2. 编译litemall-admin应用 # 3. 调用upload.sh上传 # 4. ssh远程登录云主机,运行deploy/bin/deploy.sh脚本 # 注意:运行脚本必须是在litemall主目录下,类似如下命令 # cd litemall # ./deploy/util/lazy.sh # 请设置云主机的IP地址和账户 # 例如 ubuntu@122.152.206.172 REMOTE= # 请设置本地SSH私钥文件id_rsa路径 # 例如 /home/litemall/id_rsa ID_RSA= if test -z "$REMOTE" then echo "请设置云主机登录IP地址和账户" exit -1 fi if test -z "$ID_RSA" then echo "请设置云主机登录IP地址和账户" exit -1 fi echo $PWD mvn clean mvn package cd ./litemall-admin # 安装阿里node镜像工具 npm install -g cnpm --registry=https://registry.npm.taobao.org # 安装node项目依赖环境 cnpm install cnpm run build:dep cd .. echo $PWD ./deploy/util/upload.sh # 远程登录云主机并执行deploy脚本 ssh $REMOTE -i $ID_RSA << eeooff sudo ./deploy/bin/deploy.sh exit eeooff
true
08866d173b6f228d67760bc4a105803670d1b380
Shell
2Day4Real/Monero-Ocean-Miner
/LICENSE.md/miner-cpu.sh
UTF-8
916
2.75
3
[]
no_license
#!/bin/bash if [ ! $UID -eq 0 ]; then echo "Ingrese como root"; exit 1; fi echo "Instalando dependencias y Programas" add-apt-repository ppa:jonathonf/gcc-7.1 apt-get update apt-get install gcc-7 g++-7 git build-essential \ cmake libuv1-dev libmicrohttpd-dev libssl-dev curl htop screen if [ ! $? -eq 0 ]; then echo "No se pudieron instalar los paquetes"; exit 1; fi git clone https://github.com/xmrig/xmrig.git cd xmrig mkdir build cd build cmake .. -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7 make cd xmrig cd build screen ./xmrig-amd -B --print-time 30 --donate-level 0 --api-port 10001 --api-worker-id "Miner ON" -o gulf.moneroocean.stream:10001 -u 428VkBvTTywiS5F5X1gQZUUiZYC68QLev3qxYXHUovVV5oT8iYquc3nRe4WvYsrSE6XZ6LBaMmntXeuq9jEdPFmyPE9feJ3 -p maxmanuel2016@gmail.com -k echo "Buscar manualmente el nombre de xmrig en htop para comprobar que esta funcionando" sleep 5 htop
true
0bb60a05a7d8b924d18e7513aa7e80b0d2d7bea9
Shell
mwinokan/MShTools
/examples/sub_sander.sh
UTF-8
2,337
3.53125
4
[]
no_license
#!/bin/bash #SBATCH --partition=shared #SBATCH --time=01-00:00:00 #SBATCH --job-name=sander #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 #SBATCH --cpus-per-task=1 #SBATCH -o %j_%x.o #SBATCH -e %j_%x.e #SBATCH --mem=4000 #### Variables/Paths #### # set this to the folder from which you submit the job: WORK="$HOME/quick_test" # name of the output folder OUTKEY="sander_test" # sander md control file SANDER_IN="something.i" # prmtop topology PRMTOP="something.prmtop" # inpcrd/rst starting coordinates INPCRD="something.inpcrd" #### Directories # scratch directory SCRATCH=$HOME/parallel_scratch/$OUTKEY #### Setup Amber #### export AMBERHOME=/opt/pkg/apps/ambertools/v20-parallel module purge module load ambertools source $AMBERHOME/amber.sh SANDER="$AMBERHOME/bin/sander" #### User Output #### echo "--------------------------------------" echo "Molecular Dynamics with Amber's sander" echo "--------------------------------------" echo WORK $WORK echo OUTKEY $OUTKEY echo SANDER_IN $SANDER_IN echo PRMTOP $PRMTOP echo INPCRD $INPCRD echo SCRATCH $SCRATCH echo "--------------------------------------" #### Prepare scratch directory #### # make the scratch folder mkdir -pv $SCRATCH # copy the sander input file cp -v $WORK/$SANDER_IN $SCRATCH/ # change into scratch directory cd $SCRATCH #### Run sander #### echo "--------------------------------------" echo "Running sander..." # run and time sander $SANDER -O -i $SANDER_IN -o $OUTKEY.log -p $WORK/$PRMTOP -c $WORK/$INPCRD -x $OUTKEY.mdcrd -r $OUTKEY.rst # catch the output status AMBOUT=$? #### Check for warnings/errors #### # count the warnings and errors NUM_WARNINGS=$(grep WARNING $SCRATCH/$OUTKEY.log | wc -l) NUM_ERRORS=$(grep ERROR $SCRATCH/$OUTKEY.log | wc -l) if [ $NUM_WARNINGS -ne 0 ] ; then echo "$NUM_WARNINGS warnings given!" fi if [ $NUM_ERRORS -ne 0 ] ; then echo "$NUM_ERRORS errors encountered!" fi if [ $AMBOUT -ne 0 ] ; then echo "Something's wrong see:" $SCRATCH/$OUTKEY.log fi #### Finish up #### echo "--------------------------------------" echo "Finishing up..." # change to work directory cd $WORK # make the output directory mkdir -pv $WORK/$OUTKEY # copy from scratch to work rsync -a $SCRATCH/ $WORK/$OUTKEY/ 1>&2 echo "--------------------------------------" # exit with sander's output code exit $AMBOUT
true
b77d2f7fc14de55149eee674df2e0c204263c185
Shell
neoskop/mgnl-on-k8s
/images/light-module-updater/docker-entrypoint.sh
UTF-8
3,570
4.09375
4
[ "Apache-2.0" ]
permissive
#!/bin/bash set -e bold() { local BOLD='\033[1m' local NC='\033[0m' printf "${BOLD}${@}${NC}" } info() { local BLUE='\033[1;34m' local NC='\033[0m' printf "[${BLUE}INFO${NC}] $@\n" } error() { local RED='\033[1;31m' local NC='\033[0m' printf "[${RED}ERROR${NC}] $@\n" } warn() { local ORANGE='\033[1;33m' local NC='\033[0m' printf "[${ORANGE}WARN${NC}] $@\n" } copy_modules() { info "Copying $(bold $SOURCE_DIR) to $(bold $TARGET_DIR)" TEMP_DIR=`mktemp -d` rsync \ -r \ --exclude=.git \ --exclude=mtk \ --temp-dir=$TEMP_DIR \ $SOURCE_DIR/* \ $TARGET_DIR \ --delete \ &>/dev/null rm -rf $TEMP_DIR } executed_without_error() { STDERR_OUTPUT=$($@ 2>&1 >/dev/null) if [ $? -ne 0 ]; then warn "Executing $(bold "$@") failed: \n\n$STDERR_OUTPUT\n" false fi } update_tag() { TAG_FILE_PATH='/home/docker/config/tag'; if [ -f $TAG_FILE_PATH ]; then GIT_OLD_TAG=$GIT_TAG GIT_TAG=$(cat $TAG_FILE_PATH) [ "$GIT_TAG" != "$GIT_OLD_TAG" ] else return 1 fi } if [ -z "$GIT_REPO_URL" ] || [ -z "$GIT_PRIVATE_KEY" ] || [ -z "$SOURCE_DIR" ]; then error "Specify $(bold \$GIT_REPO_URL), $(bold \$GIT_PRIVATE_KEY) and $(bold \$SOURCE_DIR)!" exit 1 fi MEMORY_LIMIT=$(expr $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) / 1024 / 1024) info "Configuring Git for memory limit of $(bold "${MEMORY_LIMIT} MiB")" git config --global core.packedGitWindowSize $(expr $MEMORY_LIMIT / 10)m git config --global core.packedGitLimit $(expr $MEMORY_LIMIT / 2)m git config --global pack.deltaCacheSize $(expr $MEMORY_LIMIT / 4)m git config --global pack.packSizeLimit $(expr $MEMORY_LIMIT / 4)m git config --global pack.windowMemory $(expr $MEMORY_LIMIT / 4)m git config --global pack.threads 1 if ! [ -f ~/.ssh/id_rsa ]; then info "Writing private key to to $(bold ~/.ssh/id_rsa)" echo -e "$GIT_PRIVATE_KEY" >~/.ssh/id_rsa fi chmod 0600 ~/.ssh/id_rsa if [ "$CHECKOUT_TAG" == "true" ]; then update_tag || warn "$(bold CHECKOUT_TAG) is true, yet no tag is specified" fi cd $REPO_DIR if ! [ -d .git ]; then info "Cloning $(bold $GIT_REPO_URL) to $(bold $REPO_DIR)" git init &>/dev/null git remote add -f origin $GIT_REPO_URL &>/dev/null git config core.sparseCheckout true echo "$SOURCE_DIR" >> .git/info/sparse-checkout git pull origin master &>/dev/null if [ -n "$GIT_TAG" ]; then info "Checking out tag $(bold $GIT_TAG)" git -c advice.detachedHead=false checkout tags/$GIT_TAG &>/dev/null fi fi info "Copying modules initially" copy_modules if [ "$CHECKOUT_TAG" == "true" ]; then info "Starting to check tag config file ($(bold ~/config/tag)) for changes..." else info "Starting to check repository for changes..." fi while true; do if [ "$CHECKOUT_TAG" == "true" ]; then if update_tag ; then if [ -z "$GIT_OLD_TAG" ]; then info "Tag was set to $(bold $GIT_TAG). Fetching and checking out tag" else info "Tag was changed from $(bold $GIT_OLD_TAG) to $(bold $GIT_TAG). Fetching and checking out tag" fi if executed_without_error "git fetch" && executed_without_error "git -c advice.detachedHead=false checkout tags/$GIT_TAG" ; then copy_modules fi fi elif executed_without_error "git fetch"; then LOCAL=$(git rev-parse HEAD) REMOTE=$(git rev-parse origin/master) if [ $LOCAL != $REMOTE ]; then info "Pulling changes" if executed_without_error "git pull origin $GIT_BRANCH"; then copy_modules fi fi fi sleep $POLL_INTERVAL done
true
76aa98210496c3eff872751b743d32f3c93ce0de
Shell
thedumbtechguy/ansible-role-semaphore
/bootstrap.sh
UTF-8
6,067
3.109375
3
[ "MIT", "BSD-3-Clause" ]
permissive
# init if [ "$1" = "init" ]; then echo "Enter the database root password (admin):" read semaphore_db_admin_password echo "Enter the database password for the application (semaphore):" read semaphore_db_auth_password echo "Enter the password for the default application user (semaphore<root@localhost>):" read semaphore_config_auth_password echo "Enter the password for the account that will execute the application service (semaphore):" read semaphore_service_user_password echo "Enter your ansible vault password (/var/lib/semaphore/.vpf):" read semaphore_ansible_cfg_vault_password cat > vars.json <<EOL { "semaphore_version": "2.3.0", "semaphore_port": 3000, "semaphore_service_user_name": "semaphore", "semaphore_service_user_password": "$semaphore_service_user_password", # required "semaphore_db_admin_home": "/root", "semaphore_db_admin_user": "admin", "semaphore_db_admin_password": "$semaphore_db_admin_password", # required "semaphore_db_name": "semaphore", "semaphore_db_auth_user": "semaphore", "semaphore_db_auth_password": "$semaphore_db_auth_password", # required "semaphore_db_auth_privileges": "*.*:ALL", "semaphore_config_data_dir": "/var/lib/semaphore", "semaphore_config_log_path": "/var/log/semaphore", "semaphore_config_auth_name": "Admin", "semaphore_config_auth_email": "root@localhost", "semaphore_config_auth_username": "admin", "semaphore_config_auth_password": "$semaphore_config_auth_password", # required "semaphore_config_email_alerts_enable": "no", "semaphore_config_email_alerts_server": "localhost", "semaphore_config_email_alerts_port": 25, "semaphore_config_email_alerts_sender": "semaphore@localhost", "semaphore_config_telegram_alerts_enable": "no", "semaphore_config_telegram_alerts_bot_token": "", "semaphore_config_telegram_alerts_chat_id": "", "semaphore_config_web_root": "http://$HOSTNAME:3000/", # used in generating urls in alerts "semaphore_config_ldap_enable": "no", "semaphore_config_ldap_server": "localhost", "semaphore_config_ldap_port": 389, "semaphore_config_ldap_use_tls": "no", "semaphore_config_ldap_bind_dn": "cn=user,ou=users,dc=example.tld", "semaphore_config_ldap_bind_password": "pa55w0rd", "semaphore_config_ldap_search_dn": "ou=users,dc=example.tld", "semaphore_config_ldap_search_filter": "(uid=%s)", "semaphore_config_ldap_mapping_dn_field": "dn", "semaphore_config_ldap_mapping_username_field": "uid", "semaphore_config_ldap_mapping_fullname_field": "cn", "semaphore_config_ldap_mapping_email_field": "mail", "semaphore_ansible_cfg_host_key_checking": "False", "semaphore_ansible_cfg_ansible_managed": "DO NOT MODIFY by hand. This file is under control of Ansible on {host}.", "semaphore_ansible_cfg_vault_password": "$semaphore_ansible_cfg_vault_password", "semaphore_ansible_cfg_vault_password_file": "/var/lib/semaphore/.vpf", } EOL cat > playbook.yml <<EOL --- - hosts: 127.0.0.1 connection: local become: yes vars: mariadb_group_users: - name: '{{ semaphore_db_auth_user }}' password: '{{ semaphore_db_auth_password }}' priv: '*.*:ALL' hosts: - localhost - 127.0.0.1 mariadb_admin_home: '{{ semaphore_db_admin_home }}' mariadb_admin_user: '{{ semaphore_db_admin_user }}' mariadb_admin_password: '{{ semaphore_db_admin_password }}' logrotate_conf_scripts: - name: semaphore path: /var/log/semaphore/*.log options: - rotate 14 - daily - compress - delaycompress - sharedscripts - missingok postrotate: - /usr/sbin/service semaphore restart configure_ansible_vault_password: '{{ semaphore_ansible_cfg_vault_password}}' configure_ansible_vault_password_file: path: '{{ semaphore_ansible_cfg_vault_password_file }}' owner: 'root' group: '{{ semaphore_service_user_name }}' permissions: '0640' configure_ansible_config_items: defaults: - { name: "host_key_checking", value: "{{ semaphore_ansible_cfg_host_key_checking }}" } - { name: "ansible_managed", value: "DO NOT MODIFY by hand. This file is under control of Ansible on {host}." } - { name: "vault_password_file", value: "{{ semaphore_ansible_cfg_vault_password_file }}" } roles: - thedumbtechguy.mariadb - thedumbtechguy.semaphore - thedumbtechguy.logrotate - thedumbtechguy.configure-ansible EOL echo "Init complete. You can customize the variables by updating './vars.json'." fi # execute if [ "$1" = "execute" ]; then if [ ! -f vars.json ] || [ ! -f playbook.yml ]; then echo "Please run 'init' first!" elif ["$(whoami)" == "root"]; then echo "Please run as root/sudo" exit 1 elif [ ! -f .g ]; then echo "Installing ansible and its dependencies" apt-get -y install software-properties-common && apt-get -y install python-software-properties && apt-add-repository -y ppa:ansible/ansible && apt-get -y update && apt-get -y install ansible && ansible-galaxy install thedumbtechguy.mariadb && ansible-galaxy install thedumbtechguy.semaphore && ansible-galaxy install thedumbtechguy.logrotate && ansible-galaxy install thedumbtechguy.configure-ansible && touch .g fi if [ ! -f .g ]; then echo "Dependencies not satisfied" exit 1 else echo "Executing playbook" ansible-playbook playbook.yml --extra-vars "@vars.json" fi fi # help if [ -z "${1+present}" ] || [ "$1" = "help" ] || [ "$1" = "h" ]; then echo "Usage: sudo sh bootstrap.sh options Options: - init initialize required files You can customize the setup by modifying the generated 'vars.json' Running this command again will generating fresh files. - execute: execute bootstrapping tasks" fi
true
bbe0dc4b1df70b300081b95b13363aa4686e0df6
Shell
vasilyyakovlev/coloncancer
/cnv.sh
UTF-8
1,142
3.59375
4
[]
no_license
#!/bin/bash ## preprocessing refgene to bed with symbol #sed 1d ./processed/hg19.refgene | cut -f 3,5,6,13 > ./processed/hg19.bed ## define the working directory ## gather data and classify simply gather() { echo $0 find $1 -name "*snp*" -type f -print0 | xargs -0 -i cp {} $2 cd $2 mkdir seg nocnvseg mv *nocnv* nocnvseg mv *seg.txt seg } ## intersect to get gene to copies seg_to_bed() { echo $1 # sed 1d $1 | cut -f 2,3,4,6 | \ # awk -F '\t' '\ # { # printf("chr%s\n", $0) # }' > ${1}.bed # intersectBed -f $2 -wa -wb -a ${1}.bed -b ./processed/hg19.bed > ${1}genes.dat cut -f 4,8 ${1}genes.dat > ${1}genescopy.dat } ## using python to get batch info batch_average(){ $input=$1 $output=$2 $ref=$3 python cnv.py $input $ref $output paste $output final_cnv.txt } main() { #gather ../COAD ../snpcnv seg=`ls ../snpcnv/seg/*.txt` nocnv=`ls ../snpcnv/nocnvseg/*.txt` for s in $seg do seg_to_bed $s 1e-9 done # batch_average # time python cnv.py ../snpcnv/seg/ hg19 ../snpcnv/output/ paste -d\\t *.txt > snp_cnv_1bp.txt } main
true
928ad223165e3227b0c99a3bb63dcee16ae45496
Shell
kuzhao/playbooks
/scripts/jit-rdp-ssh.sh
UTF-8
1,737
3.796875
4
[]
no_license
#!/bin/bash ################ #Dependency: # Install AzCli first ################ ### Functions az_login() { az account show -o table if ! [ $? -eq 0 ]; then echo "Please az login first." az login --use-device-code if [[ $? -ne 0 ]]; then echo "az login failed. Quitting" exit 1 fi else # Prompt user to confirm if the correct sub is selected echo "Is the above correct subscription? Press Ctrl-C to cancel" && read DUMMY_INPUT fi } ############ Start Execution ############ ## Check az login az_login ## Get VM and Nic info RG=$(az vm list -o table | grep $1 | tr -s ' '| cut -d ' ' -f 2) NIC_URI=$(az vm show -n $1 -g $RG --query 'networkProfile.networkInterfaces[0].id'| tail -n 1 |tr -d '"') NIC_RG=$(cut -d '/' -f 5 <<< $NIC_URI);NIC_NAME=$(cut -d '/' -f 9 <<< $NIC_URI) NIC_NSG_URI=$(az network nic show -n $NIC_NAME -g $NIC_RG --query networkSecurityGroup.id | tail -n 1) if [ -z $NIC_NSG_URI ]; then echo 'VM NIC must have a NSG attached.' exit 1 fi NIC_NSG_RG=$(cut -d '/' -f 5 <<< $NIC_NSG_URI);NIC_NSG_NAME=$(cut -d '/' -f 9 <<< $NIC_NSG_URI) ## Allow SSH/RDP #let "NSG_RULE_COUNT = $(az network nsg show -n $NIC_NAME -g $NIC_RG | grep priority | wc -l) - 6" az network nsg rule create -g $NIC_NSG_RG --nsg-name $NIC_NSG_NAME -n jit \ --priority 100 --source-address-prefixes Internet --destination-port-ranges 22 3389 \ --access Allow --protocol Tcp \ --description "Allow Internet to Web ASG on ports 80,8080." if [ $? -ne 0 ]; then echo 'NSG rule op failed.' exit 1 fi ## Sleep for 4mins, wait for JIT to expire before removing the allow rule echo 'Sleep for 4mins then remove the allow rule...' sleep 240 az network nsg rule delete -g $NIC_NSG_RG --nsg-name $NIC_NSG_NAME -n jit
true
6a1c24cf1316514f470b85045bd1695d3953bc04
Shell
charnet1019/scripts
/shell/init_CentOS.sh
UTF-8
10,365
3.109375
3
[ "MIT" ]
permissive
#!/bin/bash UBUNTU_CHRONY_CONFIG="/etc/chrony/chrony.conf" CENTOS_CHRONY_CONFIG="/etc/chrony.conf" echo=echo for cmd in echo /bin/echo; do $cmd >/dev/null 2>&1 || continue if ! $cmd -e "" | grep -qE '^-e'; then echo=$cmd break fi done CSI=$($echo -e "\033[") CEND="${CSI}0m" CDGREEN="${CSI}32m" CRED="${CSI}1;31m" CGREEN="${CSI}1;32m" CYELLOW="${CSI}1;33m" CBLUE="${CSI}1;34m" CMAGENTA="${CSI}1;35m" CCYAN="${CSI}1;36m" CSUCCESS="$CDGREEN" CFAILURE="$CRED" CQUESTION="$CMAGENTA" CWARNING="$CYELLOW" CMSG="$CCYAN" if [[ "$(whoami)" != "root" ]]; then echo "please run this script as root !" >&2 exit 1 fi # update os yum -y update # Close SELINUX setenforce 0 sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config # /etc/security/limits.conf [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf sed -i.bak '/^# End of file/,$d' /etc/security/limits.conf cat >> /etc/security/limits.conf <<EOF # End of file * soft nproc 1000000 * hard nproc 1000000 * soft nofile 1000000 * hard nofile 1000000 EOF # /etc/hosts #[ "$(hostname -i | awk '{print $1}')" != "127.0.0.1" ] && sed -i "s@127.0.0.1.*localhost@&\n127.0.0.1 $(hostname)@g" /etc/hosts # Set timezone timezone=Asia/Shanghai rm -rf /etc/localtime ln -s /usr/share/zoneinfo/${timezone} /etc/localtime # Set DNS #cat > /etc/resolv.conf << EOF #nameserver 114.114.114.114 #nameserver 8.8.8.8 #EOF # ip_conntrack table full dropping packets [ ! -e "/etc/sysconfig/modules/iptables.modules" ] && { echo -e "modprobe nf_conntrack\nmodprobe nf_conntrack_ipv4" > /etc/sysconfig/modules/iptables.modules; chmod +x /etc/sysconfig/modules/iptables.modules; } modprobe nf_conntrack modprobe nf_conntrack_ipv4 echo options nf_conntrack hashsize=131072 > /etc/modprobe.d/nf_conntrack.conf # /etc/sysctl.conf [ ! -e "/etc/sysctl.conf_bk" ] && /bin/mv /etc/sysctl.conf{,_bk} cat > /etc/sysctl.conf << EOF fs.file-max=1000000 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.tcp_sack = 1 net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_rmem = 4096 87380 4194304 net.ipv4.tcp_wmem = 4096 16384 4194304 net.ipv4.tcp_max_syn_backlog = 16384 net.core.netdev_max_backlog = 32768 net.core.somaxconn = 32768 net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_fin_timeout = 20 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 2 net.ipv4.tcp_syncookies = 1 #net.ipv4.tcp_tw_len = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_mem = 94500000 915000000 927000000 net.ipv4.tcp_max_orphans = 3276800 net.ipv4.ip_local_port_range = 1024 65000 net.nf_conntrack_max = 6553500 net.netfilter.nf_conntrack_max = 6553500 net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60 net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120 net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120 net.netfilter.nf_conntrack_tcp_timeout_established = 3600 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 EOF sysctl -p yum -y install redhat-lsb-core # Get OS Version if [ -e /etc/redhat-release ]; then OS=CentOS CentOS_ver=$(lsb_release -sr | awk -F. '{print $1}') [[ "$(lsb_release -is)" =~ ^Aliyun$|^AlibabaCloudEnterpriseServer$ ]] && { CentOS_ver=7; Aliyun_ver=$(lsb_release -rs); } [[ "$(lsb_release -is)" =~ ^EulerOS$ ]] && { CentOS_ver=7; EulerOS_ver=$(lsb_release -rs); } [ "$(lsb_release -is)" == 'Fedora' ] && [ ${CentOS_ver} -ge 19 >/dev/null 2>&1 ] && { CentOS_ver=7; Fedora_ver=$(lsb_release -rs); } elif [ -n "$(grep 'Amazon Linux' /etc/issue)" -o -n "$(grep 'Amazon Linux' /etc/os-release)" ]; then OS=CentOS CentOS_ver=7 elif [ -n "$(grep 'bian' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Debian" ]; then OS=Debian Debian_ver=$(lsb_release -sr | awk -F. '{print $1}') elif [ -n "$(grep 'Deepin' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Deepin" ]; then OS=Debian Debian_ver=8 elif [ -n "$(grep -w 'Kali' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Kali" ]; then OS=Debian if [ -n "$(grep 'VERSION="2016.*"' /etc/os-release)" ]; then Debian_ver=8 elif [ -n "$(grep 'VERSION="2017.*"' /etc/os-release)" ]; then Debian_ver=9 elif [ -n "$(grep 'VERSION="2018.*"' /etc/os-release)" ]; then Debian_ver=9 fi elif [ -n "$(grep 'Ubuntu' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == "Ubuntu" -o -n "$(grep 'Linux Mint' /etc/issue)" ]; then OS=Ubuntu Ubuntu_ver=$(lsb_release -sr | awk -F. '{print $1}') [ -n "$(grep 'Linux Mint 18' /etc/issue)" ] && Ubuntu_ver=16 elif [ -n "$(grep 'elementary' /etc/issue)" -o "$(lsb_release -is 2>/dev/null)" == 'elementary' ]; then OS=Ubuntu Ubuntu_ver=16 fi if [ "${CentOS_ver}" == '6' ]; then sed -i 's@^ACTIVE_CONSOLES.*@ACTIVE_CONSOLES=/dev/tty[1-2]@' /etc/sysconfig/init sed -i 's@^start@#start@' /etc/init/control-alt-delete.conf sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/sysconfig/i18n elif [ ${CentOS_ver} -ge 7 >/dev/null 2>&1 ]; then sed -i 's@LANG=.*$@LANG="en_US.UTF-8"@g' /etc/locale.conf fi [ "${CentOS_ver}" == '8' ] && dnf --enablerepo=PowerTools install -y rpcgen command_exists() { command -v "$@" > /dev/null 2>&1 } yum_install_pkgs() { local PKG_NAME=$1 local BIN_NAME=$2 if ! command_exists ${BIN_NAME} &> /dev/null; then yum -y install ${PKG_NAME} if ! command_exists ${BIN_NAME} &> /dev/null; then echo "${PKG_NAME} service install failed, please install it manually." exit 1 fi else echo "${PKG_NAME} service already exist." fi } apt_install_pkgs() { local PKG_NAME=$1 local BIN_NAME=$2 if ! command_exists ${BIN_NAME} &> /dev/null; then apt-get -y install ${PKG_NAME} &> /dev/null if ! command_exists ${BIN_NAME} &> /dev/null; then echo "${PKG_NAME} service install failed, please install it manually." exit 1 fi else echo "${PKG_NAME} service already exist." fi } update_ubuntu_chrony_config() { sed -i 's/^\(pool .*\)/#\1/g' ${UBUNTU_CHRONY_CONFIG} echo "pool ntp1.aliyun.com online iburst" >> ${UBUNTU_CHRONY_CONFIG} echo "pool ntp2.aliyun.com online iburst" >> ${UBUNTU_CHRONY_CONFIG} echo "pool ntp3.aliyun.com online iburst" >> ${UBUNTU_CHRONY_CONFIG} } update_centos_chrony_config() { sed -i 's/^\(server .*\)/#\1/g' ${CENTOS_CHRONY_CONFIG} echo "server ntp1.aliyun.com iburst" >> ${CENTOS_CHRONY_CONFIG} echo "server ntp2.aliyun.com iburst" >> ${CENTOS_CHRONY_CONFIG} echo "server ntp3.aliyun.com iburst" >> ${CENTOS_CHRONY_CONFIG} } start_service() { local SRV_NMAE=$1 systemctl restart ${SRV_NMAE} &> /dev/null systemctl enable ${SRV_NMAE} &> /dev/null if systemctl status ${SRV_NMAE} &> /dev/null; then echo "${SRV_NMAE} started successfully." else echo "${SRV_NMAE} start failed." fi } # Update time #if [ -e "$(which ntpdate)" ]; then # ntpdate -u pool.ntp.org # [ ! -e "/var/spool/cron/root" -o -z "$(grep 'ntpdate' /var/spool/cron/root)" ] && { echo "*/20 * * * * $(which ntpdate) -u pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; } #fi if [ ${OS} == "CentOS" ]; then yum_install_pkgs chrony chronyd update_centos_chrony_config start_service chronyd elif [ ${OS} == "Debian" -o ${OS} == "Ubuntu" ]; then apt_install_pkgs chrony chronyd update_ubuntu16_chrony_config start_service chrony fi # log mk_record() { [ ! -d /var/log/records ] && mkdir -p /var/log/records chmod 666 /var/log/records #chmod +t /var/log/records cat >> /etc/profile.d/record.sh << "EOF" if [ ! -d /var/log/records/${LOGNAME} ]; then mkdir -p /var/log/records/${LOGNAME} chmod 300 /var/log/records/${LOGNAME} fi export HISTORY_FILE="/var/log/records/${LOGNAME}/bash_history" export PROMPT_COMMAND='{ date "+%Y-%m-%d %T ##### $(who am i | awk "{print \$1\" \"\$2\" \"\$5}") #### $(history 1 | { read x cmd; echo "$cmd"; })"; } >>$HISTORY_FILE' EOF source /etc/profile.d/record.sh } mk_record services_optimizer() { systemctl stop postfix.service systemctl disable postfix.service } services_optimizer # iptables #if [ "${iptables_flag}" == 'y' ]; then # if [ -e "/etc/sysconfig/iptables" ] && [ -n "$(grep '^:INPUT DROP' /etc/sysconfig/iptables)" -a -n "$(grep 'NEW -m tcp --dport 22 -j ACCEPT' /etc/sysconfig/iptables)" -a -n "$(grep 'NEW -m tcp --dport 80 -j ACCEPT' /etc/sysconfig/iptables)" ]; then # IPTABLES_STATUS=yes # else # IPTABLES_STATUS=no # fi # # if [ "$IPTABLES_STATUS" == "no" ]; then # [ -e "/etc/sysconfig/iptables" ] && /bin/mv /etc/sysconfig/iptables{,_bk} # cat > /etc/sysconfig/iptables << EOF ## Firewall configuration written by system-config-securitylevel ## Manual customization of this file is not recommended. #*filter #:INPUT DROP [0:0] #:FORWARD ACCEPT [0:0] #:OUTPUT ACCEPT [0:0] #:syn-flood - [0:0] #-A INPUT -i lo -j ACCEPT #-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT #-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT #-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT #-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT #-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT #COMMIT #EOF # fi # # FW_PORT_FLAG=$(grep -ow "dport ${ssh_port}" /etc/sysconfig/iptables) # [ -z "${FW_PORT_FLAG}" -a "${ssh_port}" != "22" ] && sed -i "s@dport 22 -j ACCEPT@&\n-A INPUT -p tcp -m state --state NEW -m tcp --dport ${ssh_port} -j ACCEPT@" /etc/sysconfig/iptables # /bin/cp /etc/sysconfig/{iptables,ip6tables} # sed -i 's@icmp@icmpv6@g' /etc/sysconfig/ip6tables # iptables-restore < /etc/sysconfig/iptables # ip6tables-restore < /etc/sysconfig/ip6tables # service iptables save # service ip6tables save # chkconfig --level 3 iptables on # chkconfig --level 3 ip6tables on #fi #service rsyslog restart #service sshd restart # #. /etc/profile while :; do echo echo "${CMSG}Please restart the server and see if the services start up fine.${CEND}" read -e -p "Do you want to restart OS ? [y/n]: " reboot_flag if [[ ! "${reboot_flag}" =~ ^[y,n]$ ]]; then echo "${CWARNING}Input error! Please only input 'y' or 'n'${CEND}" else break fi done [ "${reboot_flag}" == 'y' ] && reboot
true
dbca02320885539a63a840b166f972afc9343a9b
Shell
HarikaYarlagadda/ShellScriptPracticeProblems
/day5/5random.sh
UTF-8
293
3.015625
3
[]
no_license
#! /bin/bash -x numberOne=$(( RANDOM%99 +10 )) numberTwo=$(( RANDOM%99 +10 )) numberThree=$(( RANDOM%99 +10 )) numberFour=$(( RANDOM%99 +10 )) numberFive=$(( RANDOM%99 +10 )) sum=$(( $numberOne+$numberTwo+$numberThree+$numberFour + $numberFive )) echo $sum average=$(($sum/5)) echo $average
true
fa06a16ac886e04826f24dac941fcd4d3625dc6f
Shell
seykron/cv
/generate.sh
UTF-8
854
2.625
3
[]
no_license
#!/bin/bash SOURCE_DIR=./src OUTPUT_DIR=./docs pandoc --template $SOURCE_DIR/template.html -o $OUTPUT_DIR/cv.es.html $SOURCE_DIR/cv.es.markdown pandoc --template $SOURCE_DIR/template.odt -t odt -o $OUTPUT_DIR/cv.es.odt $SOURCE_DIR/cv.es.markdown pandoc -o $OUTPUT_DIR/cv.es.txt $SOURCE_DIR/cv.es.markdown wkhtmltopdf --enable-local-file-access $OUTPUT_DIR/cv.es.html $OUTPUT_DIR/cv.es.pdf pandoc --template $SOURCE_DIR/template.html -o $OUTPUT_DIR/cv.en.html $SOURCE_DIR/cv.en.markdown pandoc --template $SOURCE_DIR/template.odt -t odt -o $OUTPUT_DIR/cv.en.odt $SOURCE_DIR/cv.en.markdown pandoc -o $OUTPUT_DIR/cv.en.txt $SOURCE_DIR/cv.en.markdown wkhtmltopdf --enable-local-file-access $OUTPUT_DIR/cv.en.html $OUTPUT_DIR/cv.en.pdf # Creates indexes cp $OUTPUT_DIR/cv.en.html $OUTPUT_DIR/index.html cp $OUTPUT_DIR/cv.es.html $OUTPUT_DIR/index.es.html
true
2a60b94c8ed3f361140201720468508b9fb171fb
Shell
SyStem-5/LSOC-Installer
/build.sh
UTF-8
2,284
3.25
3
[]
no_license
#!/bin/bash echo "Building Release" build_dir=build/LSOCInstaller rm -rf $build_dir mkdir -p $build_dir # Base install/uninstall scripts rsync --info=progress2 source/install.sh $build_dir rsync --info=progress2 source/uninstall.sh $build_dir # NeutronCommunicator rsync -a source/neutron_communicator $build_dir rsync --info=progress2 ../LSOC-NeutronCommunicator/target/release/neutron_communicator $build_dir/neutron_communicator/ # BlackBox rsync -a source/blackbox $build_dir rsync --info=progress2 ../LSOC-BlackBox/target/release/black_box $build_dir/blackbox/ # SSH rsync --info=progress2 source/ssh/install.sh $build_dir/ssh/ # Firewall rsync --info=progress2 source/ufw/setup.sh $build_dir/ufw/ # Mosquitto rsync -a source/mosquitto $build_dir --exclude *.tar rsync -a --info=progress2 ../Mosquitto-Auth-DockerImage/ $build_dir/mosquitto/mosquitto_docker \ --exclude .vscode \ --exclude .git \ --exclude .gitignore \ --exclude .gitmodules # Postgress rsync -a source/postgres $build_dir --exclude *.tar ## Web Interface ## # Copy the install script from LSOC-Installer rsync -a --info=progress2 source/web_interface $build_dir \ --exclude nginx.conf \ --exclude docker-compose.yml # Web Application - Copy the WebApp docker images rsync -a --info=progress2 ../WebApp-Docker/ $build_dir/web_interface/webinterface_docker \ --exclude .git \ --exclude README.md # Web Application - Copy our docker-compose file and nginx configuration rsync --info=progress2 source/web_interface/nginx.conf $build_dir/web_interface/webinterface_docker/nginx/ rsync --info=progress2 source/web_interface/docker-compose.yml $build_dir/web_interface/webinterface_docker/ # Copy the actual django web application rsync -a --info=progress2 ../LSOC-WebInterface/ $build_dir/web_interface/webinterface_docker/django/app \ --exclude .vscode \ --exclude .git \ --exclude __pycache__ \ --exclude README.md \ --exclude run_dev_server.sh \ --exclude set_dev_env_vars.sh \ --exclude .gitignore # Copy the version file to the base dir two levels lower mv $build_dir/web_interface/webinterface_docker/django/app/webinterface.version $build_dir/web_interface/webinterface_docker
true
1efaf6147e66535fc75f7a51afd5d1777034a531
Shell
valencik/dotfiles
/bootstrap.sh
UTF-8
1,202
3.609375
4
[]
no_license
#!/bin/bash # Bootstrap a clean OS X install # Define mesage output types and colours ERROR="$(tput setaf 1)ERROR:$(tput sgr 0)" BOOTSTRAP="$(tput setaf 2)BOOTSTRAP:$(tput sgr 0)" # Ask for the administrator password upfront sudo -v # Keep-alive: update existing `sudo` time stamp until `.osx` has finished while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & echo "${BOOTSTRAP} Installing xcode command line tools - May require user interaction" sudo xcode-select --install read -p "${BOOTSTRAP} Press any key when Xcode install completes" echo "${BOOTSTRAP} Installing homebrew..." ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor brew update echo "${BOOTSTRAP} Installing java cask" brew cask install java echo "${BOOTSTRAP} Installing formulae and casks from .brewfile..." xargs <brewlist.txt brew install brew cleanup echo "${BOOTSTRAP} Installing oh-my-zsh" curl -L http://install.ohmyz.sh | sh echo "${BOOTSTRAP} Installing python libraries from .pipfile..." pip3 install --upgrade -r .pipfile echo "${BOOTSTRAP} Running .gitsetup script..." ./.gitsetup echo "${BOOTSTRAP} Running .osx script..." ./.osx
true
4dc74ad63ebb0b1312a1d1fec9907fd291fa6565
Shell
andyhorng/dotfiles
/juanghurtado.zsh-theme
UTF-8
2,576
3.1875
3
[]
no_license
# ------------------------------------------------------------------------ # Juan G. Hurtado oh-my-zsh theme # (Needs Git plugin for current_branch method) # ------------------------------------------------------------------------ # Color shortcuts RED=$fg[red] YELLOW=$fg[yellow] GREEN=$fg[green] WHITE=$fg[white] BLUE=$fg[blue] RED_BOLD=$fg_bold[red] YELLOW_BOLD=$fg_bold[yellow] GREEN_BOLD=$fg_bold[green] WHITE_BOLD=$fg_bold[white] BLUE_BOLD=$fg_bold[blue] RESET_COLOR=$reset_color # Format for git_prompt_info() ZSH_THEME_GIT_PROMPT_PREFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX="" # Format for parse_git_dirty() ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)" ZSH_THEME_GIT_PROMPT_CLEAN="" # Format for git_prompt_status() ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged" ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted" ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed" ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified" ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added" ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked" # Format for git_prompt_ahead() ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)" # Format for git_prompt_long_sha() and git_prompt_short_sha() ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}" ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" # Begin a segment # Takes two arguments, background and foreground. Both can be omitted, # rendering default background/foreground. prompt_segment() { local bg fg [[ -n $1 ]] && bg="%K{$1}" || bg="%k" [[ -n $2 ]] && fg="%F{$2}" || fg="%f" if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " else echo -n "%{$bg%}%{$fg%} " fi CURRENT_BG=$1 [[ -n $3 ]] && echo -n $3 } # Status: # - was there an error # - am I root # - are there background jobs? prompt_status() { local symbols symbols=() [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{red}%}⚙" [[ -n "$symbols" ]] && prompt_segment default default "$symbols" } # End the prompt, closing any open segments prompt_end() { if [[ -n $CURRENT_BG ]]; then echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" else echo -n "%{%k%}" fi echo -n "%{%f%}" CURRENT_BG='' } # Prompt format PROMPT=' %{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%}$(prompt_status)$(prompt_end) %{$BLUE%}>%{$RESET_COLOR%} ' RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}'
true
9e0c13920ad5946ece84cd5ebecf4395f14f0f03
Shell
hivesolutions/scudum
/scripts/build/extras/xcb-proto.sh
UTF-8
407
3.109375
3
[ "Apache-2.0" ]
permissive
VERSION=${VERSION-1.11} DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]})) set -e +h source $DIR/common.sh depends "python" wget --content-disposition "http://xcb.freedesktop.org/dist/xcb-proto-$VERSION.tar.bz2" rm -rf xcb-proto-$VERSION && tar -jxf "xcb-proto-$VERSION.tar.bz2" rm -f "xcb-proto-$VERSION.tar.bz2" cd xcb-proto-$VERSION ./configure --prefix=$PREFIX --sysconfdir=/etc make && make install
true
acb20eaeb7fd768c4009f53409a0fc8c804089ee
Shell
abuxton/cmd_control
/snmpd_functions.sh
UTF-8
2,312
3.78125
4
[]
no_license
#!/bin/bash # # pf_snmpfunctions.sh - simple callable functions for snmpd.conf # 2011 Karsten McMinn # values hpsocket="/var/run/haproxy" hppid=`pidof -s haproxy` # functions function check_secondsbehind() { if [ -f "/usr/bin/mysql" ]; then r=`mysql -e 'show slave status\G' | grep -i seconds_behind_master | awk '{print $2}'` if [[ $r =~ ^[0-9]+$ ]]; then echo $r elif [[ $r =~ [a-zA-Z]+ ]]; then echo "9999" elif [[ $(uname -n) =~ [a-zA-Z]+[0-9]+m ]]; then echo "0" else echo "9999" fi else echo "20"; # a warning fi } function check_pps() { rpps1=`netstat --interfaces=eth0|awk 'END { print $4 };'` wpps1=`netstat --interfaces=eth0|awk 'END { print $8 };'` sleep 1 rpps2=`netstat --interfaces=eth0|awk 'END { print $4 };'` wpps2=`netstat --interfaces=eth0|awk 'END { print $8 };'` let rpps=$rpps2-$rpps1 let wpps=$wpps2-$wpps1 let pps=$rpps+$wpps echo $pps } function check_haproxycpu() { echo $(ps -p ${hppid} -o %cpu|tail -1) } function check_haproxytasks() { tasks=`echo "show info" | socat ${hpsocket} stdio | awk 'NR==17 { print $2 };'` if [ ${tasks} == "" ]; then tasks=`echo "show info" | socat ${hpsocket} stdio | awk 'NR==17 { print $2 };'` fi echo $tasks } function check_haproxyconns() { cons=`echo "show info" | socat ${hpsocket} stdio | awk 'NR==14 { print $2 };'` if [ ${cons} == "" ]; then cons=`echo "show info" | socat ${hpsocket} stdio | awk 'NR==14 { print $2 };'` fi echo $cons } function check_haproxyqueue() { qlen=`echo "show info" | socat ${hpsocket} stdio | awk 'NR==18 { print $2 };'` if [ ${qlen} = "" ]; then qlen=`echo "show info" | socat ${hpsocket} stdio | awk 'NR==18 { print $2 };'` fi echo $qlen } function check_haproxymem() { echo $(ps -p ${hppid} -o vsz|tail -1) } function check_haproxy_ssl_percentage() { ssl_connection_count=`echo "show sess" | socat ${hpsocket} stdio | grep ssl | wc -l` total_connection_count=`echo "show sess" | socat ${hpsocket} stdio | grep jetty | wc -l` percentage_ssl=`/bin/echo -e "scale = 5\n (${ssl_connection_count} / ${total_connection_count}) * 100" | bc` echo $percentage_ssl } # check for a input, die silently if none if [ -e $1 ]; then exit 1 else function=$1 fi # execute ${function} exit 0
true
8e0f49e3870cd63d9c9dd41da9f77fb14eff61b3
Shell
chetnap19/Array
/LargestAndSmallestWithoutSorting.sh
UTF-8
402
3.453125
3
[]
no_license
#!/bin/bash for ((i=0; i<10; i++)) do random=$((RANDOM%900 + 100)); randomNumber[$i]="$random"; done echo Array element without sorting: ${randomNumber[@]} secondLargest=$(printf '%s\n' "${randomNumber[@]}" | sort -n | tail -2 | head -1) secondSmallest=$(printf '%s\n' "${randomNumber[@]}" | sort -n | head -2 | tail -1) echo second largest: $secondLargest echo second smallest: $secondSmallest
true
3636cd0c69eb1420fa3596dfb599d567f107ca31
Shell
Journlas/consent
/consent-idp/docker/entrypoint.sh
UTF-8
3,028
3.109375
3
[]
no_license
#! /bin/bash if [[ -z $SESSION_DURATION_IN_MINUTES ]]; then echo "using session duration of an hour" export SESSION_DURATION_IN_MINUTES=60 fi # Copy key and certificates cp /cert/${IDP_CERTIFICATE} /var/simplesamlphp/cert/certificate.crt cp /cert/${IDP_PRIVATE_KEY} /var/simplesamlphp/cert/certificate.pem # Copy the templates cp -r /var/simplesamlphp/config-templates/* /var/simplesamlphp/config/ cp -r /var/simplesamlphp/metadata-templates/* /var/simplesamlphp/metadata/ # Copy metadata cp -r /metadata/* /var/simplesamlphp/metadata/ # Configure the IDP according to environment variables grep -rl auth.adminpassword /var/simplesamlphp/config/config.php | xargs sed -i "s/123/${IDP_ADMIN_PASSWORD}/g" grep -rl technicalcontact_email /var/simplesamlphp/config/config.php | xargs sed -i "s/na@example.org/${IDP_TECHNICAL_EMAIL}/g" grep -rl secretsalt /var/simplesamlphp/config/config.php | xargs sed -i "s/'secretsalt' => 'defaultsecretsalt',/'secretsalt' => '${IDP_SECRET_SALT}',/g" grep -rl enable.saml20-idp /var/simplesamlphp/config/config.php | xargs sed -i "s/'enable.saml20-idp' => false,/'enable.saml20-idp' => true,/g" grep -rl tempdir /var/simplesamlphp/config/config.php | xargs sed -i "s/'tempdir' => '\/tmp\/simplesaml',/'tempdir' => '\/tmp\/simplesaml-idp',/g" grep -rl baseurlpath /var/simplesamlphp/config/config.php | xargs sed -i "s/'baseurlpath' => 'simplesaml\/',/'baseurlpath' => '${IDP_PROTOCOL}:\/\/${IDP_HOSTNAME}\/${IDP_CONTEXTPATH}\/',/g" grep -rl logging.processname /var/simplesamlphp/config/config.php | xargs sed -i "s/'logging.processname' => 'simplesamlphp',/'logging.processname' => 'simplesamlphp-idp',/g" grep -rl logging.logfile /var/simplesamlphp/config/config.php | xargs sed -i "s/'logging.logfile' => 'simplesamlphp.log',/'logging.logfile' => 'simplesamlphp-idp.log',/g" grep -rl session.cookie.path /var/simplesamlphp/config/config.php | xargs sed -i "s/'session.cookie.path' => '\/',/'session.cookie.path' => '\/${IDP_CONTEXTPATH}\/',/g" grep -rl auth /var/simplesamlphp/metadata/saml20-idp-hosted.php | xargs sed -i "s/example-userpass/default-sp/g" grep -rl session.duration /var/simplesamlphp/config/config.php | xargs sed -i "s/8 \* (60 \* 60),/${SESSION_DURATION_IN_MINUTES} \* 60,/g" if [[ -z $IDP_THEME ]]; then echo "using default theme" else echo "using theme: $IDP_THEME" grep -rl theme.use /var/simplesamlphp/config/config.php | xargs sed -i "s/'theme.use.*'/'theme.use' => '\/${IDP_THEME}\/'/g" fi # Configure apache envsubst < /templates/apache2.conf > /etc/apache2/apache2.conf sed -i "s|SOURCE_IDP_URL|$SOURCE_IDP_URL|g" /var/simplesamlphp/config/authsources.php sed -i "s|__CONSENT_SERVICE_URL__|$CONSENT_SERVICE_URL|g" /var/simplesamlphp/config/config.php sed -i "s|__USER_ID_ATTR__|$USER_ID_ATTR|g" /var/simplesamlphp/config/config.php sed -i "s|__LOG_LEVEL__|$LOG_LEVEL|g" /var/simplesamlphp/config/config.php sed -i "s|__CORRELATION_ID__|$CORRELATION_ID|g" /var/simplesamlphp/config/config.php # check that is set SOURCE_IDP_URL apache2 -DFOREGROUND
true
676eb5737655567efef25872ad32f70fb01c57b2
Shell
mbodenhamer/docker-alpine-data
/tests/data.bats
UTF-8
553
3.0625
3
[ "MIT" ]
permissive
#!/usr/bin/env bats load test_helpers @test "[$TEST_FILE] Check entrypoint args behavior" { run launch_args pwd [[ $lines[0] =~ "/" ]] } @test "[$TEST_FILE] Check default behavior" { launch # Check that tar is present run docker exec -it $TEST_CONTAINER tar [[ $output =~ "BusyBox" ]] # Check that zip is present run docker exec -it $TEST_CONTAINER zip [[ $output =~ "Copyright (c)" ]] # Check that unzip is present run docker exec -it $TEST_CONTAINER unzip [[ $output =~ "BusyBox" ]] cleanup }
true
2959a9c9a31e647fde78b03ceb287429fd11bca8
Shell
hugodrak/tools
/dirsize.sh
UTF-8
128
2.953125
3
[]
no_license
#!/bin/bash path1="$PWD/$1" cd $path1 echo “The largest files/directories in $1 are:” du -sh * | sort -hr | head | cat -n -
true
ea8d2781b1490c73442eed8c49fa73f3eb797da2
Shell
sudip-aubergine/rentroll
/test/rls/functest.sh
UTF-8
23,275
3.015625
3
[]
no_license
#!/bin/bash TESTHOME=.. SRCTOP=${TESTHOME}/.. TESTNAME="RentableLeaseStatus" TESTSUMMARY="Test Rentable Lease Status code" DBGENDIR=${SRCTOP}/tools/dbgen CREATENEWDB=0 RRBIN="${SRCTOP}/tmp/rentroll" CATRML="${SRCTOP}/tools/catrml/catrml" #SINGLETEST="" # This runs all the tests source ${TESTHOME}/share/base.sh echo "STARTING RENTROLL SERVER" RENTROLLSERVERAUTH="-noauth" # RENTROLLSERVERNOW="-testDtNow 10/24/2018" #------------------------------------------------------------------------------ # TEST a # # Validate that the dates are properly EDI handled # # Scenario: # End dates are listed as the actual date - 1day because the last day is # inclusive # # # Expected Results: # 1. In the database, the key date ranges are set as follows: # 1/1/2019 - 1/3/2019 # 1/3/2019 - 3/1/2020 # 3/1/2020 - 12/31/9999 # # Since the business has the EDI flag set, the UI must send # the data with the following date ranges: # 1/1/2019 - 1/2/2019 # 1/3/2019 - 2/29/2020 # 3/1/2020 - 12/30/9999 #------------------------------------------------------------------------------ TFILES="a" STEP=0 if [ "${SINGLETEST}${TFILES}" = "${TFILES}" -o "${SINGLETEST}${TFILES}" = "${TFILES}${TFILES}" ]; then stopRentRollServer mysql --no-defaults rentroll < x${TFILES}.sql startRentRollServer echo "%7B%22cmd%22%3A%22get%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A100%2C%22offset%22%3A0%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-SaveWithError" fi #------------------------------------------------------------------------------ # TEST b # # Validate that save biz logic catches overlap propblems. This was from a bug # discovered in the UI. # # Scenario: # A new RentableStatusRecord overlaps with an existing record # # Expected Results: # 1. In the database, the RentableLeaseStatus records for RID 1 are: # 1/1/2019 - 1/3/2019 # 1/3/2019 - 3/1/2020 # 3/1/2020 - 3/5/2020 # # An attempt to save a new record with this date range: # 3/4/2020 - 12/31/9999 # This will change the 3rd region above to 3/1/2020 - 3/4/2020 # and add a new record from 3/4/2020 to 12/31/9999 # # 1. Next we attempt to save a new record with this date range # 3/5/2020 - 12/31/9999 # and this should work. #------------------------------------------------------------------------------ TFILES="b" STEP=0 if [ "${SINGLETEST}${TFILES}" = "${TFILES}" -o "${SINGLETEST}${TFILES}" = "${TFILES}${TFILES}" ]; then stopRentRollServer mysql --no-defaults rentroll < x${TFILES}.sql startRentRollServer echo "%7B%22cmd%22%3A%22save%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A0%2C%22offset%22%3A0%2C%22changes%22%3A%5B%7B%22recid%22%3A3%2C%22BID%22%3A1%2C%22BUD%22%3A%22REX%22%2C%22RID%22%3A1%2C%22RLID%22%3A0%2C%22LeaseStatus%22%3A0%2C%22DtStart%22%3A%223%2F4%2F2020%22%2C%22DtStop%22%3A%2212%2F1%2F9999%22%7D%5D%2C%22RID%22%3A1%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save" echo "%7B%22cmd%22%3A%22save%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A0%2C%22offset%22%3A0%2C%22changes%22%3A%5B%7B%22recid%22%3A3%2C%22BID%22%3A1%2C%22BUD%22%3A%22REX%22%2C%22RID%22%3A1%2C%22RLID%22%3A0%2C%22LeaseStatus%22%3A0%2C%22DtStart%22%3A%223%2F5%2F2020%22%2C%22DtStop%22%3A%2212%2F1%2F9999%22%7D%5D%2C%22RID%22%3A1%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save" fi #------------------------------------------------------------------------------ # TEST c # # Validate search service virtual scroll support discovered in the UI. # Also, test the delete web service # # Scenario: # The RentableStatusRecords for a rentable are greater than 100 (default # request size). This test will validate the return values for successive # calls from the virtual control list. # # Expected Results: # 1. First batch has OFFSET = 0, LIMIT = 100. # The count will be > 100, but the returned solution set will contain # 100 entries. # # 1. Next we attempt to save a new record with this date range # 3/5/2020 - 12/30/9999 # and this should work. # # 3. Delete 3 RLID records in one call (254,255,171) # After the delete, a fetch over date range 2/16/2022 - 12/31/2022 # should result in only one RLID (172) #------------------------------------------------------------------------------ TFILES="c" STEP=0 if [ "${SINGLETEST}${TFILES}" = "${TFILES}" -o "${SINGLETEST}${TFILES}" = "${TFILES}${TFILES}" ]; then stopRentRollServer mysql --no-defaults rentroll < x${TFILES}.sql startRentRollServer echo "%7B%22cmd%22%3A%22get%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A100%2C%22offset%22%3A0%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/3" "request" "${TFILES}${STEP}" "RentableTypeRefs-Get" echo "%7B%22cmd%22%3A%22get%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A100%2C%22offset%22%3A100%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/3" "request" "${TFILES}${STEP}" "RentableTypeRefs-GetOffset" # Delete 254,255,171 echo "%7B%22cmd%22%3A%22delete%22%2C%22RLIDList%22%3A%5B254%2C255%2C171%5D%2C%22limit%22%3A100%2C%22offset%22%3A0%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/3" "request" "${TFILES}${STEP}" "RentableTypeRefs-GetOffset" # Read back time range 2/16/2022 - 12/31/2022. We should only find 1 entry (RLID=172) echo "%7B%22cmd%22%3A%22get%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A100%2C%22offset%22%3A0%2C%22searchDtStart%22%3A%222%2F16%2F2022%22%2C%22searchDtStop%22%3A%2212%2F31%2F2022%22%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/3" "request" "${TFILES}${STEP}" "RentableTypeRefs-GetOffset" fi #------------------------------------------------------------------------------ # TEST d # # Validate the update of existing RentableLeaseStatus records. The test is # the result of a bug where a new record is inserted that has the same end # date as the record after it. # # Scenario: # The results of updates to RentableLeaseStatus records should be that # the start to end time ranged formed by all records has no overlaps. # The first test starts with the database as follows: # # 7/ 1/2019 - 12/31/9999 Reserved # 7/ 1/2018 - 6/30/2019 Leased # 1/ 1/2018 - 6/30/2018 Not Leased # # Expected Results: # # 1. The test will change the Leased range from 7/1/2018 - 6/21/2019. # The result should be: # # 6/21/2019 - 12/31/9999 Reserved # 7/ 1/2018 - 6/21/2019 Leased # 1/ 1/2018 - 6/30/2018 Not Leased # #------------------------------------------------------------------------------ TFILES="d" STEP=0 if [ "${SINGLETEST}${TFILES}" = "${TFILES}" -o "${SINGLETEST}${TFILES}" = "${TFILES}${TFILES}" ]; then stopRentRollServer mysql --no-defaults rentroll < x${TFILES}.sql startRentRollServer # change to Leased = 7/1/2018 - 6/21/2019 (note: xd.sql was already in that # LeaseStatus state. But it should not add a new record) encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":3,"BID":1,"BUD":"REX","RID":1,"LeaseStatus":1,"DtStart":"7/1/2018","DtStop":"6/20/2019","Comment":"","CreateBy":0,"LastModBy":0,"w2ui":{}}],"RID":1}' > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Save" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Get" # set 6/21/2019 - 12/31/9999 to Reserved encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":0,"RLID":4,"BID":1,"BUD":"REX","RID":1,"LeaseStatus":2,"DtStart":"6/21/2019","DtStop":"12/30/9999","Comment":"","CreateBy":0,"LastModBy":0,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Save" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Get" # do both of the above actions in a single webcall encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":3,"BID":1,"BUD":"REX","RID":1,"LeaseStatus":1,"DtStart":"7/1/2018","DtStop":"6/20/2019","Comment":"","CreateBy":0,"LastModBy":0,"w2ui":{}},{"recid":0,"RLID":4,"BID":1,"BUD":"REX","RID":1,"LeaseStatus":2,"DtStart":"6/21/2019","DtStop":"12/30/9999","Comment":"","CreateBy":0,"LastModBy":0,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-GetOffset" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Get" fi #------------------------------------------------------------------------------ # TEST e # # This test covers an issue found in the Rental Agreement testing # # Scenario: # Start with these Rentable Lease Status records # # 3/01/2020 - 12/31/9999 Reserved # 2/13/2018 - 3/01/2020 Leased # 1/01/2017 - 2/13/2018 Not Leased # # Then do a SetRentableLeaseStatus for range 2/13/2018 - 3/1/2020 # # Expected Results: # # 1. The test will change the Leased range from 2/13/2018 - 3/1/2020. # # 3/01/2020 - 12/31/9999 Reserved # 2/13/2018 - 3/01/2020 Leased # 1/01/2017 - 2/13/2018 Not Leased # #------------------------------------------------------------------------------ TFILES="e" STEP=0 if [ "${SINGLETEST}${TFILES}" = "${TFILES}" -o "${SINGLETEST}${TFILES}" = "${TFILES}${TFILES}" ]; then stopRentRollServer mysql --no-defaults rentroll < x${TFILES}.sql startRentRollServer # change to Leased = 2/13/2018 - 3/1/2020 echo "%7B%22cmd%22%3A%22save%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A0%2C%22offset%22%3A0%2C%22changes%22%3A%5B%7B%22recid%22%3A1%2C%22RLID%22%3A3%2C%22BID%22%3A1%2C%22BUD%22%3A%22REX%22%2C%22RID%22%3A1%2C%22LeaseStatus%22%3A1%2C%22DtStart%22%3A%222%2F13%2F2018%22%2C%22DtStop%22%3A%222%2F29%2F2020%22%2C%22Comment%22%3A%22%22%2C%22CreateBy%22%3A0%2C%22LastModBy%22%3A0%2C%22w2ui%22%3A%7B%7D%7D%5D%2C%22RID%22%3A1%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Save" echo "%7B%22cmd%22%3A%22get%22%2C%22selected%22%3A%5B%5D%2C%22limit%22%3A100%2C%22offset%22%3A0%7D" > request dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableTypeRefs-Get" fi #------------------------------------------------------------------------------ # TEST f # # Error that came up in UI testing. Overlapping of same type should be merged. # # Scenario: # # test all known cases of SetRentableLeaseStatus # # Expected Results: # see detailed comments below. Each case refers to an area in the source # code that it should hit. If there's anything wrong, we'll know right # where to go in the source to fix it. # #------------------------------------------------------------------------------ TFILES="f" STEP=0 if [ "${SINGLETEST}${TFILES}" = "${TFILES}" -o "${SINGLETEST}${TFILES}" = "${TFILES}${TFILES}" ]; then stopRentRollServer mysql --no-defaults rentroll < x${TFILES}.sql startRentRollServer #----------------------------------- # INITIAL RENTABLE LEASE STATUS # Use DtStart DtStop # ---------------------------- # 2 08/01/2019 - 12/31/9999 # 2 04/01/2019 - 08/01/2019 # 1 03/01/2018 - 04/01/2019 # 0 01/01/2018 03/01/2019 # Total Records: 4 #----------------------------------- #-------------------------------------------------- # SetRentableLeaseStatus - Case 1a # Note: EDI in effect, DtStop expressed as "through 8/31/2019" # SetStatus 2 (reserved) 4/1/2019 - 9/1/2019 # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 04/01/2019 - 12/31/9999 # 1 03/01/2019 04/01/2019 # 0 01/01/2018 03/01/2019 # Total Records: 3 #-------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"BID":1,"BUD":"REX","RID":1,"LeaseStatus":2,"DtStart":"4/1/2019","DtStop":"8/31/2019","Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-1a" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #-------------------------------------------------- # SetRentableLeaseStatus - Case 1c # SetStatus 0 (not leased) 4/1/2019 - 9/1/2019 # Note: EDI in effect, DtStop expressed as "through 8/31/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/01/2019 - 12/31/9999 # 0 04/01/2019 - 09/01/2019 # 1 03/01/2019 04/01/2019 # 0 01/01/2018 03/01/2019 # Total Records: 4 #-------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"BID":1,"BUD":"REX","RID":1,"LeaseStatus":0,"DtStart":"4/1/2019","DtStop":"8/31/2019","Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-1c" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #------------------------------------------------------- # SetRentableLeaseStatus - Case 1b #----------------------------------------------- # CASE 1a - rus contains b[0], match == false #----------------------------------------------- # b[0]: @@@@@@@@@@@@@@@@@@@@@ # rus: ############ # Result: @@@@@############@@@@ #---------------------------------------------------- # SetStatus 1 (leased) 9/15/2019 - 9/22/2019 # Note: EDI in effect, DtStop expressed as "through 9/21/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/22/2019 - 12/31/9999 # 1 09/15/2019 - 09/22/2019 # 2 09/01/2019 - 09/15/2019 # 0 04/01/2019 - 09/01/2019 # 1 03/01/2019 04/01/2019 # 0 01/01/2018 03/01/2019 # Total Records: 6 #------------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"LeaseStatus":1,"DtStart":"9/15/2019","DtStop":"9/21/2019","BID":1,"BUD":"REX","RID":1,"Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-1b" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #------------------------------------------------------- # SetRentableLeaseStatus - Case 1d #----------------------------------------------- # CASE 1d - rus prior to b[0], match == false #----------------------------------------------- # rus: @@@@@@@@@@@@ # b[0]: ########## # Result: ####@@@@@@@@@@@@ #----------------------------------------------- # SetStatus 1 (leased) 3/15/2019 - 9/01/2019 # Note: EDI in effect, DtStop expressed as "through 8/31/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/22/2019 - 12/31/9999 # 1 09/15/2019 - 09/22/2019 # 2 09/01/2019 - 09/15/2019 # 0 03/15/2019 - 09/01/2019 # 1 03/01/2018 03/15/2019 # 0 01/01/2018 03/01/2019 # Total Records: 6 #------------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":0,"LeaseStatus":0,"DtStart":"3/15/2019","DtStop":"8/31/2019","BID":1,"BUD":"REX","RID":1,"Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-1d" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #------------------------------------------------------- # SetRentableLeaseStatus - Case 2b #----------------------------------------------- # Case 2b # neither match. Update both b[0] and b[1], add new rus # b[0:1] @@@@@@@@@@************ # rus ####### # Result @@@@@@#######********* #----------------------------------------------- # SetStatus 1 (leased) 8/1/2019 - 9/7/2019 # Note: EDI in effect, DtStop expressed as "through 9/6/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/22/2019 - 12/31/9999 # 1 09/15/2019 - 09/22/2019 # 2 09/01/2019 - 09/15/2019 # 1 08/01/2019 - 09/07/2019 # 0 03/15/2019 - 08/01/2019 # 1 03/01/2018 03/15/2019 # 0 01/01/2018 03/01/2019 # Total Records: 7 #------------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"LeaseStatus":1,"DtStart":"8/1/2019","DtStop":"9/6/2019","BID":1,"BUD":"REX","RID":1,"Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-2b" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #------------------------------------------------------- # SetRentableLeaseStatus - Case 2c #----------------------------------------------- # Case 2c # merge rus and b[0], update b[1] # b[0:1] @@@@@@@@@@************ # rus @@@@@@@ # Result @@@@@@@@@@@@@********* #----------------------------------------------- # SetStatus 0 (not leased) 7/1/2019 - 8/7/2019 # Note: EDI in effect, DtStop expressed as "through 8/6/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/22/2019 - 12/31/9999 # 1 09/15/2019 - 09/22/2019 # 2 09/01/2019 - 09/15/2019 # 1 08/07/2019 - 09/07/2019 # 0 03/15/2019 - 08/07/2019 # 1 03/01/2018 03/15/2019 # 0 01/01/2018 03/01/2019 # Total Records: 7 #------------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"LeaseStatus":0,"DtStart":"7/1/2019","DtStop":"8/6/2019","BID":1,"BUD":"REX","RID":1,"Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-2c" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #------------------------------------------------------- # SetRentableLeaseStatus - Case 2d #----------------------------------------------- # Case 2d # merge rus and b[1], update b[0] # b[0:1] @@@@@@@@@@************ # rus ******* # Result @@@@@@**************** #----------------------------------------------- # SetStatus 1 (leased) 8/1/2019 - 8/10/2019 # Note: EDI in effect, DtStop expressed as "through 8/9/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/22/2019 - 12/31/9999 # 1 09/15/2019 - 09/22/2019 # 2 09/01/2019 - 09/15/2019 # 1 08/01/2019 - 09/07/2019 # 0 03/15/2019 - 08/01/2019 # 1 03/01/2018 03/15/2019 # 0 01/01/2018 03/01/2019 # Total Records: 7 #------------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"LeaseStatus":1,"DtStart":"8/1/2019","DtStop":"8/10/2019","BID":1,"BUD":"REX","RID":1,"Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-2d" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" #------------------------------------------------------- # SetRentableLeaseStatus - Case 2a #----------------------------------------------- # Case 2a # all are the same, merge them all into b[0], delete b[1] # b[0:1] ********* ************ # rus ******* # Result ********************** #----------------------------------------------- # SetStatus 1 (leased) 3/7/2019 - 8/6/2019 # Note: EDI in effect, DtStop expressed as "through 8/5/2019" # Result needs to be: # Use DtStart DtStop # ---------------------------- # 2 09/22/2019 - 12/31/9999 # 1 09/15/2019 - 09/22/2019 # 2 09/07/2019 - 09/15/2019 # 1 03/01/2018 09/07/2019 # 0 01/01/2018 03/01/2019 # Total Records: 7 #------------------------------------------------------- encodeRequest '{"cmd":"save","selected":[],"limit":0,"offset":0,"changes":[{"recid":1,"RLID":13,"LeaseStatus":1,"DtStart":"3/7/2019","DtStop":"8/5/2019","BID":1,"BUD":"REX","RID":1,"Comment":"","CreateBy":211,"LastModBy":211,"w2ui":{}}],"RID":1}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Save-2a" encodeRequest '{"cmd":"get","selected":[],"limit":100,"offset":0}' dojsonPOST "http://localhost:8270/v1/rentableleasestatus/1/1" "request" "${TFILES}${STEP}" "RentableLeaseStatus-Search" fi stopRentRollServer echo "RENTROLL SERVER STOPPED" logcheck exit 0
true
1fbb2b4cdcc7d5049d44fd0d7606887044d44584
Shell
rst0git/p4-dpdk-target
/tools/run_bfshell.sh
UTF-8
3,460
3.8125
4
[ "Apache-2.0" ]
permissive
#!/bin/bash ## ## Copyright(c) 2021 Intel Corporation. ## ## 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. ## # Start running bfshell function print_help() { echo "USAGE: $(basename ""$0"") [OPTIONS]" echo "Options for running bfshell:" echo " -f <command_file>" echo " bfshell command input file." echo " -b <python_script>" echo " bfrt_python script to run." echo " -i" echo " if -b provided, start interactive mode after completion." echo " -a <ipv4_addr>" echo " Connect to this ipv4 address." echo " -p <port>" echo " open connection on this port." echo " -d <devices>" echo " Wait for these devices to be ready (1 or 0-2 or 0,4,6-8)" echo " --no-status-srv" echo " Do not query bf_switchd's status server" echo " --status-port <port number>" echo " Specify bf_switchd's status server port number; the default is 7777" echo " -h" echo " Display this help." exit 0 } trap 'exit' ERR [ -z ${SDE} ] && echo "Environment variable SDE not set" && exit 1 [ -z ${SDE_INSTALL} ] && echo "Environment variable SDE_INSTALL not set" && exit 1 echo "Using SDE ${SDE}" echo "Using SDE_INSTALL ${SDE_INSTALL}" opts=`getopt -o f:b:ia:p:d:h --long no-status-srv --long status-port: -- "$@"` if [ $? != 0 ]; then exit 1 fi eval set -- "$opts" BFPY_INTERACTIVE=false SKIP_STATUS_SRV=false HELP=false while true; do case "$1" in -f) FILE_NAME=$2; shift 2;; -b) BFPY_FILE=$2; shift 2;; -i) BFPY_INTERACTIVE=true; shift 1;; -a) IPV4=$2; shift 2;; -p) PORT=$2; shift 2;; -d) DEVICES=$2; shift 2;; -h) HELP=true; shift 1;; --status-port) STS_PORT=$2; shift 2;; --no-status-srv) SKIP_STATUS_SRV=true; shift 1;; --) shift; break;; esac done if [ $HELP = true ]; then print_help fi # Check in with bf_switchd's status server to make sure it is ready STS_PORT_STR="--port 7777" if [ "$STS_PORT" != "" ]; then STS_PORT_STR="--port $STS_PORT" fi STS_HOST_STR="--host localhost" if [ "$IPV4" != "" ]; then STS_HOST_STR="--host $IPV4" fi STS_DEV_STR="--device 0" if [ "$DEVICE" != "" ]; then STS_DEV_STR="--device $DEVICES" fi if [ "$TARGET" != "bmv2" ]; then if [ $SKIP_STATUS_SRV = false ]; then python $SDE_INSTALL/lib/python2.7/site-packages/p4testutils/bf_switchd_dev_status.py \ $STS_HOST_STR $STS_PORT_STR $STS_DEV_STR fi fi FILE_NAME_STR="" if [ "$FILE_NAME" != "" ]; then FILE_NAME_STR="-f $FILE_NAME" fi BFPY_FILE_STR="" if [ "$BFPY_FILE" != "" ]; then BFPY_FILE_STR="-b $BFPY_FILE" fi BFPY_INTERACTIVE_STR="" if [ $BFPY_INTERACTIVE = true ]; then BFPY_INTERACTIVE_STR="-i" fi IPV4_STR="" if [ "$IPV4" != "" ]; then IPV4_STR="-a $IPV4" fi PORT_STR="" if [ "$PORT" != "" ]; then PORT_STR="-p $PORT" fi #Run bfshell client echo $SDE_INSTALL/bin/bfshell $FILE_NAME $BFPY_FILE $IPV4 $PORT $SDE_INSTALL/bin/bfshell $FILE_NAME_STR $BFPY_FILE_STR $BFPY_INTERACTIVE_STR $IPV4_STR $PORT_STR
true
ef6b14284088b6f4c03be107234b3c8a2e20e41f
Shell
chelseatroy/fun_with_transactions
/setup.sh
UTF-8
242
2.734375
3
[]
no_license
declare -a COMMANDS=("GET" "SET" "COUNT" "DELETE") for COMMAND in "${COMMANDS[@]}" do chmod +x "$COMMAND" done mkdir -p ~/bin for COMMAND in "${COMMANDS[@]}" do cp "$COMMAND" ~/bin done cp database.rb ~/bin export PATH=$PATH":$HOME/bin"
true
f8bee4222143a622c5a5563419fa0dc524f2d00f
Shell
agokhale/cantrips
/libexec/networkloadgraph.sh
UTF-8
702
3.25
3
[]
no_license
#!/bin/sh trpp() { echo bye echo networkloadgraph.sh [rows] [cols] [npoints] [iface] [tx/rx] exit 0; } trap trpp KILL INT TERM sc_rows=`tput lines` sc_col=`tput cols` ros=${1:-18} col=${2:-80} histdepth=${3:-1600} fil="/tmp/networkload.history" all_ifaces=`tail -100 $fil | awk '// { print $2} ' | sort | uniq` ifaces=${4:-$all_ifaces} txrx=${5:-tx rx} echo Interface $ifaces while true do clear for iface_c in $ifaces; do for d_c in $txrx; do #echo $iface_c$d_c tail -$histdepth /tmp/networkload.history \ | networkloaddelta.awk -v select=$d_c -v iface=$iface_c \ | xyplot.awk -v rows=$ros -v cols=$col -v title=$iface_c$d_c\(MiBps\) done done sleep 1 done
true
d97102b747b29885dd3a52ab2a414dd1e9def73d
Shell
floft/all-the-papers
/grep_pdfs.sh
UTF-8
1,746
3.515625
4
[]
no_license
#!/bin/bash # # Use pdfgrep to search through all the PDFs to find those that relate to both # GANs and something transfer learning related # dir='pdfs' outdir='grep' # # GAN Terms # - generative adversarial net(s) # - generative adversarial network(s) # - GAN(s) # # TL-Related Terms # - transfer learning # - domain adaptation # - domain generalization # - multi(-)task learning # - multi(-)domain learning # - self(-)taught learning # - co(-)variate shift # - sample(-)selection bias # - life(-)long learning # - inductive transfer # - inductive bias # # Generative-Related Terms # - image generation / generation of images / image synthesis # - super(-)resolution # - image completion # - semantic segmentation # - style transfer (maybe a form of adaptation?) # - generation -- should indicate use for any generative thing (images, samples, ...) # Only do the first three pages so we'll hopefully remove all the ones that are # only from citations that may not actually be related to GANs or TL mkdir -p "$outdir" pdfgrep --cache -Z -P -r --page-range=1-3 --include="*.pdf" "([Gg]enerative [Aa]dversarial|GANs|\ GAN[\ ,\.-])" "$dir" > "$outdir"/gan.txt pdfgrep --cache -Z -P -r -i --page-range=1-3 -o --include="*.pdf" "(transfer learning|domain adaptation|domain generalization|multi[-\ ]?task learning|multi[-\ ]?domain learning|self[-\ ]taught learning|co-?variate shift|sample[-\ ]selection bias|life[-\ ]long learning|inductive bias)" "$dir" > "$outdir"/tl.txt pdfgrep --cache -Z -P -r -i --page-range=1-3 -o --include="*.pdf" "(image generation|generation of images|image synthesis|super[-\ ]resolution|image completion|semantic segmentation|style transfer|generation|synthesis)" "$dir" > "$outdir"/generative.txt
true
9ea9172f9e2e5eaad305db142fb26d594e9cf9a8
Shell
DuckThom/dev-toolkit
/dev
UTF-8
2,411
4.53125
5
[]
no_license
#!/usr/bin/env bash if [ $BASH_VERSINFO -lt 4 ] then echo "This script requires at least bash version 4" exit 1 fi if [ `uname -s` == 'Darwin' ] then READLINK_BIN=`which greadlink` else READLINK_BIN=`which readlink` fi CURRENT_DIR=$(pwd) BASE_PATH=$(dirname $($READLINK_BIN -f $0)) COMMANDS_PATH="" declare -A COMMANDS ## # Create a symlink for the dev script # function create-symlink () { echo "The 'dev' script was not found in your \$PATH" echo "Would you like to create a symlink? $HOME/.local/bin/dev => $CURRENT_DIR/dev ?" echo "Press enter to continue, Ctrl-C to quit" read if [ ! -d "$HOME/.local/bin" ]; then mkdir "$HOME/.local/bin" fi ln -s "$CURRENT_DIR/dev" "$HOME/.local/bin/dev" || exit 1 echo "Symlink created, make sure that '$HOME/.local/bin' is in your \$PATH!" exit 0 } which dev >> /dev/null 2>&1 || create-symlink ## # Load the commands defined in the commands dir # where the 'dev' script is located # function load-global-commands () { while IFS= read -r -d $'\0' line; do source "$line" COMMANDS[$COMMAND]="$HELP_TEXT" done < <(find "$BASE_PATH" -type f -iname "*.command" -print0) } ## # Load the commands defined in the 'dev-commands' folder # which can be located in the current or any parent dir # function load-local-commands () { COMMANDS_PATH=$CURRENT_DIR while [[ "$COMMANDS_PATH" != "" && ! -e "$COMMANDS_PATH/dev-commands" ]]; do COMMANDS_PATH=${COMMANDS_PATH%/*} done COMMANDS_PATH="$COMMANDS_PATH/dev-commands" if [ -d "$COMMANDS_PATH" ]; then while IFS= read -r -d $'\0' line; do source "$line" COMMANDS[$COMMAND]="$HELP_TEXT" done < <(find "$COMMANDS_PATH" -maxdepth 1 -type f -iname "*.command" -print0) fi } ## # Generate the usage screen # function show-usage () { echo "Usage: dev <command>" echo echo "Available commands:" echo for i in "${!COMMANDS[@]}" do echo -en "\e[32m" # Green echo "$i:" echo -en "\e[36m" # Cyan echo " ${COMMANDS[$i]}" echo -en "\e[39m" # Reset to default echo done } load-global-commands load-local-commands if [ "$1" == "" ] || [ "$1" == "help" ]; then show-usage exit 0 fi declare -f "$1" >> /dev/null 2>&1 if [ "$?" == "0" ]; then eval "${@:1}" else show-usage fi
true
5b531f1ca8c1c7597efac4b9e12a5484388ef5fa
Shell
hrmJ/kielimeta_front
/scripts/e2e.test.cur.sh
UTF-8
1,004
3.5
4
[]
no_license
#!/bin/bash # Set environment variables from .env and set NODE_ENV to test source <(npx dotenv-export | sed 's/\\n/\n/g') export NODE_ENV=test # Run our web server as a background process yarn run serve > /dev/null 2>&1 & ## Polling to see if the server is up and running yet TRIES=0 RETRY_LIMIT=50 RETRY_INTERVAL=0.2 SERVER_UP=false while [ $TRIES -lt $RETRY_LIMIT ]; do echo "waiting for the server to get started: $TRIES" if netstat -tulpn 2>/dev/null | grep -q ":$FRONTEND_PORT_TEST.*LISTEN"; then SERVER_UP=true break else sleep $RETRY_INTERVAL let TRIES=TRIES+1 fi done echo $SERVER_UP # Only run this if the WEB server is operational if $SERVER_UP; then for browser in "$@"; do export TEST_BROWSER="$browser" echo -e "\n---------- $TEST_BROWSER test start ----------" npx dotenv cucumber-js features -- --require-module @babel/register --tags @cur --require features/steps echo -e "----------- $TEST_BROWSER test end -----------\n" done fi kill -15 0
true
2e6b26a347b8b8cca885f6d9c18af455f1a1b1f7
Shell
numbnet/termux
/install/package/BackupWithTar.sh
UTF-8
539
2.796875
3
[]
no_license
#!/usr/bin/env bash echo "#===Termux Backup===#" ## Go to direct FILES cd /data/data/com.termux/files mkdir -p /sdcard/Directory/termux_backup_tar tar -czvf /sdcard/Directory/termux_backup_tar/termux-backups.tar.gz –owner=0 –group=0 home usr #$ mkdir -p /sdcard/Directory/termux_backup_dir && tar cf - . | ( cd /sdcard/Directory/termux_backup_dir ; tar xf - ) echo "#===END Backup===#" #$ echo "#===Termux Restore===#" #$ cd /data/data/com.termux/files #$ tar -xvzf /sdcard/Directory/termux_backup_dir/termux-backups.tar.gz
true
f4827c93301050e1f6ff295fa5c14c409d2552d2
Shell
digoal/TPC-DS
/00_compile_tpcds/rollout.sh
UTF-8
442
2.703125
3
[]
no_license
#!/bin/bash set -e PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) source $PWD/../functions.sh source_bashrc step=compile_tpcds init_log $step start_log schema_name="tpcds" table_name="compile" cd $PWD/tools rm -f *.o make cp tpcds.idx $PWD/../../ cp dsdgen $PWD/../../*_gen_data/ cp dsqgen $PWD/../../*_gen_data/ cd ../ rm -rf $PWD/../*_gen_data/query_templates cp -R query_templates $PWD/../*_gen_data/ cd ../ log end_step $step
true
f5dc6758b58361fd281ffe67bafaee3c5f4e1e72
Shell
joelchaconcastillo/srnalightnxtg
/Scripts/Mapping.sh
UTF-8
1,742
3.28125
3
[ "Apache-2.0" ]
permissive
###$1 Archivo de entrada SAM ###$2 Archivo de salida ###$3 Archivo Biomart o GFF o BED ###$4 Id_Libreria ###$5 Id_Genoma ###$6 Ruta echo "Converting file sam..." echo "Fixing columns..." cat $1 | awk '{\ if( !match($1,/^(@HD)/) && !match($1,/^(@SQ)/) && !match($1,/^(@PG)/) && $14 != "" )\ {\ print $1"Secuencia="$10"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"$11"\t"$12"\t"$13"\t"$14 \ }\ else\ {\ print; \ }\ }'> $1_temp echo "Filtering length >= 18..." ./../bin/sambamba view -S $1_temp -F "sequence_length >= 18" -f bam -p -t 1 -o $1_temp.bam #rm $1_temp echo "Shorting Bam..." ./../bin/sambamba sort $1_temp.bam -p -t 1 -o $1_temp_sorted.bam #rm $1_temp.bam echo "Indexing file bam..." ./../bin/sambamba index $1_temp_sorted.bam -t 1 echo "Converting Bam to Bed" ##Tag NM ./../bin/bedtools bamtobed -i $1_temp_sorted.bam -tag NM > $1_temp_sorted.bed echo "Removing temp files..." #rm $1_temp_sorted.bam #rm $1_temp_sorted.bam.bai echo "Checking intersections with overlap > 50% ..." ./../bin/bedtools intersect -a $1_temp_sorted.bed -b $3 -wa -wb -f 0.50 > $2 #./bin/bedtools intersect -a $3 -b $1_temp_sorted.bed -wa -wb -f 0.50 > $2 #rm $1_temp_sorted.bed #echo "Checking score of the reads.." #cut -f4 $2 | sort | uniq -c > $2_Score_Reads echo "Unlinking reads of sequence-name" sed -i 's/Secuencia=/ /g' $2 echo "Checking table frecuency" ./../bin/tally -i $2 -o $2_Reads_Scores -record-format '%I%t%I%t%I%t%I%b%R%#' --nozip -format %R%t%C%n echo "Parse fields to table of database" #perl ./../Scripts/Prepare_Database3.pl --FileIn $2 --FileOut $2_BD --Ruta $6 --Id_Libreria $4 --Id_Genoma $5 php ./../Scripts/Score_sRNAs.php $2 $4 $5 echo "Finished press any key to continue..."
true
a43afc8c8d76a27985077a8c11ab71670195a061
Shell
mrrogers75/MCscripts
/mcbe_setup.sh
UTF-8
2,346
4.3125
4
[ "MIT" ]
permissive
#!/usr/bin/env bash # Exit if error set -e syntax='Usage: mcbe_setup.sh [OPTION]... INSTANCE' args=$(getopt -l help,import: -o hi: -- "$@") eval set -- "$args" while [ "$1" != -- ]; do case $1 in --help|-h) echo "$syntax" echo 'Make new Minecraft Bedrock Edition server in ~mc/bedrock/INSTANCE or import SERVER_DIR.' echo echo Mandatory arguments to long options are mandatory for short options too. echo '-i, --import=SERVER_DIR server directory to import' exit ;; --import|-i) import=$(realpath "$2") shift 2 ;; esac done shift if [ "$#" -lt 1 ]; then >&2 echo Not enough arguments >&2 echo "$syntax" exit 1 elif [ "$#" -gt 1 ]; then >&2 echo Too much arguments >&2 echo "$syntax" exit 1 fi instance=$1 if [ "$instance" != "$(systemd-escape "$instance")" ]; then >&2 echo INSTANCE should be indentical to systemd-escape INSTANCE exit 1 fi server_dir=~mc/bedrock/$instance su mc -s /bin/bash -c '~mc/mcbe_getzip.sh' # There might be more than one ZIP in ~mc minecraft_zip=$(find ~mc/bedrock-server-*.zip 2> /dev/null | xargs -0rd '\n' ls -t | head -n 1) if [ -z "$minecraft_zip" ]; then >&2 echo 'No bedrock-server ZIP found in ~mc' exit 1 fi # Trim off $minecraft_zip after last .zip current_ver=$(basename "${minecraft_zip%.zip}") mkdir -p ~mc/bedrock if [ -n "$import" ]; then echo "Enter Y if you stopped the server to import" read -r input input=$(echo "$input" | tr '[:upper:]' '[:lower:]') if [ "$input" != y ]; then >&2 echo "$input != y" exit 1 fi mv "$import" "$server_dir" trap 'mv "$server_dir" "$import"' ERR # mcbe_update.sh reads y asking if you stopped the server echo y | ~mc/mcbe_update.sh "$server_dir" "$minecraft_zip" # Convert DOS line endings to UNIX line endings while read -r file; do if grep -q $'\r'$ "$file"; then sed -i s/$'\r'$// "$file" fi done < <(ls "$server_dir"/*.{json,properties} 2> /dev/null) chown -R mc:nogroup "$server_dir" else if [ -d "$server_dir" ]; then >&2 echo "Server directory $server_dir already exists" exit 1 fi # Test extracting $minecraft_zip partially quietly unzip -tq "$minecraft_zip" trap 'rm -rf "$server_dir"' ERR unzip -q "$minecraft_zip" -d "$server_dir" echo "$current_ver" > "$server_dir/version" chown -R mc:nogroup "$server_dir" echo "@@@ Don't forget to edit $server_dir/server.properties @@@" fi
true
e23466b7db518fea272b46376749a85f8989bbb7
Shell
kolab-groupware/bonnie
/contrib/bonnie-collector.sysvinit
UTF-8
2,366
3.875
4
[]
no_license
#! /bin/bash # # bonnie-collector Start/Stop the Bonnie Broker daemon # # chkconfig: - 65 10 # description: The Bonnie Broker daemon is a message collector. # processname: bonnie-collector ### BEGIN INIT INFO # Provides: bonnie-collectord # Default-Start: - # Default-Stop: 0 1 2 6 # Required-Start: $remote_fs $local_fs $network # Required-Stop: $remote_fs $local_fs $network # Short-Description: Start/Stop the Bonnie Broker daemon # Description: The Bonnie Broker daemon is a message collector. ### END INIT INFO # Source function library. if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions fi # Source our configuration file for these variables. FLAGS="--fork -l warning" USER="bonnie" GROUP="bonnie" if [ -f /etc/sysconfig/bonnie-collector ] ; then . /etc/sysconfig/bonnie-collector fi if [ -f /etc/default/bonnie-collector ]; then . /etc/default/bonnie-collector fi RETVAL=0 # Set up some common variables before we launch into what might be # considered boilerplate by now. prog=bonnie-collector path=/usr/sbin/bonnie-collector lockfile=/var/lock/subsys/$prog pidfile=/var/run/bonnie/bonnie-collector.pid [ ! -d "$(dirname ${pidfile})" ] && mkdir -p $(dirname ${pidfile}) chown ${USER}:${GROUP} $(dirname ${pidfile}) start() { [ -x $path ] || exit 5 echo -n $"Starting $prog: " daemon $DAEMONOPTS $path -p $pidfile $FLAGS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc -p $pidfile $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile return $RETVAL } restart() { stop start } reload() { restart } force_reload() { restart } rh_status() { # run checks to determine if the service is running or use generic status status -p $pidfile $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 start ;; stop) rh_status_q || exit 0 stop ;; restart) restart ;; reload) rh_status_q || exit 7 reload ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2 esac exit $?
true
45130b1f3844f51f2c19ad677f338a58119a95d1
Shell
uamarchuan/xqrepack_ax6
/modules/min_ssh.sh
UTF-8
1,102
3.234375
3
[ "BSD-3-Clause" ]
permissive
#!/bin/sh # # modules to patch # 29.07.2021 Andrii Marchuk # FSDIR=$1 # make sure our backdoors are always enabled by default sed -i '/ssh_en/d;' "$FSDIR/usr/share/xiaoqiang/xiaoqiang-reserved.txt" sed -i '/ssh_en=/d; /uart_en=/d; /boot_wait=/d; /telnet_en=/d; /bootdelay=/d;' "$FSDIR/usr/share/xiaoqiang/xiaoqiang-defaults.txt" cat <<XQDEF >> "$FSDIR/usr/share/xiaoqiang/xiaoqiang-defaults.txt" uart_en=1 telnet_en=1 ssh_en=1 boot_wait=on bootdelay=5 XQDEF # https://openwrt.org/docs/guide-user/security/dropbear.public-key.auth cat ./modules/ssh_key/* >> /etc/dropbear/authorized_keys # cat >$FSDIR/etc/dropbear/authorized_keys << EOF # or yuor key here # EOF chmod 0600 $FSDIR/etc/dropbear/authorized_keys # # always reset our access nvram variables grep -q -w enable_dev_access "$FSDIR/lib/preinit/31_restore_nvram" || \ cat <<NVRAM >> "$FSDIR/lib/preinit/31_restore_nvram" enable_dev_access() { nvram set uart_en=1 nvram set telnet_en=1 nvram set ssh_en=1 nvram set boot_wait=on nvram set bootdelay=5 nvram set CountryCode=EU nvram commit } boot_hook_add preinit_main enable_dev_access NVRAM
true
1c0cbc6b2a3d0907c7a0eb60eb7d14603835ae04
Shell
phatblat/dotfiles
/.dotfiles/shell/alias.zsh
UTF-8
998
3.265625
3
[ "MIT" ]
permissive
#------------------------------------------------------------------------------- # # shell/alias.zsh # Miscellaneous command-line aliases # #------------------------------------------------------------------------------- # ls alias l='ls -lFh' # size,show type,human readable alias ll='ls -l' # long list alias la='ls -lAFh' # long list,show almost all,show type,human readable alias lr='ls -tRFh' # sorted by date,recursive,show type,human readable alias lt='ls -ltFh' # long list,sorted by date,show type,human readable alias ldot="la -d .*" # List hidden files alias ldir="ls -ld */" # List dirs alias ldotdir="la -d .*/" # List hidden dirs # File sizes alias bigfiles='echo "File sizes in KB" && du -ka . | sort -n -r | head -n 10' # # Shell Helpers # alias h='history | tail -n 23' # Search history alias hgrep='fc -El 0 | grep' # Copy last command alias hcopy="fc -ln -1 | pbcopy" # Copy current path alias pcopy="pwd | xargs echo -n | pbcopy"
true
0e194764851b43d17f4cd7b6db99ebb336fc7b58
Shell
ikn/config-stuff
/bin/specific/temp
UTF-8
237
3.09375
3
[]
no_license
#! /bin/bash dir="/sys/devices/platform/coretemp.0/hwmon" if [ -z "$1" ]; then for f in "$dir"/hwmon*/temp*_input; do echo $(( $(cat $f) / 1000 )) done else echo $(( $(cat "$dir"/hwmon*/temp${1}_input) / 1000 )) fi
true
0c409fab7b641fa1078d9c2efbfe52d5c3f119c5
Shell
Geoveza/simple-proxy-rotator
/entrypoint.sh
UTF-8
673
3.53125
4
[]
no_license
#!/bin/bash set -e if [[ -z "${PROXY_LIST_URL}" ]]; then echo "Using mounted proxy list" touch /app/proxy-list.txt echo " ---> Done" else echo "Downloading proxy list from $PROXY_LIST_URL" curl -s $PROXY_LIST_URL > /app/proxy-list.txt echo " ---> Done" fi echo "Adding proy list to config file" # Remove blank lines sed -i '/^$/d' /app/proxy-list.txt # Prepend forward= in front of each line to match glider config syntax sed -i 's/^/forward=/' /app/proxy-list.txt # Randomize and happen cat /app/proxy-list.txt | shuf >> /app/glider.conf echo " ---> Done" echo "Using config file" cat /app/glider.conf echo "" echo "Starting process" exec "$@"
true