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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
dafc56f2ac196b46f8879d4fe511c46f179e8cbd | Shell | Gitdart/dict | /build.sh | UTF-8 | 1,278 | 3.890625 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env bash
## Preparing before docker build
prepare_before_docker_build() {
echo "Make preparing jobs before docker build:"
echo "Clean up backend"
(cd backend && find . -type d -name __pycache__ -exec rm -r {} + && find . -type f -name *.pyc -exec rm -r {} +)
echo "Build frontend page and package into dist"
(cd frontend && npm install && npm run build)
}
## Main
### Go to directory this script belonged to
cd `dirname $0`
### Task
case "$1" in
image)
echo "Start building image task..."
prepare_before_docker_build
echo "Build docker image for dict with tag: dict:v1"
docker build -t dict:v1 -f Dockerfile .
echo "Docker image <dict:v1> built successfully!"
;;
container)
echo "Start make container <dict_server1> ..."
docker run --name dict_server1 -d -p 9000:80 -v /data/container/db:/data/db -v /data/container/configdb:/data/configdb dict:v1
echo "Container <dict_server1> made successfully!"
;;
clean)
echo "Start clean task: remove container and image for rebuilding..."
docker container rm -f dict_server1
docker image rm dict:v1
;;
*)
echo "Usage: ./build.sh <image|container|clean>"
;;
esac | true |
827f646536b780ae0bf220c263abe080dc38c1e6 | Shell | steepale/bermuda_germline_snps_indels | /scripts/hard_filter_SNPs.sh | UTF-8 | 854 | 2.734375 | 3 | [] | no_license | #!/bin/bash -login
### Job name
### Resources
#PBS -l nodes=1:ppn=1,walltime=00:03:59:00,mem=10gb
### Send email if the job encounters an error
#PBS –m a
### Output files to where you submitted your batch file
#PBS -e ./jobs/${PBS_JOBNAME}_${PBS_JOBID}.err
#PBS -o ./jobs/${PBS_JOBNAME}_${PBS_JOBID}.log
#PBS -j oe
# Load modules
module load GATK/3.5.0
# Change to working directory
cd ${PBS_O_WORKDIR}
# Variables
sample_name=$(basename ${Var} "_raw_snps_extracted.g.vcf.gz")
# Perform hard filtering
java -Xmx10g -cp $GATK -jar $GATK/GenomeAnalysisTK.jar \
-T VariantFiltration \
-R ./data/Galgal5/galgal5.fa \
-V ${Var} \
--filterExpression "QD < 2.0 || FS > 60.0 || MQ < 40.0 || MQRankSum < -2.5" \
--filterName "SNP_HARD_FILTER" \
-o ./data/hard_filtered_variants/${sample_name}_hard_filtered_snps.g.vcf.gz
# Job report
qstat -f ${PBS_JOBID}
| true |
5058903aabdfbb026fd21e9d4c987e6076517846 | Shell | Mickaelh51/vodiadocker | /docker-debian.sh | UTF-8 | 1,320 | 3.640625 | 4 | [
"MIT"
] | permissive | #
# Installer for Vodia PBX on Debian
#
# TODO:
# Decide what languages you want installed (for audio). Valid languages are:
# dk: Danish
# nl: Dutch
# uk: English (UK)
# en: English (US)
# ca: French (Canada)
# fr: French (France)
# de: German
# gr: Greek
# it: Italian
# pl: Polish
# ru: Russian
# sp: Spanish
# se: Swedish
# tr: Turkish
#LANGUAGES="en de" #ENV VARIABLE !
# TODO:
# Decide where to put all the stuff:
PBX_DIR=/usr/local/pbx
# TODO:
# Decide which version you want to run:
#VERSION=59.0 #ENV VARIABLE !
# Below here should be audomatic
# Find out if this is 32 or 64 bit:
BITS=`getconf LONG_BIT`;
DOWNLOAD_PATH=http://vodia.com/downloads/pbx
#
# Check if this is root
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
if [ ! -d $PBX_DIR ]; then
mkdir $PBX_DIR
fi
cd $PBX_DIR
# Get the language files:
for i in $LANGUAGES moh; do
wget $DOWNLOAD_PATH/audio/audio_$i.zip
unzip audio_$i.zip
rm audio_$i.zip
done
# Get the executable:
wget $DOWNLOAD_PATH/debian$BITS/pbxctrl-debian$BITS-$VERSION
wget $DOWNLOAD_PATH/dat/pbxctrl-$VERSION.dat
mv pbxctrl-debian$BITS-$VERSION pbxctrl
mv pbxctrl-$VERSION.dat pbxctrl.dat
chmod a+rx pbxctrl
cat >pbx.sh <<EOF
#!/bin/bash -f
cd $PBX_DIR
while [ 1 ]; do
./pbxctrl --dir . --no-daemon
done
EOF
chmod a+rx pbx.sh
| true |
10cf5cdb37bac6b6b630436ca62c6982ab0279d1 | Shell | bcui6611/mortimer | /bin/mortimer | UTF-8 | 225 | 2.75 | 3 | [] | no_license | #!/bin/sh
export MORTIMER="$(cd $(dirname "$0")/.. && pwd)"
# ~4x faster under pypy (if available)
if hash pypy 2>/dev/null; then
pypy $MORTIMER/mortimer/mortimer.py $@
else
exec $MORTIMER/mortimer/mortimer.py $@
fi
| true |
d90782f544de5859cb1df82c1d55b6feb4f82263 | Shell | jack09260812/learngit | /CDH/Shell/cloudera_scripy/cloudera-config.sh | UTF-8 | 16,873 | 3.625 | 4 | [] | no_license | vi cloudera-config.sh
#!/bin/bash
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# defines a set of helper functions that can be used by Cloudera
# manager service scripts and exports some common environment
# variables.
#
# Attempts to locate java home, prints an error and exits if no
# java can be found.
locate_java_home() {
locate_java_home_no_verify
verify_java_home
}
# Attempts to locate java home, but doesn't exit if none is found.
locate_java_home_no_verify() {
local JAVA6_HOME_CANDIDATES=(
'/usr/lib/j2sdk1.6-sun'
'/usr/lib/jvm/java-6-sun'
'/usr/lib/jvm/java-1.6.0-sun-1.6.0'
'/usr/lib/jvm/j2sdk1.6-oracle'
'/usr/lib/jvm/j2sdk1.6-oracle/jre'
'/usr/java/jdk1.6'
'/usr/java/jre1.6'
)
local OPENJAVA6_HOME_CANDIDATES=(
'/usr/lib/jvm/java-1.6.0-openjdk'
'/usr/lib/jvm/jre-1.6.0-openjdk'
)
local JAVA7_HOME_CANDIDATES=(
'/usr/java/jdk1.7'
'/usr/java/jre1.7'
'/usr/lib/jvm/j2sdk1.7-oracle'
'/usr/lib/jvm/j2sdk1.7-oracle/jre'
'/usr/lib/jvm/java-7-oracle'
)
local OPENJAVA7_HOME_CANDIDATES=(
'/usr/lib/jvm/java-1.7.0-openjdk'
'/usr/lib/jvm/java-7-openjdk'
)
local JAVA8_HOME_CANDIDATES=(
'/usr/java/jdk1.8'
'/usr/java/jre1.8'
'/usr/lib/jvm/j2sdk1.8-oracle'
'/usr/lib/jvm/j2sdk1.8-oracle/jre'
'/usr/lib/jvm/java-8-oracle'
)
local OPENJAVA8_HOME_CANDIDATES=(
'/usr/lib/jvm/java-1.8.0-openjdk'
'/usr/lib/jvm/java-8-openjdk'
)
local MISCJAVA_HOME_CANDIDATES=(
'/Library/Java/Home'
'/usr/java/default'
'/usr/lib/jvm/default-java'
'/usr/lib/jvm/java-openjdk'
'/usr/lib/jvm/jre-openjdk'
)
case ${BIGTOP_JAVA_MAJOR} in
6) JAVA_HOME_CANDIDATES=(${JAVA6_HOME_CANDIDATES[@]})
;;
7) JAVA_HOME_CANDIDATES=(${JAVA7_HOME_CANDIDATES[@]} ${OPENJAVA7_HOME_CANDIDATES[@]})
;;
8) JAVA_HOME_CANDIDATES=(${JAVA8_HOME_CANDIDATES[@]} ${OPENJAVA8_HOME_CANDIDATES[@]})
;;
misc) JAVA_HOME_CANDIDATES=(${MISCJAVA_HOME_CANDIDATES[@]})
;;
*) JAVA_HOME_CANDIDATES=(${JAVA7_HOME_CANDIDATES[@]}
${JAVA8_HOME_CANDIDATES[@]}
${JAVA6_HOME_CANDIDATES[@]}
${MISCJAVA_HOME_CANDIDATES[@]}
${OPENJAVA7_HOME_CANDIDATES[@]}
${OPENJAVA8_HOME_CANDIDATES[@]}
${OPENJAVA6_HOME_CANDIDATES[@]})
;;
esac
# attempt to find java
if [ -z "${JAVA_HOME}" ]; then
for candidate_regex in ${JAVA_HOME_CANDIDATES[@]}; do
for candidate in `ls -rvd ${candidate_regex}* 2>/dev/null`; do
if [ -e ${candidate}/bin/java ]; then
export JAVA_HOME=${candidate}
break 2
fi
done
done
fi
}
# Attempts to locate java home, using CDH's provided detection
# routine. This allows us to delegate decisions such as the
# appropriateness of using java 6 vs 7 to CDH - where the
# answer varies, depending on the version.
locate_cdh_java_home() {
if [ -z "$JAVA_HOME" ]; then
if [ -z "$JSVC_HOME" ]; then
echo "JSVC_HOME is unset. Cannot find CDH's bigtop-detect-javahome and JAVA_HOME is not set."
exit 1
fi
# CDH >= 4.3 puts bigtop-detect-javahome in JSVC_HOME. In older versions
# of CDH, it's in the parent directory of JSVC_HOME. To further complicate
# matters, JSVC_HOME is hard-coded to the pre 4.3 value when parcels are
# not used, so we must explicitly search /usr/lib.
local BIGTOP_DETECT_JAVAHOME=
for candidate in \
"${JSVC_HOME}" \
"${JSVC_HOME}/.." \
"/usr/lib/bigtop-utils" \
"/usr/libexec"; do
if [ -e "$candidate/bigtop-detect-javahome" ]; then
BIGTOP_DETECT_JAVAHOME="$candidate/bigtop-detect-javahome"
break
fi
done
if [ -z "$BIGTOP_DETECT_JAVAHOME" ]; then
echo "Cannot find CDH's bigtop-detect-javahome."
exit 1
fi
. "$BIGTOP_DETECT_JAVAHOME"
fi
verify_java_home
}
# Verify that JAVA_HOME set - does not verify that it's set to a meaningful
# value.
verify_java_home() {
if [ -z "$JAVA_HOME" ]; then
cat 1>&2 <<EOF
+======================================================================+
| Error: JAVA_HOME is not set and Java could not be found |
+----------------------------------------------------------------------+
| Please download the latest Oracle JDK from the Oracle Java web site |
| > http://www.oracle.com/technetwork/java/javase/index.html < |
| |
| Cloudera Manager requires Java 1.6 or later. |
| NOTE: This script will find Oracle Java whether you install using |
| the binary or the RPM based installer. |
+======================================================================+
EOF
exit 1
fi
echo "JAVA_HOME=$JAVA_HOME"
}
# Source the parcel environment scripts passed by the agent
source_parcel_environment() {
if [ ! -z "$SCM_DEFINES_SCRIPTS" ]; then
# Narrow IFS to newline only to allow embedded spaces
OLD_IFS=$IFS
IFS=$':'
SCRIPT_ARRAY=($SCM_DEFINES_SCRIPTS)
DIRNAME_ARRAY=($PARCEL_DIRNAMES)
IFS=$OLD_IFS
COUNT=${#SCRIPT_ARRAY[@]}
for i in `seq 1 $COUNT`; do
SCRIPT=${SCRIPT_ARRAY[$i - 1]}
PARCEL_DIRNAME=${DIRNAME_ARRAY[$i - 1]}
. "$SCRIPT"
done
fi
}
# Sets the path to the HBase script in HBASE_BIN.
locate_hbase_script() {
if [ "$CDH_VERSION" -ge "5" ]; then
# CDH-13250 use bigtop script to start hbase
# Disable sourcing defaults dir, which CM will manage instead.
export BIGTOP_DEFAULTS_DIR=""
HBASE_BIN="$HBASE_HOME/../../bin/hbase"
else
HBASE_BIN="$HBASE_HOME/bin/hbase"
fi
}
# sets the default HADOOP_CLASSPATH to include cloudera log4j appender.
# The function will append to an existing HADOOP_CLASSPATH variable if it
# is defined. MGMT_HOME must be defined, otherwise the function prints an
# error message and exits.
set_hadoop_classpath() {
set_classpath_in_var HADOOP_CLASSPATH
}
# sets the default HBASE_CLASSPATH to include cloudera log4j appender.
# The function appends to an existing HADOOP_CLASSPATH variable if it
# is defined. MGMT_HOME must be defined, otherwise the function prints an
# error message and exits.
set_hbase_classpath() {
set_classpath_in_var HBASE_CLASSPATH
}
# sets the default ZOOKEEPER_CLASSPATH to include cloudera log4j appender.
# The function appends to an existing ZOOKEEPER_CLASSPATH variable if it
# is defined. MGMT_HOME must be defined, otherwise the function prints an
# error message and exits.
set_zookeeper_classpath() {
set_classpath_in_var ZOOKEEPER_CLASSPATH
}
# sets the default FLUME_CLASSPATH to include cloudera log4j appender.
# The function appends to an existing FLUME_CLASSPATH variable if it
# is defined. MGMT_HOME must be defined, otherwise the function prints an
# error message and exits.
set_flume_classpath() {
set_classpath_in_var FLUME_CLASSPATH
}
# sets hive's AUX_CLASSPATH to include cloudera governor plugin jar.
# MGMT_HOME must be defined, otherwise the function prints an
# error message and exits.
set_hive_classpath() {
set_classpath_in_var AUX_CLASSPATH
}
# sets the classpath variable passed as a parameter to include all of cloudera
# default classes.
#
# If no parameter is passed the function prints an error message and exits.
#
# This function adds all the plugin jars that are needed by CM. It includes
# the Cloudera log4j appender, the navigator plugins and the tasktracker
# instrumentation jar. The function checks for the CDH version and includes
# all jars from that particular cdh subdir.
#
# Note that MGMT_HOME must be defined, if it is not the function prints
# an error and exits.
#
# param $1 - The name of the classpath variable to assign to. The function
# appends all the extra jars to this varible.
set_classpath_in_var() {
if [ -z $1 ]; then
echo "Must call with the name of variable to assign."
exit 1
fi
if [[ -n "$MGMT_HOME" ]]; then
# Add all plugin jars to the classpath.
ADD_TO_CP=`find "${MGMT_HOME}/lib/plugins" -maxdepth 1 -name '*.jar' | tr "\n" ":"`
# Add jars from dirs to classpath.
if [[ -n "$CM_ADD_TO_CP_DIRS" ]]; then
for DIR in $CM_ADD_TO_CP_DIRS
do
PLUGIN=`find "${MGMT_HOME}/lib/plugins/${DIR}" -maxdepth 1 -name '*.jar' | tr "\n" ":"`
ADD_TO_CP="$ADD_TO_CP$PLUGIN"
done
fi
eval OLD_VALUE=\$$1
NEW_VALUE="$ADD_TO_CP$OLD_VALUE"
export $1=${NEW_VALUE/%:/} # Remove trailing ':' if present.
else
echo "MGMT_HOME must be set."
exit 1
fi
}
get_java_major_version() {
if [ -z $JAVA_HOME/bin/java ]; then
echo "JAVA_HOME must be set"
exit 1
fi
local VERSION_STRING=`$JAVA_HOME/bin/java -version 2>&1`
local RE_JAVA='[java|openjdk][[:space:]]version[[:space:]]\"1\.([0-9][0-9]*)\.+'
if [[ $VERSION_STRING =~ $RE_JAVA ]]; then
eval $1=${BASH_REMATCH[1]}
fi
}
acquire_kerberos_tgt() {
if [ -z $1 ]; then
echo "Must call with the name of keytab file."
exit 1
fi
# Acquire Kerberos tgt (ticket-granting ticket) if the server provided the
# principal (in which case the keytab should be non-zero).
#
# Note that we cache it in the current directory so that it will be isolated to
# this hadoop command.
if [ -n "$SCM_KERBEROS_PRINCIPAL" ]; then
if [ -d /usr/kerberos/bin ]; then
export PATH=/usr/kerberos/bin:$PATH
fi
which kinit
if [ $? -ne 0 ]; then
echo "kinit does not exist on the host."
exit 1
fi
export KRB5CCNAME=$CONF_DIR/krb5cc_$(id -u)
echo "using $SCM_KERBEROS_PRINCIPAL as Kerberos principal"
echo "using $KRB5CCNAME as Kerberos ticket cache"
kinit -c $KRB5CCNAME -kt $CONF_DIR/$1 $SCM_KERBEROS_PRINCIPAL
if [ $? -ne 0 ]; then
echo "kinit was not successful."
exit 1
fi
# This is work-around for a bug in kerberos >= 1.8 that prevents java
# programs from reading from the ticket cache. It's harmless to do it
# unconditionally - as long as we sleep first, in case kerberos is
# configured to prevent ticket renewal. If the two kinit calls are
# too close together, the -R can succeed when it shouldn't, and end
# up expiring the ticket.
sleep 1
kinit -R
fi
}
# SHOULD NOT BE USED DIRECTLY OUTSIDE OF THIS FILE.
# Helper function to report a CM specific status code. Expects the CM status
# code to report and the exit code to exit with.
__cm_report_status_and_exit_with_code() {
if [ $# -ne 2 ]; then
echo "expected 2 arguments - CM status code and exit code" 1>&2
exit 1
fi
# Note that CM_STATUS_CODES is injected into the env by the agent.
for code in $CM_STATUS_CODES; do
if [ "$code" == "$1" ]; then
# Output the error in the format
# "CM_STATUS_CODE=<value>" as the last line of the stderr stream. Note
# that this format and writing to stderr is important since the agent will
# otherwise not be able to extract this error code and pass it along to
# CM.
echo CM_STATUS_CODE=$code 1>&2
exit $2
fi
done
echo "Unexpected CM error code: $1" 1>&2
exit 1
}
# Reports a CM specific status code and exits with error i.e. with exit code 1.
cm_error_and_exit() {
# Suppress tracing for this function so that the below script does not show up
# in the error logs shown to users.
#
# Not suppressing the tracing would require making the agent's parsing code
# more complex and sub-optimal (since more text will need to be searched).
# Additionally, there is a loop in this code (in the helper function being
# invoked below) which can cause a lot of text to be output to the error log
# as the number of enum values increases.
if [ $# -ne 1 ]; then
echo "expected 1 argument - CM status code to report" 1>&2
exit 1
fi
__cm_report_status_and_exit_with_code $1 1
}
# Report a CM specific status code and exit successfully i.e. with exit code 0.
cm_success_and_exit() {
# Suppress tracing for this function so that the below script does not show up
# in the error logs shown to users.
#
# Not suppressing the tracing would require making the agent's parsing code
# more complex and sub-optimal (since more text will need to be searched).
# Additionally, there is a loop in this code (in the helper function being
# invoked below) which can cause a lot of text to be output to the error log
# as the number of enum values increases.
set +xv
if [ $# -ne 1 ]; then
echo "expected 1 argument - CM status code to report" 1>&2
exit 1
fi
__cm_report_status_and_exit_with_code $1 0
}
replace_hive_hbase_jars_template() {
# - hive-hbase storage handler jar is same in CDH4 and CDH5
# - hbase jars are different for CDH4 and CDH5
# - hbase/hbase.jar is needed for CDH4 and
# - hbase/hbase-server.jar, hbase/hbase-client.jar, hbase/hbase-protocol.jar, hbase/lib/htrace-core-*.jar is needed for CDH5
HIVE_HBASE_JAR=$(find $CDH_HIVE_HOME/lib -name "hive-hbase-handler-*.jar" 2> /dev/null | tail -n 1)
if [[ "$FILE" == "hive-site.xml" ]]; then
HBASE_JAR=$(echo ${HBASE_JAR} | sed "s:,:,file\:\/\/:g")
fi
if [[ -n $HIVE_HBASE_JAR && -n $HBASE_JAR ]]; then
if [[ "$FILE" == "hive-site.xml" ]]; then
# file:// prefix is required when specifying jars in hive.aux.jars.path in hive-site.xml
perl -pi -e "s#{{HIVE_HBASE_JAR}}#file://$HIVE_HBASE_JAR,file://$HBASE_JAR#g" $CONF_DIR/$FILE
else
perl -pi -e "s#{{HIVE_HBASE_JAR}}#$HIVE_HBASE_JAR,$HBASE_JAR#g" $CONF_DIR/$FILE
fi
elif [[ -d $CDH_HBASE_HOME ]]
then
echo "ERROR: Failed to find hive-hbase storage handler jars to add in $FILE. Hive queries that use Hbase storage handler may not work until this is fixed."
fi
}
skip_if_tables_exist() {
if [ -z $1 ]; then
echo "Must call with the name of the db properties file."
exit 1
fi
DB_INFO_FILENAME=$1
JDBC_JARS="$CLOUDERA_MYSQL_CONNECTOR_JAR:$CLOUDERA_POSTGRESQL_JDBC_JAR:$CLOUDERA_ORACLE_CONNECTOR_JAR"
if [[ -z "$CMF_SERVER_ROOT" ]]; then
JDBC_JARS_CLASSPATH="/usr/share/cmf/lib/*:$JDBC_JARS"
else
JDBC_JARS_CLASSPATH="$CMF_SERVER_ROOT/lib/*:$JDBC_JARS"
fi
if [[ "$?" -ne 0 ]]; then
echo "Failed to count existing tables."
exit 1
fi
if [[ "$NUM_TABLES" -ne "0" ]]; then
echo "Database already has tables. Skipping table creation."
exit 0
fi
}
# When created, the final resting place of config files is unknown,
# so it is marked as {{CMF_CONF_DIR}}. We know what this directory will
# be here in this script, so search-replace it.
replace_conf_dir() {
echo "CONF_DIR=$CONF_DIR"
echo "CMF_CONF_DIR=$CMF_CONF_DIR"
# Exclude files that we don't want to be modified. (OPSAPS-37023)
EXCLUDE_CMF_FILES=('cloudera-config.sh' 'httpfs.sh' 'hue.sh' 'impala.sh' 'sqoop.sh' 'supervisor.conf' '*.log' '*.keytab' '*jceks')
find $CONF_DIR -type f ! -path "$CONF_DIR/logs/*" $(printf "! -name %s " ${EXCLUDE_CMF_FILES[@]}) -exec perl -pi -e "s#{{CMF_CONF_DIR}}#$CONF_DIR#g" {} \;
}
# Turn on the execute bit for .sh and .py files.
make_scripts_executable() {
find $CONF_DIR -regex ".*\.\(py\|sh\)$" -exec chmod u+x {} \;
}
EXCLUDE_CMF_FILES=('cloudera-config.sh' 'httpfs.sh' 'hue.sh' 'impala.sh' 'sqoop.sh' 'supervisor.conf' '*.log' '*.keytab' '*jceks')
find $CONF_DIR -type f ! -path "$CONF_DIR/logs/*" $(printf "! -name %s " ${EXCLUDE_CMF_FILES[@]}) -exec perl -pi -e "s#{{CMF_CONF_DIR}}#$CONF_DIR#g" {} \;
}
# Turn on the execute bit for .sh and .py files.
make_scripts_executable() {
find $CONF_DIR -regex ".*\.\(py\|sh\)$" -exec chmod u+x {} \;
}
# Replace {{PID}} in the heap dump path with the process pid
# See OPSAPS-22106
replace_pid() {
echo $@ | sed "s#{{PID}}#$$#g"
}
# Append a line to the catalina.properties file. For Tomcat this is
# effectively the same as passing the property in as a -D jvm arg.
# This works because we create the tomcat deployment directory upon
# each startup.
tomcat_set_prop() {
if [ -z "${CATALINA_PROPERTIES}" ]; then
if [ ! -e "${CATALINA_BASE}" ]; then
echo "Can't find Catalina Base ${CATALINA_BASE}"
exit 1
fi
CATALINA_PROPERTIES="${CATALINA_BASE}/conf/catalina.properties"
if [ ! -e "${CATALINA_PROPERTIES}" ]; then
echo "Error: can't find ${CATALINA_PROPERTIES}"
exit 1
fi
fi
echo "$@" >> "${CATALINA_PROPERTIES}"
}
# Add Hadoop native library folder to java library path
set_hadoop_native_library_path() {
if [ -d "${CDH_HADOOP_HOME}/lib/native" ]; then
if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
JAVA_LIBRARY_PATH="${JAVA_LIBRARY_PATH}:${CDH_HADOOP_HOME}/lib/native"
else
JAVA_LIBRARY_PATH="${CDH_HADOOP_HOME}/lib/native"
fi
fi
}
# Enable tracing.
set -x
| true |
d63b143baf562d20278982cb97e448cfc2f3e84c | Shell | kuychaco/CCF | /samples/apps/txregulator/clients/run_demo.sh | UTF-8 | 539 | 2.765625 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT"
] | permissive | #!/bin/bash
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
if [ "$#" -eq 0 ]; then
echo "No args given - specify file to be loaded"
exit 1
fi
datafile=$1
python3 "../samples/apps/txregulator/clients/loader.py" "-b" "." "--label" "lua_logging_client_test" "-l" "info" "-g" "../src/runtime_config/gov.lua" \
--app-script ../samples/apps/txregulator/app/txregulator.lua --lua-script ../samples/apps/txregulator/app/checker.lua --datafile "$datafile" --run-poll 1>>transactions.log
| true |
dd190d6ccac678e62700f6e281af5183d66cd11b | Shell | alexandrefelipemuller/shesfw | /zenity_interface.sh | UTF-8 | 584 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | # This function prints error message. And if second arg is exit, exit from jopen
function print_error() {
zenity --error --text "$1";
[ "$2" == "exit" ] && finish 1;
}
function print_msg() {
zenity --info --title "$PROJECT_NAME" --text "$1";
}
function get_entry() {
export $2=$(zenity --entry --text "$1");
}
function get_list() {
export $1=$(echo "$4" | zenity --list --text "$2" --column "$3");
}
function progress ()
{
zenity --progress --title "$PROJECT_NAME" --text "$1";
}
interface_yesno() {
if zenity --question --text "$1"; then
return 0;
else
return 1;
fi
}
| true |
f21ea8da71ae8776abd35b74b6da3b830e91a246 | Shell | smith-chem-wisc/SnpEff | /scripts_build/OLD/uploadDevelopmenVersion.sh | UTF-8 | 943 | 3.3125 | 3 | [] | no_license | #!/bin/bash -e
#------------------------------------------------------------------------------
# Create a zip file for distribution
# Note: Only binary data is included (no raw gene info / genomes)
#
# Pablo Cingolani 2010
#------------------------------------------------------------------------------
source `dirname $0`/config.sh
# Make JAR files
`dirname $0`/make.sh
# Create tmp dir
DIR=snpEff_$SNPEFF_VERSION
rm -rvf $DIR snpEff
mkdir $DIR
# Copy core files
cp -vf snpEff.config snpEff.jar SnpSift.jar $DIR
cp -rvf galaxy scripts $DIR
cd $DIR
rm -rvf `find . -name "CVS" -type d`
cd -
# Change name to 'snpEff' (so that config file can be used out of the box)
mv $DIR snpEff
# Create 'core' zip file
ZIP="snpEff_development.zip"
rm -f $ZIP 2> /dev/null
zip -r $ZIP snpEff
#---
# Upload to ZIP file
#---
# Core program
echo
echo "Upload $ZIP"
scp $ZIP pcingola,snpeff@frs.sourceforge.net:/home/frs/project/s/sn/snpeff/
| true |
13a35bedf712edf6493cfc1b8a6a6cef96062107 | Shell | Rosstail/spaceship-race | /resources/sync_dojo_jars.sh | UTF-8 | 1,989 | 4.125 | 4 | [] | no_license | #!/bin/bash
FTP_SERVER='ftp://dojouser:codingDoj0@51.91.98.27/spaceships/'
BASE=$(dirname $0)
DOWNLOAD_DIR=$BASE/students
function help() {
cat <<EOF
Usage: $0 -a action -i artefact_id
-a|--action download / upload. If download all other students jar will be downloaded.
-j|--jar Path to the local Student jar.
-i|--artefactid Name of the artefact id without the extension (e.g. Student78).
EOF
}
#if [[ $# -ne 2 ]]; then
#echo "Invalid arguments"
#exit 1
#fi
while [[ $# -gt 0 ]]; do
KEY="$1"
case $KEY in
-h|--help)
DISPLAY_HELP=true
;;
-a|--action)
ACTION=$2
shift
;;
-i|--artefactid)
ARTEFACT_ID=$2
shift
;;
-j|--jar)
LOCAL_JAR_FILE=$2
shift
;;
*)
;;
esac
shift
done
if [[ $DISPLAY_HELP ]]; then
help
exit 0
fi
case $ACTION in
upload|download) VALID_ACTION=true;;
*);;
esac
if [[ -z $VALID_ACTION ]]; then
echo "Invalid action=$ACTION"
help
exit 1
fi
if [[ -z $ARTEFACT_ID ]]; then
echo "Invalid artefactid=$ARTEFACT_ID"
help
exit 1
fi
if [[ -z $LOCAL_JAR_FILE ]]; then
echo "Invalid artefactid=$ARTEFACT_ID"
help
exit 1
fi
STUDENT_JAR=$(basename $LOCAL_JAR_FILE)
echo $STUDENT_JAR
if [[ $ACTION = "download" ]]; then
for F in $(curl --list-only $FTP_SERVER); do
if [[ $F = $STUDENT_JAR ]]; then
echo "Skipping student jar $F"
continue
fi
if [[ ! $F = *.jar ]]; then
echo "Skipping unknown file"
continue
fi
echo "Downloading $F to $DOWNLOAD_DIR/$F"
curl --insecure $FTP_SERVER$F -o $DOWNLOAD_DIR/$F
done
fi
if [[ $ACTION == "upload" ]]; then
echo "Uploading student jar $STUDENT_JAR"
curl --insecure -T $LOCAL_JAR_FILE $FTP_SERVER$STUDENT_JAR
fi
| true |
badf4e674d8d878395b0266a74437cbcb8b575fd | Shell | cristeab/utils | /bash/.bashrc | UTF-8 | 2,045 | 3.265625 | 3 | [] | no_license | # Bash cursor is modified to show git branch status.
# From sample .bashrc for SuSE Linux
# Copyright (c) SuSE GmbH Nuernberg
# There are 3 different types of shells in bash: the login shell, normal shell
# and interactive shell. Login shells read ~/.profile and interactive shells
# read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all
# settings made here will also take effect in a login shell.
#
# NOTE: It is recommended to make language settings in ~/.profile rather than
# here, since multilingual X sessions would not work properly if LANG is over-
# ridden in every subshell.
# Some applications read the EDITOR variable to determine your favourite text
# editor. So uncomment the line below and enter the editor of your choice :-)
#export EDITOR=/usr/bin/vim
#export EDITOR=/usr/bin/mcedit
# For some news readers it makes sense to specify the NEWSSERVER variable here
#export NEWSSERVER=your.news.server
# If you want to use a Palm device with Linux, uncomment the two lines below.
# For some (older) Palm Pilots, you might need to set a lower baud rate
# e.g. 57600 or 38400; lowest is 9600 (very slow!)
#
#export PILOTPORT=/dev/pilot
#export PILOTRATE=115200
test -s ~/.alias && . ~/.alias || true
alias cdw='cd ~/C++/ebookreader'
alias simu='matlab -nodisplay -nosplash -nodesktop -nojvm'
alias youtrack='java -Xmx512m -Djava.awt.headless=true -jar /home/bogdan/Soft/youtrack/youtrack-4.2.4.jar 1025'
alias xcp='xclip -selection clipboard'
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
return 0
fi
echo -e " [$gitver]"
}
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
if git diff --quiet HEAD 2>/dev/null >&2
then
color="${c_green}"
else
color=${c_red}
fi
else
return 0
fi
echo -ne $color
}
PS1='\u@\h:\w\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]> '
| true |
32ded89b4c9b1c3981af3aa9ce55c9497fe76021 | Shell | coupdair/fwrite | /mfwrite.sh | UTF-8 | 402 | 3.453125 | 3 | [] | no_license | #!/bin/bash
fwrite=fwrite.MacOSX
fwrite=fwrite.linux32
fwrite=fwrite.linux64
#fwrite=fwriteS.exe
start=1
end=10
size=64
start=$1
end=$2
size=$3
digit=4
totalSize=`echo $size*$end-$size*$start+$size*1 | bc`
echo Writing $totalSize MByte '(i.e. >'`echo $totalSize/1024 | bc`' GByte)'
for((i=start;i<end+1;i++))
do
echo $size | ./$fwrite
mv file.txt file_`printf %0$digit'd' $i`
sleep 0.1
done
| true |
71cf583e656f368085a5c565ae5caf852aefd07c | Shell | jbermudo/IBM | /IBM Cognitive Build v.2/upgrade-chaincode.sh | UTF-8 | 1,574 | 3.25 | 3 | [] | no_license | #!/bin/bash
#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#
# Exit on first error
set -e
if [ -z "$4" ];
then
echo "Syntax : ./upgrade-chaincode.sh <org index> <peer index> <chaincode name> <chaincode version>"
echo "Example: ./upgrade-chaincode.sh 1 0 blue-coin 1.0"
exit 1
fi
ORG_INDEX=$1
PEER_INDEX=$2
CHAINCODE_NAME=$3
CHAINCODE_VERSION=$4
#don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1
CC_RUNTIME_LANGUAGE=node
CHANNEL_NAME=mychannel
docker exec -e "CORE_PEER_LOCALMSPID=Org${ORG_INDEX}MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org${ORG_INDEX}.example.com/users/Admin@org${ORG_INDEX}.example.com/msp" cli${PEER_INDEX}.org${ORG_INDEX} peer chaincode upgrade -o orderer.example.com:7050 -C $CHANNEL_NAME -n $CHAINCODE_NAME -l "$CC_RUNTIME_LANGUAGE" -v $CHAINCODE_VERSION -c '{"Args":[]}' -P "OR ('Org1MSP.member','Org2MSP.member','Org3MSP.member')" --collections-config /opt/gopath/src/github.com/$CHAINCODE_NAME/private-data-config/private-data.yml
#docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp" cli0.org1 peer chaincode upgrade -o orderer.example.com:7050 -C $CHANNEL_NAME -n blue-coin -v 2.0 -c '{"Args":[]}' -P "OR ('Org1MSP.member','Org2MSP.member','Org3MSP.member')"
echo Upgrade of chaincode $CHAINCODE_NAME $CHAINCODE_VERSION TO $CHAINCODE_NAME is complete.
| true |
bca6dca87e118db5dc39c7b36419a762c19da151 | Shell | sergueik/springboot_study | /basic-ucd/related_resource_report.sh | UTF-8 | 2,127 | 3.46875 | 3 | [] | no_license | #!/bin/bash
# reports one to many resource association
# e.g. components added to specific agent
# the path of the parent resource serves like the foreign key
if [[ -z "${DEBUG}" ]] ; then
echo 'DEBUG was not set explicitly, default is false'
DEBUG='false'
fi
echo "DEBUG=${DEBUG}"
DATA_FILE=/tmp/a.json
cat <<EOF>$DATA_FILE
[
{
"id": "1122334455-ffff-aaaa-bbbb-10101010",
"path": "/TEST/host1.domain_use_agent_name",
"active": true,
"prototype": false,
"name": "host1.domain_use_agent_name",
"description": "ucd agent on host1",
"hasAgent": true,
"status": "ONLINE",
"type": "agent",
"tags": []
},
{
"id": "1122334455-ffff-aaaa-bbbb-10101010",
"path": "/TEST/host2.domain_use_agent_name",
"active": true,
"prototype": false,
"name": "host2.domain_use_agent_name",
"description": "ucd agent on host2",
"hasAgent": true,
"status": "ONLINE",
"type": "agent",
"tags": []
}
]
EOF
UCD_URL=https://localhost:8443
# read -sp 'Enter user: ' USERNAME
# read -sp 'Enter password: ' PASSWORD
# AUTHENTICATION="-u $USERNAME:$PASSWORD"
RESULT1_JSON=/tmp/b.json
RESULT_FILE=/tmp/c.txt
RESOURCE_NAME='dummy'
# NOTE: .name,.path will produce two lines
cat $DATA_FILE |jq '.[]|.name + "\" \"" + .path'| while read $RESOURCE_NAME, $RESOURCE_PATH ; do
if [[ "${DEBUG}" = 'true' ]] ; then
# NOTE: $RESULT1_JSON will be overwritten in every iteration
curl -k $AUTHENTICATION "${UCD_URL}/cli/resource/?parent=${RESOURCE_PATH}" jq '.' | tee $RESULT1_JSON > /dev/null
curl -k $AUTHENTICATION "${UCD_URL}/cli/resource/?parent=${RESOURCE_PATH}" jq -cd '.[]|.name'
fi
# collect all linked resourses - will filter later
# like to prefix every result row with the
# $RESOURCE_NAME
# NOTE: not using the $RESOURCE_PATH:
# that column can be quote long
# compose the extra columnt by jq, csv style:
$QUERY=".[]|\"$RESOURCE_NAME\"+ \",\" .name"
curl -k $AUTHENTICATION "${UCD_URL}/cli/resource/?parent=${RESOURCE_PATH}" jq -cd "${QUERY}" | tee $RESULT_FILE > /dev/null
done
echo "Raw sample data in ${}"
echo "Results in ${}"
| true |
0eefac8707f4b41a21555b1b399c8722270320b5 | Shell | mikemolter/StudyDesigner | /.bash_profile | UTF-8 | 1,101 | 2.53125 | 3 | [] | no_license | # Change command prompt
if [ -f $(brew --prefix)/etc/bash_completion/ ]; then
. $(brew --prefix)/etc/bash_completion
fi
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
alias V="cd ~/Vagrants"
alias SD="cd ~/Vagrants/apache/StudyDesigner"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export PIP_REQUIRE_VIRTUALENV=true
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/projects
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export VIRTUALENVWRAPPER_LOG_DIR="$WORKON_HOME"
export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME"
source /usr/local/bin/virtualenvwrapper.sh
| true |
1b3059b878440b6f7baeb7a85afa6fe95fdb7e4b | Shell | weidongcao/bigdata | /src/script/shell/linux_command/function/function_repo.sh | UTF-8 | 880 | 4.0625 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# 《Linux命令行与Shell脚本编程大全》第17章 创建函数
# 17.6 创建库
# Page 370
# 在用到这些函数的脚本文件中包含function_repo.sh库文件是不行的
# 问题出在Shell函数的作用域上
# 和环境变量一样,Shell函数仅在定义它的Shell会话内有效。
# 如果你在Shell命令行界面的提示符下运行function.repo.sh 脚本,
# shell会创建一个新的shell并在其中运行这个脚本
# 它会为建仓新Shell定义这三个函数,但当你运行另外一个要用到这些函数时,它们是无法使用的。
# 这同样适用于脚本。如果你尝试像普通脚本文件那样运行库文件,函数决不会出现在脚本中。
function addem {
echo $[ $1 + $2 ]
}
function multem {
echo $[ $1 * $2 ]
}
function divem {
if [ $2 -ne 0 ]
then
echo $[ $1 / $2 ]
else
echo -1
fi
}
| true |
453cff631eaa8f8865b7d9e3cf78c492c2739a49 | Shell | alindeman/multi_test | /test/run | UTF-8 | 286 | 3.34375 | 3 | [] | no_license | #!/bin/bash
result="$(bundle exec ruby -I$1 $2)"
status=$?
if [[ $result != "" ]]; then
echo
echo "=> FAIL: Expected empty output but was:"
echo "--$result--"
exit 1
fi
if [[ $status -ne 0 ]]; then
echo
echo "=> FAIL: Expected zero exit status"
exit 1
fi
echo "=> PASS"
| true |
52085e85a87150812c6c56872c66ff4cbb8d66f3 | Shell | kawing-ho/dotfiles | /.bash_aliases | UTF-8 | 3,051 | 2.640625 | 3 | [] | no_license | # EDITOR of choice
export EDITOR=vim
export BROWSER=firefox
# Ignore the following commands in history
export HISTIGNORE="clear:pwd:df:du:stat:file:shutdown:history:which:man:ls:nano:vim"
#Extra aliases
alias c='clear'
alias u='cd ..'
alias nan='nano'
alias uu='cd .. ; cd ..'
alias cls='clear;ls'
alias sl='ls'
alias pls='pwd;ls'
alias build='gcc -Wall -Werror -O -o'
alias rm='rm -i'
alias g="egrep"
alias rg='egrep -r'
alias gdb='gdb -q'
alias du="du -h"
alias df="df -h"
alias bc='bc -q'
alias vat="vimcat"
alias up="uptime -p"
alias src="source ~/.bashrc"
alias vimrc="vim ~/.vimrc"
alias bashrc="vim ~/.bash_aliases"
alias tmux="env TERM=screen-256color tmux"
alias logout="gnome-session-quit"
alias lock="xdg-screensaver lock"
alias blank="xset dpms force off"
alias op='xdg-open'
alias tf="terraform"
alias tfa="terraform apply -auto-approve"
alias tftest="terraform apply -auto-approve -var-file=testing.tfvars"
alias tfdest="terraform destroy -auto-approve -var-file=testing.tfvars"
alias tfstate="terraform state list"
alias tfv="terraform validate"
alias pingg='timeout 5 ping 8.8.8.8'
alias wifirestart="sudo service network-manager restart"
alias dnsclean="sudo /etc/init.d/dns-clean"
alias onz='source ./*env*/bin/activate'
alias nnao="nano"
alias nao="nano"
alias bim="vim"
alias car="cat"
alias ld="ls"
alias guardup="sudo ~/Public/lp-guard-debian.sh"
alias guarddown="sudo ~/Public/lp-guard-debian.sh -down"
# Security things
alias disas="objdump -M intel -d"
alias disar="objdump -R"
alias offaslr='setarch `uname -m` -R /bin/bash'
alias aquatone="aquatone -chrome-path /opt/google/chrome-linux/chrome"
alias dirsearch="python3 ~/tools/dirsearch/dirsearch.py"
alias sqlmap="python3 ~/tools/sqlmap-dev/sqlmap.py"
alias linkfinder="python3 ~/tools/LinkFinder/linkfinder.py"
alias dirs="dirsearch"
alias aqautone="aquatone"
alias testssl="~/tools/testssl.sh/testssl.sh --color=3 "
alias burp="xargs -P 10 -n 1 curl -k -x http://127.0.0.1:8080/"
alias smuggler="python3 ~/tools/smuggler/smuggler.py"
alias vhostbrute="python3 ~/tools/vhostbrute/vhostbrute.py"
alias vimcolors='ls ~/.vim/colors/'
#reverse IP lookup
revip() {
curl "https://api.hackertarget.com/reverseiplookup/?q=$1"
echo ""
}
#highlight function
highlight() {
grep -E --color "$1|$" "$2"
}
zzdns() {
cat "$1" | zdns A | g -v NX | jq ".name"
}
# cut a line from a file (eg. cl 18 hello.txt)
cl() {
sed "$1q;d" $2
}
cpl() {
sed "$1q;d" $2 | tr -d '\n' | xclip -sel clip
}
alias hl="highlight"
alias xc="xclip -sel clip"
# LESS COLORS
export LESS_TERMCAP_mb=$'\E[01;92m'
export LESS_TERMCAP_md=$'\E[01;94m' #Headings
export LESS_TERMCAP_me=$'\E[01:31m' # wut
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;93m' # Constants (less of this color)
# set remote host PS1 to different one
if [ -n "$SSH_CLIENT" ]
then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]\[\033[01;35m\]@\h\[\033[00m\]: \[\033[04;35m\]\w\[\033[00m\] \$ '
fi
| true |
ef5ded23d362bbb3bce498e3797ea5b15aebbd1c | Shell | 18200643032/extrem | /apps/sdk_package/performance/authorization.sh | UTF-8 | 1,149 | 2.6875 | 3 | [] | no_license | #/bin/bash
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
chmod +x install
if [ -e vas_3.4.gz ]; then
./install vas_3.4.gz &
else
./install vas_4.1.gz &
fi
if [ -e /usr/local/ev_sdk/bin/test ]; then
cd /usr/local/ev_sdk/bin
chmod +x ev_license
./ev_license -r r.txt
./ev_license -l privateKey.pem r.txt license.txt
cp /usr/local/ev_sdk/bin/license.txt /usr/local/vas/license.txt
a=`cat license.txt|sed 's/{"license":"\(.*\)","version":7}/\1/g'`
sed -i "s/license=/license=$a/g" local.conf
sed -i 's/version=/version=7/g' local.conf
else
cp /usr/local/ev_sdk/3rd/license/bin/ev_license /usr/local/ev_sdk/authorization
cd /usr/local/ev_sdk/authorization
chmod +x ev_license
./ev_license -r r.txt
./ev_license -l privateKey.pem r.txt license.txt
cp /usr/local/ev_sdk/authorization/license.txt /usr/local/vas/license.txt
a=`cat license.txt|sed 's/{"license":"\(.*\)","version":7}/\1/g'`
sed -i "s/license=/license=$a/g" local.conf
sed -i 's/version=/version=7/g' local.conf
fi
bash /usr/local/vas/vas_stop.sh
bash /usr/local/vas/vas_start.sh & | true |
d7ecc08b0e5079d9b226b2076feec720e88f7910 | Shell | azecoder/Parallel-Programming-cpp | /experiment.sh | UTF-8 | 885 | 2.9375 | 3 | [] | no_license | echo ""
echo "Remove Results Folder"
echo ""
make clean
echo ""
echo "Create Results Folder"
echo ""
mkdir results
echo ""
echo "Build Cpp Codes"
echo ""
make all
echo ""
echo ""
echo ""
echo "Start: SEQUENTIAL"
echo ""
./seq.o 100000 > results/seq.txt
echo ""
echo "Finished: SEQUENTIAL"
echo ""
echo ""
echo "Start: PARALLEL"
echo ""
for nw in 1 2 4 8 12 16 20 24 32 40 48 56 64
do
./par.o 100000 $nw
done > results/par.txt
echo ""
echo "Finished: PARALLEL"
echo ""
echo ""
echo "Start: FF PARALLEL FOR"
echo ""
for nw in 1 2 4 8 12 16 20 24 32 40 48 56 64
do
./par_fastflow.o 100000 $nw
done > results/par_fastflow.txt
echo ""
echo "Finished: FF PARALLEL FOR"
echo ""
echo ""
echo "Start: OMP"
echo ""
for nw in 1 2 4 8 12 16 20 24 32 40 48 56 64
do
./par_openmp.o 100000 $nw
done > results/par_openmp.txt
echo ""
echo "Finished: OMP"
echo ""
echo "" | true |
371900c6007dee84a82850c80b3c6a22f2cda355 | Shell | partycloud/scripts | /create-snapshot | UTF-8 | 147 | 3.015625 | 3 | [] | no_license | #!/bin/bash
set -eo pipefail
if [[ $# -ne 1 ]]; then
echo "Usage : $0 volume"
exit -1
fi
aws ec2 create-snapshot --volume-id $1 \
| jq '.'
| true |
11985ccf53fbfd244d329128c6fab8f59deef666 | Shell | likelinux/LearnPHP | /course/course | UTF-8 | 3,143 | 4.15625 | 4 | [] | no_license | #!/bin/bash
fname=names.dat
tmpfile=/tmp`basename $0`.$$
pause()
{
echo -e "Hit <ENTER> to continue: \c "
read junk
}
yesno()
{
read $yn junk
case $yn in
y|Y|yes|Yes|YES)
return 0;;
n|N|no|No|NO)
return 1;;
*)
echo -e Please answer Yes or No. ;;
esac
#done
}
usage()
{
script=$1
shift
echo "Usage: `basename $script` $*" 1>&2
exit 2
}
quit()
{
code=$1
if yesno "Do you really wish to exit"
then
exit $code
fi
}
heading()
{
echo "First Name Surname Address Phone Number Pin Code"
echo "==========================================================================="
}
print_records()
{
sort -t : | while read aline
do
echo $aline | awk -F : '{printf("%-14.14s%-16.16s%-20.20s%-15.15s%-10.10s\n", $1, $2, $3, $4, $5)}'
done
}
do_create()
{
while :
do
while :
do
clear
echo -e "Please enter the following contact details:"
echo
echo -e "Given name: "
read name
echo
echo -e "Surname: "
read surname
echo
echo -e "Address: "
read address
echo
echo -e "Phone Number: "
read phone
echo
echo -e "Pin Nunber: "
read pin
clear
echo "You entered the following contact details:"
echo "Given Name: $name"
echo "Surname: $surname"
echo "Address: $address"
echo "Phone Number: $phone"
echo "Pin Number: $pin"
echo
if yesno Are these details correct
then
echo $name:$surname:$addrss:$phone:$pin >> $fname
break
fi
done
yesno Create another record || break
done
}
do_view()
{
clear
(
heading
cat $fname | print_records
) | more
echo
echo Thers are `cat $fname | wc -l` contacts in the database
}
do_search()
{
echo "Please enter pattern to search for (ENTER fo all): "
read string
echo
if grep "$string" $fname > /dev/null
then
(
heading
grep "$string" $fname | print_records
) | more
return 0
else
echo -e " Sorry, no records in file \"$fname\" contains \"$string\""
return 1
fi
}
do_delete()
{ do_search && yesno "\niDelete All these records" || retrn
if [ "$string" = "" ]
then
> $fname
echo "All records deleted from the file \"$fname\""
else
sed "/$string/d" $fname >> $tmpfile
mv $tmpfile $fname
echo "All records containing text \"$string\" deleted from file \"$fname\""
fi
}
trap "quit 3" 2 3
trap "exit 0" 1 15
[ $# == 1 ] || usage $0 filename
fname=$1
if [ ! -f $fname ]
then
echo $1 does not exist
if yesno "create it"
then
> $fname
if [ ! -v $fname ]
then
echo $1 could not be created
exit 2
fi
else
exit 0
fi
elif [ ! -w $fname ]
then
echo Could not open $1 for writing
exit 2
fi
while true
do
clear
echo -e "\n\t\tSHELL PROGRAMMING DATABASE"
echo -e "\t\t\tMAIN MENU"
echo -e "\nWhat do you wish to do?\n"
echo -e "\t1. Create records"
echo -e "\t2. View records"
echo -e "\t3. Search for records"
echo -e "\t4. Delete records that match a pattern"
echo
echo "Answer ( or q to quit ) ? "
read ans junk
case $ans in
1) do_create;;
2) do_view;;
3) do_serach;;
4) do_delete;;
q*|Q*) quit 0;;
*) echo -e "Please entee a number between 1 and 4";;
esac
done
| true |
1c5ff7436f0a9ae514bc08b12ad1e7fff66c6d9f | Shell | RajdeepRao/ParallelComputing | /Assignment6/queue_heat.sh | UTF-8 | 896 | 3.25 | 3 | [] | no_license | #!/bin/sh
. ./params.sh
if [ ! -d ${RESULTDIR} ];
then
mkdir ${RESULTDIR}
fi
#strong scaling
for POWER in ${POWERS};
do
for N in ${NS};
do
for PROC in ${PROCS}
do
FILE=${RESULTDIR}/heatEquation_${N}_${POWER}_${PROC}
if [ ! -f ${FILE} ]
then
qsub -d $(pwd) -q mamba -l procs=${PROC} -v N=${N},POWER=${POWER},PROC=${PROC} ./run_heat.sh
fi
done
done
done
#weak scaling
for POWER in ${POWERS};
do
for N in ${NS};
do
for PROC in ${PROCS}
do
REALN=$( echo "sqrt ( ${PROC} )*${N}" | bc -l);
REALN=$(printf "%.0f" ${REALN})
REALN=$(( ${REALN}-(( ${REALN} % ${PROC} )) ))
FILE=${RESULTDIR}/heatEquation_${REALN}_${INTENSITY}_${PROC}
if [ ! -f ${FILE} ]
then
qsub -d $(pwd) -q mamba -l procs=${PROC} -v N=${REALN},POWER=${POWER},PROC=${PROC} ./run_heat.sh
fi
done
done
done
| true |
8f41b545f4d3a2812241ad853fbe7f1faf1587e6 | Shell | rhoegg/javajobs | /setup.sh | UTF-8 | 622 | 2.796875 | 3 | [] | no_license | #!/bin/bash
yes | grails upgrade
if [ ! -e web-app/js/yui ] ; then
grails install-plugin yui
fi
if [ ! -e grails-app/conf/StarkSecurityConfig.groovy ] ; then
grails install-plugin stark-security
fi
grails stark-security-install-full
ROLES="ROLE_SUPER_USER ROLE_RECRUITER"
LIST="ANONYMOUS"
for ROLE in $ROLES ; do
CONSTANTS="$CONSTANTS static final $ROLE = '$ROLE';"
LIST="$LIST , $ROLE"
done
sed -i bak -e "s/\/\/ static final ADMIN_USER = 'ROLE_ADMIN_USER'/$CONSTANTS/" grails-app/domain/Role.groovy
sed -i bak -e "s/\[ ANONYMOUS \]/[ $LIST ]/" grails-app/domain/Role.groovy
rm grails-app/domain/*.groovybak
| true |
4df8dd285c43dd07b44022a820e29e1d9af0fdb4 | Shell | patrickdeyoreo/dotfiles | /bashrc.d/truecolor | UTF-8 | 2,026 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env bash
set8f ()
{
: "\\[\\e[38;2;$((16#$1));$((16#$2));$((16#$3))m\\]${*:4}"
printf '%s' "${_@P}" "$(tput sgr0)" $'\n'
}
set8b ()
{
: "\\[\\e[48;2;$((16#$1));$((16#$2));$((16#$3))m\\]${*:4}"
printf '%s' "${_@P}" "$(tput sgr0)" $'\n'
}
set8f_from_colors_dict ()
{
local REPLY
while IFS=$' \t\n' read -r -a REPLY
do
if (( ${#REPLY[@]} == 4 ))
then
set8f "${REPLY[@]::3}" "${REPLY[@]}"
fi
done
} 0< "${1:-${XDG_CONFIG_HOME:-${HOME}/.config}/colors/dict/rgb-hex.txt}"
set8f_colors_random ()
{
local COLUMNS="$(( ($(tput cols) - 8) / 3 ))"
local REPLY=( )
local TIMEOUT="$((${TIMEOUT:-0}))"
local _r="$((${r:-$((RANDOM%128+128))}%256))"
local _g="$((${g:-$((RANDOM%128+128))}%256))"
local _b="$((${b:-$((RANDOM%128+128))}%256))"
local r="${_r}"
local g="${_g}"
local b="${_b}"
local i
local j
local k
set -- \
"$((${1:-RANDOM}%256))" \
"$((${2:-RANDOM}%256))" \
"$((${3:-RANDOM}%256))" \
"${4:-The quick brown fox jumps over the lazy dog}" ${4:+"${@:5}"}
while (( i++ < 256 ))
do
while (( j++ < 256 ))
do
while (( k++ < 256 ))
do
set8f \
"$(printf '%02x' "${r}")" \
"$(printf '%02x' "${g}")" \
"$(printf '%02x' "${b}")" \
"$(printf '#%02x%02x%02x:' "${r}" "${g}" "${b}")" \
"${@:4}"
: "$((r = (r+g) % 256, g = (g+b) % 256, b = (b+r) % 256))"
done
: "$((r = (r+b) % 256, g = (g+r) % 256, b = (b+g) % 256))"
done
: "$((r = (r+$1) % 256, g = (g+$2) % 256, b = (b+$3) % 256 ))"
done 1> >(
while read -r 'REPLY[0]' && read -r 'REPLY[1]' && read -r 'REPLY[2]'
do
printf "%-${COLUMNS}s\t%-${COLUMNS}s\t%-${COLUMNS}s\n" "${REPLY[@]@P}"
read -r -u 3 -t "${TIMEOUT}"
REPLY=( )
done 3<> <(:)
)
}
| true |
92d370c95573a629a526c1552a1855400cad4a11 | Shell | esra-polat/operating-systems-course-project | /my-shell-1/myprog2.sh | UTF-8 | 912 | 3.765625 | 4 | [] | no_license | path=$1
c_program_files=$path/cprogs
#check the accuracy of the path
if [ ! -d $path ]; then
echo Given path is not a directory or not found
echo "Press a key. . .";
read
exec ./Menu.sh
fi
#if there is argument of path
if [ $path ]; then
mkdir -p $c_program_files
mv *.c $c_program_files #moving the files into path+cprogs
echo " "
echo A directory named cprogs is created under $path
echo " "
echo All the files whose name ends with .c in $path are moved into cprogs directory
echo " "
else
#if there is not argument
mkdir -p cprogs
mv *.c cprogs #maving the files into cprogs
echo " "
echo A directory named cprogs is created under current working directory.
echo " "
echo All the files whose name ends with .c in the current working directory are moved into cprogs directory.
echo " "
fi
echo "Press a key. . .";
read
exec ./Menu.sh
| true |
fe382e075b1309bf89a9f23832b6cd952a2183f2 | Shell | ilventu/aur-mirror | /dosbox-svn/PKGBUILD | UTF-8 | 1,799 | 2.859375 | 3 | [] | no_license | # Contributor: Jose Valecillos <valecillosjg (at) gmail (dot) com>
pkgname=dosbox-svn
pkgver=3786
pkgrel=1
pkgdesc="An emulator with builtin DOS for running DOS Games"
arch=('i686' 'x86_64')
url="http://dosbox.sourceforge.net/"
license=('GPL')
groups=()
depends=('sdl_net' 'sdl_sound' 'libgl' 'libpng' 'alsa-lib' 'gcc-libs')
makedepends=('subversion')
provides=('dosbox')
conflicts=('dosbox')
replaces=()
backup=()
options=()
source=('dosbox.desktop' 'dosbox-16.png' 'dosbox-48.png' 'dosbox-128.png')
install=dosbox.install
noextract=()
md5sums=('eac69b50c2d7b34503a97cb521fe21ff'
'4b26bcedfc56e4ef390ee4c66a774827'
'b49ff452861ba1118f06cf5421878636'
'c48983033ba1ad1f742577b5df5d8ae6')
_svntrunk="https://dosbox.svn.sourceforge.net/svnroot/dosbox/dosbox/trunk"
_svnmod="trunk"
build() {
cd "$srcdir"
if [ -d $_svnmod/.svn ]; then
(cd $_svnmod && svn up -r $pkgver)
else
svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
fi
msg "SVN checkout done or server timeout"
msg "Starting make..."
rm -rf "$srcdir/$_svnmod-build"
cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
cd "$srcdir/$_svnmod-build"
#
# BUILD
#
msg "Building and installing..."
chmod +x autogen.sh
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc/dosbox
make
}
package() {
cd "$srcdir/$_svnmod-build"
make DESTDIR="${pkgdir}" install
# Fix invalid permissions FS#10732
chmod 755 "${pkgdir}"/usr/share/man/man1
# Install desktop files and icon
for _i in 16 48 128; do
install -D -m644 $srcdir/dosbox-$_i.png "$pkgdir"/usr/share/icons/hicolor/${_i}x${_i}/apps/dosbox.png
done
install -D -m644 $srcdir/dosbox.desktop "$pkgdir"/usr/share/applications/dosbox.desktop
msg "Removing build directory..."
cd "$srcdir"
rm -Rf ${_svnmod}-build
}
| true |
6b21b7c8f98807dce002329b5e6921c56c9f312c | Shell | javenfang/dotfiles | /system/path.zsh | UTF-8 | 1,520 | 3.359375 | 3 | [
"MIT"
] | permissive | function command_exists() {
command -v "$@" > /dev/null 2>&1
}
if command_exists lsb_release ; then
os="$(lsb_release -si)"
fi
# set default
: ${os:=""}
# perform some very rudimentary platform detection
if command_exists lsb_release; then
os="$(lsb_release -si)"
fi
if [ -z "$os" ] && [ -r /etc/lsb-release ]; then
os="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
fi
if [ -z "$os" ] && [ -r /etc/debian_version ]; then
os='debian'
fi
if [ -z "$os" ] && [ -r /etc/fedora-release ]; then
os='fedora'
fi
if [ -z "$os" ] && [ -r /etc/oracle-release ]; then
os='oracleserver'
fi
if [ -z "$os" ] && [ -r /etc/centos-release ]; then
os='centos'
fi
if [ -z "$os" ] && [ -r /etc/redhat-release ]; then
os='redhat'
fi
if [ -z "$os" ] && [ -r /etc/photon-release ]; then
os='photon'
fi
if [ -z "$os" ] && [ -r /etc/os-release ]; then
os="$(. /etc/os-release && echo "$ID")"
fi
if [ -z "$os" ] && [[ "$(uname -s)" == "Darwin" ]]; then
os="osx"
fi
os="$(echo "$os" | cut -d " " -f1 | tr '[:upper:]' '[:lower:]')"
# Special case redhatenterpriseserver
if [ "${os}" = "redhatenterpriseserver" ]; then
# Set it to redhat, it will be changed to centos below anyways
lsb_dist='redhat'
fi
export -f command_exists >/dev/null 2>&1
export OS=$os
export GOPATH="$HOME/.golang"
export PATH="/usr/local/opt/coreutils/libexec/gnubin:${GOPATH}/bin/:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
| true |
660979ef682a677a7cb9d597b536fc6d72082516 | Shell | snowbeauti/cloudstudy | /scripts/setup_mongodb.azcli | UTF-8 | 1,637 | 2.84375 | 3 | [] | no_license | #!/bin/bash
#1. Deploy Linux VM(Ubuntu 20.04 LTS), vmmongodb
#2. copy PEM file to WSL /home/tony/.ssh
#3. Adding inbound port for mongodb 27017
#4. Install NodeJS
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs build-essential
#5. GitHub Source Cloning
git clone https://github.com/microsoft/MCW-Cloud-native-applications.git /home/tony/GitSources
#6. Copy Source
cp -r /home/tony/GitSources/Hands-on\ lab/lab-files/infrastructure/content-init/ /home/tony/
#7. Install Mongo DB for Ubuntu 1804
#wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
#echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
#echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
#sudo apt-get install -y mongodb-org
sudo apt-get update
sudo apt-get install -y mongodb
sudo mongod --version
#sudo vi /etc/mongod.conf --> BindIP에 사설 IP 추가, "127.0.0.1,10.0.2.4"
sudo sed -i 's/127.0.0.1/127.0.0.1,10.0.2.4/g' /etc/mongodb.conf
sudo service mongodb start
sudo service mongodb status
#sudo systemctl start mongod
#sudo systemctl status mongod
#sudo systemctl stop mongod
#8. MongoDB에 샘플 데이터 넣기
cd /home/tony/content-init
sudo npm install
sudo node server.js
#9. MongoDB 샘플 데이터 확인 (터미널에서)
mongo
show dbs
use contentdb
show collections
db.speakers.find()
db.sessions.find()
quit() | true |
d61f23bcd1d1fb1fbadab00b78562c7d6d7649bf | Shell | ntd/luasyslog | /autogen.sh | UTF-8 | 328 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/bin/sh
#
# Just a wrapper around autoreconf to generate the configuration
# scripts after a fresh repository clone/checkout.
#
# This script does *not* call configure (as usually done in other
# projects) because this would prevent VPATH builds.
autoreconf -is -Wall
printf "Now run configure to customize your building\n"
| true |
04f0d7baf181305c0d4389e504f27ed0ffafe88c | Shell | cms-sw/cmssw-config | /SCRAM/hooks/runtime/00-modulemap | UTF-8 | 620 | 3.28125 | 3 | [] | no_license | #!/bin/bash
if [ "${SCRAM}" = "" ] ; then SCRAM=scram ; fi
if [ "$(${SCRAM} tool info root 2>&1 | grep '^CXXMODULES+=' | sed 's|.*=||')" != "1" ] ; then
exit 0
fi
CXXMODULES_DIR="include/${SCRAM_ARCH}/cxxmodules"
MODULEMAP_FILE="module.modulemap"
BASE_DIR="${LOCALTOP}"
for bdir in ${LOCALTOP} ${RELEASETOP} ; do
if [ -f "${bdir}/${CXXMODULES_DIR}/${MODULEMAP_FILE}" ] ; then
BASE_DIR="${bdir}"
break
fi
done
echo "RUNTIME:variable:CMSSW_CLING_MODULEMAP_FILE=${BASE_DIR}/${CXXMODULES_DIR}/${MODULEMAP_FILE}"
echo "RUNTIME:path:prepend:CLING_MODULEMAP_FILES=${BASE_DIR}/${CXXMODULES_DIR}/${MODULEMAP_FILE}"
| true |
2f348ad508b5d71fb05baba0dbda218bbda6e46b | Shell | Jcch94/cheatsheet | /site/ci_scripts/demo-terraform.sh | UTF-8 | 1,523 | 3.515625 | 4 | [] | no_license | #!/bin/bash
if [ $1 == "dev" ];then
suffix="-dev"
folder="dev"
fi
# get terraform scripts from S3
# create ECS & ECR
echo "Job Terraform plan *******<><><><><><><><><><><><>**********"
echo $IMAGE_NAME$suffix
aws s3 cp s3://$S3_BUCKET_NAME/TERRAFORM_INFRA "TERRAFORM_INFRA" --recursive --exclude ".sh" --exclude ".md"
cd $TERRAFORM_DIR/$folder
echo 'key="PROD/APP/'$IMAGE_NAME$suffix'.dsldemo.site.tfstate"' > app-prod.config
echo 'bucket="terraform-fargate-cluster"' >> app-prod.config
echo 'region="ap-southeast-1"' >> app-prod.config
awk '!/ecs_service_name/' production.tfvars > tmpfile && mv tmpfile production.tfvars
awk '!/environment/' production.tfvars > tmpfile && mv tmpfile production.tfvars
awk '!/docker_container_port/' production.tfvars > tmpfile && mv tmpfile production.tfvars
echo "ecs_service_name = \"$IMAGE_NAME$suffix\"" >> production.tfvars
echo "environment = \"$folder\"" >> production.tfvars
echo "docker_container_port = $DEMOSITE_DOCKER_CONTAINER_PORT" >> production.tfvars
cat app-prod.config
cat production.tfvars
terraform init -backend-config=app-prod.config
# plan
if [ $1 == "dev" ] && [ $2 != "destroy" ];then
terraform plan -var-file=production.tfvars -out "planfile_dev"
echo "Terraform Plan >> done"
fi
# destroy
if [ $2 == "destroy" ];then
terraform destroy -var-file=production.tfvars --auto-approve
echo "Terraform Destroy Plan >> done"
exit 0
fi
# apply
terraform apply -var-file=production.tfvars --auto-approve
echo "Terraform Apply >> done"
| true |
ec1f3d7b79aedbc720f022417fe89685a33bc31d | Shell | vrobert78/directus-template | /deploy.sh | UTF-8 | 413 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env bash
cd /app
set +e
npx directus database install &>/dev/null
if [ "$?" == "0" ] ; then
set -e
echo "Database installed"
ROLE=`npx directus roles create --name admin --admin`
echo "Creating administrator role"
npx directus users create --email admin@directus.com --password 123456 --role $ROLE
echo "Creating administrator user"
else
set -e
echo "Already initialized"
fi
| true |
66c42167fbe6964bd73652f52197812ad5c5fd3e | Shell | heycyril/shell_script | /soft_install/zookeeper_cluster.sh | UTF-8 | 2,632 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env bash
#设置完毕后,再每个节点上安装此脚本
#[使用设置]
#集群所有节点的ip
cluster_ip=(192.168.2.108 192.168.2.109)
#端口
port=2181
source script/zookeeper.sh
get_zookeeper_cluster() {
[ "$language" == "cn" ] && echo "不用下载" || echo "Do not download"
}
install_zookeeper_cluster() {
remove_zookeeper_cluster
[ -f ${install_dir}/${zookeeper_dir}/conf/zoo.cfg.dynamic ] || test_exit "请先安装zookeeper"
#配置文件
echo "clientPort=${port}
dataDir=${install_dir}/${zookeeper_dir}/data
syncLimit=5
tickTime=2000
initLimit=10
dataLogDir=${install_dir}/${zookeeper_dir}
dynamicConfigFile=${install_dir}/${zookeeper_dir}/conf/zoo.cfg.dynamic" > ${install_dir}/${zookeeper_dir}/conf/zoo.cfg
#输出配置
rm -rf ${install_dir}/${zookeeper_dir}/conf/zoo.cfg.dynamic
d=1
for i in `echo ${cluster_ip[*]}`
do
echo "server.${d}=${i}:2888:3888" >> ${install_dir}/${zookeeper_dir}/conf/zoo.cfg.dynamic
let d++
done
#id号
mkdir ${install_dir}/${zookeeper_dir}/data
id=`process_id`
echo "$id" > ${install_dir}/${zookeeper_dir}/data/myid
#监听ipv4,默认ipv6
sed -i '150c "-Dzookeeper.log.file=${ZOO_LOG_FILE}" "-Djava.net.preferIPv4Stack=true" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \/' ${install_dir}/${zookeeper_dir}/bin/zkServer.sh
#脚本
command=/usr/local/bin/man-zookeeper-cluster
rm -rf $command
echo "#!/bin/bash
${install_dir}/${zookeeper_dir}/bin/zkServer.sh" '$1' > $command
chmod +x $command
clear
echo "zookeeper-cluster" >> conf/installed.txt
if [ "$language" == "cn" ];then
echo "安装成功
安装目录:${install_dir}/${zookeeper_dir}
日志目录:${log_dir}/${zookeeper_dir}
启动:man-zookeeper-cluster start"
else
echo "install ok
Installation manual:${install_dir}/${zookeeper_dir}
Log directory:${log_dir}/${zookeeper_dir}
Start:man-zookeeper-cluster start"
fi
}
remove_zookeeper_cluster() {
man-zookeeper-cluster stop
rm -rf /usr/local/bin/man-zookeeper-cluster
test_remove zookeeper-cluster
[ "$language" == "cn" ] && echo "zookeeper_cluster卸载完成!" || echo "zookeeper_cluster Uninstall completed!"
}
info_zookeeper_cluster() {
if [ "$language" == "cn" ];then
echo "名字:zookeeper_cluster
版本:zookeeper
介绍:配置zookeeper集群
类型:服务
作者:http://www.52wiki.cn/docs/shell"
else
echo "Name:zookeeper_cluster
Version:zookeeper
Introduce:Configure the zookeeper cluster
Type: server
Author:http://www.52wiki.cn/docs/shell"
fi
}
| true |
4f472e27888fe84ceec36012c3b46126f78b6358 | Shell | samwhelp/play-ubuntu-18.04-plan | /plan/de-full/play-lxqt/prj/play-lxqt/app/usr/share/play-lxqt/sub/on/fcitx/func/conf_reset.sh | UTF-8 | 1,055 | 3 | 3 | [
"MIT"
] | permissive |
### Head: main #################################################################
#
fcitx_conf_reset () {
echo
echo "### Head: fcitx_conf_reset #####################################################"
echo "#"
fcitx_conf_reset_dir_create
fcitx_conf_reset_config
fcitx_conf_reset_im_config
echo "#"
echo "### Tail: fcitx_conf_reset #####################################################"
echo
}
#
### Tail: main #################################################################
### Head: fcitx ################################################################
#
fcitx_conf_reset_dir_create () {
echo "mkdir -p $HOME/.config/fcitx"
mkdir -p "$HOME/.config/fcitx"
}
fcitx_conf_reset_config () {
echo "cp $THE_SUB_ON_DIR_PATH/fcitx/conf/reset/profile $HOME/.config/fcitx/profile"
cp "$THE_SUB_ON_DIR_PATH/fcitx/conf/reset/profile" "$HOME/.config/fcitx/profile"
}
fcitx_conf_reset_im_config () {
echo
echo "im-config -n REMOVE"
im-config -n REMOVE
echo
}
#
### Tail: fcitx ################################################################
| true |
f4469f6046ea33d66f56a37502c4abd1dfd35ea9 | Shell | fourstepper/zimbra-czech-translation | /deploy.sh | UTF-8 | 4,437 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# Script, jehož funkcí je přidat soubory s překladem do českého jazyka v Zimbra Collaboration Server Open Source Edition (8.8.15) #
# Můžeme také nastavit důležité proměnné v konfiguraci serveru Zimbra (související se zobrazením implementovaného jazyka) #
echo ""
echo " ##################################################################################"
echo " ### ###"
echo " ### -- Cesky preklad pro Zimbru -- ###"
echo " ### ###"
echo " ### Zimbra Collaboration Server Open Source Edition (8.8.15) ###"
echo " ### ###"
echo " ### Autor: Jiricka Jakub Date: 04.09.2019 ###"
echo " ### Kontakt: info@root4u.cz ###"
echo " ### ###"
echo " ##################################################################################"
echo ""
num1=0
while [ $num1 == 0 ]
do
read -p "· Chcete implementovat cesky preklad na Zimbru? [A / N]:" INSTALACE;
if [ "$INSTALACE" == "A" ] || [ "$INSTALACE" == "a" ]; then
# Zmena prav a uzivatle k jazykovym souborum.
/bin/chmod 664 messages/*
/bin/chmod 664 keys/*
/bin/chown zimbra:zimbra messages/*
/bin/chown zimbra:zimbra keys/*
# Zkopírujeme jazykové soubory na jejich odpovídající místa.
cp -fp messages/* /opt/zimbra/jetty/webapps/zimbra/WEB-INF/classes/messages/
cp -fp keys/* /opt/zimbra/jetty/webapps/zimbra/WEB-INF/classes/keys/
cp -fp messages/* /opt/zimbra/jetty/webapps/zimbraAdmin/WEB-INF/classes/messages/
cp -fp keys/* /opt/zimbra/jetty/webapps/zimbraAdmin/WEB-INF/classes/keys/
# Přidejte localeName_cs_CZ = Czech do souborů ZmMsg_XX.properties jednotlivých jazyků.
for file1 in /opt/zimbra/jetty/webapps/zimbra/WEB-INF/classes/messages/ZmMsg_*;
do
echo "localeName_cs_CZ = Czech" >> $file1;
done
for file2 in /opt/zimbra/jetty/webapps/zimbraAdmin/WEB-INF/classes/messages/ZmMsg_*;
do
echo "localeName_cs_CZ = Czech" >> $file2;
done
# Zkopírujeme soubory nápovědy.
su - zimbra -c "cp -fpr /opt/zimbra/jetty/webapps/zimbra/help/en_US/ /opt/zimbra/jetty/webapps/zimbra/help/eu"
su - zimbra -c "cp -fpr /opt/zimbra/jetty/webapps/zimbraAdmin/help/en_US/ /opt/zimbra/jetty/webapps/zimbraAdmin/help/eu"
echo "";
echo " Jazyk byl spravne implementovan";
echo " Poznámka: V některých částech Zimbry, které jsou závislé na Zimlets, nemusí být uvedeným jazykem cestina. Preklad zimletu nespada do rozsahu tohoto projektu.";
echo "";
num1=1;
fi
if [ "$INSTALACE" == "N" ] || [ "$INSTALACE" == "n" ]; then
echo "";
echo " Instalace byla zrusena!";
echo "";
num1=1;
exit;
fi
done
num2=0
while [ $num2 == 0 ]
do
read -p "· Chcete nastavit cestinu jako výchozí jazyk pro všechny uživatele v rozhraní Zimbra? (Pokud používají výchozí CoS) [A / N]: " DEFAULT;
if [ "$DEFAULT" == "A" ] || [ "$DEFAULT" == "a" ]; then
# ZimbraPrefLocale jsme nastavili do cestiny
su - zimbra -c "zmprov mc default zimbraPrefLocale cz"
echo "";
echo " Nastavena cestina jako vychozi jazyk ve webovem rozhrani Zimbry";
echo " Poznámka: Pokud uživatel provede vlastní konfiguraci jazyka z jejich předvoleb, bude jejich volba nad výchozí konfigurací serveru.";
echo " Poznámka: Pokud je CoS vlastní / specifické pro vaše skupiny uživatelů, musíte je ručně změnit příkazem: 'zmprov mc NONMBRE_DE_TU_CoS zimbraPrefLocale cz'"
echo "";
num2=1;
fi
if [ "$DEFAULT" == "N" ] || [ "$DEFAULT" == "n" ]; then
echo "";
echo " Krok byl vynechán.";
echo "";
num2=1;
fi
done
num3=0
while [ $num3 == 0 ]
do
read -p "· Chcete-li nový jazyk zpřístupnit, musíte restartovat službu Zimbra. Chcete jej nyní restartovat? [A / N]: " RESTART;
if [ "$RESTART" == "A" ] || [ "$RESTART" == "a" ]; then
echo ""
echo " Restartování služby Zimbra. Tento proces může trvat pár minut ...";
echo ""
# Restartujeme sluzby
su - zimbra -c "zmcontrol stop";
sleep 10;
echo "";
su - zimbra -c "zmcontrol start";
sleep 10;
echo "";
echo " Služba Zimbra byla restartována. Instalace byla dokončena.";
echo "";
num3=1;
fi
if [ "$RESTART" == "N" ] || [ "$RESTART" == "n" ]; then
echo "";
echo " Rozhodli jste se vynechat službu RESTART služby Zimbra. Nezapomeňte, že nový jazyk nebude dostupný, dokud nebude služba Zimbra restartována.";
echo "";
num3=1;
fi
done | true |
727ca7fa6748999030311a6d66dceed7a055c921 | Shell | saidone75/vagralf-search | /vagralf-search.sh | UTF-8 | 3,168 | 3.609375 | 4 | [
"MIT"
] | permissive | #!/bin/bash
ALFRESCO_HOST=192.168.33.10
export ALFRESCO_HOST # used by sed later
ALF_DOWNLOAD_URL=https://download.alfresco.com/cloudfront/release/community/SearchServices/2.0.2/alfresco-search-services-2.0.2.zip
LOGFILE=/vagrant/vagralf-search.log
IFS=$'\n'
DEBUG=1
COLOUR=1
ALF_ZIP=$(sed s/^.*[\/]// <<< $ALF_DOWNLOAD_URL)
ALF_DIR="/opt/"$(sed 's/-[[:digit:]].*$//' <<< $ALF_ZIP)
export ALF_DIR #used by sed later
function info() {
for LINE in $1; do
if [ $COLOUR -eq 0 ]; then
echo "[I] $LINE"|tee -a $LOGFILE
else
echo -e "\033[0;32m[I]\033[0;370m $LINE" && echo "[I] $LINE" >> $LOGFILE
fi
done
}
function debug() {
for LINE in $1; do
if [ $DEBUG -eq 1 ]; then
if [ $COLOUR -eq 0 ]; then
echo "[D] $LINE"|tee -a $LOGFILE
else
echo -e "\033[0;33m[D]\033[0;370m $LINE" && echo "[D] $LINE" >> $LOGFILE
fi
fi
done
}
function fatal() {
for LINE in $1; do
if [ $COLOUR -eq 0 ]; then
echo "[F] $LINE"|tee -a $LOFGILE
else
echo -e "\033[0;31m[F]\033[0;370m $LINE" && echo "[F] $LINE" >> $LOGFILE
fi
exit 1
done
}
# update list of available packages
info "updating list of available packages"
apt update &> $LOGFILE
# install required packages
info "installing required packages"
apt install mg unzip openjdk-16-jre-headless --assume-yes &>> $LOGFILE
cd /vagrant
# download and unzip Alfresco search services
info "downloading Alfresco search services"
if [ ! -f $ALF_ZIP ]; then
wget $ALF_DOWNLOAD_URL &>> $LOGFILE
fi
unzip -o $ALF_ZIP -d /opt &>> $LOGFILE
info "configuring Alfresco search services"
# create solr group and user
groupadd solr
useradd -g solr solr
# tuning configuration
sed -r 's#^\#(SOLR_PID_DIR=).*$#printf "%s%s%s" "\1" $ALF_DIR "/var/run";#e' $ALF_DIR/solr.in.sh | sudo tee $ALF_DIR/solr.in.sh &>> $LOGFILE
sed '0,/^#GC_TUNE=.*/s/^#\(GC_TUNE=\).*$/\1\"\"/' $ALF_DIR/solr.in.sh | sudo tee $ALF_DIR/solr.in.sh &>> $LOGFILE
sed '0,/^#GC_LOG_OPTS=.*/s/^#\(GC_LOG_OPTS=.*$\).*$/\1/' $ALF_DIR/solr.in.sh | sudo tee $ALF_DIR/solr.in.sh &>> $LOGFILE
cp $ALF_DIR/solr.in.sh /etc/default/
sed -r 's#^(alfresco.host=).*$#printf "%s%s" "\1" $ALFRESCO_HOST;#e' $ALF_DIR/solrhome/templates/rerank/conf/solrcore.properties | sudo tee $ALF_DIR/solrhome/templates/rerank/conf/solrcore.properties &>> $LOGFILE
sed 's/^\(alfresco.secureComms=\).*$/\1none/' $ALF_DIR/solrhome/templates/rerank/conf/solrcore.properties | sudo tee $ALF_DIR/solrhome/templates/rerank/conf/solrcore.properties &>> $LOGFILE
mkdir $ALF_DIR/contentstore
mkdir -p $ALF_DIR/var/run
# set permission
chown -R solr:solr $ALF_DIR/solrhome
chown -R solr:solr $ALF_DIR/logs
chown -R solr:solr $ALF_DIR/contentstore
chown -R solr:solr $ALF_DIR/var
# init script
sed 's/^\(SOLR_INSTALL_DIR=\).*$/\1"\/opt\/alfresco-search-services\/solr"/' $ALF_DIR/solr/bin/init.d/solr | sudo tee /etc/init.d/solr &>> $LOGFILE
chmod 700 /etc/init.d/solr
update-rc.d solr defaults
update-rc.d solr enable
# Solr first start
info "starting Solr"
sudo -u solr $ALF_DIR/solr/bin/solr start -a "-Dcreate.alfresco.defaults=alfresco,archive"
| true |
b451293f03635c70a247135c804eedf302d42c8f | Shell | erm2wi/zoe-docker-images | /spawn_test_cluster.sh | UTF-8 | 1,085 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/sh
SWARM_MANAGER=10.1.0.1:2380
MASTER_IMAGE=zoerepo/spark-master
WORKER_IMAGE=zoerepo/spark-worker
SHELL_IMAGE=zoerepo/spark-shell
SUBMIT_IMAGE=zoerepo/spark-submit
WORKER_COUNT=3
WORKER_RAM=8g
WORKER_CORES=4
MASTER_ID=`docker -H $SWARM_MANAGER run -d $MASTER_IMAGE`
MASTER_IP=`docker -H $SWARM_MANAGER inspect --format '{{ .NetworkSettings.IPAddress }}' $MASTER_ID`
echo "Spark master is at $MASTER_IP"
for w in `seq $WORKER_COUNT`; do
docker -H $SWARM_MANAGER run -e SPARK_MASTER_IP=$MASTER_IP -e SPARK_WORKER_RAM=$WORKER_RAM -e SPARK_WORKER_CORES=$WORKER_CORES -d $WORKER_IMAGE
done
if [ "$1" == "--shell" ]; then
docker -H $SWARM_MANAGER run -i -t -e SPARK_MASTER_IP=$MASTER_IP -e SPARK_EXECUTOR_RAM=$WORKER_RAM $SHELL_IMAGE
fi
if [ "$1" == "--submit" ]; then
docker -H $SWARM_MANAGER run --rm -i -t -e SPARK_MASTER_IP=$MASTER_IP -e SPARK_EXECUTOR_RAM=$WORKER_RAM -e APPLICATION_URL=http://10.0.0.2/api/applications/binary/18 $SUBMIT_IMAGE /opt/submit.sh /apps/wordcount.py hdfs://192.168.45.157/datasets/gutenberg_big_2x.txt hdfs://192.168.45.157/tmp/cntwdc1
fi
| true |
10c01f7deb55e005dec03d595dde7022f978d59e | Shell | sgoranson/tmux-powerline | /themes/spg.sh | UTF-8 | 1,457 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # Default Theme
if patched_font_in_use; then
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="⮂"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="⮃"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="⮀"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="⮁"
else
TMUX_POWERLINE_SEPARATOR_LEFT_BOLD="◀"
TMUX_POWERLINE_SEPARATOR_LEFT_THIN="❮"
TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD="▶"
TMUX_POWERLINE_SEPARATOR_RIGHT_THIN="❯"
fi
TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR:-'16'}
TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR=${TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR:-'12'}
TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR:-$TMUX_POWERLINE_SEPARATOR_RIGHT_BOLD}
TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR=${TMUX_POWERLINE_DEFAULT_RIGHTSIDE_SEPARATOR:-$TMUX_POWERLINE_SEPARATOR_LEFT_BOLD}
# Format: segment_name background_color foreground_color [non_default_separator]
if [ $(hostname) = stankpad ]; then
TMUX_POWERLINE_HOST="hostname 2 0"
elif [ $(hostname) = stinkmyth ]; then
TMUX_POWERLINE_HOST="hostname 4 7"
else
TMUX_POWERLINE_HOST="hostname 1 7"
fi
if [ -z $TMUX_POWERLINE_LEFT_STATUS_SEGMENTS ]; then
TMUX_POWERLINE_LEFT_STATUS_SEGMENTS=(
"$TMUX_POWERLINE_HOST" \
"ifstat_sys 0 6" \
)
fi
if [ -z $TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS ]; then
TMUX_POWERLINE_RIGHT_STATUS_SEGMENTS=(
"cpu 2 0" \
"battery 5 0" \
"date 0 6 "\
"time 0 6 ${TMUX_POWERLINE_SEPARATOR_LEFT_THIN}" \
)
fi
| true |
d0daf9c60a3e927bc1dfb9c1ce6e976feaaad472 | Shell | jsavage3737/username | /username.sh | UTF-8 | 561 | 3.6875 | 4 | [] | no_license | #!/bin/bash
# username.sh
# Author: Jack Savage
echo "Welcome to the username program!"
echo "Your username must:"
echo "1) Contain only lower case letters, digits or underscore"
echo "2) Start with a lower case letter"
echo "3) Contain between 3 and 12 characters"
echo "Enter a valid username: "
read USRNM
while ! echo $USRNM | egrep "[a-z0-9_\-]+$" | egrep "^[a-z]" | egrep "^\w{3,12}$" > /dev/null 2>&1; do
echo "The username you submitted does not meet the rules stated above"
echo "Please try again! "
echo "Username:"
read USRNM
done
echo "Thank you"
| true |
f1ab365ef33f4b7fbb94391576b2efc6b2f8b221 | Shell | shipstar/dotfiles | /bin/ntimes | UTF-8 | 603 | 3.78125 | 4 | [
"MIT"
] | permissive | #!/bin/zsh
# Stolen from https://github.com/panozzaj/conf/blob/master/common/bin/ntimes
successes=0
failures=0
for ((n=0; n < $1; n++)); do
# run all arguments except for the count as new command
"${@:2}"
if [[ $? == 0 ]]; then
# no need to say success, that should be more common
successes=$[successes + 1]
else
failures=$[failures + 1]
say -v Zarvox -r400 "failed"
fi
echo -e "\nSuccesses: $successes"
echo -e "Failures: $failures\n"
done
sleep 1
if [[ 0 -eq $failures ]]; then
say -v Alex -r200 "Success!"
else
say -v Zarvox -r200 "At least some failed..."
fi
| true |
ac227557960901096ffeec6e958407045e753540 | Shell | CristinaAbba/LabDomestication_4C09Thesis | /RM_LOWQUALITY_SM.sh | UTF-8 | 376 | 3 | 3 | [] | no_license | #!/bin/bash
#Define variables
rmd_path=/4/cristina/sequence_analysis_sarah/rmd_data_SM
final_bam=/4/cristina/sequence_analysis_sarah/final_bam_SM
#For loop instructions
files=(${rmd_path}/*.rmd.bam)
for file in ${files[@]}
do
name=${file}
base=`basename ${name} .rmd.bam`
samtools view -q 20 -F 0x0004 -b ${rmd_path}/${base}.rmd.bam > ${final_bam}/${base}.final.bam
done
| true |
014f022263a192fa190ec7703ff3f15ddada02e9 | Shell | GRV96/BashTraining | /shoscri | UTF-8 | 930 | 4.28125 | 4 | [
"MIT"
] | permissive | #!/bin/bash
# Determines the shell used by a script according to its sha-bang.
# The name is short for "shell of script".
# Parameters
# $1: a filepath
# Output
# The script's shell's name
# Or "" if $1 is not a script (no sha-bang or not a file)
# or not readable
NO_SHELL=""
if [ ! -e $1 ] || [ ! -f $1 ] || [ ! -r $1 ]; then
echo $NO_SHELL
exit 1
fi
SHA_BANG_START="#!/bin/"
SH="sh"
BASH="bash"
CSH="csh"
KSH="ksh"
TCSH="tcsh"
ZSH="zsh"
shabang=`head -n 1 $1`
if [ -z "$shabang" ]; then
shell=$NO_SHELL
elif [ "$shabang" = "$SHA_BANG_START$SH" ]; then
shell=$SH
elif [ "$shabang" = "$SHA_BANG_START$BASH" ]; then
shell=$BASH
elif [ "$shabang" = "$SHA_BANG_START$CSH" ]; then
shell=$CSH
elif [ "$shabang" = "$SHA_BANG_START$KSH" ]; then
shell=$KSH
elif [ "$shabang" = "$SHA_BANG_START$TCSH" ]; then
shell=$TCSH
elif [ "$shabang" = "$SHA_BANG_START$ZSH" ]; then
shell=$ZSH
else
shell=$NO_SHELL
fi
echo $shell
| true |
3bc3ec3264a59eb8c934c270303f9b83e1eceaa1 | Shell | TrellixVulnTeam/Chromium_7C66 | /native_client_sdk/src/gonacl_appengine/src/bullet/build.sh | UTF-8 | 2,190 | 3.75 | 4 | [
"BSD-3-Clause"
] | permissive | #!/bin/bash
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -o nounset
set -o errexit
SCRIPT_DIR="$(cd $(dirname $0) && pwd)"
cd ${SCRIPT_DIR}
OUT_DIR=out
NACLPORTS_URL=https://chromium.googlesource.com/external/naclports.git
NACLPORTS_SHA=e53078c33d99b0b3cbadbbbbb92cccf7a48d5dc1
NACLPORTS_DIR=${OUT_DIR}/naclports
NACLAM_URL=https://github.com/johnmccutchan/NaClAMBase
NACLAM_DIR=${OUT_DIR}/NaClAMBase
NACLAM_SHA=0eb4647a3f99c6e66156959edc6c55d4a913468a
if [ -z "${NACL_SDK_ROOT:-}" ]; then
echo "-------------------------------------------------------------------"
echo "NACL_SDK_ROOT is unset."
echo "This environment variable needs to be pointed at some version of"
echo "the Native Client SDK (the directory containing toolchain/)."
echo "NOTE: set this to an absolute path."
echo "-------------------------------------------------------------------"
exit -1
fi
Banner() {
echo "######################################################################"
echo $*
echo "######################################################################"
}
# echo a command to stdout and then execute it.
LogExecute() {
echo $*
$*
}
Clone() {
local url=$1
local dir=$2
local sha=$3
if [ ! -d $dir ]; then
LogExecute git clone $url $dir
else
pushd $dir
LogExecute git fetch origin
popd
fi
pushd $dir
LogExecute git checkout $sha
popd
}
readonly OS_NAME=$(uname -s)
if [ $OS_NAME = "Darwin" ]; then
OS_JOBS=4
elif [ $OS_NAME = "Linux" ]; then
OS_JOBS=`nproc`
else
OS_JOBS=1
fi
Banner Cloning naclports
Clone ${NACLPORTS_URL} ${NACLPORTS_DIR} ${NACLPORTS_SHA}
Banner Building bullet
pushd ${NACLPORTS_DIR}
make NACL_ARCH=pnacl bullet
popd
Banner Cloning NaClAMBase
Clone ${NACLAM_URL} ${NACLAM_DIR} ${NACLAM_SHA}
Banner Building NaClAM
LogExecute cp Makefile ${NACLAM_DIR}
pushd ${NACLAM_DIR}
LogExecute make -j${OS_JOBS}
popd
LogExecute cp ${NACLAM_DIR}/pnacl/Release/NaClAMBullet.{pexe,nmf} ${OUT_DIR}
Banner Done!
| true |
098ed6ce62efe3c1734f29ee6c320bd7210eaf7c | Shell | dennisgyor/bin | /boot_clean.sh | UTF-8 | 1,394 | 4.25 | 4 | [] | no_license | #!/bin/bash
# Script to clean out the boot partition
# For Debian based systems only
# Exit script on error
set -e
#turn debugging on and off
#set -x
echo -e "Disk on the /boot partition is $(df -h /boot | awk ' /[0-9]/ {print $5}' ) full.\n"
echo -e "The current kernel version in use is $(uname -r)\n\nlist of older kernels installed in the boot partition: "
echo -------------------------BEGIN------------------------------
#build array from old kernel list
karray=$((sudo dpkg --list 'linux-image*' | awk '{ if ($1=="ii") print $2}' | grep -v $(uname -r) ) )
echo ${karray[@]} | tr " " "\n"
echo ---------------------------END------------------------------
echo
#debug to check array contents
#echo "Array contains ${karray[@]}"
#prompt user to remove old kernels
echo 'Remove all inactive kernels from the boot partition? Y/n'
read answer
# loop through and remove all old unused kernels to free up space
if [ "$answer" == 'Y' ] || [ "$answer" == 'y' ]; then
for i in "${karray[@]}"
do
sudo rm -f "/boot/$i"
echo deleting: $i | tr " " "\n"
done
#Clean up any old kernel packages
echo
echo 'Cleaning out old kernel packages:'
sudo apt-get autoremove
echo
echo -e "Disk on the /boot partition is now $(df -h /boot | awk ' /[0-9]/ {print $5}' ) full.\n"
else
echo 'Exiting script. Try running 'sudo apt-get clean' instead.'
fi
| true |
8bd4c8fdd16aa952159cf318924fad626650a32f | Shell | anujamjoshi/BASHSCRIPT | /script5_color.sh | UTF-8 | 225 | 3.265625 | 3 | [] | no_license | #!/bin/sh
echo Enter a color
read color
case $color in
bl* | Bl*)
echo the sky color is $color;
;;
"red" | "yellow")
echo the sun is sometimes this color
;;
*)
echo $color is not part of this category
esac
| true |
0fc267ef68d8f566f4640c2dd6195de3191e21b1 | Shell | sensor-dream/Fedora-post-Install | /www/httpd/vhost | UTF-8 | 19,342 | 3.640625 | 4 | [
"MIT"
] | permissive | #!/bin/env bash
# -*- coding: utf-8 -*-
## @File : virtual_hosts
## @Author : sensor-dream (sensor-dream@sensor-dream.ru)
## @Link : https://sensor-dream.ru
## @Date : 2018-12-8 09:38:33
#
# Декларируем имя файла
#
declare -rx www_virtual_hosts_script_source="$BASH_SOURCE"
if [[ -z "$main_run_script_path" ]]; then
declare -rx main_run_script_path="$(pwd)"
echo "Скрипт запускается из ${main_run_script_path}"
fi
#
# Подключаем общую библиотеку и общую конфигурацию
#
if [[ -z "${main_cfg_script_source}" ]]; then
check=1
while [[ "$check" -eq 1 ]]; do
if [[ ! -f 'main.cfg' ]]; then
if [[ "$(pwd)" != "/" ]]; then
cd ../
else
cd "${main_run_script_path}"
check=0
echo '\e[47;31m'"!!! Не найден общий файл конфигурации !!!\033[0m"
tput sgr0
exit 1
fi
else
check=0
if [[ -z "${main_cfg_script_source}" ]]; then
declare -rx main_project_path="$(pwd)"
. "${main_project_path}/main.cfg"
fi
cd "${main_run_script_path}"
fi
done
fi
echo_w "Подключаем $(readlink -m ${www_virtual_hosts_script_source})"
## check_root;
chk_sudo_root
if [[ -z "${www_initial_certbot_script_source}" ]]; then
. "${main_project_path}/www/initial_certbot"
fi
function create_virtual_host() {
local SERVER_SIGNATURE="${main_server_signature}"
local SERVER_SIGNATURE_VERSION="${main_server_signature_version}"
local SERVER_OS_VERSION="${main_server_os_version}"
local SERVER_TIME_ZONE="${main_local_zone}"
local SERVER_DEFAULT_CHARSET="${main_default_charset}"
local SERVER_CONTENT_LANGUAGE="${main_content_language}"
local SERVER_FULL_ORG_NAME="${main_full_org}"
local SERVER_HOST_NAME="${main_hostname}"
local SERVER_LOCAL_IP_DEVICE="${ip_device}"
local base_path="${main_www_base_path}"
local domain_list=""
local domain="${main_domain}"
local root_domain=''
local cert_root_domain=''
local domain_aliases=""
local domain_base_path=""
local domain_root_path=""
local len=0
local tmp=''
local OLDIFS="$IFS"
local result=''
local OPT=''
local key_remove=0
local erase_log_domain=0
local internet_connection="$(ping ${main_server_ping_host} -c 1 -W 1 | grep loss | awk -F, '{ print $3 }' | awk '{ print $1 }')"
if [[ "$internet_connection" == "100%" ]]; then
echo_w "No Internet connection. $internet_connection packet loss."
else
echo_n "Internet connection is ok. $internet_connection packet loss."
fi
OPTIND=1
while getopts "ue" OPT; do
case $OPT in
u) key_remove=1 ;;
e) erase_log_domain=1 ;;
*) ;;
esac
done
shift $(($OPTIND - 1))
# shift `expr $OPTIND - 1`;
[ "${1:-}" = "--" ] && shift
if [[ ! -d '/etc/letsencrypt' ]]; then
echo_m 'Not instal CERTBOT ( Not fin /etc/letsencrypt directory )'
exit 1
fi
if [[ -f '/etc/letsencrypt/isrgrootx.pem' && -s '/etc/letsencrypt/isrgrootx.pem' ]]; then
cp -f '/etc/letsencrypt/isrgrootx.pem' '/etc/letsencrypt/isrgrootx1.pem'
httpd -k graceful
fi
if [[ ! -f '/etc/letsencrypt/isrgrootx1.pem' || "$(file /etc/letsencrypt/isrgrootx1.pem | awk '{print $2}')" == "empty" ]]; then
rm '/etc/letsencrypt/isrgrootx.pem'
echo_w "Download https://letsencrypt.org/certs/isrgrootx1.pem.txt"
wget -q 'https://letsencrypt.org/certs/isrgrootx1.pem.txt' -O '/etc/letsencrypt/isrgrootx.pem'
fi
cat <<EOF > /dev/null
add_cron_job '@daily' "sh <<<'wget -q https://letsencrypt.org/certs/isrgrootx1.pem.txt -O /etc/letsencrypt/isrgrootx.pem; if [[ -f /etc/letsencrypt/isrgrootx.pem ]]; then cp -f /etc/letsencrypt/isrgrootx.pem /etc/letsencrypt/isrgrootx1.pem; httpd -k graceful; fi 2>&1' > /dev/null &" 'root'
EOF
if [[ -z "$domain" ]]; then
domain="$main_user.ru"
fi
[[ -z "$base_path" ]] && base_path="/var/www/html"
if [[ ! -d "$base_path" ]]; then
mkdir -p -m 775 "$base_path"
chown -R "$main_user".apache "$base_path"
fi
if [[ -n "$@" ]]; then
domain_list=($@)
else
domain_list=(${main_www_domain_list[*]})
fi
[[ ${#domain_list[*]} -eq 0 ]] && domain_list=("$main_domain")
# install_packages "mod_ssl mod_md mod_http2 mod_security certbot";
for i in ${!domain_list[*]}; do
domain=${domain_list[$i]}
if [[ -f "/etc/httpd/conf.d/$domain.conf" ]]; then
rm -f "/etc/httpd/conf.d/$domain.conf"
fi
if [[ -f "/etc/logrotate.d/$domain" ]]; then
rm -f "/etc/logrotate.d/$domain"
fi
if [[ -f "/etc/php-fpm.d/www.$domain.conf" ]]; then
rm -f "/etc/php-fpm.d/www.$domain.conf"
fi
done
if [[ -f "/etc/httpd/conf.d/MAIN_CONFIG_SERVER.conf" ]]; then
rm -f "/etc/httpd/conf.d/MAIN_CONFIG_SERVER.conf"
fi
echo_m "Delete all configurations files for domains ${domain_list[*]}"
result=$(httpd -t 2>&1)
if grep -q "OK" <<<$result; then
if [[ $(chk_active_service httpd) -eq 1 ]]; then
echo_m "Apply the pre configure configuration."
$(httpd -k graceful)
else
echo_w "Restart HTTPD server."
systemctl_start_services httpd
fi
echo_m "Pre configuration domains completed."
else
echo_w $result
echo_w "Выход :("
exit 1
fi
if [[ $key_remove -eq 1 ]]; then
exit 0
fi
if [[ ! -f "/etc/httpd/conf.d/MAIN_CONFIG_SERVER.conf" ]]; then
cat <<LOLS >'/etc/httpd/conf.d/MAIN_CONFIG_SERVER.conf'
##
## GLOBALs server configuration
##
## Must be installed: mod_ssl mod_md mod_http2 mod_security
##
<IfModule mod_status.c>
ExtendedStatus On
</IfModule>
#ProductOnly Server: Apache
#Major Server: Apache/2
#Minor Server: Apache/2.0
#Minimal Server: Apache/2.0.55
#OS Server: Apache/2.0.55 (Fedora)
#Full (or not specified) default Server: Apache/2.0.55 (Debian) PHP/5.1.2-1+b1 mod_ssl/2.0.55 OpenSSL/0.9.8b
#ServerTokens ProductOnly
#ServerTokens Full
#ServerTokens Minimal
ServerTokens OS
# On | Off | EMail
ServerSignature EMail
<IfModule mod_security2.c>
# SecServerSignature "$SERVER_SIGNATURE"
# SecServerSignature "$SERVER_SIGNATURE/$SERVER_SIGNATURE_VERSION"
SecServerSignature "$SERVER_SIGNATURE/$SERVER_SIGNATURE_VERSION ($SERVER_OS_VERSION)"
</IfModule>
<IfModule mod_md.c>
## MDomain $domain
## off|temporary|permanent
MDRequireHttps temporary
MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
</IfModule>
<IfModule mod_ident.c>
IdentityCheck Off
# Is default
IdentityCheckTimeout 30
</IfModule>
<IfModule mod_setenvif.c>
SetEnv TZ ${SERVER_TIME_ZONE}
# LogLevel:
# : emerg - экстренный – система не функционирует;
# : alert - ошибку необходимо немедленно исправить;
# : crit - критическая ошибка;
# : error – ошибка;
# : warn – предупреждение;
# : notice - уведомление (нормальное функционирование);
# : info - информационное сообщение;
# : debug - сообщение отладки.
LogLevel warn
BrowserMatch bot is_bot
SetEnvIf User-Agent bot Bot crawler Crawler monitor Monitor is_bot
SetEnvIf Remote_Addr ::1 127.0.0.1 ${ip_device} is_i
LogFormat "[ %{sec}t ]\nDate/time: %t\nHost: %h\nName of the remote host: %l\nFirst line of request: \"%r\"\nUser: %u\nUser-agent: \"%{User-agent}i\"\nReferer: \"%{Referer}i\"\nStatus code: %>s\nConnection status: %X\nBytes received: %I\nBytes sent: %O\nResponse size: %b\n" custom
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "[ %{sec}t ]\nDate/time: %t\nHost: %h\nName of the remote host: %l\nFirst line of request: \"%r\"\nUser: %u\nReferer: %{Referer}i -> %U\nStatus code: %>s\nConnection status: %X\n" referer
LogFormat "[ %{sec}t ]\nDate/time: %t\nHost: %h\nName of the remote host: %l\nFirst line of request: \"%r\"\nUser: %u\nUser-agent: %{User-agent}i\nStatus code: %>s\nConnection status: %X\n" agent
LogFormat "[ %{sec}t ]\nDate/time: %t\nHost: %h\nName of the remote host: %l\nFirst line of request: \"%r\"\nUser-agent: %{User-agent}i\nStatus code: %>s\nConnection status: %X\n" bot
</IfModule>
LOLS
echo_m "File /etc/httpd/conf.d/MAIN_CONFIG_SERVER.conf created."
fi
if ! grep -q "SSLStaplingCache" "/etc/httpd/conf/httpd.conf"; then
cat <<EOF >>"/etc/httpd/conf/httpd.conf"
# Устанавливаем местоположение SSL Stapling Cache и его время жизни
SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
EOF
fi
for i in ${!domain_list[*]}; do
domain=${domain_list[$i]}
domain_base_path=(${domain//./ })
len=${#domain_base_path[*]}
if [[ $len -gt 1 ]]; then
domain_root_path="$base_path/${domain_base_path[$len - 1]}/${domain_base_path[$len - 2]}"
root_domain="${domain_base_path[$len - 2]}.${domain_base_path[$len - 1]}"
if [[ ! -f "/etc/letsencrypt/live/$root_domain/fullchain.pem" ]]; then
generate_wildcard_certificate_for_main_domain -- "$root_domain"
fi
if [[ ${len} -eq 3 && ! -f "/etc/letsencrypt/live/${domain}/fullchain.pem" ]]; then
echo_w -n "Создать wildcard для домена ${domain} (n) (y/n): "
read key
if [[ $(validate_reply ${key}) -eq 1 ]]; then
generate_wildcard_certificate_for_main_domain -- "${domain}"
fi
fi
if [[ $len -eq 2 ]]; then
domain_aliases="www.$domain"
domain_root_path="$domain_root_path/root"
domain_base_path="root"
else
domain_aliases="$domain"
unset domain_base_path[$len-1]
unset domain_base_path[$len-2]
IFS="."
domain_base_path="${domain_base_path[*]}"
IFS="$OLDIFS"
domain_root_path="$domain_root_path/$domain_base_path"
fi
if [[ ! -d "$domain_root_path" ]]; then
mkdir -p -m 775 "$domain_root_path"
# mkdir -p -m 775 "$domain_root_path/www";
cp -r "$main_project_path/www/www_def" "$domain_root_path/www"
mkdir -p -m 775 "$domain_root_path/logs/statistics"
mkdir -p -m 775 "$domain_root_path/logs/nginx"
mkdir -p -m 775 "$domain_root_path/logs/unit"
mkdir -p -m 775 "$domain_root_path/cgi-bin"
mkdir -p -m 775 "$domain_root_path/tmp"
chown -R ${main_user}.apache "$domain_root_path"
# set_permission "$domain_root_path/logs"
fi
if [[ $erase_log_domain -eq 1 ]]; then
rm -f $domain_root_path/logs/*.log.*
truncate -c -s 0 $domain_root_path/logs/*.log
set_permission -r -u root -g root $domain_root_path/logs
fi
echo "Домен $len уровня"
echo "Основной домен $root_domain"
echo "Название хранилища: $domain_base_path"
echo "Корневая директория: $domain_root_path"
echo "WWW директория: $domain_root_path/www"
echo "TEMP директория: $domain_root_path/tmp"
echo "LOGS директория: $domain_root_path/logs"
echo "Статистика логов директория: $domain_root_path/logs/statistics"
echo "CGI директория: $domain_root_path/cgi-bin"
rm -f /etc/logrotate.d/${root_domain}
cat <<LOG >"/etc/logrotate.d/$domain"
#
# Generate file: /etc/logrotate.d/$domain of logrotates
# Date generate: $(date);
#
$domain_root_path/logs/*.log {
missingok
notifempty
sharedscripts
# compress
# delaycompress
nocompress
daily
copytruncate
maxsize 0.5M
rotate 10
dateext
postrotate
/bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
endscript
}
LOG
cert_root_domain="${domain}"
if [[ "${cert_root_domain}" != "${root_domain}" ]]; then
while [[ ! -e "/etc/letsencrypt/live/${cert_root_domain}" && "${cert_root_domain}" != "${root_domain}" || -z "${cert_root_domain}" ]]; do
cert_root_domain=${cert_root_domain#*.}
done
fi
[[ ${#cert_root_domain} -eq 0 ]] && cert_root_domain="${root_domain}"
echo_n "Домен ${domain}. Сертификат домена ${cert_root_domain}"
cat <<EOF >"/etc/httpd/conf.d/$domain.conf"
#
# Generate file: $domain.conf of $virtual_hosts_script_source
# Date generate: $(date);
<VirtualHost *:${main_apache_server_http_port} [::]:${main_apache_server_http_port}>
AddDefaultCharset ${SERVER_DEFAULT_CHARSET}
# Default TimeOut 60
TimeOut 320
<IfModule mod_http2.c>
Protocols h2c http/1.1
</IfModule>
SuexecUserGroup apache apache
DocumentRoot $domain_root_path/www
ServerName $domain
ServerAlias $domain_aliases
ServerAdmin $main_email
UseCanonicalName Off
DirectoryIndex index.php
CustomLog $domain_root_path/logs/custom.log custom "expr=( -z reqenv('is_bot') && -z reqenv('is_i'))"
CustomLog $domain_root_path/logs/referer.log referer "expr=( -z reqenv('is_bot') && -z reqenv('is_i'))"
CustomLog $domain_root_path/logs/agent.log agent "expr=( -z reqenv('is_bot') && -z reqenv('is_i'))"
CustomLog $domain_root_path/logs/bot.log bot "expr=( -n reqenv('is_bot') && -z reqenv('is_i'))"
# not workers :(
# CustomLog $domain_root_path/logs/custom.log custom env=[!is_bot,!is_i]
# CustomLog $domain_root_path/logs/referer.log referer env=[!is_bot,!is_i]
# CustomLog $domain_root_path/logs/agent.log agent env=[!is_bot,!is_i]
# CustomLog $domain_root_path/logs/bot.log bot env=[is_bot,!is_i]
ErrorLog $domain_root_path/logs/error.log
TransferLog $domain_root_path/logs/access.log
<Directory $domain_root_path/www>
Options -MultiViews -Indexes -ExecCGI +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 ${ip_device}
## <If "req('Host') != '$domain' || %{HTTPS} == 'off'">
<If "%{HTTPS} == 'off'">
Redirect permanent / https://$domain/
## Redirect / https://$domain/
</If>
Header set Server-Host "$HOSTNAME"
</VirtualHost>
<VirtualHost *:${main_apache_server_https_port} [::]:${main_apache_server_https_port}>
AddDefaultCharset ${SERVER_DEFAULT_CHARSET}
# Default TimeOut 60
TimeOut 320
<IfModule mod_http2.c>
Protocols h2 http/1.1
</IfModule>
SuexecUserGroup apache apache
DocumentRoot $domain_root_path/www
ServerName $domain
ServerAlias $domain_aliases
ServerAdmin $main_email
UseCanonicalName Off
DirectoryIndex index.php
FileETag MTime Size
CustomLog $domain_root_path/logs/ssl_custom.log custom "expr=( -z reqenv('is_bot') && -z reqenv('is_i'))"
CustomLog $domain_root_path/logs/ssl_referer.log referer "expr=( -z reqenv('is_bot') && -z reqenv('is_i'))"
CustomLog $domain_root_path/logs/ssl_agent.log agent "expr=( -z reqenv('is_bot') && -z reqenv('is_i'))"
CustomLog $domain_root_path/logs/ssl_bot.log bot "expr=( -n reqenv('is_bot') && -z reqenv('is_i'))"
# not workers :(
# CustomLog $domain_root_path/logs/ssl_custom.log custom env=[!is_bot,!is_i]
# CustomLog $domain_root_path/logs/ssl_referer.log referer env=[!is_bot,!is_i]
# CustomLog $domain_root_path/logs/ssl_agent.log agent env=[!is_bot,!is_i]
# CustomLog $domain_root_path/logs/ssl_bot.log bot env=[is_bot,!is_i]
ErrorLog $domain_root_path/logs/ssl_error.log
TransferLog $domain_root_path/logs/ssl_access.log
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder on
# SSLCipherSuite PROFILE=SYSTEM
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLCompression off
SSLOptions +StrictRequire
SSLStrictSNIVHostCheck off
SSLProxyProtocol all -SSLv3 -SSLv2
SSLProxyCipherSuite PROFILE=SYSTEM
SSLCertificateFile /etc/letsencrypt/live/${cert_root_domain}/cert.pem
SSLCertificateChainFile /etc/letsencrypt/live/${cert_root_domain}/chain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/${cert_root_domain}/privkey.pem
# following directive when using client certificate authentication
SSLCACertificateFile /etc/letsencrypt/isrgrootx1.pem
SSLUseStapling on
<Files ~ "\.(cgi|shtml|phtml|php3|php?)$">
SSLOptions +StdEnvVars
</Files>
<Directory $domain_root_path/www>
Options -MultiViews -Indexes -ExecCGI +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory "$domain_root_path/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
<IfModule mod_lua.c>
<Files "*.lua">
SetHandler lua-script
</Files>
</IfModule>
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 ${ip_device}
BrowserMatch "MSIE [2-5]" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0 gzip-only-text/html
<ifmodule mod_header.c>
RequestHeader edit Destination '^https: http: early:'
Header always set Server-Host "$HOSTNAME"
Header always set Cache-Control "no-store, no-cache, must-revalidate, max-age=0, s-maxage=10, no-transform, proxy-revalidate"
### HTTP-methods GET, POST, HEAD, CONNECT, OPTIONS, PUT, DELETE, TRACE, TRACK, PATCH
Header always set Access-Control-Allow-Methods "GET, POST, HEAD, CONNECT, OPTIONS, PUT"
Header always set Content-Language "${SERVER_CONTENT_LANGUAGE}"
Header always set Title "${SERVER_FULL_ORG_NAME}"
Header always set Host "${SERVER_HOST_NAME}"
# Disable content sniffing, since it's an attack vector.
Header always set X-Content-Type-Options nosniff
# Disable Proxy header, since it's an attack vector.
RequestHeader unset Proxy
</ifmodule>
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
<IfModule mod_security2.c>
# <Directory "$domain_root_path/www">
# SecRuleEngine Off
SecRequestBodyAccess Off
# SecRuleInheritance Off
# SecFilterEngine Off
# SecFilterScanPOST Off
# </Directory>
</IfModule>
</VirtualHost>
EOF
create_name_in_hosts_file "${domain}"
echo_m "Configuration domain: $domain completed."
result=$(httpd -t 2>&1)
echo_w "$result"
if grep -q "OK" <<<$result; then
if [[ $(chk_active_service httpd) -eq 1 ]]; then
echo_m "Apply the new configuration."
$(httpd -k graceful)
else
echo_w "Restart HTTPD server."
systemctl_start_services httpd
fi
echo_n "Configuration domains completed."
chk_status_OCSP_Stapling "127.0.0.1:${main_apache_server_https_port}"
else
echo_w $result
echo_w "Выход :("
exit 1
fi
sleep 1
else
echo_w "Domain \`$domain\` of the first level, not applicable."
fi
done
}
create_virtual_host $@
| true |
9b0749e37178cc61902048b7c1811d717982b97d | Shell | rastanton/WGS-QC-Assembly-Pipelines | /Kraken_Assembly_Krona.sh | UTF-8 | 856 | 2.78125 | 3 | [] | no_license | #!/bin/bash -l
# Makes a basepair waited Kraken output from a .fna file
# Usage: bash Kraken_Assembly_Local_Krona.sh My_File.fna
k=$1
kraken --threads 12 --db /path/to/minikraken_20141208 $k > ${k:0: -4}.kraken
python /path/to/Python_Scripts/Kraken_Assembly_Converter_2_Exe.py ${k:0: -4}.kraken
kraken-translate --db /home/njr5/minikraken_20141208 ${k:0: -4}.kraken > ${k:0: -4}.labels
kraken-report --db /home/njr5/minikraken_20141208 ${k:0: -4}_BP.kraken > ${k:0: -4}_contig_data.txt
python /path/to/Python_Scripts/Kraken_Assembly_Summary_Exe.py ${k:0: -4}.kraken ${k:0: -4}.labels ${k:0: -4}_contig_data.txt ${k:0: -4}_BP_data.txt
cut -f2,3 ${k:0: -4}_BP.kraken > ${k:0: -4}_BP_krona.in
ktImportTaxonomy ${k:0: -4}_BP_krona.in -o ${k:0: -4}_BP_krona.html
rm ${k:0: -4}.kraken
rm ${k:0: -4}.labels
rm ${k:0: -4}_contig_data.txt
rm ${k:0: -4}_BP_krona.in
| true |
7c4d449ec9e51c0cf669db74b5ef28679a0ddb64 | Shell | ChihChiu29/paio-docker | /external/itest.sh | UTF-8 | 415 | 3.46875 | 3 | [] | no_license | #! /usr/bin/env bash
if [ $# == 0 ]
then
echo "Usage: itests.sh <directory>"
exit -1
else
nosetests -v --nologcapture; echo "Watching changes in $1..."
while inotifywait -r -e modify $1
do
echo
echo
echo
echo "===================================================================================================="
nosetests -v --nologcapture; echo "Watching changes in $1..."
done
fi
| true |
854dde6eadd6f525fb307fc10a196e88a3d973e6 | Shell | lijianqiao/Linux | /InstallZabbix.sh | UTF-8 | 11,902 | 3.65625 | 4 | [] | no_license | #!/bin/bash
#Name InstallZabbix
#Create by li
#Use environment = centos 7.5
#
#
echo "========================================================================="
echo "========= 1.定义变量及相关配置及位置 ======"
echo "========================================================================="
#通用
SELINUX_PATH=/etc/selinux/config
HOST_NAME='/etc/sysconfig/network'
#定义下载文件放置位置,可创建软件存放文件夹并进入
#mkdir -p /data/tools
TOOLS_PATH=/root
cd $TOOLS_PATH
#网络相关配置文件及位置
#获取本机IP地址
#IPADDR1=/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"
#IPADDR1=ip a show dev ens33|grep -w inet|awk '{print $2}'|awk -F '/' '{print $1}'
ETHCONF=/etc/sysconfig/network-scripts/ifcfg-ens33
HOSTS=/etc/hosts
HOSTNAME=`hostname`
DIR=/root/backup/`date +%Y%m%d`
NETMASK=255.255.255.0
DNS_PATH='/etc/resolv.conf'
sed -i 's/ONBOOT\=no/ONBOOT\=yes/g' ${ETHCONF}
systemctl restart network
IPADDR1=`ip a show dev ens33|grep -w inet|awk '{print $2}'|sed 's/\/.*//'`
#zabbix-server相关配置文件
ZABBIX_SERVER_PATH='/etc/zabbix/zabbix_server.conf'
ZABBIX_HTTPD_PATH='/etc/httpd/conf.d/zabbix.conf'
#数据库相关配置及位置
user1='root'
user2='zabbix'
password='123456'
echo "========================================================================="
echo "========= 2.修改主机名与网络配置 ======"
echo "========================================================================="
echo "........自动获取的ip是$IPADDR1 ..........."
read -p "Please insert ip address:" IPADDR
#
#修改主机名(简单粗暴)
#hostnamectl set-hostname Zabbix-Server
#或
function Change_hosts(){
if
[ ! -d $DIR ];then
mkdir -p $DIR
fi
cp $HOSTS $DIR
# read -p "Please insert ip address": IPADDR
# host=`echo $IPADDR|sed 's/\./-/g'`
read -p "当前主机名为${HOSTNAME},是否修改(y/n):" yn
if [ "$yn" == "Y" ] || [ "$yn" == "y" ]; then
read -p "请输入主机名:" hdp
sed -i "2c HOSTNAME=${hdp}" ${HOST_NAME}
hostnamectl set-hostname ${hdp}
echo "$IPADDR $hdp">>$HOSTS
cat $HOSTS |grep 127.0.0.1 |grep "$hdp"
else
echo "....主机名未修改 .........."
#fi
fi
}
Change_hosts
#
function Change_ip(){
#判断备份目录是否存在,中括号前后都有空格,!叹号在shell表示相反的意思#
if
[ ! -d $DIR ];then
mkdir -p $DIR
fi
echo "准备开始改变IP,在此之前备份原来配置"
cp $ETHCONF $DIR
grep "dhcp" $ETHCONF
#如下$?用来判断上一次操作的状态,为0,表示上一次操作状态正确或者成功#
if
[ $? -eq 0 ];then
#read -p 交互输入变量IPADDR,注冒号后有空格,sed -i 修改配置文件#
# read IPADDR
sed -i 's/dhcp/static/g' $ETHCONF
#awk -F. 意思是以.号为分隔域,打印前三列#
#.2 是我的网关的最后一个数字,例如192.168.0.2#
echo -e "IPADDR=$IPADDR\nNETMASK=$NETMASK\nGATEWAY=`echo $IPADDR|awk -F. '{print $1"."$2"."$3}'`.2" >>$ETHCONF
echo "This IP address Change success !"
else
echo -n "这个$ETHCONF已存在 ,请确保更改吗?(y/n)":
read i
fi
if
[ "$i" == "y" -o "$i" == "yes" ];then
# read -p "Please insert ip Address:" IPADDR
#awk -F. 意思是以.号为分隔域
count=(`echo $IPADDR|awk -F. '{print $1,$2,$3,$4}'`)
#定义数组, ${#count[@]}代表获取变量值总个数#
A=${#count[@]}
#while条件语句判断,个数是否正确,不正确循环提示输入,也可以用[0-9]来判断ip#
while
[ "$A" -ne "4" ]
do
# read -p "Please re Inster ip Address,example 192.168.0.11 ip": IPADDR
count=(`echo $IPADDR|awk -F. '{print $1,$2,$3,$4}'`)
A=${#count[@]}
done
#sed -e 可以连续修改多个参数#
sed -i -e 's/^IPADDR/#IPADDR/g' -e 's/^NETMASK/#NETMASK/g' -e 's/^GATEWAY/#GATEWAY/g' $ETHCONF
#echo -e \n为连续追加内容,并自动换行#
echo -e "IPADDR=$IPADDR\nNETMASK=$NETMASK\nGATEWAY=`echo $IPADDR|awk -F. '{print $1"."$2"."$3}'`.2" >>$ETHCONF
echo "This IP address Change success !"
else
echo "This $ETHCONF static exist,please exit"
# exit $?
fi
}
Change_ip
systemctl restart network
NEW_IP=`ip a show dev ens33|grep -w inet|awk '{print $2}'|sed 's/\/.*//'`
DNS_IP=`echo $NEW_IP|awk -F. '{print $1"."$2"."$3}'`.2
cat >> $DNS_PATH << EOF
nameserver $DNS_IP
EOF
systemctl restart network
#
echo "========================================================================="
echo "========= 3.关闭selinux和防火墙 ======"
echo "========================================================================="
#关闭selinux
#临时关闭
setenforce 0
#永久关闭(重启后生效)
sed -i 's/SELINUX\=enforcing/SELINUX\=disabled/g' $SELINUX_PATH
#关闭防火墙
##临时关闭firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
#
echo "========================================================================="
echo "========= 4.安装相关组件 ======"
echo "========================================================================="
echo "ETHCONF=$ETHCONF"
echo "HOSTS=$HOSTS"
echo "HOSTNAME=$HOSTNAME"
echo "获取本机IP地址=$NEW_IP"
#安装控件
yum update -y
yum install -y vim wget net-tools tree
echo "========================================================================="
echo "========= 5.搭建LAMP环境 ======"
echo "========================================================================="
#搭建LAMP环境
#安装所需软件仓库
yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash
rpm -qa httpd php mariadb
#编辑httpd
cat >> /etc/httpd/conf/httpd.conf << EOF
#修改为主机名
ServerName www.zabbixforli.com
#添加首页支持格式
DirectoryIndex index.html index.php
EOF
#
#
#
#修改时区
echo 'date.timezone = PRC' >> /etc/php.ini
systemctl start httpd #启动并加入开机自启动httpd
systemctl enable httpd
systemctl start mariadb #启动并加入开机自启动mysqld
systemctl enable mariadb
ss -anplt | grep httpd #查看httpd启动情况,80端口监控表示httpd已启动
ss -naplt | grep mysqld #查看mysqld启动情况,3306端口监控表示mysqld已启动
echo "========================================================================="
echo "========= 6.初始化数据库 ======"
echo "========================================================================="
#初始化数据库
#设置数据库root密码
#设置zabbix用户
#使用root账户登录数据库;
#有空用户名称占用导致本地无法登录远程可登录并删除空用户
mysqladmin -u "$user1" password "$password"
echo "CREATE DATABASE zabbix character set utf8 collate utf8_bin;" | mysql -u"$user1" -p"$password"
echo "GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY '$password';" | mysql -u"$user1" -p"$password"
echo "drop user ''@localhost;" | mysql -u"$user1" -p"$password"
echo "drop user ''@$HOSTNAME;" | mysql -u"$user1" -p"$password"
echo "flush privileges;" | mysql -u"$user1" -p"$password"
#
echo "========================================================================="
echo "========= 7.安装Zabbix-server及其相关 ======"
echo "========================================================================="
#
#安装Zabbix
#安装依赖包
yum -y install net-snmp net-snmp-devel curl curl-devel libxml2 libxml2-devel libevent-devel.x86_64 javacc.noarch javacc-javadoc.noarch javacc-maven-plugin.noarch javacc* OpenIPMI iksemel-devel iksemel
#安装php支持zabbix组件
yum install php-bcmath php-mbstring php-devel php-common -y
#
#安装zabbix软件包
rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
#启用zabbix前端可选 rpms 的软件仓库
yum-config-manager --enable rhel-7-server-optional-rpms
#安装 Zabbix server/proxy/web(适用于 RHEL7,在 RHEL 6 上弃用)并使用 MySQL 数据库:
wget -c -t 0 http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-server-mysql-4.0.12-1.el7.x86_64.rpm
wget -c -t 0 http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-proxy-mysql-4.0.12-1.el7.x86_64.rpm
wget -c -t 0 http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-web-4.0.12-1.el7.noarch.rpm
wget -c -t 0 http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-web-mysql-4.0.12-1.el7.noarch.rpm
yum localinstall -y zabbix-server-mysql*
yum localinstall -y zabbix-proxy-mysql*
yum localinstall -y zabbix-web-4*
yum localinstall -y zabbix-web-mysql*
#或
#yum install zabbix-server-mysql -y
#yum install zabbix-proxy-mysql -y
#yum install zabbix-web zabbix-web-mysql -y
#
#
#注意:如果 Zabbix server 和 Zabbix proxy 安装在相同的主机,它们必须创建不同名字的数据库!
#使用 MySQL 来导入 Zabbix server 的初始数据库 schema 和数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u"$user2" -p"$password" zabbix
#对于 Zabbix proxy,导入初始的数据库 schema:
#zcat /usr/share/doc/zabbix-proxy-mysql*/schema.sql.gz | mysql -uzabbix -p[password] zabbix
#为 Zabbix server/proxy 配置数据库
cat >> $ZABBIX_SERVER_PATH << EOF
DBHost=localhost
DBPassword=$password
EOF
#
#
#
#修改时区
sed -i 's/\# php_value date.timezone Europe\/Riga/php_value date.timezone Asia\/Shanghai/g' $ZABBIX_HTTPD_PATH
#设置开机启动并启动
systemctl enable zabbix-server
systemctl start zabbix-server
#
#
#
echo "========================================================================="
echo "========= 8.安装Zabbix-agent ======"
echo "========================================================================="
#安装Zabbix-agent
wget -c -t 0 http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.12-1.el7.x86_64.rpm
yum localinstall -y zabbix-agent*
#rpm -ivh zabbix-agent*
#或
#yum install -y zabbix-agent
#设置开机启动并启动
systemctl start zabbix-agent
systemctl enable zabbix-agent
systemctl restart httpd
systemctl restart mariadb
systemctl restart zabbix-server
#
echo "========================================================================="
echo "========= 30秒后,登陆http://$NEW_IP/zabbix完成安装 ======"
echo "========= 第一步:next step ======"
echo "========= 第二步:next step ======"
echo "========= 第三步:Database type -- MySQL ======"
echo "========= :Database host -- localhost(或127.0.0.1) ======"
echo "========= :Database port -- 3306 ======"
echo "========= :Database name -- $user2 ======"
echo "========= :User -- $user2 ======"
echo "========= :Passwors -- 123456 ======"
echo "========= :Host -- localhost(或127.0.0.1) ======"
echo "========= :Port -- 10051 ======"
echo "========= :Name -- (可填项,任意值) ======"
echo "========= Next step ======"
echo "========= 第四步:next step ======"
echo "========= 第五步:Finsh ======"
echo "========= Username: Admin ======"
echo "========= Password: zabbix ======"
echo "=========================================================================="
#重启
shutdown -t 30 -r
#reboot
| true |
fa50cf23919340731d2dc184b4a7a5b766aacf32 | Shell | beautytiger/logger | /build.sh | UTF-8 | 158 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env bash
images=(
'quay.io/guanwang/logger:v1.4'
)
for image in ${images[@]}; do
docker build -t "$image" .
docker push "$image"
done
| true |
32bc8ed6b45072050dc17a5e666c1dbdc9138262 | Shell | Mixaster995/integration-k8s-packet | /scripts/sriov/config-SRIOV.sh | UTF-8 | 1,589 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# shellcheck disable=SC2064,SC2129
CONFIG_DIRECTORY="/var/lib/networkservicemesh"
CONFIG_FILE="${CONFIG_DIRECTORY}/sriov.config"
function softlink_target() {
softlink="$1"
raw_target="$(stat -c %N "${softlink}")"
test $? -eq 0 || return 1
target=$(echo "${raw_target}" | sed -E "s/(.*\/)(.*)'/\2/g")
test $? -eq 0 || return 2
echo "${target}"
return 0
}
function config_link() {
device="/sys/class/net/$1/device"
IFS=","; read -ra domains <<< "$2"; unset IFS
pci_addr="$(softlink_target "${device}")"
test $? -eq 0 || return 1
pf_kernel_driver="$(softlink_target "${device}/driver")"
test $? -eq 0 || return 1
trap "echo 0 > '${device}/sriov_numvfs'" err exit
echo 1 > "${device}/sriov_numvfs" || return 1
vf_kernel_driver="$(softlink_target "${device}/virtfn0/driver")"
test $? -eq 0 || return 1
echo " ${pci_addr}:" >> "${CONFIG_FILE}"
echo " pfKernelDriver: ${pf_kernel_driver}" >> "${CONFIG_FILE}"
echo " vfKernelDriver: ${vf_kernel_driver}" >> "${CONFIG_FILE}"
echo " capabilities:" >> "${CONFIG_FILE}"
echo " - intel" >> "${CONFIG_FILE}"
echo " - 10G" >> "${CONFIG_FILE}"
echo " serviceDomains:" >> "${CONFIG_FILE}"
for domain in "${domains[@]}"; do
echo " - ${domain}" >> "${CONFIG_FILE}"
done
return 0
}
mkdir -p "${CONFIG_DIRECTORY}"
echo "---" > "${CONFIG_FILE}"
echo "physicalFunctions:" >> "${CONFIG_FILE}"
for link_domains in "$@"; do
IFS="="; read -ra args <<< "${link_domains}"; unset IFS
config_link "${args[0]}" "${args[1]}"
test $? -eq 0 || exit 1
done
| true |
93093766e66afcd3dd5219920de5c1381dbf02a9 | Shell | rickneff/tmp | /d | UTF-8 | 241 | 2.546875 | 3 | [] | no_license | #!/bin/bash
if ! test -f ditaa0_9.jar
then
curl -s -O https://rickneff.github.io/ditaa0_9.jar
# allow easy import of ditaa Python function (see ditaa.py).
ln -s c/ditaa.py
ln -s c/ditaa0_9.jar
fi
exec java -jar ditaa0_9.jar "$@" | true |
5073b0dc3d7ce68f91d6a0ec1c09af5a61ed8c69 | Shell | atin-goyal/MyShellScripts | /Shell Scripts/getLogFiles.sh | UTF-8 | 2,342 | 3.1875 | 3 | [] | no_license | #!/bin/bash
echo "Enter Domain Home:"
read Domain_Home
echo "Number Of Days To Collect :"
read No_Of_Days
echo "Enter Mode 1) For All Log files or Any Other Value For AccessFiles & Heap Pressure(Default):"
read State
Domain_Name=$(basename $Domain_Home)
if [ "$No_Of_Days" == "" ]
then
No_Of_Days=10;
fi
if [ "$State" == "1" ]
then
find $Domain_Home/servers/*rver*/logs/ -maxdepth 1 \( -name '*log*' -o -name '*.out*' \) -type f -mtime -$No_Of_Days | xargs zip $Domain_Name.zip 2>/dev/null;
else
find $Domain_Home/servers/*rver*/logs/ -maxdepth 1 -name 'access*' -type f -mtime -$No_Of_Days | xargs zip $Domain_Name.zip 2>/dev/null;
fi
if [ "$State" != "1" ]
then
echo "------------------------------Heap Pressure For "$Domain_Name"--------------------------"
for NAME in $(ls $Domain_Home/servers | grep -i 'server')
do
echo "Heap Pressure For "$NAME;
##find $Domain_Home/servers/$NAME/logs/ -name '*out*' -type f -mtime -$No_Of_Days | xargs grep -ir '\->' | awk '{print substr($11,11,6)" "substr($12,1,10)}' | grep -v ',' | awk 'BEGIN{s=0;}{s=s+$1;}END{print "Avg Heap Usage: "s/NR "KB Total Heap: "$2;}' 2>/dev/null;
find $Domain_Home/servers/$NAME/logs/ -name '*out*' -type f -mtime -$No_Of_Days | xargs grep -ir '\->' | awk '{gsub(/KB/, "", $11); print substr($11, (index($11, "->")+2)) " "substr($12,2,(index($12,")")-4))}' | grep -v ',' | awk 'BEGIN{s=0;}{s=s+$1;}ENDBEGIN{max = 0;}{if($2>max)max=$2;}END{print "Avg Heap Usage: "s/NR "KB Max Heap: "max"KB";}' 2>/dev/null;
echo "";
done
echo "";
echo "----------------------------------------------------------------";
echo "Memory Statistics For The Host";
echo "";
find /var/log/sa -name 'sa[0-9]*' -mtime -$No_Of_Days | xargs ls -tr | awk '{print "sar -r -f "$1" | grep -i -e mem -e Average -e Linux"}' | bash;
echo "----------------------------------------------------------------";
echo "";
echo "Swap Area Statistics For The Host";
echo "";
find /var/log/sa -name 'sa[0-9]*' -mtime -$No_Of_Days | xargs ls -tr | awk '{print "sar -W -f "$1" | grep -i -e swp -e Average -e Linux"}' | bash;
echo "----------------------------------------------------------------";
echo "";
echo "CPU Statistics For The Host";
echo "";
find /var/log/sa -name 'sa[0-9]*' -mtime -$No_Of_Days | xargs ls -tr | awk '{print "sar -f "$1" | grep -i -e idle -e Average -e Linux"}' | bash;
fi
| true |
473d964ba621f2d11523102873c772f88de5d238 | Shell | nazarewk/ipxe-boot | /bin/install-clr.sh | UTF-8 | 372 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env bash
version=${1:-$(curl https://download.clearlinux.org/latest)}
url="https://download.clearlinux.org/releases/${version}/clear/clear-${version}-pxe.tar.xz"
name=clear-pxe
filename="${name}.tar.xz"
dir="media/${name}"
mkdir -p ${dir} && cd ${dir}
wget -N "${url}" -O "${filename}"
tar -xJf ${filename}
ln -sf "$(ls -1t org.clearlinux.* | head -n 1)" linux | true |
197bc81cd4acbe955979b105f8f07b6caf9415bf | Shell | NetBSDfr/sailor | /include/platform.sh | UTF-8 | 2,934 | 3.171875 | 3 | [
"BSD-2-Clause"
] | permissive | # platform specific variables and functions
# needed 3rd party programs
for bin in pkg_info pkg_tarup pkgin rsync curl
do
binpath=`which ${bin}`
if [ -z "${binpath}" ]; then
echo "${bin} is required for sailor to work"
exit 1
fi
eval ${bin}=${binpath}
done
rsync="${rsync} -av"
case $OS in
Darwin)
. ${include}/mdns.sh
p_ldd() {
/usr/bin/otool -L ${1}|${awk} '/\/[lL]ib.+\(/ {print $1}'
}
mkdevs() {
true
}
mounts() {
mcmd=${1}
case ${mcmd} in
mount)
${mount} -t devfs devfs ${shippath}/dev
;;
umount)
wait_umount dev
;;
esac
}
iflist() {
${ifconfig} -l
}
dns() {
mdns ${1}
}
readlink=$(which readlink)
master_passwd=master.passwd
# dyld is OS X's dynamic loader
# /System/Library/Frameworks* are needed by dscl which is needed by
# useradd / groupadd wrappers
SLF="/System/Library/Frameworks"
def_bins="/usr/lib/dyld /usr/bin/dscl /usr/bin/cut /usr/bin/which \
${SLF}/Foundation.framework/Versions/C/Foundation \
${SLF}/DirectoryService.framework/Versions/A/DirectoryService \
${SLF}/CoreFoundation.framework/Versions/A/CoreFoundation"
# request-schema.plist needed for dscl
def_files="/System/Library/OpenDirectory/request-schema.plist"
;;
NetBSD)
p_ldd() {
/usr/bin/ldd -f'%p\n' ${1}
}
mkdevs() {
${cp} /dev/MAKEDEV ${shippath}/dev
cd ${shippath}/dev && sh MAKEDEV std random
cd -
}
mounts() {
mcmd=${1}
for mtype in ro rw
do
eval mnt=\$"${mtype}_mounts"
[ -z "${mnt}" ] && continue
for mp in ${mnt}
do
[ ! -d "${mp}" ] && continue
${mkdir} ${shippath}/${mp}
[ ${mcmd} = "mount" ] && \
${loopmount} -o ${mtype} \
${mp} ${shippath}/${mp}
[ ${mcmd} = "umount" ] && \
${umount} ${shippath}/${mp}
done
done
}
iflist() {
${ifconfig} -l
}
dns() {
true
}
readlink="$(which readlink) -f"
master_passwd=master.passwd
def_bins="/libexec/ld.elf_so /usr/libexec/ld.elf_so $(which pwd_mkdb)"
loopmount="/sbin/mount -t null"
;;
Linux)
# Linux is on the works right now
p_ldd() {
/usr/bin/ldd ${1}|${grep} -oE '[^[:space:]]*/lib[^[:space:]]+'
}
mkdevs() {
true
}
mounts() {
mcmd=${1}
for m in run dev proc sys
do
case ${mcmd} in
mount)
${mkdir} ${shippath}/${m}
mount --bind /${m} ${shippath}/${m}
;;
umount)
wait_umount ${m}
;;
esac
done
}
iflist() {
ls -1 /sys/class/net|xargs
}
dns() {
true
}
readlink="$(which readlink) -f"
master_passwd=shadow
def_bins="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 \
/lib64/libresolv.so.2 /lib64/libnss_dns.so.2 \
/lib64/libnss_files.so.2"
;;
esac
# binaries needed by many packages and not listed in +INSTALL
# most installation and startup scripts also need /bin/sh
def_bins="${def_bins} ${useradd} ${groupadd} ${pkg_info} ${pkgin} \
/bin/sh /bin/test $(which nologin) /bin/echo /bin/ps /bin/sleep \
$(which sysctl) $(which logger) $(which kill) $(which printf) \
/bin/sh ${ping}"
| true |
204e7b20d564fd51c5f48bc9823beb435f231cdb | Shell | mattia72/pi-home | /bin/my-logger.lib.sh | UTF-8 | 431 | 3.84375 | 4 | [
"MIT"
] | permissive |
log_to_file()
{
local msg_level="$1"
local message="$2"
[ $log_level -ge $msg_level ] && echo -e "$(date +"%y.%m.%d %X"): $message" >> $log_file
}
log_to_screen()
{
local message="$1"
local msg_level=0
if [ $# -gt 1 ]; then
msg_level="$1"
message="$2"
fi
[ $log_level -ge $msg_level ] && echo -e "$message"
# msg_level 0 won't be logged
[ $msg_level -gt 0 ] && log_to_file $msg_level "$message"
}
| true |
06a7dca2c1736bfdd92818c86d40b68b899719a4 | Shell | GatorQue/conan-sfml | /.travis/run.sh | UTF-8 | 448 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/bin/bash
set -e
set -x
if [[ "$(uname -s)" == 'Darwin' ]]; then
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
pyenv activate conan
fi
sudo apt install -y freeglut3-dev libfreetype6-dev libgl1-mesa-dev libglew-dev libgpgme11-dev libjpeg8-dev libopenal-dev libpthread-stubs0-dev libsndfile1-dev libssl-dev libudev-dev libx11-dev libx11-xcb-dev libxcb-randr0-dev libxcb-image0-dev libxrandr-dev
python build.py
| true |
fb43ca14744ccc6ec2af5b7f89c40ad6f7bef1d1 | Shell | alinshrr/alininst | /ansible/playbooks/create_archiso_usb/roles/usb_iso/files/createIsoOnUsb.sh | UTF-8 | 231 | 2.828125 | 3 | [] | no_license | #!/bin/bash
tmpdir=$1/
ver="2020.03.01"
host="https://mirror.pkgbuild.com"
uri_iso="${host}/iso/${ver}/archlinux-${ver}-x86_64.iso"
uri_sha1="${host}/iso/${ver}/sha1sums.txt"
wget -P $tmpdir $uri_iso
wget -P $tmpdir $uri_sha1
| true |
a8e8ce7a3fad7f6c2e7cd04685f6c8180d68cd20 | Shell | dipoppleton/Daily_Science_Wordcloud | /MEDLINE_CONTROL.sh | UTF-8 | 606 | 2.5625 | 3 | [] | no_license | #!/bin/bash
# Get the resolution of the screen
RESOLUTION=$(system_profiler SPDisplaysDataType |grep Resolution);
# Get the X resolution
WIDTH=$(echo $RESOLUTION|awk '{print $2}')
# Get the Y resolution
# echo $RESOLUTION|awk '{print $4}'
HEIGHT=$(echo $RESOLUTION|awk '{print $4}')
# Get the data
perl medline_wordcloud.pl;
# Draw the two images
wordcloud_cli --text Todayswords.txt --width $WIDTH --height $HEIGHT --stopwords common.txt --background "white" --imagefile whitetoday.png
wordcloud_cli --text Todayswords.txt --width $WIDTH --height $HEIGHT --imagefile --stopwords common.txt blacktoday.png | true |
41812fb7f4343ca88d706d0d267071149dc12195 | Shell | syedmizanur/tensorflow | /third_party/mlir/utils/spirv/define_inst.sh | UTF-8 | 1,990 | 3.625 | 4 | [
"Apache-2.0",
"NCSA",
"LLVM-exception"
] | permissive | #!/bin/bash
# Copyright 2019 The MLIR Authors.
#
# 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.
# Script for defining a new op using SPIR-V spec from the Internet.
#
# Run as:
# ./define_inst.sh <filename> <baseclass> (<opname>)*
# <filename> is required, which is the file name of MLIR SPIR-V op definitions
# spec.
# <baseclass> is required. It will be the direct base class the newly defined
# op will drive from.
# If <opname> is missing, this script updates existing ones in <filename>.
# For example:
# ./define_inst.sh SPIRVArithmeticOps.td ArithmeticBianryOp OpIAdd
# ./define_inst.sh SPIRVLogicalOps.td LogicalOp OpFOrdEqual
set -e
file_name=$1
baseclass=$2
case $baseclass in
Op | ArithmeticBinaryOp | ArithmeticUnaryOp | LogicalBinaryOp | LogicalUnaryOp | CastOp | ControlFlowOp | StructureOp | AtomicUpdateOp | AtomicUpdateWithValueOp)
;;
*)
echo "Usage : " $0 "<filename> <baseclass> (<opname>)*"
echo "<filename> is the file name of MLIR SPIR-V op definitions spec"
echo "<baseclass> must be one of " \
"(Op|ArithmeticBinaryOp|ArithmeticUnaryOp|LogicalBinaryOp|LogicalUnaryOp|CastOp|ControlFlowOp|StructureOp|AtomicUpdateOp)"
exit 1;
;;
esac
shift
shift
current_file="$(readlink -f "$0")"
current_dir="$(dirname "$current_file")"
python3 ${current_dir}/gen_spirv_dialect.py \
--op-td-path \
${current_dir}/../../include/mlir/Dialect/SPIRV/${file_name} \
--inst-category $baseclass --new-inst "$@"
${current_dir}/define_opcodes.sh "$@"
| true |
c6c6cb31090e6f8c780c771a184d924c3818c342 | Shell | czgcampos/DAW | /tp5/obras-musicais-json/import2mongo.sh | UTF-8 | 204 | 2.890625 | 3 | [] | no_license | #!/bin/bash
# make sure you always put $f in double quotes to avoid any nasty surprises i.e. "$f"
for f in $*
do
echo "Processing $f file..."
mongoimport -h localhost:27017 -d amd -c obras "$f"
done
| true |
9fb001a696009bdffc828737b7e08a8b801b0b77 | Shell | pli01/terraform-openstack-app | /terraform/heat/config-scripts/log.cfg.tpl | UTF-8 | 797 | 2.8125 | 3 | [] | no_license | #!/bin/bash
# generated terraform template file
# place here all variables
cat <<'EOF' >/home/debian/log.cfg
%{ if dockerhub_login != "" ~}
export dockerhub_login="${dockerhub_login}"
%{ endif ~}
%{ if dockerhub_token != "" ~}
export dockerhub_token="${dockerhub_token}"
%{ endif ~}
%{ if github_token != "" ~}
export github_token="${github_token}"
%{ endif ~}
%{ if docker_registry_username != "" ~}
export docker_registry_username="${docker_registry_username}"
%{ endif ~}
%{ if docker_registry_token != "" ~}
export docker_registry_token="${docker_registry_token}"
%{ endif ~}
%{ if log_install_script != "" ~}
export log_install_script="${log_install_script}"
%{ endif ~}
%{for k,v in log_variables~}
%{ if v != "" ~}
export ${k}="${v}"
%{ else ~}
export ${k}=""
%{ endif ~}
%{endfor~}
#
EOF
| true |
a43742df17fc9f6d7e7788c19bded2937094b8a6 | Shell | akidan/coinboard | /tracker.sh | UTF-8 | 313 | 2.578125 | 3 | [] | no_license | #!/bin/bash
while :
do
USN=`cat ~/.secrets/key.json | jq .Coinboard.username | sed 's/"//g'`
PSW=`cat ~/.secrets/key.json | jq .Coinboard.password | sed 's/"//g'`
AMOUNT=`php getForm.php $USN $PSW | tr "<" "\n" | grep sg-total-assets-amount | sed 's/.*>//'`
echo -ne "\n"$AMOUNT"\r"
sleep 90;
done
| true |
393c5c6a3b70bb3facffa371122f05876a69755f | Shell | hasanloo/rest_web_proxy | /run.sh | UTF-8 | 481 | 2.703125 | 3 | [] | no_license | #!/bin/sh
# Adapted from Alex Kleissner's post, Running a Phoenix 1.3 project with docker-compose
# https://medium.com/@hex337/running-a-phoenix-1-3-project-with-docker-compose-d82ab55e43cf
set -e
echo "\n Preparing Dependencies"
# Ensure the app's dependencies are installed
mix deps.get
echo "\n Preparing Database migrations"
# Potentially Set up the database
mix ecto.create
mix ecto.migrate
echo "\n Launching Phoenix web server..."
# Start the phoenix web server
mix phx.server
| true |
22a1116aacd44c74f71e5349f6a57a47c11945c6 | Shell | singmoonshell/log-analysis-system | /web/src/main/java/com/cad/web/test.sh | UTF-8 | 1,839 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env bash
logsystemUserName="default"
# here changes the default logsystemUserName in the log-analysis-system process
#yes |yum install golang
#go get github.com/ghodss/yaml
#go get github.com/bitly/go-simplejson
name="beatwatcher"
rootbase="/var/local"
binaryname="go_build_github_com_beatwatcher_linux"
runtype="testing"
username=$(whoami)
if [[ ${username} == "root" ]]; then
base=${rootbase}/${logsystemUserName}
else
userPath=$(echo $HOME)
base=${userPath}/${logsystemUserName}
fi
echo "start to run..."
[[ ! -d "${base}" ]] && mkdir -p ${base}
if [[ $? -ne 0 ]]; then
echo "can not create ${base}, has exit "
fi
cd ${base}
# download code
# if git is not exit. it should download git first
git clone https://github.com/chenyuanxing/beatwatcher.git
if [[ $? -ne 0 ]]; then
echo "can not clone from https://github.com/chenyuanxing/beatwatcher.git,maybe exit.try to remove beatwatcher"
if [[ ${runtype} == "testing" ]]; then
echo "it is testing ,do not download again"
else
rm -rf beatwatcher
if [[ $? -ne 0 ]]; then
echo "remove beatwatcher failed"
fi
git clone https://github.com/chenyuanxing/beatwatcher.git
if [[ $? -ne 0 ]]; then
echo "can not clone from https://github.com/chenyuanxing/beatwatcher.git,do not know why !!!"
exit 1
fi
fi
fi
cd beatwatcher
tar xzvf metricbeat-6.5.4-linux-x86_64.tar.gz
if [[ $? -ne 0 ]]; then
echo " can not excute tar xzvf metricbeat-6.5.4-linux-x86_64.tar.gz . so exit "
exit 1
fi
tar xzvf filebeat-6.5.4-linux-x86_64.tar.gz
if [[ $? -ne 0 ]]; then
echo " can not excute tar xzvf filebeat-6.5.4-linux-x86_64.tar.gz . so exit "
exit 1
fi
chmod 777 ${binaryname}
# run it
# ./go_build_github_com_beatwatcher_linux -k "xxx" | true |
5d0cba2bb719927cced43a689d68e9b6fab1e5af | Shell | rcore-os/arceos | /modules/axfs/resources/create_test_img.sh | UTF-8 | 809 | 3.765625 | 4 | [
"Apache-2.0",
"AGPL-3.0-only",
"LicenseRef-scancode-mulanpubl-2.0",
"AGPL-3.0-or-later",
"GPL-3.0-only",
"MulanPSL-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-mulanpsl-2.0-en"
] | permissive | #!/bin/bash
# From https://github.com/rafalh/rust-fatfs/blob/master/scripts/create-test-img.sh
CUR_DIR=`dirname $0`
echo $OUT_DIR
create_test_img() {
local name=$1
local blkcount=$2
local fatSize=$3
dd if=/dev/zero of="$name" bs=1024 count=$blkcount
mkfs.vfat -s 1 -F $fatSize -n "Test!" -i 12345678 "$name"
mkdir -p mnt
sudo mount -o loop "$name" mnt -o rw,uid=$USER,gid=$USER
for i in $(seq 1 1000); do
echo "Rust is cool!" >>"mnt/long.txt"
done
echo "Rust is cool!" >>"mnt/short.txt"
mkdir -p "mnt/very/long/path"
echo "Rust is cool!" >>"mnt/very/long/path/test.txt"
mkdir -p "mnt/very-long-dir-name"
echo "Rust is cool!" >>"mnt/very-long-dir-name/very-long-file-name.txt"
sudo umount mnt
}
create_test_img "$CUR_DIR/fat16.img" 2500 16
create_test_img "$CUR_DIR/fat32.img" 34000 32
| true |
143c208b2237356c9aee10396a7b5cc44e8806eb | Shell | andrewp-as-is/sqlite-examples | /CSV/EOF/run.sh | UTF-8 | 178 | 2.8125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env bash
{ set +x; } 2>/dev/null
db="$(mktemp)" || exit
f="${BASH_SOURCE[0]%/*}"/data.csv
sqlite3 "$db" <<EOF
.mode csv
.import '$f' foo
PRAGMA table_info(foo);
EOF
| true |
bd08cbea8e3c2fac6507ff08cec8a92263e86a2f | Shell | ibrahim11fazil/jasperreport_angular | /dockerBuild.sh | UTF-8 | 3,239 | 3.09375 | 3 | [] | no_license | #!/bin/bash
set -a
TAG=dev_$(git describe --abbrev=0)
if [ "$1" = "prod" ]
then
source env_prod.txt
TAG=$(git describe --abbrev=0)
elif [ "$1" = "qa" ]
then
source env_qa.txt
TAG=qa_$(git describe --abbrev=0)
else
source env_dev.txt
fi
set +a
echo $TAG
echo $FILE
if [ "$1" = "prod" ]
then
echo "Staring production version building file"
TAG=prod_$(git describe --abbrev=0)
docker build --file ui/Dockerfile ui -t 172.16.0.253:5000/ui:$TAG
docker build --file workflow-camuda/Dockerfile workflow-camuda -t 172.16.0.253:5000/workflow:$TAG
docker build --file notification/Dockerfile notification -t 172.16.0.253:5000/notification:$TAG
docker build --file user/Dockerfile user -t 172.16.0.253:5000/user:$TAG
docker build --file employee/Dockerfile employee -t 172.16.0.253:5000/employee:$TAG
docker build --file cis/Dockerfile cis -t 172.16.0.253:5000/cis:$TAG
docker build --file training/Dockerfile training -t 172.16.0.253:5000/training:$TAG
docker build --file config/Dockerfile config -t 172.16.0.253:5000/config:$TAG
docker build --file fileupload/Dockerfile fileupload -t 172.16.0.253:5000/fileupload:$TAG
docker build --file authentication/Dockerfile authentication -t 172.16.0.253:5000/authentication:$TAG
docker build --file registry/Dockerfile registry -t 172.16.0.253:5000/registry:$TAG
docker build --file gateway/Dockerfile gateway -t 172.16.0.253:5000/gateway:$TAG
#docker build --file gateway-cloud/Dockerfile gateway-cloud -t 172.16.0.253:5000/gateway-cloud:$TAG
echo "PROD build done"
echo "Prod version Hot Beans Done "
elif [ "$1" = "qa" ]
then
#./build.sh
TAG=qa_$(git describe --abbrev=0)
docker build --file ui/Dockerfile ui -t 172.16.0.253:5000/ui:$TAG
docker build --file workflow-camuda/Dockerfile workflow-camuda -t 172.16.0.253:5000/workflow:$TAG
docker build --file notification/Dockerfile notification -t 172.16.0.253:5000/notification:$TAG
docker build --file user/Dockerfile user -t 172.16.0.253:5000/user:$TAG
docker build --file employee/Dockerfile employee -t 172.16.0.253:5000/employee:$TAG
docker build --file cis/Dockerfile cis -t 172.16.0.253:5000/cis:$TAG
docker build --file training/Dockerfile training -t 172.16.0.253:5000/training:$TAG
docker build --file config/Dockerfile config -t 172.16.0.253:5000/config:$TAG
docker build --file fileupload/Dockerfile fileupload -t 172.16.0.253:5000/fileupload:$TAG
docker build --file authentication/Dockerfile authentication -t 172.16.0.253:5000/authentication:$TAG
docker build --file registry/Dockerfile registry -t 172.16.0.253:5000/registry:$TAG
docker build --file gateway/Dockerfile gateway -t 172.16.0.253:5000/gateway:$TAG
#docker build --file gateway-cloud/Dockerfile gateway-cloud -t 172.16.0.253:5000/gateway-cloud:$TAG
echo "QA build done"
echo "Pushing to server "
#./docker-push.sh qa
echo "Pushing to server not done"
else
echo "Staring developer version building file"
#./build.sh
echo "Pass --> qa or prod"
fi | true |
e404f02c9f58633f9039af2aa42a4dce093d1700 | Shell | simongibbons/pyfof | /build_linux_wheels.sh | UTF-8 | 431 | 3.375 | 3 | [
"MIT"
] | permissive | #! /bin/bash
set -ex
function build_wheels() {
echo "Building Wheels"
docker build . -t pyfof -f Dockerfile-manylinux
CONTAINER_ID=$(docker create pyfof)
trap "docker rm -f ${CONTAINER_ID} > /dev/null || true" EXIT INT TERM
docker start -ai ${CONTAINER_ID}
mkdir -p wheelhouse
docker cp ${CONTAINER_ID}:/app/wheelhouse .
}
build_wheels
echo "Built the following wheels"
ls -l ./wheelhouse/pyfof*
| true |
858b8d40bade934131036a07d8ea4bc5cb006b97 | Shell | gsilos/devops | /cloudflare/purge-cache.sh | UTF-8 | 848 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env bash
# https://api.cloudflare.com/#zone-purge-files-by-url
source ~/.cloudflare
CLOUDFLARE_ENDPOINT="purge_cache"
case "$1" in
"")
echo "Uso: $0 -aS"
RETVAL=1
;;
-a)
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONEID}/${CLOUDFLARE_ENDPOINT}" \
-H "X-Auth-Email: ${CLOUDFLARE_EMAIL}" \
-H "X-Auth-Key: ${CLOUDFLARE_APIKEY}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
echo
;;
-S)
if [[ -z $2 ]]; then
echo "specify a url. Example: https://domain.com/file.txt"
exit
fi
URL=$2
curl -X POST "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONEID}/${CLOUDFLARE_ENDPOINT}" \
-H "X-Auth-Email: ${CLOUDFLARE_EMAIL}" \
-H "X-Auth-Key: ${CLOUDFLARE_APIKEY}" \
-H "Content-Type: application/json" \
--data '{"files":["'${URL}'"]}'
echo
;;
esac
| true |
2ae7966570a189648c8338340dc4613497116684 | Shell | apostrophecms-legacy/myapostrophe-mac | /build-mac-binaries.sh | UTF-8 | 452 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/bin/sh
# You don't need to run this. We run it to build the binaries in bin.tar.gz.
mkdir -p tmp &&
(
cd tmp &&
rm -rf * &&
HERE=$PWD &&
rm -rf git-master &&
curl -o git-master.zip -L https://github.com/git/git/archive/master.zip &&
unzip git-master.zip &&
cd git-master &&
make prefix=$HERE NO_DARWIN_PORTS=YesPlease NO_GETTEXT=YesPlease install
cd .. &&
tar -zcf ../bin.tar.gz bin libexec
) &&
echo "Updated git binaries"
| true |
fc4d1a3d763c089657c81dffbcffe8c2cb149abc | Shell | ztao/node_album | /client/client.sh | UTF-8 | 2,260 | 2.59375 | 3 | [] | no_license | #!/bin/bash
# Entry Point
# curl http://127.0.0.1:3000/album
# Create collections
# echo `curl -s -F album[name]="First Album" -F album[description]="this is a test album" "http://127.0.0.1:3000/album"`
# echo `curl -s -F album[name]="Armament" -F album[description]="About armament" "http://127.0.0.1:3000/album"`
# echo `curl -s -F album[name]="Plant" -F album[description]="About plant" "http://127.0.0.1:3000/album"`
# Delete collections
# echo `curl -X DELETE "http://127.0.0.1:3000/album/1"`
# echo `curl -X DELETE "http://127.0.0.1:3000/album/2"`
# echo `curl -X DELETE "http://127.0.0.1:3000/album/3"`
# Create an image
# echo `curl -s -F image=@"../test_pictures/f22.jpg" --form press=OK "http://127.0.0.1:3000/album/2/create"`
# Update an image
# echo `curl -X PUT "http://127.0.0.1:3000/album/2/photo/3" -F image=@"../test_pictures/gun.jpg"`
# Delete an image
# echo `curl -X DELETE "http://127.0.0.1:3000/album/2/photo/1"`
# CRUD metadata for albums
# Create
# echo `curl -F Metadata[name]="First Album" -F Metadata[Description]="this is a test album 3" -F Metadata[Contibuter]="Johnny" "http://127.0.0.1:3000/album/1/metadata"`
# Retrieve
# echo `curl http://127.0.0.1:3000/album/1/metadata`
# Update
# 405
# echo `curl -X PUT "http://127.0.0.1:3000/album/3/metadata" -F Metadata[Description]="The description has been changed by a PUT method." -F Metadata[Contibuter]="Johnny"`
# 201
# echo `curl -X PUT "http://127.0.0.1:3000/album/3/metadata" -F Metadata[name]="Plants" -F Metadata[Description]="The description has been changed by a PUT method." -F Metadata[Contibuter]="Johnny"`
# Delete
# echo `curl -X DELETE "http://127.0.0.1:3000/album/2/metadata"`
#CRUD comments for albums
# Post a comment
# echo `curl -F Comment="This is a comment for the album." "http://127.0.0.1:3000/album/1/comments"`
# Retrieve
#
#Update
# echo `curl -X PUT -F Comment[2]="Let me update the second comment." "http://127.0.0.1:3000/album/1/comments/2"`
#Delete
# echo `curl -X DELETE http://127.0.0.1:3000/album/2/comments/4`
# CRUD comments for photos
# echo `curl -F Comment="This is a comment for the photo." "http://127.0.0.1:3000/album/1/comments"`
# echo `curl -F Comment="Add a comment for the tank." "http://127.0.0.1:3000/album/2/photo/6/comments"` | true |
8d93c47523e77744541d186fd7aa29261d1ae348 | Shell | inwinstack/k8s-apps | /kafka/image/scripts/entrypoint.sh | UTF-8 | 1,531 | 3.28125 | 3 | [] | no_license | #!/bin/bash
#
# Kafka exec script
# Disable Kafka's GC logging (which logs to a file)...
# but enable equivalent GC logging to stdout
export GC_LOG_ENABLED="false"
export JMX_PORT="5555"
export KAFKA_GC_LOG_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps"
export KAFKA_BROKER_ID=${HOSTNAME##*-}
# volume for saving Kafka server logs
export KAFKA_VOLUME="/var/lib/kafka"
export KAFKA_LOG_DIRS="${KAFKA_DATA_DIR}/log-${KAFKA_BROKER_ID}"
# set log level and opts
if [ -z "${KAFKA_LOG_LEVEL}" ]; then
KAFKA_LOG_LEVEL="INFO"
fi
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${KAFKA_HOME}/config/log4j.properties -Dkafka.root.logger.level=${KAFKA_LOG_LEVEL},CONSOLE"
fi
# print infos
echo "+==== start broker ${KAFKA_BROKER_ID} ====+"
echo "Kafka log level: ${KAFKA_LOG_LEVEL}"
echo "Kafka log dir: ${KAFKA_LOG_DIRS}"
echo "Kafka log4j opts: ${KAFKA_LOG4J_OPTS}"
if [ ! -z "${ADVERTISED_ADDRESS}" ]; then
echo "Kafka advertised address: ${ADVERTISED_ADDRESS}"
ADVERTISED_OPTS="OUTSIDE://${ADVERTISED_ADDRESS},PLAINTEXT://:9092"
OPTS="${OPTS} --override advertised.listeners=${ADVERTISED_OPTS}"
fi
echo "+================================+"
# starting Kafka server with final configuration
exec ${KAFKA_HOME}/bin/kafka-server-start.sh ${KAFKA_HOME}/config/server.properties \
--override broker.id=${KAFKA_BROKER_ID} \
--override zookeeper.connect=${KAFKA_ZOOKEEPER_CONNECT:-zookeeper:2181} \
--override log.dirs=${KAFKA_LOG_DIRS} ${OPTS}
| true |
70ac927064d48cc6770a65bff625be6e8f40e44c | Shell | aws/s2n-tls | /codebuild/bin/utils.sh | UTF-8 | 1,714 | 3.734375 | 4 | [
"Apache-2.0",
"MIT"
] | permissive | #!/usr/bin/env bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
#
set -e
# Utility functions
get_latest_release(){
local LATEST_RELEASE_URL=$(gh api /repos/aws/s2n-tls/releases/latest|jq -r '.tarball_url')
local LATEST_RELEASE_VER=$(echo "${LATEST_RELEASE_URL}" | sed 's|.*/||')
echo "${LATEST_RELEASE_VER}"
}
gh_login(){
# Takes secrets manager key as an argument
# This GH personal access token must have 'repo' permissions to work.
gh auth status || aws secretsmanager get-secret-value --secret-id "$1" --query 'SecretString' --output text |jq -r '.secret_key'| gh auth login --with-token
#gh auth status
}
criterion_install_deps(){
make install
source "$HOME"/.cargo/env
make -C bindings/rust
}
usage(){
echo -e "Usage:\n\tget_latest_release: returns just the latest v.N.N.N version"
echo -e "\tgh_login <Secret Name> : retrieves a GitHub PAT from secrest manager and logs into GitHub.\n"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
case "${1:-}" in
"gh_login")
gh_login "${2:-}";;
"get_latest_release")
get_latest_release
echo "$LATEST_RELEASE_VER";;
*) usage;
esac
fi
| true |
98f69f4f42fd626a90691e176852b208a9f818ca | Shell | microblink/build | /toolchains/ios.universal_build.sh | UTF-8 | 6,680 | 3.359375 | 3 | [
"BSD-2-Clause"
] | permissive | ################################################################################
# A shell script for fat/universal iOS static library builds (that include both
# simulator and device slices). Taken over from a stackoverflow solution linked
# to below.
# Additional info/material:
# https://gist.github.com/adamgit/3705459
# http://red-glasses.com/index.php/tutorials/xcode4-make-a-library-in-one-file-that-works-on-both-device-and-simulator
# https://cmake.org/pipermail/cmake/2015-June/060970.html
# https://github.com/ruslo/polly
# http://atastypixel.com/blog/an-xcode-4-template-to-create-universal-static-libraries
# https://github.com/michaeltyson/iOS-Universal-Library-Template
# https://github.com/kstenerud/iOS-Universal-Framework
################################################################################
#
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4
#
# Version 2.8
#
# Latest Change:
# - Support iOS 10+
#
# Purpose:
# Automatically create a Universal static library for iPhone + iPad + iPhone Simulator from within XCode
#
# Author: Adam Martin - http://twitter.com/redglassesapps
# Based on: original script from Eonil (main changes: Eonil's script WILL NOT WORK in Xcode GUI - it WILL CRASH YOUR COMPUTER)
#
set -e
set -o pipefail
#################[ Tests: helps workaround any future bugs in Xcode ]########
#
DEBUG_THIS_SCRIPT="false"
if [ $DEBUG_THIS_SCRIPT = "true" ]
then
echo "########### TESTS #############"
echo "Use the following variables when debugging this script; note that they may change on recursions"
echo "BUILD_DIR = $BUILD_DIR"
echo "BUILD_ROOT = $BUILD_ROOT"
echo "CONFIGURATION_BUILD_DIR = $CONFIGURATION_BUILD_DIR"
echo "BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR"
echo "CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR"
echo "TARGET_BUILD_DIR = $TARGET_BUILD_DIR"
fi
#####################[ part 1 ]##################
# First, work out the BASESDK version number (NB: Apple ought to report this, but they hide it)
# (incidental: searching for substrings in sh is a nightmare! Sob)
SDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\{4\}$')
# Next, work out if we're in SIM or DEVICE
if [ ${PLATFORM_NAME} = "iphonesimulator" ]
then
OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}
ARCHITECTURES="armv7 armv7s arm64"
GCC_PREPROCESSOR_DEFINITIONS=TNUN_iOS_DEVICE_BUILD=1
else
OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}
ARCHITECTURES="i386 x86_64"
GCC_PREPROCESSOR_DEFINITIONS=TNUN_iOS_SIMULATOR_BUILD=1
fi
echo "XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})"
echo "...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}"
#
#####################[ end of part 1 ]##################
#####################[ part 2 ]##################
#
# IF this is the original invocation, invoke WHATEVER other builds are required
#
# Xcode is already building ONE target...
#
# ...but this is a LIBRARY, so Apple is wrong to set it to build just one.
# ...we need to build ALL targets
# ...we MUST NOT re-build the target that is ALREADY being built: Xcode WILL CRASH YOUR COMPUTER if you try this (infinite recursion!)
#
#
# So: build ONLY the missing platforms/configurations.
if [ "true" == ${ALREADYINVOKED:-false} ]
then
echo "RECURSION: I am NOT the root invocation, so I'm NOT going to recurse"
else
# CRITICAL:
# Prevent infinite recursion (Xcode sucks)
export ALREADYINVOKED="true"
echo "RECURSION: I am the root ... recursing all missing build targets NOW..."
echo "RECURSION: ...about to invoke: xcodebuild -configuration \"${CONFIGURATION}\" -project \"${PROJECT_NAME}.xcodeproj\" -target \"${TARGET_NAME}\" -sdk \"${OTHER_SDK_TO_BUILD}\" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO" BUILD_DIR=\"${BUILD_DIR}\" BUILD_ROOT=\"${BUILD_ROOT}\" SYMROOT=\"${SYMROOT}\"
xcodebuild -configuration "${CONFIGURATION}" -project "${PROJECT_NAME}.xcodeproj" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" ARCHS="${ARCHITECTURES}" GCC_PREPROCESSOR_DEFINITIONS="\$(value) ${GCC_PREPROCESSOR_DEFINITIONS}"
ACTION="build"
#Merge all platform binaries as a fat binary for each configurations.
# Calculate where the (multiple) built files are coming from:
CURRENTCONFIG_DEVICE_DIR=${SYMROOT}/${CONFIGURATION}-iphoneos
CURRENTCONFIG_SIMULATOR_DIR=${SYMROOT}/${CONFIGURATION}-iphonesimulator
echo "Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}"
echo "Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}"
# MODIFICATION: do not use the -universal suffix as it is not necessary and it
# (using 'default' names) plays better with CMake.
CREATING_UNIVERSAL_DIR=${SYMROOT}/${CONFIGURATION} #-universal
echo "...I will output a universal build to: ${CREATING_UNIVERSAL_DIR}"
# ... remove the products of previous runs of this script
# NB: this directory is ONLY created by this script - it should be safe to delete!
# MODIFICATION: multiple targets are supported by preventing the deletion of the
# build results folder each time script is invoked
# rm -rf "${CREATING_UNIVERSAL_DIR}"
mkdir -p "${CREATING_UNIVERSAL_DIR}"
#
echo "lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}"
if [ -d "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}.app" ]; then
echo "Running lipo in application mode..."
xcrun -sdk iphoneos lipo -create -output "${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}.app/${EXECUTABLE_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}.app/${EXECUTABLE_NAME}"
else
echo "Running lipo in library mode..."
xcrun -sdk iphoneos lipo -create -output "${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}" "${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}"
fi
#########
#
# Added: StackOverflow suggestion to also copy "include" files
# (untested, but should work OK)
#
echo "Fetching headers from ${PUBLIC_HEADERS_FOLDER_PATH}"
echo " (if you embed your library project in another project, you will need to add"
echo " a "User Search Headers" build setting of: (NB INCLUDE THE DOUBLE QUOTES BELOW!)"
echo ' "$(TARGET_BUILD_DIR)/usr/local/include/"'
if [ -d "${CURRENTCONFIG_DEVICE_DIR}${PUBLIC_HEADERS_FOLDER_PATH}" ]
then
mkdir -p "${CREATING_UNIVERSAL_DIR}${PUBLIC_HEADERS_FOLDER_PATH}"
# * needs to be outside the double quotes?
cp -r "${CURRENTCONFIG_DEVICE_DIR}${PUBLIC_HEADERS_FOLDER_PATH}"* "${CREATING_UNIVERSAL_DIR}${PUBLIC_HEADERS_FOLDER_PATH}"
fi
fi
| true |
33ba27bdf19de44f0234134050a5ea6ad9fdc4da | Shell | Lhacker/dotfiles | /linux/arch/.zshrc | UTF-8 | 827 | 2.609375 | 3 | [] | no_license | autoload colors
colors
# prompt
#local p_cdir="%B%F{blue}[%~]%f%b"
local p_cdir="%{${fg[yellow]}%}%~%{${reset_color}%}"
#local p_info="[%n@%m]"
local p_info="[%n]"
PROMPT="
$p_cdir
$p_info$ "
PROMPT2='[%n]> '
# LSColors
export LSCOLORS=gxfxcxdxbxegedabagacad
### alias ###
alias ..='cd ..'
alias ls='ls -G'
#alias rm='rm -i'
# cd_ls
function cd {
builtin cd "$@" && ls
}
# open
#alias chrome="open -a Google\ Chrome"
#alias firefox="open -a FireFox"
#alias prev="open -a Preview"
# tab settings
autoload -U compinit
compinit
zstyle ':completion:*:default' menu select=1
#bind key
#bindkey -v
#bindkey -e
#bindkey '\[[1;9C': forward-word
#bindkey '\[[1;9D': backward-word
## rbenv
#export PATH="$HOME/.rbenv/bin:$PATH"
#eval "$(rbenv init -)"
#
## pyenv
#export PATH="$HOME/.pyenv/bin:$PATH"
#eval "$(pyenv init -)"
| true |
54c0f82f18128b4fcb955580f4f3f203d416209a | Shell | dengying07/settings | /.bashrc | UTF-8 | 2,744 | 3.0625 | 3 | [] | no_license | #!/bin/bash
# ~/.bashrc skeleton
# ~/.bashrc runs ONLY on non-login subshells! (different from ksh)
# add lines here very carefully as this may execute when you don't i
# expect them to
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#echo "BASHRC has run"
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# if chimera generated aliases exist, pull them into the current ENV
[ -f ~/.bbalias ] && . ~/.bbalias
export LS_COLORS="ow=01;90:di=01;90:fi=34:ex=33"
alias ls='ls --color=auto'
use_colour=true
#alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/(\1)/'"
#if __git_ps1 > /dev/null 2>&1; then gitps1="__git_ps1"; else gitps1=":"; fi
if ${use_colour}; then
# If root
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]root@\h\[\033[01;34m\] \w#\[\033[00m\] '
else
PS1='\[\033[1;36m\]\h:\[\033[;34m\] \w \[\033[;90m$($gitps1)\]\[\033[01;34m\]\$\[\033[00m\] '
fi
#else
# PS1='\u@\h \w$(__git_ps1)\$ '
fi
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
# commandline editing
set -o emacs # emacs style command line mode (default)
#set -o vi # vi style command line mode
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# this variable needs to be set for pnewtask/pnewscript to function
# if you don't know what to put here leave it alone or ask your team.
#GROUP=put_your_group_here
alias ew='/home/pshepher/bin/eclipse_wizard.py'
alias xtermbig='xterm -fn "-*-courier-medium-r-normal--18-*-*-*-*-*-*-*" &'
alias ee='emacs -nw'
alias ..='cd ..'
alias rm=rm
alias ..='\cd ..'
alias ...='\cd ../..'
alias ....='\cd ../../..'
alias .....='\cd ../../../..'
alias cp='cp -i'
alias ln='ln -i'
alias mv='mv -i'
alias rm='rm -i'
alias cl='clear'
alias fg='fg %'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
alias l='ls -1A'
alias la='ll -a'
alias ll='ls -la --group-directories-first'
alias ee='emacs -nw'
alias arc='/home/phab/bin/arc'
alias cppcheck='/opt/swt/bin/cppcheck'
# bb specific
alias hist='ls -l /proc/self/fd' # see last 3 command run history
alias usage='fsusage'
export EDITOR="emacs -nw"
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;37;41'
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# zsh hist search not applicable
set -o emacs
alias __A=$(print '\0020') # ^P = up = previous command
alias __B=$(print '\0016') # ^N = down = next command
alias __C=$(print '\0006') # ^F = right = forward a character
alias __D=$(print '\0002') # ^B = left = back a character
alias __H=$(print '\0001') # ^A = home = beginning of line
stty erase ^?
# jump around directories https://github.com/rupa/z
# source ~/z.sh
| true |
58c0b2088df90d534f6db286e786a7070874960b | Shell | milso/dotfiles | /bashrc | UTF-8 | 1,150 | 2.625 | 3 | [] | no_license | #
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Color
alias ls='ls --color=auto'
# PS1
export PS1='\[\033k\033\\\]┌──[\e[0;36m\u\e[0m.\e[0;34m\h\e[0m]─[\e[1;34m\w\e[0m]\n└─\$ '
PATH="/home/milso/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PATH="/usr/local/lib/cw:$PATH"
# Set terminal
export TERM=rxvt-unicode-256color
# Loads of aliases
alias s='sudo packer -S'
alias r='sudo pacman -R'
alias ss='sudo packer -Ss'
alias syu='sudo pacman -Syu'
alias syy='sudo pacman -Syy'
alias qu='sudo pacman -Qu'
alias q='pacman -Q'
alias start='sudo rc.d start'
alias stop='sudo rc.d stop'
alias restart='sudo rc.d restart'
alias nc='ncmpcpp'
alias c='clear'
alias is='ps -aux | grep -v grep | grep $1'
alias k='killall $1'
alias mem='ps --sort -rss -o comm,pmem,rss -C'
alias htop='htop -u milso'
alias view='sxiv'
alias play='mplayer $1 > ~/.mplayer.log'
alias push='git push origin master'
alias commit='git commit -m '_''
alias add='git add'
alias pushfull='add . && commit && push'
alias ssid='sudo nmcli dev wifi list'
alias wifi='sudo nmcli nm wifi on'
| true |
cf18f89782b39b9f6acedc1966652e1a99a9e9a7 | Shell | leogouttefarde/dmake | /scripts/nodelist.sh | UTF-8 | 350 | 3.046875 | 3 | [] | no_license |
# Charm++ nodelist file (regenerate it after each oarsub node allocation)
NODELIST=~/nodelist
export NODELIST
# Generates Charm++ nodelist file
# each line from $OAR_NODEFILE = 1 cpu entry, usually 8 / node
awk '$0="\thost "$0" ++cpus 8"' $OAR_NODEFILE > $NODELIST
sort -u $NODELIST > tmp
echo "group main" > $NODELIST
cat tmp >> $NODELIST
rm tmp
| true |
cf89c97391e20c6bd78f93d4b68a23030d48127c | Shell | eukaryote/junkdrawer | /install-nginx.sh | UTF-8 | 3,751 | 3.78125 | 4 | [] | no_license | #!/usr/bin/env bash
# Download, compile, and install Nginx with HTTP2 enabled and LibreSSL for TLS.
set -eux -o pipefail
DEFAULT_NGINX_VERSION="1.9.12"
DEFAULT_NGINX_DIGEST="1af2eb956910ed4b11aaf525a81bc37e135907e7127948f9179f5410337da042"
LIBPCRE_VERSION="${LIBPCRE_VERSION:-8.38}"
LIBPCRE_URL="${LIBPCRE_URL:-ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${LIBPCRE_VERSION}.tar.gz}"
LIBPCRE_DIGEST="${LIBPCRE_DIGEST:-9883e419c336c63b0cb5202b09537c140966d585e4d0da66147dc513da13e629}"
NGINX_VERSION="${NGINX_VERSION:-${DEFAULT_NGINX_VERSION}}"
NGINX_URL="${NGINX_URL:-http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz}"
NGINX_DIGEST="${NGINX_DIGEST:-${DEFAULT_NGINX_DIGEST}}"
LIBRESSL_VERSION="${LIBRESSL_VERSION:-2.2.6}"
LIBRESSL_URL="${LIBRESSL_URL:-http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRESSL_VERSION}.tar.gz}"
LIBRESSL_DIGEST="${LIBRESSL_DIGEST:-1ee19994cffd047d40f63ba149115dba18a681b0cc923beec301bf424b58d64f}"
NGINX_INSTALL_DIR="${NGINX_INSTALL_DIR:-/opt/nginx/${NGINX_VERSION}}"
NGINX_TMP_DIR="${NGINX_TMP_DIR:-/var/tmp/nginx}"
NGINX_LOG_DIR="${NGINX_LOG_DIR:-/var/log/nginx}"
NGINX_DEFAULT_ERROR_LOG="${NGINX_DEFAULT_ERROR_LOG:-${NGINX_LOG_DIR}/error.log}"
NGINX_DEFAULT_HTTP_LOG="${NGINX_DEFAULT_HTTP_LOG:-${NGINX_LOG_DIR}/access.log}"
NGINX_DEFAULT_USER="${NGINX_DEFAULT_USER:-www-data}"
NGINX_DEFAULT_GROUP="${NGINX_DEFAULT_GROUP:-www-data}"
NGINX_DEFAULT_PID_FILE="${NGINX_DEFAULT_PID_FILE:-/var/run/nginx/pid}"
umask 002
verify() {
local pkg="$1"
local digest="$2"
cd $(dirname "${pkg}")
cat <<EOF | sha256sum -c
${digest} ${pkg}
EOF
}
fetch() {
local url="$1"
local digest="$2"
local destdir="$3"
local tarball=$(basename ${url})
local origdir=$(pwd)
cd ${TMPDIR:-/tmp}
if [[ ! -f "$(basename ${url})" ]]; then
curl -O "${url}"
fi
verify "${tarball}" "${digest}"
tar -C ${destdir} -xf "${tarball}"
cd ${origdir}
}
workdir=$(mktemp -d)
trap "rm -rf ${workdir}" EXIT
cd ${workdir}
fetch "${LIBRESSL_URL}" "${LIBRESSL_DIGEST}" "${workdir}"
fetch "${LIBPCRE_URL}" "${LIBPCRE_DIGEST}" "${workdir}"
fetch "${NGINX_URL}" "${NGINX_DIGEST}" "${workdir}"
# manual patch for nginx-1.9.11+ and libressl-2.2.6 until 2.2.7 is released,
# which will contain the following workaround for nginx
cat <<EOF >> ${workdir}/$(basename ${LIBRESSL_URL} .tar.gz)/Makefile.am
.PHONY: install_sw
install_sw: install
EOF
cd $(basename ${NGINX_URL} .tar.gz)
./configure \
--prefix=${NGINX_INSTALL_DIR} \
--error-log-path=${NGINX_DEFAULT_ERROR_LOG} \
--http-log-path=${NGINX_DEFAULT_HTTP_LOG} \
--with-openssl=${workdir}/$(basename ${LIBRESSL_URL} .tar.gz) \
--with-pcre=${workdir}/$(basename ${LIBPCRE_URL} .tar.gz) \
--with-http_ssl_module \
--with-http_v2_module \
--with-file-aio \
--with-threads \
--user=${NGINX_DEFAULT_USER} \
--group=${NGINX_DEFAULT_GROUP} \
--pid-path=/var/run/nginx/pid \
--http-client-body-temp-path=${NGINX_TMP_DIR}/client-body \
--http-proxy-temp-path=${NGINX_TMP_DIR}/proxy-temp \
--http-fastcgi-temp-path=${NGINX_TMP_DIR}/fastcgi-temp \
--http-uwsgi-temp-path=${NGINX_TMP_DIR}/uwsgi-temp \
--http-scgi-temp-path=${NGINX_TMP_DIR}/scgi-temp \
--without-mail_pop3_module \
--without-mail_smtp_module \
--without-mail_imap_module 2>&1 | tee .build
make 2>&1 | tee -a .build
sudo make install 2>&1 | tee -a .build
for dirpath in $(dirname ${NGINX_DEFAULT_PID_FILE}) ${NGINX_LOG_DIR} \
${NGINX_TMP_DIR}/{client-body,proxy-temp,fastcgi-temp,uwsgi-temp,scgi-temp} ; do
sudo mkdir -p -m 02755 ${dirpath}
sudo chown ${NGINX_DEFAULT_USER}:${NGINX_DEFAULT_GROUP} ${dirpath}
done
sudo touch ${NGINX_DEFAULT_PID_FILE}
sudo chown ${NGINX_DEFAULT_USER}:${NGINX_DEFAULT_GROUP} ${NGINX_DEFAULT_PID_FILE}
sudo mv .build ${NGINX_INSTALL_DIR}
| true |
75a2bc5bb317867f66db19cd1a01ac4cca195ce6 | Shell | Silverfoxcome/bash-scripting_datacamp-course | /scripts/args2.sh | UTF-8 | 158 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env bash
# Echo the first and second ARGV argument
echo $1
echo $2
# Echo out the entire ARGV array
echo $@
# Echo out the size of ARGV
echo $#
| true |
ccaa2dbac2979519ca4904c852e2b3522b1b0e25 | Shell | RawIron/learning-bash | /file_counter.bash | UTF-8 | 127 | 3.421875 | 3 | [
"Unlicense"
] | permissive |
count_files() {
ls -1 | wc -l
}
if [[ $(count_files) -le "0" ]]; then
echo "no files"
else
echo "many files"
fi
| true |
5ded938ed601733de1bc8490400f6f3be54cf97b | Shell | ifrit98/music-transformer | /awk_rand.sh | UTF-8 | 573 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/bin/sh
awk -v loop=10 -v range=100 'BEGIN{
srand()
do {
numb = 1 + int(rand() * range)
if (!(numb in prev)) {
print numb
prev[numb] = 1
count++
}
} while (count<loop)
}'
# Get Random number generator working without replacement for train/val/test split
# Convert train/val/test split data to NoteSequence tfrecord using dir2NS.sh
# Convert NoteSequence tfrecords to Performance encoding using datagen_test.sh in cf
# Get model training on the server with your data!
# Train additional models with different datasets (Experiments) | true |
05d2400ad5beafa8ffd14aac767564855e9044d1 | Shell | jmacadie/bootstrap-server | /ruby/scripts/virtual_host.sh | UTF-8 | 986 | 3.34375 | 3 | [] | no_license | #!/bin/bash
printf "\033[1A" # Move cursor one line up
printf "\033[K" # Delete to end of line
printf "\033[1A" # Move cursor one line up
printf "\033[K" # Delete to end of line
echo "Creating virtual host for the app..."
echo "......"
ROOT_PATH=$1
APP_NAME=$2
SERVER=$3
# Set up virtual host
sudo tee /etc/nginx/sites-available/$APP_NAME.conf >/dev/null <<EOF
upstream puma_$APP_NAME {
server unix:/$ROOT_PATH/var/run/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name $SERVER;
root $ROOT_PATH/current/public;
access_log $ROOT_PATH/var/log/nginx-access.log;
error_log $ROOT_PATH/var/log/nginx-error.log;
location / {
try_files \$uri @app;
}
location @app {
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$host;
proxy_set_header Origin http://\$host;
proxy_pass http://puma_$APP_NAME;
}
}
EOF
sudo ln -s \
/etc/nginx/sites-available/$APP_NAME.conf \
/etc/nginx/sites-enabled/$APP_NAME.conf
| true |
46701ef1f11db2b6da43b57152c5bd2703e13f29 | Shell | francium/dotfiles | /bash/.bash/fzf.sh | UTF-8 | 3,132 | 3.34375 | 3 | [] | no_license | # FZF
export FZF_TMUX_HEIGHT=66%
export FZF_DEFAULT_OPTS='
--layout=reverse
--color=fg:-1,bg:-1,hl:#ff6666
--color=fg+:#ffffff,bg+:#3d3d3d,hl+:#ff6666
--color=info:#ffffff,prompt:#ff6666,pointer:#ffffff
--color=marker:#ff6666,spinner:#ff6666,header:#ffffff
'
export FZF_DEFAULT_COMMAND='fd --hidden --exclude .git --exclude node_modules'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND --type d"
# Different distros seem to install it to different locations
if [[ -f /usr/share/fzf/key-bindings.bash ]]; then
# Arch
source /usr/share/fzf/key-bindings.bash
elif [[ -f /usr/share/bash-completion/completions/fzf ]]; then
# Ubuntu
source /usr/share/doc/fzf/examples/key-bindings.bash
fi
# Use fzf to find a file and open it in the $EDITOR
function fe {
FILE=`fzf`
if [ $? == 0 ]; then
$EDITOR $FILE
fi
}
# FZF git utils
# https://stackoverflow.com/questions/36513310/how-to-get-a-gits-branch-with-fuzzy-finder
#########################################################################################
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
gf() {
is_in_git_repo &&
git -c color.status=always status --short |
fzf --height 40% -m --ansi --nth 2..,.. | awk '{print $2}'
}
# Git branch
gb() {
is_in_git_repo &&
git branch --sort=committerdate -vv --color=always | grep -v '/HEAD\s' |
fzf --height 40% --ansi --multi --tac | sed 's/^..//' | awk '{print $1}' |
sed 's#^remotes/[^/]*/##'
}
# Git all branches
gbr() {
is_in_git_repo &&
git branch --sort=committerdate -vv --color=always --all | grep -v '/HEAD\s' |
fzf --height 40% --ansi --multi --tac | sed 's/^..//' | awk '{print $1}' |
sed 's#^remotes/[^/]*/##'
}
gt() {
is_in_git_repo &&
git tag --sort -version:refname |
fzf --height 40% --multi
}
gh() {
is_in_git_repo &&
git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph |
fzf --height 40% --ansi --no-sort --reverse --multi | grep -o '[a-f0-9]\{7,\}'
}
gr() {
is_in_git_repo &&
git remote -v | awk '{print $1 " " $2}' | uniq |
fzf --height 40% --tac | awk '{print $1}'
}
# bind '"\er": redraw-current-line'
# bind '"\C-g\C-f": "$(gf)\e\C-e\er"'
# bind '"\C-g\C-g": "$(gb)\e\C-e\er"'
# bind '"\C-g\C-t": "$(gt)\e\C-e\er"'
# bind '"\C-g\C-h": "$(gh)\e\C-e\er"'
# bind '"\C-g\C-r": "$(gr)\e\C-e\er"'
#########################################################################################
# List all commands using `compgen -c`
__fzf_compgen__() {
local output opts
opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore $FZF_DEFAULT_OPTS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m"
output=$(
compgen -c | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) --query "$READLINE_LINE"
) || return
READLINE_LINE=${output#*$'\t'}
if [[ -z "$READLINE_POINT" ]]; then
echo "$READLINE_LINE"
else
READLINE_POINT=0x7fffffff
fi
}
bind -m emacs-standard -x '"\ef": __fzf_compgen__'
bind -m vi-command -x '"\ef": __fzf_compgen__'
bind -m vi-insert -x '"\ef": __fzf_compgen__'
| true |
5e7b3f732fd0fa6ec5c8d2d5dd6cde956f217729 | Shell | harra210/WGS_Scripts | /fastq/CatFastq.sh | UTF-8 | 1,133 | 3.640625 | 4 | [] | no_license | #!/bin/bash
pwd=$(pwd)
cd ..
pwd_base=$(pwd)
cd $pwd
###### INTERACTIVE SECTION #######
echo "What directory are the fastq's needed to be concatenated located in?"
read -e -p "Fastq Directory: " FASTQ_DIR
echo "What do you want to name the concatenated file?"
read -e -p "Filename: " FN
echo "What Read (R1 or R2) are you wanting to concatenate?"
read -e -p "Read: " READ
##### END INTERACTIVE SECTION ######
NUMREAD=$(sed 's/R//' <<< "$READ")
cd $FASTQ_DIR
#find . -maxdepth 1 -name "*_"$READ"_*" -printf '%f\n' &> $pwd_base/tmp/fastq/catfastq.tmp
find . -maxdepth 1 -name "*_"$READ"*" -printf '%f\n' &> $pwd_base/tmp/fastq/catfastq.tmp
#
cd $pwd_base/tmp/fastq/
IFS=,$'\n' read -d '' -r -a fastq < catfastq.tmp
sortedfastq=( $(printf "%s\n" ${fastq[*]} | sort -V ) )
declare -a sortedfastq
unset IFS
##Debug Section
#echo $NUMREAD
#echo ${sortedfastq[*]}
echo "cat ${sortedfastq[*]} > "$FN"_"$NUMREAD".fastq.gz"
echo "verify command input"
read -sp "`echo -e 'Press any key to continue or Ctrl+C to abort \n\b'`" -n1 key
echo "Working"
#sleep 20;
#
cd $FASTQ_DIR;
cat ${sortedfastq[*]} > "$FN"_"$NUMREAD".fastq.gz
echo "done"
#END
| true |
a00cff964f1f7a99e0921e4977436e1dac9c977a | Shell | Daroth/kev-web-editor | /install.sh | UTF-8 | 905 | 3.375 | 3 | [] | no_license | #! /bin/sh
echo "Kevoree Web Editor is installing"
# clean & install maven projects (compile library & stuff with KMF & Kotlin)
mvn clean
mvn install
echo "Maven install: success"
# move compiled .js files to kev-web-editor folder
cp org.kevoree.model.js/target/js/kevoree.js org.kevoree.tools.editor.web/public/js/lib
cp org.kevoree.model.js/target/js/kotlin.js org.kevoree.tools.editor.web/public/js/lib/kotlin
echo "Javascript libraries (kevoree.js & kotlin.js) moved to Web app folder: success"
# export a JAVA_HOME environment variable to wrap Java in Node
echo -n "Give a valid Java JDK path (most of the time /usr/lib/jvm/le_version_u_use): "
read java_home
export JAVA_HOME=$java_home
cd org.kevoree.tools.editor.web
npm install
echo "Kevoree Web Editor installed successfully :)"
echo "(exec 'npm start' in org.kevoree.tools.editor.web/ folder to launch app on default port 3042)"
exit 0 | true |
49985c42fc8bef2ce4dddc3138bcbc1048be1b78 | Shell | github188/nodejs_workspace | /ipr/build/install.sh | UTF-8 | 3,237 | 2.828125 | 3 | [] | no_license | #!/bin/bash
logger "[box] Installing conwin box ..."
logger "[box] PATH=$PATH"
logger "[box] env = $(export)"
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
apt-get -y install htop tmux wget imagemagick graphicsmagick autossh socat build-essential moreutils xinetd
sed -i 's/\(disable\s*=\s*\)yes/\1no/' /etc/xinetd.d/time
if [ -d "/usr/lib/box" ]; then
logger "[box] Save current box to box_last"
[ -d "/usr/lib/box_last" ] && rm -rf /usr/lib/box_last
mv /usr/lib/box /usr/lib/box_last
fi
mkdir /usr/lib/box
cp -fRLH * /usr/lib/box
cp -f etc/rc.local /etc/rc.local
# cp etc/box.json /etc/box.json
[ ! -f "/etc/box.json" ] && cp etc/box.json /etc/box.json
if [ "$(cat /etc/network/interfaces | grep conwin)" = "" ]; then
logger "[box] Init network settings"
cp etc/network/interfaces /etc/network
cp etc/network/eth /etc/network/eth0
cp etc/network/eth /etc/network/eth1
sed -i 's/ethx/eth0/' /etc/network/eth0
sed -i 's/ethx/eth1/' /etc/network/eth1
fi
userdel conwin
useradd conwin -s /usr/bin/conwin-rescue
echo conwin:cn8000 | chpasswd
chmod +w /etc/sudoers
user=$(cat /etc/sudoers | grep "conwin")
if [ "$user" = "" ]; then
echo "conwin ALL=(ALL:ALL) ALL" >> /etc/sudoers
fi
chmod -w /etc/sudoers
ln -f /usr/local/bin/node /usr/bin/node
ln -fs /usr/lib/box/dashboard/bin/dashboard /usr/bin/dashboard
ln -fs /usr/lib/box/box/box.js /usr/bin/box
ln -fs /usr/lib/box/fs/fs.js /usr/bin/fs
ln -fs /usr/lib/box/bin/box-net-get /usr/bin/box-net-get
ln -fs /usr/lib/box/bin/box-net-set /usr/bin/box-net-set
ln -fs /usr/lib/box/bin/box-net-stat /usr/bin/box-net-stat
ln -fs /usr/lib/box/bin/box-net-restart /usr/bin/box-net-restart
ln -fs /usr/lib/box/bin/jnode-get /usr/bin/jnode-get
ln -fs /usr/lib/box/bin/udp_boxinfo /usr/bin/udp_boxinfo
ln -fs /usr/lib/box/bin/boxinfo /usr/bin/boxinfo
ln -fs /usr/lib/box/bin/box-clean /usr/bin/box-clean
ln -fs /usr/lib/box/bin/boxset /usr/bin/boxset
ln -fs /usr/lib/box/bin/box-start /usr/bin/box-start
ln -fs /usr/lib/box/bin/box-stop /usr/bin/box-stop
ln -fs /usr/lib/box/bin/dashboard-start /usr/bin/dashboard-start
ln -fs /usr/lib/box/bin/fs-start /usr/bin/fs-start
ln -fs /usr/lib/box/bin/box-restart /usr/bin/box-restart
ln -fs /usr/lib/box/bin/netinfo /usr/bin/netinfo
ln -fs /usr/lib/box/bin/start.sh /usr/bin/start.sh
cp -f /usr/lib/box/bin/json /usr/bin/json
cp -f /usr/lib/box/bin/conwin-rescue /usr/bin/conwin-rescue
logger "[box] install node modules"
logger "[box] python = $(which python)"
logger "[box] npm = $(which npm)"
logger "[box] g++ = $(which g++)"
cd /usr/lib/box
[ -f "node_modules.v2.tgz" ] && rm node_modules.v2.tgz
wget http://cos.conwin.cn/download/box/node_modules.v2.tgz
tar -xf node_modules.v2.tgz
# npm install > /var/log/npm.log
# mv misc/bcrypt node_modules/
# cd node_modules/bcrypt
# npm install
cd /usr/lib/box
sed -i "s/\(start *= *\).*/\1start.sh/" /etc/cwcdn.conf
logger "[box] Install finished"
port=$(cat /etc/cwcdn.conf | grep broadcast | awk -F = '{print $2}')
if [ "$port" = "" ]; then
echo "broadcast=8002" >> /etc/cwcdn.conf
fi
eval $(json -f /etc/box.json .server_fs_root/ftproot)
echo ftproot=$ftproot
[ ! -d $ftproot ] && mkdir -p $ftproot
exit 0
| true |
36a96dde1a59ab02b9a651a7a41ce8d0624076d9 | Shell | blackfly19/keda-connectors | /hack/lint.sh | UTF-8 | 912 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
STATUS=0
for dir in $(find . -name version); do
connector=$(dirname $dir)
echo "Checking $connector"
pushd $connector > /dev/null
go mod verify
go mod download
LOCAL_STATUS=0
assert-nothing-changed() {
local diff
"$@" >/dev/null || return 1
if ! diff="$(git diff -U1 --color --exit-code)"; then
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
git checkout -- .
LOCAL_STATUS=1
fi
}
assert-nothing-changed go fmt ./...
assert-nothing-changed go mod tidy
golangci-lint run --out-format=github-actions --timeout=5m --path-prefix $connector || LOCAL_STATUS=$?
popd > /dev/null
if [ "$LOCAL_STATUS" = "1" ] ; then
STATUS=$LOCAL_STATUS
fi
done
echo "Status: $STATUS"
exit $STATUS
| true |
0ffd9c3fa90759b27287171db064c9ae423559d8 | Shell | bamishr/JenkinsMultisharedRepo | /deploy_upload_package.sh | UTF-8 | 898 | 3.28125 | 3 | [] | no_license | #!/bin/bash
src=$1
dest=$2
projectname=$2
runEnv=$3
#uploadfile
if [ -d $src/lib ] && [ -d $src/conf ];then
cd $src && tar -zcf $projectname.tar.gz conf lib
uploadfile=$src/$projectname.tar.gz
elif [ -n "$(ls $src/*.js 2>/dev/null)" ] || [ -n "$(ls $src/*.html 2>/dev/null)" ] || [ -n "$(ls $src/*.json 2>/dev/null)" ];then
cd $src && tar -zcf $projectname.tar.gz ./*
uploadfile=$src/$projectname.tar.gz
elif [ -f $src ];then
uploadfile=$src
else
echo 'error path'
fi
echo 'cksum:'
cksum $uploadfile
echo $runEnv
if [ $runEnv = 'uat' ];then
echo 'upload to uat'
elif [ $runEnv = 'prod' ];then
echo 'upload to prod'
else
mkdir -p $runEnv && scp -P 2202 -r $runEnv apps@121.201.69.220:/home/apps/beta-repository
mkdir -p $dest && scp -P 2202 -r $dest apps@121.201.69.220:/home/apps/beta-repository/$runEnv
scp -P 2202 $uploadfile apps@121.201.69.220:/home/apps/beta-repository/$runEnv/$dest
fi
| true |
cddd67e16ab8156bf29b9297c0d25b8d3d480273 | Shell | hadro/ghfc | /recurring-reports/log_aggregation_jsonl.sh | UTF-8 | 1,282 | 2.90625 | 3 | [] | no_license | today=`date +%Y-%m-%d`
echo $today
HOME=/home/hadro/
cd /home/hadro/ghfc/recurring-reports/
# Download the log files from the GHFC server
echo "Pulling log files..."
cp /home/christopher/check-in-stats/shop_log.jsonl /home/hadro/ghfc/recurring-reports/logs/shop_log.jsonl
# Use some pandas to extract stuff we know we'll need
echo "Processing logs into log.csv..."
python3 /home/hadro/ghfc/recurring-reports/process_logs_jsonl.py
echo "Running RMarkdown script..."
#Rscript -e "rmarkdown::render('report.Rmd',
# output_file = paste('report.', Sys.Date(),
# '.html', sep=''
# ))"
Rscript -e "rmarkdown::render('/home/hadro/ghfc/recurring-reports/report.Rmd',
output_file = paste('/home/hadro/ghfc/recurring-reports/reports/report_', Sys.Date(),
'.html', sep=''))"
# Send it via email until we get an http version set up
#echo "Sending an email now"
#echo "Sending the report for" $today | mailx -A report_$today.html -s "Subject" josh.hadro@gmail.com
#echo "Sending the report for" $today | mailx -s "GHFC Report for $today" -A ./report_$today.html josh.hadro@gmail.com
# Push to git repo
git add /home/hadro/ghfc/recurring-reports/reports/report_$today.html
git commit -m "Add report for $today"
git push
echo "Done!"
| true |
71898b1eaa8d56a4a1a5ccbcc5c698e4a0b243c9 | Shell | ronaldahmed/morph-bandit | /wraps/gen_exp_mono-emb_ufal.sh | UTF-8 | 412 | 2.65625 | 3 | [] | no_license | #!/bin/bash
tbname=$1
input=$2
njobs=20
outname="mono-$tbname-ufal.sh"
echo "#!/bin/bash" > $outname
echo "" >> $outname
echo "qsub -cwd -l mem_free=15G,act_mem_free=15G,h_vmem=22G -p -50 -pe smp $njobs \\" >> $outname
echo "-o $outname.out \\" >> $outname
echo "-e $outname.err \\" >> $outname
echo "$HOME/fastText/fasttext skipgram -minCount 1 -input $input -output emb/$tbname -thread $njobs " >> $outname
| true |
de5770957111e766ac54c97a6a2adc90e0294f86 | Shell | gatechain/iavl | /benchmarks/setup/RUN_BENCHMARKS.sh | UTF-8 | 510 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/sh
# This runs benchmarks, by default from master branch of
# github.com/gatechain/iavl
# You can customize this by optional command line args
#
# INSTALL_USER.sh [branch] [repouser]
#
# set repouser as your username to time your fork
BRANCH=${1:-master}
REPOUSER=${2:-tendermint}
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$HOME/go/bin
export GOPATH=$HOME/go
go get -u github.com/${REPOUSER}/iavl
cd ~/go/src/github.com/${REPOUSER}/iavl
git checkout ${BRANCH}
make bench > results.txt
| true |
94f5b94df1fe358c65e01480b613a99f06a67391 | Shell | rbieniek/BGP4J | /etc/init.d/bgp4j | UTF-8 | 5,484 | 3.953125 | 4 | [
"Apache-2.0",
"MIT"
] | permissive | #!/bin/bash
#
### BEGIN INIT INFO
# Provides: bgg4j
# Required-Start: $local_fs $network $remote_fs $syslog
# Required-Stop: $local_fs $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop the BGP4J daemon
# Description: BGP4J is a BGP routing daemon implementation written in Java
### END INIT INFO
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PREFIX=
C_PATH=$PREFIX/etc/bgp4j
D_PATH=$PREFIX/bin
# Local Daemon selection may be done by using /etc/quagga/daemons.
# See /usr/share/doc/quagga/README.Debian.gz for further information.
DAEMONS="BgpDaemon"
# Print the name of the pidfile.
pidfile()
{
echo "$PREFIX/var/run/bgp4j/$1.pid"
}
# Check if daemon is started by using the pidfile.
started()
{
[ -e `pidfile $1` ] && kill -0 `cat \`pidfile $1\`` 2> /dev/null && return 0
return 1
}
# Check if the daemon is activated and if its executable and config files
# are in place.
# params: daemon name
# returns: 0=ok, 1=error
check_daemon()
{
# Check in the configuration file is there
if [ -r "$C_PATH/$1-conf.xml" ]; then
return 0
fi
# check for daemon binary
if [ ! -x "$D_PATH/$1" ]; then return 1; fi
return 0
}
# Starts the server if it's not alrady running according to the pid file.
# The Quagga daemons creates the pidfile when starting.
start()
{
echo -n " $1"
if ! check_daemon $1; then return; fi
start-stop-daemon \
--start \
--pidfile=`pidfile $1` \
--make-pidfile \
--background \
--chuid nobody:nogroup \
--exec "$D_PATH/$1" \
-- \
-c $C_PATH/$1-conf.xml \
-l $C_PATH/log-conf.xml
}
# Stop the daemon given in the parameter, printing its name to the terminal.
stop()
{
if ! started "$1" ; then
echo -n " ($1)"
return 0
else
PIDFILE=`pidfile $1`
PID=`cat $PIDFILE 2>/dev/null`
start-stop-daemon \
--stop \
--quiet \
--oknodo \
--pidfile=`pidfile $1` \
--exec "$D_PATH/$1"
#
# Now we have to wait until $DAEMON has _really_ stopped.
#
if test -n "$PID" && kill -0 $PID 2>/dev/null; then
echo -n " (waiting) ."
cnt=0
while kill -0 $PID 2>/dev/null; do
cnt=`expr $cnt + 1`
if [ $cnt -gt 60 ]; then
# Waited 120 secs now, fail.
echo -n "Failed.. "
break
fi
sleep 2
echo -n "."
done
fi
echo -n " $1"
rm -f `pidfile $1`
fi
}
convert_daemon_prios()
{
for name in $DAEMONS ; do
# First, assign the value set by the user to $value
eval value=\$$name
# Daemon not activated or entry missing?
if [ "$value" = "no" -o "$value" = "" ]; then value=0; fi
# These strings parsed for backwards compatibility.
if [ "$value" = "yes" -o "$value" = "true" ]; then value=1; fi
# Zebra is threatened special. It must be between 0=off and the first
# user assigned value "1" so we increase all other enabled daemons' values.
if [ "$name" != "zebra" -a "$value" -gt 0 ]; then value=`expr "$value" + 1`; fi
# If e.g. name is zebra then we set "zebra=yes".
eval $name=$value
done
}
# Stops all daemons that have a lower level of priority than the given.
# (technically if daemon_prio >= wanted_prio)
stop_prio()
{
local wanted_prio
local daemon_prio
local daemon_list
wanted_prio=$1
daemon_list=${2:-$DAEMONS}
echo -n "Stopping Quagga daemons (prio:$wanted_prio):"
for prio_i in `seq 10 -1 $wanted_prio`; do
for daemon_name in $daemon_list; do
eval daemon_prio=\$$daemon_name
if [ $daemon_prio -eq $prio_i ]; then
stop "$daemon_name"
fi
done
done
echo "."
}
# Starts all daemons that have a higher level of priority than the given.
# (technically if daemon_prio <= wanted_prio)
start_prio()
{
local wanted_prio
local daemon_prio
local daemon_list
wanted_prio=$1
daemon_list=${2:-$DAEMONS}
echo -n "Starting BGP4J daemons (prio:$wanted_prio):"
for prio_i in `seq 1 $wanted_prio`; do
for daemon_name in $daemon_list; do
eval daemon_prio=\$$daemon_name
if [ $daemon_prio -eq $prio_i ]; then
start "$daemon_name"
fi
done
done
echo "."
}
#########################################################
# Main program #
#########################################################
# Config broken but script must exit silently.
[ ! -r "$C_PATH/daemons" ] && exit 0
. "$C_PATH/daemons"
# Set priority of un-startable daemons to 'no' and substitute 'yes' to '0'
convert_daemon_prios
# Just for me :-)
if [ "$DEBIAN_SCRIPT_DEBUG" != "" ]; then
for name in $DAEMONS; do
echo -n "$name="; eval echo \$$name
done
fi
if [ ! -d $PREFIX/var/run/bgp4j ]; then
mkdir -p $PREFIX/var/run/bgp4j
chown nobody:nogroup $PREFIX/var/run/bgp4j
chmod 755 $PREFIX/var/run/bgp4j
fi
if [ ! -d $PREFIX/var/log/bgp4j ]; then
mkdir -p $PREFIX/var/log/bgp4j
chown nobody:nogroup $PREFIX/var/log/bgp4j
chmod 755 $PREFIX/var/log/bgp4j
fi
case "$1" in
start)
# Start all daemons
cd $C_PATH/
start_prio 10 $2
;;
stop)
# Stop all daemons at level '0' or 'stop'
stop_prio 0 $2
;;
restart|force-reload)
$0 stop $2
sleep 1
$0 start $2
;;
*)
echo "Usage: /etc/init.d/bgp4j {start|stop|restart|force-reload|<priority>} [daemon]"
echo " E.g. '/etc/init.d/bgp4j 5' would start all daemons with a prio 1-5."
echo " Read /usr/share/doc/bgp4j/README.Debian for details."
exit 1
;;
esac
exit 0
| true |
39b0d7e022e3a24cd5fb4940a44fab89e220b300 | Shell | acieroid/scraping-wasm | /scraping/docker/launch-node.sh | UTF-8 | 439 | 3.4375 | 3 | [] | no_license | #!/bin/sh
if [ "$#" -ne 2 ]; then
echo 'Requires the server URL as argument (e.g., 127.0.0.1:6345 or 10.0.0.1:6345) AND the node URL as argument (e.g., 127.0.0.1:6346 or 10.0.0.1:6346)'
exit 1
fi
echo 'Building node'
./build-node.sh || exit 1
echo 'Launching it'
SERVER_URL="$1"
NODE_URL="$2"
PORT="$(echo $NODE_URL | cut -d: -f2)"
docker run -p "$PORT:$PORT" --dns 8.8.8.8 --dns 8.8.4.4 -it node ./node "$SERVER_URL" "$NODE_URL"
| true |
e442e8f8b42566147f1693f4954248f7c4ea22d8 | Shell | usmanjavaiduj/OSM | /MON/osm_mon/plugins/vRealiseOps/vROPs_Webservice/install.sh | UTF-8 | 3,371 | 3.53125 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env bash
##
# Copyright 2016-2017 VMware Inc.
# This file is part of ETSI OSM
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# For those usages not covered by the Apache License, Version 2.0 please
# contact: osslegalrouting@vmware.com
##
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SSL_Cert_Dir="${BASEDIR}/SSL_certificate"
THISHOST=$(hostname -f)
Domain_Name="${THISHOST}"
#Domain_Name="www.vrops_webservice.com"
WebServiceFile="${BASEDIR}/vrops_webservice"
echo '
#################################################################
##### Installing Require Packages #####
#################################################################'
#Function to install packages using apt-get
function install_packages(){
[ -x /usr/bin/apt-get ] && apt-get install -y $*
#check properly installed
for PACKAGE in $*
do
PACKAGE_INSTALLED="no"
[ -x /usr/bin/apt-get ] && dpkg -l $PACKAGE &>> /dev/null && PACKAGE_INSTALLED="yes"
if [ "$PACKAGE_INSTALLED" = "no" ]
then
echo "failed to install package '$PACKAGE'. Revise network connectivity and try again" >&2
exit 1
fi
done
}
apt-get update # To get the latest package lists
[ "$_DISTRO" == "Ubuntu" ] && install_packages "python-yaml python-bottle python-jsonschema python-requests libxml2-dev libxslt-dev python-dev python-pip openssl"
[ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "python-jsonschema python-requests libxslt-devel libxml2-devel python-devel python-pip openssl"
#The only way to install python-bottle on Centos7 is with easy_install or pip
[ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && easy_install -U bottle
#required for vmware connector TODO move that to separete opt in install script
sudo pip install --upgrade pip
sudo pip install cherrypy
echo '
#################################################################
##### Genrate SSL Certificate #####
#################################################################'
#Create SSL Certifcate folder and file
mkdir "${SSL_Cert_Dir}"
openssl genrsa -out "${SSL_Cert_Dir}/${Domain_Name}".key 2048
openssl req -new -x509 -key "${SSL_Cert_Dir}/${Domain_Name}".key -out "${SSL_Cert_Dir}/${Domain_Name}".cert -days 3650 -subj /CN="${Domain_Name}"
echo '
#################################################################
##### Start Web Service #####
#################################################################'
nohup python "${WebServiceFile}" &
echo '
#################################################################
##### Done #####
#################################################################'
| true |
124a8285a44875710b5614b9cabed09436e49ead | Shell | ajtock/RNAseq_meiocyte_Walker_Feng_2018_NatGenet | /WT/leaf/fastq_gzip_best.sh | UTF-8 | 387 | 3.015625 | 3 | [] | no_license | #!/bin/bash
## ************** TEST BEFORE USE ON IMPORTANT FASTQ FILES ******************
# Example usage via condor submission system on hydrogen node7:
# csmit -m 10G -c 1 "bash fastq_gzip_best.sh SRR4204566 WT_RNASeq_leaf_Rep3_SRR4204566"
run1=$1
name=$2
if [ ! -f "$name.fastq.gz" ]; then
gzip -c -k --best $run1".fastq" > $name.fastq.gz;
else
echo "skipping $name"
fi
| true |
9c31b7cac22b327fb82a2e4e69cfb6f0944ea93d | Shell | fanx-dev/fanx | /compiler/build_javaEmit.sh | UTF-8 | 195 | 2.53125 | 3 | [
"AFL-3.0"
] | permissive |
OUT=../env/lib/java
NAME=fanx
mkdir -p ../env/lib/java/stub
mkdir temp
find ./javaEmit -name '*.java' | xargs javac -source 8 -target 8 -g -d temp
jar cvf $OUT/$NAME.jar -C temp .
rm -rf temp
| true |
15cead97ef007d1314be1c67b455d3f34f9d7d5b | Shell | denfrost/NB-MLM | /prepare_data/token_scores.sh | UTF-8 | 1,407 | 3.265625 | 3 | [] | no_license | #!/bin/bash
DATASET=$1
#if [ -n "$SLURM_JOB_ID" ] ; then
# DIR=$(dirname "$(scontrol show job "$SLURM_JOB_ID" | grep -oP "Command=\K.*sh")")
#else
DIR=$(dirname "$(realpath "$0") ")
#fi
MIN_DF_RE="^[0-9]+$"
ORIGIN_DIR="$DIR"/../"$DATASET"_experiments/DATA/"$DATASET"-clf/
OUT_DIR="$DIR"/../"$DATASET"_experiments/SCORES
PY_SCRIPT="$DIR"/../bayes_token_temperature_fix/make_token_scores.py
if [ -n "$3" ]; then
DICT_DIR="$DIR"/../"$DATASET"_experiments/DATA/"$DATASET"-mlm-"$3"-bin
else
DICT_DIR="$DIR"/../"$DATASET"_experiments/DATA/"$DATASET"-mlm-bin
fi
DICT_PATH="$DICT_DIR"/input0/dict.txt
if ! [[ -d "$ORIGIN_DIR" ]]; then
bash "$DIR"/clf_data.sh "$DATASET"
fi
if [ -n "$2" ]; then
if ! [[ $2 =~ $MIN_DF_RE ]]; then
OUT_DIR="$OUT_DIR"/freq/
mkdir -p "$OUT_DIR"
python "$PY_SCRIPT" --sqrt \
--input_dir "$ORIGIN_DIR" \
--second_dict "$DICT_PATH" \
--output_dir "$OUT_DIR"
else
OUT_DIR="$OUT_DIR"/m_"$2"/
mkdir -p "$OUT_DIR"
python "$PY_SCRIPT" --min_df "${2}" \
--input_dir "$ORIGIN_DIR" \
--second_dict "$DICT_PATH" \
--output_dir "$OUT_DIR"
fi
else
OUT_DIR="$OUT_DIR"/m_50/
mkdir -p "$OUT_DIR"
python "$PY_SCRIPT" --min_df 50 \
--input_dir "$ORIGIN_DIR" \
--second_dict "$DICT_PATH" \
--output_dir "$OUT_DIR"
fi
| true |
72f15bd0fab6faa8ebe94955ec08a964302e6b83 | Shell | uditha-madusanka/conky_crickinfo | /scoreboard.sh | UTF-8 | 1,384 | 3.71875 | 4 | [] | no_license | #!/bin/bash
# This script will show cricket live score of a selected match.
#
if [ $# -lt 1 ]; then
echo -e "!!Missing the match ID\nUsage:\n-----\n$0 <Match ID>\nExample: $0 895594\nNOTE: You can use matchIDFinder.sh to find out the Match ID"
exit 0;
fi
# Check the running operating system
if [[ `uname` == Darwin ]]
then
FSV="[||<]"
elif [[ `uname` == Linux ]]
then
FSV="(||<)"
fi
URL=http://www.espncricinfo.com/ci/engine/match/$1.html?view=scorecard;wrappertype=none
# Show match summary
printf "Match Summary\n---------------------\n"
# Title
curl -s $URL| grep 'team-1\|team-2' | awk -v FS="(\">|<)" '{print $3$5}'
echo ""
# Summary
curl -s http://www.espncricinfo.com/ci/engine/match/$1.html | grep \<title\> | cut -d">" -f2 | cut -d"|" -f 1 | sed -e "s/,/\n/g" -e "s/(/- /g" -e "s/)//g" | sed -e "s/^ //g"
# Show full scoreboard
printf "\nFull Scoreboard\n----------------------\n"
curl -s $URL| grep -A3 'bowling-table\|batsman-name' \
| sed -e "s/bowling-table/batsman-name\ndismissal-info\nbold\ntd\ class=\"\"\n/g" \
| awk -F">" '/batsman-name/ {b=$3} /dismissal-info/ {d=$2} /bold/ {a=$2} /td class=""/ {c=$2; print "|"b"|"d"|"a"|"c}' \
|sed -e "s/\/td|//g" -e "s/\/a//g" -e "s/|//g" \
| awk -v FS=$FSV '{printf "%s%-6s%s%s\n", $3, "("$4")", " "$1, " "$2}' \
| sed -e "s/^()/--------------------/g" -e "s/†//g" -e "s/&/\&/g"
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.