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
4d66f3d1e56e4cd027a0553271cb28a5824b388c
Shell
ghoulmann/Sahana-Eden-Development-Environment
/eden-dev-l/overlay/usr/local/bin/update_eden
UTF-8
179
2.65625
3
[]
no_license
#! /bin/bash -ex #pull revision specified on command line. In case no revision, pull. cd /home/web2py/applications/eden/ if [ -z "$1" ];then bzr pull else bzr pull -r $1 fi
true
b2c640da71e513a99fab026b3a8b1d577d44e82f
Shell
linnabraham/scripts
/notate
UTF-8
2,658
4.125
4
[]
no_license
#!/bin/bash # Author: Conner McDaniel # https://github.com/connermcd/bin # MIT license # This script takes as input a pdf file # Tries to get a doi, arxiv-id or isbn from it and checks to see if the bibliography already exists # Either in my primary pubs database or the database for books. # If the entry exists it obtains the citekey and uses it for creating a note title. # Checks to see if a markdown note with the same title already exists in a particular destination # Creates one if it doesnt exists. # If a doi or arxiv-id is returned but doesnt exist in database, asks to add to db and exits # If a doi, arxiv-id or isbn is not returned, uses the pdf filename for creating a note set -e pdf="$1" #check_doi(){ doi="$(pdf2doi.mine "$pdf")" # if doi is found, check first in main pubs database if [[ $doi != "" ]]; then citekey="$(pubs list doi:$doi -k)" # if not found in main pubs database then check in database for books; else extract bibtitle if [[ $citekey == "" ]]; then citekey="$(pubs --config "$HOME/.config/pubs_books/pubsrc" list doi:$doi -k)" # If found in books database echo "found", else ask to add to database first if [[ $citekey != "" ]]; then echo "Entry found in pubs $citekey" bibfile="$HOME/Dropbox/scibooks/bib/$citekey.bib" echo "Using bibtex info from $bibfile" bibtitle="$(cat "$bibfile" | sed -n '3p' | cut -d{ -f2 | cut -d} -f1)" else echo "New item. Add to database." exit fi else bibfile="$HOME/pubs/bib/$citekey.bib" bibtitle="$(cat "$bibfile" | sed -n '3p' | cut -d{ -f2 | cut -d} -f1)" fi else arxiv="$(pdf2arxiv "${1}")" if [[ $arxiv != "" ]]; then citekey="$(pubs list eprint:$arxiv -k)" bibfile="$HOME/pubs/bib/$citekey.bib" bibtitle="$(cat "$bibfile" | sed -n '3p' | cut -d{ -f2 | cut -d} -f1)" else isbn="$(pdf2isbn "${1}" | awk '{print $2}')" if [[ $isbn != "" ]]; then echo "Found ISBN" citekey="$(pubs --config "$HOME/.config/pubs_books/pubsrc" list isbn:$isbn -k)" echo "ISBN match found in pubs: $citekey" bibfile="$HOME/Dropbox/scibooks/bib/$citekey.bib" echo "Using bibtex info from $bibfile" bibtitle="$(cat "$bibfile" | sed -n '3p' | cut -d{ -f2 | cut -d} -f1)" else file_name="$pdf" fi fi file_name="$citekey".md fi make_file() { cat >"$file_name" <<EOF # $bibtitle # Summary # Quotes and Data # Questions EOF } check_file() { file="$HOME/Dropbox/Notes/Papers/${1%.*}.md" if [[ -f $file ]]; then file_name="$file" else file_name="$file" make_file "${1}" notify-send "Creating a new note at $file_name" fi } check_file "${file_name}" vim "$file_name"
true
431535d66d744c7a9ce6d708e271ff9f4c0a9601
Shell
aur-archive/cleps-video-player
/PKGBUILD
UTF-8
946
2.734375
3
[]
no_license
#Maintainer: Eshton Robateau <eshtonrob@gmail.com> pkgname=cleps-video-player pkgver=0.21.3 pkgrel=1 epoch= pkgdesc="Cleps Video Player is a lightweight media player" arch=('i686', 'x86_64') url="https://github.com/yungtrizzle/cleps-video-player" license=('GPL3') depends=('qt5-base' 'qt5-multimedia') optdepends=("gstreamer0.10-plugins: plugins to play different video formats") makedepends=('automoc4' 'cmake') changelog= source=(https://github.com/yungtrizzle/cleps-video-player/archive/${pkgver}.tar.gz) noextract=() md5sums=('d248a9c65c4f3a185c29bb4e3d95deab') prepare(){ mkdir -p build } build() { cd build cmake ../$pkgname-$pkgver \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ make } package() { cd build make DESTDIR="$pkgdir/" install cd "$srcdir/$pkgname-${pkgver}" install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop" install -Dm644 "cleps.png" "$pkgdir/usr/share/pixmaps/cleps.png" }
true
e55e80d0bf49cb966c91dc0db4a0ff681f562771
Shell
apache/zeppelin
/bin/common.sh
UTF-8
5,625
3.484375
3
[ "BSD-3-Clause", "EPL-1.0", "OFL-1.1", "MIT", "Apache-2.0", "BSD-2-Clause" ]
permissive
#!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # if [ -L "${BASH_SOURCE-$0}" ]; then FWDIR=$(dirname "$(readlink "${BASH_SOURCE-$0}")") else FWDIR=$(dirname "${BASH_SOURCE-$0}") fi if [[ -z "${ZEPPELIN_HOME}" ]]; then # Make ZEPPELIN_HOME look cleaner in logs by getting rid of the # extra ../ ZEPPELIN_HOME="$(cd "${FWDIR}/.." || exit; pwd)" export ZEPPELIN_HOME fi if [[ -z "${ZEPPELIN_CONF_DIR}" ]]; then export ZEPPELIN_CONF_DIR="${ZEPPELIN_HOME}/conf" fi if [[ -z "${ZEPPELIN_LOG_DIR}" ]]; then export ZEPPELIN_LOG_DIR="${ZEPPELIN_HOME}/logs" fi if [[ -z "$ZEPPELIN_PID_DIR" ]]; then export ZEPPELIN_PID_DIR="${ZEPPELIN_HOME}/run" fi if [[ -z "${ZEPPELIN_WAR}" ]]; then if [[ -d "${ZEPPELIN_HOME}/zeppelin-web/dist" ]]; then export ZEPPELIN_WAR="${ZEPPELIN_HOME}/zeppelin-web/dist" else ZEPPELIN_WAR=$(find -L "${ZEPPELIN_HOME}" -name "zeppelin-web-[0-9]*.war") export ZEPPELIN_WAR fi fi if [[ -z "${ZEPPELIN_ANGULAR_WAR}" ]]; then if [[ -d "${ZEPPELIN_HOME}/zeppelin-web/dist" ]]; then export ZEPPELIN_ANGULAR_WAR="${ZEPPELIN_HOME}/zeppelin-web-angular/dist/zeppelin" else ZEPPELIN_ANGULAR_WAR=$(find -L "${ZEPPELIN_HOME}" -name "zeppelin-web-angular*.war") export ZEPPELIN_ANGULAR_WAR fi fi if [[ -f "${ZEPPELIN_CONF_DIR}/zeppelin-env.sh" ]]; then . "${ZEPPELIN_CONF_DIR}/zeppelin-env.sh" fi ZEPPELIN_CLASSPATH+=":${ZEPPELIN_CONF_DIR}" function check_java_version() { if [[ -n "${JAVA_HOME+x}" ]]; then JAVA="$JAVA_HOME/bin/java" fi java_ver_output=$("${JAVA:-java}" -version 2>&1) jvmver=$(echo "$java_ver_output" | grep '[openjdk|java] version' | awk -F'"' 'NR==1 {print $2}' | cut -d\- -f1) JVM_VERSION=$(echo "$jvmver"|sed -e 's|^\([0-9][0-9]*\)\..*$|\1|') if [ "$JVM_VERSION" = "1" ]; then JVM_VERSION=$(echo "$jvmver"|sed -e 's|^1\.\([0-9][0-9]*\)\..*$|\1|') fi if [ "$JVM_VERSION" -lt 8 ] || { [ "$JVM_VERSION" -eq 8 ] && [ "${jvmver#*_}" -lt 151 ]; } ; then echo "Apache Zeppelin requires either Java 8 update 151 or newer" exit 1; fi } function addEachJarInDir(){ if [[ -d "${1}" ]]; then for jar in "${1}"/*.jar ; do ZEPPELIN_CLASSPATH="$jar:$ZEPPELIN_CLASSPATH" done fi } function addEachJarInDirRecursive(){ if [[ -d "${1}" ]]; then for jar in "${1}"/**/*.jar ; do ZEPPELIN_CLASSPATH="$jar:$ZEPPELIN_CLASSPATH" done fi } function addEachJarInDirRecursiveForIntp(){ if [[ -d "${1}" ]]; then for jar in "${1}"/*.jar; do ZEPPELIN_INTP_CLASSPATH="$jar:${ZEPPELIN_INTP_CLASSPATH}" done fi } function addJarInDir(){ if [[ -d "${1}" ]]; then ZEPPELIN_CLASSPATH="${1}/*:${ZEPPELIN_CLASSPATH}" fi } function addJarInDirForIntp() { if [[ -d "${1}" ]]; then ZEPPELIN_INTP_CLASSPATH="${1}/*:${ZEPPELIN_INTP_CLASSPATH}" fi } ZEPPELIN_COMMANDLINE_MAIN=org.apache.zeppelin.utils.CommandLineUtils function getZeppelinVersion(){ if [[ -d "${ZEPPELIN_HOME}/zeppelin-server/target/classes" ]]; then ZEPPELIN_CLASSPATH+=":${ZEPPELIN_HOME}/zeppelin-server/target/classes" fi addJarInDir "${ZEPPELIN_HOME}/zeppelin-server/target/lib" CLASSPATH+=":${ZEPPELIN_CLASSPATH}" $ZEPPELIN_RUNNER -cp "${CLASSPATH}" "${ZEPPELIN_COMMANDLINE_MAIN}" -v exit 0 } # Text encoding for # read/write job into files, # receiving/displaying query/result. if [[ -z "${ZEPPELIN_ENCODING}" ]]; then export ZEPPELIN_ENCODING="UTF-8" fi if [[ -z "${ZEPPELIN_MEM}" ]]; then export ZEPPELIN_MEM="-Xmx1024m" fi if [[ ( -z "${ZEPPELIN_INTP_MEM}" ) && ( "${ZEPPELIN_INTERPRETER_LAUNCHER}" != "yarn" ) ]]; then export ZEPPELIN_INTP_MEM="-Xmx1024m" fi JAVA_OPTS+=" ${ZEPPELIN_JAVA_OPTS} -Dfile.encoding=${ZEPPELIN_ENCODING} ${ZEPPELIN_MEM}" if [[ -n "${ZEPPELIN_IN_DOCKER}" ]]; then JAVA_OPTS+=" -Dlog4j.configuration=file://${ZEPPELIN_CONF_DIR}/log4j_docker.properties" else JAVA_OPTS+=" -Dlog4j.configuration=file://${ZEPPELIN_CONF_DIR}/log4j.properties" fi export JAVA_OPTS JAVA_INTP_OPTS="${ZEPPELIN_INTP_JAVA_OPTS} -Dfile.encoding=${ZEPPELIN_ENCODING}" if [[ -n "${ZEPPELIN_IN_DOCKER}" ]]; then JAVA_INTP_OPTS+=" -Dlog4j.configuration=file://${ZEPPELIN_CONF_DIR}/log4j_docker.properties -Dlog4j.configurationFile=file://${ZEPPELIN_CONF_DIR}/log4j2_docker.properties" elif [[ -z "${ZEPPELIN_SPARK_YARN_CLUSTER}" ]]; then JAVA_INTP_OPTS+=" -Dlog4j.configuration=file://${ZEPPELIN_CONF_DIR}/log4j.properties -Dlog4j.configurationFile=file://${ZEPPELIN_CONF_DIR}/log4j2.properties" else JAVA_INTP_OPTS+=" -Dlog4j.configuration=log4j_yarn_cluster.properties" fi export JAVA_INTP_OPTS if [[ -n "${JAVA_HOME}" ]]; then ZEPPELIN_RUNNER="${JAVA_HOME}/bin/java" else ZEPPELIN_RUNNER=java fi export ZEPPELIN_RUNNER if [[ -z "$ZEPPELIN_INTERPRETER_REMOTE_RUNNER" ]]; then export ZEPPELIN_INTERPRETER_REMOTE_RUNNER="bin/interpreter.sh" fi
true
2deadaef178c6a9ac1718266e02493d0dd99a056
Shell
GabrielNicolasAvellaneda/boundary-api-cli
/src/main/scripts/metrics/metric-get
UTF-8
1,472
3.375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash ### ### Copyright 2014-2015 Boundary, Inc. ### ### 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. ### PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" Useage() { echo "usage: $(basename $0) metric_id [ <start> <end> ]" # echo "" # echo "where:" # echo "" # echo "metric_id - Unique id of the metric" # echo "start - " # echo "end - " exit 1 } set -x typeset -r METRIC_ID=$1 typeset -r START_DT=$(date -d "$2" '+%s') typeset -r END_DT=$(date -d "$3" '+%s') typeset -r START=$(( $START_DT * 10)) typeset -r END=$(($END_DT * 10)) typeset -r AUTH="$BOUNDARY_EMAIL:$BOUNDARY_API_TOKEN" if [ $# -eq 1 ] then URL="https://$BOUNDARY_API_HOST/v1/measurements/$METRIC_ID?agg=AVG" elif [ $# -eq 3 ] then URL="https://$BOUNDARY_API_HOST/v1/measurements/$METRIC_ID?start=$START&end=$END&agg=AVG" else Useage fi URL="https://$BOUNDARY_API_HOST/v1/measurements/$METRIC_ID?start=$START&end=$END&agg=AVG" curl -X GET -i -u"$AUTH" $URL
true
f29589ae7a9fd9b623979115198c7d9416b668d6
Shell
ben4932042/env_setting
/vim-config/setup.sh
UTF-8
962
3.8125
4
[]
no_license
#!/bin/sh VIMRC_DIR="$HOME/.vimrc" VUNDLE_DIR="$HOME/.vim/bundle/Vundle.vim" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if ! type vim > /dev/null; then echo "Vim is required but it's not installed. Aborting." fi if [ -f "$VIMRC_DIR" ]; then read -p "There is already have vimrc file in your home directory, are you sure you want to overwrite it and continue?" REPLY if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Aborting." exit 1 else echo "Remove old vimrc file" rm "$VIMRC_DIR" fi fi echo "Create symbolic link from vim-config repo vimrc file to home directory." ln -s "$SCRIPT_DIR"/vimrc ~/.vimrc if [ ! -d "$VUNDLE_DIR" ]; then echo "install and setup vundle" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim fi vim +PluginInstall +qall echo "Setup done. If you want to change vim-config repo directory, please remember relink vimrc again."
true
d52a7738377a9b2c81625cad371e52c97ba1a572
Shell
tarkus/dokku-nginx-vhosts-custom-configuration
/commands
UTF-8
2,021
3.75
4
[ "MIT" ]
permissive
#!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x case "$1" in nvcc:nginx.conf) [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1 APP="$2" cat "$DOKKU_ROOT/$APP/nginx.conf" ;; nvcc:nginx.conf.d) [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1 APP="$2" if [ -d "$DOKKU_ROOT/$APP/nginx.conf.d/" ] && [ "$(ls -A $DOKKU_ROOT/$APP/nginx.conf.d/)" ]; then ls -l "$DOKKU_ROOT/$APP/nginx.conf.d/" else echo "$DOKKU_ROOT/$APP/nginx.conf.d/ does not exist or is empty" exit 1 fi ;; nvcc:nginx-vhosts-custom-configuration.conf) [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1 APP="$2" if [ -f "$DOKKU_ROOT/$APP/nginx.conf.d/nginx-vhosts-custom-configuration.conf" ]; then cat "$DOKKU_ROOT/$APP/nginx.conf.d/nginx-vhosts-custom-configuration.conf" else echo "$DOKKU_ROOT/$APP/nginx.conf.d/nginx-vhosts-custom-configuration.conf does not exist" exit 1 fi ;; nvcc:port) [[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1 [[ ! -d "$DOKKU_ROOT/$2" ]] && echo "App $2 does not exist" && exit 1 APP="$2" cat "$DOKKU_ROOT/$APP/PORT" ;; help) cat && cat<<EOF nvcc:nginx.conf <app> display the current nginx.conf nvcc:nginx.conf.d <app> display the current nginx.conf.d/ directory contents nvcc:nginx-vhosts-custom-configuration.conf <app> will display the current nginx.conf.d/nginx-vhosts-custom-configuration.conf contents nvcc:port <app> will display the current container port EOF ;; *) exit $DOKKU_NOT_IMPLEMENTED_EXIT ;; esac
true
f49ca8a27bad81b55f6e12015bc25c6e8d8f8639
Shell
mrummuka/geo
/geo-coords.sh
WINDOWS-1252
3,329
3.90625
4
[ "LicenseRef-scancode-public-domain" ]
permissive
#!/bin/bash PROGNAME="$0" usage() { cat <<EOF NAME `basename $PROGNAME` - Convert lat/lon from one format to another SYNOPSIS `basename $PROGNAME` [options] latitude longitude DESCRIPTION Convert lat/lon from one format to another. Lat/Lon may be in DegDec, MinDec, or DMS formats. Acceptable formats for lat/lon are: -93.49130 DegDec (decimal degrees) W93.49130 DegDec (decimal degrees) "-93 29.478" MinDec (decimal minutes) "W93 29.478" MinDec (decimal minutes) -93.29.478 MinDec (decimal minutes) W93.29.478 MinDec (decimal minutes) "-93 45 30" DMS (degrees, minutes, seconds) OPTIONS -a Antipod (opposite side) -d Output DegDec only -m Output MinDec only -l Lat only -L Long only EXAMPLE Convert DegDec: $ geo-coords n45.12345 w93.12345 45.12345 -93.12345 N45.12345 W93.12345 N45 7' 24.420000" W93 7' 24.420000" N45.07.407 W93.07.407 Convert to antipod: $ geo-coords -a s38.32.329 e58.13.715 38.538816 121.771417 N38.538816 E121.771417 N38 32' 19.737600" E121 46' 17.101200" N38.32.329 E121.46.285 SEE ALSO ll2maidenhead, ll2osg, ll2rd, ll2usng, ll2utm, maidenhead2ll, rd2ll, usng2ll, utm2ll EOF exit 1 } #include "geo-common" # # Set default options, can be overriden on command line or in rc file # DEBUG=0 DEGMIN=0 DEGDEC=0 DOLAT=0 DOLON=0 ANTI=0 read_rc_file # # Process the options # while getopts "alLdmDh?-" opt do case $opt in a) ANTI="1";; d) DEGDEC="1";; m) DEGMIN="1";; l) DOLAT="1";; L) DOLON="1";; D) DEBUG="$OPTARG";; h|\?|-) usage;; esac done shift `expr $OPTIND - 1` # # Main Program # case "$#" in 6) # Cut and paste from geocaching.com cache page # N 44 58.630 W 093 09.310 LAT=`echo "$1$2.$3" | tr -d '\260\302' ` LAT=`latlon $LAT` LON=`echo "$4$5.$6" | tr -d '\260\302' ` LON=`latlon $LON` ;; 4) LAT=`latlon $1.$2` LON=`latlon $3.$4` ;; 2) LAT=`latlon $1` LON=`latlon $2` ;; *) usage ;; esac if [ $ANTI = 1 ]; then LAT=`echo $LAT | awk '{ printf "%f\n", 0.0 - $1 }' ` LON=`echo $LON | awk '{ printf "%f\n", $1>=0 ? -(180.0-$1) : 180.0+$1 }' ` fi if [ $DEGMIN = 0 ]; then if [ $DOLAT = 1 ]; then echo "$LAT" exit elif [ $DOLON = 1 ]; then echo "$LON" exit fi echo " $LAT $LON" if [ $DEGDEC = 1 ]; then exit fi fi degdec2NSdegdec() { case "$1" in -*) echo "$3$1" | tr -d -- -;; *) echo "$2$1";; esac } degdec2NSmindec() { case "$1" in -*) echo "$3$(degdec2mindec $1)" | tr -d -- -;; *) echo "$2$(degdec2mindec $1)";; esac } degdec2NSdms() { case "$1" in -*) echo "$3$(degdec2dms $1)" | tr -d -- -;; *) echo "$2$(degdec2dms $1)";; esac } # # Convert DegDec to dms # degdec2dms() { awk -v v=$1 \ 'BEGIN{ d=int(v) f=(v-d)*60 if(f<0)f=-f m=int(f) s=(f-m)*60 printf "%d %d'\'' %f\"\n", d, m, s }' } if [ $DEGMIN = 0 ]; then echo "$(degdec2NSdegdec $LAT N S) $(degdec2NSdegdec $LON E W)" echo "$(degdec2NSdms $LAT N S) $(degdec2NSdms $LON E W)" else if [ $DOLAT = 1 ]; then echo "$(degdec2NSmindec $LAT N S)" exit elif [ $DOLON = 1 ]; then echo "$(degdec2NSmindec $LON E W)" exit fi fi echo "$(degdec2NSmindec $LAT N S) $(degdec2NSmindec $LON E W)"
true
cc88e98cb8507a28b8cac74f9f9baef55be77fdc
Shell
delkyd/alfheim_linux-PKGBUILDS
/qvdpautest-git/PKGBUILD
UTF-8
965
2.78125
3
[]
no_license
# Maintainer: Gustavo Alvarez <sl1pkn07@gmail.com> pkgname=qvdpautest-git pkgver=0.5.2.r29.d4396a3 pkgrel=1 pkgdesc="A VDPAU Benchmark. (GIT version)" arch=('i686' 'x86_64') license=('LGPL') url="http://www.nvnews.net/vbulletin/showthread.php?p=2015214" makedepends=('cmake') depends=('qt4' 'libvdpau') provides=('qvdpautest') conflicts=('qvdpautest') source=('git+https://github.com/robertmassaioli/qvdpautest.git') sha1sums=('SKIP') _gitname="qvdpautest" pkgver() { cd qvdpautest _ver="$(cat src/Utils.h | grep QVDPAUTEST_VERSION | cut -d ' ' -f4 | tr -d '+' | tr -e -d '\n')" echo "$(echo ${_ver} | tr ' ' .).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" } prepare() { mkdir -p build sed -e 's| directoryString.append("./");| directoryString.append("/usr/share/qvdpautest/");|g' -i qvdpautest/src/main.cpp } build() { cd build cmake ../qvdpautest \ -DCMAKE_INSTALL_PREFIX=/usr make } package() { make -C build DESTDIR="${pkgdir}" install }
true
75cadc2769f19376cb465563a03b80878f37e38c
Shell
bguina/quick-pastec
/server.sh
UTF-8
617
3.703125
4
[]
no_license
#!/usr/bin/env bash targetDir="pastec" cd "$targetDir"/build function installIfNotFound { which "$1" >/dev/null if [ $? -ne 0 ]; then echo "$1 not found but is required" >&2 sudo apt-get install "$1" fi } if [ ! -f "visualWordsORB.dat" ]; then if [ ! -f "visualWordsORB.tar.gz" ]; then echo "Downloading visual words file." installIfNotFound curl curl --remote-name "http://pastec.io/files/visualWordsORB.tar.gz" fi echo "Uncompressing visual words file." installIfNotFound tar tar -xvzf "visualWordsORB.tar.gz" fi ./pastec visualWordsORB.dat
true
5cc9119aea28ae467ee78befe5196f25bb711608
Shell
zingale/classroom_scripts
/classroom_pull.sh
UTF-8
196
3.515625
4
[]
no_license
#!/bin/bash if [[ $# -ne 1 ]]; then echo "classroom_pull.sh takes a basename as an argument" fi dirs=`find . -name "$1*" -type d` for d in ${dirs} do cd $d git pull cd .. done
true
3033676dcb9b8095eeaa6767c52d29f42447ffe6
Shell
frink/indigen
/commands/init
UTF-8
600
3.71875
4
[]
no_license
#!/bin/bash #@call init [target] #@ - initialize project directory [ -z $VER ] && echo "$0 is a helper file" && exit 1 show_header #@function copy_fill [source] [destination] copy_fill() { local SRC="$(basename $1)" local FROM="$DIR_BASE/$SRC" local TRGT="$(dirname $1)" [ ! -d "$FROM" ] && " failed to copy $SRC" && return echo -e " populating $SRC" && cp -r $FROM $TRGT } echo -e " Initializing $DIR_TRGT\n" copy_fill $DIR_CONF copy_fill $DIR_STGS copy_fill $DIR_CODE copy_fill $DIR_CHCK echo -e "\n You can now begin using $CALL:\n" echo -e " $CALL list commands\n" exit
true
2cf71dbc8c4c19317ed4173849ced31ac3a8671e
Shell
getupcloud/origin-server
/cartridges/openshift-origin-cartridge-phpmyadmin/bin/install
UTF-8
774
3.234375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash -e if [[ -d /usr/lib64 ]]; then _libdir=/usr/lib64 else _libdir=/usr/lib fi source $OPENSHIFT_CARTRIDGE_SDK_BASH case "$1" in -v|--version) version="$2" esac echo "$version" > "$OPENSHIFT_PHPMYADMIN_DIR/env/OPENSHIFT_PHPMYADMIN_VERSION" ln -s ${_libdir}/httpd/modules ${OPENSHIFT_PHPMYADMIN_DIR}modules ln -s /etc/httpd/conf/magic ${OPENSHIFT_PHPMYADMIN_DIR}conf/magic client_result "" if [ -n "$OPENSHIFT_MYSQL_DB_USERNAME" ]; then client_result "Please make note of these MySQL credentials again:" client_result " Root User: $OPENSHIFT_MYSQL_DB_USERNAME" client_result " Root Password: $OPENSHIFT_MYSQL_DB_PASSWORD" fi client_result "URL: https://$OPENSHIFT_GEAR_DNS/phpmyadmin/" cart_props "connection_url=https://$OPENSHIFT_GEAR_DNS/phpmyadmin/"
true
75fcebb507c51ac268ddcd6d3751e9ba99e4bd2a
Shell
eden90267/reactbook
/whinepad3/scripts/deploy.sh
UTF-8
331
2.53125
3
[]
no_license
#!/usr/bin/env bash # 清理上一版 rm -rf __deployme mkdir __deployme # 建置 sh scripts/build.sh # 壓縮 JS uglifyjs bundle.js -o __deployme/bundle.js # 壓縮 CSS cssshrink bundle.css > __deployme/bundle.css # 複製 HTML 和圖像 cp index.html __deployme/index.html cp -r images/ __deployme/images/ # 完成 date; echo;
true
f1cc305e2f49ef91601e264c76d4478dc9a5fe17
Shell
zhixingheyi-tian/Automation
/scripts/deprecated_scripts/oap_release_performance_test.sh
UTF-8
2,509
3.421875
3
[]
no_license
#!/bin/bash # This script is used to run all configurations one by one. BEAVER_HOME=$(cd $(dirname ${BASH_SOURCE[0]})/..;pwd) base_repo=$(cd $1; pwd) repo=${base_repo}/output/output_workflow if [ ! -f "${base_repo}/.base" ]; then echo "Please define .base in your workflow! " exit 1 fi #generate workflow python $BEAVER_HOME/utils/workflow.py ${base_repo} #compile oap compile_repo=$(dirname $(find -P $repo -name ".base" | head -1)) python $BEAVER_HOME/core/oap.py compile $compile_repo oap #oap-cache if [ ! -d "$repo/oap-cache/" ]; then echo "No oap-cache repo is created, skip oap-cache." else sh $BEAVER_HOME/scripts/oap_release_tpc_workload_all_config.sh -r -w tpcds -d $repo/oap-cache/ -i 3 -q all -s hao.jin@intel.com.com,xiangxiang.shen@intel.com,kunshang.ji@intel.com fi #oap-shuffle if [ ! -d "$repo/oap-shuffle/RPmem-shuffle/" ]; then echo "No RPmem-shuffle repo is created, skip RPMem-shuffle." else index=0 for dir in `ls $repo/oap-shuffle/RPmem-shuffle/`; do if [[ $dir =~ "TERASORT" ]] then sh $BEAVER_HOME/scripts/oap_release_hibench_all_config.sh -r -d $repo/oap-shuffle/RPmem-shuffle/ -q $index -s hao.jin@intel.com,xiangxiang.shen@intel.com,eugene.ma@intel.com -w micro/terasort elif [[ $dir =~ "TPCDS" ]] then sh $BEAVER_HOME/scripts/oap_release_tpc_workload_all_config.sh -r -w tpcds -d $repo/oap-shuffle/RPmem-shuffle/ -i 1 -q $index -s hao.jin@intel.com,xiangxiang.shen@intel.com,eugene.ma@intel.com else echo "$dir is not used to generate data!" fi index=$(( $index + 1 )) done fi #oap-data-source if [ ! -d "$repo/oap-data-source/" ]; then echo "No oap-data-source repo is created, skip oap-data-source." else sh $BEAVER_HOME/scripts/oap_release_tpc_workload_all_config.sh -r -w tpch -d $repo/oap-data-source/ -i 1 -q all -s hao.jin@intel.com,hongze.zhang@intel.com fi #oap-native-sql if [ ! -d "$repo/oap-native-sql/" ]; then echo "No oap-native-sql repo is created, skip oap-native-sql." else sh $BEAVER_HOME/scripts/oap_release_tpc_workload_all_config.sh -r -w tpch -d $repo/oap-native-sql/ -i 1 -q all -s hao.jin@intel.com,yuan.zhou@intel.com fi #oap-spark if [ ! -d "$repo/oap-spark/" ]; then echo "No oap-spark repo is created, skip oap-spark." else sh $BEAVER_HOME/scripts/oap_release_hibench_all_config.sh -r -d $repo/oap-spark/ -q all -s hao.jin@intel.com,xiangxiang.shen@intel.com,yuqiang.ye@intel.com -w ml/kmeans fi #oap-mllib if [ ! -d "$repo/oap-mllib/" ]; then echo "No oap-mllib repo is created, skip oap-mllib." else sh $BEAVER_HOME/scripts/oap_release_hibench_all_config.sh -r -d $repo/oap-mllib/ -q all -s hao.jin@intel.com -w ml/kmeans fi
true
05645f105ca4fa11a85a306d3aa0feafcddbf800
Shell
EdwardOst/bash-explore
/scope/source_local.sh
UTF-8
589
3.6875
4
[]
no_license
#!/usr/bin/env bash set -u define(){ IFS=$'\n' read -r -d '' "${1}" || true; } init() { local scope="${1}" local code="${2}" eval "source /dev/stdin <<< \"${code}\"" echo "inner: my_param=${my_param}" } define mycode <<EOF \${scope:-} my_param="hello world" EOF echo "when scope is not set by local my_param will default to global" init "" "${mycode}" echo "global: my_param=${my_param}" unset my_param echo "when scope is set to local my_param will not be defined at global scope and will result in an error" init "local" "${mycode}" echo "global: my_param=${my_param}"
true
cece45b1295b223428c2464331b785f21ac88c58
Shell
binsec/cav2021-artifacts
/bintest/flare-on-2015/1/analyze.sh
UTF-8
427
2.53125
3
[]
no_license
#!/bin/sh BINSEC=${BINSEC:-binsec} BIN="i_am_happy_you_are_to_playing_the_flareon_challenge.exe" DO_NOT_EXPLORE="0x40107b" GOAL="0x401063" MEMDESC="memory_desc.txt" exec "${BINSEC:-binsec}" -sse \ -isa x86 \ -entrypoint 0x40104b \ -sse-no-explore ${DO_NOT_EXPLORE} \ -sse-explore ${GOAL} \ -sse-depth 10000 \ -fml-universal-mode taint \ -sse-memory ${MEMDESC} \ -fml-optim-all \ -sse-robust \ "$@" ${BIN}
true
f777ba7fb8f947d9a6a42d704db4a245f4208fce
Shell
7-1-M/Hive
/ilm-client/updatingCapability_v1.0/oldCode/installScript
UTF-8
443
2.921875
3
[]
no_license
#!/bin/bash fileToDelete=$0 #let i=0 # #while [ $i -lt 10 ] #do # echo Hello $i 1>/dev/null 2>&1 # i=$(($i+1)) #done #Most logic required to replace and restart hive... /rw/pckg/busybox killall hived-mikrotik-mipsbe-PATCHED /rw/pckg/busybox sleep 5 mv newhive hived-mikrotik-mipsbe-PATCHED /rw/pckg/busybox sleep 5 /rw/pckg/hived-mikrotik-mipsbe-PATCHED & echo "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > /rw/pckg/junk rm -f $fileToDelete 2>/dev/null
true
c9b1b1eac3718349976ad38cbad6b6431e537d3f
Shell
ValerieCoding/B32-BashExamples
/03-calculs.sh
UTF-8
227
3.15625
3
[ "MIT" ]
permissive
#!/bin/bash echo 10+10 #affiche 10+10 echo $((10+10)) #affiche 20 let resultat=10*10 echo $resultat #affiche 100 #exercice : soustraire deux valeurs passees en parametre let soustraction=$1-$2 echo $1 - $2 = $soustraction
true
97f953ad45089808e5991222cadff4b335b6b056
Shell
icentsn/move-files-into-subdirectories-in-pairs
/moveFilesInPairs.sh
UTF-8
463
3.84375
4
[]
no_license
#!/bin/sh rem=$(($# % 2)) if [ $rem -ne 0 ]; then echo "Error: Must have an even number of arguments (2 minimum)" exit 1 else while [ $# -gt 0 ] do if [ ! -e "$1" ]; then echo "File $1 non-existent, so it could not be moved." exit 1 elif [ ! -d "$2" ]; then echo "subdirectory ./$2 non-existent. File $1 not moved." exit 1 else mv $1 $2 echo "File $1 moved to subdirectory ./$2" fi shift 2 done fi exit 0
true
4e3a7aa91154f23a03c4cbccbb30243be8d69561
Shell
cmehta126/chrc
/glm/fsl_glm.sh
UTF-8
969
2.59375
3
[]
no_license
#!/bin/bash #SBATCH -N 1 -c 1 -p general --mem-per-cpu=48000 -t 48:00:00 --mail-type=ALL --mail-user=chintan.mehta@yale.edu exp=$1; meas=$2 cd /ysm-gpfs/home/cm953/scratch60/glm [ -d _${exp}_${meas} ] && rm -rf _${exp}_${meas} #mri_glmfit --y dwi/volumes-${exp}-${meas}-CVS.nii.gz --fwhm 5 --mask dwi/volumes-${exp}-${meas}-CVS_mask.nii.gz --X ${exp}_design.txt --C m8_age.mat \ # --C m8_Ftest_PE1_intx.mat --C m8_PE1_intx.mat --C m8_PE1_main.mat --glmdir _${exp}_${meas} # exp=$1 meas=$2 nsim=1000 base=/ysm-gpfs/home/cm953/scratch60/glm con=c1_PE_main.con Text2Vest c1_PE_main.txt $Con em=${exp}-${meas} indir=${base}/dwi outdir=${base}/results/fsl_${em} [ ! -d $outdir ] && mkdir $outdir module load FSL; source ${FSLDIR}/etc/fslconf/fsl.sh echo $em invol=${indir}/volumes-${em}-CVS_sm.nii.gz mask=${indir}/volumes-${em}-CVS_mask.nii.gz outvol=${outdir}/${em} randomise -i $invol -o $outvol -d ${exp}_design.mat -t $Con -m $mask -T -c 2.5 -N -R -n $nsim -x --glm_output
true
5322b2c4d7948dea31e0e5fdedf72b2f399f0215
Shell
druplar/dotfiles
/zsh/20.android.zsh
UTF-8
163
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env zsh if [[ -d /usr/local/share/android-sdk ]]; then export ANDROID_SDK_ROOT=/usr/local/share/android-sdk fi export ANDROID_HOME="$HOME/.android"
true
99ab52b34262656564d6dc17734310724940f441
Shell
daringanitch/rancher-tf-mc
/02-cluster-imported/apply.sh
UTF-8
1,317
2.75
3
[ "MIT" ]
permissive
#!/bin/bash pushd ./terraform/state terraform init \ -input=false \ ../root/cluster \ && \ terraform plan \ -input=false \ -var-file=./azure-creds.tfvars \ -state=./cluster.tfstate \ -out ./cluster.plan.zip \ ../root/cluster \ && \ terraform apply \ -state=./cluster.tfstate \ ./cluster.plan.zip \ && \ # TODO - use terraform_remote_state for sharing values export tf_var_aks_cluster_resource_group_name=$(terraform output -state=./cluster.tfstate resource_group_name) \ && \ # TODO - use terraform_remote_state for sharing values export tf_var_aks_cluster_name=$(terraform output -state=./cluster.tfstate cluster_name) \ && \ # TODO - use terraform_remote_state for sharing values export tf_var_prefix=$(terraform output -state=./cluster.tfstate prefix) \ && \ terraform init \ -input=false \ ../root/import \ && \ terraform plan \ -input=false \ -var-file=./azure-creds.tfvars \ -var-file=./rancher-creds.tfvars \ -var="aks_cluster_resource_group_name=${tf_var_aks_cluster_resource_group_name}" \ -var="aks_cluster_name=${tf_var_aks_cluster_name}" \ -var="rancher_cluster_name=tf-mc-imported-${tf_var_prefix}" \ -state=./import.tfstate \ -out ./import.plan.zip \ ../root/import \ && \ terraform apply \ -state=./import.tfstate \ ./import.plan.zip popd
true
2a4f3a9a4e9729856b1e6fd0bcc8fc1c84b8d58a
Shell
t-torii/pcf-pipelines
/tasks/delete-tile/task.sh
UTF-8
840
3.3125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/bin/bash set -eu main() { if [ -n $OPSMAN_IP ]; then echo "$OPSMAN_IP $OPSMAN_DOMAIN_OR_IP_ADDRESS" >> /etc/hosts fi # find tile version installed echo "Retrieving current staged version of ${TILE_PRODUCT_NAME}" product_version=$(om-linux \ --target https://$OPSMAN_DOMAIN_OR_IP_ADDRESS \ --username "$OPSMAN_USERNAME" \ --password "$OPSMAN_PASSWORD" \ --skip-ssl-validation \ deployed-products | grep ${TILE_PRODUCT_NAME} | cut -d "|" -f 3 | tr -d " ") echo "Unsteging product [${TILE_PRODUCT_NAME}], version [${product_version}] , from ${OPSMAN_DOMAIN_OR_IP_ADDRESS}" om-linux \ --target https://$OPSMAN_DOMAIN_OR_IP_ADDRESS \ --username "$OPSMAN_USERNAME" \ --password "$OPSMAN_PASSWORD" \ --skip-ssl-validation \ unstage-product \ --product-name "$TILE_PRODUCT_NAME" } main
true
e197d678ac072659b4946c0acb5083124717cec3
Shell
theghost1980/nxs-node-installer
/Files/nodesetup.sh
UTF-8
1,306
3.296875
3
[]
no_license
#!/bin/bash # size of swapfile in megabytes swapsize=1024 # does the swap file already exist? grep -q "swapfile" /etc/fstab # if not then create it if [ $? -ne 0 ]; then echo 'swapfile not found. Adding swapfile.' fallocate -l ${swapsize}M /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile echo '/swapfile none swap defaults 0 0' >> /etc/fstab else echo 'swapfile found. No changes made.' fi # output results to terminal #cat /proc/swaps #cat /proc/meminfo | grep Swap #install required Dependancies and compile cd ~/ sudo apt-get update && sudo apt-get install -y git build-essential libboost-all-dev libssl-dev libminiupnpc-dev unzip libdb-dev libdb++-dev git clone https://github.com/Nexusoft/Nexus.git Nexus cd ~/Nexus make -f makefile.unix USE_LLD=1 #download DB bootstrap, extract and create nexus.conf cd ~/ wget http://nexusminingpool.com/downloads/LLD100117.zip mkdir .Nexus unzip LLD100117.zip cd .Nexus cat > nexus.conf <<- "EOF" rpcuser=rpcserver rpcpassword=12345678+originalSEXYone daemon=1 server=1 unified=1 addnode=52.63.26.48 addnode=52.68.138.229 addnode=54.169.106.238 addnode=52.78.170.114 addnode=52.64.203.106 addnode=52.66.23.129 addnode=52.67.182.108 addnode=54.173.118.111 EOF #Launch the wallet daemon cd ~/Nexus ./nexus
true
4d791a4af3f05d7f8fef55343233cd9baab45085
Shell
kajalpani/hello-world
/greet_user.sh
UTF-8
154
3.28125
3
[]
no_license
#!/bin/bash #This is just a demo file if [ -z $1 ]; then echo "Please pass your name as argument to script" exit 1 fi echo "Hey how are you doing?" $1
true
093629e66e7f7ed317eb90bbeb2cc931371a3f0d
Shell
BenLocal/FFmpeg-Builds
/scripts.d/50-vaapi/40-libdrm.sh
UTF-8
1,038
3.28125
3
[ "MIT" ]
permissive
#!/bin/bash LIBDRM_REPO="https://gitlab.freedesktop.org/mesa/drm.git" LIBDRM_COMMIT="1a4c0ec9aea13211997f982715fe5ffcf19dd067" ffbuild_enabled() { [[ $TARGET != linux* ]] && return -1 return 0 } ffbuild_dockerbuild() { git-mini-clone "$LIBDRM_REPO" "$LIBDRM_COMMIT" libdrm cd libdrm mkdir build && cd build local myconf=( --prefix="$FFBUILD_PREFIX" -Ddefault_library=static -Dlibkms=false -Dudev=false -Dcairo-tests=false -Dvalgrind=false -Dexynos=false -Dfreedreno=false -Domap=false -Detnaviv=false -Dintel=true -Dnouveau=true -Dradeon=true -Damdgpu=true ) if [[ $TARGET == linux* ]]; then myconf+=( --cross-file=/cross.meson ) else echo "Unknown target" return -1 fi meson "${myconf[@]}" .. ninja -j$(nproc) ninja install } ffbuild_configure() { echo --enable-libdrm } ffbuild_unconfigure() { echo --disable-libdrm }
true
5ef730a293ad76d50e11426a3222eee4c6659a12
Shell
tnakaicode/jburkardt
/fn/fn_prb.sh
UTF-8
463
2.953125
3
[]
no_license
#! /bin/bash # g++ -c -I/$HOME/include fn_prb.cpp if [ $? -ne 0 ]; then echo "Errors compiling fn_prb.cpp" exit fi # g++ fn_prb.o /$HOME/libcpp/$ARCH/fn.o /$HOME/libcpp/$ARCH/test_values.o -lm if [ $? -ne 0 ]; then echo "Errors linking and loading fn_prb.o." exit fi # rm fn_prb.o # mv a.out fn_prb ./fn_prb > fn_prb_output.txt if [ $? -ne 0 ]; then echo "Errors running fn_prb." exit fi rm fn_prb # echo "Program output written to fn_prb_output.txt"
true
6e0ee645d6ed63ee2398cf6988604ecc73c9df4d
Shell
jackalope33/abuseIPDB_lookup
/abuseipdb_lookup.sh
UTF-8
5,491
4.09375
4
[]
no_license
#!/bin/bash date=$(date | sed s/[" ":]/_/g | cut -c -19) # Exit if no arguments passed if [ -z $1 ]; then printf "Usage:\n ./abuseipdb_lookup.sh [<ip>] [-f <file>] [--help]\n" exit 1 fi # Check for API key. If not present, prompt for key if [ ! -f ".abuse_apikey" ]; then printf "No API key found. Please enter API key: " read api_key # Input validation -- ensure the API key is the correct length. Exit if not if [ $(echo $api_key | wc -c) -ne 81 ]; then printf "\nAPI key has invalid length. Exiting.\n" exit fi # Store the API key in a hidden file accessible only to the owner echo $api_key > .abuse_apikey chmod 600 .abuse_apikey sleep 1 printf "\nAPI key stored.\n" && sleep .5 else api_key=$(cat .abuse_apikey) fi # Name lookup function name_look () { nslookup $1 8.8.8.8 | grep Address | grep -v '#53' | awk '{print $2}' | head -1 return 0 } # Function for API call -- uses curl to obtain json record of IP being queried # Parses syntax and assigns variable values using awk api_call () { ip=$1 # Regex to check if IP contains letters site_check='[A-Za-z]' if [[ $1 =~ $site_check ]]; then # If letters detected, look up IP address printf "\nLooking up IP..." ip=$(name_look $ip) if [ -z $ip ]; then printf "\nNo IP registered for host %s. Skipping" $1 let skip=1 return 1 fi printf "Checking %s..." $ip fi curl -G -s https://api.abuseipdb.com/api/v2/check \ --data-urlencode "ipAddress=$ip" \ -d maxAgeInDays=90 \ -d verbose \ -H "Key: $2" \ -H "Accept: application/json" >> $ip.json isPublic=$(cat $ip.json | awk -F, '{print $2}' | cut -c 12-) isWhitelisted=$(cat $ip.json | awk -F, '{print $4}' | cut -c 17-) score=$(cat $ip.json | awk -F, '{print $5}' | cut -c 24-) countryName=$(cat $ip.json | awk -F, '{print $10}' | cut -c 15- | sed "s/\"//g") isp=$(cat $ip.json | awk -F, '{print $8}' | cut -c 7- | sed "s/\"//g") domain=$(cat $ip.json | awk -F, '{print $9}' | cut -c 10- | sed "s/\"//g") totalReports=$(cat $ip.json | awk -F, '{print $11}' | cut -c 16-) lastReportedAt=$(cat $ip.json | awk -F, '{print $12}' | cut -c 18- | sed "s/\"//g") # Checks status code of API response. Exits if site unavailable if [ $(cat $ip.json | awk -F, '{print $1}' | cut -c 23-) -eq 1 ] 2>/dev/null ; then printf "\nAbuseIPDB API is down. Please try again later.\nExiting...\n" rm -f $ip.json exit fi return 0 } case $1 in -f) let file=1 # Creates directories for csv/json files and suppresses STDERR if directories already exist mkdir results 2> /dev/null mkdir json_results 2>/dev/null # Initialize counter variables and determine number of unique IPs let c=0 let m=0 t=$(cat $2 | uniq | wc -l) # Create header line for csv report printf "IP Address,Public,White Listed,Score,Country,ISP,Domain,Total Reports,Last Reported\n" | tee results/abuse_results_$date.csv > /dev/null # For loop for each IP address - performs API call and assesses based on confidence value (greater than 0) for ip in $(cat $2 | sed s/'\r'//g | sort | uniq); do let skip=0 let c+=1 printf "\n%s of %s:\tChecking %s" $c $t $ip api_call $ip $api_key if [ $skip -eq 1 ]; then continue fi echo $ip","$isPublic","$isWhitelisted","$score","$countryName","$isp","$domain","$totalReports","$lastReportedAt >> results/abuse_results_$date.csv if [ "$score" -gt 0 ]; then mv $ip.json json_results/ printf "\t**MALICIOUS**" let m+=1 else rm -f $ip.json 2> /dev/null fi done # Outputs only valid records to final report (including header value) cat results/abuse_results_$date.csv | egrep -i 'true|false|public' > results/results_$date.csv && rm results/abuse_results_$date.csv # Report Summary displayed to STDOUT printf "\n\t\t\t\tSummary" printf "\n=====================================================================" printf "\nTotal Sites Checked:\t\t\t%d" $c printf "\nMalicious Sites Found:\t\t\t%d\n\n" $m printf "CSV report:\t\tresults/results_$date.csv\n" printf "Full json output:\tjson_reports/\n\n" ;; --help) # Help text clear printf "\t=============================\n" printf "\t| Abuse IPDB Lookup Utility |\n" printf "\t=============================\n\n" printf "This is a basic utility that queries the Abuse IPDB for IP addresses that have been reported as malicious.\n" printf "\nArguments:\n\t<ip>:\tPassing a single IP address as an argument will perform\n\t\ta single lookup. Results are displayed as standard output.\n" printf "\n\t\tex: ./abuseipdb_lookup.sh 123.123.123.123\n" printf "\n\t-f:\tThe file argument requires a file containing a list of IP addresses\n\t\tto be specified. Results are saved as a csv file.\n\n\t\tex: ./abuseipdb_lookup.sh -f list.txt\n\n" ;; *) let file=0 # Single query of API using IP address passed as command line argument printf "\nChecking %s..." $1 api_call $1 $api_key if [ -z "$score" ]; then printf "\n\nInvalid response for %s. Exiting.\n" $1 else if [ "$score" -eq 0 ]; then printf "\n\n%s has not been reported to AbuseIPDB.\n" $1 else printf "\n\n%s has been reported as malicious!\n\n" $1 sleep 1 printf "Domain:\t\t\t%s\n" $domain printf "Country:\t\t%s\n" "$countryName" printf "ISP:\t\t\t%s\n" "$isp" printf "Confidence Score:\t%s\n" $score printf "Total Reports:\t\t%s\n" $totalReports printf "Last Reported:\t\t%s\n\n" $lastReportedAt fi fi rm -f $1.json 2> /dev/null ;; esac
true
c89a06e1ba896dd768c5899e146670e667d1cbb2
Shell
durganavaneethan/RRP
/RRP/rrp-master/rrp-master/RRP/RRP/files/GitBucket_Script.sh
UTF-8
1,977
2.921875
3
[]
no_license
if ! [ -f /sys/hypervisor/uuid ]; then sudo mkdir data sudo mkdir data/gitbucket sudo chmod -R 777 data/gitbucket docker -v if [ $? -eq 127 ] ; then sudo apt-get update sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' sudo apt-get update sudo apt-get install -y docker-engine sudo service docker start sudo docker run --restart=always --name gitbucket -d -p 8081:8080 -v /home/RRP/data/gitbucket:/gitbucket f99aq8ove/gitbucket else sudo service docker start sudo docker run --restart=always --name gitbucket -d -p 8081:8080 -v /home/RRP/data/gitbucket:/gitbucket f99aq8ove/gitbucket sudo docker -v fi else sudo mkdir /home/ec2-user/data sudo mkdir /home/ec2-user/data/gitbucket sudo chmod -R ugo+rw /home/ec2-user/data/gitbucket if findmnt -S /dev/xvdb | grep -F "TARGET" > /dev/null; then echo Filesystem is mounted else sudo mkfs -t ext4 -F /dev/xvdb sudo mount /dev/xvdb /home/ec2-user/data/gitbucket sudo cp /etc/fstab /etc/fstab.orig sudo sed -i '$ a /dev/xvdb /home/ec2-user/data/gitbucket ext4 defaults 1 1' /etc/fstab fi docker -v if [ $? -eq 127 ] ; then sudo yum -y update sudo yum install -y git sudo yum install -y docker sudo service docker start sudo docker run --restart=always --name gitbucket -d -p 8081:8080 -v /home/ec2-user/data/gitbucket:/gitbucket f99aq8ove/gitbucket sudo docker -v sleep 40 sudo docker restart gitbucket else sudo yum install -y git sudo service docker start sudo docker run --restart=always --name gitbucket -d -p 8081:8080 -v /home/ec2-user/data/gitbucket:/gitbucket f99aq8ove/gitbucket sudo docker -v sleep 40 sudo docker restart gitbucket fi fi
true
82e8da6a40f64e0d5bde34eecc39e2cccbe3f3ee
Shell
flyzjhz/DWR-956_decrypted_fw
/decrypted_and_extracted/dwr956_v1.0.0.7_r02_nb_p02003/root/etc/rc.d/wave_wlan_main_modify
UTF-8
1,108
3.703125
4
[]
no_license
#!/bin/sh # Defines if [ ! "$MTLK_INIT_PLATFORM" ]; then . /tmp/mtlk_init_platform.sh fi print2log DBG "running wave_wlan_main_modify: args: $*" # Optimization: What should be the final state of the interface: (set to IF_DOWN if another script will bring up the interface) if_state=$3 if [ "$if_state" = "" ] then if_state=$IF_UP fi timestamp "wave_wlan_main_modify:$apIndex:begin" apIndex=$1 ssidChanged=$2 # Get corresponding wlan network interface from mapping file wlan=`find_wave_if_from_index $apIndex` # Bring interface down ifconfig $wlan down # Config driver params $ETC_PATH/mtlk_set_driver_params.sh reconfigure ${apIndex} wlan_main # TODO: Bring interface up #ifconfig $wlan up # If ESSID was changed, recreate hostapd config file, if not just reload existing file if [ "$ssidChanged" = "$SSID_CHANGED" ] then $ETC_PATH/wave_wlan_sec_modify $apIndex $if_state else # Driver limitation: reset security after doing ifconfig down $ETC_PATH/mtlk_init_hostapd.sh reload $apIndex $if_state fi print2log DBG "wave_wlan_main_modify: Done" timestamp "wave_wlan_main_modify:$apIndex:done"
true
c6fa17bcae857d531b65da949315bd8081d29bba
Shell
naveenlj/openldap
/ldap-user.sh
UTF-8
2,481
3.484375
3
[]
no_license
# extract local users and groups who have 500-999 digit UID # replace "SUFFIX=***" to your own domain name # this is an example #!/bin/bash SUFFIX='dc=server,dc=world' LDIF='ldapuser.ldif' echo -n > $LDIF for line in `grep "x:[5-9][0-9][0-9]:" /etc/passwd | sed -e "s/ /%/g"` do LUID="`echo $line | cut -d: -f1`" NAME="`echo $line | cut -d: -f5 | cut -d, -f1`" if [ ! "$NAME" ] then NAME="$LUID" else NAME=`echo "$NAME" | sed -e 's/%/ /g'` fi SN=`echo "$NAME" | awk '{print $2}'` [ ! "$SN" ] && SN="$NAME" LASTCHANGEFLAG=`grep $LUID: /etc/shadow | cut -d: -f3` [ ! "$LASTCHANGEFLAG" ] && LASTCHANGEFLAG="0" SHADOWFLAG=`grep $LUID: /etc/shadow | cut -d: -f9` [ ! "$SHADOWFLAG" ] && SHADOWFLAG="0" echo "dn: uid=$LUID,ou=People,$SUFFIX" >> $LDIF echo "objectClass: inetOrgPerson" >> $LDIF echo "objectClass: posixAccount" >> $LDIF echo "objectClass: shadowAccount" >> $LDIF echo "sn: $SN" >> $LDIF echo "givenName: `echo $NAME | awk '{print $1}'`" >> $LDIF echo "cn: $NAME" >> $LDIF echo "displayName: $NAME" >> $LDIF echo "uidNumber: `echo $line | cut -d: -f3`" >> $LDIF echo "gidNumber: `echo $line | cut -d: -f4`" >> $LDIF echo "userPassword: {crypt}`grep $LUID: /etc/shadow | cut -d: -f2`" >> $LDIF echo "gecos: $NAME" >> $LDIF echo "loginShell: `echo $line | cut -d: -f7`" >> $LDIF echo "homeDirectory: `echo $line | cut -d: -f6`" >> $LDIF echo "shadowExpire: `passwd -S $LUID | awk '{print $7}'`" >> $LDIF echo "shadowFlag: $SHADOWFLAG" >> $LDIF echo "shadowWarning: `passwd -S $LUID | awk '{print $6}'`" >> $LDIF echo "shadowMin: `passwd -S $LUID | awk '{print $4}'`" >> $LDIF echo "shadowMax: `passwd -S $LUID | awk '{print $5}'`" >> $LDIF echo "shadowLastChange: $LASTCHANGEFLAG" >> $LDIF echo >> $LDIF done for line in `grep "x:[5-9][0-9][0-9]:" /etc/group` do CN="`echo $line | cut -d: -f1`" LGID="`echo $line | cut -d: -f3`" echo "dn: cn=$CN,ou=Group,$SUFFIX" >> $LDIF echo "objectClass: posixGroup" >> $LDIF echo "cn: $CN" >> $LDIF echo "gidNumber: $LGID" >> $LDIF echo "memberUid: `grep ":$LGID:" /etc/passwd | cut -d: -f1`" >> $LDIF users="`echo $line | cut -d: -f4`" if [ "$users" ] then for user in `echo "$users" | sed 's/,/ /g'` do [ ! "$CN" = "$user" ] && echo "memberUid: $user" >> $LDIF done fi echo >> $LDIF done
true
422eb70abed82ee2988c7ebd8b139487a49803c5
Shell
ODEX-TOS/packages
/pam/repos/core-x86_64/PKGBUILD
UTF-8
1,744
2.5625
3
[ "GPL-1.0-or-later", "MIT" ]
permissive
# Maintainer: Tobias Powalowski <tpowa@archlinux.org> # Contributor: judd <jvinet@zeroflux.org> pkgname=pam pkgver=1.5.0 pkgrel=2 pkgdesc="PAM (Pluggable Authentication Modules) library" arch=('x86_64') license=('GPL2') url="http://linux-pam.org" depends=('glibc' 'libtirpc' 'pambase' 'audit' 'libaudit.so' 'libxcrypt' 'libcrypt.so') makedepends=('flex' 'w3m' 'docbook-xml>=4.4' 'docbook-xsl') provides=('libpam.so' 'libpamc.so' 'libpam_misc.so') backup=(etc/security/{access.conf,faillock.conf,group.conf,limits.conf,namespace.conf,namespace.init,pam_env.conf,time.conf} etc/environment) source=(https://github.com/linux-pam/linux-pam/releases/download/v$pkgver/Linux-PAM-$pkgver.tar.xz{,.asc} CVE-2020-27780.patch::https://github.com/linux-pam/linux-pam/commit/30fdfb90d9864bcc254a62760aaa149d373fd4eb.patch $pkgname.tmpfiles) validpgpkeys=( '8C6BFD92EE0F42EDF91A6A736D1A7F052E5924BB' # Thorsten Kukuk '296D6F29A020808E8717A8842DB5BD89A340AEB7' #Dimitry V. Levin <ldv@altlinux.org> ) sha256sums=('02d39854b508fae9dc713f7733bbcdadbe17b50de965aedddd65bcb6cc7852c8' 'SKIP' 'b785b637e4bf4c0a1601c296b562ee2eed09916cc589dc4021fa1abc6c5394c8' '5631f224e90c4f0459361c2a5b250112e3a91ba849754bb6f67d69d683a2e5ac') options=('!emptydirs') prepare() { cd Linux-PAM-$pkgver patch -Np1 < ../CVE-2020-27780.patch } build() { cd Linux-PAM-$pkgver ./configure --libdir=/usr/lib --sbindir=/usr/bin --disable-db make } package() { install -Dm 644 $pkgname.tmpfiles "$pkgdir"/usr/lib/tmpfiles.d/$pkgname.conf cd Linux-PAM-$pkgver make DESTDIR="$pkgdir" SCONFIGDIR=/etc/security install # set unix_chkpwd uid chmod +s "$pkgdir"/usr/bin/unix_chkpwd # remove doc which is not used anymore # FS #40749 rm "$pkgdir"/usr/share/doc/Linux-PAM/sag-pam_userdb.html }
true
049dc0feaeacefa3bc34c85d97a13ff2f49c4652
Shell
IBM-Security/performance
/IAM/scripts/ISIM_tuning_scripts/otherTools/do_statement_monitoring.sh
UTF-8
1,277
3.609375
4
[]
no_license
#!/bin/ksh # Script to do statement monitoring # This script writes the monitor output to the current directory if [ `uname` = "Linux" ];then # define a print function, since Linux doesn't seem to have one print(){ echo "$@" } fi db2 connect to itim db2 list tables | grep EXPLAIN_ >$0.tmp if [ "X`cat $0.tmp`" = "X" ];then print Performing one time setup ... db2 -tf $HOME/sqllib/misc/EXPLAIN.DDL fi rm $0.tmp # Monitoring statements db2 "drop event monitor dstatement" >/dev/null # db2 "create event monitor dstatement for statements write to file $PWD" print db2 \"create event monitor dstatement for statements write to file \'$PWD\'\" >$0.tmp . $0.tmp rm $0.tmp db2 "set event monitor dstatement state 1" print Do experiment to be monitored now. Press enter to stop monitoring. read dummyvar db2 "set event monitor dstatement state 0" db2evmon -path $PWD >$PWD/dstate.out # Maybe use mon.awk to further process the output # awk -f mon.awk $PWD/dstate.out db2 "drop event monitor dstatement" db2 terminate # Use proc_stmt_mon_output.awk to further process the output awk -f proc_stmt_mon_output.awk $PWD/dstate.out >$PWD/mon.out sort -n +1 mon.out >mon.sorted echo "Full output in dstate.out, summary in mon.out, sorted by time in mon.sorted"
true
ed25c290659924fecc12ac06e7788f14a998b9ca
Shell
fermi-lat/repo-tools
/bin/extract_tags.sh
UTF-8
564
3.921875
4
[]
no_license
#!/bin/bash cvs_sandbox=$1 if [ "$#" -ne 1 ]; then echo "Usage: extract_tags.sh CVS_MODULE" exit 1; fi # Fix directories cd $cvs_sandbox cvs_repo=$(pwd) cd - &> /dev/null cd $cvs_sandbox gitsha_f=".gitsha" gitsha=$(cat $gitsha_f) OMIT_PATTERN="HEAD\|LATEST" status=$(cvs status -v $gitsha_f | grep -v $OMIT_PATTERN) revision=$(echo "$status" | grep "Repository revision:" | awk '{print $3}') tags=$(echo "$status" | grep "(revision: $revision)" | awk '{print $1}') printf "cvs_tag\tgit_sha\n" for tag in $tags; do printf "$tag\t$gitsha\n" done
true
3c173e5e67d483b14738948cfc9c89687d80af6c
Shell
Jubei-Mitsuyoshi/AXE-PKGBUILDS
/AXE-EXPERIMENTAL/nemo-git/PKGBUILD
UTF-8
1,920
3.046875
3
[]
no_license
# Maintainer: Ner0 # Maintainer: Jubei-Mitsuyoshi <jubei.house.of.five.masters@gmail.com> pkgname=nemo-git pkgver=20121106 pkgrel=99.1axe pkgdesc="Cinnamon file manager (Nautilus fork), development version" arch=('i686' 'x86_64') url="https://github.com/linuxmint/nemo" license=('GPL') groups=("axis") depends=('dconf' 'desktop-file-utils' 'exempi' 'gnome-desktop' 'gnome-icon-theme' 'hicolor-icon-theme' 'libnotify' 'libtracker-sparql') makedepends=('git' 'gtk-doc' 'gnome-common' 'gobject-introspection' 'intltool') optdepends=('nemo-dropbox-git: Dropbox integration' 'nemo-fileroller-git: File Roller integration' 'gksu: Open as Root') conflicts=('nemo-fm') provides=('nemo-fm' 'nautilus') options=('!emptydirs' '!libtool') install=nemo.install _gitroot=git://github.com/linuxmint/nemo.git _gitname=nemo build() { msg "Connecting to GIT server...." if [[ -d "$_gitname" ]]; then cd "$_gitname" && git pull origin && cd .. msg "The local files are updated." else git clone "$_gitroot" "$_gitname" fi msg "GIT checkout done or server timeout" msg "Starting build..." rm -rf "$_gitname-build" git clone "$_gitname" "$_gitname-build" cd "$_gitname-build" # Get default terminal value _terminal=$(gsettings get org.gnome.desktop.default-applications.terminal exec | tr -d "'") # Set "Open in Terminal" to default terminal (Arch doesn't use x-terminal-emulator) sed -i "s/x-terminal-emulator/$_terminal/" src/nemo-view.c # Fix "Open as Root" sed -i "s/gksu/gksudo/" src/nemo-view.c ./autogen.sh --prefix=/usr --sysconfdir=/etc \ --localstatedir=/var --disable-static \ --libexecdir=/usr/lib/nemo \ --disable-nst-extension \ --disable-update-mimedb \ --disable-packagekit \ --disable-gtk-doc-html \ --disable-schemas-compile make } package() { cd "$_gitname-build/" make DESTDIR="$pkgdir/" install } # vim:set ts=2 sw=2 et:
true
12b3e6bfb139c51fbe3c3bcbc5aa25d3d63b1d76
Shell
drapadubok/dti_analyse
/dti_prepro.sh
UTF-8
1,730
3.421875
3
[]
no_license
#!/bin/bash # DTI preprocessing # 1) Perform eddy current correction # 2) And extract mask from resulting file # 3) Perform DTIFIT reconstruction # 4) do the bedpostx # Folder structure: # -n.nii.gz # -bvals # -bvecs # -bet.nii # by Dima Smirnov, somewhere in 2012 n=$1 #n gets the first argument rootpath=$2 #folder with subject files, i.e. /$rootpath/$n/n.nii.gz and /$rootpath/$n/bvecs #-------Main part for filename in "$rootpath/$n/$n.nii.gz" ; do subj=`$FSLDIR/bin/remove_ext $filename` # subj is n.nii.gz but without .nii.gz extension echo "Processing $filename" #-------ECC if [ ! -e "$rootpath/$n/data.nii.gz" ]; # if ECC file doesn't exist then echo "ECC on $subj.nii" # Do ECC, save file eddy_correct "$subj.nii" "${subj}_c" 0 else echo "ECC was done before, moving on to mask extraction" fi #--------BET if [ ! -e "$rootpath/$n/nodif_brain_mask.nii.gz" ]; # if mask doesn't exist then echo "Creating mask for $subj" bet "${subj}_c.nii.gz" "$subj" -f 0.3 -g 0 -n -m else echo "Mask was done, DTIFIT now" fi #--------DTIFIT if [ ! -e "${subj}_dti_FA.nii.gz" ]; then echo "DTIFIT" dtifit --data="${subj}_c.nii.gz" --out="${subj}_dti" --mask="${subj}_mask.nii.gz" --bvecs="$rootpath/bvecs" --bvals="$rootpath/bvals" else echo "DTIFIT was done, now the longest part - bedpostx" fi #--------BEDPOSTX if [ ! -e "$rootpath/$n/data.nii.gz" ]; then mv "${subj}_c.nii.gz" "$rootpath/$n/data.nii.gz" fi if [ ! -e "$rootpath/$n/nodif_brain_mask.nii.gz" ]; then mv "${subj}_mask.nii.gz" "$rootpath/$n/nodif_brain_mask.nii.gz" fi cp "$rootpath/bvecs" "$rootpath/$n/bvecs" cp "$rootpath/bvals" "$rootpath/$n/bvals" done bedpostx "$rootpath/$n" #done
true
547f2f51ef31859ea9fc5fd3310ce0c9ebb311c9
Shell
svolokh/FakeSoftShadows
/FakeSoftShadows/misc/make_inc.bash
UTF-8
245
2.890625
3
[]
no_license
#!/bin/bash if [[ -z $1 ]]; then echo 'Missing argument' 1>&2 exit 1 fi root=$(dirname $(realpath $0)) python $root/obj_to_inc.py $root/$1.obj $root/../models/$1_vertices.inc $root/../models/$1_normals.inc $root/../models/$1_indices.inc
true
3fe3ef6f98269859b1c2c2e8a18017d30e7f1505
Shell
ghuntley/monorepo
/third_party/git/t/t3903-stash.sh
UTF-8
30,539
3.359375
3
[ "MIT", "GPL-1.0-or-later", "LGPL-2.0-or-later", "LGPL-2.1-only", "GPL-3.0-only", "GPL-2.0-only" ]
permissive
#!/bin/sh # # Copyright (c) 2007 Johannes E Schindelin # test_description='Test git stash' . ./test-lib.sh test_expect_success 'stash some dirty working directory' ' echo 1 >file && git add file && echo unrelated >other-file && git add other-file && test_tick && git commit -m initial && echo 2 >file && git add file && echo 3 >file && test_tick && git stash && git diff-files --quiet && git diff-index --cached --quiet HEAD ' cat >expect <<EOF diff --git a/file b/file index 0cfbf08..00750ed 100644 --- a/file +++ b/file @@ -1 +1 @@ -2 +3 EOF test_expect_success 'parents of stash' ' test $(git rev-parse stash^) = $(git rev-parse HEAD) && git diff stash^2..stash >output && test_cmp expect output ' test_expect_success 'applying bogus stash does nothing' ' test_must_fail git stash apply stash@{1} && echo 1 >expect && test_cmp expect file ' test_expect_success 'apply does not need clean working directory' ' echo 4 >other-file && git stash apply && echo 3 >expect && test_cmp expect file ' test_expect_success 'apply does not clobber working directory changes' ' git reset --hard && echo 4 >file && test_must_fail git stash apply && echo 4 >expect && test_cmp expect file ' test_expect_success 'apply stashed changes' ' git reset --hard && echo 5 >other-file && git add other-file && test_tick && git commit -m other-file && git stash apply && test 3 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) ' test_expect_success 'apply stashed changes (including index)' ' git reset --hard HEAD^ && echo 6 >other-file && git add other-file && test_tick && git commit -m other-file && git stash apply --index && test 3 = $(cat file) && test 2 = $(git show :file) && test 1 = $(git show HEAD:file) ' test_expect_success 'unstashing in a subdirectory' ' git reset --hard HEAD && mkdir subdir && ( cd subdir && git stash apply ) ' test_expect_success 'stash drop complains of extra options' ' test_must_fail git stash drop --foo ' test_expect_success 'drop top stash' ' git reset --hard && git stash list >expected && echo 7 >file && git stash && git stash drop && git stash list >actual && test_cmp expected actual && git stash apply && test 3 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) ' test_expect_success 'drop middle stash' ' git reset --hard && echo 8 >file && git stash && echo 9 >file && git stash && git stash drop stash@{1} && test 2 = $(git stash list | wc -l) && git stash apply && test 9 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) && git reset --hard && git stash drop && git stash apply && test 3 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) ' test_expect_success 'drop middle stash by index' ' git reset --hard && echo 8 >file && git stash && echo 9 >file && git stash && git stash drop 1 && test 2 = $(git stash list | wc -l) && git stash apply && test 9 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) && git reset --hard && git stash drop && git stash apply && test 3 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) ' test_expect_success 'stash pop' ' git reset --hard && git stash pop && test 3 = $(cat file) && test 1 = $(git show :file) && test 1 = $(git show HEAD:file) && test 0 = $(git stash list | wc -l) ' cat >expect <<EOF diff --git a/file2 b/file2 new file mode 100644 index 0000000..1fe912c --- /dev/null +++ b/file2 @@ -0,0 +1 @@ +bar2 EOF cat >expect1 <<EOF diff --git a/file b/file index 257cc56..5716ca5 100644 --- a/file +++ b/file @@ -1 +1 @@ -foo +bar EOF cat >expect2 <<EOF diff --git a/file b/file index 7601807..5716ca5 100644 --- a/file +++ b/file @@ -1 +1 @@ -baz +bar diff --git a/file2 b/file2 new file mode 100644 index 0000000..1fe912c --- /dev/null +++ b/file2 @@ -0,0 +1 @@ +bar2 EOF test_expect_success 'stash branch' ' echo foo >file && git commit file -m first && echo bar >file && echo bar2 >file2 && git add file2 && git stash && echo baz >file && git commit file -m second && git stash branch stashbranch && test refs/heads/stashbranch = $(git symbolic-ref HEAD) && test $(git rev-parse HEAD) = $(git rev-parse master^) && git diff --cached >output && test_cmp expect output && git diff >output && test_cmp expect1 output && git add file && git commit -m alternate\ second && git diff master..stashbranch >output && test_cmp output expect2 && test 0 = $(git stash list | wc -l) ' test_expect_success 'apply -q is quiet' ' echo foo >file && git stash && git stash apply -q >output.out 2>&1 && test_must_be_empty output.out ' test_expect_success 'save -q is quiet' ' git stash save --quiet >output.out 2>&1 && test_must_be_empty output.out ' test_expect_success 'pop -q is quiet' ' git stash pop -q >output.out 2>&1 && test_must_be_empty output.out ' test_expect_success 'pop -q --index works and is quiet' ' echo foo >file && git add file && git stash save --quiet && git stash pop -q --index >output.out 2>&1 && test foo = "$(git show :file)" && test_must_be_empty output.out ' test_expect_success 'drop -q is quiet' ' git stash && git stash drop -q >output.out 2>&1 && test_must_be_empty output.out ' test_expect_success 'stash -k' ' echo bar3 >file && echo bar4 >file2 && git add file2 && git stash -k && test bar,bar4 = $(cat file),$(cat file2) ' test_expect_success 'stash --no-keep-index' ' echo bar33 >file && echo bar44 >file2 && git add file2 && git stash --no-keep-index && test bar,bar2 = $(cat file),$(cat file2) ' test_expect_success 'stash --invalid-option' ' echo bar5 >file && echo bar6 >file2 && git add file2 && test_must_fail git stash --invalid-option && test_must_fail git stash save --invalid-option && test bar5,bar6 = $(cat file),$(cat file2) ' test_expect_success 'stash an added file' ' git reset --hard && echo new >file3 && git add file3 && git stash save "added file" && ! test -r file3 && git stash apply && test new = "$(cat file3)" ' test_expect_success 'stash --intent-to-add file' ' git reset --hard && echo new >file4 && git add --intent-to-add file4 && test_when_finished "git rm -f file4" && test_must_fail git stash ' test_expect_success 'stash rm then recreate' ' git reset --hard && git rm file && echo bar7 >file && git stash save "rm then recreate" && test bar = "$(cat file)" && git stash apply && test bar7 = "$(cat file)" ' test_expect_success 'stash rm and ignore' ' git reset --hard && git rm file && echo file >.gitignore && git stash save "rm and ignore" && test bar = "$(cat file)" && test file = "$(cat .gitignore)" && git stash apply && ! test -r file && test file = "$(cat .gitignore)" ' test_expect_success 'stash rm and ignore (stage .gitignore)' ' git reset --hard && git rm file && echo file >.gitignore && git add .gitignore && git stash save "rm and ignore (stage .gitignore)" && test bar = "$(cat file)" && ! test -r .gitignore && git stash apply && ! test -r file && test file = "$(cat .gitignore)" ' test_expect_success SYMLINKS 'stash file to symlink' ' git reset --hard && rm file && ln -s file2 file && git stash save "file to symlink" && test -f file && test bar = "$(cat file)" && git stash apply && case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac ' test_expect_success SYMLINKS 'stash file to symlink (stage rm)' ' git reset --hard && git rm file && ln -s file2 file && git stash save "file to symlink (stage rm)" && test -f file && test bar = "$(cat file)" && git stash apply && case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac ' test_expect_success SYMLINKS 'stash file to symlink (full stage)' ' git reset --hard && rm file && ln -s file2 file && git add file && git stash save "file to symlink (full stage)" && test -f file && test bar = "$(cat file)" && git stash apply && case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac ' # This test creates a commit with a symlink used for the following tests test_expect_success 'stash symlink to file' ' git reset --hard && test_ln_s_add file filelink && git commit -m "Add symlink" && rm filelink && cp file filelink && git stash save "symlink to file" ' test_expect_success SYMLINKS 'this must have re-created the symlink' ' test -h filelink && case "$(ls -l filelink)" in *" filelink -> file") :;; *) false;; esac ' test_expect_success 'unstash must re-create the file' ' git stash apply && ! test -h filelink && test bar = "$(cat file)" ' test_expect_success 'stash symlink to file (stage rm)' ' git reset --hard && git rm filelink && cp file filelink && git stash save "symlink to file (stage rm)" ' test_expect_success SYMLINKS 'this must have re-created the symlink' ' test -h filelink && case "$(ls -l filelink)" in *" filelink -> file") :;; *) false;; esac ' test_expect_success 'unstash must re-create the file' ' git stash apply && ! test -h filelink && test bar = "$(cat file)" ' test_expect_success 'stash symlink to file (full stage)' ' git reset --hard && rm filelink && cp file filelink && git add filelink && git stash save "symlink to file (full stage)" ' test_expect_success SYMLINKS 'this must have re-created the symlink' ' test -h filelink && case "$(ls -l filelink)" in *" filelink -> file") :;; *) false;; esac ' test_expect_success 'unstash must re-create the file' ' git stash apply && ! test -h filelink && test bar = "$(cat file)" ' test_expect_failure 'stash directory to file' ' git reset --hard && mkdir dir && echo foo >dir/file && git add dir/file && git commit -m "Add file in dir" && rm -fr dir && echo bar >dir && git stash save "directory to file" && test -d dir && test foo = "$(cat dir/file)" && test_must_fail git stash apply && test bar = "$(cat dir)" && git reset --soft HEAD^ ' test_expect_failure 'stash file to directory' ' git reset --hard && rm file && mkdir file && echo foo >file/file && git stash save "file to directory" && test -f file && test bar = "$(cat file)" && git stash apply && test -f file/file && test foo = "$(cat file/file)" ' test_expect_success 'giving too many ref arguments does not modify files' ' git stash clear && test_when_finished "git reset --hard HEAD" && echo foo >file2 && git stash && echo bar >file2 && git stash && test-tool chmtime =123456789 file2 && for type in apply pop "branch stash-branch" do test_must_fail git stash $type stash@{0} stash@{1} 2>err && test_i18ngrep "Too many revisions" err && test 123456789 = $(test-tool chmtime -g file2) || return 1 done ' test_expect_success 'drop: too many arguments errors out (does nothing)' ' git stash list >expect && test_must_fail git stash drop stash@{0} stash@{1} 2>err && test_i18ngrep "Too many revisions" err && git stash list >actual && test_cmp expect actual ' test_expect_success 'show: too many arguments errors out (does nothing)' ' test_must_fail git stash show stash@{0} stash@{1} 2>err 1>out && test_i18ngrep "Too many revisions" err && test_must_be_empty out ' test_expect_success 'stash create - no changes' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && git stash create >actual && test_must_be_empty actual ' test_expect_success 'stash branch - no stashes on stack, stash-like argument' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && STASH_ID=$(git stash create) && git reset --hard && git stash branch stash-branch ${STASH_ID} && test_when_finished "git reset --hard HEAD && git checkout master && git branch -D stash-branch" && test $(git ls-files --modified | wc -l) -eq 1 ' test_expect_success 'stash branch - stashes on stack, stash-like argument' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && git stash && test_when_finished "git stash drop" && echo bar >>file && STASH_ID=$(git stash create) && git reset --hard && git stash branch stash-branch ${STASH_ID} && test_when_finished "git reset --hard HEAD && git checkout master && git branch -D stash-branch" && test $(git ls-files --modified | wc -l) -eq 1 ' test_expect_success 'stash branch complains with no arguments' ' test_must_fail git stash branch 2>err && test_i18ngrep "No branch name specified" err ' test_expect_success 'stash show format defaults to --stat' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && git stash && test_when_finished "git stash drop" && echo bar >>file && STASH_ID=$(git stash create) && git reset --hard && cat >expected <<-EOF && file | 1 + 1 file changed, 1 insertion(+) EOF git stash show ${STASH_ID} >actual && test_i18ncmp expected actual ' test_expect_success 'stash show - stashes on stack, stash-like argument' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && git stash && test_when_finished "git stash drop" && echo bar >>file && STASH_ID=$(git stash create) && git reset --hard && echo "1 0 file" >expected && git stash show --numstat ${STASH_ID} >actual && test_cmp expected actual ' test_expect_success 'stash show -p - stashes on stack, stash-like argument' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && git stash && test_when_finished "git stash drop" && echo bar >>file && STASH_ID=$(git stash create) && git reset --hard && cat >expected <<-EOF && diff --git a/file b/file index 7601807..935fbd3 100644 --- a/file +++ b/file @@ -1 +1,2 @@ baz +bar EOF git stash show -p ${STASH_ID} >actual && test_cmp expected actual ' test_expect_success 'stash show - no stashes on stack, stash-like argument' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && STASH_ID=$(git stash create) && git reset --hard && echo "1 0 file" >expected && git stash show --numstat ${STASH_ID} >actual && test_cmp expected actual ' test_expect_success 'stash show -p - no stashes on stack, stash-like argument' ' git stash clear && test_when_finished "git reset --hard HEAD" && git reset --hard && echo foo >>file && STASH_ID=$(git stash create) && git reset --hard && cat >expected <<-EOF && diff --git a/file b/file index 7601807..71b52c4 100644 --- a/file +++ b/file @@ -1 +1,2 @@ baz +foo EOF git stash show -p ${STASH_ID} >actual && test_cmp expected actual ' test_expect_success 'stash show --patience shows diff' ' git reset --hard && echo foo >>file && STASH_ID=$(git stash create) && git reset --hard && cat >expected <<-EOF && diff --git a/file b/file index 7601807..71b52c4 100644 --- a/file +++ b/file @@ -1 +1,2 @@ baz +foo EOF git stash show --patience ${STASH_ID} >actual && test_cmp expected actual ' test_expect_success 'drop: fail early if specified stash is not a stash ref' ' git stash clear && test_when_finished "git reset --hard HEAD && git stash clear" && git reset --hard && echo foo >file && git stash && echo bar >file && git stash && test_must_fail git stash drop $(git rev-parse stash@{0}) && git stash pop && test bar = "$(cat file)" && git reset --hard HEAD ' test_expect_success 'pop: fail early if specified stash is not a stash ref' ' git stash clear && test_when_finished "git reset --hard HEAD && git stash clear" && git reset --hard && echo foo >file && git stash && echo bar >file && git stash && test_must_fail git stash pop $(git rev-parse stash@{0}) && git stash pop && test bar = "$(cat file)" && git reset --hard HEAD ' test_expect_success 'ref with non-existent reflog' ' git stash clear && echo bar5 >file && echo bar6 >file2 && git add file2 && git stash && test_must_fail git rev-parse --quiet --verify does-not-exist && test_must_fail git stash drop does-not-exist && test_must_fail git stash drop does-not-exist@{0} && test_must_fail git stash pop does-not-exist && test_must_fail git stash pop does-not-exist@{0} && test_must_fail git stash apply does-not-exist && test_must_fail git stash apply does-not-exist@{0} && test_must_fail git stash show does-not-exist && test_must_fail git stash show does-not-exist@{0} && test_must_fail git stash branch tmp does-not-exist && test_must_fail git stash branch tmp does-not-exist@{0} && git stash drop ' test_expect_success 'invalid ref of the form stash@{n}, n >= N' ' git stash clear && test_must_fail git stash drop stash@{0} && echo bar5 >file && echo bar6 >file2 && git add file2 && git stash && test_must_fail git stash drop stash@{1} && test_must_fail git stash pop stash@{1} && test_must_fail git stash apply stash@{1} && test_must_fail git stash show stash@{1} && test_must_fail git stash branch tmp stash@{1} && git stash drop ' test_expect_success 'invalid ref of the form "n", n >= N' ' git stash clear && test_must_fail git stash drop 0 && echo bar5 >file && echo bar6 >file2 && git add file2 && git stash && test_must_fail git stash drop 1 && test_must_fail git stash pop 1 && test_must_fail git stash apply 1 && test_must_fail git stash show 1 && test_must_fail git stash branch tmp 1 && git stash drop ' test_expect_success 'valid ref of the form "n", n < N' ' git stash clear && echo bar5 >file && echo bar6 >file2 && git add file2 && git stash && git stash show 0 && git stash branch tmp 0 && git checkout master && git stash && git stash apply 0 && git reset --hard && git stash pop 0 && git stash && git stash drop 0 && test_must_fail git stash drop ' test_expect_success 'branch: do not drop the stash if the branch exists' ' git stash clear && echo foo >file && git add file && git commit -m initial && echo bar >file && git stash && test_must_fail git stash branch master stash@{0} && git rev-parse stash@{0} -- ' test_expect_success 'branch: should not drop the stash if the apply fails' ' git stash clear && git reset HEAD~1 --hard && echo foo >file && git add file && git commit -m initial && echo bar >file && git stash && echo baz >file && test_when_finished "git checkout master" && test_must_fail git stash branch new_branch stash@{0} && git rev-parse stash@{0} -- ' test_expect_success 'apply: show same status as git status (relative to ./)' ' git stash clear && echo 1 >subdir/subfile1 && echo 2 >subdir/subfile2 && git add subdir/subfile1 && git commit -m subdir && ( cd subdir && echo x >subfile1 && echo x >../file && git status >../expect && git stash && sane_unset GIT_MERGE_VERBOSITY && git stash apply ) | sed -e 1d >actual && # drop "Saved..." test_i18ncmp expect actual ' cat >expect <<EOF diff --git a/HEAD b/HEAD new file mode 100644 index 0000000..fe0cbee --- /dev/null +++ b/HEAD @@ -0,0 +1 @@ +file-not-a-ref EOF test_expect_success 'stash where working directory contains "HEAD" file' ' git stash clear && git reset --hard && echo file-not-a-ref >HEAD && git add HEAD && test_tick && git stash && git diff-files --quiet && git diff-index --cached --quiet HEAD && test "$(git rev-parse stash^)" = "$(git rev-parse HEAD)" && git diff stash^..stash >output && test_cmp expect output ' test_expect_success 'store called with invalid commit' ' test_must_fail git stash store foo ' test_expect_success 'store updates stash ref and reflog' ' git stash clear && git reset --hard && echo quux >bazzy && git add bazzy && STASH_ID=$(git stash create) && git reset --hard && test_path_is_missing bazzy && git stash store -m quuxery $STASH_ID && test $(git rev-parse stash) = $STASH_ID && git reflog --format=%H stash| grep $STASH_ID && git stash pop && grep quux bazzy ' test_expect_success 'handle stash specification with spaces' ' git stash clear && echo pig >file && git stash && stamp=$(git log -g --format="%cd" -1 refs/stash) && test_tick && echo cow >file && git stash && git stash apply "stash@{$stamp}" && grep pig file ' test_expect_success 'setup stash with index and worktree changes' ' git stash clear && git reset --hard && echo index >file && git add file && echo working >file && git stash ' test_expect_success 'stash list implies --first-parent -m' ' cat >expect <<-EOF && stash@{0} diff --git a/file b/file index 257cc56..d26b33d 100644 --- a/file +++ b/file @@ -1 +1 @@ -foo +working EOF git stash list --format=%gd -p >actual && test_cmp expect actual ' test_expect_success 'stash list --cc shows combined diff' ' cat >expect <<-\EOF && stash@{0} diff --cc file index 257cc56,9015a7a..d26b33d --- a/file +++ b/file @@@ -1,1 -1,1 +1,1 @@@ - foo -index ++working EOF git stash list --format=%gd -p --cc >actual && test_cmp expect actual ' test_expect_success 'stash is not confused by partial renames' ' mv file renamed && git add renamed && git stash && git stash apply && test_path_is_file renamed && test_path_is_missing file ' test_expect_success 'push -m shows right message' ' >foo && git add foo && git stash push -m "test message" && echo "stash@{0}: On master: test message" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'push -m also works without space' ' >foo && git add foo && git stash push -m"unspaced test message" && echo "stash@{0}: On master: unspaced test message" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'store -m foo shows right message' ' git stash clear && git reset --hard && echo quux >bazzy && git add bazzy && STASH_ID=$(git stash create) && git stash store -m "store m" $STASH_ID && echo "stash@{0}: store m" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'store -mfoo shows right message' ' git stash clear && git reset --hard && echo quux >bazzy && git add bazzy && STASH_ID=$(git stash create) && git stash store -m"store mfoo" $STASH_ID && echo "stash@{0}: store mfoo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'store --message=foo shows right message' ' git stash clear && git reset --hard && echo quux >bazzy && git add bazzy && STASH_ID=$(git stash create) && git stash store --message="store message=foo" $STASH_ID && echo "stash@{0}: store message=foo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'store --message foo shows right message' ' git stash clear && git reset --hard && echo quux >bazzy && git add bazzy && STASH_ID=$(git stash create) && git stash store --message "store message foo" $STASH_ID && echo "stash@{0}: store message foo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'push -mfoo uses right message' ' >foo && git add foo && git stash push -m"test mfoo" && echo "stash@{0}: On master: test mfoo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'push --message foo is synonym for -mfoo' ' >foo && git add foo && git stash push --message "test message foo" && echo "stash@{0}: On master: test message foo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'push --message=foo is synonym for -mfoo' ' >foo && git add foo && git stash push --message="test message=foo" && echo "stash@{0}: On master: test message=foo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'push -m shows right message' ' >foo && git add foo && git stash push -m "test m foo" && echo "stash@{0}: On master: test m foo" >expect && git stash list -1 >actual && test_cmp expect actual ' test_expect_success 'create stores correct message' ' >foo && git add foo && STASH_ID=$(git stash create "create test message") && echo "On master: create test message" >expect && git show --pretty=%s -s ${STASH_ID} >actual && test_cmp expect actual ' test_expect_success 'create with multiple arguments for the message' ' >foo && git add foo && STASH_ID=$(git stash create test untracked) && echo "On master: test untracked" >expect && git show --pretty=%s -s ${STASH_ID} >actual && test_cmp expect actual ' test_expect_success 'create in a detached state' ' test_when_finished "git checkout master" && git checkout HEAD~1 && >foo && git add foo && STASH_ID=$(git stash create) && HEAD_ID=$(git rev-parse --short HEAD) && echo "WIP on (no branch): ${HEAD_ID} initial" >expect && git show --pretty=%s -s ${STASH_ID} >actual && test_cmp expect actual ' test_expect_success 'stash -- <pathspec> stashes and restores the file' ' >foo && >bar && git add foo bar && git stash push -- foo && test_path_is_file bar && test_path_is_missing foo && git stash pop && test_path_is_file foo && test_path_is_file bar ' test_expect_success 'stash -- <pathspec> stashes in subdirectory' ' mkdir sub && >foo && >bar && git add foo bar && ( cd sub && git stash push -- ../foo ) && test_path_is_file bar && test_path_is_missing foo && git stash pop && test_path_is_file foo && test_path_is_file bar ' test_expect_success 'stash with multiple pathspec arguments' ' >foo && >bar && >extra && git add foo bar extra && git stash push -- foo bar && test_path_is_missing bar && test_path_is_missing foo && test_path_is_file extra && git stash pop && test_path_is_file foo && test_path_is_file bar && test_path_is_file extra ' test_expect_success 'stash with file including $IFS character' ' >"foo bar" && >foo && >bar && git add foo* && git stash push -- "foo b*" && test_path_is_missing "foo bar" && test_path_is_file foo && test_path_is_file bar && git stash pop && test_path_is_file "foo bar" && test_path_is_file foo && test_path_is_file bar ' test_expect_success 'stash with pathspec matching multiple paths' ' echo original >file && echo original >other-file && git commit -m "two" file other-file && echo modified >file && echo modified >other-file && git stash push -- "*file" && echo original >expect && test_cmp expect file && test_cmp expect other-file && git stash pop && echo modified >expect && test_cmp expect file && test_cmp expect other-file ' test_expect_success 'stash push -p with pathspec shows no changes only once' ' >foo && git add foo && git commit -m "tmp" && git stash push -p foo >actual && echo "No local changes to save" >expect && git reset --hard HEAD~ && test_i18ncmp expect actual ' test_expect_success 'push <pathspec>: show no changes when there are none' ' >foo && git add foo && git commit -m "tmp" && git stash push foo >actual && echo "No local changes to save" >expect && git reset --hard HEAD~ && test_i18ncmp expect actual ' test_expect_success 'push: <pathspec> not in the repository errors out' ' >untracked && test_must_fail git stash push untracked && test_path_is_file untracked ' test_expect_success 'push: -q is quiet with changes' ' >foo && git add foo && git stash push -q >output 2>&1 && test_must_be_empty output ' test_expect_success 'push: -q is quiet with no changes' ' git stash push -q >output 2>&1 && test_must_be_empty output ' test_expect_success 'push: -q is quiet even if there is no initial commit' ' git init foo_dir && test_when_finished rm -rf foo_dir && ( cd foo_dir && >bar && test_must_fail git stash push -q >output 2>&1 && test_must_be_empty output ) ' test_expect_success 'untracked files are left in place when -u is not given' ' >file && git add file && >untracked && git stash push file && test_path_is_file untracked ' test_expect_success 'stash without verb with pathspec' ' >"foo bar" && >foo && >bar && git add foo* && git stash -- "foo b*" && test_path_is_missing "foo bar" && test_path_is_file foo && test_path_is_file bar && git stash pop && test_path_is_file "foo bar" && test_path_is_file foo && test_path_is_file bar ' test_expect_success 'stash -k -- <pathspec> leaves unstaged files intact' ' git reset && >foo && >bar && git add foo bar && git commit -m "test" && echo "foo" >foo && echo "bar" >bar && git stash -k -- foo && test "",bar = $(cat foo),$(cat bar) && git stash pop && test foo,bar = $(cat foo),$(cat bar) ' test_expect_success 'stash -- <subdir> leaves untracked files in subdir intact' ' git reset && >subdir/untracked && >subdir/tracked1 && >subdir/tracked2 && git add subdir/tracked* && git stash -- subdir/ && test_path_is_missing subdir/tracked1 && test_path_is_missing subdir/tracked2 && test_path_is_file subdir/untracked && git stash pop && test_path_is_file subdir/tracked1 && test_path_is_file subdir/tracked2 && test_path_is_file subdir/untracked ' test_expect_success 'stash -- <subdir> works with binary files' ' git reset && >subdir/untracked && >subdir/tracked && cp "$TEST_DIRECTORY"/test-binary-1.png subdir/tracked-binary && git add subdir/tracked* && git stash -- subdir/ && test_path_is_missing subdir/tracked && test_path_is_missing subdir/tracked-binary && test_path_is_file subdir/untracked && git stash pop && test_path_is_file subdir/tracked && test_path_is_file subdir/tracked-binary && test_path_is_file subdir/untracked ' test_expect_success 'stash with user.name and user.email set works' ' test_config user.name "A U Thor" && test_config user.email "a.u@thor" && git stash ' test_expect_success 'stash works when user.name and user.email are not set' ' git reset && >1 && git add 1 && echo "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" >expect && git stash && git show -s --format="%an <%ae>" refs/stash >actual && test_cmp expect actual && >2 && git add 2 && test_config user.useconfigonly true && test_config stash.usebuiltin true && ( sane_unset GIT_AUTHOR_NAME && sane_unset GIT_AUTHOR_EMAIL && sane_unset GIT_COMMITTER_NAME && sane_unset GIT_COMMITTER_EMAIL && test_unconfig user.email && test_unconfig user.name && test_must_fail git commit -m "should fail" && echo "git stash <git@stash>" >expect && >2 && git stash && git show -s --format="%an <%ae>" refs/stash >actual && test_cmp expect actual ) ' test_expect_success 'stash --keep-index with file deleted in index does not resurrect it on disk' ' test_commit to-remove to-remove && git rm to-remove && git stash --keep-index && test_path_is_missing to-remove ' test_done
true
ae3e5221db23121fcca02d8fd82426d0bfee30ab
Shell
ekarmazin/tfvars-generator
/tfvars-gen.sh
UTF-8
3,182
3.96875
4
[]
no_license
#!/bin/bash set -e # Disclamer: # # cfg_parser - Parse and ini files into variables # By Andres J. Diaz # http://theoldschooldevops.com/2008/02/09/bash-ini-parser/ # Use pastebin link WordPress corrupts the script text # http://pastebin.com/f61ef4979 (original) # http://pastebin.com/m4fe6bdaf (supports spaces in values) # cfg_parser () { IFS=$'\n' && ini=( $(<$1) ) # convert to line-array ini=( ${ini[*]//;*/} ) # remove comments ; ini=( ${ini[*]//\#*/} ) # remove comments # ini=( ${ini[*]/\ =/=} ) # remove tabs before = ini=( ${ini[*]/=\ /=} ) # remove tabs be = ini=( ${ini[*]/\ *=\ /=} ) # remove anything with a space around = ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix ini=( ${ini[*]/%]/ \(} ) # convert text2function (1) ini=( ${ini[*]/=/=\( } ) # convert item to array ini=( ${ini[*]/%/ \)} ) # close array parenthesis ini=( ${ini[*]/%\\ \)/ \\} ) # the multiline trick ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2) ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis ini[0]="" # remove first element ini[${#ini[*]} + 1]='}' # add the last brace eval "$(echo "${ini[*]}")" # eval the result } display_help () { echo -e "\n Usage: $0 [--credentials=<path>] [--profile=<name>] [--gtoken=<github token>] [--key-path=</foo/bar/>] [--key-name=<key.pem>] \n" echo -e " Default --credentials is '~/.aws/credentials' \n" echo -e " Default --profile is 'default' \n" } for i in "$@" do case $i in --credentials=*) CREDENTIALS="${i#*=}" shift # past argument=value ;; --profile=*) PROFILE="${i#*=}" shift # past argument=value ;; --gtoken=*) TOKEN="${i#*=}" shift # past argument=value ;; --key-path=*) AWS_KEY_PATH="${i#*=}" shift # past argument=value ;; --key-name=*) AWS_KEY_NAME="${i#*=}" shift # past argument=value ;; --help) display_help exit 0 ;; *) # unknown option echo "Unknown option $1" display_help exit 1 ;; esac done # Set default values CREDENTIALS=${CREDENTIALS:-~/.aws/credentials} PROFILE=${PROFILE:-default} AWS_KEY_PATH=${AWS_KEY_PATH:-/} AWS_KEY_NAME=${AWS_KEY_NAME:-key.pem} GITHUB_TOKEN=${TOKEN:-00000} # Do the magic of cfg_parser if [[ ! -r "${CREDENTIALS}" ]]; then echo "File not found: '${CREDENTIALS}'" exit 3 fi cfg_parser "${CREDENTIALS}" if [[ $? -ne 0 ]]; then echo "Parsing credentials file '${CREDENTIALS}' failed" exit 4 fi cfg.section.${PROFILE} if [[ $? -ne 0 ]]; then echo "Profile '${PROFILE}' not found" exit 5 else echo "aws_access_key = \"${aws_access_key_id}\"" > terraform.tfvars && echo "aws_secret_key = \"${aws_secret_access_key}\"" >> terraform.tfvars # If no token in profile then skip it in outpout file if [[ ${aws_session_token} ]]; then echo "aws_session_token = \"${aws_session_token}\"" >> terraform.tfvars fi echo "aws_key_path = \"${AWS_KEY_PATH}\"" >> terraform.tfvars echo "aws_key_name = \"${AWS_KEY_NAME}\"" >> terraform.tfvars echo "github_token = \"${GITHUB_TOKEN}\"" >> terraform.tfvars echo -e "Done! Enjoy your terraform! \n" fi exit 0
true
b299263048ba0269dbe5b1317c79cc27209bba6c
Shell
ODEX-TOS/packages
/archiso/repos/extra-any/PKGBUILD
UTF-8
990
2.578125
3
[ "GPL-1.0-or-later", "MIT" ]
permissive
# Maintainer: David Runge <dvzrv@archlinux.org> # Contributor: Pierre Schmitz <pierre@archlinux.de> # Contributor: Gerardo Exequiel Pozzi <djgera@archlinux.org> pkgbase=archiso pkgname=('archiso' 'mkinitcpio-archiso') pkgver=50.1 pkgrel=1 pkgdesc='Tools for creating Arch Linux live and install iso images' arch=('any') license=('GPL3') url="https://gitlab.archlinux.org/archlinux/archiso" makedepends=('git') source=("git+https://gitlab.archlinux.org/archlinux/archiso.git#tag=v${pkgver}?signed") sha256sums=('SKIP') validpgpkeys=('C7E7849466FE2358343588377258734B41C31549') # David Runge <dvzrv@archlinux.org> package_archiso() { depends=('arch-install-scripts' 'bash' 'dosfstools' 'e2fsprogs' 'libisoburn' 'mtools' 'squashfs-tools') optdepends=('edk2-ovmf: for emulating UEFI with run_archiso' 'qemu: for run_archiso') cd "${pkgbase}" make DESTDIR="${pkgdir}" install } package_mkinitcpio-archiso() { pkgdesc='Mkinitcpio hooks and scripts for archiso' depends=('mkinitcpio') cd "${pkgbase}" make DESTDIR="${pkgdir}" install-initcpio }
true
15c44afbb761c18c87f44eac2d573012767b559d
Shell
kunalbhat/sinatra-shell
/shell_sinatra.sh
UTF-8
1,470
3.65625
4
[]
no_license
#!/bin/sh # shell_sinatra - a shell script that generates all the folders and files # needed for a small sinatra project # Create the root project folder if [ "$1" != "" ]; then project_folder=$1 else project_folder='new-sinatra-project' fi mkdir $1 cd $1 # Initialize git git init # Detect explicit ruby version to set with rbenv, otherwise just # use `system` if [ "$2" != "" ]; then rbenv local $2 else rbenv local system fi # Make directories directories=( "assets" "assets/javascripts" "views" ) for f in "${directories[@]}" do : mkdir $f done # Create app files app_files=( "app.rb Gemfile Procfile" ) for f in "${app_files[@]}" do : touch $f done # Create layout and asset files layout_files=( "assets/javascripts/application.coffee" "views/layout.haml" "views/index.haml" "style.scss" ) for f in "${layout_files[@]}" do : touch $f done # Generate app.rb cat > app.rb << _EOF_ Bundler.require :web Bundler.require :development if development? use Rack::Coffee, root: 'assets', urls: '/javascripts' get '/style.css' do scss :style end get '/' do haml :index end _EOF_ # Generate Gemfile cat > Gemfile << _EOF_ source 'https://rubygems.org' ruby '$2' gem 'puma' group :web do gem 'haml' gem 'rack-coffee' gem 'sinatra' gem 'sass' end group :development do gem 'sinatra-reloader' end _EOF_ # Procfile cat > Procfile << _EOF_ web: bundle exec ruby app.rb -p \$PORT _EOF_ # Bundle bundle install --path vendor/
true
ab77ff0191585964386c6ab64b81d77c372a0e1e
Shell
xwi88/go-demo-gin
/docker/docker-version.sh
UTF-8
293
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env bash # image info, version may auto update TAG=latest USER=v8fg NAME=go-demo-gin REPOSITORY=${USER}/${NAME} # image with tag, use to push image LOCATION=${REPOSITORY}:${TAG} # use to build container CONTAINER_NAME=${USER}-${NAME} # ARGS ... DAEMON="-d" PORT="-p 9990:9990"
true
5936ffdec59ad403c675d6896bf3ea423f2e1e0f
Shell
creio/dots
/.config/eww/bar/scripts/workspace
UTF-8
865
3.375
3
[]
no_license
#!/usr/bin/env bash gib_workspace_names() { wmctrl -d | awk '{ print $1 " " $2 " " $9 }' | grep -v NSP } gib_workspace_yuck() { buffered="" gib_workspace_names | while read -r id active name; do name="${name#*_}" if [ "$active" == '*' ]; then active_class="active" else active_class="inactive" fi if wmctrl -l | grep --regexp '.*\s\+'"$id"'\s\+.*' >/dev/null; then button_class="occupied" button_name="ﱣ" else button_class="empty" button_name="祿" fi buffered+="(button :class \"$button_class $active_class\" :onclick \"wmctrl -s $id\" \"$button_name\")" echo -n "$buffered" buffered="" done } box_attrs=':orientation "h" :class "works" :space-evenly false :spacing 5 :halign "center" :valign "center" :vexpand false ' echo "(box $box_attrs $(gib_workspace_yuck))"
true
e69109b825883cdf0d28ec62b3036f281b4919dc
Shell
erkiluik001/skriptimine
/praks9/yl4
UTF-8
435
2.921875
3
[]
no_license
#!/bin/bash # echo -n "Sisetage ridade arv: " #kasutaja peab sisestama ridade arvu read rida #loeb kasutaja vastust num=1 #number algab ühest for (( i = 1; i <= $rida; i++ )) do #alustab do käsku echo -n "$num." #echob numbri. let num++ #jätkab numbri käsku for (( j = 1; j <= $i; j++ )) do #alustab do käsku echo -n "* " #echob tärn ja tühik done #löppetab do käsu echo "" #kuvab lahenduse ekraanile done #lõppetab do käsu
true
62b66b52d6b37a9683afc471ad8452d6e7bd39de
Shell
slack/dotfiles
/bin/core
UTF-8
458
2.953125
3
[]
no_license
#!/bin/bash set -x if [[ -z ${CORE_TOKEN} ]]; then echo "No CORE_TOKEN found, use 'core-login' to login" exit 1 fi if [[ -z ${CORE_URL} ]]; then echo "No CORE_URL found, use 'core-login' to set" exit 1 fi response_body=$(curl -v -X ${CORE_METHOD:-"GET"} -H "X-EY-Token: ${CORE_TOKEN}" -H "Content-type: application/json" -H "Accept: application/vnd.engineyard-private+json" ${CORE_URL}$*) echo ${response_body} | /usr/bin/env python -mjson.tool
true
b800e65ccf3c4782a706c5ac20b896993b663735
Shell
orgrim/nb-utils
/pkgsrc/prepare_pkg_comp
UTF-8
5,605
3.34375
3
[]
no_license
#!/bin/sh # # Copyright 2011 Nicolas Thauvin. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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. # DESTDIR="/usr/pkg_comp" RELEASE="/var/pub/NetBSD" PKGSRC="/usr/pkgsrc" DISTFILES="/usr/pkgsrc/distfiles" PACKAGES="/usr/pkgsrc/packages" usage() { echo "usage: `basename $0` [options] chroot_name" echo "options:" echo " -d destdir Sandbox path. ($DESTDIR)" echo " -r release Path to RELEASEDIR ($RELEASE)" echo " -s pkgsrc Path to PKGSRC ($PKGSRC)" echo " -f distfiles Path to DISTFILES ($DISTFILES)" echo " -p packages Path to PACKAGES ($PACKAGES)" echo " -e DISTFILES and PACKAGES are in the parent directory of PKGSRC" echo echo " -h Print this help" exit $1 } args=`getopt d:r:s:f:p:eh $*` if [ $? != 0 ]; then usage 1 fi set -- $args for o in $*; do case $o in -d) DESTDIR=$2; shift 2;; -r) RELEASE=$2; shift 2;; -s) PKGSRC=$2; shift 2;; -f) DISTFILES=$2; shift 2;; -p) PACKAGES=$2; shift 2;; -e) EXTERN="yes"; shift;; -h) usage 1;; --) shift; break;; esac done if [ $# != 1 ]; then echo "Error: mmissing chroot_name" usage 1 fi CHROOT=$1 DESTDIR=$DESTDIR/$CHROOT RELEASE=$RELEASE/`uname -m` if [ "$EXTERN" = "yes" ]; then parent=`dirname $PKGSRC` DISTFILES=$parent/`basename $DISTFILES` PACKAGES=$parent/`basename $PACKAGES` else DISTFILES=$PKGSRC/`basename $DISTFILES` PACKAGES=$PKGSRC/`basename $PACKAGES` fi CONF=$HOME/pkg_comp/${CHROOT}.conf if [ -f $CONF ]; then echo "Error: $CONF exists." exit 1 fi cat > $HOME/pkg_comp/${CHROOT}.conf <<EOF # -*- sh -*- # # pkg_comp - configuration file # See pkg_comp(8) for a detailed description of each variable. # # Variables used internally by pkg_comp. AUTO_PACKAGES="" AUTO_TARGET="package-install" BUILD_PACKAGES="pkgtools/pkg_chk pkgtools/pkg_comp pkgtools/pkg_tarup pkgtools/pkgclean pkgtools/pkgfind" BUILD_TARGET="package-install" COPYROOTCFG="no" DESTDIR="$DESTDIR" DISTRIBDIR="$RELEASE" LIBKVER_STANDALONE_PREFIX="/libkver" MAKEROOT_HOOKS="" MOUNT_HOOKS="" NETBSD_RELEASE="no" REAL_CCACHE="" REAL_DISTFILES="$DISTFILES" REAL_DISTFILES_OPTS="-t null -o rw" REAL_PACKAGES="$PACKAGES" REAL_PACKAGES_OPTS="-t null -o rw" REAL_PKGSRC="$PKGSRC" REAL_PKGSRC_OPTS="-t null -o ro" REAL_PKGVULNDIR="/usr/pkgsrc/distfiles" REAL_SRC="/usr/src" REAL_SRC_OPTS="-t null -o ro" ROOTSHELL="/bin/ksh" SETS="base.tgz comp.tgz etc.tgz kern-GENERIC.tgz text.tgz" SETS_X11="xbase.tgz xcomp.tgz xetc.tgz xfont.tgz xserver.tgz" SYNC_UMOUNT="no" UMOUNT_HOOKS="" # Default variables written to the generated mk.conf. BSDSRCDIR="/usr/src" CFLAGS="" CLEANDEPENDS="yes" CPPFLAGS="" CXXFLAGS="" DISTDIR="/pkg_comp/distfiles" LIBKVER_STANDALONE_PREFIX="/libkver" LOCALBASE="/usr/pkg" MKOBJDIRS="yes" PACKAGES="/pkg_comp/packages" PKGSRC_COMPILER="gcc" PKGVULNDIR="/usr/pkg/share" PKG_DBDIR="/var/db/pkg" PKG_DEVELOPER="yes" PKG_SYSCONFBASE="/usr/pkg/etc" USE_AUDIT_PACKAGES="yes" USE_XPKGWEDGE="yes" WRKDIR_BASENAME="default" WRKOBJDIR="/pkg_comp/obj/pkgsrc" EOF pkg_comp -c $CHROOT makeroot cat > $DESTDIR/etc/mk.conf <<EOF # # /etc/mk.conf # .ifdef BSD_PKG_MK WRKDIR_BASENAME ?= default MKOBJDIRS ?= yes BSDSRCDIR ?= /usr/src WRKOBJDIR ?= /pkg_comp/obj/pkgsrc DISTDIR ?= /pkg_comp/distfiles PACKAGES ?= /pkg_comp/packages CLEANDEPENDS ?= yes LOCALBASE ?= /usr/pkg PKG_SYSCONFBASE ?= /usr/pkg/etc USE_AUDIT_PACKAGES ?= yes PKGVULNDIR ?= /usr/pkg/share USE_XPKGWEDGE ?= yes PKGSRC_COMPILER ?= gcc LIBKVER_STANDALONE_PREFIX ?= /libkver # pkgsrc LOCALPATCHES=/usr/pkgsrc/localpatches UPDATE_TARGET=package-install DEPENDS_TARGET=package-install #PKG_DEVELOPER=yes # pkg_chk PKGCHK_UPDATE_CONF=/tmp/pkgchk-update.conf PKGCHK_CONF=/usr/pkgsrc/pkgchk.conf # pkg options PGSQL_VERSION_DEFAULT=90 PKG_DEFAULT_OPTIONS+= inet6 ssl -arts -aalib -pulseaudio perl PKG_OPTIONS.freetype2 += subpixel PKG_OPTIONS.scmgit+= -scmgit-gui PKG_OPTIONS.mplayer+= -mplayer-menu PKG_OPTIONS.squid+= squid-pf PKG_OPTIONS.php+= fastcgi suhosin PKG_OPTIONS.mutt+= gpgme mutt-sidebar ncursesw PKG_OPTIONS.cone+= wide-curses PKG_OPTIONS.thunderbird+= mozilla-enigmail # licenses ACCEPTABLE_LICENSES+= vim-license ACCEPTABLE_LICENSES+= mplayer-codec-license ACCEPTABLE_LICENSES+= openmotif-license ACCEPTABLE_LICENSES+= ms-ttf-license ACCEPTABLE_LICENSES+= unrar-license .endif # BSD_PKG_MK EOF
true
903cc86d5c1db04fc34ff48835ccf6dd3b81f0e1
Shell
Annasadra/fio.start
/scripts/claimrewards-auto.sh
UTF-8
1,440
3.015625
3
[ "MIT" ]
permissive
#!/bin/bash ############################################################################### # # FIO tools # # Created by CryptoLions.io; updated by ZenBlocks.io # Git Hub: https://github.com/fioprotocol/fio.start # ############################################################################### v2endpoint=https://fio.eossweden.org fioAddress="bp@zenblocks" actor=p5fi5ywnitjc lastclaimed=$(curl -X GET "$v2endpoint/v2/history/get_actions?account=$actor&filter=fio.treasury%3Abpclaim&limit=1&sort=desc&simple=true" -H "accept: application/json" | jq .simple_actions[].timestamp -r) #lastclaimed=$(curl -X GET "https://api.waxsweden.org/v2/history/get_actions?account=zenblockswax&filter=eosio%3Aclaimrewards&sort=desc&simple=true" -H "accept: application/json" | jq .simple_actions[0].timestamp -r) if [ ! -z "$lastclaimed" ] then claimed=$(date -d "${lastclaimed}" +"%s") now=$(date +"%s") diff=$(( $now - $claimed )) echo "lastclaimed:$claimed\nnow:$now\ndiff:$diff" if [ $diff > 14400 ] # allow claim every 4hrs min then # use pwd for new wallet specifically to store custom perm created with updateauth.sh ./clio.sh wallet unlock -n claims --password PW5DU5L385JT72HE8TJ295G295H27FDL58FY386H20Dh9e3i69ss8w ./clio.sh push action fio.treasury bpclaim '{"fio_address":"'$fioAddress'","actor":"'$actor'"}' -p $actor@claim ./clio.sh wallet lock -n claims fi fi
true
5809379c7cc7abf200c64b03bc566e94a668e07b
Shell
kdave/xfstests
/tests/generic/496
UTF-8
1,940
3.375
3
[]
no_license
#! /bin/bash # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2018 Oracle. All Rights Reserved. # # FS QA Test No. 496 # # Test various swapfile activation oddities on filesystems that support # fallocated swapfiles (for given fs ext4/xfs) # . ./common/preamble _begin_fstest auto quick swap prealloc # Override the default cleanup function. _cleanup() { cd / swapoff $swapfile 2> /dev/null rm -f $tmp.* } # Import common functions. . ./common/filter # real QA test starts here _supported_fs generic _require_scratch_swapfile _require_test_program mkswap _require_test_program swapon _require_xfs_io_command "falloc" _scratch_mkfs >>$seqres.full 2>&1 _scratch_mount >>$seqres.full 2>&1 swapfile=$SCRATCH_MNT/swap len=$((2 * 1048576)) page_size=$(get_page_size) swapfile_cycle() { local swapfile="$1" "$here/src/mkswap" $swapfile >> $seqres.full "$here/src/swapon" $swapfile 2>&1 | _filter_scratch swapoff $swapfile 2>> $seqres.full rm -f $swapfile } # Create a fallocated swap file echo "fallocate swap" | tee -a $seqres.full touch $swapfile # Swap files must be nocow on Btrfs. $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 $XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full "$here/src/mkswap" $swapfile # ext4/xfs should not fail for swapon on fallocated files case $FSTYP in ext4|xfs) "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \ _fail "swapon failed on fallocated file" ;; *) "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \ _notrun "fallocated swap not supported here" ;; esac swapoff $swapfile # Create a fallocated swap file and touch every other $PAGE_SIZE to create # a mess of written/unwritten extent records echo "mixed swap" | tee -a $seqres.full $XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full seq $page_size $((page_size * 2)) $len | while read offset; do _pwrite_byte 0x58 $offset 1 $swapfile >> $seqres.full done swapfile_cycle $swapfile status=0 exit
true
e323faa0856ce66db4cd1031a4ed5b3f7f663984
Shell
Tscott7/proj5-maps
/stop.sh
UTF-8
564
4.03125
4
[ "Artistic-2.0" ]
permissive
#! /bin/bash # # Stop the service started by start.sh # It's process ID should be in ./SERVICE_PID # # See design notes in start.sh # this=${BASH_SOURCE[0]} here=`dirname ${this}` pushd ${here} pid=`cat SERVICE_PID` numpat='^[0-9]+$' if [[ ${pid} =~ ${numpat} ]]; then # That looks like a process ID ... echo "PS: " ps -x ${pid} echo "Killing process ${pid}" kill -9 ${pid} sleep 1 ps -x ${pid} else echo "Didn't find expected value in ${here}/SERVICE_PID" echo "Found /${pid}/" echo "Didn't match /${numpat}/" fi; popd
true
b162c3039eee4673a47e75f7c0e6f956cf40607f
Shell
chrishagel/setup
/dotfiles/.zshrc
UTF-8
1,262
2.78125
3
[]
no_license
#------------------------------ # Adopt .bash_profile config #------------------------------ source ~/.bash_profile #------------------------------ # Customize Prompt #------------------------------ ## Source: http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html ### user@host:CWD zsh > PROMPT="%B%F{blue}%n%F{magenta}@%m:%F{blue}%~ %F{white}zsh > %f%b" #------------------------------ # Show Git Branch #------------------------------ ## Source: https://git-scm.com/book/en/v2/Git-in-Other-Environments-Git-in-Zsh #autoload -Uz vcs_info #precmd_vcs_info() { vcs_info } #precmd_functions+=( precmd_vcs_info ) #setopt prompt_subst #RPROMPT=\$vcs_info_msg_0_ # PROMPT=\$vcs_info_msg_0_'%# ' #zstyle ':vcs_info:git:*' formats '%b'
true
40754b4b9261adf599b45fc7c5537997bd104035
Shell
trasherdk/dotfiles
/i3/temperature.sh
UTF-8
123
2.59375
3
[]
no_license
#!/bin/bash DATA="$(sensors | egrep '(Core 0|temp1)' | egrep -o '\+[0-9\. ]+' | head -2 | tr '\n' '/' )" echo "${DATA%?} "
true
85b2f9c07c56051bff41fac127d6b0fa519f255e
Shell
Odoo-10-test/trucos_odoo
/odoo_calculate_workers.sh
UTF-8
2,964
3.90625
4
[]
no_license
#!/bin/bash # CONST 1GB CONST_1GB="1024*1024*1024" # VARIABLE WORKERS CMD_W=0 # VARIABLE MAX MEMORY PERCENT CMD_M=80 # VARIABLE IS HELP CMD_H=0 # VARIABLE IS VERBOSE CMD_V=0 # FUNCTIONS arithmetic() { echo "scale=0; $1" | bc } calculateWorkers(){ if [ $CMD_W -gt 0 ]; then echo $CMD_W elif [ $(calculateMaxMemory) -le $(arithmetic "$CONST_1GB") ]; then echo 1 # 1GB elif [ $(calculateMaxMemory) -le $(arithmetic "2*$CONST_1GB") ]; then echo 2 # 2GB elif [ $(calculateMaxMemory) -le $(arithmetic "3*$CONST_1GB") ]; then echo 3 # 3GB else echo $(arithmetic "1+$(calculateNumCores)*2") fi } calculateMemTotal () { echo $(arithmetic "$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }')*1024") } calculateNumCores(){ echo $(nproc) } calculateMaxMemory() { echo $(arithmetic "$(calculateMemTotal)*$CMD_M/100") } calculateLimitMemoryHard() { echo $(arithmetic "$(calculateMaxMemory)/$(calculateWorkers)") } calculateLimitMemorySoft() { echo $(arithmetic "$(calculateLimitMemoryHard)*80/100") } # COMMANDS v() { echo echo "System Information" echo "------------------" echo "Cores (CORES): $(calculateNumCores)" echo "Total Memory (TOTAL_M): $(calculateMemTotal) bytes" echo "Max Allowed Memory (ALLOW_M): $(calculateMaxMemory) bytes" echo "Max Allowed Memory Percent, default 80%: $CMD_M%" echo echo echo "Functions to calculate configutarion" echo "------------------------------------" echo "workers = if not used -w then" echo " if ALLOW_M < 1GB then 1" echo " else ALLOW_M < 2GB then 2" echo " else ALLOW_M < 3GB then 3" echo " else 1+CORES*2" echo " else -w" echo "limit_memory_hard = ALLOW_M / workers" echo "limit_memory_soft = limit_memory_hard * 80%" echo "limit_request = DEFAULT 8192" echo "limit_time_cpu = DEFAULT 120" echo "limit_time_real = DEFAULT 180" echo "max_cron_threads = DEFAULT 2" echo echo echo "Add to the odoo-server.conf" echo "---------------------------" c echo } h() { echo "This file enables us to optimally configure multithreading settings Odoo" echo " -h Help" echo " -m Max memory percent to use" echo " -v Verbose" echo " -w Set static workers number" } c() { echo "workers = $(calculateWorkers)" echo "limit_memory_hard = $(calculateLimitMemoryHard)" echo "limit_memory_soft = $(calculateLimitMemorySoft)" echo "limit_request = 8192" echo "limit_time_cpu = 120" echo "limit_time_real = 180" echo "max_cron_threads = 2" } # PROCESS PARAMETERS i=1 while ["$i" -le $# ] do case "${!i}" in '-w') ((i++)) CMD_W=${!i} ;; '-m') ((i++)) if [ ${!i} -gt 0 ] && [ ${!i} -lt 80 ]; then CMD_M=${!i} fi ;; '-v') CMD_V=1 ;; '-h') CMD_H=1 ;; *) # NOTHING ;; esac done # EXEC ACTION if [ $CMD_H -eq 1 ]; then h elif [ $CMD_V -eq 1 ]; then v else c fi exit 0
true
7c451c5d0de12de954e750405e651949279e09ea
Shell
cloudfoundry/nats-release
/acceptance/run-fail-if-v1-happy.sh
UTF-8
1,294
3.265625
3
[ "Apache-2.0" ]
permissive
#!/bin/bash set -x TESTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" RELEASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd ../ && pwd )" echo "-----> `date`: Delete previous deployment" bosh -n -d nats delete-deployment --force echo "-----> `date`: Deploy dev release" ( set -e; bosh -n -d nats deploy $TESTDIR/manifest-non-tls.yml -o $TESTDIR/replace-with-dev.yml -o $TESTDIR/properties-fail-if-v1.yml -o $TESTDIR/100-max-flight.yml ) if [[ $? == 1 ]]; then echo "Deployment failed unexpectedlly. Failing." exit 1 else echo "Deployment succeeded." fi echo "-----> `date`: Checking results" bosh -d nats ssh -c "cd /var/vcap/sys/log/nats-tls && sudo tail post-start.stdout.log | grep 'Local nats server version: 2'" if [[ $? == 0 ]]; then echo "V2 confirmation logged as expected." else echo "No v2 confirmation message. Failing." exit 1 fi bosh -d nats ssh -c "ps aux | grep -v grep | grep gnats" if [[ $? == 0 ]]; then echo "NATS v1 running after deployment. Fail" exit 1 else echo "No NATS v1" fi bosh -d nats ssh -c "ps aux | grep -v grep | grep nats-server" if [[ $? == 0 ]]; then echo "NATS v2 running after deployment." else echo "No NATS v2" exit 1 fi echo "-----> `date`: Done"
true
dfe1a4ca085577791171721d8671aa33be613702
Shell
ISI-apex/hpsc-utils
/make/env.sh
UTF-8
1,229
3.59375
4
[ "BSD-3-Clause" ]
permissive
# Environment settings for working on the HPSC stack with Bash # # May be setup to autoload on shell startup, since it is harmless as far as # pollution that affects non-HPSC tasks. SELF_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)" # On some build hosts, the repository is cloned from a file system path. # In order to allow multiple user to push and pull from that shared remote # clone, the permissions of the files created by git need to be at least # group readable and writable. git() { # execute in a subshell with changed umask (umask g=rwx && command git "$@") } # Make all invocations of make parallel NPROC=$(nproc) if [ "${NPROC}" -ge 8 ] # hack to distinguish a shared server vs local box then NPROC=$((NPROC - 4)) # don't hog all cores on shared servers fi alias make="nice make -j${NPROC}" USER_RC=${SELF_DIR}/.hpscrc if [ -f "${USER_RC}" ] then echo "Loading: ${USER_RC}" source "${USER_RC}" fi SDK_DEP_ENV=${SELF_DIR}/sdk/bld/dep-env.sh if [ -f ${SDK_DEP_ENV} ] then echo "Loading SDK deps: ${SDK_DEP_ENV}" source ${SDK_DEP_ENV} fi SDK_ENV=${SELF_DIR}/sdk/bld/env.sh if [ -f ${SDK_ENV} ] then echo "Loading SDK: ${SDK_ENV}" source ${SDK_ENV} fi
true
5e065e434f48b83afc91b686b933491689efccbc
Shell
nogproject/nog
/tools/bin/make-deb
UTF-8
5,636
3.640625
4
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
#!/bin/bash # vim: sw=4 set -o errexit -o nounset -o pipefail -o noglob # `products` will be filled in `debX()`. declare -a products main() { if ! [ -d '/go' ]; then die 'Must be run in a godev container.' fi mkdir -p 'product/deb' deb nog-app-2 installNogApp2 deb nogfsoregd installNogfsoregd deb nogfsoctl installNogfsoctl deb git-fso installGitFso deb tartt installTartt deb nogfsostad installNogfsostad deb nogfsoschd installNogfsoschd deb nogfsotard installNogfsotard deb nogfsotarsecbakd installNogfsotarsecbakd deb tar-incremental-mtime installTarIncrementalMtime deb nogfsosdwbakd3 installNogfsosdwbakd3 deb nogfsorstd installNogfsorstd deb nogfsodomd installNogfsodomd echo ' SUMMARY deb' echo echo 'Debs:' printf '%s\n' "${products[@]}" echo echo ' DONE' } deb() { name="$1" installVroot="$2" src="deb/${name}" package="$(grep '^Package:' "${src}/control" | cut -d : -f 2 | tr -d ' ')" arch="$(grep '^Architecture:' "${src}/control" | cut -d : -f 2 | tr -d ' ')" version="$(grep "^${name}:" versions.yml | cut -d : -f 2 | tr -d ' ')" case ${version} in *-*) version="$(tr '-' '~' <<<"${version}")+${BUILD_TAG:-unspecified-build-tag}" ;; esac deb="product/deb/${package}_${version}_${arch}.deb" products+=( "${deb}" ) echo " DPKG-DEB ${deb}" if [ -e "${deb}" ]; then echo 'Already up to date.' return fi vroot=$(mktemp -d /tmp/make-deb-XXXXX) trap "rm -rf '${vroot}'" EXIT debian="${vroot}/DEBIAN" install -m 0755 -d "${debian}" sed <"${src}/control" \ -e "s/{{ *version *}}/${version}/" \ | install -m 0644 /dev/stdin "${debian}/control" for script in postinst; do if [ -e "${src}/${script}" ]; then install -m 0755 "${src}/${script}" "${debian}/${script}" fi done for other in templates; do if [ -e "${src}/${other}" ]; then install -m 0644 "${src}/${other}" "${debian}/${other}" fi done ${installVroot} dpkg-deb --build "${vroot}" "${deb}" rm -r "${vroot}" trap - EXIT } installNogApp2() { lib="${vroot}/usr/lib/nog-app-2" install -m 0755 -d "${lib}" install -m 0644 'product/nog-app-2.tar.gz' "${lib}/nog-app-2.tar.gz" # Install the example in `lib` instead of `doc`, so that `postinst` works # with dpkg path patterns that exclude doc. install -m 0644 "${src}/example.nogenv.sh" "${lib}/example.nogenv.sh" bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 "${src}/nogapp2" "${bin}/nogapp2" } installNogfsoregd() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/nogfsoregd' "${bin}/nogfsoregd" } installNogfsoctl() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/nogfsoctl' "${bin}/nogfsoctl" } installGitFso() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/git-fso' "${bin}/git-fso" } installTartt() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" for f in \ tartt \ tartt-store \ tartt-is-dir \ ; do install -m 0755 "product/bin/${f}" "${bin}/${f}" done } installNogfsostad() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" for f in \ nogfsostad \ nogfsostasududod \ nogfsostaudod-fd \ nogfsostasuod-fd \ nogfsostasvsd \ ; do install -m 0755 "product/bin/${f}" "${bin}/${f}" done } installNogfsoschd() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/nogfsoschd' "${bin}/nogfsoschd" } installNogfsotard() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" for f in \ git-receive-pack-get-owner \ git-receive-pack-sudo-owner \ nogfsotard \ nogfsotargctd \ ; do install -m 0755 "product/bin/${f}" "${bin}/${f}" done lib="${vroot}/usr/lib/nogfsotard" install -m 0755 -d "${lib}" for f in \ git-archive-branch-dir \ git-for-each-ref-dir \ git-is-immutable-fso-stat-dir \ git-is-newer-branch-dir-duration \ git-rev-parse-branch-dir \ git-rev-parse-is-valid-branch-dir \ stat-dir-owner \ ; do install -m 0755 "product/bin/${f}" "${lib}/${f}" done } installNogfsotarsecbakd() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/nogfsotarsecbakd' "${bin}/nogfsotarsecbakd" } installTarIncrementalMtime() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/tar-incremental-mtime' "${bin}/tar-incremental-mtime" } installNogfsosdwbakd3() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" for f in \ nogfsosdwbakd3 \ ; do install -m 0755 "product/bin/${f}" "${bin}/${f}" done lib="${vroot}/usr/lib/nogfsosdwbakd3" install -m 0755 -d "${lib}" for f in \ git-for-each-ref-dir \ stat-dir-owner \ ; do install -m 0755 "product/bin/${f}" "${lib}/${f}" done } installNogfsorstd() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/nogfsorstd' "${bin}/nogfsorstd" } installNogfsodomd() { bin="${vroot}/usr/bin" install -m 0755 -d "${bin}" install -m 0755 'product/bin/nogfsodomd' "${bin}/nogfsodomd" } die() { echo >&2 "fatal: $*" exit 1 } main "$@"
true
48081826066f3437ef557540a95a2ba0b4221733
Shell
akora/vagrant-contenta-installer
/install-mysql-apache-php72.sh
UTF-8
1,860
3.375
3
[ "MIT" ]
permissive
#!/usr/bin/env bash MySQL_config_file="/etc/mysql/my.cnf" echo "=== Installing MySQL server and setting root password..." debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' apt-get install -y mysql-client mysql-server echo "=== Fixing warnings about changed setting names in $MySQL_config_file..." if grep -Fxq "key_buffer_size" $MySQL_config_file then echo "=== key_buffer_size found, nothing to do..." else echo "=== key_buffer_size..." sed -i 's/key_buffer/key_buffer_size/g' $MySQL_config_file fi if grep -Fxq "myisam-recover-options" $MySQL_config_file then echo "=== myisam-recover-options found, nothing to do..." else echo "=== myisam-recover-options..." sed -i 's/myisam-recover/myisam-recover-options/g' $MySQL_config_file fi echo "=== Allowing remote management of MySQL server..." if grep -Fxq "0.0.0.0" $MySQL_config_file then echo "=== 0.0.0.0 found, nothing to do..." else echo "=== 0.0.0.0..." sed -i 's/127.0.0.1/0.0.0.0/g' $MySQL_config_file fi mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'root';" mysql -uroot -proot -e "FLUSH PRIVILEGES;" echo "=== Restarting service for changes to take effect..." service mysql restart echo "=== Installing Apache & PHP 7.2..." add-apt-repository ppa:ondrej/php -y apt-get update apt-get install -y apache2 php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-gd php7.2-curl php7.2-mbstring php7.2-xml php-uploadprogress echo "=== Enabling mod_rewrite & clean URLs..." a2enmod rewrite sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf echo "=== Restarting service & removing default index.html..." service apache2 restart rm /var/www/html/index.html exit 0
true
9b92425a9bb08239907daf9603f30089dfa58cb4
Shell
wonkiChoi/addb
/bin/addb_RR
UTF-8
10,487
3.75
4
[ "Apache-2.0" ]
permissive
#!/bin/bash . ${ADDB_HOME}/addb_RR_conf ## arg1: Option name ## arg2: GREP1 ## arg3: value function SetConfiguration_Grep1() { OPTIONNAME=$1 GREP1=$2 VALUE=$3 for port in ${PORT_LIST[@]} do grep_result=$(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "${GREP1}" ) sed -i".old" "s/${grep_result}/${OPTIONNAME} ${VALUE}/" "${CONF_DIR}/${CONF_PREFIX}_${port}.conf" if [ $? -ne 0 ]; then echo "[ERROR] Cannot overwrite configuration file..." exit 1 fi done echo "Setting is done!" echo "Finally, check ${OPTIONNAME}" for port in ${PORT_LIST[@]} do echo "[${CONF_PREFIX}_${port}.conf]" echo $(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "$GREP1" ) done } ## arg1: Option name ## arg2: GREP1 ## arg3: GREP2 ## arg4: GREP3 ## arg5: value function SetConfiguration_Grep3() { OPTIONNAME=$1 GREP1=$2 GREP2=$3 GREP3=$4 VALUE=$5 for port in ${PORT_LIST[@]} do grep_result=$(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "$GREP1"| grep -v "$GREP2" | grep -v "$GREP3" ) sed -i".old" "s/${grep_result}/${OPTIONNAME} ${VALUE}/" "${CONF_DIR}/${CONF_PREFIX}_${port}.conf" if [ $? -ne 0 ]; then echo "[ERROR] Cannot overwrite configuration file..." exit 1 fi done echo "Setting is done!" echo "Finally, check ${OPTIONNAME}" for port in ${PORT_LIST[@]} do echo "[${CONF_PREFIX}_${port}.conf]" echo $(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "${GREP1}" | grep -v "${GREP2}" | grep -v "${GREP3}" ) done } # -AOF ## arg1: yes | no function Set_AOF() { if [ -z "$1" ]; then echo -e "\nPlease enter [yes | no]" echo "Ex) addb_RR -AOF yes" exit 1; else echo -e "\n## ADDB Redis - Set AOF" SetConfiguration_Grep3 "appendonly" "appendonly" "#" "appendfilename" $1 fi } # -CV ## arg1: column vector size function Set_CV() { if [ -z "$1" ]; then echo -e "\nPlease enter columnvector_size" echo "Ex) addb_RR -CV 250" exit 1; else echo -e "\n## ADDB Redis - Set Column-vector size" SetConfiguration_Grep1 "columnvector_size" "columnvector_size" $1 fi } # -offCV function Off_CV() { GREP=columnvector_size echo -e "\n## ADDB Redis - Off columnvector_size option " for port in ${PORT_LIST[@]} do grep_result=$(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "${GREP}" ) sed -i".old" "s/${grep_result}/#${grep_result}/" "${CONF_DIR}/${CONF_PREFIX}_${port}.conf" if [ $? -ne 0 ]; then echo "[ERROR] Cannot overwrite configuration file..." exit 1 fi done echo "Setting is done!" echo "Finally, check ${OPTIONNAME}" for port in ${PORT_LIST[@]} do echo "[${CONF_PREFIX}_${port}.conf]" echo $(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "${GREP}" ) done } # -IP function Set_IP() { echo -e "\n## ADDB Redis - Set BindIP option " for port in ${PORT_LIST[@]} do grep_result=$(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "bind " | grep -v "#" ) sed -i".old" "s/${grep_result}/bind ${IP}/" "${CONF_DIR}/${CONF_PREFIX}_${port}.conf" if [ $? -ne 0 ]; then echo "[ERROR] Cannot overwrite configuration file..." exit 1 fi done echo "Setting is done!" echo "Finally, check ${OPTIONNAME}" for port in ${PORT_LIST[@]} do echo "[${CONF_PREFIX}_${port}.conf]" echo $(cat ${CONF_DIR}/${CONF_PREFIX}_${port}.conf | grep "bind " | grep -v "#" ) done } # -loglevel ## arg1: log level (notice verbose debug warning) function Set_loglevel() { if [ -z "$1" ]; then echo -e "\nPlease enter log level [notice|verbose|debug|warning]" echo "Ex) addb_RR -loglevel debug" exit 1; else echo -e "\n## ADDB Redis - Set log level " SetConfiguration_Grep1 "loglevel" "loglevel" $1 fi } # -maxmemory ## arg1: max memory function Set_memory() { if [ -z "$1" ]; then echo -e "\nPlease enter max memory" echo "Ex) addb_RR -memory 5GB" exit 1; else echo -e "\n## ADDB Redis - Set max memory " SetConfiguration_Grep3 "maxmemory" "maxmemory" "#" "policy" $1 fi } # -rewrite ## arg1: rewrite [yes|no] function Set_rewrite() { if [ -z "$1" ]; then echo -e "\nPlease enter [yes | no]" echo "Ex) addb_RR -rewrite yes" exit 1; else echo -e "\n## ADDB Redis - Set rewrite option " SetConfiguration_Grep1 "no-appendfsync-on-rewrite" "no-appendfsync-on-rewrite" $1 fi } # -RG ## arg1: rowgroup_size function Set_RG() { if [ -z "$1" ]; then echo -e "\nPlease enter row group size" echo "Ex) addb_RR -RG 500" exit 1; else echo -e "\n## ADDB Redis - Set row group size " SetConfiguration_Grep1 "rowgroup_size" "rowgroup_size" $1 fi } # -ziplist ## arg1: ziplist entries function Set_ziplist() { if [ -z "$1" ]; then echo -e "\nPlease enter hash-max-ziplist-entries" echo "Ex) addb_RR -ziplist 100000" exit 1; else echo -e "\n## ADDB Redis - Set hash-max-ziplist-entries " SetConfiguration_Grep1 "hash-max-ziplist-entries" "hash-max-ziplist-entries" $1 fi } # -init function InitDirectory() { echo -e "\n## ADDB Redis - Initilize directory" mkdir -p ${CONF_DIR} echo "mkdir -p ${CONF_DIR}" for i in ${NODE_LIST[@]} do echo "touch ${CONF_DIR}/nodes${i}.conf" touch ${CONF_DIR}/nodes${i}.conf done mkdir -p ${LOG_DIR} echo "mkdir -p ${LOG_DIR}" mkdir -p ${RUN_DIR} echo "mkdir -p ${RUN_DIR}" for port in ${PORT_LIST_1[@]} do mkdir -p ${DATA_DIR_1}/${port} echo "mkdir -p ${DATA_DIR_1}/${port}" done for port in ${PORT_LIST_2[@]} do mkdir -p ${DATA_DIR_2}/${port}; echo "mkdir -p ${DATA_DIR_2}/${port}" done } # -run function RunServer() { echo -e "\n## ADDB Redis - Run redis-server" source ~/.bashrc cd ${ADDB_HOME} for port in ${PORT_LIST[@]} do echo "Run [${port}]" ./src/${REDIS_SERVER} ${CONF_DIR}/${CONF_PREFIX}_${port}.conf done sleep 5 CheckServer } # -check function CheckServer() { echo -e "\n## ADDB Redis - Check redis-server\n" ps -ef | grep ${REDIS_SERVER} } # -watch function WatchServer() { echo -e "\n## ADDB Redis - Watch redis-server\n" cd ${ADDB_HOME} content="" for port in ${PORT_LIST_1[@]} do content+=" du -h ${DATA_DIR_1}/${port}/${ROCKSDB_DATA_DIR};" done for port in ${PORT_LIST_2[@]} do content+=" du -h ${DATA_DIR_2}/${port}/${ROCKSDB_DATA_DIR};" done #content+="./scripts/clusterCommand8.sh dbsize" content+="addb_RR -command dbsize" watch -d -n 1 "${content}" } # -kill function KillServer() { echo -e "\n## ADDB Redis - Kill redis-server\n" RESULT=$(ps -ef | grep ${REDIS_SERVER} | tr -s ' ' | cut -d ' ' -f 2) for port in ${RESULT[@]}; do sudo kill -9 $port done echo $(ps -ef | grep ${REDIS_SERVER}) } # -clean function CleanData() { echo -e "\n## ADDB Redis - Clean redis data\n" for port in ${PORT_LIST_1[@]} do echo "rm -r ${DATA_DIR_1}/${port}/*" rm -r ${DATA_DIR_1}/${port}/* done for port in ${PORT_LIST_2[@]} do echo "rm -r ${DATA_DIR_2}/${port}/*" rm -r ${DATA_DIR_2}/${port}/* done } # -create function CreateCluster() { echo -e "\n## ADDB Redis - Create cluster" command="ruby ${ADDB_HOME}/src/redis-trib.rb create" for host in ${HOST_IP_LIST[@]} do for port in ${PORT_LIST[@]} do command="${command} ${host}:${port}" done done eval $command } # -command # arg1-arg3 function ClusterCommand() { echo -e "\n## ADDB Redis - Execute command for each redis instance" echo "Run $1 $2 $3" for port in ${PORT_LIST[@]} do echo "[${port}]" ./src/redis-cli -c -p ${port} -h ${IP} $1 $2 $3 done } # -reset function ResetCluster() { echo -e "\n## ADDB Redis - Reset cluster" ClusterCommand cluster reset hard } # -reset function ClusterInfo() { echo -e "\n## ADDB Redis - show cluster info" ClusterCommand cluster info } # Helper function Helper() { echo -e "\n## ADDB Redis Controller Helper " echo -e "\nusage: addb_RR [ -help ] # Configuration [ -AOF <yes | no> ] := on/off AppendOnlyFile persistent method [ -CV <columnvector_size ] := set columnvector_size [ -offCV ] := off columnvector option [ -IP ] := set BindIP based on current system [ -loglevel <notice | verbose | debug | warning> ] := set loglevel on Redis [ -memory <maxmemory> ] := set maxmemory. should contain degree such as MB, GB [ -rewrite <yes | no> ] := on/off rewrite method [ -RG <rowgroup_size> ] := set rowgroup_size [ -ziplist <hash-max-ziplist-entries> ] := set max ziplist entries # Redis-server [ -init ] := initialize directories for running redis [ -run ] := run each redis instance with configuration file [ -check ] := check redis server [ -watch ] := watch status of redis server and RocksDB directory [ -kill ] := kill all redis server [ -clean ] := clean data directories for Redis and RocksDB # Cluster [ -create ] := create redis cluster [ -reset ] := reset redis cluster [ -command ] := execute command for each redis instance [ -info ] := show cluster information by 'cluster info' command " } # main function ## arg0: options ## arg[1-2]: parameters about corresponding option function main() { case $1 in h|help|-h|-help|--h|--help) Helper ;; -AOF) Set_AOF $2 ;; -CV) Set_CV $2 ;; -offCV) Off_CV ;; -IP) Set_IP ;; -loglevel) Set_loglevel $2 ;; -memory) Set_memory $2 ;; -rewrite) Set_rewrite $2 ;; -RG) Set_RG $2 ;; -ziplist) Set_ziplist $2 ;; -init) InitDirectory ;; -run) RunServer ;; -check) CheckServer ;; -watch) WatchServer ;; -kill) KillServer ;; -clean) CleanData ;; -create) CreateCluster ;; -command) ClusterCommand $2 $3 $4 ;; -reset) ResetCluster ;; -info) ClusterInfo ;; *) echo -e "\n# ADDB Redis Controller " echo "[Invalid argument error]" echo "Please enter correct option name with parameters" echo -e "\nusage: addb_spark [ -help ] # Configuration [ -AOF <yes | no> ] [ -CV <columnvector_size> ] [ -offCV ] [ -IP ] [ -loglevel <notice | verbose | debug | warning> ] [ -memory <maxmemory> ] [ -rewrite <yes | no>] [ -RG <rowgroup_size>] [ -ziplist <hash-max-ziplist-entries>] # Redis-server [ -init ] [ -run ] [ -check ] [ -watch ] [ -kill ] [ -clean ] # Cluster [ -create ] [ -reset ] [ -command ] [ -info ] " ;; esac } main $1 $2 $3 $4
true
94c2e3c95fda1a09b164a94ff44a863be21e95ec
Shell
crteal/zot-world
/provision.sh
UTF-8
1,899
2.671875
3
[]
no_license
#!/usr/bin/env bash RABBITMQ_USER=$(uuidgen) RABBITMQ_PASSWORD=$(uuidgen) POSTGRES_PASSWORD=$(uuidgen) add-apt-repository ppa:git-core/ppa add-apt-repository ppa:openjdk-r/ppa add-apt-repository ppa:chris-lea/redis-server echo 'deb http://www.rabbitmq.com/debian/ testing main' | tee /etc/apt/sources.list.d/rabbitmq.list wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - f apt-get update apt-get install -y build-essential nodejs openjdk-8-jdk postgresql-9.6 rabbitmq-server redis-server wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh rabbitmqctl add_user "$RABBITMQ_USER" "$RABBITMQ_PASSWORD" rabbitmqctl set_user_tags "$RABBITMQ_USER" administrator rabbitmqctl set_permissions -p / "$RABBITMQ_USER" ".*" ".*" ".*" rabbitmq-plugins enable rabbitmq_management sudo -u postgres psql -c "ALTER USER postgres PASSWORD '$POSTGRES_PASSWORD';" sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/9.6/main/postgresql.conf echo "host all all all md5" >> /etc/postgresql/9.6/main/pg_hba.conf service postgresql restart sed -e 's/^bind 127.0.0.1/bind 0.0.0.0/' -i /etc/redis/redis.conf cat >> /etc/environment <<EOF DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@localhost:5432/zot_world RABBITMQ_BIGWIG_RX_URL=amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@localhost RABBITMQ_BIGWIG_TX_URL=amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@localhost EOF cd /usr/local/bin wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein chmod a+x lein runuser -l vagrant -c "lein"
true
c43e2ced24ded4b80d12c25f2818caa91fe240b5
Shell
grabbitnu/spectral-petsc
/tests.sh
UTF-8
455
2.890625
3
[]
no_license
#!/bin/sh inc=$1 test_range () { cos_scale=$1; echo 'cos_scale = ' $cos_scale for n in $(seq $2 $3 $4); do printf "%3d: " $n ./elliptic -dim $n,$n -exact 0 -cos_scale $cos_scale -gamma 4 -ksp_rtol 1e-12 -snes_rtol 1e-12 | grep 'Norm of error' #./elliptic -dim $n,$n -exact 0 -cos_scale $cos_scale -gamma 4 -snes_max_it 1 -ksp_type preonly -pc_type lu # | grep 'Norm of error' done } test_range 3 4 $inc 44 test_range "2.8" 4 $inc 44
true
5094fd1867da972a743dae9dc5355e91b574669e
Shell
bsb808/linux_setup
/mrc/all_ros_remote.sh
UTF-8
396
2.546875
3
[]
no_license
#!/bin/bash for N in $(seq 0 7) #for N in $(seq 5 5) do IP="192.168.11.6${N}" ROS_MASTER_URI="http://${IP}:11311" echo "--------" echo ${IP} #rosnode list #rostopic list rostopic echo -n 1 /my_p3at/battery_voltage # Don't seem to be published #rostopic echo -n 1 /my_p3at/battery_state_of_charge #rostopic echo -n 1 /my_p3at/battery_recharge_state done
true
79477ba17dd41f96b1c5763131f757e2a48fd09e
Shell
omsgunjal2003/bash2cpp
/tests/hostname0.sh
UTF-8
162
3.140625
3
[ "MIT" ]
permissive
HOSTNAME=$(/bin/hostname) if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then hostname localhost fi
true
e44d06ffed9131b087e2bb475e83ccfaec7732e1
Shell
abhinavdahiya/bootkube
/hack/terraform-quickstart/start-cluster.sh
UTF-8
585
2.8125
3
[ "Apache-2.0" ]
permissive
#!/bin/bash set -euo pipefail export BOOTSTRAP_IP=`terraform output bootstrap_node_ip` export WORKER_IPS=`terraform output -json worker_ips | jq -r '.value[]'` export MASTER_IPS=`terraform output -json master_ips | jq -r '.value[]'` export SELF_HOST_ETCD=`terraform output self_host_etcd` export SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" cd ../quickstart ./init-master.sh $BOOTSTRAP_IP for IP in $WORKER_IPS do ./init-node.sh $IP cluster/auth/kubeconfig done for IP in $MASTER_IPS do TAG_MASTER=true ./init-node.sh $IP cluster/auth/kubeconfig done
true
93901d898e3820885bcc8b292107c874e0a2e4f3
Shell
shinjiescorido/games
/test.sh
UTF-8
1,455
3.171875
3
[]
no_license
#!/bin/bash # Functions ok() { echo -e '\e[32m'$1'\e[m'; } # Green EXPECTED_ARGS=0 E_BADARGS=65 #MYSQL=`mysql` VUSER="webuser" VUPASS="webuser1@" Q1="SET NAMES utf8;SET SQL_MODE='';SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;CREATE DATABASE IF NOT EXISTS bc DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" Q2="GRANT ALL ON *.* TO '${VUSER}'@'localhost' IDENTIFIED BY '${VUUPASS}';" Q3="FLUSH PRIVILEGES;" T1="CREATE TABLE action_logs (" T2="user_id int(10) unsigned NOT NULL," T3="table_id int(10) unsigned NOT NULL," T4="round_num int(10) unsigned NOT NULL," T5="type enum('r','b','s','i','f','m') COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'r: Regular, b: Bonus, s: Super 6, i: Insurance, f: flippy'," T6="actions json DEFAULT NULL," T7="ip varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL," T8="created_at datetime DEFAULT NULL," T9="PRIMARY KEY (user_id,table_id,round_num)" T11=") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;" Q4="USE bc;${T1}${T2}${T3}${T4}${T5}${T6}${T7}${T8}${T9}${T11}" SQL="${Q1}${Q2}${Q3}${Q4}" if [ $# -ne $EXPECTED_ARGS ] then echo "Usage: $0 dbname dbuser dbpass" exit $E_BADARGS fi /etc/init.d/mysql start mysql -uroot -pbfd3v3l0p3r1@ -e "$SQL" ok "Database and user created with a password "
true
23cc6f4ef16d2b0e6646f3b6786af35b9a72a1ef
Shell
eljuanchosf/terraform-aws-bosh-lite-cf-bootstrap
/shape.sh
UTF-8
2,448
4.28125
4
[ "Apache-2.0" ]
permissive
#!/bin/bash set -e SSH_CONFIG_FILE=~/.ssh/config ADD_TO_SSH_CONFIG=false MYSQL=false LOGSEARCH=false FORCE=false PREFIX="" until [[ $PREFIX =~ ^[A-Za-z_]+$ ]]; do PREFIX=$(shuf -n 1 /usr/share/dict/words) # This line gets a random word from dictionary done TERRAFORM_COMMAND=$1 shift if [[ $TERRAFORM_COMMAND = "help" ]]; then cat <<EOL Usage: ./shape.sh command -p=[prefix] --add-jumpbox --mysql --logsearch command: any Terraform command -p (or --prefix): the prefix for the infrastructure names. --add-jumpbox: once the deploy is done, this flag will add the jumpbox SSH configuration to the SSH config file. --mysql - NOT IMPLEMENTED -: deploys also the MySQL BOSH Release --logsearch - NOT IMPLEMENTED -: deploys also the ELK BOSH Releases EOL fi for i in "$@" do case $i in -p=*|--prefix=*) PREFIX="${i#*=}" shift # past argument=value ;; --force) FORCE=true shift ;; --add-jumpbox) ADD_TO_SSH_CONFIG=true shift ;; --mysql) MYSQL=true shift ;; --logsearch) LOGSEARCH=true shift ;; *) # unknown option ;; esac done if [[ $TERRAFORM_COMMAND = "apply" ]]; then echo You will be deploying Bosh Lite/CF with the following config: echo ------------------------------------------------------------- echo -e "AWS Resource Prefix: \e[32m${PREFIX}\e[0m" echo -e "Add Jumpbox to $SSH_CONFIG_FILE: \e[31m${ADD_TO_SSH_CONFIG}\e[0m" echo -e "Deploy MySQL BOSH Release: \e[31m${MYSQL}\e[0m" echo -e "Deploy Logsearch BOSH Release: \e[31m${LOGSEARCH}\e[0m" if [[ $FORCE = false ]]; then echo read -p "Are you sure? (Y/n) " -n 1 -r if [[ ! $REPLY =~ ^[Yy]$ ]] then echo exit 1 fi fi fi export TF_VAR_prefix="${PREFIX}" terraform $TERRAFORM_COMMAND if [[ $TERRAFORM_COMMAND = "apply" ]]; then JUMPBOX_IP=$(terraform output jumpbox_ip) KEY_PATH=$(terraform output aws_key_path) if [[ $ADD_TO_SSH_CONFIG = true ]]; then cat >> $SSH_CONFIG_FILE <<EOL Host ${PREFIX}_jumpbox User ubuntu HostName ${JUMPBOX_IP} Port 22 IdentityFile ${KEY_PATH} EOL echo -e "\nYou can access the jumpbox by doing: \e[97mssh ${PREFIX}_jumpbox\e[0m\n" else echo -e "\nYou can access the jumpbox by doing: \e[97mssh -i ${KEY_PATH} ubuntu@${JUMPBOX_IP}\e[0m\n" fi elif [[ $TERRAFORM_COMMAND = "destroy" ]]; then sed -i -e "/Host ${PREFIX}_jumpbox/,+5d" $SSH_CONFIG_FILE fi
true
cbd8f05a3c2dbd313c9e2f7546597b69bc75aa84
Shell
patagonaa/wx-ground-station
/process_satellite.sh
UTF-8
2,169
3.125
3
[ "MIT" ]
permissive
#!/bin/bash FILEKEY=$1 START_TIME=$2 END_TIME=$3 SAT=$4 ELEVATION=$5 TLE_FILE=$6 source ./config.env IMAGE_DIR=${OUT_DIR}/images META_DIR=${OUT_DIR}/meta AUDIO_DIR=${OUT_DIR}/audio LOG_DIR=${OUT_DIR}/logs AUDIO_FILE=${AUDIO_DIR}/${FILEKEY}.wav MAP_FILE=${IMAGE_DIR}/${FILEKEY}-map.png METAFILE=${META_DIR}/${FILEKEY}.txt LOGFILE=${LOG_DIR}/${FILEKEY}.log mkdir -p $LOG_DIR mkdir -p $IMAGE_DIR mkdir -p $META_DIR echo $@ >> $LOGFILE PassStart=`expr $START_TIME + 90` echo wxmap -T "${SAT}" -H $TLE_FILE -p 0 -l 0 -o $PassStart ${MAP_FILE} >> $LOGFILE 2>&1 wxmap -T "${SAT}" -H $TLE_FILE -p 0 -l 0 -o $PassStart ${MAP_FILE} >> $LOGFILE 2>&1 echo RAW >> $LOGFILE wxtoimg -m ${MAP_FILE} $WXTOIMG_ARGS -p $AUDIO_FILE ${IMAGE_DIR}/${FILEKEY}-RAW.png >> $LOGFILE 2>&1 parallel -k "echo {}; wxtoimg -m ${MAP_FILE} $WXTOIMG_ARGS -e {} $AUDIO_FILE ${IMAGE_DIR}/${FILEKEY}-{}.png 2>&1" ::: ZA NO MSA MCIR THERM >> $LOGFILE 2>&1 echo Projections >> $LOGFILE wxproj -b $PROJECTION_BOUNDS -p mercator ${IMAGE_DIR}/${FILEKEY}-MSA.png ${IMAGE_DIR}/${FILEKEY}-MSA-merc.png >> $LOGFILE 2>&1 & wxproj -b $PROJECTION_BOUNDS -p stereographic ${IMAGE_DIR}/${FILEKEY}-MSA.png ${IMAGE_DIR}/${FILEKEY}-MSA-stereo.png >> $LOGFILE 2>&1 & wxproj -b $PROJECTION_BOUNDS -p mercator ${IMAGE_DIR}/${FILEKEY}-THERM.png ${IMAGE_DIR}/${FILEKEY}-THERM-merc.png >> $LOGFILE 2>&1 & wxproj -b $PROJECTION_BOUNDS -p stereographic ${IMAGE_DIR}/${FILEKEY}-THERM.png ${IMAGE_DIR}/${FILEKEY}-THERM-stereo.png >> $LOGFILE 2>&1 & wait find ${IMAGE_DIR} -name '*.png' -size 0 | xargs rm echo Meta File >> $LOGFILE TLE1=`grep "$SAT" $TLE_FILE -A 2 | tail -2 | head -1 | tr -d '\r'` TLE2=`grep "$SAT" $TLE_FILE -A 2 | tail -2 | tail -1 | tr -d '\r'` GAIN=`grep Gain $LOGFILE | head -1` CHAN_A=`grep "Channel A" $LOGFILE | head -1` CHAN_B=`grep "Channel B" $LOGFILE | head -1` echo START_TIME=$START_TIME > $METAFILE echo END_TIME=$END_TIME >> $METAFILE echo RECORD_END_TIME=`date -r $AUDIO_FILE +%s` >> $METAFILE echo TLE1=$TLE1 >> $METAFILE echo TLE2=$TLE2 >> $METAFILE echo GAIN=$GAIN >> $METAFILE echo CHAN_A=$CHAN_A >> $METAFILE echo CHAN_B=$CHAN_B >> $METAFILE echo MAXELEV=$ELEVATION >> $METAFILE
true
65d0334c483ce8ae282764ea5f1a909fff68bcb5
Shell
griffinbird/azure-container-labs
/scripts/create-subnet-virtual-node.sh
UTF-8
1,064
3.1875
3
[ "MIT" ]
permissive
#!/usr/bin/env bash ################################################################ # Parameters ################################################################ RESOURCE_GROUP="<Reousrce Group Name>" CLUSTER_NAME="<AKS Cluster Name>" # Service Principal SP_CLIENT_ID="<Service Principal Client ID>" # VNET Info VNET_NAME="<Virtual Network Name>" SUBNET_VIRTUAL_NODE="<Subname name for AKS>" ################################################################ # Script Start ################################################################ echo "Create Subnet for Virtual Nodes" az network vnet subnet create \ --resource-group $RESOURCE_GROUP \ --vnet-name $VNET_NAME \ --name $SUBNET_VIRTUAL_NODE \ --address-prefix 10.241.0.0/16 echo "Get the virtual network resource ID" VNET_ID=$(az network vnet show --resource-group $RESOURCE_GROUP --name $VNET_NAME --query id -o tsv) echo "To grant the correct access for the AKS cluster to use the virtual network" az role assignment create --assignee $SP_CLIENT_ID --scope $VNET_ID --role Contributor
true
1d5b18fd7657a60ad8aacf86fcfca1ef1dbd376c
Shell
CraigStThomas/SEIS_764_Project
/images/compress.sh
UTF-8
1,981
2.78125
3
[]
no_license
#!/bin/bash shopt -s globstar for file in ./A01/**; do if [[ -f "$file" ]]; then dirname="${file%/*}/" basename="${file:${#dirname}}" n=$(printf %03d "$basename" | cut -d '_' -f 1) convert 'A01/'$basename -resize 120 'A01/'$n'_compressed.png' fi done mkdir A01_compressed mv A01/*_compressed.png A01_compressed/ for file in ./A02/**; do if [[ -f "$file" ]]; then dirname="${file%/*}/" basename="${file:${#dirname}}" n=$(printf %03d "$basename" | cut -d '_' -f 1) convert 'A02/'$basename -resize 120 'A02/'$n'_compressed.png' fi done mkdir A02_compressed mv A02/*_compressed.png A02_compressed/ for file in ./A03/**; do if [[ -f "$file" ]]; then dirname="${file%/*}/" basename="${file:${#dirname}}" n=$(printf %03d "$basename" | cut -d '_' -f 1) convert 'A03/'$basename -resize 120 'A03/'$n'_compressed.png' fi done mkdir A03_compressed mv A03/*_compressed.png A03_compressed/ for file in ./A04/**; do if [[ -f "$file" ]]; then dirname="${file%/*}/" basename="${file:${#dirname}}" n=$(printf %03d "$basename" | cut -d '_' -f 1) convert 'A04/'$basename -resize 120 'A04/'$n'_compressed.png' fi done mkdir A04_compressed mv A04/*_compressed.png A04_compressed/ for file in ./A05/**; do if [[ -f "$file" ]]; then dirname="${file%/*}/" basename="${file:${#dirname}}" n=$(printf %03d "$basename" | cut -d '_' -f 1) convert 'A05/'$basename -resize 120 'A05/'$n'_compressed.png' fi done mkdir A05_compressed mv A05/*_compressed.png A05_compressed/ for file in ./A06/**; do if [[ -f "$file" ]]; then dirname="${file%/*}/" basename="${file:${#dirname}}" n=$(printf %03d "$basename" | cut -d '_' -f 1) convert 'A06/'$basename -resize 120 'A06/'$n'_compressed.png' fi done mkdir A06_compressed mv A06/*_compressed.png A06_compressed/
true
4af081882569acc7cc688289afcc30f301140a37
Shell
jester1412/YottaDB
/ydb_utilities_scripts/start_multi_site_replication
UTF-8
1,687
3.4375
3
[]
no_license
#!/bin/bash multi_site_file=${ydb_dir}/gbls/multi-site.repl ROW=`cat ${multi_site_file} | wc -l` . ${ydb_dir}/ydbenv . ${UTIL_DIR}/replication_start for i in $(eval echo {1..$ROW}) do if [[ ! $i -eq 1 ]] then ### Extract Multi-Site Replication data from multi-site.repl HOST=`awk -F "|" 'FNR == '''$i''' {print $1 }' ${multi_site_file}` secondary_ip=`awk -F "|" 'FNR == '''$i''' {print $2 }' ${multi_site_file}` ydb_repl_instname_tmp=`awk -F "|" 'FNR == '''$i''' {print $3 }' ${multi_site_file}` ydb_repl_secondary_instname=`awk -F "|" 'FNR == '''$i''' {print $4 }' ${multi_site_file}` repl_port=`awk -F "|" 'FNR == '''$i''' {print $5 }' ${multi_site_file}` repl_listen_port=`awk -F "|" 'FNR == '''$i''' {print $6 }' ${multi_site_file}` if [[ $MODE == "PRIMARY" ]] then if [[ $ydb_repl_instname_tmp == $ydb_repl_instname ]] then continue else ### Set Replication Secondary Instance Name as Replication Instance Name ### Because In Primary mode Replication Instance Name and Replication Secondary Instance Name are switch ydb_repl_secondary_instname=$ydb_repl_instname_tmp ### The same as Replication port and Replication Listen Port repl_port=$repl_listen_port echo $secondary_ip $ydb_repl_secondary_instname $repl_port echo "Start Replication to ${ydb_repl_secondary_instname}" start_replication_in_primary_mode fi elif [[ $MODE == "SECONDARY" ]] then if [[ ! $ydb_repl_instname_tmp == $ydb_repl_instname ]] then continue else start_replication_in_secondary_mode fi else echo "MODE not Defined !!!" exit 1 fi fi done
true
084220e8f49aa00d6001b3ead5641c04c57a3537
Shell
j842/samba
/assets/usr/local/bin/docker-smb-getshares
UTF-8
219
3.265625
3
[]
no_license
#!/bin/bash cd /etc/samba/dockershareinfo COUNT=$(ls -1 | wc -l) if [ $COUNT -gt 0 ]; then echo "Found ${COUNT} shared folders." >&2 cat * | tr '\n' ' ' exit 0 fi echo "There are no shared folders." >&2 exit 1
true
40af43fabca046263038731938de458b2e631b13
Shell
insperatum/git-working
/g-update
UTF-8
337
3.484375
3
[]
no_license
#!/bin/bash cd `dirname "$0"` git fetch newcommits=`git rev-list HEAD..origin/master --count` if [ "$newcommits" -gt "0" ]; then echo echo "g-working update available:" git log --pretty=oneline HEAD..origin/master | cat read -p "Install? (y/n) " yn case $yn in [Yy]* ) git pull origin master; exit 0 esac fi exit 1
true
283f66a706c14b5f6e40f91f080e1a204b58640f
Shell
flipreverse/piVCCU
/pivccu/host/detect_hardware.inc
UTF-8
4,838
3.34375
3
[ "Apache-2.0", "GPL-2.0-only" ]
permissive
#!/bin/bash . /etc/default/pivccu HMRF_HARDWARE='' HMIP_HARDWARE='' case $PIVCCU_HMRF_MODE in "Fake-HmRF") HMRF_HARDWARE='FAKE_HMRF' if [ -z "$PIVCCU_FAKE_SERIAL" ]; then PIVCCU_FAKE_SERIAL=`shuf -i 1-9999999 -n 1` PIVCCU_FAKE_SERIAL=`printf "FKE%07d" $PIVCCU_FAKE_SERIAL` echo "PIVCCU_FAKE_SERIAL=\"$PIVCCU_FAKE_SERIAL\"" >> /etc/default/pivccu fi if [ -z "$PIVCCU_FAKE_RADIO_MAC" ]; then PIVCCU_FAKE_RADIO_MAC=`shuf -i 1-16777215 -n 1` PIVCCU_FAKE_RADIO_MAC=`printf "0x%06x" $PIVCCU_FAKE_RADIO_MAC` echo "PIVCCU_FAKE_RADIO_MAC=\"$PIVCCU_FAKE_RADIO_MAC\"" >> /etc/default/pivccu fi modprobe -a fake_hmrf &> /dev/null if [ -e /sys/module/fake_hmrf ]; then UART_MAJOR=`cat /sys/devices/virtual/fake-hmrf/fake-hmrf/dev | cut -d: -f1` echo -n "$PIVCCU_FAKE_SERIAL" > /sys/module/fake_hmrf/parameters/board_serial echo -n "$PIVCCU_FAKE_RADIO_MAC" > /sys/module/fake_hmrf/parameters/radio_mac fi BOARD_SERIAL=$PIVCCU_FAKE_SERIAL RADIO_MAC=$PIVCCU_FAKE_RADIO_MAC mount --bind /dev /var/lib/piVCCU/rootfs/dev mount --bind /proc /var/lib/piVCCU/rootfs/proc SGTIN=`chroot /var/lib/piVCCU/rootfs /bin/eq3configcmd update-coprocessor -p /dev/fake-hmrf -t HM-MOD-UART -c -sg 2>&1 | grep "SGTIN:" | cut -d' ' -f5` umount /var/lib/piVCCU/rootfs/dev umount /var/lib/piVCCU/rootfs/proc grep "^CCU2 " /var/lib/piVCCU/rootfs/firmware/fwmap | awk -F ' ' '{print $3}' > /sys/module/fake_hmrf/parameters/firmware_version ;; "HM-MOD-RPI-PCB"|"RPI-RF-MOD"|"") if [ -e /dev/raw-uart ]; then UART_MAJOR=`cat /sys/devices/virtual/raw-uart/raw-uart/dev | cut -d: -f1` mount --bind /dev /var/lib/piVCCU/rootfs/dev mount --bind /proc /var/lib/piVCCU/rootfs/proc RADIO_MAC=`chroot /var/lib/piVCCU/rootfs /bin/eq3configcmd read-default-rf-address -f /dev/raw-uart -h 2>&1 | grep "^0x"` || true if [ -z "$RADIO_MAC" ] || [ "$RADIO_MAC" == "0x00ffff" ] || [ "$RADIO_MAC" == "0xa9ffff" ]; then RF_RPI_MOD_INFO=`timeout 20 chroot /var/lib/piVCCU/rootfs /opt/jre/bin/java -Dgnu.io.rxtx.SerialPorts=/dev/raw-uart -jar /opt/HmIP/hmip-copro-update.jar -p /dev/raw-uart -v -a 2>&1` || true RADIO_MAC=`echo "$RF_RPI_MOD_INFO" | sed -n 's/.*Radio address = \([0-9A-Fa-f]\{6\}\).*/0x\1/p'` SGTIN=`echo "$RF_RPI_MOD_INFO" | sed -n 's/.*SGTIN = \([0-9A-Fa-f]\{24\}\).*/\1/p'` if [ ! -z "$RADIO_MAC" ] || [ ! -z "$SGTIN" ]; then HMRF_HARDWARE='RPI-RF-MOD' BOARD_SERIAL=`echo -n "$SGTIN" | tail -c 10` fi else HMRF_HARDWARE='HM-MOD-RPI-PCB' SGTIN=`chroot /var/lib/piVCCU/rootfs /bin/eq3configcmd update-coprocessor -p /dev/raw-uart -t HM-MOD-UART -c -sg 2>&1 | grep "SGTIN:" | cut -d' ' -f5` BOARD_SERIAL=`chroot /var/lib/piVCCU/rootfs /bin/eq3configcmd update-coprocessor -p /dev/raw-uart -t HM-MOD-UART -c -se 2>&1 | grep "SerialNumber:" | cut -d' ' -f5` fi umount /var/lib/piVCCU/rootfs/dev umount /var/lib/piVCCU/rootfs/proc fi ;; esac if [ -e /sys/devices/virtual/eq3loop ]; then EQ3LOOP_MAJOR=`cat /sys/devices/virtual/eq3loop/eq3loop/dev | cut -d: -f1` fi case $PIVCCU_HMIP_MODE in "Multimacd"|"") HMIP_MAJOR=$EQ3LOOP_MAJOR HMIP_MINOR=1 HMIP_HARDWARE=$HMRF_HARDWARE ;; "HmIP-RFUSB") modprobe -a cp210x &> /dev/null if [ `grep -c "1b1f c020" /sys/bus/usb-serial/drivers/cp210x/new_id` -eq 0 ]; then echo "1b1f c020" > /sys/bus/usb-serial/drivers/cp210x/new_id fi for syspath in $(find /sys/bus/usb/devices/usb*/ -name ttyUSB*); do if [ -e $syspath/dev ]; then eval "$(udevadm info -q property --export -p $syspath)" if [ "$ID_VENDOR_ID $ID_MODEL_ID" == "1b1f c020" ]; then HMIP_MAJOR=$MAJOR HMIP_MINOR=$MINOR HMIP_DEVNAME=$DEVNAME break fi fi done if [ -z "$HMIP_MAJOR" ]; then HMIP_MAJOR=1 HMIP_MINOR=3 else HMIP_HARDWARE='HMIP-RFUSB' mount --bind /dev /var/lib/piVCCU/rootfs/dev mount --bind /proc /var/lib/piVCCU/rootfs/proc HMIP_INFO=`timeout 20 chroot /var/lib/piVCCU/rootfs /opt/jre/bin/java -Dgnu.io.rxtx.SerialPorts=$HMIP_DEVNAME -jar /opt/HmIP/hmip-copro-update.jar -p $HMIP_DEVNAME -v -a 2>&1` || true SGTIN=`echo "$HMIP_INFO" | sed -n 's/.*SGTIN = \([0-9A-Fa-f]\{24\}\).*/\1/p'` umount /var/lib/piVCCU/rootfs/dev umount /var/lib/piVCCU/rootfs/proc fi ;; esac BRIDGE=`brctl show | sed -n 2p | awk '{print $1}'` MAIN_INTERFACE=`route | grep 'default' | awk '{print $5" "$8}' | sort | awk '{print $2}' | uniq | head -n 1` HOST_MAC=`cat /sys/class/net/$MAIN_INTERFACE/address` MAC=`echo $HOST_MAC | md5sum | sed 's/\(.\)\(..\)\(..\)\(..\)\(..\)\(..\).*/\1a:\2:\3:\4:\5:\6/'`
true
ed4610cb2acf6ed5102006dc9d18cff18f1a7699
Shell
deyrajat/Test
/at-component-pcf/utilities-lib/script/capture-utils/stopErrorCapture.sh
UTF-8
510
3.15625
3
[]
no_license
#!/bin/bash kill -9 $(ps -aef | grep "tail -f /var/log/broadhop/consolidated-qns.log" | grep -v grep | awk '{print $2}') totalException=`grep ERROR $1 | wc -l` echo "total Excetion: $totalException" errorType=`grep "ERROR" $1 | awk -F "ERROR" '{print $NF}' | sort -u | awk -F "-" '{print $1}' | sort -u` for error in $errorType do uniqCount=`grep $error $1 | wc -l` lastUniqLine=`grep $error $1 | tail -1` echo "$lastUniqLine, Total Count=$uniqCount" >> tmp_Error done >$1 cp tmp_Error $1 rm -f tmp_Error
true
c876c047cb2e3d2d41a36f4b3530c40f4cdbc0ea
Shell
landai-n/dr-yocto
/build.sh
UTF-8
212
2.609375
3
[ "MIT" ]
permissive
#!/bin/bash # argument 1: Ubuntu version (e.g. 18.04) used as container tag # argument 2: path to Dockerfile docker build --build-arg "host_uid=$(id -u)" --build-arg "host_gid=$(id -g)" --tag "dr-yocto:$1" $2
true
ef88f1cfee085667ab3dbb91cc3229d1e0c4f18f
Shell
stevepartridge/baseballga.me-server-go
/_scripts/install.sh
UTF-8
989
3.890625
4
[]
no_license
#!/bin/bash BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo "$BASE_DIR" SERVICE="baseballgame" SERVICE_DIR="$BASE_DIR/../$SERVICE-service" UPSTART="$SERVICE.conf" if [[ ! -f "/etc/init/$UPSTART" ]]; then echo "/etc/init/$UPSTART doesn't exist, create it" if [[ -f "$BASE_DIR/upstart.conf" ]]; then printf "$BASE_DIR/upstart.conf found, creating..." cp "$BASE_DIR/upstart.conf" "/etc/init/$UPSTART" chmod 0700 "/etc/init/$UPSTART" initctl list printf "done.\n" else echo "$BASE_DIR/upstart.conf file not found. unable to create upstart script" fi else echo "/etc/init/$UPSTART found. skipping creation." fi if [[ ! -d "$SERVICE_DIR" ]]; then echo "creating service directory: $SERVICE_DIR" mkdir -p "$SERVICE_DIR" fi rm -f "$SERVICE_DIR/$SERVICE" cp "$BASE_DIR/$SERVICE" "$SERVICE_DIR/." service "$SERVICE" restart printf "Status: " initctl list | grep "$SERVICE" cd "$BASE_DIR/.." rm -f "\*-$SERVICE_linux\*" rm -fR "$BASE_DIR"
true
6962e4527ab66ab6460beed8e95bf7ef319bc22c
Shell
578412668/test
/test
UTF-8
1,335
4.28125
4
[]
no_license
#!/bin/bash ##for file zip and unzip #date:2011/7/20 #input:current_filename #use gunzip\bzip\tar commands to do this . #two choices:pack||unpack pack() { ##use tar cmd to pack file echo "Now will use tar to pack the file......" echo "tar $CUR_FILE ......." #sleep 1 tar -zcvf $CUR_FILE.tar.gz $CUR_FILE if [ "$?" -eq "0" ];then echo "pack file $CUR_FILE into tar.gz file ok~!" else echo "Error:Pack file into tar.gz failed~!" exit 1 fi } unpack(){ ##get file type ftype=`file $CUR_FILE` #echo file type echo "Your file type is:###$ftype" case "$ftype" in "$CUR_FILE: Zip archive"*) unzip $CUR_FILE echo "unzip $CUR_FILE OK~!" ;; "$CUR_FILE: gzip compressed"*) gunzip $CUR_FILE echo "gunzip $CUR_FILE OK~!" ;; "$CUR_FILE: bzip2 compressed"*) bunzip2 $CUR_FILE echo "bunzip $CUR_FILE OK~!" ;; *) echo "File $CUR_FILE can not be uncompressed!!!" exit 1 ;; esac } CUR_FILE="$1" if [ -z $CUR_FILE];then echo "Please input your filename!" exit 1 else echo "Your file name:$CUR_FILE" ##make target choice echo "Which work you wanna do?" select var in "pack" "unpack";do break done echo "You selected $var file....." case $var in pack) pack CUR_FILE ;; unpack) unpack CUR_FILE ;; *) echo "Usage:select option error!" exit 1 esac fi
true
a7de8a59b7ec26039c7abd0ed650f5c365d813e8
Shell
alldatacenter/alldata
/dts/airbyte/airbyte-commons-worker/src/main/resources/entrypoints/sync/check.sh
UTF-8
333
3.015625
3
[ "MIT", "Elastic-2.0", "Apache-2.0", "BSD-3-Clause" ]
permissive
trap "touch TERMINATION_FILE_CHECK" EXIT (set -e; while true; do curl -s HEARTBEAT_URL &> /dev/null; sleep 1; done) & CHILD_PID=$! (while true; do if [ -f TERMINATION_FILE_MAIN ]; then kill $CHILD_PID; exit 0; fi; sleep 1; done) & wait $CHILD_PID EXIT_CODE=$? if [ -f TERMINATION_FILE_MAIN ] then exit 0 else exit $EXIT_CODE fi
true
ba55858ed6329b71d8d429311151d93de3dbeeb7
Shell
ppc64le/build-scripts
/a/awx/ansible-awx_rhel_7.7.sh
UTF-8
1,787
3.625
4
[ "Apache-2.0" ]
permissive
#!/bin/bash # ---------------------------------------------------------------------------- # # Package : ansible/awx # Version : 9.0.1 # Source repo : https://github.com/seth-priya/awx # Tested on : RHEL 7.7 # Script License: Apache License, Version 2 or later # Maintainer : Sarvesh Tamba <sarvesh.tamba@ibm.com> # # Disclaimer: This script has been tested in root mode on given # ========== platform using the mentioned version of the package. # It may not work as expected with newer versions of the # package and/or distribution. In such case, please # contact "Maintainer" of this script. # # ---------------------------------------------------------------------------- set -e CURRENT_DIR=`pwd` # Install all dependencies. sudo yum -y update sudo yum -y install git curl gcc python3-devel libffi-devel openssl-devel make python3-pip # Install ansible pip3 install ansible #The above pulls Intel specific rabbitmq image from DockerHub instead of being built locally. #Build rabbitmq on Power and retag it. cd $CURRENT_DIR docker rmi ansible/awx_rabbitmq:3.7.4 ansible/awx_rabbitmq:latest -f # check if source code already checked out if [ -d "$CURRENT_DIR/awx-rabbitmq" ]; then # if source code already exists remove the directory rm -rf "$CURRENT_DIR/awx-rabbitmq/" fi git clone https://github.com/ansible/awx-rabbitmq cd awx-rabbitmq/ make docker tag ansible/awx_rabbitmq:3.7.21 ansible/awx_rabbitmq:3.7.4 # Clone and build missing dependencies from source. cd $CURRENT_DIR # check if source code already checked out if [ -d "$CURRENT_DIR/awx" ]; then rm -rf "$CURRENT_DIR/awx" fi git clone https://github.com/seth-priya/awx.git cd awx git apply ../awx_ppc64le.diff pip3 install docker-compose cd installer ansible-playbook -i inventory install.yml
true
deae5cedc7bb8618105b27c3d6d31ec8468a824a
Shell
bioinformatics-lab/SPEAQeasy
/run_pipeline_local.sh
UTF-8
1,084
3.59375
4
[]
no_license
#!/bin/bash # Script to run pipeline using local hardware resources # After running 'install_software.sh', this should point to the directory # where SPEAQeasy was installed, and not say "$PWD" ORIG_DIR=$PWD export _JAVA_OPTIONS="-Xms5g -Xmx7g" $ORIG_DIR/Software/nextflow main.nf \ --small_test \ --sample "single" \ --reference "hg38" \ --strand "unstranded" \ --annotation "$ORIG_DIR/Annotation" \ -with-report execution_reports/pipeline_report.html \ -profile local \ 2>&1 | tee -a SPEAQeasy_output.log # Produces a report for each sample tracing the pipeline steps # performed (can be helpful for debugging). Experimental, and may not work on # all Linux distributions. Other operating systems are currently not supported. # # Note that the reports are generated from the output log produced in the above # section, and so if you rename the log, you must also pass replace the filename # in the bash call below. echo "Generating per-sample logs for debugging..." bash $ORIG_DIR/scripts/generate_logs.sh $PWD/SPEAQeasy_output.log
true
203af9b4b03c5596382709308e349d2d523752cd
Shell
Lily11223344/VQA-MIB
/vis.sh
UTF-8
322
3.15625
3
[ "Apache-2.0" ]
permissive
#!/bin/bash if [ "$#" -ne 2 ]; then echo "How to use (example):" echo "./vis.sh ban_wa_with_fusion 12" echo "12 is the maximum epoch number in the folder (starting from 0)" exit 1 fi i=0 while [ $i -le $2 ] do python vis.py -v $1 -e $i -n 1000 & i=$(($i+1)) done echo "All done"
true
6f431fcf054228f81a64f8a1273a846fa4eb8168
Shell
qznc/dot
/bin/fool_browser
UTF-8
491
3.234375
3
[ "LicenseRef-scancode-unknown-license-reference", "ISC" ]
permissive
#!/bin/sh set -e # inspiration: https://github.com/wesbos/aprilFools.css EVIL="\ /* Haha */ body { -webkit-transform: rotate(180deg); -mozilla-transform: rotate(180deg); transform: rotate(180deg); }" do_evil() { echo "break $1" echo "$EVIL" >>$1 } HOMEDIR=$1 do_evil "$HOMEDIR/.config/chromium/Default/User StyleSheets/Custom.css" do_evil "$HOMEDIR/.config/google-chrome/Default/User StyleSheets/Custom.css" do_evil $(find "$HOMEDIR/.mozilla/firefox" -name "userContent-example.css")
true
e1075cb76e7682c8dd2bb14d19fb5e0aa61f3f07
Shell
loganlinn/dotfiles-2019
/plugins/pyenv-act/pyenv-act.plugin.zsh
UTF-8
787
3.46875
3
[ "MIT" ]
permissive
alias deact="pyenv deactivate" # @description activates a pyenv-managed virtualenv based on args, pwd, or fzf choice act() { local env="$1" if [[ "$#" -ne "0" ]]; then pyenv activate "$1" return 0 fi if [[ -z "${VIRTUAL_ENV:-}" ]]; then project=$(basename $(git rev-parse --show-toplevel 2>/dev/null || pwd)) if [[ -d "$PYENV_ROOT/versions/$project" ]]; then pyenv activate "$project" return 0 fi fi choice=$(pyenv virtualenvs --bare | awk '/[-.0-9]+\/envs\//{next;}{print $1}' | fzf --select-1 --query="$env") if [[ -n "$choice" ]]; then pyenv activate "$choice" return 0 fi return 1 } # _act_virtualenv_list() { # pyenv virtualenv --complete # } # _act() { # compadd $(_act_virtualenv_list) # } # compdef _act act
true
7f1c7f9743a88ad02b51e8ec1b3d0a452f78aa05
Shell
janshi2021/cciscript
/old_script/sshlogin.sh
UTF-8
830
3.65625
4
[]
no_license
#!/bin/bash if [ $# -lt 2 ]; then echo "Syntax: $0 IP_ADDR USER ROOT_PASSWORD" echo "E.g. $0 192.168.1.1 root nokia123" exit -1 fi me=`which $0` me=`dirname $me` #check if remote machine has our public key ssh -oNumberOfPasswordPrompts=0 -oPasswordAuthentication=no -oStrictHostKeyChecking=no ${2}@${1} 'echo ""' if [ $? -eq 0 ] then echo "already register public key on ${1}" exit 0 fi echo "upload public key to ${1}" #rm -f $HOME/.ssh/known_hosts #ssh-keygen -R ${1} expect -f ${me}/upload_pubkey.sh ${1} ${2} ${3} "/${2}/.ssh/id_rsa.pub" ssh -oNumberOfPasswordPrompts=0 -oPasswordAuthentication=no -oStrictHostKeyChecking=no ${2}@${1} 'echo ""' if [ $? -eq 0 ] then echo "registered public key on ${1} successfully" exit 0 fi echo "failed to register public key on ${1} " exit 1
true
247f12ef7c69a30874b24069e7650cae62692827
Shell
Projetomoni/MKLV
/cgi-bin/remoequip.cgi
UTF-8
791
3.109375
3
[]
no_license
#!/bin/bash read VAR echo "content-type: text/html" echo IP=$(echo $VAR | cut -d"&" -f1 | cut -d"=" -f2) CIP=$(echo $VAR | cut -d"&" -f2 | cut -d"=" -f2) echo "<script lang='javascript'>" if [[ $IP != '' ]] ; then if [[ $CIP != '' ]] ; then if [[ $IP == $CIP ]] ; then grep -v "$IP$;" registrados.csv > registrados.new mv registrados.new registrados.csv chmod 777 equi.csv echo "$(date);$IP;REMOVIDO" >> registrados.log echo "alert('Equipamento removido.');" echo "location.href='../menu.html'" else echo "alert('Campos não coincidem.');" echo "location.href='../menu.html'" fi else echo "alert('Campos vazios.');" echo "location.href='../menu.html'" fi else echo "alert('Campos vazios.');" echo "location.href='../menu.html'" fi echo "</script>"
true
d59aec8f37543898e51f87f85ad4a63ad7e23068
Shell
telefonicaid/fiware-murano
/docker/dashboard/run.sh
UTF-8
428
2.96875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash MURANO=`docker ps -a -q --filter="name=murano"` if [ "$MURANO" != "" ] then echo "stop murano" docker stop $(docker ps -a -q) docker rm $(docker ps -a -q) docker rmi murano-dashboard docker rmi fiware-murano fi cd ../fiwaremurano docker build -t fiware-murano . cd ../dashboard docker build -t murano-dashboard . export PASSWORD=$1 docker-compose -f docker-compose-dashboard.yml up -d
true
318f27bb44298a8969b11a20a6f976cd43c25fa6
Shell
simoncarrignon/phd
/dev/addConfigLine.sh
UTF-8
405
3.34375
3
[]
no_license
#Script used to add a column with some values that are in the config file of the experiment but that was not in the output folder=$1 val=$2 for i in $folder/run_*/ ; do nag=`cat $i/config.xml | grep "numAgents value=" | awk 'BEGIN{FS="\""}{print $2}'` nst=`cat $i/config.xml | grep "goods num=" | awk 'BEGIN{FS="\""}{print $2}'` echo $nag " and "$nst sed -i "s/^/$nag;$nst;/g" $i/agents.csv done
true
3eb7390a925c0203853bd13b13633c020d429151
Shell
Solaxun/tern
/tools/fs_hash.sh
UTF-8
421
3.71875
4
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/bin/sh # # Copyright (c) 2018 VMware, Inc. All Rights Reserved. # SPDX-License-Identifier: BSD-2-Clause # # Given a file path, create a list of file stats and their sha256sums # usage: ./fs_hash.sh path/to/dir # format: permissions|uid|gid|size in bytes|number of hard links|security context|sha256sum filepath pushd $1 > /dev/null; find -type f -printf "%M|%U|%G|%s|%n|%Z|" -exec sha256sum {} \; popd > /dev/null;
true
95a7f77ac6f05ac536b696e3d16841ac4a13cae3
Shell
eehouse/xwords
/xwords4/linux/scripts/game_with_seed.sh
UTF-8
500
3.265625
3
[]
no_license
#!/bin/sh set -u -e PARAMS="--curses --robot Kati --remote-player --game-dict dict.xwd --quit-after 1 --sort-tiles" run() { SEED=$1 LOG=LOG__${SEED}.txt ROOM=ROOM_${SEED} > $LOG ./obj_linux_memdbg/xwords $PARAMS --room $ROOM \ --seed $SEED >/dev/null 2>>$LOG & sleep 1 ./obj_linux_memdbg/xwords $PARAMS --room $ROOM \ --seed $((SEED+1000)) >/dev/null 2>>$LOG & } for SEED in $(seq 1 1000); do echo "trying seed $SEED" run $SEED wait done
true
7d3279f518c7855e4c8d670d3413dc7af27cdba9
Shell
schadley/custom-ps1
/PS1.sh
UTF-8
1,669
3.546875
4
[ "MIT" ]
permissive
#!/bin/sh BoxCornerUL='┌' #u250c BoxCornerLL='└' #u2514 Tpipe='├' #u251c LineHoriz='─' #u2500 Delta='Δ' #u0394 Minus='−' #u2212 Red='\e[0;31m' Green='\e[0;32m' NC='\e[0m' if [ "$color_prompt" = yes ]; then PS1='$BoxCornerUL$LineHoriz ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]' else PS1='$BoxCornerUL$LineHoriz ${debian_chroot:+($debian_chroot)}\u@\h:\w' fi unset color_prompt force_color_prompt in_git_repo() { [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1 } git_branch() { local branch=$(git branch 2>/dev/null | grep -Po "(?<=\* ).+") echo "$branch" } git_index() { local new=$(git diff-index --cached --name-only --ignore-submodules=dirty --diff-filter=A HEAD | wc -l) local modified=$(git diff-index --cached --name-only --ignore-submodules=dirty --diff-filter=M HEAD | wc -l) local deleted=$(git diff-index --cached --name-only --ignore-submodules=dirty --diff-filter=D HEAD | wc -l) echo "$Green+:$new $Delta:$modified $Minus:$deleted$NC" } git_worktree() { local modified=$(git diff --name-only --ignore-submodules=dirty --diff-filter=M | wc -l) local deleted=$(git diff --name-only --ignore-submodules=dirty --diff-filter=D | wc -l) local untracked=$(git ls-files --exclude-standard --others | wc -l) echo "$Red$Delta:$modified $Minus:$deleted ?:$untracked$NC" } print_git_status() { if in_git_repo; then local status="\n$Tpipe$LineHoriz B:$(git_branch)" status+=" $(git_index)" status+=" $(git_worktree)" echo -e "$status" fi } PS1+='$(print_git_status)' PS1+='\n$BoxCornerLL\$ '
true
8af5ed2bd78f5421efe1b6dccea2caaf5cdc3202
Shell
a093130/conda-recipes
/libarchive/build.sh
UTF-8
419
2.5625
3
[ "BSD-3-Clause", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env bash # Building libarchive 3.1.2 with CMake 3.3.1 doesn't get you .pc files. # cmake "-DCMAKE_BUILD_TYPE=Release" \ # "-GUnix Makefiles" \ # "-DCMAKE_INSTALL_PREFIX=${PREFIX}" # cmake --build . -- "-j${CPU_COUNT}" # cmake --build . --target install autoreconf -i ./configure --prefix=${PREFIX} \ --with-expat \ --without-xml2 make -j"${CPU_COUNT}" V=1 make install
true
662b22623f1d3302f9a84f9f095cd7d75643716a
Shell
forcespikejan/Trading-Bot
/resources/scripts/ui-instance-entrypoint.sh
UTF-8
307
2.984375
3
[]
no_license
#!/bin/sh set -e JS_FILE=$(grep -nril "window.location.origin||\"http://localhost:8080\"" /etc/nginx/html/ || echo "0") if [ "0" != "${JS_FILE}" ]; then sed -i 's/window.location.origin||"http:\/\/localhost:8080"/"http:\/\/'${TRADING_BOT_API_HOST}':'${TRADING_BOT_API_PORT}'"/g' $JS_FILE fi exec "$@"
true
6cc0a7380e83660658c92c3ee6df0c3b92d1c0d5
Shell
feelssexy/audiotroll
/tui
UTF-8
2,820
3.390625
3
[]
no_license
#!/usr/bin/env bash function menu { local title=$1 shift local choices=$# trap 'echo -e "\033[u\033[${choices}B\033[0m"; cleanup; return 255' 2 stty -echo -icanon time 0 min 0 for i in $( seq $(( choices + 2 )) ) do echo done echo -en "\033[$(( $choices + 2 ))A\033[J" echo -e "\033[1m$title" for i in $( seq $( echo -n $title | wc -c ) ) do echo -n "*" done echo -en "\n\033[s\n" for i in $( seq $choices ) do echo -en "\033[1m( )\033[0m" $1 [ $i -ne $choices ] && echo shift done local pos=0 local key="?" until [ "$key" = $'\r' ] do select-entry $pos echo -en "\033[92m*" key="$( wait-key )" if [ "$key" = $'\033[A' ] && [ $pos -gt 0 ] then select-entry $pos echo -en "\033[0m " let pos-- fi if [ "$key" = $'\033[B' ] && [ $pos -lt $(( $choices - 1 )) ] then select-entry $pos echo -en "\033[0m " let pos++ fi done echo -e "\033[u\033[${choices}B\033[0m" cleanup return $pos } function multi-menu { local title=$1 shift local choices=$# if [ -z $selection ] then for (( i = 0; i < choices; i++ )) do selection[$i]=0 done fi trap 'echo -e "\033[u\033[${choices}B\033[0m"; cleanup; return 255' 2 stty -echo -icanon time 0 min 0 for i in $( seq $(( choices + 2 )) ) do echo done echo -en "\033)0\033[$(( $choices + 2 ))A\033[J" echo -e "\033[1m$title" for i in $( seq $( echo -n $title | wc -c ) ) do echo -n "*" done echo -en "\n\033[s\n" for i in $( seq $choices ) do echo -en "\033[1m[ ]\033[0m" $1 [ $i -ne $choices ] && echo shift done local pos=0 local key="?" local char until [ "$key" = $'\r' ] do select-entry $pos char=$( [ ${selection[$pos]} -eq 1 ] && echo -en "\033[92m\016\x60\017" || echo -en " " ) echo -en "\033[0;7m${char}\033[0m" key=$( wait-key ) if [ "$key" = " " ] then [ ${selection[$pos]} -eq 1 ] && selection[$pos]=0 || selection[$pos]=1 fi if [ "$key" = $'\033[A' ] && [ $pos -gt 0 ] then select-entry $pos [ ${selection[$pos]} -eq 1 ] && echo -en "\033[92m\016\x60\017" || echo -en "\033[0m " let pos-- fi if [ "$key" = $'\033[B' ] && [ $pos -lt $(( $choices - 1 )) ] then select-entry $pos [ ${selection[$pos]} -eq 1 ] && echo -en "\033[92m\016\x60\017" || echo -en "\033[0m " let pos++ fi done echo -e "\033[u\033[${choices}B\033[0m" cleanup } function select-entry { echo -en "\033[u\033[1C\033[$(( $1 + 1 ))B" } function wait-key { local result="" until [ ${#result} != 0 ] do result=$( get-key ) done echo -n "$result" } function get-key { local timeout=${1:-0.02} local retval=0 local input="" local char until [ $retval = 142 ] do read -t $timeout -rsN1 char retval=$? [ "$char" = $'\n' ] && char=$'\r' input="${input}${char}" done echo -n "$input" } function cleanup { stty sane trap 2 }
true
ff8ff35b9c81a96cbe8173dcc0b3bd9add7bdf75
Shell
stackpoet/clara
/build_lambda.sh
UTF-8
1,410
2.71875
3
[]
no_license
#!/usr/bin/env bash # 06/23/2019 - Adding new feature that creates Yara scanning lambda fucntion #author: Abhinav Singh lambda_output_file=/opt/app/build/lambda.zip set -e yum update -y yum install -y cpio python3-pip yum-utils zip yum -y install gcc openssl-devel bzip2-devel libffi-devel yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm #yum install https://www.rpmfind.net/linux/epel/7/x86_64/Packages/y/yara-3.8.1-1.el7.x86_64.rpm yum install -y http://download-ib01.fedoraproject.org/pub/epel/testing/7/x86_64/Packages/y/yara-3.11.0-1.el7.x86_64.rpm yum install -y python3-devel.x86_64 pip3 install --no-cache-dir virtualenv virtualenv env . env/bin/activate pip3 install --no-cache-dir -r requirements.txt pushd /tmp yumdownloader -x \*i686 --archlist=x86_64 clamav clamav-lib clamav-update json-c pcre2 yara rpm2cpio clamav-0*.rpm | cpio -idmv rpm2cpio clamav-lib*.rpm | cpio -idmv rpm2cpio clamav-update*.rpm | cpio -idmv rpm2cpio json-c*.rpm | cpio -idmv rpm2cpio pcre*.rpm | cpio -idmv rpm2cpio yara*.rpm | cpio -idmv popd mkdir -p bin cp /tmp/usr/bin/clamscan /tmp/usr/bin/freshclam /tmp/usr/bin/yara /tmp/usr/bin/yarac /tmp/usr/lib64/* bin/. echo "DatabaseMirror database.clamav.net" > bin/freshclam.conf mkdir -p build zip -r9 $lambda_output_file *.py bin zip -r9 $lambda_output_file conf/ bin/. cd env/lib/python3.7/site-packages zip -r9 $lambda_output_file *
true
7077f26bc4d928472b26159aa81199c59add051c
Shell
rogerbrandtdev/golang-tls
/list_crt_n_keys.sh
UTF-8
207
3.046875
3
[]
no_license
#! /bin/bash -e for f in $( echo "$( find . -name '*crt' | grep -v save ; find . -name '*key' | grep -v save )" ) do if [[ $# -eq 0 ]] then echo $f else eval "$* $f" fi done
true
a4ee2d3db44f4016072cef146a39b5f6cdb38101
Shell
bash-my-aws/bash-my-aws
/scripts/build
UTF-8
2,008
3.96875
4
[ "MIT" ]
permissive
#!/usr/bin/env bash project_root="$(cd "$(dirname "$0")/.." && pwd)" aliases_destination="$project_root/aliases" funcs_destination="$project_root/functions" completion_destination="$project_root/bash_completion.sh" # Generate a file with all BMA function names (used in bash completion) # functions in shell before loading BMA functions funcs_before_bma=$(compgen -A function) # load all the functions from bash-my-aws for f in $project_root/lib/*-functions; do source "$f"; done # all function after loading BMA functions funcs_after_bma=$(compgen -A function) # Generate the functions file { echo "# DO NOT MANUALLY MODIFY THIS FILE." echo "# Use 'scripts/build' to regenerate if required." echo "" echo "${funcs_before_bma}" "${funcs_after_bma}" | tr ' ' '\n' | awk 'NF' | LC_ALL=C sort | uniq -u } > "$funcs_destination" # Generate the aliases file { echo "# DO NOT MANUALLY MODIFY THIS FILE." echo "# Use 'scripts/build' to regenerate if required." echo "" } > "$aliases_destination" # Don't create alias for these functions exclusions=('region') for fnc in $(echo "${funcs_before_bma}" "${funcs_after_bma}" "${exclusions}" | tr ' ' '\n' | LC_ALL=C sort | uniq -u); do echo "alias $fnc='\${BMA_HOME:-\$HOME/.bash-my-aws}/bin/bma $fnc'" >> "$aliases_destination" done; # functions to clone fncs_to_clone=('region') { echo echo "# We'll find a less suprising place for this in future" echo "# region() needs to be a function in order to let it" echo "# set AWS_DEFAULT_REGION in the current shell" } >> "$aliases_destination" for fnc_name in $fncs_to_clone; do function_body=$(type "$fnc_name" | tail -n +3) printf "function %s() %s" "$fnc_name" "$function_body" >> "$aliases_destination" done; echo "" >> "$aliases_destination" ${project_root}/scripts/build-completions > "$completion_destination" ${project_root}/scripts/build-docs
true
822b4e391342ebc6017220310b53c002fcab02f4
Shell
AverageMarcus/dotfiles
/home/.bin/flux-refresh
UTF-8
3,810
3.9375
4
[]
no_license
#!/usr/bin/env bash source .utils set -e VERBOSE="" TARGET_RESOURCE="all" NAMESPACES="-A" print_usage() { blue "flux-refresh - Refresh all flux resources" echo " " underline "Usage:" echo "flux-refresh [options]" echo " " underline "Options:" echo "-t, --type the resource type to target. Valid options: gitrepo, helmrepository, kustomization, helmrelease & all. Default: all" echo "-n, --namespace the namespace resources belong in. Default: all namespaces" echo " --verbose show full verbose output" echo "-h, --help show this help text" } while test $# -gt 0; do case "$1" in -h|--help) print_usage exit 0 ;; -t|--type) shift TARGET_RESOURCE=$1 shift ;; -n|--namespace) shift NAMESPACES="-n $1" shift ;; --verbose) VERBOSE="true" shift ;; *) shift ;; esac done if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "gitrepo" ]]; then GITREPOS=$(kubectl get gitrepo ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"') fi if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrepository" ]]; then HELMREPOS=$(kubectl get helmrepository ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"') fi if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "kustomization" ]]; then KUSTOMIZATIONS=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"') fi if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrelease" ]]; then HEALMRELEASES=$(kubectl get helmrelease ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"') fi if [[ "${GITREPOS}" != "" ]]; then blue "Refreshing GitRepositories" for RESOURCE in ${GITREPOS} do PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n")) printf "${PARTS[0]}/${PARTS[2]}" if [[ "${VERBOSE}" == "true" ]]; then echo "" flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} || true else flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true printf " ✅" fi echo "" done fi if [[ "${HELMREPOS}" != "" ]]; then blue "Refreshing HelmRepositories" for RESOURCE in ${HELMREPOS} do PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n")) printf "${PARTS[0]}/${PARTS[2]}" if [[ "${VERBOSE}" == "true" ]]; then echo "" flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} || true else flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true printf " ✅" fi echo "" done fi if [[ "${KUSTOMIZATIONS}" != "" ]]; then blue "Refreshing Kustomizations" for RESOURCE in ${KUSTOMIZATIONS} do PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n")) printf "${PARTS[0]}/${PARTS[2]}" if [[ "${VERBOSE}" == "true" ]]; then echo "" flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} || true else flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true printf " ✅" fi echo "" done fi if [[ "${HEALMRELEASES}" != "" ]]; then blue "Refreshing HelmReleases" for RESOURCE in ${HEALMRELEASES} do PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n")) printf "${PARTS[0]}/${PARTS[2]}" if [[ "${VERBOSE}" == "true" ]]; then echo "" flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} || true else flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true printf " ✅" fi echo "" done fi
true
a292213650412a8c33521e0e704e2596d767e906
Shell
kragen/shootout
/bin/compress_ndata
UTF-8
186
2.546875
3
[ "BSD-3-Clause" ]
permissive
#!/bin/bash # compress ndata.csv in download directory # Isaac Gouy May 10 2005, May 14 2005 NDATA=website/data/ndata.csv Z=website/websites/download/ndata.csv.bz2 bzip2 -fc $NDATA > $Z
true
1e686bef4911bb656c99f79c2ce0695cf185b002
Shell
kevinguan-glitch/Acute-Lymphoblastic-Leukemia-Classifier-2020
/RPI4/Setup.sh
UTF-8
1,142
3.390625
3
[ "MIT" ]
permissive
#!/bin/bash FMSG="- Acute Lymphoblastic Leukemia Tensorflow CNN For Raspberry Pi 4 installation terminated" read -p "? This script will install the Acute Lymphoblastic Leukemia Tensorflow CNN For Raspberry Pi 4 required Python libraries and Tensorflow on your device. Are you ready (y/n)? " cmsg if [ "$cmsg" = "Y" -o "$cmsg" = "y" ]; then echo "- Installing required Python libraries and Tensorflow" sudo apt-get update sudo apt-get upgrade sudo pip3 install psutil sudo pip3 install requests sudo pip3 install numpy sudo pip3 install jsonpickle sudo pip3 install flask sudo pip3 install paho-mqtt sudo apt-get install gfortran sudo apt-get install libhdf5-dev libc-ares-dev libeigen3-dev sudo apt-get install libatlas-base-dev libopenblas-dev libblas-dev sudo apt-get install liblapack-dev cython sudo pip3 install pybind11 sudo pip3 install h5py wget https://github.com/Qengineering/Tensorflow-Raspberry-Pi/raw/master/tensorflow-2.1.0-cp37-cp37m-linux_armv7l.whl sudo -H pip3 install tensorflow-2.1.0-cp37-cp37m-linux_armv7l.whl else echo $FMSG; exit fi
true
01cfbc173f785ec0b42ab5a7e53c8c0b8aabeb69
Shell
taylorrassmannlibertyits/health-apis-data-query
/data-query-tests/lab-login
UTF-8
836
3.90625
4
[]
no_license
#!/usr/bin/env bash cd $(dirname $(readlink -f $0)) usage() { cat <<EOF $0 [options] [email] Performs OAuth login for lab users and prints their login ID and an access token. Options -h, --help Print this help and exit $1 EOF exit 1 } [ "$1" == "-h" -o "$1" == "--help" ] && usage # # Log in a user and print it's access token # OUTPUT=$(mktemp -p . oauth-login.XXXX) onExit() { rm $OUTPUT; } trap onExit EXIT LAB_USER="$1" FILTER=" " [ -n "$LAB_USER" ] && LOGIN_ARGS="-Dlab.user=$LAB_USER" && FILTER="$LAB_USER" mvn -q -P'!standard' test \ -Dgroups= \ -Dtest="*OauthLoginTest*" \ $LOGIN_ARGS \ > $OUTPUT 2>&1 USERS_FILE=lab-users.txt [ ! -f $USERS_FILE ] \ && echo "Missing $USERS_FILE, something terrible has happened" \ && cat $OUTPUT \ && exit 1 cat $USERS_FILE | cut -d ' ' -f 1,6 | grep -F "$FILTER"
true
58e145986abb0f950db15d858109b9f795e2ed17
Shell
410-dev/Macintosh-Packager
/bash/mpkg-manual
UTF-8
1,709
3.25
3
[]
no_license
#!/bin/bash echo "Macintosh Packager" echo "Usage: mpkg [parameters] [subparameter] [Extra Arguments]" echo "" echo "Parameters: " echo "-i: Install a package. Requires root privilage. Requires a subparameter. (--install)" echo "-r: Removes a package. Requires root privilage. Requires a subparameter. (--remove)" echo "-h: Shows help. (--help)" echo "-l: Shows installed package list (ID only). (--list)" echo "-v: Shows MPKG version. (--version)" echo "-p: Shows package information. Requires a subparameter. (--package-inspect)" echo "-b: Block removal for certain package. Requires a subparameter. (--block-remove)" echo "-d: Deploy a package. Requires one or more subparameters. (--deploy)" echo "--select: Select multiple packages. Able to add up to 8 packages at once." echo "--deep-inspect: Deeply inspect a package. Requires two subparameters." echo "" echo "Subparameter:" echo "-i: path to mpack package file" echo "-r: a package ID" echo "-p: a package ID" echo "-b: a package ID" echo "-d: path to mpack package file" echo "--deep-inspect: [key] [package ID]" echo "" echo "Extra Arguments: " echo "--ctr-only : Removes control file only. Requires -r option." echo "--target : Set a installation target directory. Ex. --target /Users/user/Desktop" echo "--usertarget : Set a installation target directory for user directory payload. Ex. --usertarget /Users/user/Desktop" echo "--override : Ignores package protection for installing same version. Requires -i option." echo "--ignore-dependency: Ignores dependency when installing / removing a package. Requires -r or -i option." echo "--with-control : Deploy a package with package informatio directory." exit 0
true