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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9a239d2000b0214bae68b8218908bc246ccd009f
|
Shell
|
NGTS/zlp-script
|
/testing/test_add_sysrem.sh
|
UTF-8
| 1,369
| 3.53125
| 4
|
[] |
no_license
|
#!/usr/bin/env sh
set -eu
BASEDIR=$(dirname $0)/..
find_file() {
find testing/data -name $1
}
does_file_exist() {
FNAME=$(find_file $1)
if [ -z ${FNAME} ]; then
return 1
else
return 0
fi
}
run_test() {
readonly outputname=$1
readonly tamname=$2
readonly test_fname="$TMPDIR/test_photom.fits"
cp $outputname $test_fname
python $BASEDIR/scripts/combine_with_sysrem.py -p $test_fname -t $tamname -v
verify
}
verify() {
python <<EOF
from astropy.io import fits
with fits.open("$test_fname") as infile:
assert "tamflux" in infile
imagelist = infile['imagelist'].data
catalogue = infile['catalogue'].data
imagelist_names = set([col.name for col in imagelist.columns])
catalogue_names = set([col.name for col in catalogue.columns])
assert 'AJ' in imagelist_names, "Cannot find AJ imagelist column"
assert 'ZERO_POINT' in imagelist_names, "Cannot find tamuz zero point imagelist column"
assert 'CI' in catalogue_names, 'Cannot find CI catalogue column'
EOF
}
main() {
if ! does_file_exist "test_output.fits"; then
echo "Cannot find photometry file" >&2
exit 1
fi
if ! does_file_exist "test_tamout.fits"; then
echo "Cannot find tamuz file" >&2
exit 1
fi
run_test $(find_file test_output.fits) $(find_file test_tamout.fits)
}
main
| true
|
dc48659f9da94bb7c7bff0a0bfc2fce68a586075
|
Shell
|
thirumurthy/dbbackup
|
/backupdb.sh
|
UTF-8
| 493
| 3.09375
| 3
|
[
"MIT"
] |
permissive
|
#! /bin/sh
cd $(dirname $0)
DB=$1
DBUSER=$2
DBPASSWD=$3
HOST=$4
FILE=$DB-$(date +%F).sql
mysqldump --routines "--user=${DBUSER}" -h $HOST --password=$DBPASSWD $DB > $PWD/$FILE
gzip $FILE
echo Created $PWD/$FILE*
# Code Copied from https://stackoverflow.com/questions/5075198/how-to-export-mysql-database-with-triggers-and-procedures
# Example Usage : backupdb.sh my_db dev_user dev_password
# Get this code Using wget https://raw.githubusercontent.com/thirumurthy/dbbackup/master/backupdb.sh
| true
|
512d771b71a5d7551e741cd2175620c24e54bb91
|
Shell
|
LeonWilzer/unix-scripts
|
/Bash/passer
|
UTF-8
| 961
| 4.59375
| 5
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# This is a script which runs a command after an optional countdown if the provided passphrase has been correctly entered.
# If that is not the case, it will merely print "Wrong pass!"
# Standard Variables
COUNT=0
RUN="echo Pass is correct!"
Pass=""
# These equal to the option flags:
# -t 0
# -r "echo Pass is correct"
# -p ""
# This function reasigns any values given by the option flags
while getopts p:r:t: option
do
case "${option}"
in
p) PASS=${OPTARG};;
r) RUN=${OPTARG};;
t) COUNT=${OPTARG};;
esac
done
# Main part of the Script.
# It asks for the Passphrase, reads and writes the user input to the variable pw and then it compares pw with the actual passphrase and then runs the countdown and the provided command, if succesful.
echo -n Pass:
read -s pw
echo
if [ $pw == $PASS ]
then
for (( i=$COUNT; i>0; i-- ))
do
echo "Execution in $i..."
sleep 1
done
$RUN
else
echo Wrong Pass!
fi
# End of Script
| true
|
6983fcf0e4f2219370407c29f46faca1f1267296
|
Shell
|
yaofan97/centos7-auto-config-shell
|
/centos7ไธ้ฎ้
็ฝฎ/scripts/configure_rsyslog.sh
|
UTF-8
| 4,247
| 3.421875
| 3
|
[] |
no_license
|
#!/bin/bash
###############################################################
#File Name : configure_rsyslog_for_server.sh
#Arthor : kylin
#Created Time : Tue 22 Sep 2015 03:47:57 PM CST
#Update Time : Fri Nov 20 22:49:39 CST 2015
#Email : kylinlingh@foxmail.com
#Github : https://github.com/Kylinlin
#Version : 2.0
#Description : ้
็ฝฎRsyslog็ณป็ป
###############################################################
source ~/global_directory.txt
CONFIGURED_OPTIONS=$GLOBAL_DIRECTORY/../log/configured_options.log
UNCONFIGURED_OPTIONS=$GLOBAL_DIRECTORY/../log/unconfigured_options.log
function Configure_Rsyslog_For_Server {
echo -e "\e[1;33mInstalling and configuring rsyslog for remote server,please wait for a while...\e[0m"
rpm -qa | grep rsyslog > /dev/null
if [[ $? == 1 ]]; then
yum install rsyslog -y > /dev/null
fi
RLOG_CONF=/etc/rsyslog.conf
if [[ -f $RLOG_CONF.bak ]]; then
rm -f $RLOG_CONF
mv $RLOG_CONF.bak $RLOG_CONF
else
cp $RLOG_CONF $RLOG_CONF.bak
fi
sed -i '/^#$ModLoad imklog/c \$ModLoad imklog' $RLOG_CONF
sed -i '/^#$ModLoad immark /c \$ModLoad immark' $RLOG_CONF
# sed -i '/^#$ModLoad imudp/c \$ModLoad imudp' $RLOG_CONF
# sed -i '/^#$UDPServerRun 514/c \$UDPServerRun 514' $RLOG_CONF
sed -i '/^#$ModLoad imtcp/c \$ModLoad imtcp' $RLOG_CONF
sed -i '/^#$InputTCPServerRun 514/c \$InputTCPServerRun 514' $RLOG_CONF
sed -i '22i $template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log" *' $RLOG_CONF
sed -i '23i *.* ?RemoteLogs' $RLOG_CONF
sed -i '24i & ~' $RLOG_CONF
systemctl restart rsyslog
systemctl enable rsyslog.service > /dev/null
echo -e "\e[1;32m+Configure remote log system \e[0m" >> $CONFIGURED_OPTIONS
}
function Configure_Rsyslog_For_Client {
echo -e "\e[1;33mInstalling and configuring rsyslog, please wait for a while...\e[0m"
rpm -qa | grep rsyslog > /dev/null
if [[ $? == 1 ]]; then
yum install rsyslog -y > /dev/null
fi
#Configure rsyslog to send logs
RLOG_CONF=/etc/rsyslog.conf
if [[ -f $RLOG_CONF.bak ]]; then
rm -f RLOG_CONF
mv $RLOG_CONF.bak $RLOG_CONF
else
cp $RLOG_CONF $RLOG_CONF.bak
fi
echo -n -e "\e[1;35mEnter the remote server's ip: \e[0m"
read IP
echo "*.* @@$IP:514" >> $RLOG_CONF
#Configure the remote server to record all command.
BASH_CONF=/etc/bashrc
if [[ -f $BASH_CONF.bak ]]; then
rm -f $BASH_CONF
mv $BASH_CONF.bak $BASH_CONF
else
cp $BASH_CONF $BASH_CONF.bak
fi
cat >> $BASH_CONF<<EOF
export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });logger "[euid=\$(whoami)]":\$(who am i):[\`pwd\`]"\$msg"; }'
EOF
source /etc/bashrc
source /etc/bashrc
systemctl restart rsyslog > /dev/null
systemctl enable rsyslog.service > /dev/null
echo -e "\e[1;32m+Configure remote log system \e[0m" >> $CONFIGURED_OPTIONS
}
function Using_Log_Scripts {
echo -e "\e[1;33mUse vbird's script to analyze log, please wait for a while...\e[0m"
cd $GLOBAL_DIRECTORY/../packages
tar -xf logfile_centos7.tar.gz -C /
cat > /etc/cron.d/loganalyze <<EOF
10 0 * * * root /bin/bash /root/bin/logfile/logfile.sh &> /dev/null
EOF
LOGFILE_CONFIG=/root/bin/logfile/logfile.sh
echo -n -e "\e[1;35mEnter the email address: \e[0m"
read EMAIL_ADDRESS
sed -i "s#^email=\"root@localhost\"#email=\"root@localhost,$EMAIL_ADDRESS\"#" $LOGFILE_CONFIG
echo -e "\e[1;32m+Install vbird's script to analyze log. \e[0m" >> $CONFIGURED_OPTIONS
}
function Startup {
while true; do
echo -n -e "\e[1;35mEnter 1 to configure server, enter 2 to configure client, enter n to cancel: \e[0m"
read CHOICE
if [[ $CHOICE == 1 ]]; then
Configure_Rsyslog_For_Server
elif [[ $CHOICE == 2 ]]; then
Configure_Rsyslog_For_Client
elif [[ $CHOICE == 'n' ]]; then
return 0
else
echo -n -e "\e[1;31mYou have entered the wrong character, try again?[y/n]: \e[0m"
read AGAIN
if [[ $AGAIN == 'n' ]]; then
return 0
fi
fi
done
}
Startup
| true
|
39da074d5a335659952f64b9f14aa29e7253758c
|
Shell
|
Fmajor/Configuration
|
/script/setup_script.sh
|
UTF-8
| 2,149
| 3.703125
| 4
|
[] |
no_license
|
#!/bin/sh
#=============================================================================#
# Vonng's Bash Profile Setup script
# Author: vonng (fengruohang@outlook.com)
# Run this script to setup configurations
#=============================================================================#
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ#
echo "#=============================================================#"
echo "# Configuring bin & scripts settings..."
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ#
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ#
# Setup directories
PLATFORM=`uname -a | awk '{print $1}'`
SRC_DIR=$(cd `dirname $0`; pwd)
TARGET_DIR=$HOME/usr/bin/
case "$PLATFORM" in
Linux)
mkdir -p $TARGET_DIR
cp -r $SRC_DIR/linux/* $TARGET_DIR
cp -r $SRC_DIR/common/* $TARGET_DIR
;;
Darwin)
mkdir -p $TARGET_DIR
cp -r $SRC_DIR/mac/* $TARGET_DIR
cp -r $SRC_DIR/common/* $TARGET_DIR
;;
*)
echo "Platform not supported!"
;;
esac
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ#
echo "# Bin & scripts setup done."
echo "#=============================================================#"
#โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ#
| true
|
a76f9e6100e4caa6e979769bc22ce155ed0b545d
|
Shell
|
penguinlinux/penguinscripts
|
/old_cool_scripts/weborama/url.sh
|
UTF-8
| 172
| 2.8125
| 3
|
[] |
no_license
|
until ! read curLine
do
desc=`echo "$curLine" | cut -d"|" -f1`
url=`echo "$curLine" | cut -d"|" -f2`
echo "<a href=\"${url}\">${desc}</a>" # >> output.txt
done
| true
|
e2afa837c2d1616978c61125cc7295df92080fe0
|
Shell
|
crichardson332/uscxml
|
/contrib/local/bcp-boost.sh
|
UTF-8
| 509
| 3.5625
| 4
|
[
"BSD-2-Clause",
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
#!/bin/sh
set -e
ME=`basename $0`
DIR="$( cd "$( dirname "$0" )" && pwd )"
CWD=`pwd`
BOOST_DIR=$1
if [ ! -d "$BOOST_DIR" ] || [ ! -x "$BOOST_DIR" ]; then
echo "First argument is supposed to be the path to the boost source code"
exit
fi
cd $BOOST_DIR
./bootstrap.sh
./b2 tools/bcp
cd ${DIR}
SOURCE_FILES=`find ${DIR}/../../src/ -name \*.h -print -o -name \*.cpp -print`
${BOOST_DIR}/dist/bin/bcp \
--boost=${BOOST_DIR} \
--scan ${SOURCE_FILES} \
${DIR}/../src
# rm -rf ${DIR}/../prebuilt/include/libs
| true
|
34caab916ae2518291084e34ec1b4f7c7d3804e2
|
Shell
|
200360828/COMP2101
|
/bash/systeminfo.sh
|
UTF-8
| 3,579
| 3.90625
| 4
|
[] |
no_license
|
#!/bin/bash
# Bash Assignment Monday Morning Class
# Sukhpreet Singh
# Student ID- 200360828
# Declare variables and assign any default values
rundefaultmode="yes"
# command line options to narrow down the Output field
function helpcmds {
echo "
Output can be one or more for the following:
$0 [-h | --help menu]
$0 [-hd | --Displays host and domain name]
$0 [-i | --IP address of the system]
$0 [-os | --Operating System name]
$0 [-ov | --Operating System version]
$0 [-ci | --CPU info ]
$0 [-ri | --RAM info]
$0 [-df | --Available Disk Space]
$0 [-p | --List of Installed Printers]
$0 [-sw | --List of User installed software]
"
}
function errormessage {
echo "$0" >&2
}
# Narrowing the information field
while [ $# -gt 0 ]; do
case "$1" in
-h)
helpcmds
rundefaultmode="no"
;;
-hd)
hostinfo="yes"
rundefaultmode="no"
;;
-i)
ipinfo="yes"
rundefaultmode="no"
;;
-os)
osinfo="yes"
rundefaultmode="no"
;;
-ov)
ovinfo="yes"
rundefaultmode="no"
;;
-ci)
cpuinfo="yes"
rundefaultmode="no"
;;
-ri)
raminfo="yes"
rundefaultmode="no"
;;
-df)
diskinfo="yes"
rundefaultmode="no"
;;
-p)
printerinfo="yes"
rundefaultmode="no"
;;
-sw)
softwareinfo="yes"
rundefaultmode="no"
;;
*)
errormessage "
'$1' Not a valid entry"
exit 1
;;
esac
shift
done
===================================================
# Information variables
Systemname="$(hostname)"
domainname="$(hostname -d)"
ipaddress="$(hostname -I)"
OSname="$(lsb_release -i)"
OSversion="$(grep PRETTY /etc/os-release |sed -e 's/.*=//' -e 's/"//g')"
CPUdetails="$(lscpu | grep "Model name:")"
RAMinfo="$(cat /proc/meminfo | grep MemTotal)"
discspace="$(df -h)"
printerinformation="$(lpstat -p)"
softwaredetails="$(apt list --installed)"
..........................................................................................
# Outputs
# Host name/Domain Name Details
hostnamedetails="Hostname: $Systemname
Domain Name: $domainname"
# IP Details
ipaddressdetails="IP Address: $ipaddress"
# OS Details
osdetails="Operating System: $OSname"
# OS Version
osversion="Operating System Version: $OSversion"
# CPU Information
cpudetails="CPU Information: $CPUdetails"
# RAM Details
ramdetails="RAM Information: $RAMinfo"
# Disc Space Details
discdetails="
DISC Information: $discspace"
# Printer Details
printerdetails="Installed Printer Information: $printerinformation"
# Software Details
softwaredetails="Installed Software List: $softwaredetails"
.......................................................................................................
# OUTPUT
if [ "$rundefaultmode" = "yes" -o "$hostinfo" = "yes" ]; then
echo "$hostnamedetails"
fi
if [ "$rundefaultmode" = "yes" -o "$ipinfo" = "yes" ]; then
echo "$ipaddressdetails"
fi
if [ "$rundefaultmode" = "yes" -o "$osinfo" = "yes" ]; then
echo "$osdetails"
fi
if [ "$rundefaultmode" = "yes" -o "$ovinfo" = "yes" ]; then
echo "$osversion"
fi
if [ "$rundefaultmode" = "yes" -o "$cpuinfo" = "yes" ]; then
echo "$cpudetails"
fi
if [ "$rundefaultmode" = "yes" -o "$raminfo" = "yes" ]; then
echo "$ramdetails"
fi
if [ "$rundefaultmode" = "yes" -o "$diskinfo" = "yes" ]; then
echo "$discdetails"
fi
if [ "$rundefaultmode" = "yes" -o "$printerinfo" = "yes" ]; then
echo "$printerdetails"
fi
if [ "$rundefaultmode" = "yes" -o "$softwareinfo" = "yes" ]; then
echo "$softwaredetails"
fi
echo END OF SYSTEM INFORMATION
| true
|
5f05f466e6eff0a4e95be0db74273497bbc7a697
|
Shell
|
elsudano/Fedora
|
/server-scripts/testspeed.sh
|
UTF-8
| 1,386
| 3.53125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
PROVIDERS=(#"testvelocidadeu.mismenet.net" \
"speedtestbcn.adamo.es" \
"speedtestbcn.adamo.es" \
"testvelocidad.eu/speed-test" \
"testvelocidad.eu/speed-test" \
"speedtest.conectabalear.com/ba/")
DEBUG=0
MIN=6 # minimum value for the longitude of random value of salt
MAX=8 # maximum value for the longitude of random value of salt
TIME_TO_MEASURE=15 # maximum timeout for taken mesaure
function download {
DIFF=$(($MAX-$MIN+1))
COMMAND="curl -w %{speed_download} -s --output /dev/null --max-time $TIME_TO_MEASURE"
$COMMAND $1?$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w $(echo $(($(($RANDOM%$DIFF))+$MIN))) | head -n 1) >> $2
echo "" >> $2
}
function average {
# File temporal for taken all statistic download
FILE=$(mktemp)
BYTES=0
# Launch all thread for download
for P in ${PROVIDERS[@]}; do
download "https://$P/download.bin" $FILE &
sleep 0.1 # for no write in file in the same time
done
# add 2 seconds for calculate average of download
TIME_TO_MEASURE=$(($TIME_TO_MEASURE+2))
sleep $TIME_TO_MEASURE
while read i; do
i=${i%",000"} # clean decimals
BYTES=$(($BYTES+i))
done <$FILE;
BITS=$((($BYTES*8)/1048576))
BYTES=$(($BYTES/1048576))
echo "Public IP: $(curl -s ifconfig.me)"
echo "Average download speed: $BITS Mb/s, $BYTES MB/s"
}
# MAIN
average;
| true
|
5bced6fb0b73577c2d6ba2494e5cc28d1ea22dcc
|
Shell
|
Trietptm-on-Security/el_harden
|
/fixes/repo/disable_users_coredumps.sh
|
UTF-8
| 274
| 2.8125
| 3
|
[] |
no_license
|
#!/bin/bash
# SID: CCE-27033-0
{
: ${LIMITS_CORE:=0}
##
# Just zap the entry if it exists and readd
sed -Ei "/\*\s+hard\s+core\s+/d" /etc/security/limits.conf
echo "* hard core ${LIMITS_CORE}" >> /etc/security/limits.conf
} &>> ${LOGFILE}
| true
|
f71b9aadc9aec91b91e297b03898e26031206a90
|
Shell
|
diagramatics/dotfiles
|
/.dotfiles-files/.aliases.sh
|
UTF-8
| 302
| 2.765625
| 3
|
[
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] |
permissive
|
#!/usr/bin/env bash
alias g="git"
alias ls="ls -lah"
alias cd..="cd .."
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../../"
alias ~="cd ~" # `cd` is probably faster to type though
# Enable hub aliasing
eval "$(hub alias -s)"
| true
|
c1933be97a38da4d5535ac0f254005842c0d171b
|
Shell
|
stereotype441/mesa-tools
|
/bin/build-mesa
|
UTF-8
| 150
| 2.53125
| 3
|
[] |
no_license
|
#!/bin/bash
set -e
cd ~/mesa
git tag -d build || true
git tag build `git-commit-working-tree`
num_jobs=`getconf _NPROCESSORS_ONLN`
make "-j$num_jobs"
| true
|
53a82cae7523e97f2622b7b5fcfbcd19529af4be
|
Shell
|
abfleishman/active-learning-detect
|
/train/active_learning_eval.sh
|
UTF-8
| 3,487
| 3.171875
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Source environmental variables
set -a
sed -i 's/\r//g' $1
. $1
set +a
# Updating vars in config file
envsubst < $1 > cur_config.ini
# Update images from blob storage
# echo "Updating Blob Folder"
# python ${python_file_directory}/update_blob_folder.py cur_config.ini
# # Create TFRecord from images + csv file on blob storage
# echo "Creating TF Record"
# python ${python_file_directory}/convert_tf_record.py cur_config.ini
# # Download tf model if it doesn't exist
# if [ ! -d "$download_location/${model_name}" ]; then
# mkdir -p $download_location
# curl $tf_url --create-dirs -o ${download_location}/${model_name}.tar.gz
# tar -xzf ${download_location}/${model_name}.tar.gz -C $download_location
# fi
# if [ ! -z "$optional_pipeline_url" ]; then
# curl $optional_pipeline_url -o $pipeline_file
# elif [ ! -f $pipeline_file ]; then
# cat "there you go"
# cp ${download_location}/${model_name}/pipeline.config $pipeline_file
# fi
echo "Making pipeline file from env vars"
temp_pipeline=${pipeline_file%.*}_temp.${pipeline_file##*.}
# sed "s/${old_label_path//\//\\/}/${label_map_path//\//\\/}/g" $pipeline_file > $temp_pipeline
# sed -i "s/${old_train_path//\//\\/}/${tf_train_record//\//\\/}/g" $temp_pipeline
# sed -i "s/${old_val_path//\//\\/}/${tf_val_record//\//\\/}/g" $temp_pipeline
# sed -i "s/keep_checkpoint_every_n_hours: 1.0/keep_checkpoint_every_n_hours: 1/" $temp_pipeline
# sed -i "s/${old_checkpoint_path//\//\\/}/${fine_tune_checkpoint//\//\\/}/g" $temp_pipeline
# sed -i "s/keep_checkpoint_every_n_hours: 1.0/keep_checkpoint_every_n_hours: 1/" $temp_pipeline
# sed -i "s/$num_steps_marker[[:space:]]*[[:digit:]]*/$num_steps_marker $train_iterations/g" $temp_pipeline
# sed -i "s/$num_examples_marker[[:space:]]*[[:digit:]]*/$num_examples_marker $eval_iterations/g" $temp_pipeline
# sed -i "s/$num_classes_marker[[:space:]]*[[:digit:]]*/$num_classes_marker $num_classes/g" $temp_pipeline
# Train model on TFRecord
echo "Eval model"
# rm -rf $train_dir
echo $temp_pipeline
python ${tf_location_legacy}/eval.py --eval_dir=$train_dir --pipeline_config_path=$temp_pipeline --logtostderr
# Export inference graph of model
# echo "Exporting inference graph"
# rm -rf $inference_output_dir
# python ${tf_location}/export_inference_graph.py --input_type "image_tensor" --pipeline_config_path "$temp_pipeline" --trained_checkpoint_prefix "${train_dir}/model.ckpt-$train_iterations" --output_directory "$inference_output_dir"
# TODO: Validation on Model, keep track of MAP etc.
# Use inference graph to create predictions on untagged images
# echo "Creating new predictions"
# python ${python_file_directory}/create_predictions.py cur_config.ini
# echo "Calculating performance"
# python ${python_file_directory}/map_validation.py cur_config.ini
# # Rename predictions and inference graph based on timestamp and upload
# echo "Uploading new data"
# az storage blob upload --container-name $label_container_name --file ${inference_output_dir}/frozen_inference_graph.pb --name model_$(date +%s).pb --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_KEY
# az storage blob upload --container-name $label_container_name --file $untagged_output --name totag_$(date +%s).csv --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_KEY
# az storage blob upload --container-name $label_container_name --file $validation_output --name performance_$(date +%s).csv --account-name $AZURE_STORAGE_ACCOUNT --account-key $AZURE_STORAGE_KEY
| true
|
f87419928b9b496741225750b991e72998909a29
|
Shell
|
qovalenko/docker
|
/firefox-with-java6.sh
|
UTF-8
| 2,075
| 3.59375
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
# Old Firefox with JRE 6 for managing HP servers
# https://www.reddit.com/r/linuxquestions/comments/2oebqn/problems_using_ilo_java_interface_with_java_7_and/
image=$(basename $0 .sh)
user=${USER:-root}
home=${HOME:-/home/$user}
uid=${UID:-1000}
gid=${uid:-1000}
tmpdir=$(mktemp -d)
escape_me() {
perl -e 'print(join(" ", map { my $x=$_; s/\\/\\\\/g; s/\"/\\\"/g; s/`/\\`/g; s/\$/\\\$/g; s/!/\"\x27!\x27\"/g; ($x ne $_) || /\s/ ? "\"$_\"" : $_ } @ARGV))' "$@"
}
echo "FROM ubuntu:10.04
RUN /bin/sed -i -r 's#archive#old-releases#g' /etc/apt/sources.list \\
&& apt-get update \\
&& apt-get -y install ia32-libs xterm wget
RUN wget --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' \\
http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jre-6u45-linux-i586.bin \\
&& bash jre-6u45-linux-i586.bin
RUN wget --no-check-certificate https://ftp.mozilla.org/pub/firefox/releases/3.6.3/linux-i686/en-US/firefox-3.6.3.tar.bz2 \\
&& tar xjvf firefox-3.6.3.tar.bz2 \\
&& mkdir -p /usr/lib/mozilla/plugins \\
&& ln -s /jre1.6.0_45/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins
RUN mkdir -p ${home} \\
&& chown ${uid}:${gid} -R ${home} \\
&& echo \"${user}:x:${uid}:${gid}:${user},,,:${home}:/bin/bash\" >> /etc/passwd \\
&& echo \"${user}:x:${uid}:\" >> /etc/group \\
&& [ -d /etc/sudoers.d ] || (apt-get update && apt-get -y install sudo) \\
&& echo \"${user} ALL=(ALL) NOPASSWD: ALL\" > /etc/sudoers.d/${user} \\
&& chmod 0440 /etc/sudoers.d/${user}
USER ${user}
ENV HOME ${home}
CMD /firefox/firefox --no-remote $(escape_me "$@")
" > $tmpdir/Dockerfile
docker build -t $image $tmpdir
rm -rf $tmpdir
# this may be run under Java's `Runtime.getRuntime.exec` or from XFCE menu, in this case no `docker -t` nor `docker -i` start
ti() {
stty -a >/dev/null
if [ $? -eq 0 ]; then echo "-ti"; fi
}
docker run $(ti) -e DISPLAY --net=host -v $HOME/.Xauthority:${home}/.Xauthority:ro -v /tmp/.X11-unix:/tmp/.X11-unix \
--rm $image
| true
|
5c64c0874320cb69611c1a92ed7b51aa85287082
|
Shell
|
571451370/virtual_media
|
/mount_media.sh
|
UTF-8
| 2,861
| 3.09375
| 3
|
[] |
no_license
|
IPMI_LOCATION=192.168.86.61
USERNAME=ADMIN
PASSWORD=ADMIN
NFS_IP=192.168.86.57
ISO_LOCATION=/var/nfsshare
IMAGE_NAME=$1
function do_sleep () {
sleep 5
}
#1. Power off server
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD chassis power off
do_sleep
#2. Enable virtual media support
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xca 0x08
do_sleep
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xcb 0x08 0x01
do_sleep
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xcb 0x0a 0x01
do_sleep
#3. Enable CD/DVD device 2.1 Enable "Mount CD/DVD" in GUI (p144) should cause vmedia restart within 2 seconds.
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xcb 0x00 0x01
do_sleep
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xca 0x00
do_sleep
#(read status should return 0x01)
#4. Clear RIS configuration
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9f 0x01 0x0d
do_sleep
#5 Setup nfs 4.1 Set share type NFS
SHARE_TYPE_ASCII=`./string_to_ascii.py nfs`
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9F 0x01 0x05 0x00 $SHARE_TYPE_ASCII
do_sleep
#6 NFS server IP (10.38.12.26)
NFS_IP_ASCII=`./string_to_ascii.py $NFS_IP`
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9F 0x01 0x02 0x00 $NFS_IP_ASCII
do_sleep
#7 Set NFS Mount Root path 4.3.1 clear progress bit
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9F 0x01 0x01 0x00 0x00
do_sleep
#8 set progress bit
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9F 0x01 0x01 0x00 0x01
do_sleep
#9 Set path
ISO_LOCATION_ASCII=`./string_to_ascii.py $ISO_LOCATION`
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9F 0x01 0x01 0x01 $ISO_LOCATION_ASCII
do_sleep
#10 clear progress bit
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9F 0x01 0x01 0x00 0x00
do_sleep
#11 Restart Remote Image CD (Restart RIS CD media)
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0x9f 0x01 0x0b 0x01
do_sleep
#12 Wait for device to be mounted (output is Available image count [3:5])
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xd8 0x00 0x01
do_sleep
#13 Set image name (start redirection)
IMAGE_NAME_ASCII=`./string_to_ascii.py $IMAGE_NAME`
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x32 0xD7 0x01 0x01 0x01 0x01 $IMAGE_NAME_ASCII
do_sleep
#14 Tell BMC to boot from Virtual CD/ROM next power on
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD raw 0x00 0x08 0x05 0x80 0x14 0x00 0x00 0x00
do_sleep
#15 Power on server
ipmitool -I lanplus -H $IPMI_LOCATION -U $USERNAME -P $PASSWORD chassis power on
| true
|
db0ddc1310e2ddddb6173c3283e77c815c607713
|
Shell
|
knktkc/spine-collective_export_shell
|
/export.sh
|
UTF-8
| 780
| 3.734375
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/sh
set -e
# MacใฎSpineใฎใใน
SPINE_EXE="/Applications/Spine/Spine.app/Contents/MacOS/Spine"
echo "Spine exe: $SPINE_EXE"
echo ""
files="./20_ใขใใกใผใทใงใณ/*"
fileary=()
directory=()
spines=()
for filepath in $files; do
if [ -d $filepath ] ; then
directory+=("$filepath")
fi
done
for i in ${directory[@]}; do
echo "Cleaning..."
rm -rf ${i}/export_light/*
# echo "Packaging..."
# "$SPINE_EXE" -i ${i}/images -o ${i}/export_light -p atlas-1.0.json
for directory_path in "${i}/*"; do
for spine_path in ${directory_path}; do
if [[ $spine_path =~ .+\.spine ]] ; then
echo "Exporting..."
echo "spine : ${spine_path}"
"$SPINE_EXE" -i ${spine_path} -o ${i}/export_light -e json.json
fi
done
done
done
| true
|
edc0b9ec9539a41d7f2c3927c379c20bc1b6a17e
|
Shell
|
zalora/microgram
|
/pkgs/retry/retry
|
UTF-8
| 1,491
| 4.1875
| 4
|
[
"MIT"
] |
permissive
|
#! /bin/sh
#
# usage: retry COMMAND [ARGS...]
#
# Retry to run a command successfully with configurable delays between runs.
#
# Notice that the command won't receive any data via standard input.
#
set -euf
export PATH=@coreutils@/bin"${PATH+:$PATH}"
# By default try to run command 10 times with a delay of 3s between retries.
retry_count=${RETRY_COUNT:-10}
retry_delay=${RETRY_DELAY:-3}
# retry_delay_seq specifies the delays between unsuccessful attempts to run the
# command as space separated list of sleep arguments. See also sleep(1).
#
# Notice how this sequence is one less than the desired number of retries
# because we don't need to wait after the last failed attempt.
#
# You can override this variable to e.g. implement a non-linear retry schema.
retry_delay_seq=${RETRY_DELAY_SEQ:-$(
for i in $(seq 2 $retry_count); do
echo $retry_delay
done
)}
# main COMMAND [ARGS...]
main() {
try_exec "$@"
for delay in $retry_delay_seq; do
echo "$0: \`$@\` exit code $exit_code; retrying after sleep $delay..." >&2
sleep $delay
try_exec "$@"
done
echo "$0: \`$@\` exit code $exit_code; giving up." >&2
exit $exit_code
}
# try_exec COMMAND [ARGS...]
# If command exits with a zero exit code, then try_exec will exit the current
# process (mimicking the behavior of exec). Otherwise set the exit_code
# variable for further inspection (or retry in our case).
try_exec() {
if env "$@" </dev/null; then
exit
else
exit_code=$?
fi
}
main "$@"
| true
|
4c836a799aa8c38feb6b8375514129857b8544d1
|
Shell
|
pablox-cl/dotfiles-b
|
/tag-gui/config/bspwm/panel/panel
|
UTF-8
| 1,499
| 3.171875
| 3
|
[
"MIT"
] |
permissive
|
#! /bin/sh
PANEL_FIFO=${TMPDIR}/bspwm-panel-fifo
PANEL_WIDTH=$(xrandr | grep \* | cut -d x -f1)
PANEL_HEIGHT=20
PANEL_FONT="-*-terminus-medium-*-*-*-14-*-*-*-*-*-iso8859-*"
PANEL_WM_NAME=bspwm_panel
if xdo id -a "$PANEL_WM_NAME" > /dev/null ; then
printf "%s\n" "The panel is already running." >&2
exit 1
fi
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
mkfifo "$PANEL_FIFO"
cd $(dirname $0)
. ./panel_colors
bspc config top_padding $PANEL_HEIGHT
bspc subscribe report > "$PANEL_FIFO" &
xtitle -sf 'T%s' > "$PANEL_FIFO" &
# conky -c ./panel_conky_$(hostname) > "$PANEL_FIFO" &
./scripts/run_i3status -c ~/.config/i3status/simple.config > "$PANEL_FIFO" &
trayer --height 20 --edge right --align left --margin 20 --widthtype request --transparent true --alpha 255 --tint 0x$COLOR_BACKGROUND &
xdotool search --onlyvisible --class 'trayer' windowunmap
./panel_bar < "$PANEL_FIFO" | lemonbar -a 32 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT \
-f "${PANEL_FONT}" \
-f "-misc-stlarch-medium-r-normal--10-100-75-75-c-80-iso10646-1" \
-f "-lucy-tewi-medium-r-normal-*-11-*-*-*-*-*-*-*" \
-u 1 \
-B "#e6151515" \
-F "$COLOR_DEFAULT_FG" | sh &
# -B "$COLOR_DEFAULT_BG" \
wid=$(xdo id -a "$PANEL_WM_NAME")
tries_left=20
while [ -z "$wid" -a "$tries_left" -gt 0 ] ; do
sleep 0.05
wid=$(xdo id -a "$PANEL_WM_NAME")
tries_left=$((tries_left - 1))
done
[ -n "$wid" ] && xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
wait
| true
|
75a731d445a60094bd946fa593bef31932e6c97e
|
Shell
|
SiteView/ecc82Server
|
/SiteviewLic/licwangzhenm/test.sh
|
UTF-8
| 678
| 2.984375
| 3
|
[] |
no_license
|
ERL=/usr/lib/erlang/bin/erl
HOSTNAME='localhost'
export HEART_COMMAND="$PWD/test.sh start"
case $1 in
start)
$ERL -smp -heart -detached -sname test -setcookie 3ren -pa $PWD/ebin -boot start_sasl -s test
echo "Starting ..."
;;
debug)
$ERL -smp -sname test -setcookie 3ren -pa $PWD/ebin -boot start_sasl -s test
;;
live)
$ERL -smp -sname test -setcookie 3ren -pa $PWD/ebin -s test
;;
stop)
echo "Stopping ..."
$ERL -noshell -sname erlnode \
-setcookie 3ren -pa $PWD/ebin -s erlnode stop test@$HOSTNAME
;;
*)
echo "Usage: $0 {start|stop|debug|live}"
exit 1
esac
exit 0
| true
|
193553b6356494a989c5ad520763c96c2786d8a9
|
Shell
|
bigpoppa-sys/syscoin-governance-update
|
/script.sh
|
UTF-8
| 4,163
| 3.640625
| 4
|
[] |
no_license
|
#!/bin/bash
# Only run as a root user
if [ "$(sudo id -u)" != "0" ]; then
echo "This script may only be run as root or with user with sudo privileges."
exit 1
fi
HBAR="---------------------------------------------------------------------------------------"
# import messages
source <(curl -sL https://raw.githubusercontent.com/syscoin/Masternode-Install-Script/master/messages.sh)
pause(){
echo ""
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
}
do_entry(){
echo ""
echo "======================================================================================"
echo " Update script for Governance GenKey"
echo "======================================================================================"
}
do_entry
start_syscoind(){
echo "$MESSAGE_SYSCOIND"
sudo service syscoind start # start the service
sudo systemctl enable syscoind # enable at boot
clear
}
stop_syscoind(){
echo "$MESSAGE_STOPPING"
sudo service syscoind stop
echo "Shutting down Syscoin Node"
sleep 30
clear
}
# errors are shown if LC_ALL is blank when you run locale
if [ "$LC_ALL" = "" ]; then export LC_ALL="$LANG"; fi
clear
RESOLVED_ADDRESS=$(curl -s ipinfo.io/ip)
SYSCOIN_BRANCH="master"
DEFAULT_PORT=8369
# syscoin.conf value defaults
rpcuser="sycoinrpc"
rpcpassword="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
masternodeprivkey=""
externalip="$RESOLVED_ADDRESS"
port="$DEFAULT_PORT"
# try to read them in from an existing install
if sudo test -f /home/syscoin/.syscoin/syscoin.conf; then
sudo cp /home/syscoin/.syscoin/syscoin.conf ~/syscoin.conf
sudo chown $(whoami).$(id -g -n $(whoami)) ~/syscoin.conf
source ~/syscoin.conf
rm -f ~/syscoin.conf
fi
RPC_USER="$rpcuser"
RPC_PASSWORD="$rpcpassword"
MASTERNODE_PORT="$port"
if [ "$externalip" != "$RESOLVED_ADDRESS" ]; then
echo ""
echo "WARNING: The syscoin.conf value for externalip=${externalip} does not match your detected external ip of ${RESOLVED_ADDRESS}."
echo ""
fi
read -e -p "External IP Address [$externalip]: " EXTERNAL_ADDRESS
if [ "$EXTERNAL_ADDRESS" = "" ]; then
EXTERNAL_ADDRESS="$externalip"
fi
if [ "$port" != "" ] && [ "$port" != "$DEFAULT_PORT" ]; then
echo ""
echo "WARNING: The syscoin.conf value for port=${port} does not match the default of ${DEFAULT_PORT}."
echo ""
fi
read -e -p "Masternode Port [$port]: " MASTERNODE_PORT
if [ "$MASTERNODE_PORT" = "" ]; then
MASTERNODE_PORT="$port"
fi
masternode_private_key(){
read -e -p "Masternode Governance Voting Key [$masternodeprivkey]: " MASTERNODE_PRIVATE_KEY
if [ "$MASTERNODE_PRIVATE_KEY" = "" ]; then
if [ "$masternodeprivkey" != "" ]; then
MASTERNODE_PRIVATE_KEY="$masternodeprivkey"
else
echo "You must enter a masternode governance voting key!";
masternode_private_key
fi
fi
}
masternode_private_key
#Generating Random Passwords
RPC_PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
clear
# syscoin conf file
SYSCOIN_CONF=$(cat <<EOF
# rpc config
rpcuser=user
rpcpassword=$RPC_PASSWORD
rpcallowip=127.0.0.1
rpcbind=127.0.0.1
rpcport=8370
# syscoind config
listen=1
server=1
daemon=1
maxconnections=24
# masternode config
masternode=1
masternodeprivkey=$MASTERNODE_PRIVATE_KEY
externalip=$EXTERNAL_ADDRESS
port=$MASTERNODE_PORT
EOF
)
# testnet config
SYSCOIN_TESTNET_CONF=$(cat <<EOF
# testnet config
gethtestnet=1
addnode=54.203.169.179
addnode=54.190.239.153
EOF
)
# functions to install a masternode from scratch
update_conf(){
echo "UPDATING CONF"
echo "$SYSCOIN_CONF" > ~/syscoin.conf
if [ ! "$IS_MAINNET" = "" ] && [ ! "$IS_MAINNET" = "y" ] && [ ! "$IS_MAINNET" = "Y" ]; then
echo "$SYSCOIN_TESTNET_CONF" >> ~/syscoin.conf
fi
# create conf directory
sudo mkdir -p /home/syscoin/.syscoin
sudo rm -rf /home/syscoin/.syscoin/debug.log
sudo mv -f ~/syscoin.conf /home/syscoin/.syscoin/syscoin.conf
sudo chown -R syscoin.syscoin /home/syscoin/.syscoin
sudo chmod 600 /home/syscoin/.syscoin/syscoin.conf
clear
}
stop_syscoind
update_conf
start_syscoind
echo "Update Finished"
echo "Syscoin Node now started with new credentials"
| true
|
512bbe23fe6b2738a71667c5472958f437a5b152
|
Shell
|
gnos-project/gnos-gnowledge
|
/src/core/core-init.bash
|
UTF-8
| 3,391
| 2.921875
| 3
|
[] |
no_license
|
########
# INIT #
########
Init ()
{
## BASE
PRODUCT_NAME=gnos
PRODUCT_VERSION=19.07.1
INSTALL_VERSION=$PRODUCT_VERSION
INSTALL_DATE=$( date +%Y%m%d )
TARGET=/mnt/target
## BOOTCLONE
BOOTCLONE_ROOT=/bootclone-root # DOC DSET root-repo, relative to ZFS_POOL_NAME
BOOTCLONE_GRUB=/bootclone-boot # DOC [zfs-only] DSET grub-boot, relative to ZFS_POOL_NAME
BOOTCLONE_BOOT=/repo # DOC [ext-only] PATH boot-repo, relative to BOOTCLONE_MNTP
BOOTCLONE_MNTP=/mnt$BOOTCLONE_GRUB # DOC PATH grub-boot mountpoint
BOOTCLONE_HEAD=/grub/bootclone-head.cfg # DOC PATH relative to BOOTCLONE_MNTP
BOOTCLONE_FOOT=/grub/bootclone-foot.cfg # DOC PATH relative to BOOTCLONE_MNTP
## NTP
NTP_SERVERS="pool.ntp.org" # ALT ntp.ubuntu.com ntp.neel.ch
## FS types
BOOT_FS=ext4
## LUKS names
LUKS_BOOT_NAME=crypto-boot
LUKS_SWAP_NAME=crypto-swap
LUKS_POOL_NAME=crypto-root
## MD names
UEFI_MD=/dev/md/uefi
BOOT_MD=/dev/md/boot
SWAP_MD=/dev/md/swap
POOL_MD=/dev/md/root
## UEFI names
UEFI_NAME=$PRODUCT_NAME
## Topologies
ZFS_TOPOLOGY_WORDS='mirror|raidz|raidz1|raidz2|raidz3|logs|spares|spare'
MD_TOPOLOGY_WORDS='linear|stripe|mirror|raid0|raid1|raid4|raid4|raid5|raid6|raid10|0|1|4|5|6|10'
## Menu defaults
DEFAULTS_UBUNTU_RELEASE="bionic"
DEFAULTS_HOST_HOSTNAME="${PRODUCT_NAME}demo"
DEFAULTS_USER_USERNAME="user"
DEFAULTS_LUKS_FORMAT_OPTS="--cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 2000"
DEFAULTS_ZFS_POOL_NAME="pool"
DEFAULTS_ZFS_POOL_OPTS="-o ashift=13 -o autoexpand=on -O atime=off -O compression=lz4 -O normalization=formD"
DEFAULTS_ZFS_ROOT_DSET="root/$PRODUCT_NAME"
DEFAULTS_ZFS_DATA_DSET="data"
## UI
UI_OPTS="--nocancel --yes-button Next --ok-button Next"
UI_TEXT="$PRODUCT_NAME v$PRODUCT_VERSION"
## Prefs
# Installer prefs
INST_PREF="
INSTALL_MODE
INSTALL_VERSION
INSTALL_DATE
"
# Zfs prefs
ZFS_PREF="
ZFS_POOL_NAME
ZFS_ROOT_DSET
ZFS_DATA_DSET
ZFS_POOL_OPTS
"
# Storage prefs
STOR_PREF="
STORAGE_OPTIONS
UEFI_PARTITION
BOOT_PARTITION
SWAP_PARTITION
POOL_TOPOLOGY
GRUB_DEVICE
LUKS_FORMAT_OPTS
$ZFS_PREF
IRFS_IP
"
# Distro prefs
DISTRO_PREF="
UBUNTU_RELEASE
KEYBOARD_MODEL
KEYBOARD_LAYOUT
KEYBOARD_VARIANT
HOST_TIMEZONE
HOST_HOSTNAME
USER_USERNAME
"
# Security
SEC_PREF="
LUKS_PASSWORD
USER_PASSWORD
"
# Generated
AUTO_PREF="
BOOT_DEVICE
SWAP_DEVICE
POOL_DEVICE
POOL_PARTITION
BOOTCLONE_TYPE
LUKS_KEY
"
# Config file prefs
CORE_PREF="
$INST_PREF
$STOR_PREF
$DISTRO_PREF
"
# Mandatory prefs
CORE_MANDATORY="
INSTALL_MODE
""
POOL_TOPOLOGY
""
UBUNTU_RELEASE
KEYBOARD_MODEL
KEYBOARD_LAYOUT
HOST_HOSTNAME
HOST_TIMEZONE
USER_USERNAME
"
}
###############################
# !!! DO NOT EDIT BELOW !!! ###
###############################
| true
|
9ae3f150b593a6a585a3a152d9f6eb070133196f
|
Shell
|
kai-uofa/dockerized-php-rails-postgres
|
/dev_bootstrap.sh
|
UTF-8
| 4,745
| 3.890625
| 4
|
[] |
no_license
|
#!/bin/bash
# Usage:
# chmod +x ./dev_bootstrap.sh
# ./dev_bootstrap.sh $DATABASE_BACKUP_PATH $RAIL_GIT_URL $RAIL_BRANCH $API_GIT_URL $API_BRANCH $RUBY_VERSION $RUBY_RAIL_GEMSET $RUBY_API_GEMSET
DATABASE_BACKUP_PATH=$1
if [[ ${2} == http* ]] || [[ ${2} == git* ]]; then
RAIL_GIT_URL=$2
else
echo "[WARNING] No Rails git URL. Please make sure you have your Rails repository locally."
RAIL_GIT_URL=''
fi
if [ -z "$3" ]; then
echo "[WARNING] No Rails branch is set, using master branch."
RAIL_BRANCH='master'
else
RAIL_BRANCH=$3
fi
if [[ ${4} == http* ]] || [[ ${4} == git* ]]; then
API_GIT_URL=$4
else
echo "[WARNING] No API git URL. Please make sure you have your API repository locally."
API_GIT_URL=''
fi
if [ -z "$5" ]; then
echo "[WARNING] No API branch is set, using master branch."
API_BRANCH='live'
else
API_BRANCH=$5
fi
if [ -z "$6" ]; then
echo "[WARNING] No Ruby version is set. Using default version."
RUBY_VERSION='2.4.9'
else
RUBY_VERSION=$6
fi
if [ -z "$7" ]; then
echo "[WARNING] No Gemset name for Rails is set. Using default name."
RUBY_RAIL_GEMSET='gemset_rails'
else
RUBY_RAIL_GEMSET=$7
fi
if [ -z "$8" ]; then
echo "[WARNING] No Gemset name for API is set. Using default name."
RUBY_API_GEMSET='gemset_api'
else
RUBY_API_GEMSET=$8
fi
RAILS_DIRECTORY='rails'
PHP_DIRECTORY='php-api'
POSTGRES_DIRECTORY='postgres-data'
# Create default .env file for docker-compose
echo "RUBY_VERSION=${RUBY_VERSION}" > ./.env
echo "RAILS_DIRECTORY=${RAILS_DIRECTORY}" >> ./.env
echo "PHP_DIRECTORY=${PHP_DIRECTORY}" >> ./.env
echo "POSTGRES_DIRECTORY=${POSTGRES_DIRECTORY}" >> ./.env
# Clone rails
if [ -z "$RAIL_GIT_URL" ]; then
echo "[WARNING] Using local repository. Please make sure you have your Rails repository at ../${RAILS_DIRECTORY}"
else
git clone ${RAIL_GIT_URL} ../${RAILS_DIRECTORY}
fi
# Update rails configurations
echo ${RUBY_VERSION} > ../${RAILS_DIRECTORY}/.ruby-version
echo ${RUBY_RAIL_GEMSET} > ../${RAILS_DIRECTORY}/.ruby-gemset
cp ./dev-configs/database.yml.docker ../${RAILS_DIRECTORY}/config/database.yml
# Clone api
if [ -z "$API_GIT_URL" ]; then
echo "[WARNING] Using local repository. Please make sure you have your API repository at ../${PHP_DIRECTORY}"
else
git clone ${API_GIT_URL} ../${PHP_DIRECTORY}
fi
# Update api configurations
echo ${RUBY_VERSION} > ../${PHP_DIRECTORY}/.ruby-version
echo ${RUBY_API_GEMSET} > ../${PHP_DIRECTORY}/.ruby-gemset
cp ./dev-configs/config.php.docker ../${PHP_DIRECTORY}/config.php
# Copy .vscode folder to support PHP debug
cp -R ./.vscode/ ../${PHP_DIRECTORY}/.vscode
# Download database backup
if [ -z "$DATABASE_BACKUP_PATH" ]; then
echo "[WARNING] No database backup path. Postgres docker will spin up with an empty database."
else
if [[ ${DATABASE_BACKUP_PATH} == http* ]]; then
curl ${DATABASE_BACKUP_PATH} > ./dev-configs/database_backup.gz
else
mv ${DATABASE_BACKUP_PATH} ./dev-configs/database_backup.gz
fi
fi
# Preparing dev config for building docker image
mkdir ./dev-configs/${PHP_DIRECTORY}
cp ../${PHP_DIRECTORY}/Gemfile ./dev-configs/${PHP_DIRECTORY}/Gemfile
cp ../${PHP_DIRECTORY}/Gemfile.lock ./dev-configs/${PHP_DIRECTORY}/Gemfile.lock
cp ../${PHP_DIRECTORY}/.ruby-gemset ./dev-configs/${PHP_DIRECTORY}/.ruby-gemset
cp ../${PHP_DIRECTORY}/.ruby-version ./dev-configs/${PHP_DIRECTORY}/.ruby-version
mkdir ./dev-configs/${RAILS_DIRECTORY}
cp ../${RAILS_DIRECTORY}/Gemfile ./dev-configs/${RAILS_DIRECTORY}/Gemfile
cp ../${RAILS_DIRECTORY}/Gemfile.lock ./dev-configs/${RAILS_DIRECTORY}/Gemfile.lock
cp ../${RAILS_DIRECTORY}/.ruby-gemset ./dev-configs/${RAILS_DIRECTORY}/.ruby-gemset
cp ../${RAILS_DIRECTORY}/.ruby-version ./dev-configs/${RAILS_DIRECTORY}/.ruby-version
# Build development docker images
docker-compose build
# Remove vendor folder if exist
if [ -d "../${PHP_DIRECTORY}/vendor" ]; then
rm -rf ../${PHP_DIRECTORY}/vendor
fi
# Install composer packages on development
docker-compose run development composer install
# Clean up docker: all stopped containers, all networks not used by at least 1 container, all dangling images and build caches.
docker system prune --force
# Clean up temporary files
if [ -d "./dev-configs/${PHP_DIRECTORY}" ]; then
rm -rf ./dev-configs/${PHP_DIRECTORY}
fi
if [ -d "./dev-configs/${RAILS_DIRECTORY}" ]; then
rm -rf ./dev-configs/${RAILS_DIRECTORY}
fi
# Set execute bit for ./dev-configs/db_init.sh
chmod +x ./dev-configs/db_init.sh
# Runs development dockers
if [ -z "$DATABASE_BACKUP_PATH" ]; then
docker-compose -f docker-compose.yaml up --detach
else
docker-compose -f docker-compose.yaml -f docker-compose.restoredb.yaml up --detach
fi
| true
|
4364bf1895968e16be5732a69d0071e058be8cd0
|
Shell
|
maxfierke/dotfiles
|
/script/setup
|
UTF-8
| 1,146
| 3.640625
| 4
|
[
"Unlicense"
] |
permissive
|
#!/bin/zsh
#
# Stolen from holman's dotfiles:
# https://github.com/holman/dotfiles/blob/8d4881a5adec944b3a8dea1e769a3cbdd7e7bbb6/script/install
cd "$(dirname $0)"/..
export DOTFILES_ROOT=$(pwd -P)
export ZSH="$DOTFILES_ROOT/vendor/.oh-my-zsh"
export ZSH_CUSTOM="$DOTFILES_ROOT/zsh/oh-my-zsh"
source $DOTFILES_ROOT/util/common.sh
if [ ! -d "$ZSH" ]; then
step "Grabbing oh-my-zsh, if it's not already there"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended
step_ok "Installed oh-my-zsh"
fi
if [ ! -L $HOME/.zshrc ]; then
step "Linking the zshrc"
ln -sf $DOTFILES_ROOT/zsh/zshrc $HOME/.zshrc
step_ok "Linked"
fi
if [ ! -L $HOME/.Brewfile ]; then
step "Linking the Brewfile"
ln -sf $DOTFILES_ROOT/Brewfile $HOME/.Brewfile
step_ok "Linked"
fi
source $HOME/.zshrc
step 'Ensuring Brew dependencies are up-to-date'
brew bundle --file=$DOTFILES_ROOT/Brewfile check || brew bundle --file=$DOTFILES_ROOT/Brewfile install
step_ok 'Brewfile dependencies up-to-date'
find . -name install.sh -not -path "./vendor/*" | while read installer ; do sh -c "${installer}" ; done
| true
|
ebf418a61b9efd96b880c29ed892807b037f064a
|
Shell
|
CodoCodo/data_bank
|
/script/get_file_type.sh
|
UTF-8
| 318
| 3.984375
| 4
|
[] |
no_license
|
#!/bin/bash
file_path=$1
if [ -z ${file_path} ]; then
echo "Please specify file path"
exit
fi
ext_name=${file_path##*.}
file_type=""
case $ext_name in
"mp4" | "avi")
file_type="video"
;;
"jpg" | "bmp" | "png")
file_type="image"
;;
* )
file_type="unknown"
;;
esac
echo $file_type
| true
|
970973b31f335b2f71e327f7a16a6b26687dae4e
|
Shell
|
seismicindustries/modeswitch
|
/mini_install.sh
|
UTF-8
| 914
| 2.921875
| 3
|
[] |
no_license
|
#!/bin/bash
echo " installing apache from apt repository"
sudo apt-get install apache2
cho " installing hostapd from apt repository"
sudo apt-get install hostapd
echo ""
echo ""
echo ""
echo -e "[ \033[1m\033[96mdude\033[m ] Install wlan mode switching script into systemctl's realms -------------"
echo ""
sudo mkdir /opt/si
sudo mkdir /opt/si/modeswitch
sudo cp support/modeswitch/wlan-mode.sh /opt/si/modeswitch/.
sudo cp support/modeswitch/wlan-mode.service /etc/systemd/system/.
sudo systemctl daemon-reload
sudo systemctl enable wlan-mode.service
echo ""
echo ""
echo ""
echo -e "[ \033[1m\033[96mdude\033[m ] Update device configuration -------------------------------------------"
sudo cp --backup=numbered support/hostapd.conf /etc/hostapd/.
sudo cp -r support/html/* /var/www/html/.
echo -e "[ \033[1m\033[96mdude\033[m ] Installation completed, please reboot now."
| true
|
896d0241b1a44eb47caf7eabc7bfec0055065e72
|
Shell
|
cotterjd/courses
|
/bash/bash_course/loops/for_loop.sh
|
UTF-8
| 138
| 2.6875
| 3
|
[] |
no_license
|
#!/bin/bash
for (( i = 1; i <= 5; i++ )); do
echo $i
done
echo
for (( i = 1, j=10; i <=3 && j<=20; i++, j+=10)); do
echo $i $j
done
| true
|
1a31b36dc71d63209d6f5dd7dab30e64a62339ae
|
Shell
|
JiaweiChen110/lab02
|
/largest.sh
|
UTF-8
| 488
| 3.796875
| 4
|
[] |
no_license
|
#!/bin/bash
if [ $# -ne 3 ]
then
echo "$0: number1 number2 number3 are not given" >&2
exit 1
fi
n1=$1
n2=$2
n3=$3
if [ $n1 -gt $n2 ] && [ $n1 -gt $n3 ]
then
echo "$n1 is Biggest number"
elif [ $n2 -gt $n1 ] && [ $n2 -gt $n3 ]
then
echo "$n2 is Biggest number"
elif [ $n3 -gt $n1 ] && [ $n3 -gt $n2 ]
then
echo "$n3 is Biggest number"
elif [ $1 -eq $2 ] && [ $1 -eq $3 ] && [ $2 -eq $3 ]
then
echo "All numbers are equal"
else
echo "Can not determine the biggest number"
fi
| true
|
9692c19d4347c8bd2c3c2a9ce7a26ac9512e455a
|
Shell
|
ghstanu/compciv
|
/homework/buzzfeed-listicle-title-parsing/lister.sh
|
UTF-8
| 359
| 2.71875
| 3
|
[] |
no_license
|
d_start='2014-01-01'
d_end='2014-12-31'
days_diff=$(( ( $(date -ud $d_end +'%s') - $(date -ud $d_start +'%s') )/ 60 / 60 / 24 ))
#Listicle tiles = pup 'li.bf_dom a text{}'
for num in $(seq 0 $days_diff); do
# DO YOUR WORK HERE
pup 'li.bf_dom a text{}'|
grep -oE '^[[:digit:]]+' |
sort -rn | uniq -c
date -d "$d_start $num days" +%Y-%m-%d
done
| true
|
4f0420e0ef8bf63a079450854036f85ac145dab3
|
Shell
|
saityucel/docker-sync-tutorial
|
/compare.sh
|
UTF-8
| 493
| 2.71875
| 3
|
[] |
no_license
|
#/usr/bin/env bash
docker-sync start -d --no-logd
rm -rf app/vendor
t1=$(date +%s)
docker-compose -f docker-compose.yml run --rm app install
t2=$(date +%s)
rm -rf app/vendor
t3=$(date +%s)
docker-compose -f docker-compose-mac.yml run --rm app install
t4=$(date +%s)
duration1=$((t2-t1))
duration2=$((t4-t3))
echo "Execution time of Docker for Mac without docker-sync: $duration1 seconds."
echo "Execution time of Docker for Mac with docker-sync: $duration2 seconds."
docker-sync stop
| true
|
f09d8bd899e78c1bf6d7d306e4579c5eb5a0e9fe
|
Shell
|
yyzybb537/rapidhttp
|
/scripts/extract_http_parser.sh
|
UTF-8
| 1,692
| 3.28125
| 3
|
[] |
no_license
|
#!/bin/sh
dest=$1/include/rapidhttp/layer.hpp
echo "#pragma once" > $dest
cat $1/third_party/http-parser/http_parser.h >> $dest
sed -i 's/extern\ "C"/namespace rapidhttp/g' $dest
last_include=`grep "^\#include" $1/third_party/http-parser/http_parser.c -n | tail -1 | cut -d: -f1`
tail_start=`expr $last_include + 1`
head -$last_include $1/third_party/http-parser/http_parser.c >> $dest
echo "namespace rapidhttp {" >> $dest
tail -n +$tail_start $1/third_party/http-parser/http_parser.c >> $dest
echo "} //namespace rapidhttp" >> $dest
# add inline key-word
sed -i 's/^unsigned long http_parser_version(void);/inline &/g' $dest
sed -i 's/^void http_parser_init(.*);/inline &/g' $dest
sed -i 's/^void http_parser_settings_init(.*);/inline &/g' $dest
sed -i 's/^size_t http_parser_execute\s*(.*/inline &/g' $dest
sed -i 's/^int http_should_keep_alive(.*);/inline &/g' $dest
sed -i 's/^const char \*http_method_str(.*);/inline &/g' $dest
sed -i 's/^const char \*http_errno_name(.*);/inline &/g' $dest
sed -i 's/^const char \*http_errno_description(.*);/inline &/g' $dest
sed -i 's/^void http_parser_url_init(.*);/inline &/g' $dest
sed -i 's/^int http_parser_parse_url(.*/inline &/g' $dest
sed -i 's/^void http_parser_pause(.*);/inline &/g' $dest
sed -i 's/^int http_body_is_final(.*);/inline &/g' $dest
sed -i 's/^unsigned long$/inline &/g' $dest
sed -i 's/^static enum state$/inline &/g' $dest
sed -i 's/^static enum http_host_state$/inline &/g' $dest
sed -i 's/^int$/inline &/g' $dest
sed -i 's/^static int$/inline &/g' $dest
sed -i 's/^void$/inline &/g' $dest
sed -i 's/^const char \*$/inline &/g' $dest
sed -i 's/^\#include "http_parser.h"//g' $dest
echo "create http-parser $dest"
| true
|
3ce61128c1fa0f1fab46904169360d259b5e8c2b
|
Shell
|
1054/Crab.Toolkit.PdBI
|
/bin/pdbi-uvt-go-subtract
|
UTF-8
| 5,097
| 3.59375
| 4
|
[] |
no_license
|
#!/bin/bash
#
# Input a line cube uvt, and a continuum uvt
# Output uvt = the line cube uvt subtract the continuum uvt
#
# Last update:
# 2017-03-30 using "pdbi-uvt-core-arg-v4"
# 2017-03-30 using "pdbi-uvt-core-arg-v5"
# 2018-02-16 using "pdbi-uvt-core-arg-v8", cleaning more files
#
#
#
# Uage
#
usage() {
echo "Usage: "
echo " pdbi-uvt-go-subtract -name NAME.uvt CONT.uvt -out NAME_CONTSUB.uvt [-weight 0.5]"
echo ""
echo "Notes: "
echo " -weight is a factor that will be multiplied to \"CONT.uvt\" before the subtraction."
echo ""
}
#
# SOURCE pdbi-uvt-core-arg
#
if [[ -f $(dirname "${BASH_SOURCE[0]}")"/pdbi-uvt-core-arg-v8" ]]; then
source $(dirname "${BASH_SOURCE[0]}")"/pdbi-uvt-core-arg-v8" "$@"
else
echo ""
echo "Error! Could not find \""$(dirname "${BASH_SOURCE[0]}")"/pdbi-uvt-core-arg-v8\"!"
echo ""
exit 1
fi
#
# Check input parameters -- uvt file name, must have two files
#
if [[ ${#PdBIUVT_NAME[@]} != 2 ]]; then
usage; exit
fi
#
# Set default output file
#
if [[ ${#PdBIUVT_SAVE[@]} -eq 0 ]]; then
PdBIUVT_SAVE+=("${PdBIUVT_NAME[0]}-Continuum-Subtracted")
echo ""; echo "Warning! Output name was not given, setting to \"$PdBIUVT_SAVE\""; echo ""
fi
if [[ x"${PdBIUVT_SAVE[0]}" == x || x"${PdBIUVT_SAVE[0]}" == x"tmp_pdbi_uvt" ]]; then
PdBIUVT_SAVE[0]="${PdBIUVT_NAME[0]}-Continuum-Subtracted"
echo ""; echo "Warning! Output name was not given, setting to \"$PdBIUVT_SAVE\""; echo ""
fi
#
# Remove suffix
#
if [[ x"${PdBIUVT_SAVE[0]}" == x*".uvt" ]]; then
PdBIUVT_SAVE[0]=$(echo "${PdBIUVT_SAVE[0]}" | sed -e 's/\.uvt$//g')
fi
if [[ x"${PdBIUVT_SAVE[0]}" == x*".UVT" ]]; then
PdBIUVT_SAVE[0]=$(echo "${PdBIUVT_SAVE[0]}" | sed -e 's/\.UVT$//g')
fi
#
# Backup existing output file
#
if [[ -f "${PdBIUVT_SAVE[0]}.uvt" ]]; then
if [[ -f "${PdBIUVT_SAVE[0]}.uvt.backup" ]]; then
\rm "${PdBIUVT_SAVE[0]}.uvt.backup"
fi
echo "Warning! Found existing \"${PdBIUVT_SAVE[0]}.uvt\"! Backup as \"${PdBIUVT_SAVE[0]}.uvt.backup\"!"
mv "${PdBIUVT_SAVE[0]}.uvt" "${PdBIUVT_SAVE[0]}.uvt.backup"
fi
#
# Deal with the input uv data file
# Output to mapping script
# "${PdBIUVT_NAME[0]}.$PdBIUVT_TYPE.uv_subtract.script"
#
PdBIUVT_EXE="${PdBIUVT_NAME[0]}.${PdBIUVT_TYPE[0]}.uv_subtract.script"
PdBIUVT_LOG="${PdBIUVT_NAME[0]}.${PdBIUVT_TYPE[0]}.uv_subtract.log"
PdBIUVT_INI="${PdBIUVT_NAME[0]}.${PdBIUVT_TYPE[0]}.uv_subtract.init"
PdBIUVT_SUB="1"
if [[ ${#PdBIUVT_UVMERGE_WEIGHT[@]} -gt 0 ]]; then
PdBIUVT_SUB="${PdBIUVT_UVMERGE_WEIGHT[0]}"
fi
echo "Checking \"${PdBIUVT_NAME[0]}.${PdBIUVT_TYPE[0]}\""
cp "${PdBIUVT_NAME[0]}.${PdBIUVT_TYPE[0]}" "${PdBIUVT_SAVE[0]}.uvt"
echo "Subtracting \"${PdBIUVT_NAME[1]}.${PdBIUVT_TYPE[1]}\" continuum data from \"${PdBIUVT_NAME[0]}.${PdBIUVT_TYPE[0]}\" cube data"
echo '! ' > "$PdBIUVT_INI"
echo '! Task UV_SUBTRACT' >> "$PdBIUVT_INI"
echo '! ' >> "$PdBIUVT_INI"
echo 'TASK\CHARACTER "UV table to subtract from" UV_TABLE$ "'"${PdBIUVT_SAVE[0]}.uvt"'"' >> "$PdBIUVT_INI"
echo 'TASK\CHARACTER "UV table used as continuum" SELF$ "'"${PdBIUVT_NAME[1]}.${PdBIUVT_TYPE[1]}"'"' >> "$PdBIUVT_INI"
echo 'TASK\REAL "The smoothing time constant in seconds" DTIME$ 45' >> "$PdBIUVT_INI" # 20200310: 500 -> 45
echo 'TASK\INTEGER "The continuum channel" WCOL$[2] 0 0' >> "$PdBIUVT_INI"
echo 'TASK\REAL "How many times should the continuum be subtracted" SUB$ '"${PdBIUVT_SUB}" >> "$PdBIUVT_INI"
echo 'TASK\GO' >> "$PdBIUVT_INI"
#
echo "run uv_subtract $PdBIUVT_INI /NOWINDOW" > "$PdBIUVT_EXE"
echo "Running @$PdBIUVT_EXE in GILDAS mapping"
echo "@$PdBIUVT_EXE | mapping > $PdBIUVT_LOG"
echo "@$PdBIUVT_EXE" | mapping > "$PdBIUVT_LOG"
if [[ -f "${PdBIUVT_SAVE[0]}.uvt" ]]; then
echo "Successufully saved to \"${PdBIUVT_SAVE[0]}.uvt\"!"
if [[ $PdBIUVT_UVMERGE_KEEP_FILE -eq 0 ]]; then
# if do not keep intermediate files, then delete them.
if [[ -f "$PdBIUVT_LOG" ]]; then
rm "$PdBIUVT_LOG"
fi
if [[ -f "$PdBIUVT_EXE" ]]; then
rm "$PdBIUVT_EXE"
fi
if [[ -f "$PdBIUVT_INI" ]]; then
rm "$PdBIUVT_INI"
fi
fi
else
echo "Error! Failed to run GILDAS MAPPING UV_SUBTRACT and output \"${PdBIUVT_SAVE[0]}.uvt\"!"
echo "Please check \"$PdBIUVT_LOG\" and \"$PdBIUVT_INI\"!"
exit 1
fi
| true
|
2e3b5fee008895ffb51ef8f1887c9e733a5fc6a1
|
Shell
|
mikefarah/yq
|
/scripts/acceptance.sh
|
UTF-8
| 242
| 2.59375
| 3
|
[
"MIT"
] |
permissive
|
#! /bin/bash
set -e
for test in acceptance_tests/*.sh; do
echo "--------------------------------------------------------------"
echo "$test"
echo "--------------------------------------------------------------"
(exec "$test");
done
| true
|
b5f602d6db616fa8ae554a7bceb145135b2a2ace
|
Shell
|
thu-spmi/CAT
|
/egs/TEMPLATE/local/lm_data.sh
|
UTF-8
| 796
| 3.625
| 4
|
[
"Apache-2.0"
] |
permissive
|
set -e -u
dir="data/local-lm"
n_utts=50000
url="https://www.openslr.org/resources/11/librispeech-lm-norm.txt.gz"
[ $n_utts -le 500 ] && {
echo "#utterances must > 500 for spliting train & dev" >&2
exit 1
}
mkdir -p $dir
cd $dir
if [ ! -f .completed ]; then
# download and process data
echo "Start downloading corpus, please wait..."
wget $url -q -O - | gunzip -c | head -n $n_utts |
tr '[:upper:]' '[:lower:]' >libri-part.txt
echo "Corpus downloaded. ($n_utts utterances from librispeech corpus)"
# take the last 500 utterances as dev
head -n $(($n_utts - 500)) libri-part.txt >libri-part.train
tail -n 500 libri-part.txt >libri-part.dev
touch .completed
else
echo "Found previous processed data."
fi
cd - >/dev/null
echo "$0 done"
exit 0
| true
|
e7d064620ffd1272083f26d5b2fa1f5582d40279
|
Shell
|
th3architect/ui
|
/scripts/build-static
|
UTF-8
| 1,508
| 3.984375
| 4
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
#!/bin/bash
set -e
# cd to app root
CWD=$(dirname $0)
if [ `basename $(pwd)` = 'scripts' ]; then
cd ../
else
cd `dirname $CWD`
fi
#BRANCH=$(echo $GIT_BRANCH | sed -e 's/^origin\///')
#if [ "$BRANCH" = "HEAD" ]; then
# BRANCH="master"
#fi
VERSION=$(cat package.json | grep version | cut -f4 -d'"' | sed 's/-/_/g')
ENVIRONMENT="production"
BUILD_DIR="dist/static/${VERSION}"
CDN="cdn.rancher.io/ui"
URL="/static"
UPLOAD=0
echo "Branch: ${BRANCH}"
echo "Version: ${VERSION}"
echo "Build Dir: ${BUILD_DIR}"
while getopts "u" opt;do
case $opt in
u)
UPLOAD=1
;;
\?)
echo "Invalid arguemnts"
print_help
exit 1
;;
:)
echo "Option -${OPTARG} requires arguement." >&2
print_help
exit 1
;;
esac
shift 1
done
function exec() {
$@
if [ $? -ne 0 ]; then
echo "Command: $@ failed"
exit 2
fi
}
echo "Testing..."
exec ember test
echo "Building..."
RANCHER_ENDPOINT="" BASE_URL="$URL" BASE_ASSETS="//${CDN}/${VERSION}" exec ember build --environment=$ENVIRONMENT --output-path=$BUILD_DIR
# Create a file containing the version
echo "${VERSION}" > $BUILD_DIR/VERSION
# Replace the version in the static file that cattle serves up
sed -i.bak s/VERSION/$VERSION/g "$BUILD_DIR/static/index.html"
if [ $UPLOAD -eq 1 ]; then
echo "Uploading..."
exec gsutil -m cp -R $BUILD_DIR "gs://${CDN}"
echo "Updating latest..."
exec gsutil rsync -d -r "gs://${CDN}/${VERSION}" "gs://${CDN}/latest"
fi
| true
|
0317f8424f50ee2f87e0ca02275f272c6c22b384
|
Shell
|
bundgaard/QuickInstallFolsom
|
/computenode.sh
|
UTF-8
| 2,150
| 2.609375
| 3
|
[] |
no_license
|
#!/bin/bash
apt-get -y install nova-compute nova-network nova-api-metadata
read "Is your internal network card eth1? (y/n): " network
if network == y
then
eth1=$(/sbin/ifconfig eth1| sed -n 's/.*inet *addr:\([0-9\.]*\).*/\1/p')
else
eth1=$(/sbin/ifconfig eth0| sed -n 's/.*inet *addr:\([0-9\.]*\).*/\1/p')
fi
. computeinfo
source computeinfo
echo "[DEFAULT]
# LOGS/STATE
verbose=True
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/run/lock/nova
# AUTHENTICATION
auth_strategy=keystone
# SCHEDULER
scheduler_driver=nova.scheduler.multi.MultiScheduler
compute_scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
# CINDER
volume_api_class=nova.volume.cinder.API
# DATABASE
sql_connection=mysql://nova:$SERVICE_TOKEN@$node1/nova
# COMPUTE
libvirt_type=kvm
libvirt_use_virtio_for_bridges=True
start_guests_on_host_boot=True
resume_guests_state_on_host_boot=True
api_paste_config=/etc/nova/api-paste.ini
allow_admin_api=True
use_deprecated_auth=False
nova_url=http://$node1:8774/v1.1/
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
# APIS
ec2_host=$node1
ec2_url=http://$node1:8773/services/Cloud
keystone_ec2_url=http://$node1:5000/v2.0/ec2tokens
s3_host=$node1
cc_host=$node1
metadata_host=$node1
# RABBITMQ
rabbit_host=$node1
# GLANCE
image_service=nova.image.glance.GlanceImageService
glance_api_servers=$node1:9292
# NETWORK
network_manager=nova.network.manager.FlatDHCPManager
force_dhcp_release=True
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
public_interface=eth0
flat_interface=eth1
flat_network_bridge=br100
fixed_range=$internal_range
network_size=$internal_size
flat_network_dhcp_start=$internal_start
flat_injected=False
connection_type=libvirt
multi_host=True
# NOVNC CONSOLE
novnc_enabled=True
novncproxy_base_url=http://$node1public:6080/vnc_auto.html
# Change vncserver_proxyclient_address and vncserver_listen to match each compute host
vncserver_proxyclient_address=$eth1
vncserver_listen=$eth1" > /etc/nova/nova.conf
cd /etc/init.d/; for i in $( ls nova-* ); do service $i restart; done
| true
|
34d3085004cbbe6fae42b8f6fa7f8c0191285a17
|
Shell
|
Jroque/CyberSec
|
/syvars.sh.save
|
UTF-8
| 327
| 2.609375
| 3
|
[] |
no_license
|
#!/bin/bash
#demo one of the class
printf "Current Working Dir:<033[0m'\t%s\n'\033[34;40mHostName:\033[0m'\t%s\n'Bash Version':\t%s\n""\033[0m" $PWD $HOSTNAME $BASH_VERSION
#echo "Hostname: $HOSTNAME"
#echo "Bash Version: $BASH_VERSION"
#$echo "Time (seconds): $SECONDS"
#echo "Machine Type: $MACHTYPE"
#echo "Filename: $0"
| true
|
461859c50cd303ffa60e87afb6d66e3b2f3ba362
|
Shell
|
leifliddy/salt
|
/pkg/osx/sign_binaries.sh
|
UTF-8
| 5,260
| 4.03125
| 4
|
[
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] |
permissive
|
#!/bin/bash
################################################################################
#
# Title: Binary Signing Script for macOS
# Author: Shane Lee
# Date: December 2020
#
# Description: This signs all binaries built by the `build_env.sh` script as
# well as those created by installing salt. It assumes a pyenv
# environment in /opt/salt/.pyenv with salt installed
#
# Requirements:
# - Xcode Command Line Tools (xcode-select --install)
# or
# - Xcode
#
# Usage:
# This script does not require any parameters.
#
# Example:
#
# sudo ./sign_binaries
#
# Environment Setup:
#
# Import Certificates:
# Import the Salt Developer Application Signing certificate using the
# following command:
#
# security import "developerID_application.p12" -k ~/Library/Keychains/login.keychain
#
# NOTE: The .p12 certificate is required as the .cer certificate is
# missing the private key. This can be created by exporting the
# certificate from the machine it was created on
#
# Define Environment Variables:
# Create an environment variable with the name of the certificate to use
# from the keychain for binary signing. Use the following command (The
# actual value must match what is provided in the certificate):
#
# export DEV_APP_CERT="Developer ID Application: Salt Stack, Inc. (AB123ABCD1)"
#
################################################################################
echo "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"
echo "Signing Binaries"
################################################################################
# Make sure the script is launched with sudo
################################################################################
if [[ $(id -u) -ne 0 ]]; then
echo ">>>>>> Re-launching as sudo <<<<<<"
exec sudo -E /bin/bash -c "$(printf '%q ' "$BASH_SOURCE" "$@")"
fi
################################################################################
# Set to Exit on all Errors
################################################################################
trap 'quit_on_error $LINENO $BASH_COMMAND' ERR
quit_on_error() {
echo "$(basename $0) caught error on line : $1 command was: $2"
exit 1
}
################################################################################
# Environment Variables
################################################################################
echo "**** Setting Variables"
INSTALL_DIR=/opt/salt
PY_VERSION=3.9
PY_DOT_VERSION=3.9.15
CMD_OUTPUT=$(mktemp -t cmd.log)
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
################################################################################
# Add rpath to the Python binaries before signing
################################################################################
echo "**** Setting rpath in binaries"
install_name_tool $INSTALL_DIR/bin/python${PY_VERSION} \
-add_rpath $INSTALL_DIR/.pyenv/versions/$PY_DOT_VERSION/lib \
-add_rpath $INSTALL_DIR/.pyenv/versions/$PY_DOT_VERSION/openssl/lib || echo "already present"
################################################################################
# Sign python binaries in `bin` and `lib`
################################################################################
echo "**** Signing binaries that have entitlements (/opt/salt/.pyenv)"
if ! find ${INSTALL_DIR}/.pyenv \
-type f \
-perm -u=x \
-follow \
! -name "*.so" \
! -name "*.dylib" \
! -name "*.py" \
! -name "*.sh" \
! -name "*.bat" \
! -name "*.pl" \
! -name "*.crt" \
! -name "*.key" \
-exec codesign --timestamp \
--options=runtime \
--verbose \
--force \
--entitlements "$SCRIPT_DIR/entitlements.plist" \
--sign "$DEV_APP_CERT" "{}" \; > "$CMD_OUTPUT" 2>&1; then
echo "Failed to sign binaries"
echo "Failed to sign run with entitlements"
echo "output >>>>>>"
cat "$CMD_OUTPUT" 1>&2
echo "<<<<<< output"
exit 1
fi
echo "**** Signing dynamic libraries (*dylib) (/opt/salt/.pyenv)"
if ! find ${INSTALL_DIR}/.pyenv \
-type f \
-name "*dylib" \
-follow \
-exec codesign --timestamp \
--options=runtime \
--verbose \
--force \
--sign "$DEV_APP_CERT" "{}" \; > "$CMD_OUTPUT" 2>&1; then
echo "Failed to sign dynamic libraries"
echo "output >>>>>>"
cat "$CMD_OUTPUT" 1>&2
echo "<<<<<< output"
exit 1
fi
if ! echo "**** Signing shared libraries (*.so) (/opt/salt/.pyenv)"
find ${INSTALL_DIR}/.pyenv \
-type f \
-name "*.so" \
-follow \
-exec codesign --timestamp \
--options=runtime \
--verbose \
--force \
--sign "$DEV_APP_CERT" "{}" \; > "$CMD_OUTPUT" 2>&1; then
echo "Failed to sign shared libraries"
echo "output >>>>>>"
cat "$CMD_OUTPUT" 1>&2
echo "<<<<<< output"
exit 1
fi
echo "**** Signing Binaries Completed Successfully"
echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
| true
|
696b866c3c235ddb0f120dc248b48184ee98ec7e
|
Shell
|
wiedehopf/piaware-support
|
/scripts/generate-usb-mount
|
UTF-8
| 847
| 3.921875
| 4
|
[] |
no_license
|
#!/bin/sh
# This script is called by udev when a partition on a
# removable USB block device is added or changed.
# It creates a readonly mount unit via systemd and starts it.
# systemd will handle the removal itself.
action=$1
devpath=$2
devunit=$(systemd-escape --path --suffix device $devpath)
mountpoint=/media/usb/$(basename $devpath)
mountunit=$(systemd-escape --path --suffix mount $mountpoint)
mountunitfile=/run/systemd/system/$mountunit
if [ "$action" = "change" ]
then
systemctl --no-block stop $mountunit
fi
if [ "$action" = "add" -o "$action" = "change" ]
then
cat <<EOF >$mountunitfile
# Automatically generated by generate-usb-mount.sh
[Unit]
Before=local-fs.target
[Mount]
What=$devpath
Where=$mountpoint
Type=auto
Options=ro,nodev,noexec,nosuid
EOF
systemctl daemon-reload
systemctl --no-block start $mountunit
fi
| true
|
a6d2a4373d439b6eb1fbcffb8429457094f8bcbb
|
Shell
|
mohamed-arradi/AirpodsBattery-Monitor-For-Mac
|
/AirpodsPro Battery/AirpodsPro Battery/Resources/battery-airpods-monterey.sh
|
UTF-8
| 2,349
| 3.234375
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
# Airpods.sh
# Output connected Airpods battery levels via CLI
BT_DEFAULTS=$(defaults read /Library/Preferences/com.apple.Bluetooth)
SYS_PROFILE=$(system_profiler SPBluetoothDataType 2>/dev/null)
MAC_ADDR=$(grep -b2 "Minor Type: "<<<"${SYS_PROFILE}"|awk '/Address/{print $3}')
regex_connected="(Connected:.+)"
if [[ $SYS_PROFILE =~ $regex_connected ]]
then
#this regex won't work because of PRCE not working with some bash version (Connected:.Yes).(Vendor ID:.0x004C.)(Product ID:.*(Case.+%).+(Firmware Version:.[A-Z-a-z-0-9]+))
patwithCase="(.+).(Vendor ID:.0x004C.)(Product ID.*(Case.+%))"
patwithoutCase="(.+).(Vendor ID:.0x004C.)(Product ID.*.)"
replace="?"
comp=$(echo ${SYS_PROFILE} | sed "s/Address:/$replace/g")
set -f
IFS='?'
ary=($comp)
for key in "${!ary[@]}";
do
d=$(echo "${ary[$key]}")
data=""
macAddress=""
connectedStatus=""
vendorID=""
batteryLevel=""
firmwareVersion=""
if [[ $d =~ $patwithCase ]]
then
macAddress=$( echo "${BASH_REMATCH[1]}" | sed 's/ *$//g')
connectedStatus="${BASH_REMATCH[2]}"
vendorID="${BASH_REMATCH[3]}"
data="${BASH_REMATCH[4]}"
firmwareVersion=$(echo ${BASH_REMATCH[6]} | awk '{print $3}')
batterylevelregex="Case Battery Level: (.+%) Left Battery Level: (.+%) Right Battery Level: (.+%)"
batterySingleRegex="(BatteryPercentSingle) = ([0-9]+)"
if [[ $data =~ $batterylevelregex ]]
then
caseBattery="${BASH_REMATCH[1]}"
leftBattery="${BASH_REMATCH[2]}"
rightBattery="${BASH_REMATCH[3]}"
batteryLevel="${caseBattery} ${leftBattery} ${rightBattery}"
if [ -z "$batteryLevel" ]
then
echo ""
else
echo $macAddress"@@""$batteryLevel"
fi
elif [[ $data =~ $batterySingleRegex ]]
then
#IN PROGRESS - AIRPODS MAX (TO VERIFY)
batteryLevel=$macAddress"@@"${BASH_REMATCH[2]}
echo $batteryLevel
fi
elif [[ $d =~ $patwithoutCase ]]
then
macAddress=$( echo "${BASH_REMATCH[1]}" | sed 's/ *$//g')
vendorID="${BASH_REMATCH[2]}"
data="${BASH_REMATCH[3]}"
firmwareVersion=$(echo ${BASH_REMATCH[6]} | awk '{print $3}')
batterylevelregex="Left Battery Level: (.+%) Right Battery Level: (.+%)"
if [[ $data =~ $batterylevelregex ]]
then
caseBattery="-1"
leftBattery="${BASH_REMATCH[1]}"
rightBattery="${BASH_REMATCH[2]}"
batteryLevel="${caseBattery} ${leftBattery} ${rightBattery}"
if [ -z "$batteryLevel" ]
then
echo ""
else
echo $macAddress"@@""$batteryLevel"
fi
fi
fi
done
else
echo "nc"
fi
exit 0
| true
|
e86d0a87553459e935f82fb0416a58f43e94f1d7
|
Shell
|
tsingui/build-raycloud-rtd1296
|
/build-alpine.sh
|
UTF-8
| 1,287
| 3.3125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
[ "$EUID" != "0" ] && echo "please run as root" && exit 1
set -e
set -o pipefail
os="alpine"
rootsize=700
origin="minirootfs"
target="raycloud"
tmpdir="tmp"
output="output"
rootfs_mount_point="/mnt/${os}_rootfs"
qemu_static="./tools/qemu/qemu-aarch64-static"
cur_dir=$(pwd)
DTB=rtd-1296-raycloud-2GB.dtb
chroot_prepare() {
if [ -z "$TRAVIS" ]; then
sed -i 's#http://dl-cdn.alpinelinux.org#https://mirrors.tuna.tsinghua.edu.cn#' $rootfs_mount_point/etc/apk/repositories
echo "nameserver 119.29.29.29" > $rootfs_mount_point/etc/resolv.conf
else
echo "nameserver 8.8.8.8" > $rootfs_mount_point/etc/resolv.conf
fi
}
ext_init_param() {
:
}
chroot_post() {
if [ -n "$TRAVIS" ]; then
sed -i 's#http://dl-cdn.alpinelinux.org#https://mirrors.tuna.tsinghua.edu.cn#' $rootfs_mount_point/etc/apk/repositories
fi
}
add_resizemmc() {
echo "add resize mmc script"
cp ./tools/${os}/resizemmc.sh $rootfs_mount_point/sbin/resizemmc.sh
cp ./tools/${os}/resizemmc $rootfs_mount_point/etc/init.d/resizemmc
ln -sf /etc/init.d/resizemmc $rootfs_mount_point/etc/runlevels/default/resizemmc
touch $rootfs_mount_point/root/.need_resize
}
gen_new_name() {
local rootfs=$1
echo "`basename $rootfs | sed "s/${origin}/${target}/" | sed 's/.gz$/.xz/'`"
}
source ./common.sh
| true
|
993690c151b1373a6cb624689e0834f052d224b7
|
Shell
|
mstenback/references
|
/bash/3-fibonacci_index/fibonacci_index.sh
|
UTF-8
| 1,370
| 4.25
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Mark Stenbรคck, 2019 (https://github.com/mstenback/practice_bash)
#
# Excercise 3: Calculate F(n) - Fibonacci value for the given number.
# E.g. the 6th Fibonacci (n=6) is 8.
# The maximum Fibonacci that can be calculated with a signed 64-bit integer
# is the 92th Fibonacci, 7540113804746346429.
INDEX=0
MAX_FIBONACCI=7540113804746346429
ROUND=2
VAL1=0
VAL2=1
SUM=0
RE='^[0-9]+$'
# If user has given no command line parameters so ask for them. Verify that values are numbers.
if [[ $# -ne 1 ]]; then
echo "This script calculates F(n) - Fibonacci value for the given number."
echo "Please provide a value n (>= 0):"
read INDEX
else
INDEX=$1
fi
# Validate the user input.
if ! [[ $INDEX =~ $RE ]]; then
echo "Error: For function F(n) the value of n must be >= 0." >&2; exit 1
fi
# Calculate the sequence up to the specified index.
if [ $INDEX -eq 0 ] || [ $INDEX -eq 1 ]; then
echo "F($INDEX) = $INDEX"
else
while [ $ROUND -le $INDEX ]
do
SUM=$((VAL1+VAL2))
# If we go beyond this point the SInt64 value will flip to negative for the next Fibonacci.
if [ $SUM -ge $MAX_FIBONACCI ]; then
echo "F($ROUND) = $SUM <- the maximum F(n) for signed 64-bit integer."; exit 1
fi
ROUND=$((ROUND+1))
VAL1=$VAL2
VAL2=$SUM
done
echo "F($INDEX) = $SUM"
fi
exit 0
| true
|
356ff0e83c32ed6a53927dc048eb3092b2679e2f
|
Shell
|
alexmavr/netmg
|
/sources_and_sinks/lab1.sh
|
UTF-8
| 755
| 3.265625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
outfile="lab1_output.text"
#question_template: "command | tee -a $outfile"
questions=(
#Q_1_a,c
{'ping -c 4','traceroute -P udp','traceroute -P icmp'}" www."{'esa.int','grnet.gr','stanford.edu','wikipedia.org','facebook.com'}" | tee -a $outfile"
#Q_1_b
"ping -c 4 -s "{'64','1400'}" www."{'esa.int','grnet.gr','stanford.edu'}" | tee -a $outfile"
#Q_1_d
####The "both directions" clause is troubling me
"ping -c 4 -R www."{'uoa.gr','auth.gr','esa.int'}" | tee -a $outfile"
)
##LINUX(!) => Dont work on BSD: "traceroute -M {udp,icmp}"
function report () {
echo "========" "$1" "========" >> $outfile
eval "$1"
echo -e "\n" >> $outfile
}
IFS=""
rm -f "$outfile"
for i in "${questions[@]}"
do
report "$i"
done
echo "Finished!"
| true
|
bb913fb99fe564004311460887736b04342ecfdf
|
Shell
|
florianutz/orange-box
|
/usr/bin/orange-box-add-physical-nodes
|
UTF-8
| 1,493
| 3.375
| 3
|
[] |
no_license
|
#!/bin/bash
#
# orange-box-add-physical-nodes - add all local nodes in the micro-cluster
# Copyright (C) 2014 Canonical Ltd.
#
# Authors: Dustin Kirkland <kirkland@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
. /usr/lib/orange-box/inc/common
. /etc/maas/maas_cluster.conf
set -e
set -x
oauth_login
# Search for nodes listening on AMT's 16992
info "Searching for all nodes on the local network listening on 16992; this will take 60 seconds...."
ips=$(time for i in $(seq 1 10); do nmap -p 16992 -oG - 10.14.4.1/24 | grep 16992/open | awk '{print $2}' ; done | sort -u -r)
if [ -z "$ips" ]; then
error "nmap did not find any nodes listening on [16992] on the [10.14.4.1/24] network"
fi
info "Found: [$ips]"
# Set nomodeset kernel parameter, to ensure we can vnc to the console
maas admin maas set-config name=kernel_opts value=nomodeset
# Loop over the list of ip addresses listening on 16992
orange-box-add-node $ips
| true
|
c17ca08909263f0ab99ee20f87f088cfe4d915f7
|
Shell
|
dhruv395/Apache-tomcat
|
/How to Change JVM Heap Setting (-Xms -Xmx) of Tomcat โ Configure setenv.sh file โ Run catalina.sh
|
UTF-8
| 973
| 2.828125
| 3
|
[] |
no_license
|
https://crunchify.com/how-to-change-jvm-heap-setting-xms-xmx-of-tomcat/
-Xmx:
Specifies the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB.
Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this
value will be approximately 4000m on Solaris 7
-XX:PermSize
Itโs used to set size for Permanent Generation. It is where class files are kept.
Step1:
Go to Apache Tomcat /bin directory.
/tomcat/bin/
Step2:
By default you wont see setenv.sh (for Linux/Mac) or setenv.bat (for windows) file under /bin directory.
You have to create one with below parameters.
vi /tomcat/bin/setenv.sh
export CATALINA_OPTS="$CATALINA_OPTS -Xms512m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx8192m"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=256m"
step3:
Go to <Tomcat Directory>/bin directory
Execute command: ./catalina.sh run
| true
|
72b89fd515c9ed2cc528b0eb26cdd4973a4f354f
|
Shell
|
lexahall/dotfiles
|
/zshrc
|
UTF-8
| 3,578
| 2.859375
| 3
|
[] |
no_license
|
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
z
zsh-autosuggestions
colored-man-pages
zsh-syntax-highlighting
)
export ZSH=~/.oh-my-zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="lexa"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
source $ZSH/oh-my-zsh.sh
# functions and aliases
alias zrc="vim ~/.zshrc_local"
alias gsps="git stash; git pull; git stash pop"
# Remove gg alias added by git plugin
unalias gg
# Change the color of the tab when using SSH
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
echo -ne "\033]6;1;bg;blue;brightness;$3\a"
}
tab-reset() {
echo -ne "\033]6;1;bg;*;default\a"
}
if [[ -n "$SSH_CONNECTION" ]]; then
tab-color 82 139 220
else
tab-reset
fi
# iTerm tab title
# $1 = type; 0 - both, 1 - tab, 2 - title
# rest = text
#DISABLE_AUTO_TITLE="true"
# setTerminalText () {
# # echo works in bash & zsh
# local mode=$1 ; shift
# echo -ne "\033]title\007"
#}
#stt_both () { setTerminalText 0 $@; }
#stt_tab () { setTerminalText 1 $@; }
#stt_title () { setTerminalText 2 $@; }
# use vim keybindings
# bindkey -v
# Allow local overrides
if [ -f ~/.zshrc_local ]; then
source ~/.zshrc_local
fi
| true
|
3d043acfa04001a3cfe615f8b005868610451cde
|
Shell
|
nathayush/CS-304
|
/Lab Assignment 1/Q3.sh
|
UTF-8
| 155
| 3.1875
| 3
|
[] |
no_license
|
#!/bin/bash
cat q3_words.txt | while read line;
do
for word in $line
do
res=$(grep -o "$word" q3.txt | wc -l)
echo "$word -> $res"
done
done
| true
|
c63208e41a746dd6f516930743b07c890bdb16ed
|
Shell
|
kkoomen/dotfiles-i3
|
/.bash_aliases
|
UTF-8
| 2,137
| 2.96875
| 3
|
[] |
no_license
|
shopt -s expand_aliases
# GENERAL
alias dsize='du -hs'
alias mkdir='mkdir -pv'
alias vi='vim'
alias ls='ls -l --color=auto'
alias sl='ls'
alias tree='tree -C'
alias pcinfo='inxi -Fx'
alias calc='bc -l'
alias cb="xclip -selection clipboard"
alias yt-dl='youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s"'
alias make-tar='tar -czvf'
alias hibernate='sudo pm-hibernate'
alias reboot='sudo reboot'
alias poweroff='sudo poweroff'
# NETWORK
alias xip='curl icanhazip.com'
alias lip="ifconfig | grep -A 1 'wlp3s0' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1"
alias listports="ss -tln | awk '{print $4}'"
# DOTFILES
alias bashrc='vim ~/.bashrc'
alias vimrc='vim ~/.vimrc'
alias Xresources='vim ~/.Xresources'
alias reload='source ~/.bashrc'
alias xmerge='xrdb -merge ~/.Xresources'
# PASTEBINS
alias ix="curl -s -F 'f:1=<-' ix.io"
alias pb="curl -s -F c=@- https://ptpb.pw/ | grep url"
# FIREWALL
alias httpon='sudo ufw allow http'
alias httpoff='sudo ufw delete allow http'
# DOCKER
function ddrush {
# If we don't receive any version, we can assume this project is drupal 8 that
# uses drupal lightning skeleton, so we change directory in docroot/ and run
# drush from there.
drupal_version=$(docker-compose exec php drush st --format=list drupal_version | cut -d '.' -f 1)
if [[ "$drupal_version" -eq "" ]] || [[ "${drupal_version:0:1}" -eq "8" ]]; then
docker-compose exec php bash -c "cd docroot && drush ${@}"
else
docker-compose exec php drush ${@}
fi
}
function ddrush-sqldump {
# If we don't receive any version, we can assume this project is drupal 8 that
# uses drupal lightning skeleton, so we change directory in docroot/ and run
# an "drush sql-dump" from there.
drupal_version=$(docker-compose exec php drush st --format=list drupal_version | cut -d '.' -f 1)
if [[ "$drupal_version" -eq "" ]] || [[ "${drupal_version:0:1}" -eq "8" ]]; then
docker-compose exec php bash -c "cd docroot && drush sql-dump --result-file --gzip --structure-tables-key=common"
else
docker-compose exec php drush sql-dump --result-file --gzip --structure-tables-key=common
fi
}
| true
|
40fafd765f3b412d36f27411e9dbfe133f2aee94
|
Shell
|
sundewang/shells
|
/batch_run.sh
|
UTF-8
| 383
| 3.84375
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
# ๆน้่ฟ่กrun.sh
# ้ๅๆๅฎๆไปถๅคน๏ผ็ถๅ่ฟ่กๅ
ถไธญ็run.sh่ๆฌ
# check parameters
if [ $# -ne 1 ]
then
echo Please input directory
exit 1
fi
dir=$1
for d in $dir/*
do
if [ -d $d ]
then
echo start $d/run.sh
cd $d
bash run.sh
else
echo $d is not directory
fi
done
echo all $dir start
| true
|
9789356bdb4fc1b7db7289ac096645290e63b5a5
|
Shell
|
Jim-RM-zz/mac_setup
|
/general.sh
|
UTF-8
| 1,191
| 2.796875
| 3
|
[] |
no_license
|
#!/bin/bash
# Installs Homebrew - will install xcode command line tools if missing
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Installs brew casks / apps
brew install --cask google-chrome
brew install --cask slack
brew install --cask 1password
brew install --cask malwarebytes
# Install for plain old Teamviewer is default, but uncomment the line
# below if you would rather install host.
brew install --cask teamviewer
# brew install --cask teamviewer-host
# This is for the desktop cloud app, from in here you can then install
# the speci Adobe apps you need to
brew install --cask adobe-creative-cloud
# These installs below will prompt / require a password to install
brew install --cask zoom
brew install --cask microsoft-teams # Micros Teams will prompt for a password to complete install
brew install --cask microsoft-office # Will prompt for a password to complete install
# checks / upgrades brew casks
brew upgrade
# Uninstall script for Homebrew - uncomment to have homebrew uninstalled after the installs complete.
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
| true
|
1e9f88e2b353f6afcc93a294792c11baa8460ef5
|
Shell
|
kuaikuai/doc
|
/org/set_rps.sh
|
UTF-8
| 435
| 3.390625
| 3
|
[] |
no_license
|
#!/bin/bash
# Enable RPS (Receive Packet Steering)
rfc=4096
cc=$(grep -c processor /proc/cpuinfo)
rsfe=$(echo $cc*$rfc | bc)
sysctl -w net.core.rps_sock_flow_entries=$rsfe
for fileRps in $(ls /sys/class/net/eth*/queues/rx-*/rps_cpus)
do
echo ffffffff > $fileRps
done
for fileRfc in $(ls /sys/class/net/eth*/queues/rx-*/rps_flow_cnt)
do
echo $rfc > $fileRfc
done
tail /sys/class/net/eth*/queues/rx-*/{rps_cpus,rps_flow_cnt}
| true
|
52347caead6e1bb05401f2d96efb1965b52762a5
|
Shell
|
1edenec/ledoland
|
/.config/bspwm/scritpts/scratch_gui
|
UTF-8
| 146
| 2.828125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
id=$(xdotool search --class "$1" | awk 'NR == 1')
if [ "$id" != "" ]
then
bspc node "$id" --flag hidden -f
else
$1 &
fi
| true
|
1c8ee218c39c5a7b66d997049a289dc9cfcb2890
|
Shell
|
jondkelley/cisco-unifi-controllable-switch
|
/src/shinc/common.sh
|
UTF-8
| 2,758
| 3.78125
| 4
|
[] |
no_license
|
#
# UniFi controllable switch - common functions
#
[ -z "$ROOT" ] && echo "Set ROOT before sourcing common.sh" 1>&2
if [ -e /var/etc/persistent ]; then
DEVEL=
# use /tmp to avoid littering persistent config
# the controller re-adopts the device on reboot when needed
# and this allows forgetting the device in the controller (after reboot)
CFG_DIR=/tmp/unifi-cfg
#CFG_DIR=/var/etc/persistent/cfg
else
# it looks like we're running in-tree for development
DEVEL=1
CFG_DIR="$ROOT"/../cfg
fi
export ROOT DEVEL CFG_DIR
# return a variable from a configuration file
cfg_get() {
file="$CFG_DIR/$1"
key=`echo "$2" | sed 's/\./\\\\./g'`
sed "s/^$key=//p;d" "$file" 2>/dev/null
}
# set a configuration variable
cfg_set() {
file="$CFG_DIR/$1"
key="$2"
value="$3"
mkdir -p "$CFG_DIR"
if grep -q "^$key=" "$file" 2>/dev/null; then
sed -i "s/^\($key=\).*$/\1$value/" "$file"
else
echo "$key=$value" >>"$file"
fi
}
# return first mac address found in system
find_system_mac() {
ifconfig | sed 's/^.*\(ether\|HWaddr\) \([0-9a-fA-F:]\+\).*$/\2/p;d' | head -n 1
}
# return mac address from configuration or system
get_mac() {
cfg_get dev mac || find_system_mac
}
# return model id recognized by UniFi
get_model_id() {
if grep -q '^board.portnumber=5$' /etc/board.info 2>/dev/null; then
echo -n 'US8P60'
else
echo -n 'US8P150'
fi
}
# run JSON.sh
JSONsh() {
"$ROOT"/shinc/JSON.sh
}
# workaround for https://github.com/dominictarr/JSON.sh/issues/50
[ -x "$ROOT"/egrep ] && PATH="$ROOT:$PATH" && export PATH
# perform an inform request
# use netcat instead of wget, because busybox misses wget's --post-file argument
inform_request() {
url="$1"
key="$2"
mac=`echo "$3" | sed 's/://g'`
hostport=`echo "$url" | sed 's/^\w\+:\/\///;s/\/.*$//'`
host=`echo "$hostport" | sed 's/:.*$//'`
port=`echo "$hostport" | sed 's/^.*://'`
[ -z "$port" ] && port=80
TMP1=`mktemp -t unifi-inform-send-in.XXXXXXXXXX`
cat >"$TMP1" # encryption can't handle buffering
TMP2=`mktemp -t unifi-inform-send-enc.XXXXXXXXXX`
"$ROOT"/unifi-inform-data enc "$key" "$mac" <"$TMP1" >"$TMP2"
(
printf "POST %s HTTP/1.0\r\n" "$url"
printf "Host: %s%s\r\n" "$hostport"
printf "Accept: application/x-binary\r\n"
printf "Content-Type: application/x-binary\r\n"
printf "Content-Length: %d\r\n" `wc -c "$TMP2" | awk '{print $1}'`
printf "\r\n"
cat "$TMP2"
) | nc "$host" "$port" | (
while IFS= read -r line; do [ ${#line} -eq 1 ] && break; done
"$ROOT"/unifi-inform-data dec "$key"
)
rm -f "$TMP1" "$TMP2"
}
# send a broadcast packet
# busybox's netcat does not support this, so it was added to unifi-inform-data
broadcast() {
"$ROOT"/unifi-inform-data bcast
}
| true
|
37937c775386efea66461a8266f6a5f27579b126
|
Shell
|
streemline/LinuxScripts
|
/Arch/Install/asUser/rslsync.sh
|
UTF-8
| 416
| 2.796875
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
set -e
EXPLICIT=(
rslsync
)
./installWithAurHelper.sh "${EXPLICIT[@]}"
sudo pacman -D --asexplicit --quiet "${EXPLICIT[@]}"
mkdir -p ~/.config/rslsync
mkdir -p ~/.cache/rslsync
cat > ~/.config/rslsync/rslsync.conf << EOF
{
"device_name": "$HOSTNAME",
"storage_path": "$HOME/.cache/rslsync/",
"webui": {
"listen": "127.0.0.1:8888"
}
}
EOF
systemctl --user enable --now rslsync.service
| true
|
f297d8bb9327a21d0ae23a154f573b758f5fc83b
|
Shell
|
rjmholt/dotfiles
|
/package_install.sh
|
UTF-8
| 1,048
| 3.640625
| 4
|
[] |
no_license
|
#!/bin/bash
set -e
APT_PACKAGES=<<EOF
vim \
wget \
open-ssh
EOF
APT_GUI_PACKAGES=<<EOF
vlc \
wine \
texlive \
cairo-dock \
build-essential \
clang \
clojure \
python3 \
ipython3 \
ruby \
haskell-platform
EOF
case $OSTYPE in
darwin*)
# Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
BREW=1
;;
linux*)
which apt-get && APTGET=1
which dnf && DNF=1
;;
esac
if [ $APTGET ]
then
if [ $(whoami) != "root" ]
then
echo "Please run as root"
exit
fi
apt-get update
apt-get install $APT_PACKAGES
apt-get upgrade
elif [ $BREW ]
then
if [ $(whoami) == "root" ]
then
echo "Install homebrew as a normal user"
exit
fi
brew update
brew install $BREW_PACKAGES
brew upgrade
elif [ $DNF ]
then
if [ $(whoami) != "root" ]
then
echo "Please run as root"
exit
fi
dnf update
dnf install $DNF_PACKAGES
dnf upgrade
fi
| true
|
785df5b9c592be3f065d08f2f891b0b60deb3ea6
|
Shell
|
onfsdn/atrium-onos
|
/tools/dev/bin/onos-app
|
UTF-8
| 2,038
| 4.03125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# -----------------------------------------------------------------------------
# Tool to manage ONOS applications using REST API.
# -----------------------------------------------------------------------------
node=${1:-$OCI}
cmd=${2:-list}
app=${3}
export URL=http://$node:8181/onos/v1/applications
export HDR="-HContent-Type:application/octet-stream"
export curl="curl -sS --user $ONOS_WEB_USER:$ONOS_WEB_PASS"
# Prints usage help
function usage {
echo "usage: onos-app <node-ip> list" >&2
echo " onos-app <node-ip> {install|install!} <app-file>" >&2
echo " onos-app <node-ip> {reinstall|reinstall!} [<app-name>] <app-file>" >&2
echo " onos-app <node-ip> {activate|deactivate|uninstall} <app-name>" >&2
exit 1
}
# Extract app name from the specified *.oar file
function appName {
aux=/tmp/aux$$.jar
cp $1 $aux
pushd /tmp >/dev/null
jar xf $aux app.xml && grep name= app.xml | cut -d\" -f2
rm -f $aux /tmp/app.xml
popd >/dev/null
}
[ -z $node -o "$node" = "-h" -o "$node" = "--help" -o "$node" = "-?" ] && usage
case $cmd in
list) $curl -X GET $URL;;
install!|install)
[ $cmd = "install!" ] && activate="?activate=true"
[ $# -lt 3 -o ! -f $app ] && usage
$curl -X POST $HDR $URL$activate --data-binary @$app
;;
reinstall!|reinstall)
[ $cmd = "reinstall!" ] && activate="?activate=true"
[ $# -lt 4 -a ! -f "$3" ] && usage
[ $# -eq 4 -a ! -f "$4" ] && usage
oar=$4
[ $# -lt 4 ] && oar=$3 && app=$(appName $oar)
$curl -X DELETE $URL/$app
$curl -X POST $HDR $URL$activate --data-binary @$oar
;;
uninstall)
[ $# -lt 3 ] && usage
$curl -X DELETE $URL/$app
;;
activate)
[ $# -lt 3 ] && usage
$curl -X POST $URL/$app/active
;;
deactivate)
[ $# -lt 3 ] && usage
$curl -X DELETE $URL/$app/active
;;
*) usage;;
esac
status=$?
echo # new line for prompt
exit $status
| true
|
c594cd77aca37555b9b73d99927037a675e0d55e
|
Shell
|
ystia/forge
|
/org/ystia/logstash/linux/bash/relationships/elasticsearch/configure.sh
|
UTF-8
| 2,026
| 3.390625
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
#
# Ystia Forge
# Copyright (C) 2018 Bull S. A. S. - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
#
source ${utils_scripts}/utils.sh
log begin
lock "$(basename $0)"
[ -z ${LOGSTASH_HOME} ] && error_exit "LOGSTASH_HOME not set"
if [[ -e "${YSTIA_DIR}/.${SOURCE_NODE}-ls2esFlag" ]]; then
log info "Logstash component '${SOURCE_NODE}' already configured with Elasticsearch output"
unlock "$(basename $0)"
exit 0
fi
log info "Connecting Logstash to Elasticsearch"
log info "Environment variables : source is ${scripts} - home is ${HOME}"
log info "Elasticsearch cluster name is ${cluster_name}"
# Create conf directory if not already created
mkdir -p ${LOGSTASH_HOME}/conf /
touch "${LOGSTASH_HOME}/conf/3-elasticsearch_logstash_outputs.conf"
# Take into account elk-all-in-one topo. Is consul agent present ?
IS_CONSUL=1
if is_port_open "127.0.0.1" "8500"
then
host_name="elasticsearch.service.ystia"
elif [[ -n "${ES_PUBLIC_IP}" ]]; then
host_name="${ES_PUBLIC_IP}"
elif [[ -n "${ES_IP}" ]]; then
host_name="${ES_IP}"
elif [[ -n "${ES_CAP_IP}" ]]; then
host_name="${ES_CAP_IP}"
else
host_name="localhost"
fi
port="9200"
host=$host_name:$port
log info "Elasticsearch host is $host"
if [[ -n "${PROXY}" ]]; then
proxy_config="\n\t\tproxy => \"${PROXY}\""
fi
#echo -e "output {\n\telasticsearch {\n\t\tcluster => \"${cluster_name}\"\n\t\tprotocol => node\n\t}\n}" >>${LOGSTASH_HOME}/conf/3-elasticsearch_logstash_outputs.conf
echo -e "output {\n\telasticsearch {${proxy_config}\n\t\thosts => [\"$host\"] \n\t}\n}" >>${LOGSTASH_HOME}/conf/3-elasticsearch_logstash_outputs.conf
log info "A4C configure elasticsearch cluster ${cluster_name}"
touch "${YSTIA_DIR}/.${SOURCE_NODE}-ls2esFlag"
log info "Logstash connected to Elasticsearch host ${host}"
unlock "$(basename $0)"
log end
| true
|
9981bfdd352c1ed6c47526c8cc8484366341daeb
|
Shell
|
AidanHilt/CSC412Final
|
/Projects/Prog_03/Code/script.sh
|
UTF-8
| 1,251
| 3.84375
| 4
|
[] |
no_license
|
if [ $# -ne 2 ];
then
echo You provided an invalid number of arguments. Please provide two directories, the first of which contains TGA images.
exit -1
fi
if [ ! -d "$1" ];
then
echo The first argument is not a valid directory
exit -1
fi
if [ ! -d "$2" ];
then
echo The second argument is not a valid directory
exit -1
fi
compiler="gcc"
flags="-Wall -Wextra"
dimName="dimensions"
cropName="crop"
splName="split"
rotName="rotate"
$compiler dimensions.c -o $dimName $flags
$compiler crop.c -o $cropName $flags
$compiler split.c -o $splName $flags
$compiler rotate.c -o $rotName $flags
files=($(ls "$1" | grep .tga$))
for i in "${files[@]}"
do
width=`./$dimName -w "$1/$i"`
height=`./$dimName -h "$1/$i"`
middleWidth=$(( $width/2 ))
middleHeight=$(( $height/2 ))
`./$cropName "$1/$i" "$2" 0 0 $middleWidth $middleHeight`
`./$cropName "$1/$i" "$2" $(($middleWidth-1)) 0 $middleWidth $middleHeight`
`./$cropName "$1/$i" "$2" 0 $(($middleHeight-1)) $middleWidth $middleHeight`
`./$cropName "$1/$i" "$2" $(($middleWidth-1)) $(($middleHeight-1)) $middleWidth $middleHeight`
`./$splName "$1/$i" "$2"`
`./$rotName l "$1/$i" "$2"`
done
rm $dimName
rm $cropName
rm $splName
rm $rotName
| true
|
90e462966db33dad88d16388892c9fb1650c8510
|
Shell
|
centreon/centreon
|
/centreon/libinstall/CentStorage.sh
|
UTF-8
| 6,526
| 3.421875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
#----
## @Synopsis Install script for CentStorage
## @Copyright Copyright 2008, Guillaume Watteeux
## @Copyright Copyright 2008-2020, Centreon
## @license GPL : http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
## Install script for CentStorage
#----
## Centreon is developed with GPL Licence 2.0
##
## GPL License: http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
##
## Developed by : Julien Mathis - Romain Le Merlus
## Contributors : Guillaume Watteeux - Maximilien Bersoult
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## For information : infos@centreon.com
echo -e "\n$line"
echo -e "\t$(gettext "Starting CentStorage Installation")"
echo -e "$line"
###### Check disk space
check_tmp_disk_space
if [ "$?" -eq 1 ] ; then
if [ "$silent_install" -eq 1 ] ; then
purge_centreon_tmp_dir "silent"
else
purge_centreon_tmp_dir
fi
fi
###### Require
#################################
## Where is install_dir_centreon ?
locate_centreon_installdir
## locate or create Centreon log dir
locate_centreon_logdir
locate_centreon_etcdir
locate_centreon_rundir
locate_centreon_generationdir
locate_centreon_varlib
## Config pre-require
locate_cron_d
locate_centstorage_bindir
#locate_centstorage_libdir
locate_centstorage_rrddir
## Config Nagios
check_centreon_group
check_centreon_user
## Populate temporaty source directory
copyInTempFile 2>>$LOG_FILE
## Create temporary folder
log "INFO" "$(gettext "Create working directory")"
mkdir -p $TMP_DIR/final/www/install
mkdir -p $TMP_DIR/work/www/install
mkdir -p $TMP_DIR/final/bin
mkdir -p $TMP_DIR/work/bin
mkdir -p $TMP_DIR/final/cron
mkdir -p $TMP_DIR/work/cron
[ ! -d $INSTALL_DIR_CENTREON/examples ] && \
mkdir -p $INSTALL_DIR_CENTREON/examples
###### DB script
#################################
## Change Macro in working dir
log "INFO" "$(gettext "Change macros for createTablesCentstorage.sql")"
${SED} -e 's|@CENTSTORAGE_RRD@|'"$CENTSTORAGE_RRD"'|g' \
$TMP_DIR/src/www/install/createTablesCentstorage.sql \
> $TMP_DIR/work/www/install/createTablesCentstorage.sql
## Copy in final dir
log "INFO" "$(gettext "Copying www/install/createTablesCentstorage.sql in final directory")"
cp $TMP_DIR/work/www/install/createTablesCentstorage.sql \
$TMP_DIR/final/www/install/createTablesCentstorage.sql >> $LOG_FILE 2>&1
## Copy CreateTablesCentStorage.sql in INSTALL_DIR_CENTREON
$INSTALL_DIR/cinstall $cinstall_opts \
-u "$WEB_USER" -g "$WEB_GROUP" -m 644 \
$TMP_DIR/final/www/install/createTablesCentstorage.sql \
$INSTALL_DIR_CENTREON/www/install/createTablesCentstorage.sql \
>> $LOG_FILE 2>&1
check_result $? "$(gettext "install") www/install/createTablesCentstorage.sql"
###### RRD directory
#################################
## Create CentStorage Status folder
if [ ! -d "$CENTSTORAGE_RRD/status" ] ; then
log "INFO" "$(gettext "Create CentStorage status directory")"
$INSTALL_DIR/cinstall $cinstall_opts \
-u "$CENTREON_USER" -g "$CENTREON_GROUP" -d 755 \
$CENTSTORAGE_RRD/status >> $LOG_FILE 2>&1
check_result $? "$(gettext "Creating Centreon Directory") '$CENTSTORAGE_RRD/status'"
else
echo_passed "$(gettext "CentStorage status Directory already exists")" "$passed"
fi
## Create CentStorage metrics folder
if [ ! -d "$CENTSTORAGE_RRD/metrics" ] ; then
log "INFO" "$(gettext "Create CentStorage metrics directory")"
$INSTALL_DIR/cinstall $cinstall_opts \
-u "$CENTREON_USER" -g "$CENTREON_USER" -d 755 \
$CENTSTORAGE_RRD/metrics >> $LOG_FILE 2>&1
check_result $? "$(gettext "Creating Centreon Directory") '$CENTSTORAGE_RRD/metrics'"
else
echo_passed "$(gettext "CentStorage metrics Directory already exists")" "$passed"
fi
## Change right to RRD directory
check_rrd_right
## Copy lib for CentStorage TODO
####
#log "INFO" "$(gettext "Install library for centstorage")"
#$INSTALL_DIR/cinstall $cinstall_opts \
# -g "$CENTREON_GROUP" -m 644 \
# $TMP_DIR/final/lib $INSTALL_DIR_CENTREON/lib >> $LOG_FILE 2>&1
#check_result $? "$(gettext "Install library for centstorage")"
## Change right on CENTREON_RUNDIR
log "INFO" "$(gettext "Change right") : $CENTREON_RUNDIR"
$INSTALL_DIR/cinstall $cinstall_opts -u "$CENTREON_USER" -d 750 \
$CENTREON_RUNDIR >> $LOG_FILE 2>&1
check_result $? "$(gettext "Change right") : $CENTREON_RUNDIR"
#ย Install centstorage perl lib
$INSTALL_DIR/cinstall $cinstall_opts -m 755 \
$TMP_DIR/src/lib/perl/centreon/common/ \
$PERL_LIB_DIR/centreon/common/ >> $LOG_FILE 2>&1
$INSTALL_DIR/cinstall $cinstall_opts -m 755 \
$TMP_DIR/src/lib/perl/centreon/script.pm \
$PERL_LIB_DIR/centreon/script.pm >> $LOG_FILE 2>&1
$INSTALL_DIR/cinstall $cinstall_opts -m 755 \
$TMP_DIR/src/lib/perl/centreon/script/centstorage_purge.pm \
$PERL_LIB_DIR/centreon/script/centstorage_purge.pm >> $LOG_FILE 2>&1
###### Cron
#################################
### Macro
## logAnalyserBroker
log "INFO" "$(gettext "Install logAnalyserBroker")"
$INSTALL_DIR/cinstall $cinstall_opts \
-u "$CENTREON_USER" -g "$CENTREON_GROUP" -m 755 \
$TMP_DIR/src/bin/logAnalyserBroker \
$CENTSTORAGE_BINDIR/logAnalyserBroker >> $LOG_FILE 2>&1
check_result $? "$(gettext "Install logAnalyserBroker")"
## cron file
log "INFO" "$(gettext "Change macros for centstorage.cron")"
${SED} -e 's|@PHP_BIN@|'"$PHP_BIN"'|g' \
-e 's|@CENTSTORAGE_BINDIR@|'"$CENTSTORAGE_BINDIR"'|g' \
-e 's|@INSTALL_DIR_CENTREON@|'"$INSTALL_DIR_CENTREON"'|g' \
-e 's|@CENTREON_LOG@|'"$CENTREON_LOG"'|g' \
-e 's|@CENTREON_ETC@|'"$CENTREON_ETC"'|g' \
-e 's|@CENTREON_USER@|'"$CENTREON_USER"'|g' \
-e 's|@WEB_USER@|'"$WEB_USER"'|g' \
$BASE_DIR/tmpl/install/centstorage.cron > $TMP_DIR/work/centstorage.cron
check_result $? "$(gettext "Change macros for centstorage.cron")"
cp $TMP_DIR/work/centstorage.cron $TMP_DIR/final/centstorage.cron >> $LOG_FILE 2>&1
log "INFO" "$(gettext "Install centstorage cron")"
$INSTALL_DIR/cinstall $cinstall_opts -m 644 \
$TMP_DIR/final/centstorage.cron \
$CRON_D/centstorage >> $LOG_FILE 2>&1
check_result $? "$(gettext "Install CentStorage cron")"
###### Post Install
#################################
createCentStorageInstallConf
## wait and see...
## sql console inject ?
| true
|
72a5387c11979ca3680e029bde1f3430399064e3
|
Shell
|
snoopcatt/win_customize
|
/bashrc
|
UTF-8
| 371
| 2.703125
| 3
|
[] |
no_license
|
[ -z "$PS1" ] && return
HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
HISTCONTROL=ignoreboth
shopt -s histappend
shopt -s checkwinsize
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \w #\[\033[00m\] '
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
alias ls='ls --color=auto -B --group-directories-first --hide="NTUSER*" --hide="ntuser*" -rc'
cmd /c chcp 65001 > /dev/null 2>&1
cd ~
clear
| true
|
f6e4b426af4a0e52d3a9f40da8711be2284ed1ca
|
Shell
|
kundan-chaulya/shell-scripts
|
/ScriptTemplate.sh
|
UTF-8
| 5,457
| 3.9375
| 4
|
[] |
no_license
|
#!/bin/sh
################################################################################
# Name : ScriptTemplate.sh #
# Author : Kundan Chaulya #
# Description : #
# Exit Code : #
# #
# Change Control : #
#------------------------------------------------------------------------------#
# Version | Date(MM/DD/YYYY)| Author | Description #
#------------------------------------------------------------------------------#
# #
################################################################################
## Signal handlers
# Signal 9 : SIGKILL or signal 9 (kill -9) cannot be trapped.
# The kernel IMMEDIATELY terminates any process sent this signal and
# no signal handling is performed.
#
# **** BE WARNED !!! Use SIGKILL as a last resort. ****
##
full_filename=$(basename "$0")
filename="${full_filename%.*}"
extension="${full_filename##*.}"
BIN_PATH=$(dirname "$0")
# Signal handlers
#trap exitFunc SIGHUP SIGINT SIGTERM INT
# Capture Ctrl+C
trap ctrl_c INT # Interrupt -- often CTRL-c
trap ctrl_d QUIT # Quit -- often CTRL-d
trap cmd_kill TERM # From kill command
trap cmd_hup HUP # When session disconnected
#-------------------------------------------------------------------------------
# Function Definition - START #
#-------------------------------------------------------------------------------
##
# Function to call for Ctrl+C
# Input : None
# Return Code : None
##
function ctrl_c()
{
WARN "** Trapped Ctrl+C !!! **"
cleanUp
}
##
# Function to call for Ctrl+d
# Input : None
# Return Code : None
##
function ctrl_d()
{
WARN "** Trapped Ctrl+d !!! **"
cleanUp
}
##
# Function to call for KILL
# Input : None
# Return Code : None
##
function cmd_kill()
{
WARN "** Trapped KILL !!! **"
cleanUp
}
##
# Function to call for HUP
# Input : None
# Return Code : None
##
function cmd_hup()
{
WARN "** Trapped HUP !!! **"
cleanUp
}
##
# Perform cleanup before exiting
# Input : None
# Return Code : None
##
function cleanUp()
{
# Perform program exit housekeeping
INFO "Performing Clean-up ..."
# TO DO : additional processing: send email
# INFO "................................................................................"
# INFO " Main (END) "
# INFO "................................................................................"
exit 9
}
##
# Print formatted log message
# Input : Argument 1: Message to print
# Return Code : None
##
function INFO()
{
local msg="${1}" # argument 1: message to print
echo -e "$(date +'%Y-%m-%d %H:%M:%S') [INFO] ${filename}: $msg"
}
##
# Print formatted log message
# Input : Argument 1: Message to print
# Return Code : None
##
function WARN()
{
local msg="${1}" # argument 1: message to print
echo -e "$(date +'%Y-%m-%d %H:%M:%S') [WARN] ${filename}: $msg"
}
##
# Print formatted log message
# Input : Argument 1: Message to print
# Return Code : None
##
function ERROR()
{
local msg="${1}" # argument 1: message to print
echo -e "$(date +'%Y-%m-%d %H:%M:%S') [ERROR] ${filename}: ${msg}"
echo -e "$(date +'%Y-%m-%d %H:%M:%S') [ERROR] ${filename}: EXITING"
exit 1
}
##
# Print usage
# Input : None
# Return Code : None
##
function usage()
{
echo -e "\n Usage:"
echo "-------------------------------------"
echo "$0 <Abs Path for log folder> <Abs path for payload file>"
echo -e "\nDescription:"
echo "____________________________"
echo "TO DO"
exit 1
}
##
# Sends mail
# Input : Argument 1: From email
# : Argument 2: To mail
# : Argument 3: Subject
# : Argument 4: Message body
# Return Code : None
##
function sendMail
{
local from="${1}"
local to="${2}"
local subject="${3}"
local message="${4}"
(
echo "From: ${from}";
echo "To: ${to}";
echo "Subject: ${subject}";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "${message}";
) | sendmail -t
return 0
}
#-------------------------------------------------------------------------------
# Function Definition - END #
#-------------------------------------------------------------------------------
# source "${CNF_DIR}/settings.cfg"
# source "${LIB_DIR}/DbLib.sh"
INFO "Param file $PARAM_FILE"
######################## __MAIN__ ###########################
INFO "-------------------- START - ${filename} --------------------"
# Your code logic here
# Error handling
# if [ $? -ne 0 ] ; then
# sendMail <<From>> <<TO-Mail>> <<Subject>> <<Message>>
# ERROR "<<Error message>>"
# exit 1
# else
# INFO "send success mail"
# sendMail $From $TO-Mail $Subject $Message
# fi
INFO "-------------------- END - ${filename} --------------------"
exit 0
| true
|
2342f9a3f9639c3ed8fe0c4ee3186337a4e60beb
|
Shell
|
Sumanshu-Nankana/Linux
|
/Bash/Display an element of an array.sh
|
UTF-8
| 133
| 2.640625
| 3
|
[] |
no_license
|
# https://www.hackerrank.com/challenges/bash-tutorials-display-the-third-element-of-an-array/problem
array=($(cat))
echo ${array[3]}
| true
|
b4aee13a06f58f61fe16032dd78928b31d8692f2
|
Shell
|
beentaken/sgt
|
/local/pid
|
UTF-8
| 351
| 3.375
| 3
|
[] |
no_license
|
#!/bin/sh
# Similar to the "pidof" utility I've got used to from Debian, but
# only returns process IDs I can strace or kill. I hope. Also, this
# one is implemented as a wrapper on pgrep, which is available on
# more systems than the Debian-specific pidof.
uid=`id -u`
if test "$uid" = 0; then
exec pgrep "$@"
else
exec pgrep -U "$uid" "$@"
fi
| true
|
603584b043f63a0f73905e11eb00682e331d1c0d
|
Shell
|
elmomk/openshift
|
/wait.sh
|
UTF-8
| 420
| 3.59375
| 4
|
[] |
no_license
|
#!/bin/bash
show-stack () {
aws cloudformation describe-stacks --output table --stack-name $1
}
INFRA_ID=$(jq -r .infraID metadata.json)
STAGE=$1
NU=1
if [ -z $STAGE ]
then
echo "set the stage variable"
exit
fi
while [ $NU = 1 ];do
show-stack $INFRA_ID-$STAGE | grep CREATE_IN_PROGRESS && echo in_progress;
if [ $? != 0 ];then
show-stack $INFRA_ID-$STAGE && NU=0;
fi
done
| true
|
91c86d008647fe82be763a5af62136af5261522a
|
Shell
|
isabella232/mesos-systemd
|
/v3/setup/proxy_setup.sh
|
UTF-8
| 473
| 2.9375
| 3
|
[] |
no_license
|
#!/bin/bash -x
source /etc/environment
if [ -f /etc/profile.d/etcdctl.sh ]; then
source /etc/profile.d/etcdctl.sh
fi
if [ "$NODE_ROLE" != "proxy" ]; then
exit 0
fi
PROXY_SETUP_IMAGE=behance/mesos-proxy-setup:latest
docker run \
--name mesos-proxy-setup \
--log-opt max-size=`etcdctl get /docker/config/logs-max-size` \
--log-opt max-file=`etcdctl get /docker/config/logs-max-file` \
--net='host' \
--privileged \
${PROXY_SETUP_IMAGE}
| true
|
2c68df0cf78e6e60e7adbff7aa0ebde6a7e6794e
|
Shell
|
aswroma3/asw-2018
|
/projects/asw-830-java-rmi/b-counter-rmi/resources/server/start-rmiregistry.sh
|
WINDOWS-1252
| 607
| 2.78125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Script per l'avvio del registry RMI.
# Uso: start-rmiregistry
# Nota: si potrebbe specificare la porta, ma non l'indirizzo del server.
echo Starting rmiregistry
# determina il path assoluto in cui si trova lo script
# (rispetto alla posizione da cui stata richiesta l'esecuzione dello script)
REL_PATH_TO_SCRIPT=`dirname $0`
ABS_PATH_TO_SCRIPT=`( cd ${REL_PATH_TO_SCRIPT} && pwd )`
# base dir BD=/home/vagrant/projects/asw-830-rmi/c-counter-rmi/dist/server
BD=${ABS_PATH_TO_SCRIPT}
LIB_DIR=${BD}/libs
# unset CLASSPATH
export CLASSPATH=${LIB_DIR}/service.jar
rmiregistry &
| true
|
0e160b72b26d7897336ac9d3464bdabfbe58e930
|
Shell
|
sihrc/blebot
|
/scripts/setup.sh
|
UTF-8
| 1,095
| 2.703125
| 3
|
[] |
no_license
|
#!/bin/bash
sudo apt-get update
sudo apt-get install -y git
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo mkdir -p /etc/apt/sources.list.d/
sudo echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee -a /etc/apt/sources.list.d/docker.list
sudo apt-get update && sudo apt-get purge lxc-docker && sudo apt-cache policy docker-engine
sudo apt-get install -y linux-image-extra-$(uname -r)
sudo apt-get install -y apparmor docker-engine
sudo service docker start
chmod og+X /root
sudo apt-get install -y build-essential postgresql postgresql-contrib
sudo service postgresql start
sudo -u postgres createuser -s blebot
sudo -u postgres psql -c "ALTER USER blebot WITH PASSWORD 'blerocks';"
sed -i -e "s/#listen_addresses = 'localhost'/listen_addresses = '172.17.0.0/16'/g" /etc/postgresql/9.3/main/postgresql.conf
# Setup Script
mkdir ~/blebot && cd ~/blebot && git init
git config --global user.name "Chris Lee"
git config --global user.email "sihrc.c.lee@gmail.com"
./scripts/deploy.sh
| true
|
f88c0474598fb2687fc90e37d4c3d872dae6dfcc
|
Shell
|
TechByTheNerd/SysAdminConfigAndScripts
|
/src/scripts/bash/all-jails.sh
|
UTF-8
| 352
| 3.296875
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
JAILS=$(fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g')
INDEX=1
for JAIL in $JAILS
do
echo ""
echo -n "${INDEX}) "
fail2ban-client status $JAIL
((INDEX++))
done
echo ""
echo "$(find /var/log/syslog -type f -mtime -1 -exec grep "UFW BLOCK" {} \; | wc -l) blocks in the past 24 hours."
echo ""
| true
|
2ab95571ea4a1e5af64fe227ce90313c363cd856
|
Shell
|
nico2sh/dotfiles
|
/restore.sh
|
UTF-8
| 1,361
| 3.890625
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
###########################
# This script restores backed up dotfiles
# @author Adam Eivy
###########################
#################################
# Move to the directory
#################################
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
cd $DIR
# include my library helpers for colorized echo and require_brew, etc
source ./lib_sh/echos.sh
if [[ -z $1 ]]; then
error "you need to specify a backup folder date. Take a look in ~/.dotfiles_backup/ to see which backup date you wish to restore."
exit 1
fi
bot "Restoring dotfiles from backup..."
pushd ~/.dotfiles_backup/$1
for file in .*; do
if [[ $file == "." || $file == ".." ]]; then
continue
fi
running "~/$file"
if [[ -e ~/$file ]]; then
unlink $file;
echo -en "project dotfile $file unlinked";ok
fi
if [[ -e ./$file ]]; then
mv ./$file ./
echo -en "$1 backup restored";ok
fi
echo -en '\done';ok
done
popd
bot "Woot! All done."
| true
|
a24e6b212ed746c83e722a58f4180a46544612df
|
Shell
|
pdbrito/laravel-cloud-run
|
/devops/docker/entrypoint.sh
|
UTF-8
| 624
| 3.28125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -e
role=${CONTAINER_ROLE:-app}
env=${APP_ENV:-production}
migrate=${DB_MIGRATE:-0}
if [[ "$role" = "app" ]]; then
if [[ "$migrate" = "1" ]]; then
php /var/www/html/artisan migrate --force
fi
docker-php-entrypoint apache2-foreground
elif [[ "$role" = "worker" ]]; then
echo "Running the worker..."
php /var/www/html/artisan horizon
elif [[ "$role" = "scheduler" ]]; then
while [[ true ]]
do
php /var/www/html/artisan schedule:run --verbose --no-interaction &
sleep 60
done
else
echo "Could not match the container role \"$role\""
exit 1
fi
| true
|
2daa2568352e9dcd8efa9aae628e8a7a943a5cbb
|
Shell
|
redbear/STM32-Arduino
|
/test.sh
|
UTF-8
| 801
| 3.875
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
#
# Script for copy to arduno15 folder
#
# For Linux root: $ sudo test.sh root
#
os=`uname`
if [ $os == 'Darwin' ]; then
board_path=~/Library/Arduino15/packages/RedBear/hardware/STM32F2
elif [ $os == 'Windows' ]; then
board_path=~/Library/Arduino15/packages/RedBear/hardware/STM32F2
elif [ $os=='Linux' ]; then
#if [ $# -eq 1 ]; then
board_path=/root/.arduino15/packages/RedBear/hardware/STM32F2
#else
#board_path=~/.arduino15/packages/RedBear/hardware/STM32F2
# fi
else
echo Unknown OS
exit
fi
ver=$(ls $board_path | grep 0.2.)
echo OS is $os
if [ -s $board_path/$ver ]; then
echo Will copy to $board_path/$ver
rm -r $board_path/$ver
mkdir $board_path/$ver
cp -a arduino/* $board_path/$ver/
else
echo Error: please install board package for the Duo first.
fi
| true
|
a4895e3cfe03c1d56dfb657a3f6c38725e19b805
|
Shell
|
rvdhoek/Raspberry-MRTG
|
/testport.sh
|
UTF-8
| 339
| 3.34375
| 3
|
[] |
no_license
|
#!/bin/sh
TESTIP=$1
#check if symlink exists
if [ "$1" = "" ]; then
echo "Test TCP port required"
exit 1
fi
TESTIP=$(dig +short myip.opendns.com @resolver1.opendns.com)
#nc -w 1 $TESTIP $1
nc -n -z -w 1 $TESTIP $1 > /dev/null
if [ $? -eq 0 ]; then
#Succes
echo "1"
echo "1"
else
#No succes
echo "0"
echo "0"
fi
| true
|
fd95fc34a59f16fd78fdb922d89e0af86bdb26f5
|
Shell
|
PaaS-TA/PAAS-TA-TAIGA-RELEASE
|
/jobs/taiga/templates/devel/setup-devel.sh
|
UTF-8
| 1,540
| 2.578125
| 3
|
[] |
no_license
|
#!/bin/bash
echo ****************setup-devel
echo ${JOB_NAME}
echo ${JOB_DIR}
echo ${PKG_DIR}
echo ${HOME}
echo ************devel
pushd ${HOME}
mkdir -p logs
mkdir -p conf
popd
# Bootstrap
# source ./scripts/setup-vars.sh
echo ********************************setup-config
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-config.sh
echo *******************************config
echo ********************************setup-apt
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-apt.sh
echo ****************************apt
# Setup and install services dependencies
echo ********************************setup-postgresql
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-postgresql.sh
echo ********************************postgresql
#source ./scripts/setup-redis.sh
#source ./scripts/setup-rabbitmq.sh
# Setup and install python related dependencies
echo ********************************setup-buildessential
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-buildessential.sh
echo ********************************buildessential
echo ********************************setup-python
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-python.sh
echo ********************************python
# Setup Taiga
echo ********************************setup-frontend
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-frontend.sh
echo ********************************frontend
echo ********************************setup-backend
source /var/vcap/jobs/${JOB_NAME}/devel/scripts/setup-backend.sh
echo ********************************backend
| true
|
5666f11aeae1f8761b0dddb27a1616abe1e0cc10
|
Shell
|
bensimner/litmus_example
|
/bin/run.sh
|
UTF-8
| 929
| 2.609375
| 3
|
[] |
no_license
|
date
LITMUSOPTS="${@:-$LITMUSOPTS}"
SLEEP=0
if [ ! -f SB.no ]; then
cat <<'EOF'
%%%%%%%%%%%%%%%%%%%%%%%%%
% Results for SB.litmus %
%%%%%%%%%%%%%%%%%%%%%%%%%
X86 SB
"Fre PodWR Fre PodWR"
{x=0; y=0;}
P0 | P1 ;
MOV [x],$1 | MOV [y],$1 ;
MOV EAX,[y] | MOV EAX,[x] ;
exists (0:EAX=0 /\ 1:EAX=0)
Generated assembler
EOF
cat SB.t
./SB.exe -q $LITMUSOPTS
fi
sleep $SLEEP
cat <<'EOF'
Revision 6df01eae65da067104a82cfcdcc9d3629c927419, version 7.52+10(dev)
Command line: litmus7 SB.litmus -o build/
Parameters
#define SIZE_OF_TEST 100000
#define NUMBER_OF_RUN 10
#define AVAIL 1
#define STRIDE (-1)
#define MAX_LOOP 0
/* gcc options: -Wall -std=gnu99 -fomit-frame-pointer -O2 -pthread */
/* barrier: user */
/* launch: changing */
/* affinity: none */
/* alloc: dynamic */
/* memory: direct */
/* safer: write */
/* preload: random */
/* speedcheck: no */
EOF
head -1 comp.sh
echo "LITMUSOPTS=$LITMUSOPTS"
date
| true
|
495ad0dc7cd3416e068c964e3c6464cbc77eb2ca
|
Shell
|
natesilva/wireguard-qnd
|
/update-config
|
UTF-8
| 697
| 3.921875
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
umask 077
echo "Using configuration found in vpn.conf to rebuild server" \
"configuration file wg0.conf."
# The base directory for the config scripts
dir=$(cd -P -- "$(dirname -- "${0}")" && pwd -P)
scriptsdir=$dir/scripts
userdir=$dir/users
vpnconf=$dir/vpn.conf
# Generate any missing users;
usercount=0
users=$("$scriptsdir/get-config-value" "$vpnconf" user)
for user in $users ; do
if [[ ! -e "$userdir/$user" ]]; then
"$scriptsdir/make-user" "$user"
fi
usercount=$((usercount+1))
done
# Rebuild the wg0.conf file
"$dir/scripts/build-server-config" > "$dir/../wg0.conf"
# Restart the VPN
service wg-quick@wg0 restart
echo "Done, with $usercount active user(s)."
| true
|
cebb2e5481803ff79da7f5c032cd744314fb9d0e
|
Shell
|
jm42/webdown
|
/webdown
|
UTF-8
| 2,609
| 4.0625
| 4
|
[
"WTFPL"
] |
permissive
|
#!/usr/bin/env sh
#
# webdown -- static website generator from markdown sources
# . .
# . , _ |_ _| _ . ,._
# \/\/ (/,[_)(_](_) \/\/ [ )
#
# Copyright (C) 2012-2013 Juan M Martรญnez
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License, Version 2, as
# published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
# details.
#
# History
# -------
# 2012/04/09: v0.2
# * Remove title and title-separator
# 2012/03/22: First version
#
VERSION=0.2
QUIET=0
LAYOUT=
if [[ ! -x /usr/bin/sundown ]]; then
echo "Please install 'sundown' to use ${0##*/}"
exit 1
fi
version()
{
echo "${0##*/} v$VERSION"
}
usage()
{
cat << EOF
usage: ${0##*/} [options] <source> <destination>
options:
-l, --layout <file> Layout for each generated page
-q, --quiet Do not display any message
-h, --help Display this message
-V, --version Print version and exit
EOF
}
log()
{
local msg=$1; shift
if [[ 0 == $QUIET ]]; then
echo "$msg" "$@"
fi
}
fatal()
{
local msg=$1; shift
log "$msg" "$@" >&2
exit 1
}
SHORT_OPTS="qhVl:"
LONG_OPTS="quiet,help,version,layout:"
argv=$(getopt -l "$LONG_OPTS" -- "$SHORT_OPTS" "$@") || { usage ; exit 1 ; }
eval set -- "$argv"
while true ; do
case "$1" in
-l|--layout) LAYOUT="$2" ; shift 2 ;;
-q|--quiet) QUIET=1 ; shift ;;
-h|--help) usage ; exit ;;
-V|--version) version ; exit ;;
--) shift ; break ;;
*) usage ; exit 1 ;;
esac
done
[[ $# -eq 2 ]] || { usage ; exit 1 ; }
SRC=$(readlink -f $1)
DST=$(readlink -f $2)
[[ -d "$SRC" ]] || { fatal "Invalid source directory" ; }
[[ -d "$DST" ]] || { fatal "Invalid destination directory" ; }
if [[ -f "$LAYOUT" ]]; then
LCONTENT=$(cat $LAYOUT)
if [[ ! "$LCONTENT" =~ "{{ CONTENT }}" ]]; then
fatal "The layout file must contain a \"{{ CONTENT }}\" variable"
fi
fi
for SFILE in $(find "$SRC" -name '*.markdown' -type f); do
DFILE=${SFILE/$SRC/$DST}
DFILE=${DFILE/%markdown/html}
mkdir -p $(dirname $DFILE)
if [[ -n "$LCONTENT" ]]; then
MARKDOWN=$(sundown $SFILE)
CTITLE=$(head -n1 "$SFILE")
CONTENT=$LCONTENT
CONTENT=${CONTENT/\{\{ CONTENT \}\}/$MARKDOWN}
CONTENT=${CONTENT/\{\{ TITLE \}\}/$CTITLE}
else
CONTENT=$(sundown $SFILE)
fi
echo "$CONTENT" > $DFILE
done
# End of file
# vim: set ts=2 sw=2 noet:
| true
|
f0282d1042177312d70846248dc35464fe561fd2
|
Shell
|
Jeffrey-P-McAteer/ptrack
|
/deploy.sh
|
UTF-8
| 836
| 2.765625
| 3
|
[] |
no_license
|
#!/bin/sh
# Uses state on Jeff's machine, not really scaleable
deploy_new_vm() {
gcloud compute instances create "ptrack" \
--image-project=arch-linux-gce \
--image-family=arch \
--machine-type=e2-small \
--zone=us-east1-b \
--network-tier=STANDARD \
--boot-disk-size=32GB \
--hostname="ptrack.jmcateer.pw"
}
set -e
cargo build --bin=ptrack-server --release --target=x86_64-unknown-linux-gnu
cargo build --bin=ptrack-agent --release --target=x86_64-pc-windows-gnu
gcloud compute ssh ptrack -- sudo mkdir -p /opt/ptrack/
gcloud compute scp target/x86_64-unknown-linux-gnu/release/ptrack-server ptrack:/opt/ptrack/
gcloud compute scp target/x86_64-pc-windows-gnu/release/ptrack-agent.exe ptrack:/opt/ptrack/
gcloud compute ssh ptrack -- sudo /opt/ptrack/ptrack-server install-and-run-systemd-service
| true
|
7e5bbe7579683becac0c967703bac6cbe4b46f30
|
Shell
|
paranoid-and-roid/deployment_project
|
/system_tests.sh
|
UTF-8
| 329
| 2.65625
| 3
|
[] |
no_license
|
VAR=$(ps -ef | grep apache2 | wc -l)
echo There is/are $VAR apache2 processes running
VAR=$(ps -ef | grep mysql | wc -l)
echo There is/are $VAR mysql processes running
VAR=$(ps -ef | grep http | wc -l)
echo There is/are $VAR http processes running
VAR=$(ps -ef | grep tcp | wc -l)
echo There is/are $VAR TCP processes running
| true
|
225f42ed53b7a11bd0ca5e1052cf3586fc54d06a
|
Shell
|
aminedada/projets
|
/projet_unix/plusoumoins/.svn/pristine/22/225f42ed53b7a11bd0ca5e1052cf3586fc54d06a.svn-base
|
UTF-8
| 1,392
| 2.75
| 3
|
[] |
no_license
|
#!/bin/sh
## menu6.sh for menu6 in /home/friaa_a/projet/plusoumoins
##
## Made by FRIAA Amine
## Login <friaa_a@etna-alternance.net>
##
## Started on Wed Nov 5 09:35:31 2014 FRIAA Amine
## Last update Wed Nov 5 16:54:41 2014 FRIAA Amine
##
echo -e "\033[31;5mโโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโ โโโโโโ โโโโโ โโโโโ โโโโโ
โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโ โโโโโโ โโโโโ โโโโโ โโโโโ
โโโโโ โโโโโ โโโโโ โโโโโ โโโโโ โโโ โโโโโโ โโโโโ โโโโโ โโโโโ \033[0m"
echo -e "****************************1:facile**********************************"
echo -e "****************************2:normal**********************************"
echo -e "****************************3:hard************************************"
echo -e "****************************4:extrem**********************************"
echo -e "****************************exit:sortie du jeu************************"
echo -en "$> "
read opt
if [ $opt = 2 ]
then
. ./normal.sh
fi
if [ $opt = 3 ]
then
. ./hard.sh
fi
if [ $opt = 4 ]
then
. ./extrem.sh
fi
if [ $opt = 1 ]
then
. ./facile.sh
fi
if [ $opt = "exit" ]
then
echo -en "Bonne journee\n"
exit
fi
| true
|
af339e568bbb8fb9bcb1565a658409a1f03776b6
|
Shell
|
donrast41/OS
|
/week5-master/(ex2)with_race.sh
|
UTF-8
| 119
| 2.96875
| 3
|
[] |
no_license
|
for i in `seq 1 1000`;
do
last_number=`tail -1 num`
last_number=$((last_number + 1))
echo $last_number >> num
done
| true
|
ef315b35c6288c7cb235e74de5e1a708217e7b7a
|
Shell
|
vslakshmi/sample-java-project
|
/worls_of_numbers.sh
|
UTF-8
| 146
| 2.5625
| 3
|
[] |
no_license
|
#!bin/bash
echo "Please enter a"
read a;
echo "Please enter b"
read b;
echo $((a+b));
echo $((a-b));
echo $((a*b));
echo $((a/b));
echo $((a%b));
| true
|
7e0be8f50687f5d82d77c47061b8826fe97a3a7c
|
Shell
|
EricssonIoTaaS/DeviceOnBoardingExamples
|
/raspberryPi/temperatureSensor/sendTempDataWithHTTP.sh
|
UTF-8
| 361
| 2.90625
| 3
|
[] |
no_license
|
#!/bin/bash
while true;
do
temp=$(./readTempData.sh)
now=$(date +%d.%m.%y-%T)
cat blank.json | sed 's/T1/'$temp'/g; s/D1/'$now'/g'> \
send.json
json=$(cat send.json)
echo $json
curl -X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d "$json" \
http://iot-api-gw.ericsson.net:3001/resources/Ericsson/ITSC/temperature
sleep 10
done
| true
|
37729fe235789b0e51a5c87da33099766ec8a418
|
Shell
|
djmattyg007/arch-adminer
|
/setup/root/install.sh
|
UTF-8
| 424
| 2.921875
| 3
|
[
"Unlicense"
] |
permissive
|
#!/bin/bash
# Exit script if return code != 0
set -e
source /root/functions.sh
echo "Install dhcpcd package without udev support"
aur_start
aur_build dhcpcd-without-systemd
aur_finish
echo "Install and configure additional PHP packages"
source /root/php.sh
echo "Download adminer"
curl -L -sS -o /srv/http/adminer.php https://www.matthewgamble.net/files/adminer/adminer-${ADMINER_VERSION}.php
# Cleanup
pacman_cleanup
| true
|
6e576d3fc6d24740f875781f634803f6e065c0cc
|
Shell
|
sudnya/video-classifier
|
/lucius/experiments/mnist/train-mnist.sh
|
UTF-8
| 2,074
| 2.921875
| 3
|
[] |
no_license
|
#!/bin/bash
SCRIPT_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CUDA_DEVICES="0"
INPUT_TRAINING_DATASET="/Users/gregdiamos/temp/mnist/train/database.txt"
INPUT_VALIDATION_DATASET="/Users/gregdiamos/temp/mnist/test/database.txt"
LOGS="NesterovAcceleratedGradientSolver,BenchmarkImageNet,LabelMatchResultProcessor,InputVisualDataProducer"
LAYER_SIZE="256"
INPUT_WIDTH="28"
INPUT_HEIGHT="28"
INPUT_COLORS="1"
LAYERS="3"
MINI_BATCH_SIZE="64"
LAYER_OUTPUT_REDUCTION_FACTOR="1"
BATCH_NORMALIZATION=0
FORWARD_BATCH_NORMALIZATION=1
EPOCHS="80"
LEARNING_RATE="1.0e-2"
ANNEALING_RATE="1.000001"
MOMENTUM="0.9"
RESUME_FROM=""
EXPERIMENT_NAME="$FORWARD_BATCH_NORMALIZATION-fbn-$BATCH_NORMALIZATION-bn-$INPUT_WIDTH-w-$INPUT_HEIGHT-h-$INPUT_COLORS-c-$LAYER_SIZE-layer-size-$LAYERS-layers-$MINI_BATCH_SIZE-mb-$LEARNING_RATE-lr-$MOMENTUM-m-$ANNEALING_RATE-anneal"
if [[ -n $RESUME_FROM ]]
then
EXPERIMENT_NAME="$EXPERIMENT_NAME-resume"
fi
EXPERIMENT_DIRECTORY="$SCRIPT_DIRECTORY/$EXPERIMENT_NAME"
LOG_FILE="$EXPERIMENT_DIRECTORY/log"
MODEL_FILE="$EXPERIMENT_DIRECTORY/model.tar"
VALIDATION_ERROR_FILE="$EXPERIMENT_DIRECTORY/validation-error.csv"
TRAINING_ERROR_FILE="$EXPERIMENT_DIRECTORY/training-error.csv"
mkdir -p $EXPERIMENT_DIRECTORY
export CUDA_VISIBLE_DEVICES=$CUDA_DEVICES
COMMAND="benchmark-imagenet -l $LAYER_SIZE -e $EPOCHS -b $MINI_BATCH_SIZE -f $LAYER_OUTPUT_REDUCTION_FACTOR \
--momentum $MOMENTUM --learning-rate $LEARNING_RATE -c $INPUT_COLORS -x $INPUT_WIDTH -y $INPUT_HEIGHT \
-i $INPUT_TRAINING_DATASET -t $INPUT_VALIDATION_DATASET -L $LOGS --log-file $LOG_FILE \
-o $MODEL_FILE -r $VALIDATION_ERROR_FILE --training-report-path $TRAINING_ERROR_FILE \
--layers $LAYERS \
--annealing-rate $ANNEALING_RATE"
if [ $BATCH_NORMALIZATION -eq 1 ]
then
COMMAND="$COMMAND --batch-normalization"
fi
if [ $FORWARD_BATCH_NORMALIZATION -eq 1 ]
then
COMMAND="$COMMAND --forward-batch-normalization"
fi
if [[ -n $RESUME_FROM ]]
then
COMMAND="$COMMAND -m $RESUME_FROM"
fi
echo $COMMAND
$COMMAND
| true
|
72eb276126e627ced05bcd7c9c16d09ee4a02e5d
|
Shell
|
thecotne/stateless-app
|
/statelessup
|
UTF-8
| 779
| 2.734375
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
set -e
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
SELF_DIR=$(dirname $SELF_PATH)
RSYNC_COMMAND="rsync -vaz --exclude node_modules --exclude tsconfig.tsbuildinfo"
eval "$RSYNC_COMMAND $SELF_DIR/workspaces/blessing/ ./workspaces/blessing/"
eval "$RSYNC_COMMAND $SELF_DIR/workspaces/producers/ ./workspaces/producers/"
eval "$RSYNC_COMMAND $SELF_DIR/.editorconfig ./.editorconfig"
eval "$RSYNC_COMMAND $SELF_DIR/.eslintrc.js ./.eslintrc.js"
eval "$RSYNC_COMMAND $SELF_DIR/.nvmrc ./.nvmrc"
eval "$RSYNC_COMMAND $SELF_DIR/.prettierrc.js ./.prettierrc.js"
eval "$RSYNC_COMMAND $SELF_DIR/.yarnrc ./.yarnrc"
eval "$RSYNC_COMMAND $SELF_DIR/README.md ./README.md"
eval "$RSYNC_COMMAND $SELF_DIR/tasker ./tasker"
| true
|
598a934d3eaa093f5600d43782a99503e9385839
|
Shell
|
maxgallo/dotfiles
|
/more/mas.sh
|
UTF-8
| 481
| 3.28125
| 3
|
[] |
no_license
|
#!/bin/bash
source ../utils/confirm.sh
source ../utils/brew-utils.sh
source ../utils/log.sh
# "mas search xzy" to search for packages
mas_packages=(
668208984 # GIPHY Capture. The GIF Maker
467040476 # HiddenMe
1497506650 # Yubico Authenticator
)
# Make sure homebrew is installed first
mandatoryBrew
logStep "Installing Mas"
brew install mas
logStep "Installing Mas Packages"
for i in "${mas_packages[@]}"
do
:
echo installing $i
mas install "$i"
done
| true
|
0ee626b86096ba2dcb9fb62e759634bda6ba6a75
|
Shell
|
bharathmighty248/shell_programming
|
/forloop/primenum.sh
|
UTF-8
| 220
| 3.640625
| 4
|
[] |
no_license
|
#!/bin/bash -x
read -p "Enter the num :: " n
c=0
for ((i=1; i<=n; i++))
do
b=$(($n % $i))
if [ $b == 0 ]
then
c=$(($c+1))
fi
done
if [ $c == 2 ]
then
echo $n is prime number
else
echo $n is not prime number
fi
| true
|
c4909fdcd9a6c0378f12b1b4437c15b9687df247
|
Shell
|
scenario-test-framework/stfw
|
/src/bin/lib/stfw/usecase/scenario/scenario_inputport
|
UTF-8
| 4,265
| 3.515625
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
#===================================================================================================
#
# scenario inputport
#
#===================================================================================================
. "${DIR_BIN_LIB}/stfw/domain/service/scenario_service"
#--------------------------------------------------------------------------------------------------
# ๅๆๅ
#
# ๆฆ่ฆ
# ใใฃใฌใฏใใชใๅๆๅใใพใใ
#
# ๅผๆฐ
# 1: ใทใใชใชใซใผใใใฃใฌใฏใใช
# 2: ใทใใชใชๅ
#
# ๅบๅ
# ็ฐๅขๅคๆฐ
# ใชใ
# ๆจๆบๅบๅ
# ใชใ
# ใใกใคใซ
# _{ใทใใชใชๅ}/
# metadata.yml
# scenario.dig
#
#--------------------------------------------------------------------------------------------------
function stfw.usecase.inputport.scenario.initialize_requested() {
stfw.log.func_start_debug "$@"
local _scenario_root_dir="${1:?}"
local _scenario_name="$2"
stfw.domain.service.scenario.initialize_requested "${_scenario_root_dir}" "${_scenario_name}"
local _retcode=$?
stfw.log.func_end_debug ${_retcode}
return ${_retcode}
}
#--------------------------------------------------------------------------------------------------
# digใใกใคใซ็ๆ
#
# ๆฆ่ฆ
# ใใฃใฌใฏใใชๆงๆใซๅใใใฆdigใใกใคใซใ็ๆใใพใใ
#
# ๅผๆฐ
# 1: scenarioใใฃใฌใฏใใช
#
# ๅบๅ
# ็ฐๅขๅคๆฐ
# ใชใ
# ๆจๆบๅบๅ
# ใชใ
# ใใกใคใซ
# {ใทใใชใชๅ}/
# metadata.yml
# scenario.dig
#
#--------------------------------------------------------------------------------------------------
function stfw.usecase.inputport.scenario.generate_requested() {
stfw.log.func_start_debug "$@"
local _trg_scenario_dir="${1:?}"
stfw.domain.service.scenario.generate_requested "${_trg_scenario_dir}"
local _retcode=$?
stfw.log.func_end_debug ${_retcode}
return ${_retcode}
}
#--------------------------------------------------------------------------------------------------
# digใใกใคใซ็ๆ(ใซในใฑใผใ)
#
# ๆฆ่ฆ
# ใใฃใฌใฏใใชๆงๆใซๅใใใฆใscenario, bizdateใฎdigใใกใคใซใ็ๆใใพใใ
#
# ๅผๆฐ
# 1: scenarioใใฃใฌใฏใใช
#
# ๅบๅ
# ็ฐๅขๅคๆฐ
# ใชใ
# ๆจๆบๅบๅ
# ใชใ
# ใใกใคใซ
# {ใทใใชใชๅ}/
# metadata.yml
# scenario.dig
# _{้ฃ็ช}_{ๆฅญๅๆฅไป}/
# metadata.yml
# bizdate.dig
#
#--------------------------------------------------------------------------------------------------
function stfw.usecase.inputport.scenario.cascade_generate_requested() {
stfw.log.func_start_debug "$@"
local _trg_scenario_dir="${1:?}"
stfw.domain.service.scenario.cascade_generate_requested "${_trg_scenario_dir}"
local _retcode=$?
stfw.log.func_end_debug ${_retcode}
return ${_retcode}
}
#--------------------------------------------------------------------------------------------------
# setup
#
# ๆฆ่ฆ
# setupๅฆ็ใๅฎ่กใใพใใ
#
# ๅผๆฐ
# 1: scenarioใใฃใฌใฏใใช
#
# ๅบๅ
# ็ฐๅขๅคๆฐ
# ใชใ
# ๆจๆบๅบๅ
# ใชใ
# ใใกใคใซ
# ใชใ
#
#--------------------------------------------------------------------------------------------------
function stfw.usecase.inputport.scenario.setup_requested() {
stfw.log.func_start_debug "$@"
local _trg_scenario_dir="${1:?}"
stfw.domain.service.scenario.setup "${_trg_scenario_dir}"
local _retcode=$?
stfw.log.func_end_debug ${_retcode}
return ${_retcode}
}
#--------------------------------------------------------------------------------------------------
# teardown
#
# ๆฆ่ฆ
# teardownๅฆ็ใๅฎ่กใใพใใ
#
# ๅผๆฐ
# 1: scenarioใใฃใฌใฏใใช
#
# ๅบๅ
# ็ฐๅขๅคๆฐ
# ใชใ
# ๆจๆบๅบๅ
# ใชใ
# ใใกใคใซ
# ใชใ
#
#--------------------------------------------------------------------------------------------------
function stfw.usecase.inputport.scenario.teardown_requested() {
stfw.log.func_start_debug "$@"
local _trg_scenario_dir="${1:?}"
stfw.domain.service.scenario.teardown "${_trg_scenario_dir}"
local _retcode=$?
stfw.log.func_end_debug ${_retcode}
return ${_retcode}
}
| true
|
6c8a44c96eea2caa26814a4de275d50c696df898
|
Shell
|
cliu1/lorelei-amdtk
|
/recipes/CHN_DEV_20160831/utils/phone_loop_train.sh
|
UTF-8
| 2,828
| 3.703125
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
#
# Train the inifinite phone-loop model.
#
if [ $# -ne 4 ]; then
echo "usage: $0 <setup.sh> <niter> <in_dir> <out_dir>"
exit 1
fi
setup="$1"
niter="$2"
init_model="$3/model.bin"
out_dir="$4"
source $setup || exit 1
if [ ! -e $out_dir/.done ]; then
mkdir -p "$out_dir"
# First, we copy the inital model to the iteration 0 directory.
if [ ! -e "$out_dir"/iter0/.done ]; then
mkdir "$out_dir"/iter0
cp "$init_model" "$out_dir/iter0/model.bin"
date > "$out_dir"/iter0/.done
else
echo "The initial model has already been set. Skipping."
fi
# Now start to (re-)train the model.
for i in $(seq "$niter") ; do
if [ ! -e "$out_dir/iter$i/.done" ]; then
mkdir "$out_dir/iter$i" || exit 1
# We pick up the model from the last iteration.
model="$out_dir/iter$((i-1))/model.bin" || exit 1
# VB E-step: estimate the posterior distribution of the
# latent variables.
amdtk_run $parallel_profile \
--ntasks "$parallel_n_core" \
--options "$train_parallel_opts" \
"pl-vbexp" \
"$train_keys" \
"amdtk_ploop_exp $model $fea_dir/\$ITEM1.$fea_ext \
$out_dir/iter$i/\$ITEM1.acc" \
"$out_dir/iter$i" || exit 1
# Accumulate the statistics. This step could be further
# optimized by parallelizing the accumulation.
find "$out_dir/iter$i" -name "*.acc" > \
"$out_dir/iter$i/stats.list" || exit 1
amdtk_ploop_acc "$out_dir/iter$i/stats.list" \
"$out_dir/iter$i/total_acc_stats" || exit 1
# VB M-step: from the sufficient statistics we update the
# parameters of the posteriors.
llh=$(amdtk_ploop_max "$model" \
"$out_dir/iter$i/total_acc_stats" \
"$out_dir/iter$i/model.bin" || exit 1)
echo "Iteration: $i log-likelihood >= $llh"|| exit 1
# Keep track of the lower bound on the log-likelihood.
echo "$llh" > "$out_dir"/iter"$i"/llh.txt || exit 1
# Clean up the statistics as they can take a lot of space.
rm "$out_dir/iter$i/stats.list" || exit 1
find "$out_dir/iter$i/" -name "*.acc" -exec rm {} + || exit 1
date > "$out_dir/iter$i/.done"
else
echo "Iteration $i has already been done. Skipping."
fi
done
# Create a link pointing to the model of the last iteration.
#ln -fs "$out_dir/iter$niter/model.bin" "$out_dir/model.bin"
cp "$out_dir/iter$niter/model.bin" "$out_dir/model.bin"
date > "$out_dir/.done"
else
echo "The model is already trained. Skipping."
fi
| true
|
0a05e8011db3c0c0bfba614f156c20b90e9eb621
|
Shell
|
tianyaleixiaowu/pinpoint-agent
|
/configure-agent.sh
|
UTF-8
| 937
| 2.515625
| 3
|
[] |
no_license
|
#!/bin/bash
set -e
set -x
COLLECTOR_IP=${COLLECTOR_IP:-127.0.0.1}
COLLECTOR_TCP_PORT=${COLLECTOR_TCP_PORT:-9994}
COLLECTOR_UDP_STAT_LISTEN_PORT=${COLLECTOR_UDP_STAT_LISTEN_PORT:-9995}
COLLECTOR_UDP_SPAN_LISTEN_PORT=${COLLECTOR_UDP_SPAN_LISTEN_PORT:-9996}
cp -R /assets/pinpoint-agent /assets/pinpoint-agent
cp -f /assets/pinpoint.config /assets/pinpoint-agent/pinpoint.config
sed -i "s/profiler.collector.ip=127.0.0.1/profiler.collector.ip=${COLLECTOR_IP}/g" /assets/pinpoint-agent/pinpoint.config
sed -i "s/profiler.collector.tcp.port=9994/profiler.collector.tcp.port=${COLLECTOR_TCP_PORT}/g" /assets/pinpoint-agent/pinpoint.config
sed -i "s/profiler.collector.stat.port=9995/profiler.collector.stat.port=${COLLECTOR_UDP_STAT_LISTEN_PORT}/g" /assets/pinpoint-agent/pinpoint.config
sed -i "s/profiler.collector.span.port=9996/profiler.collector.span.port=${COLLECTOR_UDP_SPAN_LISTEN_PORT}/g" /assets/pinpoint-agent/pinpoint.config
| true
|
a4ee9278df69557ed9eb0ac6e8d273d146e51988
|
Shell
|
rbudiharso/asdf
|
/lib/commands/command-local.bash
|
UTF-8
| 645
| 3.6875
| 4
|
[
"MIT"
] |
permissive
|
# -*- sh -*-
# shellcheck source=lib/commands/version_commands.bash
source "$(dirname "$ASDF_CMD_FILE")/version_commands.bash"
local_command() {
local parent=false
local positional=()
while [[ $# -gt 0 ]]; do
case $1 in
-p | --parent)
parent="true"
shift # past value
;;
*)
positional+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${positional[@]}" # restore positional parameters
if [ $parent = true ]; then
version_command local-tree "$@"
else
version_command local "$@"
fi
}
local_command "$@"
| true
|
7518ff6a2df1f3d49cec60c8e846797adb25567b
|
Shell
|
NobukoYoshida/ocaml-mpst
|
/examples/run_oauth.sh
|
UTF-8
| 832
| 2.921875
| 3
|
[] |
no_license
|
#!/bin/bash
cd "$(dirname "$0")"
set -e
set -v
opam switch ocaml-mpst-lwt
eval `opam env`
dune build @oauth/all
# Starting the OAuth server.
# An HTTPS-enabled web server is required.
# Add the following configuration to your HTTPS server:
#
# ProxyPass /scribble http://127.0.0.1:8080/scribble
# ProxyPassReverse /scribble http://127.0.0.1:8080/scribble
#
# and open: https://your-server-domain.com/scribble/oauth
#
# SSH port forwarding is useful for this purpose. For example,
#
# ssh your-server-domain.com -R127.0.0.1:8080:127.0.0.1:8080
#
# will open 127.0.0.1:8080 on your server, and
# redirect connections to this host.
#
# After finishing experiments, do not forget to
# kill the OAuth server:
#
# killall oauth.exe
#
../_build/default/examples/oauth/oauth.exe &
echo Please open https://your.domain/scribble/oauth
| true
|
2caec772ff94624acff8dc6e6e206cf88dfc6785
|
Shell
|
barklyprotects/homebrew-barkly
|
/projects/base/files/env/functions.sh
|
UTF-8
| 362
| 3.984375
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Get current timestamp. Use option '-c' to copy to clipboard.
function ts {
local iso_stamp=`date +"%Y-%m-%d %H:%M:%S"`
if [ "$1" == "-c" ]; then
echo -n $iso_stamp | pbcopy
echo "[$iso_stamp] copied to clipboard."
else
echo $iso_stamp
fi
}
function tmpname {
local name=`date +"%Y-%m-%d_%H-%M-%S"`
echo "tempfile_$name"
}
| true
|
ae40d867edcaf078d322d711328bfeceb92515e3
|
Shell
|
itsShnik/dotfiles
|
/.bash_aliases
|
UTF-8
| 532
| 2.578125
| 3
|
[] |
no_license
|
shopt -s autocd
shopt -s cdspell
# my new alias
alias open='xdg-open'
alias bashrc='vim ~/.bashrc'
alias ll='ls -alh'
alias la='ls -A'
alias l='ls -CFlh'
alias lsd="ls -alF | grep /$"
alias srcbash='source ~/.bashrc'
alias als='cat ~/.bash_aliases'
# git aliases
alias adda="git add -A"
alias pull="git pull origin master"
alias push="git push origin master"
alias commit='function _commit(){ git commit -m $1 ; };_commit'
# kitty
alias icat='kitty +kitten icat'
# aliases concerning command prompt
alias ls='ls --color=always'
| true
|
0f52ac9a549f9a36a586b2cb78288fa6cc35b8ff
|
Shell
|
vasanthkumart007/Software_AG_Vasanth
|
/dockerex/docker-ex3-folder/docker-ex3
|
UTF-8
| 381
| 2.828125
| 3
|
[] |
no_license
|
#!/bin/bash
#Author: VASANTH
#Date: May 2 2021
echo "THIS SCRIPT WILL CREATE A CONTAINER NGINX:1.19.10"
echo "--------------------"
sleep 1
echo "IT WILL LISTENS TO THE PORT http://localhost:8080"
echo "--------------------"
docker-compose -f ex3-compose.yml up
sleep 1
echo
echo "-------------------"
echo "CONTAINER EXITED SINCE CTRL+C IS PRESSED"
echo "--------------------"
| true
|
5711385f3266a1edd1c1c67a80d2579319dccbff
|
Shell
|
ricardoribas/bash-commands
|
/bin/request-volume-expansion.sh
|
UTF-8
| 779
| 3.4375
| 3
|
[] |
no_license
|
#/bin/bash
EC2_INSTANCE_ID=$1
EC2_ACCOUNT_USER=$2
EC2_KEY_LOCATION=$3
# Retrieve information about the instance volumes
EC2_INSTANCE_INFO=$(aws ec2 describe-instances --instance-id $EC2_INSTANCE_ID)
EC2_VOLUME_ID=$(echo $EC2_INSTANCE_INFO | jq '.Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId' | tr -d '"')
EC2_INSTANCE_DNS_NAME=$(echo $EC2_INSTANCE_INFO | jq '.Reservations[0].Instances[0].PublicDnsName' | tr -d '"')
aws ec2 modify-volume --size 50 --volume-id $EC2_VOLUME_ID
EC2_INSTANCE_CONNECTION="$EC2_ACCOUNT_USER@$EC2_INSTANCE_DNS_NAME"
# Access the instance and expand the disk to comply to the new size
ssh -i $EC2_KEY_LOCATION $EC2_INSTANCE_CONNECTION "sudo file -s /dev/xvd* && lsblk && sudo growpart /dev/xvda 1 && sudo xfs_growfs /dev/xvda1"
| true
|
4ab8783c8356c21cb5e1632bd5198f32c95fb712
|
Shell
|
lanl/SICM
|
/contrib/identify_numa
|
UTF-8
| 962
| 3.9375
| 4
|
[
"BSD-2-Clause"
] |
permissive
|
#!/usr/bin/env bash
ROOT="$(dirname ${BASH_SOURCE[0]})"
declare -A mapping
nodes=$(${ROOT}/list_numa_nodes | awk '{ print $1 }')
# start with assumption that all numa nodes are dram
for node in ${nodes}
do
mapping["${node}"]="DRAM"
done
# run all memory type detectors in the identify_numa.d directory
for detector in $(find ${ROOT}/identify_numa.d/* -type f -executable)
do
while IFS=" " read -r node type; do
if [[ "${node}" == "" ]]
then
continue
fi
if [[ "${node}" -lt "0" ]]
then
echo "Warning: ${type} mapped to NUMA node ${node}"
continue
fi
if [[ "${mapping[${node}]}" != "DRAM" ]]
then
echo "Warning: NUMA Node ${node} previously mapped to ${mapping[${node}]}" 1>&2
fi
mapping["${node}"]="${type}"
done <<< "$(${detector})"
done
# done
for node in ${nodes}
do
echo "${node} ${mapping[${node}]}"
done
| true
|
05ddc558dc7ba159e784df240bfc451e784cbb5c
|
Shell
|
kbschliep/Serverless-WebApp
|
/wait-for-localstack-ready.sh
|
UTF-8
| 409
| 3.640625
| 4
|
[] |
no_license
|
CONTAINER=$(docker ps -q)
if [ -z $CONTAINER ]; then
echo "Couldn't find running Docker container."
docker --version
docker ps
exit 1
fi
echo "waiting for Localstack to report 'Ready.' from container $CONTAINER"
while true; do
LOGS=$(docker logs $CONTAINER --since 1m)
if echo $LOGS | grep 'Ready.'; then
echo "Localstack is ready!"
break;
fi
echo "waiting.."
sleep 1
done
| true
|
77a92f7b0cec7eb22c72f20503a8a97be98c3eb2
|
Shell
|
MicahElliott/dotfiles
|
/bin/ecd.sh
|
UTF-8
| 8,054
| 3.765625
| 4
|
[] |
no_license
|
# ecd โ Enhanced CD (for bash)
#
# Author: Micah Elliott http://MicahElliott.com
# License: WTFPL http://sam.zoy.org/wtfpl/
#
# Usage: source .../ecd.sh; cd ...
# (Donโt try to run this file; it is to be sourced)
#
# Useful aliases:
# alias cdl='cd -l'
# alias cde='vim -o2 .enterrc .exitrc'
#
# NOTE: I no longer use this script since switching to zsh, where I
# rely on more powerful versions of pushd (pu), popd (po), cd, and chpwd
# hook. But, this still is useful in bash if:
# * you find pushd/popd counterintuitive (I did for a long time)
# * want a menu-driven history
# * like the notion of .enterrc/.exitrc per directory
# * would like to see a clever example of full-path ascension/descension.
#
# See OโReillyโs Power Tools book for an example of sprinkling these
# little files around.
#
# History:
# * 2003: Written and used by a few folks at Intel, shared on freshmeat.
# * 2008: Expanded to multi-shell/OS, re-wrote in Python, many feature *ideas*
# * 2009: Micah adopts zsh
# * 2011: Posted to github in case someone still wants to use it
#
# NOTE: You might not want to name the workhorse function โcdโ. If
# itโs uncomfortable, you could use โcโ or โecdโ.
#
# See README for ideas to expand this.
declare -a _dirstack
_dirstack=($HOME)
#echo "_dirstack array set to ${_dirstack[*]}"
_cd_dbg() { (( $debug )) && _cd_msg "debug: $@"; }
_cd_vbs() { (( $verbose )) && _cd_msg "$@" 1>&2; }
_cd_msg() { echo -e "cd: $@" 1>&2; }
_cd_cleanup() { trap INT; OPTERR=1 OPTIND=1; }
_cd_misuse() {
echo "cd: illegal option -- $OPTARG"
echo "Try \`cd -h' for more information."
}
_cd_usage() {
echo "Usage: cd [OPTION] [DIR]"
echo "Change the current directory to DIR, searching for hidden"
echo "source-able files named \`.enterrc' and \`.exitrc'."
echo
echo " -h display help message and exit"
echo " -l list history and select new directory from menu"
echo " -v verbose mode"
echo
echo "Report bugs to <mde@MicahElliott.com>"
}
# Ascend upward in dir hierarchy searching for and sourcing .exitrc files
_cd_ascend() {
# Donโt ascend if cwd is โ/โ
if [ "$orig" = "/" ]; then return; fi
# Ascend all the way to common base dir
_cd_vbs "Ascending -- searching for files of type .exitrc"
tmp_orig_ext=/$orig_ext
while [ "${tmp_orig_ext}" != "${tmp_orig_ext%%/*}" ]; do
_cd_dbg "Searching '${common}${tmp_orig_ext}' for '.exitrc'"
if [ -e "${common}$tmp_orig_ext/.exitrc" ]; then
_cd_vbs "Found and sourced ${common}$tmp_orig_ext/.exitrc"
source "${common}/${tmp_orig_ext}/.exitrc"
fi
tmp_orig_ext="${tmp_orig_ext%/*}"
done
}
# Descend downward in dir hierarchy searching for and sourcing .enterrc files
_cd_descend() {
# Descend to โnew_extโ
_cd_vbs "Descending -- searching for files of type .enterrc"
tmp="$common"
for dir in ${new_ext//\// }; do
tmp="${tmp}/${dir}"
_cd_dbg "Searching '${tmp}' for '.enterrc'"
if [ -e "$tmp/.enterrc" ]; then
_cd_vbs "Found and sourced $tmp/.enterrc"
source "$tmp/.enterrc"
fi
done
}
cd() {
trap '_cd_cleanup; return 2;' INT
# Declare local vars
local orig new orig_list new_list orig_ext new_ext common maxsize list_dirs
local opt dir verbose debug tmp tmp_orig_ext comm_tmp abort
let maxsize=10 list_dirs=0 verbose=0
#let debug=0
let debug=${DEBUG:-0}
(( $debug )) && let verbose=1
### PART 1: Parse command-line options
while getopts ":hlv" opt; do
case $opt in
h ) _cd_usage; _cd_cleanup; return 1 ;;
l ) let list_dirs=1 ;;
v ) let verbose=1 ;;
\? ) _cd_misuse; _cd_cleanup; return 1;;
esac
done
shift $(($OPTIND - 1))
# Indicate activated modes
(( $list_dirs )) && _cd_vbs "<<list_dirs mode set>>"
(( $verbose )) && _cd_vbs "<<verbose mode set>>"
# `orig' is original directory
orig=$(pwd)
_cd_dbg "orig = $orig"
### PART 2: Determine functional mode: interactive or not
# Interactive list mode
if (( $list_dirs )); then
# If stack is empty bail out
if (( ${#_dirstack[*]} < 2 )); then
_cd_msg "stack is empty -- nothing to list"; _cd_cleanup; return 1;
fi
# FIXME: Maybe add color to this prompt ??
PS3="Enter your selection: "
# Choose from dirs on stack, excluding the first dir
select d in $(echo ${_dirstack[*]} | sed 's:[^ ]*::') "<<exit>>"; do
if [ "$d" = "<<exit>>" ]; then
_cd_cleanup; let abort=1; break;
elif [ $d ]; then
new="$d";
if ! builtin cd "$d"; then _cd_cleanup; return 1; fi
break;
else
echo "Invalid choice -- try again"
fi
done
(( abort )) && return 0;
# Non-interactive mode
else
# `new' is destination directory -- must cd there to obtain abs path
if (( $# > 0 )); then
if ! builtin cd "$1"; then _cd_cleanup; return 1; fi
new=$( echo $(pwd) | sed 's:///*:/:' )
else # $# = 0
builtin cd $HOME
new=$(pwd)
fi
fi
_cd_dbg "new = $new"
### PART 3: Add dir to stack
# Donโt want โ/โ on stack
if [ "$new" = "/" ]; then :
else
# If already in list move to front and remove later entry
if echo "${_dirstack[*]} " | /bin/grep -q "$new "; then
_cd_dbg "$new already on stack -- moving to front."
_dirstack=($new $( echo "${_dirstack[*]} " | sed "s:$new ::" ))
# Else just add to _dirstack
else
_dirstack=($new ${_dirstack[*]})
fi
# Check for length too long
if (( ${#_dirstack[*]} > $maxsize )); then
_cd_dbg "reached max size -- unsetting index "${#_dirstack[*]}-1
unset _dirstack[${#_dirstack[*]}-1]
fi
fi
### PART 4: Search for files of type .exitrc and .enterrc (ascension/descension)
### CASE 0: No-op if `cd .' or `cd ' and already in $HOME
if [ "$orig" = "$new" ]; then
_cd_msg "You're already there, silly."
_cd_cleanup; return 1;
fi
### Some magic to determine commonality of orig and new dirs
orig_list=$(echo $orig | sed -e 's:^/::' -e 's:/:\\n:g')
new_list=$(echo $new | sed -e 's:^/::' -e 's:/:\\n:g')
comm_tmp=$(comm --nocheck-order -12 <(echo -e "$orig_list") <(echo -e "$new_list"))
common=$(echo $comm_tmp | sed -e 's:^:/:' -e 's: :/:g')
if [ "$common" = "/" ]; then common=""; fi
comm_tmp=$(comm --nocheck-order -23 <(echo -e "$orig_list") <(echo -e "$new_list"))
orig_ext=$(echo $comm_tmp | sed -e 's: :/:g')
comm_tmp=$(comm --nocheck-order -13 <(echo -e "$orig_list") <(echo -e "$new_list"))
new_ext=$(echo $comm_tmp | sed -e 's: :/:g')
_cd_dbg "common = $common"
_cd_dbg "orig_ext = $orig_ext"
_cd_dbg "new_ext = $new_ext"
### CASE 1: Moving to entirely new hierarchy of `/'
if [ -z "$common" ]; then
_cd_dbg "CASE1: $new and $orig have no common base"
_cd_ascend
_cd_descend
### CASE 2: Descending to some subdir of orig
elif [ -z "$orig_ext" ]; then
_cd_dbg "CASE2: Descending to $new_ext"
_cd_descend
### CASE 3: Ascending to some parent in the hierarchy, but still common base
else
_cd_dbg "CASE3: Ascending to $common"
_cd_ascend
# CASE 3.1: Descend to `new_ext', sourcing all .enterrc's
if [ -n "$new_ext" ]; then
_cd_dbg "CASE3.1: Descending to $new_ext"
_cd_descend
# CASE 3.2: New dir is a direct parent -- no descension
else
_cd_dbg "CASE3.2: new_ext is null -- no descending"
new_ext="."
_cd_descend #trial
fi
fi
### PART 5: End
_cd_vbs "_dirstack = ${_dirstack[*]}"
_cd_cleanup; return 0;
}
| true
|
7595a177d1bf882421d0e0596b33372d0d06fe72
|
Shell
|
probe36/network-switch
|
/corn-test/dailybackup.sh
|
UTF-8
| 766
| 2.859375
| 3
|
[] |
no_license
|
#Purpose: make dauily backup from DC to Office
#Revised: 20200420
#Version control
#Git name
#!bin/bash
#Home dir
BACKUPHOME=/backup/ETNbackup
#Source dir
SDIR1=192.168.0.55:/home/ETN_Documents/SdDocument
SDIR2=192.168.0.55:/home/ETN_Documents/SdDocumentAddendum
#Destination dir
DDIR=$BACKUPHOME/ETN_Documents
#Excluded files
EXCLUDES=$BACKUPHOME/exclude_files.txt
#Create daily backup dir
DNAME=$(date +%A)
mkdir -p $BACKUPHOME/weekly/$DNAME
#Option
OPT="-avzhe ssh --bwlimit=1900 --progress --force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES --delete --backup --backup-dir=$BACKUPHOME/weekly/$DNAME"
#Delete all last week's data
rm -rf $BACKUPHOME/weekly/$DNAME/*
#Start Syncing
rsync $OPT $SDIR1 $DDIR
rsync $OPT $SDIR2 $DDIR
rsync $Opt
| true
|
a27e297fe0f1576e53eaa9947a831d84bc0cbae8
|
Shell
|
prague-dev/sas-creator
|
/android-emulator-creator.sh
|
UTF-8
| 366
| 2.703125
| 3
|
[] |
no_license
|
#!/bin/bash
sz="$(stat -c %s s.img)"
sz=$((sz/512))
sz=$((sz + 2048 ))
sz=$((sz / 2048 ))
sz=$((sz * 2048 ))
sum=2048
newsum=$((sum+sz+2048))
rm -f system-gpt
truncate -s $((newsum*512)) system-gpt
/sbin/sgdisk -C system-gpt
/sbin/sgdisk --new=1:2048:+$sz system-gpt
/sbin/sgdisk --change-name=1:system system-gpt
dd if=s.img of=system-gpt conv=notrunc seek=$sum
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.