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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cc43f16ba30fed04ec31a19f2e642a729c928ed7
|
Shell
|
Jackojc/dots
|
/scripts/utils/monitors/dimmer
|
UTF-8
| 126
| 2.6875
| 3
|
[] |
no_license
|
#!/usr/bin/env sh
file="$XDG_RUNTIME_DIR/dimmer"
if [ -f "$file" ]; then
sct
rm "$file"
else
sct 4000
touch "$file"
fi
| true
|
86d05e322a5f20a77371dd3658d480bafb5deafc
|
Shell
|
cisco-security/Cisco-Validated-Designs
|
/safe-cloud-caas-azure/azure-infrastructure/gitlab-user-data.sh
|
UTF-8
| 1,313
| 2.921875
| 3
|
[] |
no_license
|
#!/bin/sh
# Documentation to install GitLab-CE can be found here - https://about.gitlab.com/install/?version=ce#ubuntu
#Install Docker CE
sudo apt-get -y update && sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get -y update && sudo apt-get -y install docker-ce docker-ce-cli containerd.io
#Install Gitlab CE
sudo apt-get -y install curl tzdata perl
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="http://safegitlab.${gitlabaddress}" apt-get install gitlab-ce
# Enable container registry- https://docs.gitlab.com/ee/administration/packages/container_registry.html
sudo echo "registry_external_url 'http://safegitlab.${gitlabaddress}:5050'" >> /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure
#Install Gitlab Runner
curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb"
dpkg -i gitlab-runner_amd64.deb
| true
|
72f7d4f794d3fdfb1a82c21e5871b6d733dc509e
|
Shell
|
HETovi/disconf
|
/disconf-web/deploy/deploy.sh
|
UTF-8
| 2,556
| 3.78125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
#
# 一个简单的 WAR&&静态代码 部署脚本, 执行时必须在disconf-web目录下执行本脚本
#
#
# 执行前请确定环境变量里存在以下两个变量
# 1. $ONLINE_CONFIG_PATH : java web 线上配置目录
# 2. $WAR_ROOT_PATH : java web war 包
#
# 脚本执行后,将生成从下文件:
# $WAR_ROOT_PATH/ 项目根目录(请将Tomcat指向此目录)
# $WAR_ROOT_PATH/disconf-web.war 生成的War包
# $WAR_ROOT_PATH/html HTML前端代码(请将Nginx指向此目录)
# $WAR_ROOT_PATH/META-INF
# $WAR_ROOT_PATH/WEB-INF Java Classes
#
#
# 线上配置的路径 ONLINE_CONFIG_PATH=/home/work/dsp/disconf-rd/online-resources
# 需要预先设置在环境变量里
if [ "$ONLINE_CONFIG_PATH" = "" ]; then
echo "ONLINE_CONFIG_PATH is null, please set it in your env."
exit 1
fi
#
# WAR要放的路径 WAR_ROOT_PATH=/home/work/dsp/disconf-rd/war
# 需要预先设置在环境变量里
if [ "$WAR_ROOT_PATH" = "" ]; then
echo "ONLINE_CONFIG_PATH is null, please set it in your env."
exit 1
fi
set -e
export PATH
echo "**********************************************"
echo "copy online config " $ONLINE_CONFIG_PATH
echo "**********************************************"
if [ -d "src/main/online-resources" ]; then
printf '%s\n' "Removing src/main/online-resources/*"
rm -rf src/main/online-resources/*
fi
mkdir -p src/main/online-resources
cp -rp "$ONLINE_CONFIG_PATH"/* src/main/online-resources
echo "**********************************************"
echo "It's going to Generate the output for war"
echo "**********************************************"
current_path=`pwd`
#
# 进行WAR打包
#
echo "**********************************************"
echo "It's going to got war package"
echo "**********************************************"
sh deploy/build_java.sh
#
# 进行FE打包
#
echo "**********************************************"
echo "It's going to got fe package"
echo "**********************************************"
cd html
python build.py
#
cd ${current_path}
#
# 清空原始目录
#
mkdir -p ${WAR_ROOT_PATH}
if [ ${#WAR_ROOT_PATH} -gt 15 ]; then
echo "rm " $WAR_ROOT_PATH
rm -rf "$WAR_ROOT_PATH"
mkdir -p ${WAR_ROOT_PATH}
fi
#
#
#
echo "start to copy war"
cp -rp output/disconf-web.war $WAR_ROOT_PATH
#
#
#
echo "start to copy static"
mkdir ${WAR_ROOT_PATH}/html
cp -rp html/output/* $WAR_ROOT_PATH/html
#
#
#
cd ${WAR_ROOT_PATH}
echo "start to jar war"
jar xvf disconf-web.war
cd ${current_path}
echo "deploy done" $WAR_ROOT_PATH
| true
|
fc4c4e07879a0f6637d5b5a8b5d7482130fef208
|
Shell
|
monalto/WPMT9.2
|
/script_wortnutzung.sh
|
UTF-8
| 261
| 3.03125
| 3
|
[] |
no_license
|
#!/bin/bash
# In diesem Script wird ein Wortnutzungsstatistik erstellt
for word in "history" "historical" "praehistorische" "historische"
do
COUNT=$(grep -woi "$word" 2020-05-23-Article_list_dirty.tsv | wc -l| sed 's/^[[:space:]]*//')
echo "$word:$COUNT"
done
| true
|
ec12f663064ac7e00cd1e4086fc9e167ce914e52
|
Shell
|
luis-16/baxter-interface-VP
|
/Codigos/configuracion_python.sh
|
UTF-8
| 676
| 2.515625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#echo "$DIR"
#cd "$DIR"
source /opt/ros/indigo/setup.bash
source ~/ros_ws/devel/setup.sh
#K=$(wmctrl -l | grep Gazebo)
#echo $K + "hola"
PID=$$
#echo $PID
#for word in $K
#do
# echo $word
#done
#read -ra arr <<<"$K"
#F=$(xdotool search --onlyvisible --name Gazebo)
#echo $F
#xdotool windowsize $F 650 716
#xdotool windowmove 123 0 1080
#echo ${arr[0]}
#gst-launch-1.0 ximagesrc xid="${arr[0]}" startx=0 use-damage=0 show-pointer=false ! video/x-raw,framerate=30/1,cursor=TRUE ! ximagesink
#/home/baxter/Documentos/baxter/intento21/Codigos/ffmpeg.sh
python Codigos/scritp_programa.py
#kill $PID
| true
|
14384e4f8b27030d6140db8021d3e426d538cbe0
|
Shell
|
1902february04cloud/grep-JamesWatsonGitHub
|
/PalindromeScript
|
UTF-8
| 218
| 3.5625
| 4
|
[] |
no_license
|
#!/bin/bash
while read X; do
message=$X
length=${#message}
backward=""
for ((i=$length-1; i>=0; i--)); do
backward=$backward${message:$i:1}
done
if [ "${message,,}" == "${backward,,}" ]; then echo $message
fi
done
| true
|
0e3b9a6f3497fe3d9089fe2fc8691dc26c4e3d22
|
Shell
|
cha63506/core-3
|
/gstreamer0.10/PKGBUILD
|
UTF-8
| 1,386
| 2.625
| 3
|
[] |
no_license
|
# maintainer almack@chakraos.org
pkgname=gstreamer0.10
pkgver=0.10.36
pkgrel=11
pkgdesc="GStreamer Multimedia Framework"
arch=('x86_64')
license=('LGPL')
url="http://gstreamer.freedesktop.org/"
depends=('libxml2' 'glib2')
makedepends=('intltool' 'pkgconfig' 'gobject-introspection' 'git')
source=("git://anongit.freedesktop.org/gstreamer-sdk/gstreamer#commit=3ddc31eaa18c3be1613e43430eca78a3e445639e"
tests-remove-silly-test_fail_abstract_new-check.patch
bison3.patch)
sha256sums=('SKIP'
'd3d3f4f04453831fdb4244bfe174a38c4e6f9f4da5c8c9050dcfa1a6097aad52'
'ed154e280abf59b24d98a8ab0fe868b449b26aa61f7ae3813fab8ac615fcaefa')
prepare() {
cd gstreamer
patch -Np1 -i ../tests-remove-silly-test_fail_abstract_new-check.patch
patch -Np1 -i ../bison3.patch
sed -e 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' -i configure.ac
}
build() {
cd gstreamer
NOCONFIGURE=1 ./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib \
--with-package-name="GStreamer (Chakra GNU/Linux)" \
--with-package-origin="http://www.chakraos.org/" \
--disable-static
make
}
check() {
cd gstreamer
make check
}
package() {
cd gstreamer
make DESTDIR="${pkgdir}" install
#Remove unversioned gst-* binaries to get rid of conflicts
cd "${pkgdir}/usr/bin"
for bins in `ls *-0.10`; do
rm -f ${bins/-0.10/}
done
}
| true
|
33753ff683d290d6c117d29c3a5b116b1ff7d2eb
|
Shell
|
manujakau/Packer_Vagrant
|
/bash_scripts/common/install_common_tools.sh
|
UTF-8
| 207
| 3.03125
| 3
|
[] |
no_license
|
if [ -f /etc/redhat-release ]; then
# Figure out this for redhat/CentOS
sudo yum install -y vim man
elif [[ $(lsb_release -i | awk '{print $3}') == "Ubuntu" ]]; then
sudo apt-get install -y vim man
fi
| true
|
3ad39e62a820f40feccffdb368f55d6c4b96c88b
|
Shell
|
WizardFactory/cordova-plugin-todayweather-android-widget
|
/makeSources.sh
|
UTF-8
| 134
| 2.8125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/sh
while read foo
do
src=${foo#*/}
dst=${src#*/}
dst=${dst#*/}
echo "<resource-file src=\"$src\" target=\"$dst\" />"
done
| true
|
545de0a38afe3e420bc306c443d500aa07e44799
|
Shell
|
gaeduron/init
|
/network/03
|
UTF-8
| 152
| 2.859375
| 3
|
[] |
no_license
|
#!/bin/bash
source colors.sh
MAC_ADDRESS=$(ifconfig en0 | grep 'ether .*' | sed /.\*ether\ /s///)
echo "Your MAC address: ${Green}$MAC_ADDRESS${NC}"
| true
|
c7dff9b922a67b3d4ef3faa1fabc3462ab5ce525
|
Shell
|
BlackwaterTechnology/LearningCenter
|
/shell/deploy.ucp.sh
|
UTF-8
| 2,168
| 3.578125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
set -e
echo "此脚本只支持一次执行成功,如果失败请分析脚本内容处理"
sleep 3
read -p "输入rocketchat包所在的主机(默认172.19.6.160):" remoteHost
read -p "输入rocketchat包路径(默认/opt/)" remotePath
read -p "输入rocketchat包文件(默认:sunchat.tar.gz)" remoteFile
read -p "请输入项目名,即部署环境的包名,(列如:rocketchatv1.5):" package
remoteHost="${remoteHost:-172.19.6.160}"
remotePath="${remotePath:-/opt/}"
remoteFile="${remoteFile:-sunchat.tar.gz}"
filePath=${remotePath}${remoteFile}
path="/opt/"
file="sunchat.tar.gz"
package=${package:-rocketchatv1.5}
slaveHost="172.16.40.25"
#echo $remoteHost ${remotePath}${remoteFile}
#exit
if test -e ${filePath}
then
echo "删除本地旧的部署包"
rm -f ${filePath}
fi
echo "开始从测试环境复制部署包"
scp root@${remoteHost}:${filePath} ${path}
if [ $? -eq 0 ]
then
echo "开始解压部署包"
/bin/tar -zxf ${file}
fi
echo "npm安装包依赖。。"
cd bundle/programs/server/ && npm install && cd -
if [ -e ${package} ]
then
echo "按时间结尾打包备份项目文件,后删除项目文件"
tar zcf ${package}.$(date +%Y%m%d%H%m).tar.gz ${package} && rm -rf ${package}
echo "备份完成"
fi
mv bundle ${package}
echo "重启应用。。。"
systemctl restart ${package}
sleep 5
if [ $(ps -ef | grep ${package} | wc -l) -gt 1 ]
then
echo "$HOSTNAME 部署完成。。。"
else
echo "尝试重启。。。"
systemctl restart ${package}
fi
#开始部署其它节点
echo "开始同步部署其它节点,暂时只有25"
slavePackage="${package}.$(date +%Y%m%d%H%m).slave.tar.gz"
echo "打包当前节点已安装依赖的新项目包"
tar zcf ${slavePackage} ${package}
echo "传输包到备节点"
scp ${slavePackage} ${slaveHost}:${path}
ssh ${slaveHost} "cd ${path} && rm -rf ${package}"
ssh ${slaveHost} "cd ${path} && tar zxf ${slavePackage}"
ssh ${slaveHost} "systemctl restart ${package}"
sleep 5
if test $(ssh ${slaveHost} "ps -ef | grep ${package} | wc -l") -gt 1
then
echo "slave 部署完成"
else
echo "尝试重启slave节点"
ssh ${slaveHost} "systemctl restart ${package}"
fi
| true
|
273b63374ec1b9ce6721967c5c24c40b1b195a6a
|
Shell
|
roryashfordbentley/fission-docs
|
/tools/deploy.sh
|
UTF-8
| 3,605
| 3.703125
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
localUrl="http://localhost/xxxxxxxx"
remoteUrl="http://xxxxxxxx.com"
remoteUrlRelative="public_html"
remoteUrlPath="/home/xxxxxx/public_html"
remoteMysqlDb=""
remoteMysqlUser=""
remoteMysqlPass=""
remoteSshUsernameHost=""
remoteSshPort="722"
buildFolder="build"
dbBackupName="db_backup.sql"
#localUrl="http://localhost/trueformdigital"
#remoteUrl="http://staging.codebluedigital.com/trueformdigital"
#remoteUrlRelative="staging/trueformdigital"
#remoteUrlPath="/home/codeblue/staging/trueformdigital"
#remoteMysqlDb="codeblue_trueformdi"
#remoteMysqlUser="codeblue_rory"
#remoteMysqlPass="0987poiu"
remoteSshUsernameHost="codeblue@varuna.uksrv.co.uk"
remoteSshPort="722"
buildFolder="build"
dbBackupName="db_backup.sql"
# Debug colours
red='\033[0;31m'
green='\033[0;32m'
lightGreen='\033[1;32m'
lightBlue='\033[1;34m'
nc='\033[0m' # No Color
# Horizontal Rules
hr="======================================================"
hrThin="------------------------------------------------------"
# Array of remote SSH options
declare -a remoteSshOptions=(
-p $remoteSshPort
$remoteSshUsernameHost
)
# Array of remote SQL options
declare -a remoteSqlOptions=(
-u $remoteMysqlUser
--password=$remoteMysqlPass
$remoteMysqlDb
)
# Array of remote SQL options
declare -a remoteRsyncOptions=(
-az
$(pwd)/$buildFolder/
-e 'ssh -p 722'
$remoteSshUsernameHost:$remoteUrlPath
)
# Prepare Export DB
#
# Depends on WP-CLI being installed and setup in $PATH
# Takes 3 Args -
# (1) Current db
# (2) New db
# (3) Export path
backup_database () {
echo ""
echo "${lightGreen} Replacing [${lightBlue}$1${lightGreen}]"
echo " with [${lightBlue}$2${lightGreen}]${nc}"
echo $hrThin
wp db export --tables=$(wp db tables --all-tables-with-prefix --format=csv)
wp search-replace $1 $2 wptd_* --export=$3
}
# Array of files to ignore
declare -a backupOptions=(
-av
-q
--exclude='.DS_Store'
--exclude='*.md'
--exclude='wp-config-local.php'
--exclude='.git'
--exclude='.gitignore'
--exclude='node_modules/'
--exclude='npm-debug.log'
--exclude=$buildFolder
--exclude='deploy.sh'
)
# Run it!!!!!!!!
echo $hr
echo $lightBlue
echo ' ______ __ '
echo ' / __/ /__ _ __/ /_ ____ ____ ___ _____ '
echo ' / /_/ / _ \| |/_/ __ \/ __ \/ __ \/ _ \/ ___/ '
echo ' / __/ / __/> </ /_/ / /_/ / / / / __(__ ) '
echo '/_/ /_/____/_/|_/_.___/\____/_/ /_/\___/____/ '
echo ' ____/ /__ ____ / /___ __ __ '
echo ' / __ / _ \/ __ \/ / __ \/ / / / '
echo '/ /_/ / __/ /_/ / / /_/ / /_/ / '
echo '\__,_/\___/ .___/_/\____/\__, / '
echo ' /_/ /____/ '
echo $nc
echo $hr
echo "${lightGreen}⚡ Backing up files to [${lightBlue}/$buildFolder${lightGreen}]${nc}"
# backup the files using the backupOptions array
rsync "${backupOptions[@]}" $(pwd)/ $(pwd)/$buildFolder
echo $hrThin
echo "${lightGreen}⚡ Backing up Database to: [${lightBlue}/$buildFolder${lightGreen}]${nc}"
# change the DB paths
backup_database $localUrl $remoteUrl $buildFolder/$dbBackupName
echo "${lightGreen}⚡ Deploying files to server${nc}"
# Rsync the modified files over using array for options
rsync "${remoteRsyncOptions[@]}"
echo $hrThin
echo "${lightGreen}⚡ Migrating DB to: [${lightBlue}$remoteUrl${lightGreen}]${nc}"
# Update the database
ssh ${remoteSshOptions[@]} "mysql -u $remoteMysqlUser --password=$remoteMysqlPass $remoteMysqlDb < $remoteUrlRelative/$dbBackupName"
echo $hrThin
| true
|
5024416c70b5eb789a551dddccf9181473276437
|
Shell
|
yekai1003/go-example
|
/scripts/dockerfile.sh
|
UTF-8
| 863
| 4.03125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -e
#生成dockerfile
gen(){
#程序名称
pname="$1_$2"
#模板
filename=./deployments/bin/"$pname"
#判断bin是否存在
if [ ! -d deployments/bin/"$pname" ];then
mkdir deployments/bin/"$pname"
fi
cat>$filename/Dockerfile<<EOF
FROM alpine:3.2
RUN set -xe && apk add --no-cache tzdata && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ADD $pname /$pname
RUN chmod +x /$pname
ENTRYPOINT [ "/$pname" ]
EOF
echo "生成dockerfile$pname"
}
#全部生成dockerfile
allgen() {
gen api common
gen srv user
gen srv account
gen srv auth
}
#判断如何build
case $1 in
alldf) echo "全部生成dockerfile"
allgen
;;
df) echo "生成dockerfile:"$2,$3
if [ -z $2 -o -z $3 ];then
echo "参数错误"
exit 2
fi
gen $2 $3
;;
*)
echo "生成dockerfile error"
exit 2
;;
esac
| true
|
06d5ca4077107e18b65fe60213e13febab2db2cc
|
Shell
|
spiedeman/vim-config
|
/themes/install.sh
|
UTF-8
| 1,215
| 2.734375
| 3
|
[] |
no_license
|
#!/bin/bash
# echo "xiaomei1102" | sudo -S add-apt-repository ppa:snwh/pulp -y
sudo add-apt-repository ppa:snwh/pulp
sudo apt update
sudo apt install paper-gtk-theme -y
sudo apt install paper-icon-theme -y
echo "<<< INSTALL arc-theme"
if ! [ -d ~/tmp ]; then
mkdir ~/tmp
fi
cd ~/tmp
sudo apt install libgtk-3-dev autoconf -y
git clone https://github.com/horst3180/arc-theme --depth 1
cd arc-theme
./autogen.sh --prefix=/usr
sudo make install
cd .. && rm -rf arc-theme
echo "TO UNINSTALL arc-theme..."
echo "Type: "
echo " sudo rm -rf /usr/share/{Arc,Arc-Darker,Arc-Dark}"
echo "UNINSTALL COMPLETE..."
echo "<<< INSTALL numix-gtk-theme"
sudo add-apt-repository ppa:numix/ppa
sudo apt update
sudo apt install numix-gtk-theme numix-icon-theme-circle -y
# install compiz
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo ">>> compiz_ubuntu16.04_3d.profile"
echo ">>> is the config file for compiz."
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>"
sudo apt install unity-tweak-tool -y
sudo apt install compizconfig-settings-manager compiz-plugins -y
# Bing Wallpaper
[ -d ~/.config/autostart ] || mkdir ~/.config/autostart
sudo add-apt-repository ppa:whizzzkid/bingwallpaper
sudo apt update
sudo apt install bingwallpaper
| true
|
cfdf9ec24209e6840ebc59dfe1336bf966b80127
|
Shell
|
ianjdarrow/license_script
|
/change.sh
|
UTF-8
| 612
| 3.296875
| 3
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
REPO="$1"
NOW=`date +%Y-%m-%d`
BRANCH="LICENSE-CHANGE-$NOW"
URL="git@github.com:filecoin-project/$REPO.git"
echo "Cloning $URL"
git clone "$URL" .
git checkout -b "$BRANCH"
ls | grep -i license | xargs rm -v
CPY="$HOME/Code/license_script/COPYRIGHT"
MIT="$HOME/Code/license_script/LICENSE-MIT"
APA="$HOME/Code/license_script/LICENSE-APACHE"
cp $CPY $MIT $APA .
git add -u
git add COPYRIGHT LICENSE-MIT LICENSE-APACHE
git commit -m "Update license to MIT/Apache-2"
git push origin HEAD
hub pull-request -m "Update license to MIT/Apache-2"
cd .. && rm -rf changes/ && mkdir changes && cd changes
| true
|
e2e6a40edea9ee30d01e81a13ab89754c4436bdc
|
Shell
|
mo-ai/ai-dev-platform
|
/config/setup.sh
|
UTF-8
| 1,587
| 4.21875
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
set -e
os=
function setupCentosRepos() {
echo "Setup Centos Repositoris ..."
sudo mkdir /etc/repos.d.bak
sudo mv /etc/repos.d/* /etc/repos.d.bak
sudo cp centos/etc/repos.d/nexus.repo /etc/repos.d
}
function setupDocker(){
echo "Setup Docker ..."
sudo groupadd docker || sudo gpasswd -a ${USER} docker || sudo systemctl restart docker
! sudo test -e /etc/docker && sudo mkdir /etc/docker
sudo cp common/etc/docker/daemon.json /etc/docker
}
function setupCentosPki(){
echo "Setup Centos Pki ..."
sudo cp centos/etc/pki/rpm-gpg/* /etc/pki/rpm-gpg
}
function setupUbuntuSource(){
echo "Setup Ubuntu Sources ..."
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp $os/etc/apt/sources.list /etc/apt
}
function setupUbuntuGPG(){
echo "Setup Ubuntu gpg ..."
for gpg in `ls ubuntu/gpg`
do
sudo apt-key add ubuntu/gpg/$gpg
done
}
function isCentos(){
test -e /etc/redhat-release
}
function isUbuntu(){
uname -a | grep ubuntu > /dev/null
}
function checkOS(){
echo "Check OS ..."
if isCentos; then
os=centos
return
fi
if isUbuntu; then
os=ubuntu
return
fi
}
function run_on_centos(){
setupCentosRepos
setupDocker
setupCentosPki
}
function run_on_ubuntu(){
setupUbuntuSource
setupDocker
setupUbuntuGPG
}
function run(){
checkOS
if [ "$os" = "" ]; then
echo "Not supported on this OS!"
exit 1
fi
run_on_$os
echo "The setup is completed."
}
run
| true
|
7365187c2bb50499bee4cf6f5a1e44e8a140713b
|
Shell
|
rdnux59/microlinux
|
/desktop-kde-14.1-source/kde-workspace/kde-workspace.SlackBuild
|
UTF-8
| 7,263
| 3.421875
| 3
|
[] |
no_license
|
#!/bin/sh
# Slackware build script for kde-workspace
# Written by Niki Kovacs <info@microlinux.fr>
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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.
PRGNAM=kde-workspace
VERSION=${VERSION:-4.10.5}
BUILD=${BUILD:-3}
TAG=${TAG:-_microlinux}
NUMJOBS=${NUMJOBS:--j5}
# Automatically determine the architecture we're building on:
MARCH=$( uname -m )
if [ -z "$ARCH" ]; then
case "$MARCH" in
i?86) export ARCH=i486 ;;
armv7hl) export ARCH=$MARCH ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$MARCH ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/microlinux}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
# Use this as CFLAGS and CXXFLAGS:
if [ -z "$SLKCFLAGS" ]; then
if [ "$ARCH" = "i486" ]; then
export SLKCFLAGS="-O2 -march=i486 -mtune=i686"
export LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
export SLKCFLAGS="-O2"
export LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
export SLKCFLAGS="-O2 -fPIC"
export LIBDIRSUFFIX="64"
elif [ "$ARCH" = "arm" ]; then
export SLKCFLAGS="-O2 -march=armv4 -mtune=xscale"
export LIBDIRSUFFIX=""
elif [ "$ARCH" = "armel" ]; then
export SLKCFLAGS="-O2 -march=armv4t"
export LIBDIRSUFFIX=""
elif [ "$ARCH" = "armv7hl" ]; then
export SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
export LIBDIRSUFFIX=""
else
export SLKCFLAGS="-O2"
export LIBDIRSUFFIX=""
fi
fi
set -e
if [ ! -r $PRGNAM-$VERSION.tar.xz ] ; then
wget -c http://download.kde.org/stable/$VERSION/src/$PRGNAM-$VERSION.tar.xz
fi
md5sum -c $PRGNAM-$VERSION.tar.xz.md5
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz || exit 1
cd $PRGNAM-$VERSION || exit 1
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Increase the timeout to accomodate slow-to-initialize video chipset drivers:
zcat $CWD/patches/kde-workspace.kdm.server.timeout.diff.gz | patch -p1 --verbose || { touch ${SLACK_KDE_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
# Always show 'remaining time' in the popup of the battery plasmoid:
zcat $CWD/patches/kde-workspace.batteryapplet.diff.gz | patch -p1 --verbose || { touch ${SLACK_KDE_BUILD_DIR}/${PKGNAME}.failed ; continue ; }
# KDE options
export KDE_OPT_ARGS=" -DKDE4_BUILD_TESTS=OFF -DSITE=\"microlinux.fr\" "
# Avoid a version number in .la files:
if [ -d /usr/lib${LIBDIRSUFFIX}/qt ]; then
QTDIR=/usr/lib${LIBDIRSUFFIX}/qt
fi
mkdir build
cd build
cmake \
$KDE_OPT_ARGS \
-DKDE_PLATFORM_FEATURE_DISABLE_DEPRECATED=TRUE \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_C_FLAGS_RELEASE:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="$SLKCFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DMAN_INSTALL_DIR=/usr/man \
-DSYSCONF_INSTALL_DIR=/etc/kde \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
..
make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1
cd -
# We don't need the activities launcher in the panel
mv $PKG/usr/share/apps/plasma-desktop/updates/addShowActivitiesManagerPlasmoid.js \
$PKG/usr/share/apps/plasma-desktop/updates/addShowActivitiesManagerPlasmoid.js.deactivated
# Our own custom profile
cat $CWD/00-defaultLayout.js > \
$PKG/usr/share/apps/plasma-desktop/init/00-defaultLayout.js
cat $CWD/layout.js > \
$PKG/usr/share/apps/plasma/layout-templates/org.kde.plasma-desktop.defaultPanel/contents/layout.js
# Use ck-launch-session in runlevel 3,
# to start and attach a ConsoleKit session to the X session:
mkdir -p $PKG/etc/X11/xinit
cat $CWD/xinit/xinitrc.kde > $PKG/etc/X11/xinit/xinitrc.kde
chmod 0755 $PKG/etc/X11/xinit/xinitrc.kde
# Setup config files for KDM:
$PKG/usr/bin/genkdmconf --no-old --no-old-scripts --no-backup --in $PKG/usr/share/config/kdm
# Add Slackware's standard xsessions path to kdmrc and remove the redundant
# xsession files for XFCE (those are installed by the xcfe package):
if ! grep -q "SessionsDirs=/usr/share/xsessions" $PKG/usr/share/config/kdm/kdmrc ; then
sed -i -e "/SessionsDirs=/s#SessionsDirs=\(.*\)\$#SessionsDirs=/usr/share/xsessions,\1#" $PKG/usr/share/config/kdm/kdmrc
fi
rm $PKG/usr/share/apps/kdm/sessions/xfce*.desktop
# Not allowing root to login at the console is just plain silly. If they
# have physical access to the machine, what's the point of trying to stop
# this? Even the kdmrc file says this is supposed to be the default.
sed -i 's/AllowRootLogin=false/AllowRootLogin=true/' \
$PKG/usr/share/config/kdm/kdmrc
# We are also not ready to create a separate 'kdm' non-root user:
sed -i 's/GreeterUID=kdm/#&/' \
$PKG/usr/share/config/kdm/kdmrc
# Add a .new suffix so we don't mangle an existing file:
mv $PKG/usr/share/config/kdm/kdmrc $PKG/usr/share/config/kdm/kdmrc.new
cp -a $PKG/usr/share/config/kdm/Xsession $PKG/usr/share/config/kdm/Xsession.orig
cat $CWD/config/Xsession | sed -e "s#/lib#/lib${LIBDIRSUFFIX}#" \
> $PKG/usr/share/config/kdm/Xsession
# Add a .new suffix so we don't mangle an existing file:
mv $PKG/usr/share/config/kdm/backgroundrc $PKG/usr/share/config/kdm/backgroundrc.new
# Move the KDM files someplace FHS compliant:
mkdir -p $PKG/etc/kde
mv $PKG/usr/share/config/kdm $PKG/etc/kde
( cd $PKG/usr/share/config ; ln -sf ../../../etc/kde/kdm . )
# Move the polkit dbus configuration files to the proper place:
mv $PKG/etc/kde/dbus-1 $PKG/etc/
# This is fubar:
rm -f $PKG/usr/share/icons/hicolor/index.theme
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING* README* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
# Cleanup
cd $TMP
rm -rf $PRGNAM-$VERSION $PKG
| true
|
f4cfbe430e7bea602cbe011dee15fb1773681385
|
Shell
|
marstool/qwp201906
|
/docs/20190531_wqyxf3uampw.info_dir/20190531_wqYXF3UaMPw.info.json.sh2
|
UTF-8
| 2,410
| 2.78125
| 3
|
[] |
no_license
|
#!/bin/bash
rm -f \
20190531_wqYXF3UaMPw.info.json.vo.* \
20190531_wqYXF3UaMPw.info.json.ao.* \
20190531_wqYXF3UaMPw.info.json.bo.* \
20190531_wqYXF3UaMPw.info.json.wav
rm -fr 20190531_wqYXF3UaMPw.info_dir
mkdir -p 20190531_wqYXF3UaMPw.info_dir
mv 20190531_wqYXF3UaMPw.info.json 20190531_wqYXF3UaMPw.info.json.* 20190531_wqYXF3UaMPw.info_dir/
mv 20190531_wqYXF3UaMPw.info_dir/20190531_wqYXF3UaMPw.info.json.jpg 20190531_wqYXF3UaMPw.info_dir/20190531_wqYXF3UaMPw.info.json.webm.mp4.jpg
cat > 20190531_wqYXF3UaMPw.info_dir/_index.md << EOF3
+++
title = " 20190531_wqYXF3UaMPw 平论HOT | 警告⚠️中国多家农商行、城商行可能宣告破产!2019-05-31 "
description = " #重磅 #重磅 #重磅__一监管部门人士表示,当前有些农商行、城商行面临着严重的信用风险,处于技术性破产的边缘,这类机构要稳妥有序的按照市场化原则清理退出市场。(券商中国)__#中国危机路线图_#中国危机大逃亡__债务危机-金融危机-经济危机-经济萧条-社会危机-政治危机-难民危机 "
weight = 20
+++
{{< mymp4 mp4="20190531_wqYXF3UaMPw.info.json.webm.mp4"
text="len $(cat 20190531_wqYXF3UaMPw.info_dir/20190531_wqYXF3UaMPw.info.json.webm.mp4|wc -c)"
>}}
{{< mymp4x mp4x="20190531_wqYXF3UaMPw.info.json.25k.mp4"
text="len $(cat 20190531_wqYXF3UaMPw.info_dir/20190531_wqYXF3UaMPw.info.json.25k.mp4|wc -c)"
>}}
{{< mydiv text="#重磅 #重磅 #重磅__一监管部门人士表示,当前有些农商行、城商行面临着严重的信用风险,处于技术性破产的边缘,这类机构要稳妥有序的按照市场化原则清理退出市场。(券商中国)__#中国危机路线图_#中国危机大逃亡__债务危机-金融危机-经济危机-经济萧条-社会危机-政治危机-难民危机" >}}
<br>
{{< mydiv text="https://www.youtube.com/watch?v=wqYXF3UaMPw" >}}
<br>
请大家传播时,不需要传播文件本身,<br>
原因是:一旦传播过大东西(例如,图片,文件),<br>
就会触发检查机制。<br>
我不知道检查机制的触发条件。<br>
但是我知道,不会说你传一个没有敏感词的网络地址都检查,<br>
否则,检查员得累死。<br><br>
直接转发网址就可以了:<br>
原因是,这是程序员网站,<br>
共匪不敢封锁,墙内可以直接下载。
EOF3
| true
|
aa8e380fbaa592e000333553828565b8a9bc988d
|
Shell
|
lethosor/build-env
|
/msvc/dfhack-test
|
UTF-8
| 418
| 3.9375
| 4
|
[
"Unlicense"
] |
permissive
|
#!/bin/bash -e
usage()
{
echo 'Usage: dfhack-test [os] [bits] [command]' >&2
echo 'os: windows' >&2
echo 'bits: 32 or 64' >&2
echo 'command: DFHack command to use as the test runner; for example, test/main' >&2
echo '(run inside the DF folder)' >&2
}
if [[ $# -ne 3 ]]; then
usage
exit 1
fi
os=$1
bits=$2
script=$3
shift 3
echo '[temporary] Skipping tests for all platforms other than 64-bit Linux.'
exit 0
| true
|
194bf5ee940e7e5b583a67661707599df3771382
|
Shell
|
pghalliday/gitify-svn
|
/end-to-end-test.sh
|
UTF-8
| 1,041
| 3.828125
| 4
|
[] |
no_license
|
#!/bin/bash
set -e
DIR="$(dirname "$(readlink -f "$0")")"
cd $DIR/end-to-end
. git-repos.sh
. svn-repos.sh
# init Git repositories
for repo in "${GIT_REPOS[@]}"; do
echo y | sudo gitify-git-delete $repo
sudo gitify-git-create $repo
done
# init SVN repositories
for repo in "${SVN_REPOS[@]}"; do
echo y | sudo gitify-svn-delete $repo
sudo gitify-svn-load $repo saved/$repo.dump
done
# replay the progress starting with the
# first SVN repo in the list
rm -rf working
mkdir working
if [ -e saved/prompts.json ]; then
cp saved/prompts.json working/
fi
../bin/index.js -l debug -q -u admin -p password -r http://localhost/svn/${SVN_REPOS[0]} working
# check the Git repository checksums
EXITCODE=0
for repo in "${GIT_REPOS[@]}"; do
echo "Testing checksum for Git repo $repo"
EXPECTED=$(cat saved/$repo.checksum)
echo "EXPECTED: $EXPECTED"
ACTUAL=$(gitify-git-checksum $repo)
echo "ACTUAL: $ACTUAL"
if [ "$EXPECTED" == "$ACTUAL" ]; then
echo "PASS"
else
echo "FAIL"
EXITCODE=1
fi
done
exit $EXITCODE
| true
|
61a83c19ac2c8481684dd026650de9a07d944fac
|
Shell
|
Juici/dotfiles
|
/zsh/.zsh/prompt.zsh
|
UTF-8
| 11,185
| 3.359375
| 3
|
[] |
no_license
|
# Setup {{{
# Substitute colours in prompt.
setopt prompt_subst
# Load colors module.
autoload -Uz colors
colors
# http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' stagedstr '1' # Boolean value.
zstyle ':vcs_info:*' unstagedstr '1' # Boolean value.
zstyle ':vcs_info:*' use-simple true
zstyle ':vcs_info:*' max-exports 8
# Hook debug info.
zstyle ':vcs_info:*+*:*' debug false
# VCS format strings.
#
# %R - top repo directory
# %b - branch
# %i - revision
# %m - misc
# %c - has staged
# %u - has unstaged
# 0 - has untracked
# %a - action
#
# By default vcs_info doesn't support untracked files, so we pretend that there
# are none and we will override it with a hook.
zstyle ':vcs_info:*:*' formats '%R' '%b' '%i' '%m' '%c' '%u' '0'
zstyle ':vcs_info:*:*' actionformats '%R' '%b' '%i' '%m' '%c' '%u' '0' '%a'
zstyle ':vcs_info:git+set-message:*' hooks git-untracked
+vi-git-untracked() {
emulate -L zsh
setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
integer n=$1
# `vcs_info_msg_6_` carries the 'has untracked' state, it defaults to `0`.
if (( n == 6 )); then
# Untracked files are marked by lines starting '??', so we filter on
# those lines.
local -a untracked
untracked=( ${(@M)${(@f)"$(git status --porcelain --no-ahead-behind --no-renames --ignore-submodules=all --untracked-files=all 2>/dev/null)"}##'??'*} )
# If there are untracked files update the message.
if (( ${#untracked} > 0 )); then
# Override the message.
hook_com[message]='1'
# Set `ret` to non-zero so that our message is used.
ret=1
fi
fi
}
# }}}
# Prompt {{{
typeset -gA Prompt
# Anonymous function to avoid leaking variables.
() {
emulate -L zsh
setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
# Left Prompt.
# Set the prompt suffix character.
local suffix_char
case "$TERM" in
linux|tmux)
suffix_char='>'
;;
*)
suffix_char='\u276f'
;;
esac
integer lvl
# Check for tmux by looking at $TERM, because $TMUX won't be propagated to any
# nested sudo shells but $TERM will.
if [[ "$TERM" = *tmux* ]] || [[ -n "$TMUX" ]]; then
# In a a tmux session created in a non-root or root shell.
lvl=$(( SHLVL - 1 ))
else
# Either in a root shell created inside a non-root tmux session,
# or not in a tmux session.
lvl=$SHLVL
fi
# Repeat the suffix character to represent shell level.
local suffix_chars=$(printf "${suffix_char}%.0s" {1..$lvl})
# Suffix with extra information for root.
#
# Displays in bold yellow with username for privileged shells.
# Displays in bold red for regular shells.
#
# '%(!.true.false)' - tennary expression on if the shell is running with
# privileges.
local suffix="%B%(!.%F{yellow}%n.%F{red})${suffix_chars}%f%b"
# Prompt expansion:
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
# Login info, displayed when in an SSH session.
#
# Display 'user@host' in green and ':' in bold.
#
# '%n' - username
# '%m' - hostname up to first .
local ssh_info='%F{green}%n@%m%f%B:%b'
# Current working directory info.
#
# Display name of current working directory in bold blue.
#
# '%1~' - last part of current path, ie. the directory name
local wd='%F{blue}%B%1~%b%f'
# Running jobs and exit status.
#
# Display if there are running jobs and if the exit status of the last
# command was non-zero.
#
# '%(1j.*.)' - '*' if the numer of running jobs is at least 1
# '%(?..!)' - '!' if the exit status is not 0
#
# Conditional substrings:
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Conditional-Substrings-in-Prompts
local status_info='%F{yellow}%B%(1j.*.)%(?..!)%b%f'
# Export PROMPT.
export PROMPT="${SSH_TTY:+${ssh_info}}${wd}${status_info} ${suffix} "
# Right Prompt
# Space before full_path, if vcs_info or cmd_elapsed present.
local path_space='${${Prompt[vcs_info]:-${Prompt[cmd_elapsed]:-}}:+ }'
# Space before vcs_info, if cmd_elapsed present.
local vcs_space='${${Prompt[cmd_elapsed]:-}:+ }'
# The full path, displayed in the right prompt.
#
# Not displayed if terminal width is less than 80 columns.
# Trimmed from left side to fit within a quarter of the terminal width.
#
# Adds a space before if VCS info is displayed.
local full_path="%-80(l.${path_space}%F{blue}%\$(( COLUMNS / 4 ))<...<%~%<<%f.)"
# VCS branch info, set by async precmd callback.
local vcs_info="\${Prompt[vcs_info]:+${vcs_space}}\${Prompt[vcs_info]}"
local italic_on='' italic_off=''
if (( ${+terminfo[sitm]} && ${+terminfo[ritm]} )); then
italic_on="%{${terminfo[sitm]}%}"
italic_off="%{${terminfo[ritm]}%}"
fi
# Time taken for previous command.
local elapsed_time="%F{cyan}${italic_on}\${Prompt[cmd_elapsed]}${italic_off}%f"
export RPROMPT="${elapsed_time}${vcs_info}${full_path}"
export ZLE_RPROMPT_INDENT=0
}
export SPROMPT="zsh: correct %F{red}'%R'%f to %F{red}'%r'%f [%B%Uy%u%bes, %B%Un%u%bo, %B%Ue%u%bdit, %B%Ua%u%bbort]? "
# }}}
# Hooks {{{
autoload -Uz add-zsh-hook
→prompt_preexec() {
# Record start time of command.
.prompt_record_start_time
}
add-zsh-hook preexec →prompt_preexec
→prompt_precmd() {
# Perform long tasks async to prevent blocking.
.prompt_async_tasks
# Report the execution time of previous command.
.prompt_report_start_time
}
add-zsh-hook precmd →prompt_precmd
# }}}
# Functions {{{
# Timer {{{
typeset -gF EPOCHREALTIME
.prompt_record_start_time() {
emulate -L zsh
setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
# Set command start time.
Prompt[cmd_elapsed]=
Prompt[cmd_start]=$EPOCHREALTIME
}
.prompt_report_start_time() {
emulate -L zsh
setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
# If command start time was set, calculate elapsed time.
if [[ -n "${Prompt[cmd_start]}" ]]; then
local -F delta secs
local -i 10 days hours mins
((
delta = EPOCHREALTIME - Prompt[cmd_start],
secs = delta % 60,
delta /= 60,
mins = delta % 60,
delta /= 60,
hours = delta % 24,
days = delta / 24
))
# Construct time elapsed string.
local elapsed=
(( days > 0 )) && elapsed="${days}d"
(( hours > 0 )) && elapsed="${elapsed}${hours}h"
(( mins > 0 )) && elapsed="${elapsed}${days}m"
if [[ -z "$elapsed" ]]; then
elapsed="$(printf '%.2f' $secs)s"
elif (( days == 0 )); then
elapsed="${elapsed}$(( secs | 0 ))s"
fi
Prompt[cmd_start]=
Prompt[cmd_elapsed]=$elapsed
else
Prompt[cmd_elapsed]=
fi
}
# }}}
# VCS {{{
.prompt_async_tasks() {
emulate -L zsh
setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd
# Note: exec doesn't accept variables in the form of associative arrays, so
# we have to go through a intermediate variable 'async_fd'.
local -i 10 async_fd
# If there is a pending task cancel it.
if [[ -n ${Prompt[async_fd]} ]] && { true <&${Prompt[async_fd]} } 2>/dev/null; then
# Close the file descriptor.
async_fd=${Prompt[async_fd]}
exec {async_fd}<&-
# Remove the handler.
zle -F $async_fd
fi
# Probably no longer within the VCS tree.
if [[ -n ${Prompt[vcs_root]} ]] && [[ "$PWD" != "${Prompt[vcs_root]}"* ]]; then
Prompt[vcs_root]=
Prompt[vcs_info]=
fi
# Fork a process to fetch VCS info and open a pipe to read from it.
exec {async_fd}< <(
# Check the path is an existing directory, it may have been removed.
[[ -d $PWD ]] || return 1
# Fetch VCS info.
vcs_info >&2
local -A info
info[root]=$vcs_info_msg_0_
info[branch]=$vcs_info_msg_1_
info[revision]=$vcs_info_msg_2_
info[action]=$vcs_info_msg_7_
info[misc]=$vcs_info_msg_3_
((
info[staged] = vcs_info_msg_4_,
info[unstaged] = vcs_info_msg_5_,
info[untracked] = vcs_info_msg_6_
))
info[pwd]=$PWD
builtin print -r -- "${(@kvq)info}"
)
Prompt[async_fd]=$async_fd
# When the file descriptor is readable, run the callback handler.
zle -F $async_fd →prompt_async_callback
}
→prompt_async_callback() {
emulate -L zsh
setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd no_prompt_vars
local -i 10 async_fd=$1
# Sanity check for the callback.
if [[ -z ${Prompt[async_fd]} ]] || (( async_fd != Prompt[async_fd] )); then
# If in ZLE move to first column and clear line. The prompt will be
# reset when the callback chain finishes.
#
# This prevents the message from getting garbled.
zle && print -n "${terminfo[cr]}${terminfo[el]}"
print -Pru2 '%F{red}prompt%f: handler callback for wrong fd'
return 1
fi
# Read from file descriptor.
local read_in="$(<&$async_fd)"
# Remove the handler and close the file descriptor.
Prompt[async_fd]=''
zle -F $async_fd
exec {async_fd}<&-
# Check if data read from file descriptor was empty, if so abort.
[[ -z "$read_in" ]] && return
local -A info
# Parse output (z) and unquote as array (Q@).
info=( "${(Q@)${(z)read_in}}" )
# Check if the path has changed since the job started, if so abort.
[[ "${info[pwd]}" != "$PWD" ]] && return
Prompt[vcs_root]=${info[root]}
Prompt[vcs_pwd]=${info[pwd]}
if [[ -n ${info[root]} ]]; then
local branch=${info[branch]} action= misc= staged= unstaged= untracked=
# Use branch, tag, or revision.
if (( $#branch > 32 )); then
# Trim long branch names.
branch="${branch:0:12}...${branch:0-12}"
elif [[ -z $branch ]]; then
branch=${info[revision]:0:9}
fi
[[ -n ${info[action]} ]] && action="|${info[action]}"
#[[ -n ${info[misc]} ]] && misc="(${info[misc]})"
(( info[staged] )) && staged="%F{green}●%f"
(( info[unstaged] )) && unstaged="%F{red}●%f"
(( info[untracked] )) && untracked="%F{blue}●%f"
Prompt[vcs_info]="[${branch}${action}${misc}${staged}${unstaged}${untracked}]"
else
Prompt[vcs_info]=
fi
setopt prompt_vars
zle && zle reset-prompt
}
# }}}
# }}}
| true
|
38e981dac233d50723f2c5f49c25f793a1cd52a8
|
Shell
|
MASILab/thorax_non_rigid_toolbox
|
/tools/functions_corrField_non_rigid_2_low_res.sh
|
UTF-8
| 8,735
| 2.71875
| 3
|
[] |
no_license
|
run_process_one_scan () {
local scan_name="$1"
local scan_name_no_ext="${scan_name%.*}"
local MOVING_IMG=${MOVING_FOLDER}/${scan_name}
local REF_MASK_IMG=${REFERENCE_FOLDER}/valid_region_mask.nii.gz
local scan_root_folder=${OUTPUT_ROOT_FOLDER}/${scan_name_no_ext}
set -o xtrace
mkdir -p ${scan_root_folder}
set +o xtrace
local OUTPUT_LOW_RES_FOLDER=${scan_root_folder}/output_low_res
local OUTPUT_LOW_RES_2_FOLDER=${scan_root_folder}/output_low_res2
local OUTPUT_JAC_FOLDER=${scan_root_folder}/jac
set -o xtrace
mkdir -p ${OUTPUT_LOW_RES_FOLDER}
mkdir -p ${OUTPUT_LOW_RES_2_FOLDER}
mkdir -p ${OUTPUT_JAC_FOLDER}
set +o xtrace
run_registration_pipeline () {
# 1. Run low resolution
run_low_res_1 () {
set -o xtrace
${C3D_ROOT}/c3d -int 0 \
${REF_MASK_IMG} -resample-mm 2x2x2mm \
-o ${OUTPUT_LOW_RES_FOLDER}/mask.nii.gz
${NIFYREG_ROOT}/reg_resample -inter 3 -pad NaN \
-ref ${OUTPUT_LOW_RES_FOLDER}/mask.nii.gz \
-flo ${MOVING_IMG} \
-trans ${IDENTITY_MAT} \
-res ${OUTPUT_LOW_RES_FOLDER}/moving.nii.gz
set +o xtrace
run_registration_pipeline_res ${OUTPUT_LOW_RES_FOLDER} "${corrField_config_step1}" "${effective_etch_step1}"
}
# 2. Run with updated mask still with low resolution.
run_low_res_2 () {
set -o xtrace
ln -sf ${OUTPUT_LOW_RES_FOLDER}/mask.nii.gz ${OUTPUT_LOW_RES_2_FOLDER}/mask.nii.gz
ln -sf ${OUTPUT_LOW_RES_FOLDER}/output/warp.nii.gz ${OUTPUT_LOW_RES_2_FOLDER}/moving.nii.gz
set +o xtrace
run_registration_pipeline_res ${OUTPUT_LOW_RES_2_FOLDER} "${corrField_config_step2}" "${effective_etch_step2}"
}
run_combined_jacobian_analysis () {
set -o xtrace
${NIFYREG_ROOT}/reg_transform \
-comp \
${OUTPUT_LOW_RES_FOLDER}/output/trans.nii.gz \
${OUTPUT_LOW_RES_2_FOLDER}/output/trans.nii.gz \
${OUTPUT_JAC_FOLDER}/trans_combine.nii.gz
${NIFYREG_ROOT}/reg_jacobian \
-trans ${OUTPUT_JAC_FOLDER}/trans_combine.nii.gz \
-ref ${REF_MASK_IMG} \
-jac ${OUTPUT_JAC_FOLDER}/jac.nii.gz
${C3D_ROOT}/c3d \
${OUTPUT_JAC_FOLDER}/jac.nii.gz \
-threshold -inf 0 1 0 -o ${OUTPUT_JAC_FOLDER}/neg_jac_map.nii.gz
${C3D_ROOT}/c3d \
-verbose \
${OUTPUT_JAC_FOLDER}/neg_jac_map.nii.gz \
${OUTPUT_LOW_RES_2_FOLDER}/output/effective_mask.nii.gz \
-overlap 1
set +o xtrace
set -o xtrace
cp ${OUTPUT_JAC_FOLDER}/jac.nii.gz \
${OUTPUT_JAC_DET_FOLDER}/${scan_name}
set +o xtrace
}
run_low_res_1
run_low_res_2
run_combined_jacobian_analysis
mkdir -p ${OUTPUT_INTERP_FOLDER}/ori
set -o xtrace
cp ${OUTPUT_LOW_RES_2_FOLDER}/output/warp.nii.gz ${OUTPUT_INTERP_FOLDER}/ori/${scan_name}
set +o xtrace
}
run_registration_pipeline_res () {
local root_folder=$1
local corrField_opt="$2"
local hw="$3"
local mask=${root_folder}/mask.nii.gz
local preprocess_folder=${root_folder}/preprocess
local output_folder=${root_folder}/output
mkdir -p ${preprocess_folder}
mkdir -p ${output_folder}
local fixed=${root_folder}/fixed.nii.gz
echo ""
echo "Create resampled fixed"
set -o xtrace
${NIFYREG_ROOT}/reg_resample -inter 3 -pad NaN \
-ref ${mask} \
-flo ${FIXED_IMG} \
-trans ${IDENTITY_MAT} \
-res ${fixed}
set +o xtrace
run_preprocessing () {
local scan_flag=$1
local in_scan=${root_folder}/${scan_flag}.nii.gz
local out_valid_region_mask=${preprocess_folder}/${scan_flag}_valid_region.nii.gz
local out_signed_distance=${preprocess_folder}/${scan_flag}_edt.nii.gz
set -o xtrace
${PYTHON_ENV} ${SRC_ROOT}/tools/get_non_nan_region.py \
--ori ${in_scan} \
--out-mask ${out_valid_region_mask}
${PYTHON_ENV} ${SRC_ROOT}/tools/get_distance_field.py \
--mask ${out_valid_region_mask} \
--out-edt ${out_signed_distance}
${PYTHON_ENV} ${SRC_ROOT}/tools/replace_nan.py \
--val -1000 \
--in_image ${in_scan} \
--out_image ${preprocess_folder}/${scan_flag}_no_nan.nii.gz
set +o xtrace
}
echo ""
echo "Run preprocessing"
run_preprocessing "moving"
run_preprocessing "fixed"
get_effective_region () {
local in_edt_map=$1
local distance="$2"
local out_effective_region_mask=$3
set -o xtrace
${C3D_ROOT}/c3d ${in_edt_map} -threshold ${distance} inf 1 0 -o ${out_effective_region_mask}
set +o xtrace
}
run_corrField_registration () {
local hw_moving="${hw}"
local hw_fixed="6"
local edt_moving=${preprocess_folder}/moving_edt.nii.gz
local edt_fixed=${preprocess_folder}/fixed_edt.nii.gz
local effective_moving=${output_folder}/moving_mask_effective.nii.gz
local effective_fixed=${output_folder}/fixed_mask_effective.nii.gz
local bounary_mask=${output_folder}/boundary_mask.nii.gz
get_effective_region ${edt_moving} ${hw_moving} ${effective_moving}
get_effective_region ${edt_fixed} ${hw_fixed} ${effective_fixed}
echo ""
echo "1. Get the effective region mask."
local effective_mask=${output_folder}/effective_mask.nii.gz
set -o xtrace
${PYTHON_ENV} ${SRC_ROOT}/tools/get_boundary_mask.py \
--ref ${mask} \
--dist ${hw_moving} \
--out-mask ${bounary_mask}
${C3D_ROOT}/c3d ${mask} ${effective_moving} ${effective_fixed} ${bounary_mask}\
-multiply -multiply -multiply -o ${effective_mask}
set +o xtrace
echo ""
echo "2. Registration using the effective region mask."
set -o xtrace
${corrField_ROOT}/corrField ${corrField_opt} \
-F ${preprocess_folder}/fixed_no_nan.nii.gz \
-M ${preprocess_folder}/moving_no_nan.nii.gz \
-m ${effective_mask} \
-O ${output_folder}/warp.dat
${corrField_ROOT}/convertWarpNiftyreg \
-R ${mask} \
-O ${output_folder}/warp.dat \
-T ${output_folder}/trans.nii.gz
${NIFYREG_ROOT}/reg_resample \
-inter 3 -pad NaN \
-ref ${mask} \
-flo ${root_folder}/moving.nii.gz \
-trans ${output_folder}/trans.nii.gz \
-res ${output_folder}/warp.nii.gz
set +o xtrace
echo ""
echo "4. Analyse the Jacobian map"
${NIFYREG_ROOT}/reg_jacobian \
-trans ${output_folder}/trans.nii.gz \
-ref ${mask} \
-jac ${output_folder}/jac.nii.gz
${C3D_ROOT}/c3d ${output_folder}/jac.nii.gz \
-threshold -inf 0 1 0 -o ${output_folder}/neg_jac_map.nii.gz
${C3D_ROOT}/c3d \
-verbose ${output_folder}/neg_jac_map.nii.gz ${effective_mask} -overlap 1
}
echo ""
echo "Run registration"
run_corrField_registration
}
run_registration_pipeline
}
run_interp_scan () {
local scan_name="$1"
local scan_name_no_ext="${scan_name%.*}"
local REF_MASK_IMG=${REFERENCE_FOLDER}/valid_region_mask.nii.gz
local scan_root_folder=${OUTPUT_ROOT_FOLDER}/${scan_name_no_ext}
local OUTPUT_LOW_RES_FOLDER=${scan_root_folder}/output_low_res
local OUTPUT_LOW_RES_2_FOLDER=${scan_root_folder}/output_low_res2
local low_res_1_trans=${OUTPUT_LOW_RES_FOLDER}/output/trans.nii.gz
local low_res_2_trans=${OUTPUT_LOW_RES_2_FOLDER}/output/trans.nii.gz
run_interp_scan_flag () {
local mask_flag="$1"
local in_mask=${MASK_FOLDER}/${mask_flag}/${scan_name}
local out_mask_folder=${OUTPUT_INTERP_FOLDER}/${mask_flag}
mkdir -p ${out_mask_folder}
local out_mask=${out_mask_folder}/${scan_name}
set -o xtrace
${NIFYREG_ROOT}/reg_resample \
-inter 0 -pad 0 \
-ref ${REF_MASK_IMG} \
-flo ${in_mask} \
-trans ${low_res_1_trans} \
-res ${out_mask}_temp.nii.gz
${NIFYREG_ROOT}/reg_resample \
-inter 0 -pad 0 \
-ref ${REF_MASK_IMG} \
-flo ${out_mask}_temp.nii.gz \
-trans ${low_res_2_trans} \
-res ${out_mask}
rm ${out_mask}_temp.nii.gz
set +o xtrace
}
get_effective_region () {
local out_mask_folder=${OUTPUT_INTERP_FOLDER}/effective_region
local final_effective_region_mask=${OUTPUT_LOW_RES_2_FOLDER}/output/effective_mask.nii.gz
set -o xtrace
mkdir -p ${out_mask_folder}
cp ${final_effective_region_mask} ${out_mask_folder}/${scan_name}
set +o xtrace
}
run_interp_scan_flag lung_mask
run_interp_scan_flag body_mask
get_effective_region
}
rm_temp_files () {
local scan_name="$1"
local scan_name_no_ext="${scan_name%.*}"
local scan_root_folder=${OUTPUT_ROOT_FOLDER}/${scan_name_no_ext}
set -o xtrace
rm -rf ${scan_root_folder}
set +o xtrace
}
| true
|
aadf8c2273894d38ad3c1449e702d438ecafa2d3
|
Shell
|
benderstwin/VPS-PLEX
|
/Traefik/install.sh
|
UTF-8
| 924
| 2.875
| 3
|
[
"Unlicense"
] |
permissive
|
#!/bin/bash
read -p "new username: " traefikuser
useradd -m -s /bin/bash $traefikuser
htpasswd -n $traefikuser password > /docker/apps/htpd
su $traefikuser
mkdir -p /docker/apps/traefik/
cd /docker/apps/traefik/
wget https://raw.githubusercontent.com/benderstwin/VPS-PLEX/master/Traefik/traefik.toml
read -p "enter your email: " traefikemail
read -p "what hostname do you want to use like traefik.hostname.fun: " traefikdomainhost
read -p "what domain do you want to use like hostname.fun: " traefikdomain
echo "setting up traefik.toml"
htpd="$(cat /docker/apps/htpwd)"
sed -i "s@passwordhtpwd@${htpd}@" traefik.toml
sed -i "s/[^@ ]*@[^@]*\.[^@ ]*/${traefikemail}/g" traefik.toml
sed -i "s@traefikdomain@${traefikdomainhost}@" traefik.toml
sed -i "s@domainname@${traefikdomain}@" docker-compose.yml
sed -i "s@domainnamehost@${traefikdomainhost}@" docker-compose.yml
touch acme.json
chmod 600 acme.json
docker-compose up -d
| true
|
d69f12300e92c93b46edea1b40c8e08ecea6a1a6
|
Shell
|
serine/jira-cli-wrappers
|
/jira-log.sh
|
UTF-8
| 404
| 3.25
| 3
|
[] |
no_license
|
#!/bin/bash
jira_exec="jira"
action="addWork"
if [[ -z "$@" ]]
then
echo ""
echo " MESSAGE: this is --action ${action}"
echo ""
echo " OPTIONS:"
echo ""
echo " --issue provide issue number, e.g bip-547"
echo " --timeSpent specify the time e.g 3h 30m"
echo " --comment comment string to add"
echo ""
exit
fi
${jira_exec} --action ${action}\
"$@"
| true
|
252fe2c93499a871085c0f599d3b50e3de7f8ad3
|
Shell
|
a18danperllu/P19
|
/2ASIX_M06_UF2_P19_Dani_Perez_show-attackers.sh
|
UTF-8
| 1,024
| 4.0625
| 4
|
[] |
no_license
|
#!/bin/bash
#PRactica_19
#https://github.com/a18danperllu/P19
usage() {
echo "Usage: ./show-attackers.sh [log-file] file
Display the number of failed logins attemps by IP address and location
from a log file" 1>&2;
exit 1;
}
#Global variables
MAX='10'
# Make sure a file was supplied as an argument.
if [[ $# -eq 0 ]]
then
echo "Please supply a file as an argument."
usage
exit 1
fi
file "{$1}" >> /dev/null
if [[ $? -ne 0 ]]
then
echo "Cannot open log file: $1"
exit 1
fi
# Display the CSV header.
echo "Intentos IP Localizacion"
# Loop through the list of failed attempts and corresponding IP addresses.
cat "$1" | grep Failed ${LOG_FILE} | awk '{print $(NF - 3)}' | sort | uniq -c | sort -nr | while read COUNT IP
do
# If the number of failed attempts is greater than the limit, display count, IP, and location.
if [[ $TRYS -gt "$MAX" ]]
then
location=$(geoiplookup "$IP" | cut -d ' ' -f4,5)
echo "$TRYS $IP $location"
fi
done
| true
|
ea9a3e663c9dbd6c48c084bddc72922f449cfff4
|
Shell
|
imankulov/wav2rtp
|
/src/wav2rtp-testcall.sh
|
UTF-8
| 4,081
| 3.34375
| 3
|
[
"FSFUL",
"BSD-2-Clause"
] |
permissive
|
#!/bin/bash
# $Id$
#
# Copyright (c) 2007, R.Imankulov
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the R.Imankulov nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
HELP_STRING="
This script runs wav2rtp and sipp one after another.
Its behaviour is confugured with environement variables and options for wav2rtp.
Environment variables are listed below:
WAV2RTP path to wav2rtp program (default: search in \$PATH)
SIPP path to sipp program (default: search in \$PATH)
SCENARIO path to basic scenario.xml file (default: ./scenario.xml)
HOST destination IP-address (default is 127.0.0.1)
THISHOST source (this host) IP-address (default is 127.0.0.1)
CLIENT_USERNAME name of the service on the client-side (default: \"service\")
Example:
SCENARIO=../doc/examples/scenario.xml $0 -c speex -f test.wav -t test.pcap \\
-o independent_losses:enabled=true -o independent_losses:loss_rate=0.05
"
# Search for wav2rtp
WAV2RTP=${WAV2RTP:-$(which wav2rtp)}
WAV2RTP=${WAV2RTP:-./wav2rtp}
if [[ ! -x $WAV2RTP ]]; then
echo "$HELP_STRING"
echo "wav2rtp executable is not found"
exit 1
fi
# Search for sipp
SIPP=${SIPP:-$(which sipp)}
if [[ ! -x $SIPP ]]; then
echo "$HELP_STRING"
echo "sipp executable is not found"
exit 1
fi
# Search for scenario
SCENARIO=${SCENARIO:-scenario.xml}
if [[ ! -f $SCENARIO ]]; then
echo "$HELP_STRING"
echo "scenario.xml is not found"
exit 1
fi
# Define client name
CLIENT_USERNAME=${CLIENT_USERNAME:-service}
# Remote host
HOST=${HOST:-127.0.0.1}
# Local host
THISHOST=${THISHOST:-127.0.0.1}
sdp_data_packet_file=$(mktemp)
play_pcap_xml_file=$(mktemp)
scenario_file=$(mktemp)
trap "rm -f $sdp_data_packet_file $play_pcap_xml_file $scenario_file" 0 2 3 15
echo $WAV2RTP $@ -o "sipp:enabled=true"
$WAV2RTP $@ -o "sipp:enabled=true" | awk "
/\*\*\*sdp_data_packet\*\*\*/{
sdp_data_packet_found=1;
play_pcap_xml_found=0;
next;
}
/\*\*\*play_pcap_xml\*\*\*/{
play_pcap_xml_found=1;
sdp_data_packet_found=0;
next;
}
{
if (play_pcap_xml_found){
print >> \"$play_pcap_xml_file\";
}
if (sdp_data_packet_found){
print >> \"$sdp_data_packet_file\";
}
}
"
cat $SCENARIO | sed -r "/\\*\\*\\*sdp_data_packet\\*\\*\\*/r $sdp_data_packet_file" \
| sed -r "/\\*\\*\\*play_pcap_xml\\*\\*\\*/r $play_pcap_xml_file" \
| sed -r "/\\*\\*\\*.*\\*\\*\\*/d" > $scenario_file
if [[ $(id -u) == 0 ]]; then
$SIPP -m 1 -sf $scenario_file $HOST -s $CLIENT_USERNAME -i $THISHOST
else
sudo $SIPP -m 1 -sf $scenario_file $HOST -s $CLIENT_USERNAME -i $THISHOST
fi
exit 0
| true
|
7ccb39de5634f6a21be50cf37111ef60f9543e97
|
Shell
|
shreyasvalmiki/search-engine
|
/sorter.sh
|
UTF-8
| 385
| 3.46875
| 3
|
[] |
no_license
|
#!/bin/bash
declare -a arr
ls dumps/buckets > temp/listfile
readarray -t arr < temp/listfile
#This does a simple sort on each bucket and saves it in the sorted file and deletes the original file.
for i in "${arr[@]}"
do
if [[ -z "$i" ]] || [[ "$i" == " " ]]; then
echo $i
else
echo $i
sort -i -s -k1,1 dumps/buckets/$i > dumps/sorted/$i
fi
#rm dumps/buckets/$i
done
| true
|
f6e92f737bcd08f24d12de7da713692f2b3aa3ec
|
Shell
|
aluvalasuman/OpenSSL-1.0.1c_DirectoryStructureFriendly
|
/build_ptt.sh
|
UTF-8
| 4,312
| 3.390625
| 3
|
[] |
no_license
|
#!/bin/bash
# Setting the NDK_DEBUG=0 flag, while using ndk-build, forces the optimization level of -O2.
#Start time of the build
echo
echo
echo
START=$(date +%s)
echo "Start Date & Time: `date --date=@$START`"
echo
echo
echo
#Setting the build mode
export MPTT_NATIVE_BUILD_MODE=$1
if [ $MPTT_NATIVE_BUILD_MODE == "RELEASE" ]; then
echo "MPTT_NATIVE_BUILD_MODE: $MPTT_NATIVE_BUILD_MODE"
elif [ $MPTT_NATIVE_BUILD_MODE == "QUICK" ]; then
echo "MPTT_NATIVE_BUILD_MODE: $MPTT_NATIVE_BUILD_MODE"
elif [ $MPTT_NATIVE_BUILD_MODE == "CLEAN" ]; then
echo "MPTT_NATIVE_BUILD_MODE: $MPTT_NATIVE_BUILD_MODE"
elif [ $MPTT_NATIVE_BUILD_MODE == "RQUICK" ]; then
echo "MPTT_NATIVE_BUILD_MODE: $MPTT_NATIVE_BUILD_MODE"
else
export MPTT_NATIVE_BUILD_MODE=DEBUG
echo "MPTT_NATIVE_BUILD_MODE: $MPTT_NATIVE_BUILD_MODE"
echo "IMPORTANT: Please make sure you read Application.mk and AndroidManifest.xml file flag is set appropriately."
fi
#Building the native library
if [ $MPTT_NATIVE_BUILD_MODE == "QUICK" ]; then
echo "===================== QUICK ====================="
echo "+ Building for the QUICK BUILD Mode.............................................................."
echo "+ Debug mode options will be considered "
echo "+ Make Sure 'APP_OPTIM := debug' in Application.mk file"
echo "+ Make Sure 'android:debuggable=true' in AndroidManifest.xml file"
echo "+ Make Sure 'LOCAL_CFLAGS := -g' is ADDED in all the Android.mk files (or)"
echo "+ 'LOCAL_EXPORT_CFLAGS += -g' in parent Android.mk file"
echo "+ APP_OPTIM = `$APP_OPTIM`"
echo "===================== QUICK ====================="
echo
echo
echo
ndk-build NDK_DEBUG=1 V=1
elif [ $MPTT_NATIVE_BUILD_MODE == "RELEASE" ]; then
echo "===================== RELEASE ====================="
echo "+ Building for the RELEASE Mode.............................................................."
echo "+ Make Sure 'APP_OPTIM := release' in Application.mk file"
echo "+ Make Sure 'android:debuggable=false' in AndroidManifest.xml file"
echo "+ Make Sure 'LOCAL_CFLAGS := -g' is REMOVED in all the Android.mk files"
echo "+ 'LOCAL_EXPORT_CFLAGS += -g' in parent Android.mk file"
echo "+ APP_OPTIM = `$APP_OPTIM`"
echo "===================== RELEASE ====================="
echo
echo
echo
ndk-build clean
echo
echo
echo
ndk-build NDK_DEBUG=0 V=1 -B
elif [ $MPTT_NATIVE_BUILD_MODE == "RQUICK" ]; then
echo "===================== RELEASE QUICK====================="
echo "+ Building for the RELEASE Mode.............................................................."
echo "+ Make Sure 'APP_OPTIM := release' in Application.mk file"
echo "+ Make Sure 'android:debuggable=false' in AndroidManifest.xml file"
echo "+ Make Sure 'LOCAL_CFLAGS := -g' is REMOVED in all the Android.mk files"
echo "+ 'LOCAL_EXPORT_CFLAGS += -g' in parent Android.mk file"
echo "+ APP_OPTIM = `$APP_OPTIM`"
echo "===================== RELEASE QUICK ====================="
echo
echo
echo
ndk-build NDK_DEBUG=0 V=1
elif [ $MPTT_NATIVE_BUILD_MODE == "CLEAN" ]; then
echo "===================== CLEAN ====================="
echo "+ Cleaning the build system ..... "
echo "===================== CLEAN ====================="
echo
echo
echo
ndk-build clean
else
echo "===================== DEBUG ====================="
echo "+ Building for the DEBUG Mode.............................................................."
echo "+ Make Sure 'APP_OPTIM := debug' in Application.mk file"
echo "+ Make Sure 'android:debuggable=true' in AndroidManifest.xml file"
echo "+ Make Sure 'LOCAL_CFLAGS := -g' is ADDED in all the Android.mk files"
echo "+ 'LOCAL_EXPORT_CFLAGS += -g' in parent Android.mk file"
echo "+ APP_OPTIM = `$APP_OPTIM`"
echo "===================== DEBUG ====================="
echo
echo
echo
ndk-build clean
echo
echo
echo
ndk-build NDK_DEBUG=1 V=1 -B
fi
echo
echo
echo
#End time of the build
END=$(date +%s)
echo "End Date & Time: `date --date=@$END +%H:%M:%S`"
#Printing Build Time
DIFF=$(( $END - $START ))
echo "It took $DIFF seconds"
seconds=$DIFF
hours=$((seconds / 3600))
seconds=$((seconds % 3600))
minutes=$((seconds / 60))
seconds=$((seconds % 60))
echo "Time Consumed : $hours hour(s) $minutes minute(s) $seconds second(s)"
echo
echo
echo
| true
|
6de4d8c58783aaa4c3c3bf529eca455ba639db84
|
Shell
|
lghcctvgmail/programming
|
/configfile/compile/hisiv200_compile_env.sh
|
UTF-8
| 195
| 2.5625
| 3
|
[] |
no_license
|
#!/bin/sh
HISIV200_ROOT=`pwd|xargs dirname`
echo $HISIV200_ROOT
#export hisiv200 compile env
export PATH=$PATH:$HISIV200_ROOT/opt/hisi-linux/x86-arm/arm-hisiv200-linux/target/bin
echo $PATH
| true
|
e28a18a2eae003f305d09c3354956d912a0ed2dc
|
Shell
|
Tubbz-alt/CODK-Z
|
/utils/flash_jtag.sh
|
UTF-8
| 264
| 2.53125
| 3
|
[] |
no_license
|
#!/bin/sh
topdir=$((dirname $(readlink -f $0))
$topdir/bin/openocd -f scripts/interface/ftdi/flyswatter2.cfg -f scripts/board/firestarter.cfg -f scripts/codk-jtag.cfg
if [ $? -ne 0 ]; then
echo
echo "***ERROR***"
exit 1
else
echo
echo "!!!SUCCESS!!!"
fi
| true
|
3dd77d2b5f82680abb4703cc70222cbf28dc8874
|
Shell
|
jagregory/1password-env
|
/lib/signin.sh
|
UTF-8
| 1,598
| 3.609375
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
TOKEN_DIR="$HOME/.1password-env"
function default_vault {
echo -n "Vault" >&2
[ ! -z "$OP_DEFAULT_VAULT" ] && echo -n " ($OP_DEFAULT_VAULT)" >&2
echo -n ": " >&2
read -r __vault
echo "${__vault:-$OP_DEFAULT_VAULT}"
}
function default_email {
echo -n "Email" >&2
[ ! -z "$OP_DEFAULT_EMAIL" ] && echo -n " ($OP_DEFAULT_EMAIL)" >&2
echo -n ": " >&2
read -r __email
echo "${__email:-$OP_DEFAULT_EMAIL}"
}
function default_secretkey {
if [ -z "$OP_DEFAULT_SECRET_KEY" ]; then
echo -n 'Secret Key: ' >&2
read -s -r __secretkey
echo "$__secretkey"
else
echo "$OP_DEFAULT_SECRET_KEY"
fi
}
function load_saved_session {
if [ -f "$TOKEN_DIR/defaults" ]; then
source "$TOKEN_DIR/defaults"
fi
if [ -f "$TOKEN_DIR/session" ]; then
source "$TOKEN_DIR/session"
fi
}
function ensure_signed_in {
load_saved_session
echo -n '1Password vault unlocked... ' >&2
op get account >/dev/null 2>&1 && { echo -e '\x1B[0;32m✔\x1B[0m' >&2; return 0; }
echo -e '\x1B[0;31mⅹ\x1B[0m' >&2
echo '' >&2
local vault
vault=$(default_vault)
local email
email=$(default_email)
local secretkey
secretkey=$(default_secretkey)
echo
session=$(op signin "$vault" "$email" "$secretkey" --output=raw)
mkdir -p "$TOKEN_DIR" >/dev/null 2>&1
chmod 700 "$TOKEN_DIR" >/dev/null 2>&1
cat > "$TOKEN_DIR/defaults" << EOF
export OP_DEFAULT_VAULT='$vault'
export OP_DEFAULT_EMAIL='$email'
EOF
cat > "$TOKEN_DIR/session" << EOF
export OP_SESSION_$vault='$session'
EOF
chmod -R 600 "$TOKEN_DIR/"*
load_saved_session
}
| true
|
029f6e5c272d0b02478fd608421ff74cd2fd3f31
|
Shell
|
JakeFromTheDark/pre-commit-hooks
|
/hooks/cf-doc.sh
|
UTF-8
| 1,325
| 4.5
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
output_dir=
output_format=markdown
verbose=
retcode=0
die () {
echo "${0##*/}: $*" >&2
exit 1
}
while [ -n "$1" ]; do
case "$1" in
--outputdir=*)
output_dir="${1#*=}"
shift
;;
--outputdir)
shift
output_dir="$1"
shift
;;
--format=*)
output_format="${1#*=}"
shift
;;
--format)
shift
output_format="$1"
shift
;;
--verbose)
verbose=yes
shift
;;
--*)
die "Syntax error: Unsupported option ($1)"
;;
*)
break
;;
esac
done
# validate output format
case "${output_format}" in
json) output_extension=json;;
markdown|md) output_extension=md;;
*) die "Syntax error: Unsupported output format (${output_format})";;
esac
# ensure output dir
[ -n "${output_dir}" ] \
|| die "Syntax Error: No output dir given"
[ -f "${output_dir}" ] \
&& die "Syntax Error: Given output dir (${output_dir}) is a file"
# process the rest of arguments - files
for file; do
out_file="${output_dir}/${file%.*}.${output_extension}"
[ -n "${verbose}" ] \
&& echo "Creating ${output_format} file ${out_file} from ${file} ..."
mkdir -p "${out_file%/*}"
cf-doc "${output_format}" "${file}" > "${out_file}" || retcode=$?
done
exit "${retcode}"
| true
|
8209dde03a8bacd9026daea2ec23535d9a8fc70a
|
Shell
|
OXOTH1K/hassio-addon-transmission
|
/transmission/rootfs/etc/cont-init.d/20-transmission-configuration.sh
|
UTF-8
| 1,329
| 3.046875
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/with-contenv bashio
# ==============================================================================
declare CONFIG
declare authentication_required
declare username
declare password
if ! bashio::fs.directory_exists '/data/transmission'; then
mkdir '/data/transmission'
fi
if ! bashio::fs.file_exists '/data/transmission/settings.json'; then
echo "{}" > /data/transmission/settings.json
fi
CONFIG=$(</data/transmission/settings.json)
# Defaults
CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir\"=\"/share/incomplete\"")
CONFIG=$(bashio::jq "${CONFIG}" ".\"incomplete-dir-enabled\"=true")
CONFIG=$(bashio::jq "${CONFIG}" ".\"download-dir\"=\"/share/downloads\"")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-whitelist-enabled\"=false")
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-host-whitelist-enabled\"=false")
CONFIG=$(bashio::jq "${CONFIG}" ".\"bind-address-ipv4\"=\"0.0.0.0\"")
authentication_required=$(bashio::config 'authentication_required')
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-authentication-required\"=${authentication_required}")
username=$(bashio::config 'username')
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-username\"=\"${username}\"")
password=$(bashio::config 'password')
CONFIG=$(bashio::jq "${CONFIG}" ".\"rpc-password\"=\"${password}\"")
echo "${CONFIG}" > /data/transmission/settings.json
| true
|
e6e8412fe3c5f639fa329bb01119a36de60016bb
|
Shell
|
Svtter/mysql-db-fork
|
/mysql-fork-delete.sh
|
UTF-8
| 1,018
| 3.53125
| 4
|
[
"LicenseRef-scancode-cecill-b-en"
] |
permissive
|
#!/usr/bin/env bash
TARGET_DB=$1
PASSWORD=$1
echo "mysql-fork> deleting database and user $TARGET_DB"
MYSQL=/usr/bin/mysql
# Killing all process from user
# http://dbadiaries.com/how-to-kill-all-mysql-processes-for-a-specific-user/
# ensure this file is deleted because mysql does not allow overwrite
rm /tmp/kill_process.txt 2>/dev/null || true
echo "SELECT CONCAT('KILL ',id,';') AS run_this FROM information_schema.processlist WHERE user='${TARGET_DB}' INTO OUTFILE '/tmp/kill_process.txt';"|"$MYSQL"
echo "SOURCE /tmp/kill_process.txt"|"$MYSQL"
rm /tmp/kill_process.txt
# NOTE: IF EXISTS mariadb > 10.1.3
# https://mariadb.com/kb/en/library/drop-user/#if-exists
echo "DROP USER IF EXISTS ${TARGET_DB}"|"$MYSQL"
echo "DROP DATABASE IF EXISTS ${TARGET_DB}"|"$MYSQL"
if [ -d "/var/lib/mysql/${TARGET_DB}" ]
then
echo "Oops, directory still exists after drop database. Manual deletion of resting files."
rm -rf "/var/lib/mysql/${TARGET_DB}/"*
echo "DROP DATABASE IF EXISTS ${TARGET_DB}"|"$MYSQL"
fi
| true
|
01d94c29c4c5ffa60d3245da213540879cf091b3
|
Shell
|
faecie/async-sockets
|
/travis-install.sh
|
UTF-8
| 847
| 3
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
set -e
if [[ "${TRAVIS_PHP_VERSION}" = "5.4" || "${TRAVIS_PHP_VERSION}" = "5.5" ]]; then
PHP_UNIT_VERSION=~4.7
else
PHP_UNIT_VERSION=~5.2
fi
if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" &&
"${TRAVIS_PHP_VERSION}" != "7.0" &&
"${TRAVIS_PHP_VERSION}" != "7.1" &&
"${TRAVIS_PHP_VERSION}" != "nightly" ]]; then
echo "yes" | pecl install event
# install 'libevent' PHP extension
curl http://pecl.php.net/get/libevent-0.1.0.tgz | tar -xz
pushd libevent-0.1.0
phpize
./configure
make
make install
popd
echo "extension=libevent.so" >> "$(php -r 'echo php_ini_loaded_file();')"
fi
composer install --prefer-dist
composer require phpunit/phpunit:${PHP_UNIT_VERSION}
php tests/console.php async_sockets:test:warmup --configuration=${ASYNC_SOCKETS_CONFIG}
| true
|
ee9168f1ac140ee2470de51b3ac2384dd08938d9
|
Shell
|
EpochFail/word
|
/migrations/run-migrations
|
UTF-8
| 395
| 2.640625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
export PGUSER="${PGUSER:-word}"
export PGPASSWORD="${PGPASSWORD:-krampus}"
export PGDB="${PGDB:-word}"
export PGPORT="${PGPORT:-$( echo "${PG_PORT_5432_TCP_PORT:-5432}" )}"
export PGHOST="${PGHOST:-$( echo "${PG_PORT_5432_TCP_ADDR:-127.0.0.1}" )}"
export PGSSLMODE="${PGSSLMODE:-disable}"
export PGTZ="${PGTZ:-UTC}"
DIR="$( cd "$( dirname "$0" )" && pwd )"
goose -path=$DIR up
| true
|
d121dedc320ff3d8bf3c8d7fd404e4b187b9841d
|
Shell
|
AndDiSa/android_backup_project
|
/restore_apps.sh
|
UTF-8
| 2,427
| 3.640625
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# License; Apache-2
# Originally from Raphael Moll
# Tested/Fixed for Android O by marc_soft@merlins.org 2017/12
# improved / completly reworked to play nice with Android 9 / 10 by anddisa@gmail.com 2019/12
curr_dir="$(dirname "$0")"
. "$curr_dir/functions.sh"
set -e # fail early
OLDIFS="$IFS"
cat <<EOF
WARNING: restoring random system apps is quite likely to make things worse
unless you are copying between 2 identical devices.
You probably want to mv backupdir/app_{com.android,com.google}* /backup/location
This will cause this script not to try and restore system app data
EOF
sleep 5
DIR="$1"
if [[ ! -d "$DIR" ]]; then
echo "Usage: $0 <data-dir>"
echo "Must be created with ./backup_apps.sh"
exit 2
fi
shift
checkPrerequisites
updateBusybox
lookForAdbDevice
checkRootType
pushBusybox
cd $DIR
if [ $# -gt 0 ]; then
APPS="$@"
echo "## Push apps: $APPS"
else
APPS=$(echo app_*)
echo "## Push all apps in $DIR: $APPS"
fi
echo "## Installing apps"
for appPackage in $APPS
do
APP=`tar xvfz $appPackage -C /tmp/ --wildcards "*.apk" | sed 's/\.\///'`
echo $appPackage
echo $APP
echo "Installing $APP"
pushd /tmp
error=`$A install-multiple -r -t ${APP}`
echo "error=$error"
rm *.apk
popd
appPrefix=$(echo $appPackage | sed 's/app_//' | sed 's/\.tar\.gz//')
echo $appPrefix
allApps=`$A shell cmd package list packages -f`
#echo $allApps
appConfig=$(echo $allApps | tr " " "\n" | grep $appPrefix)
echo "$appConfig"
#dataDir=`echo $appConfig | sed 's/package://' | rev | cut -d "=" -f1 | rev`
dataDir=$appPrefix
echo $dataDir
echo
echo "## Now installing app data"
$AS "pm clear $appPrefix"
sleep 1
echo "Attempting to restore data for $APP"
# figure out current app user id
L=( $($AS ls -d -l /data/data/$dataDir 2>/dev/null) ) || :
# drwx------ 10 u0_a240 u0_a240 4096 2017-12-10 13:45 .
# => return u0_a240
ID=${L[2]}
if [[ -z $ID ]]; then
echo "Error: $APP still not installed"
exit 2
fi
echo "APP User id is $ID"
dataPackage=`echo $appPackage | sed 's/app_/data_/'`
echo "mkdir -p /dev/tmp/$dataDir"
$AS "mkdir -p /dev/tmp/$dataDir"
cat $dataPackage | pv -trab | $AS "/dev/busybox tar -xzpf - -C /data/data/$dataDir"
echo "$AS chown -R $ID.$ID /data/data/$dataDir"
$AS "chown -R $ID.$ID /data/data/$dataDir"
done
echo "script exiting after adb install will want to fix securelinux perms with: restorecon -FRDv /data/data"
$AS "restorecon -FRDv /data/data"
cleanup
| true
|
d8d2b61e69b14e19a10787ab79052d3469fa089f
|
Shell
|
pixierepo/px-toolchain
|
/scripts/quick-conf.sh
|
UTF-8
| 245
| 2.625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
#Config time setting and locales
sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
sed -i 's/^# *\(en_US ISO-8859-1\)/\1/' /etc/locale.gen
locale-gen
echo 'LANG='$LANG >> /etc/locale.conf
unset LANG
source /etc/profile.d/locale.sh
| true
|
47abc9f853a3f95ce63fe98fb1df94d9353af780
|
Shell
|
WDCommunity/wdpksrc
|
/wdpk/docker/init.sh
|
UTF-8
| 623
| 3.5625
| 4
|
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/sh
[ -f /tmp/debug_apkg ] && echo "APKG_DEBUG: $0 $@" >> /tmp/debug_apkg
APPDIR=$1
log=/tmp/debug_apkg
echo "INIT linking files from path: $path" >> $log
# setup binaries in PATH before the original v1.7 binaries
ln -s $(readlink -f ${APPDIR})/docker/* /sbin
# disable default docker by moving the original start script
[ -L /usr/sbin/docker_daemon.sh ] && mv /usr/sbin/docker_daemon.sh /usr/sbin/docker_daemon.sh.bak
[ -L /usr/sbin/docker ] && mv /usr/sbin/docker /usr/sbin/docker.bak
# create folder for the redirecting webpage
WEBPATH="/var/www/docker/"
mkdir -p ${WEBPATH}
ln -sf ${APPDIR}/web/* $WEBPATH
| true
|
3e8fce367b5e54abe19c47b0042144f7995dc441
|
Shell
|
Huihuiweng/3D_CUBIT_mesh
|
/Surface/create_surface_data.sh
|
UTF-8
| 3,360
| 3.359375
| 3
|
[] |
no_license
|
### Load Parameters file ###
source ../Parameters_for_curved_surfaces.sh
##################################
##################################
### Output
Subxyz=surface_sigma_${Sur_sigma}_inc_${Sur_inc}.xyz
if [ $Sur_GRD_data = "1" ] ; then
if [ ! -f $Sur_input_data ] ; then
echo "Miss the data for the curved free surface. Please give the correct path to the data..."
echo "Fails to create curved mesh..."
exit
fi
# Because the global topography data may be very large, it is better to cut the global data to smaller one.
if [ ! -f temp_file/cutted_${X1}_${X2}_${Y1}_${Y2}.grd ] ; then
grdcut $Sur_input_data -Gtemp_file/cutted_${X1}_${X2}_${Y1}_${Y2}.grd -R${X1}/${X2}/${Y1}/${Y2}
fi
grd2xyz temp_file/cutted_${X1}_${X2}_${Y1}_${Y2}.grd | gawk '{print ($1-('"$Lon_ref"'))*'"$Lon_scale"'*1e3, ($2-('"$Lat_ref"'))*'"$Lat_scale"'*1e3, $3}' > temp_file/topo.xyz
else
gawk '{if($1>= '"${X1}"' && $1<= '"${X2}"' && $2>= '"${Y1}"' && $2<='"${Y2}"') print ($1-('"$Lon_ref"'))*'"$Lon_scale"'*1e3, ($2-('"$Lat_ref"'))*'"$Lat_scale"'*1e3, $3}' ${input_data} > temp_file/topo.xyz
fi
#####################################
##### Smooth the data ######
#####################################
$Run_python ../python_scripts/Smooth_slab.py -p temp_file/topo.xyz $Sur_sigma $Sur_inc > temp_file/${Subxyz}
#####################################
##### Create jou file ######
#####################################
dimension=`$Run_python ../python_scripts/Dimension.py -p temp_file/${Subxyz}`
echo "Topography data dimension:" $dimension
$Run_python ../python_scripts/slab_interface_netsurf.py -p temp_file/${Subxyz} ${dimension} CUBIT_jou/surface_sigma_${Sur_sigma}_inc_${Sur_inc}.jou ../output/surface_sigma_${Sur_sigma}_inc_${Sur_inc}.sat
#####################################
##### Create sat file ######
#####################################
$Run_python ../python_scripts/playback_jou.py -p CUBIT_jou/surface_sigma_${Sur_sigma}_inc_${Sur_inc}.jou
#####################################
##### Map to figure ######
#####################################
makecpt -Crelief -T-8000/8000/100 -N > temp.cpt
### Original data
grdimage temp_file/cutted_${X1}_${X2}_${Y1}_${Y2}.grd -R${X1}/${X2}/${Y1}/${Y2} -JX4i -B0.5f0.1/0.5f0.1:."Original topography":WSne -Ctemp.cpt -K -Q > ps/${Sur_sigma}_${Sur_inc}_topography.eps
grdcontour temp_file/cutted_${X1}_${X2}_${Y1}_${Y2}.grd -R -J -C500 -A- -O -K >> ps/${Sur_sigma}_${Sur_inc}_topography.eps
### Smoothed data
LowerX=`gawk 'BEGIN{print ('"$X1"'-'"$Lon_ref"')*'"$Lon_scale"'*1e3}'`
UpperX=`gawk 'BEGIN{print ('"$X2"'-'"$Lon_ref"')*'"$Lon_scale"'*1e3}'`
LowerY=`gawk 'BEGIN{print ('"$Y1"'-'"$Lat_ref"')*'"$Lat_scale"'*1e3}'`
UpperY=`gawk 'BEGIN{print ('"$Y2"'-'"$Lat_ref"')*'"$Lat_scale"'*1e3}'`
pscontour temp_file/${Subxyz} -R${LowerX}/${UpperX}/${LowerY}/${UpperY} -B50000f10000:."Smoothed and resampled topography":WSne -J -Ctemp.cpt -I -A- -O -K -X5i >> ps/${Sur_sigma}_${Sur_inc}_topography.eps
pscontour temp_file/${Subxyz} -R${LowerX}/${UpperX}/${LowerY}/${UpperY} -J -C500 -Wthinnest -A- -O >> ps/${Sur_sigma}_${Sur_inc}_topography.eps
ps2pdf ps/${Sur_sigma}_${Sur_inc}_topography.eps ps/${Sur_sigma}_${Sur_inc}_topography.pdf
rm ps/${Sur_sigma}_${Sur_inc}_topography.eps temp.cpt gmt.history -f
| true
|
63f2e913bb651f6338a691f110875d20245ae7e9
|
Shell
|
nreith/linux-scripts
|
/scripts/install_mssql17_drivers
|
UTF-8
| 1,750
| 3.453125
| 3
|
[] |
no_license
|
#!/bin/bash
# ms sql server odbc
printf "
Installing Microsoft SQL Server ODBC v17 and JDBC v7 Drivers in /opt/microsoft/
###############################################################################
"
# Build Deps
sudo apt-get update -qq
sudo apt-get install -y curl wget apt-transport-https gnupg2
# MS SQL Server Drivers
cd /tmp && curl -s https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Add PPAs for Ubuntu 16.04/18.04/20.04
export VERSION_ID=$(grep VERSION_ID /etc/os-release | cut -d'=' -f2 | sed 's/"//g')
#sudo curl -s https://packages.microsoft.com/config/ubuntu/$VERSION_ID/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update -qq
sudo env ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
sudo env ACCEPT_EULA=Y apt-get install -y mssql-tools
sudo bash -c "echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> /etc/profile.d/mssql.sh"
sudo chmod +x /etc/profile.d/mssql.sh
export PATH="$PATH:/opt/mssql-tools/bin"
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
# Get JDBC Driver
cd /opt/microsoft && mkdir -p msjdbcsql7 && cd msjdbcsql7
wget -q "https://github.com/Microsoft/mssql-jdbc/releases/download/v7.2.1/mssql-jdbc-7.2.1.jre8.jar"
# config file
cat << EOF >> /etc/odbcinst.ini
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.2.so.0.1
Threading=1
UsageCount=1
[JDBC Driver 7 for SQL Server]
Description=Microsoft JDBC Driver 7 for SQL Server
Driver=/opt/microsoft/msjdbcsql7/mssql-jdbc-7.2.1.jre8.jar
EOF
printf "
####################
DONE
When in doubt about installed sql drivers, check 'cat /etc/odbcinst.ini'
"
| true
|
538c36e4c71d08140040f354fabc3983e1806e18
|
Shell
|
chuchuva/cordova-plugin-purchase-documentation
|
/build.sh
|
UTF-8
| 901
| 3.09375
| 3
|
[] |
no_license
|
#!/bin/bash
for platform in android ios; do
for type in consumable subscription non-consumable nr-subscription; do
(
cat sections/$type-$platform-intro.md sections/generic-$platform-intro.md
echo
echo '## Setup'
echo
cat ./sections/setup-$platform-*.md
cat ./sections/setup-$type-$platform-*.md
echo
echo '## Coding'
echo
cat ./sections/$type-generic-initialization.md
echo
cat ./sections/$type-$platform.md
) > use-cases/$type-$platform.md
done
done
if false; then
# Setup Android
(
echo "# Setup Android"
echo
echo "We will setup our Android application."
echo
cat ./sections/setup-android-*.md
) > use-cases/setup-android.md
# Setup iOS
(
echo "# Setup iOS"
echo
echo "We will setup our iOS application."
echo
cat ./sections/setup-ios-*.md
) > use-cases/setup-ios.md
fi
| true
|
74b897059c8d42792a28a32a67610ee85c3d2ffd
|
Shell
|
atgmavans/caa
|
/bin/bash/preprocess/preprocess_fastqc.sh
|
UTF-8
| 606
| 3
| 3
|
[] |
no_license
|
#!/bin/bash/preprocess
# filtering of raw reads
if [[ $FASTQC == yes ]]; then
fastqc_folder=$output_folder/FastQC_report
mkdir $fastqc_folder
echo -e " <mop_preprocess> \e[33m quality control of raw reads with fastqc \e[39m"
fastqc $sequence_file -o $fastqc_folder -d $tempdir -t $TASK_CPUS
if [[ $NANOFILT == yes ]]; then
echo -e " <mop_preprocess> \e[33m quality control of filtered reads with fastqc \e[39m"
fastqc $nanofilt_output -o $fastqc_folder -d $tempdir -t $TASK_CPUS
fi
elif [[ $FASTQC == no ]]; then
echo -e " <mop_preprocess> \e[33m skipping quality control of reads \e[39m"
fi
| true
|
2819b86b9b33e646e2aaff053ce490b94d899fa1
|
Shell
|
voting-app-example/vote
|
/build.sh
|
UTF-8
| 208
| 2.59375
| 3
|
[] |
no_license
|
#!/bin/sh
set -e
TAG=$(echo $GITHUB_SHA | head -c7)
REGISTRY_BASE_URL="registry.digitalocean.com/voting-app-example"
docker build \
-t $REGISTRY_BASE_URL/vote:latest \
-t $REGISTRY_BASE_URL/vote:$TAG .
| true
|
69304f60a8ce56c3ac8a2627cb7cf28fe9453f4b
|
Shell
|
easybiblabs/docker-chef
|
/research-containers/alpine-nginx-php7fpm/container_confs/entrypoint.sh
|
UTF-8
| 362
| 3.046875
| 3
|
[] |
no_license
|
#!/bin/sh
# ----------------------------------------------------------------------------
# entrypoint for container
# ----------------------------------------------------------------------------
set -e
if [ "$1" == "nginx" ]; then
echo "starting services...."
/usr/bin/supervisord -n -c /etc/supervisord.conf
else
echo "Running something else"
exec "$@"
fi
| true
|
227f0a1f32690fce53a01bec13718f34cb7bb072
|
Shell
|
SbWereWolf/fias
|
/docker/cmd/deploy/deploy-db.sh
|
UTF-8
| 1,653
| 2.796875
| 3
|
[] |
no_license
|
#!/bin/bash
echo 'START deploy FIAS'
date --rfc-3339=seconds && echo 'Let create database fias'
time psql -U postgres -wtc \
"SELECT 1 FROM pg_database WHERE datname = 'fias'" \
| grep -q 1 || psql -U postgres -c "CREATE DATABASE fias"
date --rfc-3339=seconds && echo 'Let create schema fias'
time psql -U postgres -d fias -wtc "CREATE SCHEMA IF NOT EXISTS fias"
date --rfc-3339=seconds && echo 'START import-base-dbf'
time bash /home/fias/cmd/deploy/import-base-dbf.sh
date --rfc-3339=seconds && echo 'FINISH import-base-dbf'
date --rfc-3339=seconds && echo 'START alter-address-object'
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/alter-address-object.sql
date --rfc-3339=seconds && echo 'FINISH alter-address-object'
date --rfc-3339=seconds && echo 'START alter-house'
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/alter-house.sql
date --rfc-3339=seconds && echo 'FINISH alter-house'
date --rfc-3339=seconds && echo 'START alter-room'
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/alter-room.sql
date --rfc-3339=seconds && echo 'FINISH alter-room'
date --rfc-3339=seconds && echo 'START create-stored-procedures'
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-address-object-group.sql
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-address-object-name.sql
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-address-object-tree.sql
time psql -U postgres -d fias -wab \
-f /home/fias/cmd/deploy/get-house-name.sql
date --rfc-3339=seconds && echo 'FINISH create-stored-procedures'
echo 'FINISH deploy FIAS'
| true
|
7ed708501903bb8fa42b2ccbfda2fd9435a24ed5
|
Shell
|
xanguera/mediaeval_zerocost
|
/s5/decode_mediaeval.sh
|
UTF-8
| 3,179
| 3.75
| 4
|
[] |
no_license
|
#!/bin/bash
# Xavier Anguera - ELSA Corp. 2016
# This script runs the decoding of a directory of wav files
# USAGE: $0 input_directory output_directory
# Change directory to the location of this script.
cwd=$PWD
cd $(dirname $0)
#define some paths
. path.sh || exit 1
. cmd.sh || exit 1
#default values
inputDir=
outputDir=$PWD/output #defaults to the output dir
numParallel=1
run_cmd=run.pl
read -d '' help_message << HELPMESSAGE
==> Mediaeval Zero Cost decoding script <==
Usage: $0 [options]
--inputDir: location where to find 16KHz 16bit .wav files to decode
--outputDir: location where to write decoding output, defaults to ./output
--numParallel: number of parallel decoding jobs to run
HELPMESSAGE
#parse input parameters
[ $# -gt 1 ] && echo "$0 $@" # Print the command line for logging
. parse_options.sh || exit 1;
#check that input and output directories are defined
if [ -z "$inputDir" ] || [ -z "$outputDir" ]; then
echo "[ERROR]: either input or output directories are not defined"
printf "$help_message\n"
exit
fi
#checking existence of directories
if [ ! -d ${inputDir} ]; then
echo "[ERROR]: input directory <<$inputDir>> does not exist"
exit
fi
#false && \
{
#prepare the data
rm -Rf $outputDir/data
mkdir -p $outputDir/data
#prepare wav.scp, utt2spk and text files
for aFile in ${inputDir}/*.wav;
do
name=$(basename $aFile .wav)
echo "$name $aFile" >> $outputDir/data/wav.scp
echo "$name $name" >> $outputDir/data/utt2spk
echo "$name <unk>" >> $outputDir/data/text
done
utils/utt2spk_to_spk2utt.pl $outputDir/data/utt2spk > $outputDir/data/spk2utt
}
#false && \
{
#compute features
featsData=$outputDir/data
steps/make_mfcc.sh --cmd "$run_cmd" --nj $numParallel $featsData $featsData/log $featsData/data || exit 1;
steps/compute_cmvn_stats.sh $featsData $featsData/log $featsData/data || exit 1;
utils/fix_data_dir.sh $featsData || exit 1 # remove segments with problems
}
#false && \
{
#perform decoding (word level)
steps/decode_si_mediaeval.sh --nj $numParallel --cmd "$run_cmd" --model exp/tri1/final.mdl --config conf/decode.conf\
--skip-scoring true --srcDir exp/tri1 \
exp/tri1/graph $featsData $outputDir/decoding_words || exit 1
if [ -d $outputDir/decoding_words ]; then
lattice-align-words --output-error-lats=true data/lang/phones/word_boundary.int exp/tri1/final.mdl "ark:gunzip -c $outputDir/decoding_words/lat.*.gz |" ark:- | \
lattice-to-ctm-conf --decode-mbr=true ark:- - | \
utils/int2sym.pl -f 5 data/lang/words.txt > $outputDir/decoding_words/output.ctm || exit 1;
fi
}
#false && \
{
#perform decoding (phone level)
steps/decode_si_mediaeval.sh --nj $numParallel --cmd "$run_cmd" --model exp/tri1/final.mdl --config conf/decode.conf\
--skip-scoring true --srcDir exp/tri1 \
exp/tri1/graph_phn $featsData $outputDir/decoding_phones || exit 1
if [ -d $outputDir/decoding_phones ]; then
lattice-align-phones --output-error-lats=true exp/tri1/final.mdl "ark:gunzip -c $outputDir/decoding_phones/lat.*.gz |" ark:- | \
lattice-to-ctm-conf --decode-mbr=true ark:- - | \
utils/int2sym.pl -f 5 data/lang_phn/words.txt > $outputDir/decoding_phones/output.ctm || exit 1;
fi
}
| true
|
2edb298bb0bfe3a1081240878986bed51b2076ab
|
Shell
|
cClaude/cchlib
|
/buildAll.sh
|
UTF-8
| 3,455
| 3.5625
| 4
|
[] |
no_license
|
#!/bin/bash
#
set +ex
[ -d .logs ] || mkdir .logs
mvn clean install | tee .logs/mvn-install.log
MVN_EXIT="${PIPESTATUS[0]}"
# MVN_EXIT="$?" - Not valid due to pipe
cat .logs/mvn-install.log | grep "warning: no description for" | sort | uniq > .logs/mvn-install-warn-no-desc.log
cat .logs/mvn-install.log | grep "warning: no @param for" | sort | uniq > .logs/mvn-install-warn-no-param.log
cat .logs/mvn-install.log | grep "warning: no @return" | sort | uniq > .logs/mvn-install-warn-no-return.log
cat .logs/mvn-install.log | grep "error: unknown tag:" | sort | uniq > .logs/mvn-install-error-unknown-tag.log
cat .logs/mvn-install.log | grep "error: exception not thrown:" | sort | uniq > .logs/mvn-install-error-not-thrown.log
cat .logs/mvn-install.log | grep "warning: empty" | sort | uniq > .logs/mvn-install-warning-empty.log
cat .logs/mvn-install.log | grep "error: reference not found" | sort | uniq > .logs/mvn-install-error-reference-not-found.log
cat .logs/mvn-install.log | grep ": error: bad use of '" | sort | uniq > .logs/mvn-install-error-bad-use-of.log
cat .logs/mvn-install.log | grep "error: semicolon missing" | sort | uniq > .logs/mvn-install-error-semicolon-missing.log
cat .logs/mvn-install.log | grep -v "warning: no description for" \
| grep -v "warning: no @param for" \
| grep -v "warning: no @return" \
| grep -v "error: unknown tag:" \
| grep -v "error: exception not thrown:" \
| grep -v "warning: empty" \
| grep -v "error: reference not found" \
| grep -v ": error: bad use of '" \
| grep -v "error: semicolon missing" \
> .logs/mvn-install-others.log
if [ ! "${MVN_EXIT}" -eq "0" ];
then
echo "[ERROR] in ${MVN} ${MVN_PARAM}"
exit 1
fi
pushd apps
./buildAllApps.sh | tee ../.logs/buildAllApps.log
popd
cat .logs/buildAllApps.log | grep "warning: no description for" | sort | uniq > .logs/build-all-apps-warn-no-desc.log
cat .logs/buildAllApps.log | grep "warning: no @param for" | sort | uniq > .logs/build-all-apps-warn-no-param.log
cat .logs/buildAllApps.log | grep "warning: no @return" | sort | uniq > .logs/build-all-apps-warn-no-return.log
cat .logs/buildAllApps.log | grep "error: unknown tag:" | sort | uniq > .logs/build-all-apps-error-unknown-tag.log
cat .logs/buildAllApps.log | grep "error: exception not thrown:" | sort | uniq > .logs/build-all-apps-error-not-thrown.log
cat .logs/buildAllApps.log | grep "warning: empty" | sort | uniq > .logs/build-all-apps-warning-empty.log
cat .logs/buildAllApps.log | grep "error: reference not found" | sort | uniq > .logs/build-all-apps-error-reference-not-found.log
cat .logs/buildAllApps.log | grep ": error: bad use of '" | sort | uniq > .logs/build-all-apps-error-bad-use-of.log
cat .logs/buildAllApps.log | grep "error: semicolon missing" | sort | uniq > .logs/build-all-apps-error-semicolon-missing.log
cat .logs/buildAllApps.log | grep -v "warning: no description for" \
| grep -v "warning: no @param for" \
| grep -v "warning: no @return" \
| grep -v "error: unknown tag:" \
| grep -v "error: exception not thrown:" \
| grep -v "warning: empty" \
| grep -v "error: reference not found" \
| grep -v ": error: bad use of '" \
| grep -v "error: semicolon missing" \
> .logs/build-all-apps-others.log
# Some cleanup
rm -fr /tmp/FolderTreeBuilderTest*
rm -fr /tmp/cchlib-test-io-*
rm -fr /tmp/content*-file*-*.png*
rm -fr /tmp/dup-file*.png
rm -fr /tmp/notduplicate-*
rm -fr /tmp/part-*.png
rm -fr /tmp/testCopyURLFile*
| true
|
a00627799410907a01be9655bd9dcaeec22bf32a
|
Shell
|
razorsedge/hadoop-deployment-bash
|
/navencrypt/navencrypt_prepare.sh
|
UTF-8
| 6,158
| 4.03125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copyright Clairvoyant 2017
#
# $Id$
#
# EXIT CODE:
# 0 = success
# 1 = print_help function (or incorrect commandline)
# 2 = ERROR: Must be root.
#
if [ -n "$DEBUG" ]; then set -x; fi
#
##### START CONFIG ###################################################
##### STOP CONFIG ####################################################
PATH=/usr/bin:/usr/sbin:/bin:/sbin
FSTYPE=xfs
FSMOUNTOPT=noatime
FORCE=no
# Function to print the help screen.
print_help() {
printf 'Usage: %s --navpass <password> --device <device> --emountpoint <emountpoint> [--fstype <fstype>] [--mountoptions <options>]\n' "$1"
printf '\n'
printf ' -n|--navpass First password used to encrypt the local Navigator Encrypt configuration.\n'
printf ' -2|--navpass2 Second password used to encrypt the local Navigator Encrypt configuration. This parameter is not needed for the single-passphrase key type.\n'
printf ' -d|--device Disk device to encrypt. Device will be wiped.\n'
printf ' -e|--emountpoint Mountpoint of the encrypted filesystem.\n'
printf ' [-t|--fstype] Filesystem type. Default is xfs.\n'
printf ' [-o|--mountoptions] Filesystem mount options. Default is noatime.\n'
printf ' [-f|--force] Force wipe any existing data.\n'
printf ' [-h|--help]\n'
printf ' [-v|--version]\n'
printf '\n'
printf ' ex. %s --navpass "mypasssword" --device /dev/sdb --emountpoint /navencrypt/2\n' "$1"
exit 1
}
# Function to check for root privileges.
check_root() {
if [[ $(/usr/bin/id | awk -F= '{print $2}' | awk -F"(" '{print $1}' 2>/dev/null) -ne 0 ]]; then
printf 'You must have root privileges to run this program.\n'
exit 2
fi
}
## If the variable DEBUG is set, then turn on tracing.
## http://www.research.att.com/lists/ast-users/2003/05/msg00009.html
#if [ $DEBUG ]; then
# # This will turn on the ksh xtrace option for mainline code
# set -x
#
# # This will turn on the ksh xtrace option for all functions
# typeset +f |
# while read F junk
# do
# typeset -ft $F
# done
# unset F junk
#fi
# Process arguments.
while [[ $1 = -* ]]; do
case $1 in
-n|--navpass)
shift
NAVPASS=$1
;;
-2|--navpass2)
shift
NAVPASS2=$1
;;
-d|--device)
shift
DEVICE=$1
;;
-e|--emountpoint)
shift
# shellcheck disable=SC2001
EMOUNTPOINT=$(echo "$1" | sed -e 's|/$||')
;;
-t|--fstype)
shift
FSTYPE=$1
;;
-o|--mountoptions)
shift
FSMOUNTOPT=$1
;;
-f|--force)
FORCE=yes
;;
-h|--help)
print_help "$(basename "$0")"
;;
-v|--version)
printf '\tPrepare a device for Navigator Encrypt data encryption.\n'
exit 0
;;
*)
print_help "$(basename "$0")"
;;
esac
shift
done
echo "********************************************************************************"
echo "*** $(basename "$0")"
echo "********************************************************************************"
# Check to see if we have no parameters.
if [[ -z "$NAVPASS" ]]; then print_help "$(basename "$0")"; fi
if [[ -z "$DEVICE" ]]; then print_help "$(basename "$0")"; fi
if [[ -z "$EMOUNTPOINT" ]]; then print_help "$(basename "$0")"; fi
# Let's not bother continuing unless we have the privs to do something.
check_root
# main
set -u
umask 022
if [ -f /etc/navencrypt/keytrustee/clientname ]; then
# Check to make sure we do not wipe a LVM.
if ! echo "$DEVICE" | grep -qE '^/dev/sd|^/dev/xvd' ;then
echo "** ERROR: ${DEVICE} is not an sd device. Exiting..."
exit 7
fi
if [ -b "$DEVICE" ]; then
# Is there a partition?
if [ -b "${DEVICE}1" ]; then
echo "** Device ${DEVICE} is already partitioned."
PART="1"
elif [ -b "${DEVICE}p1" ]; then
echo "** Device ${DEVICE} is already partitioned."
PART="p1"
else
echo "** Device ${DEVICE} is not partitioned."
if ! rpm -q parted >/dev/null 2>&1; then
echo "** Installing parted. Please wait..."
yum -y -d1 -e1 install parted
fi
SIZE=$(lsblk --all --bytes --list --output NAME,SIZE,TYPE "$DEVICE" | awk '/disk$/{print $2}')
if [ "$SIZE" -ge 2199023255552 ]; then
parted --script "$DEVICE" mklabel gpt mkpart primary "$FSTYPE" 1049kB 100%
else
parted --script "$DEVICE" mklabel msdos mkpart primary "$FSTYPE" 1049kB 100%
fi
sleep 2
if [ -b "${DEVICE}1" ]; then
PART="1"
elif [ -b "${DEVICE}p1" ]; then
PART="p1"
else
echo "** ERROR: Device ${DEVICE} partitioning failed. Exiting..."
exit 5
fi
fi
echo "** Preparing ${DEVICE} for encryption..."
if [ "$FORCE" == yes ]; then
dd if=/dev/zero of="${DEVICE}${PART}" ibs=1M count=1
fi
# shellcheck disable=SC2174
mkdir -p -m 0755 "$(dirname "$EMOUNTPOINT")"
# shellcheck disable=SC2174
mkdir -p -m 0755 "$EMOUNTPOINT" && \
chattr +i "$EMOUNTPOINT" && \
printf -v NAVPASS_ANSWERS '%s\n%s' "$NAVPASS" "$NAVPASS2" && \
echo "$NAVPASS_ANSWERS" |
navencrypt-prepare -t "$FSTYPE" -o "$FSMOUNTOPT" --use-uuid "${DEVICE}${PART}" "$EMOUNTPOINT" -
RETVAL=$?
if [ "$RETVAL" -ne 0 ]; then
echo "** ERROR: Could not format ${DEVICE} for ${EMOUNTPOINT}."
exit $RETVAL
fi
else
echo "** ERROR: Device ${DEVICE} does not exist. Exiting..."
exit 4
fi
else
echo "** WARNING: This host is not yet registered. Skipping..."
exit 3
fi
| true
|
0eb02fa88e2aa1c0a8c4c1b9b6122cc32a411133
|
Shell
|
jenkins-x/jx
|
/hack/linter.sh
|
UTF-8
| 451
| 3.359375
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
set -e -o pipefail
if [ "$DISABLE_LINTER" == "true" ]
then
exit 0
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
linterVersion="$(golangci-lint --version | awk '{print $4}')"
expectedLinterVersion=1.50.1
if [ "${linterVersion}" != "${expectedLinterVersion}" ]; then
echo "Install GolangCI-Lint version ${expectedLinterVersion}"
exit 1
fi
export GO111MODULE=on
golangci-lint run \
--verbose \
--build-tags build
| true
|
e96b4ea9bab279fdb162db081dd8976e28dbaa33
|
Shell
|
guy-mograbi-at-gigaspaces/cloudify-widget
|
/test/src/main/scripts/run-test.sh
|
UTF-8
| 314
| 2.671875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/sh
# install maven
id=$1
cd /root/play-2.0.4/cloudify-widget
play $* -Dconfig.file=conf/prod.conf run &
url=http://localhost:9000
while ! wget --spider $url 2>&1 | grep --quiet "200 OK"; do sleep 1; echo waiting for site...; done;
#start the tests
cd /root/play-2.0.4/cloudify-widget/test
mvn test -U -X
| true
|
f88129d6beb8345af4140ff845c2d3e361c84a74
|
Shell
|
dlamber7/android_device_motorola_cliq2
|
/bootmenu/recovery/sbin/postrecoveryboot.sh
|
UTF-8
| 471
| 2.75
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/sbin/sh
sleep 5
for i in $(seq 1 10)
do
TMP=$(mount | grep /tmp)
if [ -z "$TMP" ]
then
break
fi
umount -l /tmp
sleep 1
done
busybox mount -orw,remount /
rm -r /tmp
mkdir -p /tmp
rm sdcard
mkdir sdcard
# Restart with root hacked adbd
mount -orw,remount /
busybox kill $(busybox ps | busybox grep adbd)
echo msc_adb > /dev/usb_device_mode
touch /tmp/recovery.log
sync
/sbin/adbd &
sleep 1
umount -l /system
#/sbin/adbd recovery &
| true
|
bc8aa23cda8e91f4512dba8c05e8a8d3081e56f1
|
Shell
|
postgrespro/testgres
|
/publish_package.sh
|
UTF-8
| 347
| 2.703125
| 3
|
[
"PostgreSQL"
] |
permissive
|
#!/usr/bin/env bash
set -eux
# prepare environment
venv_path=.venv
rm -rf "$venv_path"
virtualenv "$venv_path"
export VIRTUAL_ENV_DISABLE_PROMPT=1
. "$venv_path"/bin/activate
# install utilities
pip3 install setuptools twine
# create distribution of the package
python3 setup.py sdist bdist_wheel
# upload dist
twine upload dist/*
set +eux
| true
|
4176c65bfa236a964d8d30b3a1be355fe2c557ee
|
Shell
|
mobilemindtec/j2objc-unit
|
/share/j2objc-compile.sh
|
UTF-8
| 1,174
| 3.3125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
BUILD="./build/j2objc"
rm -rf $BUILD
mkdir -p $BUILD/{java,objc,bin}
find "./src/main" -name '*.java' -type f -exec cp {} "$BUILD/java/" \;
find "./src/main" -type f -name 'packages.properties' -exec cat {} + >> "$BUILD/java/packages.properties" ;
CLASS_PATH="./src/main/java:"
for f in $BUILD/java/*.java; do
FILE_NAME=`basename $f`
NAME=${FILE_NAME//".java"/""}
FILE_M="${NAME}.m"
echo "** j2objc compile $FILE_NAME"
j2objc -d $BUILD/objc \
-sourcepath "$BUILD/java/**.java" \
-classpath $CLASS_PATH \
--prefixes $BUILD/java/packages.properties \
--swift-friendly \
--no-segmented-headers \
-use-arc \
--nullability \
--no-package-directories $f
#--verbose \
done
## prepare and copy ios sources to pod project
APP_IOS_SOURCES=../ios/J2ObjCUnit/Classes
rm -R $APP_IOS_SOURCES/*
cp ../ios/src/* $APP_IOS_SOURCES/
cp $BUILD/objc/* $APP_IOS_SOURCES/
#APP_SHARE_DEF_HEADER=$APP_IOS_SOURCES/J2ObjCUnit.h
#
#for f in $APP_IOS_SOURCES/*.h; do
# FILE_NAME=`basename $f`
#
# if [ $FILE_NAME == "J2ObjCUnit.h" ]; then
# continue
# fi
#
# echo "#include \"$FILE_NAME\"" >> $APP_SHARE_DEF_HEADER
#done
| true
|
28a39c8c60a961fadc6c0545bde4a3542c3fca07
|
Shell
|
leinefran/system_engineering-devops
|
/0x04-loops_conditions_and_parsing/3-until_holberton_school
|
UTF-8
| 174
| 3.453125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
# a Bash script that displays Holberton School 10 times using a until loop.
count=0
until [ $count -eq 10 ]
do
echo "Holberton School"
((count++))
done
| true
|
c8fa78cd2e82d2573326cc5795afad1eaf845333
|
Shell
|
uk0/mongo-install
|
/systemctls/init/2-initRS.sh
|
UTF-8
| 1,380
| 2.9375
| 3
|
[] |
no_license
|
#!/bin/bash
############
# init rsX #
############
###########################获取集群节点数量############
source MONGO_PACKAGE_PATH/env/env.sh
##########################根据分片倍数创建MongoDB分片,并写入fstab##
for((i=0;i<$TD_MDB_SHARD_GROUD_NUM;i++))
do
for((j=1;j<=$TD_NODE_COUNT;j++))
do
let increment_rs=$i*$TD_NODE_COUNT
let rs_num=$rs_num+1
let port_num=27018+$rs_num
let current_rs=$j
let left_rs=$current_rs-1
let right_rs=$current_rs+1
let max_rs=$TD_NODE_COUNT
if [ $left_rs -eq 0 ] || [ $left_rs -eq $increment_rs ];
then
let left_rs=$TD_NODE_COUNT
elif [ $right_rs -gt $max_rs ];
then
let right_rs=1
fi
echo -e "\033[33m-----------$MONGO_HOME/bin/mongo mongo_host$j:$port_num----------- \033[0m"
$MONGO_HOME/bin/mongo mongo_host$j:$port_num <<EOF
config={_id:"TOD-Shard-$rs_num",
members:[
{_id:0,host:"mongo_host$current_rs:$port_num",priority:2},
{_id:1,host:"mongo_host$left_rs:$port_num"},
{_id:2,host:"mongo_host$right_rs:$port_num"}],
settings:{getLastErrorDefaults:{w:"majority",wtimeout:5000}}};
rs.initiate(config);
exit;
EOF
done
done
| true
|
f0cf88daaf903424033bc0bec5e077aea6099280
|
Shell
|
ryancj14/fpga-tool-perf
|
/utils/conda.sh
|
UTF-8
| 1,040
| 3.328125
| 3
|
[
"ISC"
] |
permissive
|
#!/bin/bash
#
# Copyright (C) 2020 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
export CONDA_DIR=$(pwd)/env/conda
export PATH=$CONDA_DIR/bin:${PATH}
(
if [[ ! -e ${CONDA_DIR}/bin/conda ]]; then
cd env && \
wget --no-verbose --continue https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod a+x Miniconda3-latest-Linux-x86_64.sh
(
export HOME=$CONDA_DIR
./Miniconda3-latest-Linux-x86_64.sh -p $CONDA_DIR -b -f || exit 1
)
conda config --system --add envs_dirs $CONDA_DIR/envs
conda config --system --add pkgs_dirs $CONDA_DIR/pkgs
fi
conda config --system --set always_yes yes
conda config --system --set changeps1 no
conda update -q conda
conda env create --file ../conf/environment.yml
conda init bash
source ~/.bashrc
conda info -a
)
| true
|
2422df78257ac2e2c469fa948b29bc0e2b9b670b
|
Shell
|
zarkone/bash-turing-machine
|
/turing.sh
|
UTF-8
| 5,070
| 3.578125
| 4
|
[] |
no_license
|
#!/bin/bash
#turing.sh V0.21
# This is an turing machine implemented in Bash.
if [ -z "$1" ]; then
echo "You should specify an input file!" 1>&2
exit 1
fi
oldIFS=$IFS
state=0
line=0
endless=1
bandwidth=79
pos=0
alpha[0]=" "
alpha[1]="1"
alpha[2]="0"
alphasize=2
#Init Band
IFS=$'\n'
echo "# opening: $1"
for l in $(cat $1 |sed "s/\#.*//g"|sed "/^\s*$/d"|sed "s/^\s*//g"|sed "s/\s*$//g")
do
p=0
cor=0
((line+=1))
echo -n "$line: "
echo $l>&2
case ${l:0:1} in
"<"|"I")
it=""
for i in `seq 2 ${#l}`; do
c=${l:(($i-1)):1}
cok=0
for j in $(seq 0 $alphasize)
do
if [ "$cok" -eq "0" ]; then
if [ "$c" == "${alpha[$j]}" ]; then
cok=1
fi
fi
done
if [ "$cok" == "1" ]; then
band[(($p-$cor))]=$c
it="$it$c"
else
echo "# Ignoring character '$c' @$line:$pos." >&2
((cor+=1))
fi
((p+=1))
done
echo "# (I@ 0) $it">&2
;;
"!"|"S")
state=${l:1}
echo "# S: $state"
;;
"."|"P")
pos=${l:1}
echo "# P: $pos"
;;
"L")
bandwidth=$((${l:1}-1))
echo "# L: $bandwidth"
;;
"@"|"A")
p=1
al=""
alphasize=$((${#l}-1))
for i in $(seq 2 ${#l})
do
c=${l:(($i-1)):1}
alpha[$p]=$c
al="$al$c"
((p+=1))
done
echo "# A: $al ($alphasize symbols)"
;;
*)
IFS=","
a=($l)
count=0
while [ -n "${a[$count]}" ]
do
((count+=1))
done
if [ "$count" -ne "5" ]; then
echo "# Missformed Statedescription @$line -- ignoring (program will not work properly)" >&2
echo "# Statedescribtion looks like: State,Symbol expected,Symbol to write,Headdirection,Next State">&2
else
stat="${a[0]}"
expect="${a[1]}"
write="${a[2]}"
move="${a[3]}"
next="${a[4]}"
#echo "# State: $stat"
#echo "# expecting: $expect"
#echo "# write: $write"
#echo "# move to: $move"
#echo "# next state: $next"
if [ "$next" == "F" ]; then
endless=0
fi
index=$(($stat*($alphasize+1)))
#case $expect in
# # " "->((index+=0))->dumm
# "0")
# ((index+=1))
# ;;
# "1")
# ((index+=2))
# ;;
#esac
ok=0
off=0
wok=0
#echo $alphasize
IFS=$oldIFS#$"\n"
for i in $(seq 0 $alphasize)
do
#echo "\$i=\"$i\""
#echo "\$alpha[$i]=${alpha[$i]}"
if [ "$ok" -ne "1" ]; then
if [ "$expect" == "" -o "$expect" == "${alpha[$i]}" ]; then
((index+=$off))
ok=1
fi
fi
if [ "$wok" -eq "0" ]; then
if [ "${alpha[$i]}"=="$write" ]; then
wok=1
fi
fi
((off+=1))
done
if [ "$ok" -eq "0" ]; then
echo "# Unspecified symbol '$expect' expected @$line">&2
exit 1
fi
if [ "$wok" -eq "0" ]; then
echo "# Should write unspecified symbol '$write' @$line">&2
exit 1
fi
eval "states_write[$index]=\"$write\""
eval "states_move[$index]=\"$move\""
eval "states_next[$index]=\"$next\""
fi
IFS=$oldIFS
esac
done
echo P: $pos
if [ "$endless" -eq "1" ]; then
echo -n "## This seems to be an endless turing machine. Do you realy want to start it? [y/N] ">&2
read -n 1 ant
echo >&2
if [ "$ant" != "y" ]; then
exit 0
fi
fi
echo $state
cycles=0
until [ "$state" == "F" ]
do
((cycles+=1))
echo -n "# ($state@$(echo $cycles|gawk '{ printf "%5d\n", $1 }')) "
for i in $(seq 0 $bandwidth)
do
if [ "$i" -eq "$pos" ]; then
echo -n "_${band[$i]}_"
else
echo -n "${band[$i]}"
fi
done
echo
#Read
data=${band[$pos]}
#echo "$state*($alphasize+1)"
index=$(($state*($alphasize+1)))
ok=0
off=0
IFS=$oldIFS
#echo "# Data: $data@$pos"
for i in $(seq 0 $alphasize)
do
if [ "$ok" -ne "1" ]; then
#echo "\"$data\"==\"${alpha[$i]}\""
if [ "$data" == "" -o "$data" == "${alpha[$i]}" ]; then
#echo "# Found ${alpha[$i]}@$i+$off"
((index+=$off))
ok=1
fi
fi
((off+=1))
done
if [ "$ok" -eq "0" ]; then
echo "# Unspecified symbol '$data'!">&2
exit 1;
fi
#case $data in
# "0")
# ((index+=1))
# ;;
# "1")
# ((index+=2))
# ;;
#esac
#Write
#echo "## Writing: ${states_write[$index]}@$index"
if [ -z "${states_write[$index]}" ]; then
echo "## State: ($state,$data) is not defined! Halted.">&2
exit 1
fi
band[$pos]=${states_write[$index]}
#Move Head
case ${states_move[$index]} in
"<")
((pos-=1))
;;
">")
((pos+=1))
;;
esac
if [ "$pos" -lt "0" ]; then
#pos=$bandwidth
pos=0
for (( i=bandwidth-1;i>0;i-- ))
do
band[i]="${band[$i-1]}"
done
band[0]=" "
fi
# if [ "$pos" -gt "$bandwidth" ]; then
# pos=0
# fi
#jump to next state
#echo "$index: ${states_next[$index]}"
state=${states_next[$index]}
if [ "$state" == "F" ]; then
((cycles+=1))
echo -n "# ($state@$(echo $cycles|gawk '{printf "%5d",$1}')) ">&2
for i in $(seq 0 $bandwidth)
do
echo -n "${band[$i]}">&2
done
echo>&2
echo "# Reached final state. Needed $cycles cycles">&2
fi
#t=$(($state * ($alphasize+1)))
#for i in $(seq 0 $alphasize)
#do
# if [ -z "${states_write[$(($t+$i))]}" ]; then
# echo "## State '$state' is not well defined!">&2
# exit 1;
# fi
#done
done
echo "### END ###"
exit 0
| true
|
416fc7708988551e66f06b78564fcc73b4ea2e96
|
Shell
|
xjdr/bootstrap-dev
|
/bootstrap_vim.sh
|
UTF-8
| 780
| 2.75
| 3
|
[] |
no_license
|
#!/bin/bash
INSTALL_ROOT=$HOME/Vim
mkdir $INSTALL_ROOT
pushd $INSTALL_ROOT
curl ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2 -O
tar xvf vim-7.4.tar.bz2
pushd vim74
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-perlinterp \
--enable-luainterp \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=$INSTALL_ROOT
make VIMRUNTIMEDIR=$INSTALL_ROOT/share/vim/vim74
make install
popd
rm -rf vim74
rm -rf vim-7.4.tar.bz2
popd
METAPATH=$INSTALL_ROOT/bin
echo Add the following line to the end of your .bashrc:
echo VIM_HOME=$METAPATH
| true
|
9a3997dca2c0c985363de143354684c278fcb965
|
Shell
|
nindate/openstack
|
/juno/aio/9-juno-aio-install-ceilometer.sh
|
UTF-8
| 9,372
| 2.890625
| 3
|
[] |
no_license
|
#!/bin/bash -ex
source config.cfg
## Configuring Ceilometer
echo "########## Configuring Ceilometer ##########"
# Install mongodb packages
echo "########## Installing mongodb ##########"
apt-get install -y mongodb-server mongodb-clients python-pymongo
crudini --set /etc/mongodb.conf '' bind_ip $MANAGEMENT
crudini --set /etc/mongodb.conf '' smallfiles True
# Remove initial journal files as we have changed the journalling config above
service mongodb stop
if [[ $(ls /var/lib/mongodb/journal/prealloc.* >/dev/null 2>&1 | wc -l) != 0 ]] ; then
rm /var/lib/mongodb/journal/prealloc.*
fi
service mongodb start
service mongodb restart
# Sleep for service to restart
sleep 10
CMD="mongo --host $MANAGEMENT --eval 'db = db.getSiblingDB(\"ceilometer\"); db.addUser({user: \"ceilometer\", pwd: \"$MYSQL_PASS\", roles: [ \"readWrite\", \"dbAdmin\" ]})'"
eval $CMD
echo "########## CREATING ceilometer service credentials and endpoint ##########"
export OS_SERVICE_TOKEN="$TOKEN_PASS"
export OS_SERVICE_ENDPOINT="http://$MANAGEMENT:35357/v2.0"
export SERVICE_ENDPOINT="http://$MANAGEMENT:35357/v2.0"
get_id () {
echo `$@ | awk '/ id / { print $4 }'`
}
CEILOMETER_USER=$(get_id keystone user-create --name=ceilometer --pass="$SERVICE_PASSWORD" --email=heat@example.com)
keystone user-role-add --tenant $SERVICE_TENANT_NAME --user ceilometer --role $ADMIN_ROLE_NAME
keystone user-role-add --tenant $SERVICE_TENANT_NAME --user ceilometer --role $(keystone role-list | awk '/ResellerAdmin/' | awk '{print $2}')
echo "########## CREATING CEILOMETER SERVICE ##########"
keystone service-create --name ceilometer --type metering --description "Telemetry"
echo "########## CREATING CEILOMETER ENDPOINT ##########"
keystone endpoint-create \
--service-id $(keystone service-list | awk '/ metering / {print $2}') \
--publicurl http://$MANAGEMENT:8777 \
--internalurl http://$MANAGEMENT:8777 \
--adminurl http://$MANAGEMENT:8777 \
--region regionOne
# Install packages
echo "########## Installing packages ##########"
apt-get install -y ceilometer-api ceilometer-collector ceilometer-agent-central \
ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier \
python-ceilometerclient
echo "########## Updating config ##########"
crudini --set /etc/ceilometer/ceilometer.conf database connection mongodb://ceilometer:$MYSQL_PASS@$MANAGEMENT:27017/ceilometer
crudini --set /etc/ceilometer/ceilometer.conf '' rpc_backend rabbit
crudini --set /etc/ceilometer/ceilometer.conf '' rabbit_host $MANAGEMENT
crudini --set /etc/ceilometer/ceilometer.conf '' rabbit_password $RABBIT_PASS
crudini --set /etc/ceilometer/ceilometer.conf '' auth_strategy keystone
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_uri http://$MANAGEMENT:5000/v2.0
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken identity_uri http://$MANAGEMENT:35357
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken admin_tenant_name service
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken admin_user ceilometer
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken admin_password $SERVICE_PASSWORD
crudini --del /etc/ceilometer/ceilometer.conf keystone_authtoken auth_host
crudini --del /etc/ceilometer/ceilometer.conf keystone_authtoken auth_port
crudini --del /etc/ceilometer/ceilometer.conf keystone_authtoken auth_protocol
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_auth_url http://$MANAGEMENT:5000/v2.0
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_username ceilometer
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_tenant_name service
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_password $SERVICE_PASSWORD
crudini --set /etc/ceilometer/ceilometer.conf publisher metering_secret $METERING_SECRET
crudini --set /etc/ceilometer/ceilometer.conf '' verbose True
sed -i -e 's/interval: 600/interval: 60/g' /etc/ceilometer/pipeline.yaml
echo "########## Restarting services ##########"
service ceilometer-agent-central restart
service ceilometer-agent-notification restart
service ceilometer-api restart
service ceilometer-collector restart
service ceilometer-alarm-evaluator restart
service ceilometer-alarm-notifier restart
# Configure the compute service
echo "########## Configure the compute service ##########"
apt-get install -y ceilometer-agent-compute
echo "########## Updating config ##########"
crudini --set /etc/ceilometer/ceilometer.conf publisher metering_secret openstack
crudini --set /etc/ceilometer/ceilometer.conf '' rabbit_host $MANAGEMENT
crudini --set /etc/ceilometer/ceilometer.conf '' rabbit_password $RABBIT_PASS
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken auth_uri http://$MANAGEMENT:5000/v2.0
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken identity_uri http://$MANAGEMENT:35357
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken admin_tenant_name service
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken admin_user ceilometer
crudini --set /etc/ceilometer/ceilometer.conf keystone_authtoken admin_password $SERVICE_PASSWORD
crudini --del /etc/ceilometer/ceilometer.conf keystone_authtoken auth_host
crudini --del /etc/ceilometer/ceilometer.conf keystone_authtoken auth_port
crudini --del /etc/ceilometer/ceilometer.conf keystone_authtoken auth_protocol
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_auth_url http://$MANAGEMENT:5000/v2.0
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_username ceilometer
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_tenant_name service
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_password $SERVICE_PASSWORD
crudini --set /etc/ceilometer/ceilometer.conf service_credentials os_region_name regionOne
crudini --set /etc/ceilometer/ceilometer.conf '' verbose True
crudini --set /etc/nova/nova.conf '' instance_usage_audit True
crudini --set /etc/nova/nova.conf '' instance_usage_audit_period hour
crudini --set /etc/nova/nova.conf '' notify_on_state_change vm_and_task_state
crudini --set /etc/nova/nova.conf '' notification_driver messagingv2
echo "########## Restarting services ##########"
service ceilometer-agent-compute restart
service nova-compute restart
# Configure Image service
echo "########## Configure Image service ##########"
echo "########## Updating config ##########"
crudini --set /etc/glance/glance-api.conf '' notification_driver messagingv2
crudini --set /etc/glance/glance-api.conf '' rpc_backend rabbit
crudini --set /etc/glance/glance-api.conf '' rabbit_host $MANAGEMENT
crudini --set /etc/glance/glance-api.conf '' rabbit_password $RABBIT_PASS
crudini --set /etc/glance/glance-registry.conf '' notification_driver messagingv2
crudini --set /etc/glance/glance-registry.conf '' rpc_backend rabbit
crudini --set /etc/glance/glance-registry.conf '' rabbit_host $MANAGEMENT
crudini --set /etc/glance/glance-registry.conf '' rabbit_password $RABBIT_PASS
echo "########## Restarting services ##########"
service glance-registry restart
service glance-api restart
# Configure Block Storage service
echo "########## Updating config ##########"
crudini --set /etc/cinder/cinder.conf '' control_exchange cinder
crudini --set /etc/cinder/cinder.conf '' notification_driver messagingv2
# Restart the Block Storage services on the controller node
echo "########## Restarting services ##########"
service cinder-api restart
service cinder-scheduler restart
# Restart the Block Storage services on the storage nodes
service cinder-volume restart
# Configure the Object Storage service
echo "########## Configure the Object Storage service ##########"
# Update proxy server
EXISTING_OPERATOR_ROLES=$(crudini --get /etc/swift/proxy-server.conf filter:keystoneauth operator_roles)
if [[ $(echo $EXISTING_OPERATOR_ROLES | grep ResellerAdmin | wc -l) = 0 ]] ; then
NEW_OPERATOR_ROLES=${EXISTING_OPERATOR_ROLES}",ResellerAdmin"
crudini --set /etc/swift/proxy-server.conf filter:keystoneauth operator_roles $NEW_OPERATOR_ROLES
fi
echo "########## Updating config ##########"
crudini --set /etc/swift/proxy-server.conf pipeline:main pipeline "authtoken cache healthcheck keystoneauth proxy-logging ceilometer proxy-server"
crudini --set /etc/swift/proxy-server.conf filter:ceilometer use "egg:ceilometer#swift"
crudini --set /etc/swift/proxy-server.conf filter:ceilometer log_level WARN
# Add user ceilometer to group swift
usermod -a -G ceilometer swift
# Faced this issue of swift-proxy not being able to start as it did not have permissions on /var/log/ceilometer to create a log file
# Hence adding below lines
chgrp ceilometer /var/log/ceilometer
chmod g+w /var/log/ceilometer
# Restart swift-proxy
echo "########## Restarting swift-proxy ##########"
service swift-proxy restart
# Configure the Object Storage service
echo "########## Configure the Object Storage service ##########"
echo "########## Updating config ##########"
crudini --set /etc/neutron/neutron.conf '' notification_driver messagingv2
echo "########## Restarting neutron services ##########"
service neutron-server restart
service neutron-dhcp-agent restart
service neutron-l3-agent restart
service neutron-metadata-agent restart
service neutron-plugin-openvswitch-agent restart
| true
|
55f4acf2002d32492bcefb58def6efb513104912
|
Shell
|
caruccio/openshift-elasticsearch
|
/bin/install
|
UTF-8
| 113
| 3.0625
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash -eu
case "$1" in
-v|--version)
version="$2"
esac
# Copy version specific files
shopt -s dotglob
| true
|
518f7fd2554925bd2dd41e922b2f662b94079dad
|
Shell
|
DamianZaremba/ClueServices
|
/rebuild_and_run.sh
|
UTF-8
| 524
| 3.09375
| 3
|
[] |
no_license
|
#!/bin/bash
CONFIG_FILE="config.xml"
LIB_DIR="lib"
BUILD_DIR="build"
CS_RUN_CLASS="org.cluenet.clueservices.core.ClueServices"
# Actual paths
cd "$(dirname $0)"
BASE_DIR="$(pwd)"
CS_CONFIG_PATH="$BASE_DIR/$CONFIG_FILE"
JAVA_CPATH=$CLASSPATH""$BASE_DIR"/"$BUILD_DIR"/:"$BASE_DIR"/"$LIB_DIR"/*"
[ ! -z "$CLASSPATH" ] && JAVA_CPATH=$CLASSPATH":"$JAVA_CPATH
# Commands
CS_BUILD_COMMAND="ant"
CS_RUN_COMMAND="java -cp '$JAVA_CPATH' $CS_RUN_CLASS '$CS_CONFIG_PATH'"
# Run stuff
eval $CS_BUILD_COMMAND && eval $CS_RUN_COMMAND
| true
|
9d9858bfc79842fcc6146921a32e791b00750165
|
Shell
|
charoensri/pega-installer-ready
|
/scripts/docker-entrypoint.sh
|
UTF-8
| 8,095
| 3.5625
| 4
|
[] |
no_license
|
#!/bin/bash
set -e
pega_root="/opt/pega"
kit_root="${pega_root}/kit"
scripts_root="${kit_root}/scripts"
lib_root="${pega_root}/lib"
config_root="${pega_root}/config"
secret_root="${pega_root}/secrets"
db_username_file="${secret_root}/DB_USERNAME"
db_password_file="${secret_root}/DB_PASSWORD"
setupDatabase_properties="${config_root}/setupDatabase.properties"
prconfig="${config_root}/prconfig.xml"
prlog4j2="${config_root}/prlog4j2.xml"
prbootstrap="${config_root}/prbootstrap.properties"
postgres_conf="${config_root}/postgres.conf"
mssql_conf="${config_root}/mssql.conf"
oracledate_conf="${config_root}/oracledate.conf"
db2zos_conf="${config_root}/db2zos.conf"
udb_conf="${config_root}/udb.conf"
generate_config="${scripts_root}/generateConfig.sh"
unzipKit(){
deleteFileAfterUnzip=false
#download if URI is provided
if [ "$KIT_URL" != "" ]; then
deleteFileAfterUnzip=true
buildname=$(basename $KIT_URL)
if curl --output /dev/null --silent --head --fail $KIT_URL
then
echo "Downloading kit from url"
curl -ksSL -o ${kit_root}/$buildname ${KIT_URL}
else
echo "Unable to download kit from url"
fi
fi
#check the no of zip files
no_of_zip_files=$(ls -lr ${kit_root}/*.zip 2> /dev/null| wc -l)
if [ "$no_of_zip_files" == 0 ]
then
echo "The distribution kit is neither mounted nor downloaded through Kit url '"$KIT_URL"'. Please provide a valid distribution image"
exit 1;
elif [ "$no_of_zip_files" -gt 1 ]
then
echo "/opt/pega/kit folder should contain only one distribution image in zip format"
exit 1
else
unzip -o ${kit_root}/*.zip -d ${kit_root}
fi
#delete the file if URI is provided
if $deleteFileAfterUnzip ; then
echo "Deleting downloaded kit zip file."
rm ${kit_root}/$buildname
fi
}
# Build JDBC Driver jar path
constructJarPath(){
DRIVER_JAR_PATH=''
if [ "$JDBC_DRIVER_URI" != "" ]; then
urls=$(echo $JDBC_DRIVER_URI | tr "," "\n")
for url in $urls
do
echo "Downloading database driver: ${url}";
jarfilename=$(basename $url)
if curl --output /dev/null --silent --head --fail $url
then
curl -ksSL -o ${lib_root}/$jarfilename ${url}
else
echo "Could not download jar from ${url}"
exit 1
fi
done
fi
# construct jar_path for the jars mounted in opt/pega/lib
for source_jar in ${lib_root}/*
do
filename=$(basename "$source_jar")
ext="${filename##*.}"
if [ "$ext" = "jar" ]; then
if [ -z $DRIVER_JAR_PATH ]; then
DRIVER_JAR_PATH+="${lib_root}/${filename}"
else
DRIVER_JAR_PATH+=":${lib_root}/${filename}"
fi
fi
done
# This needs to be exported for dockerize to correctly replace JAR_PATH in template files
export DRIVER_JAR_PATH=$DRIVER_JAR_PATH
}
# Read Secrets
readSecrets() {
if [ -e "$db_username_file" ]; then
SECRET_DB_USERNAME=$(<${db_username_file})
else
SECRET_DB_USERNAME=${DB_USERNAME}
fi
if [ -e "$db_password_file" ]; then
SECRET_DB_PASSWORD=$(<${db_password_file})
else
SECRET_DB_PASSWORD=${DB_PASSWORD}
fi
if { [ "$SECRET_DB_USERNAME" == "" ] || [ "$SECRET_DB_PASSWORD" == "" ] ;} && [ ! -e "$setupDatabase_properties" ]; then
echo "DB_USERNAME and DB_PASSWORD must be specified.";
exit 1
fi
# This needs to be exported for dockerize to correctly replace USERNAME, PASSWORD in template files
export DB_USERNAME=$SECRET_DB_USERNAME
export DB_PASSWORD=$SECRET_DB_PASSWORD
}
# Mount prlog4j2 provided
mount_log4j2() {
if [ -e "$prlog4j2" ]; then
echo "Loading prlog4j2 from ${prlog4j2}...";
cp "$prlog4j2" ${scripts_root}/config
else
echo "No prlog4j2 was specified in ${prlog4j2}. Using defaults."
fi
}
# Dockerize setupDatabase.properties from template
dockerizeSetupdatabase() {
echo "Generating setupDatabase.properties from templates."
/bin/dockerize -template ${config_root}/setupDatabase.properties.tmpl:${scripts_root}/setupDatabase.properties
}
# dockerize prconfig.xml from template
dockerizePrconfig() {
echo "Generating prconfig.xml from templates."
/bin/dockerize -template ${config_root}/prconfig.xml.tmpl:${scripts_root}/prconfig.xml
}
# dockerize prbootstrap.properties from template
dockerizePrbootstrap() {
echo "Generating prbootstrap.properties from templates."
/bin/dockerize -template ${config_root}/prbootstrap.properties.tmpl:${scripts_root}/prbootstrap.properties
}
# dockerize migrateSystem.properties from template
dockerizeMigrateSystemProperties() {
echo "Generating migrateSystem.properties from templates."
/bin/dockerize -template ${config_root}/migrateSystem.properties.tmpl:${scripts_root}/migrateSystem.properties
}
# Mount provided database conf files
mount_dbconf() {
if [ -e "$mssql_conf" ] && [ "$DB_TYPE" == "mssql" ]; then
echo "Loading mssql.conf from ${mssql_conf}...";
cp "$mssql_conf" "${scripts_root}/config/mssql/mssql.conf"
elif [ -e "$postgres_conf" ] && [ "$DB_TYPE" == "postgres" ]; then
echo "Loading postgres.conf from ${postgres_conf}...";
cp "$postgres_conf" "${scripts_root}/config/postgres/postgres.conf"
elif [ -e "$oracledate_conf" ] && [ "$DB_TYPE" == "oracledate" ]; then
echo "Loading oracledate.conf from ${oracledate_conf}...";
cp "$oracledate_conf" "${scripts_root}/config/oracledate/oracledate.conf"
elif [ -e "$udb_conf" ] && [ "$DB_TYPE" == "udb" ]; then
echo "Loading udb.conf from ${udb_conf}...";
cp "$udb_conf" "${scripts_root}/config/udb/udb.conf"
elif [ -e "$db2zos_conf" ] && [ "$DB_TYPE" == "db2zos" ]; then
echo "Loading db2zos.conf from ${db2zos_conf}...";
cp "$db2zos_conf" "${scripts_root}/config/db2zos/db2zos.conf"
fi
}
generateConfig() {
generate_config_cmd="$generate_config $ACTION --resultFile result.properties"
if [ "$ACTION" == 'pre-upgrade' ]; then
generate_config_cmd="$generate_config_cmd --rulesSchema $RULES_SCHEMA"
fi
sh $generate_config_cmd
cat $scripts_root/result.properties
source $scripts_root/result.properties
# Initialize CODESET_VERSION to codeset version available in prdeploy.jar
CODESET_VERSION=$prdeploy_codeset_version
}
initializeSchemas() {
if [ "$DATA_SCHEMA" == '' ]; then
export DATA_SCHEMA=$RULES_SCHEMA
fi
if [ "$CUSTOMERDATA_SCHEMA" == '' ]; then
export CUSTOMERDATA_SCHEMA=$DATA_SCHEMA
fi
}
isActionValid() {
VALID_ACTIONS="install, upgrade, install-deploy, upgrade-deploy, pre-upgrade, post-upgrade"
if [ -n "`echo $VALID_ACTIONS | xargs -d ","| xargs -n1| grep -e \"^$ACTION$\"`" ]; then
echo "Action selected is '"$ACTION"'";
else
echo "Invalid action '"$ACTION"' passed.";
echo "Valid actions are : " $VALID_ACTIONS;
exit 1;
fi
}
echo "Checking valid action"
# Check action validation
isActionValid
if [ -z "$(ls -A /opt/pega/kit/scripts)" -a -z "$(ls -A /opt/pega/kit/archives)" -a -z "$(ls -A /opt/pega/kit/rules)" ]
then
# unzip distribution kit
unzipKit
fi
source /scripts/pega_install.sh
source /scripts/pega_upgrade.sh
source /scripts/installer_utils.sh
# intialize the jar path and secrets before mounting any config file
constructJarPath
readSecrets
# mount these files before mounting/dockerizing prconfig, prbootstrap, setupdatabase
mount_log4j2
mount_dbconf
initializeSchemas
ACTUAL_RULES_SCHEMA=$RULES_SCHEMA;
ACTUAL_DATA_SCHEMA=$DATA_SCHEMA;
ACTUAL_CUSTOMERDATA_SCHEMA=$CUSTOMERDATA_SCHEMA;
dockerizePrconfig
dockerizePrbootstrap
dockerizeSetupdatabase
# setupdatabase need to be mounted or dockerized for generateconfig to work
generateConfig
source /scripts/installer_utils.sh
if [ "$ACTION" == 'install' ] || [ "$ACTION" == 'install-deploy' ]; then
#------------------------INSTALL-------------------------------------
execute_install
elif [ "$ACTION" == 'upgrade' ] || [ "$ACTION" == 'upgrade-deploy' ]; then
#---------------------------UPGRADE----------------------------------
execute_upgrade
elif [ "$ACTION" == 'pre-upgrade' ] || [ "$ACTION" == 'post-upgrade' ]; then
do_upgrade_pre_post_actions
else
echo "Invalid action " $ACTION " passed.";
exit 1;
fi
| true
|
68fb605a8f9cd628a42246ddf6b794cf69764f06
|
Shell
|
WU-ARL/ndn-ops
|
/named-data/nfd_v0.3/NLSR_key_scripts/uci.sh
|
UTF-8
| 1,561
| 2.796875
| 3
|
[] |
no_license
|
#!/bin/bash
# point home to /var/lib/ndn/nlsr so keys will be stored there.
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-key-gen -n /ndn/edu/uci > ~nlsr/unsigned_site.cert'
# seems that now we have to set a default identity:
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-key-gen -n /ndn/edu/uci/nlsr > ~nlsr/unsigned_nlsr.cert'
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-set-default -n /ndn/edu/uci/nlsr'
# this next step must take place on UCLA where the root cert is.
# sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-cert-gen -S 201507080000 -E 201810080000 -N "UCI" -s /ndn -p /ndn/edu/uci -r /home/nlsr/uci_unsigned_site.cert > /home/nlsr/uci_site.cert'
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-key-gen -n /ndn/edu/uci/%C1.Operator/ndnops > ~nlsr/unsigned_operator.cert'
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-set-default -n /ndn/edu/uci/nlsr'
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-cert-gen -S 201507080000 -E 201810080000 -N "UCI Operator" -s /ndn/edu/uci -p /ndn/edu/uci/%C1.Operator/ndnops -r ~nlsr/unsigned_operator.cert > /etc/ndn/nlsr/keys/operator.cert'
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-key-gen -n /ndn/edu/uci/%C1.Router/ndnhub > ~nlsr/unsigned_router.cert'
sudo su - nlsr -c 'export HOME=/var/lib/ndn/nlsr/; ndnsec-cert-gen -S 201507080000 -E 201810080000 -N "UCI Router ndnhub" -s /ndn/edu/uci/%C1.Operator/ndnops -p /ndn/edu/uci/%C1.Router/ndnhub -r ~nlsr/unsigned_router.cert > /etc/ndn/nlsr/keys/router.cert'
| true
|
b3307555a92d6670a27c2ba94f29fd5a0a0a3ad1
|
Shell
|
AbhikChowdhury6/overlay
|
/data_collection/UbuntuVidcap.sh
|
UTF-8
| 270
| 2.625
| 3
|
[] |
no_license
|
#!/bin/bash
t="$(date +"%d-%m-%Y-%H-%M-%S.%N")"
productName=$2
sensorName=$1
port=$3
path="/media/chowderhat/18CE0051CE002998/"
name=$path$productName-$sensorName-$t-.h264
echo $name
ffmpeg -i /dev/video1 -r 30 -s 1920x1080 -c:v libx264 -preset ultrafast -crf 0 $name &
| true
|
32ae228a7dd0beee675ff115d680ee6ec4e33db2
|
Shell
|
2infinite/ipmi-check
|
/ipmi-check-sdr.sh
|
UTF-8
| 958
| 3.390625
| 3
|
[] |
no_license
|
#!/bin/bash
# Add to cron:
# IPMI check for sdr:
#34 9,12,15 * * 1-5 /usr/local/sbin/ipmi-check-sdr.sh
LOGDIR=/var/log/ipmi-sdr
DOMAIN="DOMAIN.local"
BLACKLIST4HOST=BLACKHOST\|OLDHOST-ilo\|BLACKHOST-ILO
TEMPFILE="/tmp/hosts-ilo"
PASS4IPMI="CHANGE"
host -l ${DOMAIN} | grep -i "\-ilo" | egrep -iv ${BLACKLIST4HOST} | awk '{print $1}' > ${TEMPFILE}
exec < ${TEMPFILE}
while read string
do
ipmitool -I lanplus -H $string -U ipmimon -P ${PASS4IPMI} sdr 2>&1 | egrep -vw ok\|disabled\|"Not Readable"\|nr >$LOGDIR/$string.new
if [ -s $LOGDIR/$string ] ; then
diff -q $LOGDIR/$string.new $LOGDIR/$string > /dev/null
if [ $? -ne 0 ] ; then
echo "diff $LOGDIR/$string.new $LOGDIR/$string:"
diff $LOGDIR/$string.new $LOGDIR/$string
fi
# Save old log with bigger size:
if [[ $(stat -c%s $LOGDIR/$string) -gt $(stat -c%s $LOGDIR/$string.new) ]]; then
mv $LOGDIR/$string $LOGDIR/$string.old
fi
fi
mv $LOGDIR/$string.new $LOGDIR/$string
done
| true
|
357e16b82b9aa1d36f4dc8c75ffb8337e6110174
|
Shell
|
MW-autocat-script/fr-MW-autocat-script
|
/catscripts/Lifestyle/Religion/Jainism/Jainism.sh
|
UTF-8
| 225
| 3.15625
| 3
|
[] |
no_license
|
#!/bin/bash
egrep -i 'Jain(|s|ism)\b' newpages.txt >> Jainism.txt
JAINISM=`stat --print=%s Jainism.txt`
if [ $JAINISM -ne 0 ];
then
export CATFILE="Jainism.txt"
export CATNAME="Jainism"
$CATEGORIZE
fi
rm Jainism.txt
| true
|
d3aa817088d857362fc5b4cf31cda3f5cdc99b0c
|
Shell
|
amwhalen/rpi-scripts
|
/cron/network_check.sh
|
UTF-8
| 1,632
| 4.46875
| 4
|
[] |
no_license
|
#!/bin/bash
# checks network connectivity and reboots if there are problems
# credit here: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=30&t=20149
# place in cron to check every two minutes:
# */2 * * * * root /path/to/network_check.sh wlan0 192.168.0.1 /opt/check_lan/stuck.fflg >/dev/null
if [ $# -lt 3 ]
then
echo "Invalid command line arguments." >&2
echo "Usage: network_check.sh <INTERFACE> <IP_TO_CHECK> <FLAG_FILE>" >&2
echo "Example: network_check.sh wlan0 192.168.0.1 /opt/check_lan/stuck.fflg" >&2
exit 1
fi
# grab options from command line
INTERFACE=$1
IP_FOR_TEST=$2
FLAG=$3
# probably don't need to change below here
PING_COUNT=1
PING="/bin/ping"
IFUP="/sbin/ifup"
IFDOWN="/sbin/ifdown --force"
# logs using logger
function logit {
logger -t "network_check" "$1"
}
# make sure flag dir exists
FLAGDIR=`dirname $FLAG`
if [ ! -d $FLAGDIR ]
then
logit "creating flag directory: $FLAGDIR"
sudo mkdir -p $FLAGDIR
fi
# ping test
$PING -c $PING_COUNT $IP_FOR_TEST > /dev/null 2> /dev/null
if [ $? -ge 1 ]
then
logit "$INTERFACE seems to be down, trying to bring it up..."
if [ -e $FLAG ]
then
logit "$INTERFACE is still down, REBOOT to recover ..."
rm -f $FLAG 2>/dev/null
sudo reboot
else
# set a flag so next time around we know it's already been down once
touch $FLAG
logit $(sudo $IFDOWN $INTERFACE)
sleep 10
logit $(sudo $IFUP $INTERFACE)
fi
else
logit "$INTERFACE is up"
rm -f $FLAG 2>/dev/null
fi
| true
|
b42eec2a75e57390aa5ccc91e3dcaf2cf74d44bd
|
Shell
|
DamienRobert/dotfiles
|
/user/config/dotfiles/.zsh/extra-zle.zsh
|
UTF-8
| 2,805
| 2.8125
| 3
|
[
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] |
permissive
|
#vim: fdm=marker
### les fonctions de Luc sont grassouilles {{{
function zle_insert-pair () {
LBUFFER="$LBUFFER$1"
RBUFFER="$2$RBUFFER"
}
function zle_insert-braces () {
zle_insert-pair '{' '}'
}
zle -N zle_insert-braces
function zle_insert-double-quotes () {
zle_insert-pair '"' '"'
}
zle -N zle_insert-double-quotes
function zle_insert-quotes () {
zle_insert-pair \' \'
}
zle -N zle_insert-quotes
function zle_insert-back-quotes () {
zle_insert-pair '`' '`'
}
zle -N zle_insert-back-quotes
function zle_insert-parentheses () {
zle_insert-pair '(' ')'
}
zle -N zle_insert-parentheses
function zle_insert-brackets () {
zle_insert-pair '[' ']'
}
zle -N zle_insert-brackets
function zle_setup-delims () {
bindkey '[' insert-brackets
bindkey '(' insert-parentheses
bindkey '`' insert-back-quotes
bindkey \' insert-quotes
bindkey '"' insert-double-quotes
bindkey '{' insert-braces
}
function zle_unset-delims () {
bindkey '[' self-insert
bindkey '(' self-insert
bindkey '`' self-insert
bindkey \' self-insert
bindkey '"' self-insert
bindkey '{' self-insert
}
zle_setup-delims
#}}}
## dircycle {{{
#### from oh-my-zsh
##
# dircycle plugin: enables cycling through the directory
# stack using Ctrl+Shift+Left/Right
function zle_insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }
zle -N zle_insert-cycledleft
bindkey "\e[1;6D" zle_insert-cycledleft
function zle_insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }
zle -N zle_insert-cycledright
bindkey "\e[1;6C" zle_insert-cycledright
#DIRSTACKSIZE=10
#setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
#### }}}
# Unbinded functions {{{
# press esc-m for inserting last typed word again (thanks to caphuso!)
zle_insert-last-typed-word() { zle insert-last-word -- 0 -1 };
zle -N zle_insert-last-typed-word;
#k# Insert last typed word
#bindkey "\em" insert-last-typed-word
## beginning-of-line OR beginning-of-buffer OR beginning of history
## by: Bart Schaefer <schaefer@brasslantern.com>, Bernhard Tittelbach
zle_beginning-or-end-of-somewhere() {
local hno=$HISTNO
if [[ ( "${LBUFFER[-1]}" == $'\n' && "${WIDGET}" == beginning-of* ) || \
( "${RBUFFER[1]}" == $'\n' && "${WIDGET}" == end-of* ) ]]; then
zle .${WIDGET:s/somewhere/buffer-or-history/} "$@"
else
zle .${WIDGET:s/somewhere/line-hist/} "$@"
if (( HISTNO != hno )); then
zle .${WIDGET:s/somewhere/buffer-or-history/} "$@"
fi
fi
}
zle -N zle_beginning-of-somewhere zle_beginning-or-end-of-somewhere
zle -N zle_end-of-somewhere zle_beginning-or-end-of-somewhere
run-fg-editor() {
zle push-input
BUFFER="fg %$EDITOR:t"
zle accept-line
}
zle -N zle_run-fg-editor
#call back the suspended editor
#}}}
| true
|
4f102c98cd60fcc6acc0d8476de2696f5ddecf20
|
Shell
|
thirtythreeforty/dotfiles
|
/bin/remove-vim-plugin
|
UTF-8
| 381
| 3.234375
| 3
|
[] |
no_license
|
#!/bin/bash
# Get real path
SCRIPTPATH="$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )"
DOTFILESDIR="$(dirname "$SCRIPTPATH")"
REPONAME="$(basename "${@}")"
REPONAME=${REPONAME%%.git}
pushd "${DOTFILESDIR}" > /dev/null
git submodule deinit -f "./vim/bundle/$REPONAME"
git rm -f "./vim/bundle/$REPONAME"
rm -rf ".git/modules/vim/bundle/$REPONAME"
popd > /dev/null
| true
|
ffb44cd1c4b0a7e9e4ce902dc83d4716daf7e61b
|
Shell
|
chahk0129/CS744-Big-Data-Systems
|
/assignment2/part2/taskB/run.sh
|
UTF-8
| 5,375
| 3.5
| 4
|
[] |
no_license
|
#!/bin/bash
## get ip address of namenode
ip_addr=$(hostname -I)
ip=(${ip_addr//" "/ })
master_ip=10.10.1.1
num_nodes="1 2 3 4"
## directory info for all nodes
node0=cs744/assignment2/part2/taskB
node1=cs744/assignment2/part2/taskB
node2=cs744/assignment2/part2/taskB
node3=cs744/assignment2/part2/taskB
## expor path for all nodes for conda path
export_cmd="export PATH=\"/users/hcha/miniconda3/bin:\$PATH\""
## create output directories
mkdir -p output;
ssh node1 mkdir -p ${node1}/output
ssh node2 mkdir -p ${node2}/output
ssh node3 mkdir -p ${node3}/output
for n in $num_nodes; do
if [[ "$n" = "1" ]]; then
## collects network stats of all nodes before execution
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
## app execution
python main.py --master-ip $master_ip --num-nodes $n --rank 0 >> output/num${n}_rank0.out
## collects network stats of all nodes after execution
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
elif [[ "$n" = "2" ]]; then
## collects network stats of all nodes before execution
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank1.stat
ssh node1 cat /proc/net/dev >> output/num${n}_rank1.stat
## app execution
python main.py --master-ip $master_ip --num-nodes $n --rank 0 >> output/num${n}_rank0.out &
ssh node1 "$export_cmd; cd ${node1}; python main.py --master-ip $master_ip --num-nodes $n --rank 1 >> output/num${n}_rank1.out"
## collects network stats of all nodes after execution
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank1.stat
ssh node1 cat /proc/net/dev >> output/num${n}_rank1.stat
elif [[ "$n" = "3" ]]; then
## collects network stats of all nodes before execution
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank1.stat
ssh node1 cat /proc/net/dev >> output/num${n}_rank1.stat
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank2.stat
ssh node2 cat /proc/net/dev >> output/num${n}_rank2.stat
## app execution
python main.py --master-ip $master_ip --num-nodes $n --rank 0 >> output/num${n}_rank0.out &
ssh node1 "$export_cmd; cd ${node1}; python main.py --master-ip $master_ip --num-nodes $n --rank 1 >> output/num${n}_rank1.out" &
ssh node2 "$export_cmd; cd ${node2}; python main.py --master-ip $master_ip --num-nodes $n --rank 2 >> output/num${n}_rank2.out"
## collects network stats of all nodes after execution
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank1.stat
ssh node1 cat /proc/net/dev >> output/num${n}_rank1.stat
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank2.stat
ssh node2 cat /proc/net/dev >> output/num${n}_rank2.stat
elif [[ "$n" = "4" ]]; then
## collects network stats of all nodes before execution
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank1.stat
ssh node1 cat /proc/net/dev >> output/num${n}_rank1.stat
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank2.stat
ssh node2 cat /proc/net/dev >> output/num${n}_rank2.stat
echo -e "---------- Network Stat. (Before) -------------" >> output/num${n}_rank3.stat
ssh node3 cat /proc/net/dev >> output/num${n}_rank3.stat
## app execution
python main.py --master-ip $master_ip --num-nodes $n --rank 0 >> output/num${n}_rank0.out &
ssh node1 "$export_cmd; cd ${node1}; python main.py --master-ip $master_ip --num-nodes $n --rank 1 >> output/num${n}_rank1.out" &
ssh node2 "$export_cmd; cd ${node2}; python main.py --master-ip $master_ip --num-nodes $n --rank 2 >> output/num${n}_rank2.out" &
ssh node3 "$export_cmd; cd ${node3}; python main.py --master-ip $master_ip --num-nodes $n --rank 3 >> output/num${n}_rank3.out"
## collects network stats of all nodes after execution
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank0.stat
cat /proc/net/dev >> output/num${n}_rank0.stat
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank1.stat
ssh node1 cat /proc/net/dev >> output/num${n}_rank1.stat
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank2.stat
ssh node2 cat /proc/net/dev >> output/num${n}_rank2.stat
echo -e "---------- Network Stat. (After) -------------" >> output/num${n}_rank3.stat
ssh node3 cat /proc/net/dev >> output/num${n}_rank3.stat
else
echo "Not supported number of nodes! (only supported up to 4)"
exit 1
fi
done
| true
|
181f48a311745601636e60a214d988556bfab431
|
Shell
|
hhwang39/EmorySleepProject
|
/RaspberryPiCodes/Test1/mount_mbient.sh
|
UTF-8
| 2,500
| 3.296875
| 3
|
[] |
no_license
|
#!/bin/bash
GPIODIR=/sys/class/gpio
function initLED(){
if [ ! -f "$GPIODIR/gpio24" ];then
echo 24 > $GPIODIR/export
echo out > $GPIODIR/gpio24/direction
echo 22 > $GPIODIR/export
echo out > $GPIODIR/gpio22/direction
echo 23 > $GPIODIR/export
echo out > $GPIODIR/gpio23/direction
fi
}
function offLED(){
echo 0 > $GPIODIR/gpio22/value
echo 0 > $GPIODIR/gpio23/value
echo 0 > $GPIODIR/gpio24/value
}
function greenLEDon(){
echo 1 > $GPIODIR/gpio22/value
}
function blueLEDon(){
echo 1 > $GPIODIR/gpio24/value
}
function redLEDon(){
echo 1 > $GPIODIR/gpio23/value
}
PROJECTHOME=/home/pi/mbientlab/Project/Test1
cd $PROJECTHOME
process=`ps -efa|grep python|grep -v grep|awk '{print $3, $2}'`
kill -9 `echo $process`
offLED
blueLEDon
if [ ! -f "/media/pi/EMORYSLP/data/deviceaddress.txt" ];then
dummy=1
else
cp /media/pi/EMORYSLP/data/deviceaddress.txt /home/pi/mbientlab/Project/Test1
cp /media/pi/EMORYSLP/data/deviceaddress.txt /home/pi/mbientlab/Project/calibration
sleep 2
rm /media/pi/EMORYSLP/data/deviceaddress.txt
fi
if [ ! -f "/media/pi/EMORYSLP/data/calibration.txt" ];then
if [ ! -f "/home/pi/mbientlab/Project/Test1/data1.db" ];then
sleep 2
umount /media/pi/EMORYSLP
offLED
else
STARTUPFILE=startdate.txt
rm $STARTUPFILE
sqlite3 -header -csv data1.db "select * from acc;" > data1.csv
resultcsv=$?
cd /home/pi/mbientlab/Project/Test1
mkdir backup
cp data1.db /home/pi/mbientlab/Project/Test1/backup
mv data1.db /media/pi/EMORYSLP/data
resultdb=$?
mv data1.*.db /media/pi/EMORYSLP/data
mv data1.csv /media/pi/EMORYSLP/data
mv excep.log /media/pi/EMORYSLP/data
cp /dev/null excep.log
umount /media/pi/EMORYSLP
resultu=$?
offLED
if [ $resultdb -eq 0 -a $resultcsv -eq 0 -a $resultu -eq 0 ];then
greenLEDon
sleep 10
offLED
else
redLEDon
sleep 10
offLED
fi
fi
else
cd /home/pi/mbientlab/Project/calibration
/home/pi/mbientlab/Project/calibration/executeConnect.sh
filename=`ls calibrationResults*.csv`
dosfilename=`echo $filename|sed -e s/://g`
mv $filename /media/pi/EMORYSLP/data/$dosfilename
resultdb=$?
cp excep.log /media/pi/EMORYSLP/data/excepCalibration.log
cp /dev/null excep.log
rm data1.db
rm /media/pi/EMORYSLP/data/calibration.txt
umount /media/pi/EMORYSLP
resultu=$?
offLED
if [ $resultdb -eq 0 -a $resultu -eq 0 ];then
greenLEDon
sleep 10
offLED
else
redLEDon
sleep 10
offLED
fi
fi
| true
|
9effae6825f9048bc04cc6e291ff6ff6905822da
|
Shell
|
dfenglei/redis_dump_restore_modify
|
/redis_dump_restore_modify.sh
|
UTF-8
| 837
| 2.921875
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
src_ip=1.2.3.62
src_port=7963
dest_ip=1.4.3.6
dest_port=7963
key_prefix=1:b4cfea8406e4456d:
i=1
redis-cli -h $src_ip -p $src_port -a Redis~123 -n 1 keys "${key_prefix}*" | while read key
do
redis-cli -h $dest_ip -p $dest_port -a Redis~123 -n 1 del ${key/b4cfea8406e4456d/93775b9324a34c08}
echo "$i migrate key $key"
redis-cli -h $src_ip -p $src_port -a Redis~123 -n 1 --raw dump $key | perl -pe 'chomp if eof'|redis-cli -h $dest_ip -p $dest_port -a Redis~123 -n 1 -x restore ${key/b4cfea8406e4456d/93775b9324a34c08} 0
echo "$modify key $key"
redis-cli -h $dest_ip -p $dest_port -a Redis~123 -n 1 hgetall ${key/b4cfea8406e4456d/93775b9324a34c08} |sed 's/b4cfea8406e4456d/93775b9324a34c08/' | tr '\n' ' ' |xargs redis-cli -h $dest_ip -p $dest_port -a Redis~123 -n 1 hmset ${key/b4cfea8406e4456d/93775b9324a34c08}
((i++))
done
| true
|
56a5d8e0f9cd7201ca01897a37607b7cb29eaa04
|
Shell
|
jrabenoit/oneoffs
|
/axial_diffusivity_creator.sh
|
UTF-8
| 145
| 2.875
| 3
|
[] |
no_license
|
#!/bin/bash
for D in */; do
(cd $D &&
L2=*_L2.nii.gz
L3=*_L3.nii.gz
RD=$(basename $D)"_RD"
fsl5.0-fslmaths $L2 -add $L3 -div 2 $RD);
done
| true
|
723d21323dffd65db1eea7e0acb60ac8228bdf7c
|
Shell
|
mtangh/dot-bashrc
|
/files/etc/bash.bashrc.d/04inputrc.sh
|
UTF-8
| 475
| 3.046875
| 3
|
[
"BSD-3-Clause"
] |
permissive
|
# ${bashrc_dir}/04inputrc.sh
# $Id$
inputrc_file=""
# Lookup inputrc file in
for inputrc_file in $( {
__pf_rc_loader -r \
{"${XDG_CONFIG_HOME:-${HOME}/.config}"/,"${HOME}"/.}inputrc \
{"${bash_local}","${bashrc_dir}"}/inputrc
} 2>/dev/null || :; )
do
[ -f "${inputrc_file}" -a -r "${inputrc_file}" ] && {
INPUTRC="${inputrc_file}" &&
break
} || :
done || :
# unset
unset inputrc_file
# Export
[ -n "${INPUTRC:-}" ] && {
export INPUTRC
} || :
# end
return 0
| true
|
ce3455c6a7fe9ff59f1448d705e2b6251a09af29
|
Shell
|
robcore/Actiontec_T3200M
|
/userspace/public/apps/wanconf/scripts/wanconf.sh
|
UTF-8
| 223
| 2.890625
| 3
|
[] |
no_license
|
#!/bin/sh
case "$1" in
start)
echo "Starting wanconf..."
/bin/wanconf
exit 0
;;
stop)
echo "Stopping wancof..."
exit 0
;;
*)
echo "Starting wanconf with no args..."
/bin/wanconf
exit 1
;;
esac
| true
|
a8e4822027980f6123afb864e6fafd6570629230
|
Shell
|
dexterchan/TreeQuery
|
/Scripts/runTreeQueryNode.sh
|
UTF-8
| 529
| 2.671875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
DOCKERIMAGE=$1
WORKDIR=$2
docker run -it --rm -v $WORKDIR:/opt/config \
-e CLUSTERCFG=treequeryCluster.templ.yaml \
-e DBCFG=DatabaseConnection.templ.yaml \
-e NODE_HOSTNAME=$NODE_HOSTNAME \
-e NODE_PORT=$NODE_PORT \
-e CLUSTERNAME=$CLUSTERNAME \
-e SERVICE_DISCOVERY_HOSTNAME=$SERVICE_DISCOVERY_HOSTNAME \
-e SERVICE_DISCOVERY_PORT=$SERVICE_DISCOVERY_PORT \
-e AWS_REGION=$AWS_S3_REGION \
-e AWS_ACCESS_KEY=$AWS_ACCESS_KEY \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-p $NODE_PORT:$NODE_PORT $DOCKERIMAGE
| true
|
38025b6dfbd987208b524732e47dc3c4b66b7c98
|
Shell
|
mingster/dotfiles
|
/install/pydata.sh
|
UTF-8
| 3,796
| 3.546875
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
# ~/pydata.sh
# Removed user's cached credentials
# This script might be run with .dots, which uses elevated privileges
sudo -K
brew uninstall --force --ignore-dependencies python python2 python2.7 python3 python3.6 > /dev/null 2>&1
brew install python@2 python@3 > /dev/null 2>&1
echo; for x in python python2 python3; do
which $x; readlink $(which $x); $x --version; echo; done
#https://www.freecodecamp.org/news/python-version-on-mac-update/
brew install pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init --path)"\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
## upgrade pip if any
python3 -m pip install --upgrade pip
###############################################################################
# Virtual Enviroments #
###############################################################################
echo "------------------------------"
echo "Setting up virtual environments."
# Install virtual environments globally
# It fails to install virtualenv if PIP_REQUIRE_VIRTUALENV was true
export PIP_REQUIRE_VIRTUALENV=false
sudo pip3 install virtualenv
sudo pip3 install virtualenvwrapper
echo "------------------------------"
echo "Source virtualenvwrapper from ~/.extra"
EXTRA_PATH=~/.extra
echo $EXTRA_PATH
echo "" >> $EXTRA_PATH
echo "" >> $EXTRA_PATH
echo "# Source virtualenvwrapper, added by pydata.sh" >> $EXTRA_PATH
echo "export WORKON_HOME=~/.virtualenvs" >> $EXTRA_PATH
echo "source /usr/local/bin/virtualenvwrapper.sh" >> $EXTRA_PATH
echo "" >> $BASH_PROFILE_PATH
source $EXTRA_PATH
###############################################################################
# Python 2 Virtual Enviroment #
###############################################################################
echo "------------------------------"
echo "Setting up py2-data virtual environment."
# Create a Python2 data environment
mkvirtualenv py2-data
workon py2-data
# Install Python data modules
pip install numpy
pip install scipy
pip install matplotlib
pip install pandas
pip install sympy
pip install nose
pip install unittest2
pip install seaborn
pip install scikit-learn
pip install "ipython[all]"
pip install bokeh
pip install Flask
pip install sqlalchemy
pip install mysql-python
###############################################################################
# Python 3 Virtual Enviroment #
###############################################################################
echo "------------------------------"
echo "Setting up py3-data virtual environment."
# Create a Python3 data environment
mkvirtualenv --python=/usr/local/bin/python3 py3-data
workon py3-data
# Install Python data modules
pip install numpy
pip install scipy
pip install matplotlib
pip install pandas
pip install sympy
pip install nose
pip install unittest2
pip install seaborn
pip install scikit-learn
pip install "ipython[all]"
pip install bokeh
pip install Flask
pip install sqlalchemy
#pip install mysql-python # Python 2 only, use mysqlclient instead
pip install mysqlclient
###############################################################################
# Install IPython Profile
###############################################################################
echo "------------------------------"
echo "Installing IPython Notebook Default Profile"
# Add the IPython profile
mkdir -p ~/.ipython
cp -r init/profile_default/ ~/.ipython/profile_default
echo "------------------------------"
echo "Script completed."
echo "Usage: workon py2-data for Python2"
echo "Usage: workon py3-data for Python3"
| true
|
f7cf2ceedd6a2ddb9603c80021adbaaaeac20db5
|
Shell
|
evilboss/cordova-actionscan
|
/run-device.sh
|
UTF-8
| 206
| 2.734375
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
if [ "$(type -t cordova)" ];
then
echo "Starting the operation"
cordova run android
else
echo "Cordova not installed in this machine please run setup.sh"
fi
| true
|
2a7df55972df7679a62e2074c8f3bbea2179f13c
|
Shell
|
oracleyue/dotfiles
|
/ArchLinux/bin/tracker_update.sh
|
UTF-8
| 1,902
| 3.96875
| 4
|
[] |
no_license
|
#!/bin/bash
# env variables
DAEMON=/usr/bin/aria2c
PID_NAME=aria2c
PID=$(ps ux | awk '/aria2c/ && !/awk/ {print $2}')
CONFIG_PATH=${HOME}/.config/aria2/aria2.conf
# check https://github.com/ngosang/trackerslist
TRACKERLIST_NAME='trackers_best.txt'
TRACKER_URL='https://raw.githubusercontent.com/ngosang/trackerslist/master/'${TRACKERLIST_NAME}
# functions
check_running() {
PID=`ps ux | awk '/aria2c/ && !/awk/ {print $2}'`
if [ -z $PID ]; then
return 1
else
return 0
fi
}
do_update() {
list=`wget -qO- $TRACKER_URL|sed '/^$/d'|perl -pe 'chop if eof'|tr "\n" ","`
if [ -z "`grep "bt-tracker" $CONFIG_PATH`" ]; then
echo -e "\nbt-tracker=${list}" >> ${CONFIG_PATH}
echo 'bt-tracker added!'
else
sed -i "s@^bt-tracker.*@bt-tracker=${list}@g" ${CONFIG_PATH}
echo 'bt-tracker updated!'
fi
RET_VAL=1
# do_restart
}
do_start() {
if check_running; then
echo "$PID_NAME (pid $PID) is already running..."
return 0
fi
$DAEMON
if check_running; then
echo "Starting $PID_NAME success"
else
echo "Starting $PID_NAME failed"
RET_VAL=1
fi
}
do_stop() {
if check_running; then
kill -9 $PID
echo "Stopping $PID_NAME success"
else
echo "$PID_NAME is stopped"
RET_VAL=1
fi
}
do_restart() {
do_stop
do_start
}
do_status() {
check_running
case $? in
0)
echo "$PID_NAME (pid $PID) is running..."
;;
1)
echo "$PID_NAME is stopped"
RET_VAL=1
;;
esac
}
# interface
if [[ $# -eq 0 ]]; then
do_update
else
case "$1" in
start|stop|restart|status|update)
do_$1
;;
*)
echo "Usage: $0 { start | stop | restart | status |update }"
RET_VAL=1
;;
esac
fi
exit $RET_VAL
| true
|
120c0c5fe9e8462ee9a79bb3288fd873907c5c88
|
Shell
|
leosilvadev/chat-js
|
/run.sh
|
UTF-8
| 431
| 3.1875
| 3
|
[] |
no_license
|
#!/bin/bash
if [ ! -d "redis" ]; then
echo "Redis not found, downloading..."
wget http://download.redis.io/releases/redis-3.2.6.tar.gz
echo "Redis downloaded successfully!"
tar xzf redis-3.2.6.tar.gz
rm redis-3.2.6.tar.gz
mv redis-3.2.6 redis
cd redis
echo "Installing Redis..."
make &> /dev/null
echo "Redis installed!"
fi
cd src
nohup redis-server &> /dev/null &
cd ../../api
./run.sh
cd ../web
./run.sh
| true
|
339c6cd4ed38df724e658bc4f9eff3f8e700b779
|
Shell
|
mikebd/dotfiles
|
/include/bashrc.d/svn.sh
|
UTF-8
| 314
| 3.140625
| 3
|
[] |
no_license
|
function svndiff
{
if [[ "$1" == "--whitespace" ]]; then
shift
else
local -r ignoreWhitespace="-x -b"
fi
if which colordiff > /dev/null 2>&1; then
svn diff $ignoreWhitespace --diff-cmd colordiff "$@" | less
else
svn diff $ignoreWhitespace "$@" | less
fi
}
| true
|
dd364efa747f61519f2841386e0295cfba224675
|
Shell
|
Shmorcho/shell_script_SAP
|
/SAPtask5/task5.sh
|
UTF-8
| 755
| 3.328125
| 3
|
[] |
no_license
|
#!/bin/bash
la[1]=hope
ra[1]=hope
do_alter(){
if [[ "$1" -le "$2" ]]
then
cat template_tmp | sed "s/@${la[$1]}@/${ra[$1]}/g" > template_t
cp template_t template_tmp
rm template_t
do_alter $(($1+1)) $2
fi
}
cp $1 variables_tmp
cp $2 template_tmp
cat variables_tmp | sed "s/=.*//g" > variables_t
cp variables_t variables_l
rm variables_t
cat variables_tmp | sed "s/.*=//g" > variables_t
cp variables_t variables_r
rm variables_t
t=1
h=1
for x in $(cat variables_l)
do
la[$t]=$x
t=$(($t+1))
done
for x in $(cat variables_r)
do
ra[$h]=$x
h=$(($h+1))
done
t=$(($t-1))
do_alter 1 $t
cp template_tmp template_final
rm variables_tmp template_tmp variables_r variables_l
#This is the same as task3.sh but uses recursion
| true
|
86b396bbfac7343b32dc02ed400c07ffd5eb0b9e
|
Shell
|
fernand/site
|
/files/2010.sh
|
UTF-8
| 430
| 3.109375
| 3
|
[] |
no_license
|
root=http://ngm.nationalgeographic.com
root2=http://www.nationalgeographic.com
loc=/ngm/photo-contest/2010/entries/wallpaper/
for week in {1..11}
do
i=1
curl $root$loc"week-"$week"/" |
awk 'BEGIN {FS="\""} {if ($2=="wallpaper_link") print $4}' |
while read line
do
curl "${root2}${line}" |
awk 'BEGIN {FS="\""} {if ($2=="download_link") print $4}' |
xargs -I % curl -o $week"-"$i".jpg" %
let i=i+1
done
done
| true
|
8eaf25ed257bed36c9998293d08be44a04bc682a
|
Shell
|
pesimon/microk8s
|
/microk8s-resources/actions/disable.storage.sh
|
UTF-8
| 469
| 3.1875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
set -e
echo "Disabling default storage"
cat "${SNAP}/actions/storage.yaml" | \
"$SNAP/bin/sed" 's@\$SNAP_COMMON@'"$SNAP_COMMON"'@g' | \
"$SNAP/kubectl" "--kubeconfig=$SNAP/client.config" delete -f -
sleep 5
echo "Storage removed"
read -p "Remove PVC storage at $SNAP_COMMON/default-storage ? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
sudo rm -rf "$SNAP_COMMON/default-storage"
echo "Storage space reclaimed"
| true
|
af3b59b8ae5d3ec52fe717ee8d0bda90384bdaa2
|
Shell
|
desertSniper87/dotfiles
|
/shell_scripts/bin/rename_extensions.sh
|
UTF-8
| 1,026
| 4.03125
| 4
|
[] |
no_license
|
#!/bin/bash
read -rp 'Old Extension: ' OLD_EXT
read -rp 'New Extension: ' NEW_EXT
if [ -z "$NEW_EXT" ] && [ -z "$OLD_EXT" ]; then
echo "Nothing to do"
exit 1
fi
if [ -z "$NEW_EXT" ];then
echo "Converting all files having *.$OLD_EXT in $(pwd) to *"
else
echo "Converting all files having *.$OLD_EXT in $(pwd) to *.$NEW_EXT"
fi
read -p "Are you sure? " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
if [ -z "$OLD_EXT" ]
then
for file in *; do
echo Renaming $file to "${file}.$NEW_EXT"
mv -- "$file" "${file}.$NEW_EXT"
done
exit 1
fi
for file in *.$OLD_EXT; do
if [ -z "$NEW_EXT" ]
then
echo Renaming $file to "${file%.$OLD_EXT}"
mv -- "$file" "${file%.$OLD_EXT}"
else
echo 'Renaming $file to "${file%.$OLD_EXT}.$NEW_EXT"'
mv -- "$file" "${file%.$OLD_EXT}.$NEW_EXT"
fi
if [ -z "$OLD_EXT" ]
then
echo Renaming $file to "${file%.$OLD_EXT}"
mv -- "$file" "${file%.$OLD_EXT}"
fi
done
| true
|
294e9281150bc5139d4ea4a6713d9e4186bd4f58
|
Shell
|
schmel/steamlink
|
/emustation.sh
|
UTF-8
| 964
| 3.25
| 3
|
[] |
no_license
|
#!/bin/sh
# Set up the home directory and paths
export APP=/home/apps/emustation
export PATH=$APP:$PATH
export LD_LIBRARY_PATH=$APP:$LD_LIBRARY_PATH
export DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/DBUS_SESSION_BUS_ADDRESS)
export SDL_GAMECONTROLLERCONFIG_FILE=/etc/controller_map.txt
# Check to see if we're already running
# This can happen if the power manager crashes and tries to restart us
PIDFILE=/var/run/emu_run.pid
if [ -f "$PIDFILE" ]; then
running=$(ps | fgrep $(cat "$PIDFILE") | fgrep "{$(basename $0)} /bin/sh")
if [ "$running" != "" ]; then
echo "$0 already running, exiting"
exit 0
fi
fi
echo $$ >"$PIDFILE"
# Shutdown the shell in case it got wedged somehow
if killall shell 2>/dev/null; then
sleep 3;
fi
# Run the shell application and launch applications
export http_proxy=""
export https_proxy=""
cd $APP
HOME="/home/apps/emustation/.home" /home/apps/emustation/emulationstation
| true
|
ac456638051237caec11ff6946a65f4ddd804f1c
|
Shell
|
deanproctor/sdc-autoscaling
|
/autoscale/lambda/autoscale
|
UTF-8
| 3,708
| 3.859375
| 4
|
[] |
no_license
|
#!/bin/bash
set -e
if [ -f "$SDC_CONF/autoscale.conf" ]; then
. $SDC_CONF/autoscale.conf
else
echo "Autoscaling settings file missing $SDC_CONF/autoscale.conf"
exit 0
fi
if [[ "$AUTOSCALING_ENABLED" != "yes" ]]; then
echo "Autoscaling configuration disabled"
exit 0
fi
if [ -z "$API_KEY" ]; then
echo "API_KEY must be specified in $SDC_CONF/autoscale.conf"
exit 1
fi
if [ -z "$API_ENDPOINT" ]; then
echo "API_ENDPOINT must be specified in $SDC_CONF/autoscale.conf"
exit 1
fi
function get_port_and_protocol {
PORT=$(grep ^https.port= ${SDC_CONF}/sdc.properties | cut -d '=' -f2)
PROTOCOL=https
if [ -z "$PORT" ] || [ "$PORT" = "-1" ]; then
PORT=$(grep ^http.port= ${SDC_CONF}/sdc.properties | cut -d '=' -f2)
PROTOCOL=http
fi
if [ -z "$PORT" ] || [ "$PORT" = "-1" ]; then
PORT=18630
fi
}
function pre_start {
if [ -s "$SDC_CONF/application-token.txt" ]; then
echo "Auth token already exists in ${SDC_CONF}/application-token.txt. SDC already registered. Exiting."
exit 0
fi
echo "Generating authentication token"
result=$(curl -s -S -X POST -d '{"action": "pre-start"}' $API_ENDPOINT -H "x-api-key: $API_KEY")
error=$(echo $result | python -mjson.tool | awk -F'"' '/error/{print $4}')
authToken=$(echo $result | python -mjson.tool | awk -F'"' '/response/{print $4}')
if [ -n "$error" ]; then
echo "Error generating authentication token: $error"
exit 1
fi
# Persist auth token
echo "${authToken}" > "${SDC_CONF}/application-token.txt"
get_port_and_protocol
base_url="${PROTOCOL}://${BASE_URL}:${PORT}"
echo "Setting sdc.base.http.url in sdc.properties to ${base_url}"
sed -i "s|#sdc.base.http.url=.*|sdc.base.http.url=${base_url}|" ${SDC_CONF}/sdc.properties
echo "Enabling Control Hub"
sed -i "s|dpm.enabled=.*|dpm.enabled=true|" ${SDC_CONF}/dpm.properties
sed -i "s|dpm.base.url=.*|dpm.base.url=${SCH_URL}|" ${SDC_CONF}/dpm.properties
}
function post_start {
get_port_and_protocol
# Wait until we see the Control Hub auth redirect
until [ $(curl -s -S --output /dev/null -k ${PROTOCOL}://${BASE_URL}:${PORT} -w "%{http_code}" 2>/dev/null) -eq 302 ]
do
sleep 5
done
sleep 10
echo "Configuring SDC in Control Hub"
SDC_ID=$(< ${SDC_DATA}/sdc.id)
result=$(curl -s -S -X POST -d "{\"action\": \"post-start\", \"sdcId\": \"${SDC_ID}\", \"labels\": \"${LABELS}\", \"groups\": \"${GROUP}\"}" $API_ENDPOINT -H "x-api-key: $API_KEY")
error=$(echo $result | python -mjson.tool | awk -F'"' '/error/{print $4}')
authToken=$(echo $result | python -mjson.tool | awk -F'"' '/response/{print $4}')
if [ -n "$error" ]; then
echo "Error configuring SDC in Control Hub: $error"
exit 1
fi
echo "$response"
}
function pre_stop {
echo "Gracefully unregistering SDC"
SDC_ID=$(< ${SDC_DATA}/sdc.id)
result=$(curl -s -S -X POST -d "{\"action\": \"pre-stop\", \"sdcId\": \"${SDC_ID}\"}" $API_ENDPOINT -H "x-api-key: $API_KEY")
error=$(echo $result | python -mjson.tool | awk -F'"' '/error/{print $4}')
authToken=$(echo $result | python -mjson.tool | awk -F'"' '/response/{print $4}')
if [ -n "$error" ]; then
echo "Error unregistering SDC: $error"
exit 1
fi
echo "$response"
echo "Disabling Control Hub locally"
> ${SDC_CONF}/application-token.txt
sed -i "s|dpm.enabled=.*|dpm.enabled=false|" ${SDC_CONF}/dpm.properties
}
if [[ "$1" = "pre_start" ]]; then
pre_start
elif [[ "$1" = "post_start" ]]; then
post_start
elif [[ "$1" = "pre_stop" ]]; then
pre_stop
fi
| true
|
1d029e0d28cdd1c3c97ba5976bb86532d6142b14
|
Shell
|
coldis-org/infrastructure-software-repository
|
/src/main/infrastructure/service/script/nexus_configure.sh
|
UTF-8
| 2,597
| 4.1875
| 4
|
[] |
no_license
|
#!/bin/sh
# Default script behavior.
set -o errexit
#set -o pipefail
# Default parameters.
DEBUG=false
DEBUG_OPT=
FORCE_CONFIGURATION=false
START_POOLING_INTERVAL=15
START_POOLING_RETRIES=20
NEXUS_SCRIPT=/opt/nexus-script
# For each argument.
while :; do
case ${1} in
# If debuf is enabled.
--debug)
DEBUG=true
DEBUG_OPT="--debug"
;;
# Force the repository to be configured.
-c|--force-configuration)
FORCE_CONFIGURATION=true
;;
# Start pooling interval.
-p|--start-pooling-interval)
START_POOLING_INTERVAL=${2}
shift
;;
# Start pooling interval.
-r|--start-pooling-retries)
START_POOLING_RETRIES=${2}
shift
;;
# No more options.
*)
break
esac
shift
done
# Using unavaialble variables should fail the script.
set -o nounset
# Enables interruption signal handling.
trap - INT TERM
# Print arguments if on debug mode.
${DEBUG} && echo "Running 'nexus_configure'"
${DEBUG} && echo "FORCE_CONFIGURATION=${FORCE_CONFIGURATION}"
${DEBUG} && echo "START_POOLING_RETRIES=${START_POOLING_RETRIES}"
# If the container has not been configured yet.
if ${FORCE_CONFIGURATION} || [ ! -f ${NEXUS_DATA}/configured.lock ]
then
# While the service is not up.
RETRY_NUMBER=0
while [ ${RETRY_NUMBER} -lt ${START_POOLING_RETRIES} ]
do
# If the service has started.
if [ "$(curl --write-out %{http_code} --silent --output /dev/null http://localhost:8081)" = "200" ]
then
# Waits a bit more.
sleep ${START_POOLING_INTERVAL}
sleep ${START_POOLING_INTERVAL}
# Configures the repositories.
${DEBUG} && echo "Repository not configured yet. Configuring..."
REPO_CONFIGURED=`nexus_run_script ${DEBUG_OPT} \
-n nexusConfigureRepositories \
-f ${NEXUS_SCRIPT}/groovy/nexusConfigureRepositories.groovy || \
echo "false"`
# If the repository has not been configured
if [ "${REPO_CONFIGURED}" = "false" ]
then
echo "Failed to configure repositories."
# If the repository has been configured
else
# Sets that the container has been configured.
echo "Repositories configured"
touch ${NEXUS_DATA}/configured.lock
fi
break
# If the service has not started.
else
${DEBUG} && echo "Service not ready. Waiting another ${START_POOLING_INTERVAL} seconds."
# Waits a bit.
sleep ${START_POOLING_INTERVAL}
fi
# Increment the retry number.
RETRY_NUMBER=$((${RETRY_NUMBER} + 1))
done
# If the service does not start,
if [ ${RETRY_NUMBER} -ge ${START_POOLING_RETRIES} ]
then
exit "Process did not start within expected interval"
fi
fi
| true
|
72fd0e88f6d721e7249812dbb86150cb5be93816
|
Shell
|
josefpaij/dotfiles
|
/.zshrc
|
UTF-8
| 851
| 3.0625
| 3
|
[] |
no_license
|
##
## Executes commands at the start of an interactive session.
##
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
unalias run-help
autoload run-help
HELPDIR=/usr/local/share/zsh/help
autoload -Uz promptinit
promptinit
prompt josefpaij
# load aliases file
if [ -f ~/.aliases ]; then . ~/.aliases; fi
# create notes path
export NOTESDIR='/Users/josefpaij/Development/Mac/notes'
bindkey '^[OA' history-beginning-search-backward
bindkey '^[OB' history-beginning-search-forward
export NVM_DIR=~/.nvm
source $NVM_DIR/nvm.sh
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
if command -v tmux>/dev/null; then
[[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux -2
fi
| true
|
13411000f20f3c830f01233df9a9f7346a584429
|
Shell
|
will-v-king/shellScriptFiles
|
/separateJSFromHTMFile
|
UTF-8
| 6,266
| 3.75
| 4
|
[
"MIT"
] |
permissive
|
#! /bin/bash -
#从.htm文件中提取javascript代码(只有一段内嵌代码时),并保存到.js/目录下同名.js文件中,然后重命名.htm为.html文件,并清除内嵌javascript代码,增加js文件引用。
LC_ALL=C
path="."
jsFolderName="js"
sourceHTMLFileType=".htm"
destinationHTMLFileType=".htm"
jsBlockStartMarkStr='<script type="text/javascript">'
jsBlockStartMarkGrepReg='<script type=\"text\/javascript\">'
jsBlockStartMarkSedReg='<script\ type=\"text\/javascript\">'
### startRegion Option
#while getopts "p:t:r:f:" optname
#do
# case "$optname" in
# "p")
# path=$OPTARG
# ;;
# "s")
# sourceHTMLFileType=$OPTARG
# ;;
# "d")
# destinationHTMLFileType=$OPTARG
# ;;
# "f")
# targetFileName=$OPTARG
# ;;
# "?")
# echo "unknown option $OPTARG"
# ;;
# ":")
# echo "No argument value for option $OPTARG"
# ;;
# *)
# ## should not occur
# echo "unknown error while processing options"
# ;;
# esac
#done
### endRegion Option
## STARTRegion LongOption
# from /usr/share/doc/util-linux/examples/getopt-parse.bash
# Note that we use `"$@"' to let each command-line parameter expand to a
# separate word. The quotes around `$@' are essential!
# We need TEMP as the `eval set --' would nuke the return value of getopt.
TEMP=`getopt -o p:s:d:j:m: --long path:,sourceHTMLFileType:,destinationHTMLFileType:,jsFolderName:,jsBlockStartMarkStr: \
-n 'example.bash' -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-p|--path) path=$2 ; shift 2 ;;
-s|--sourceHTMLFileType) sourceHTMLFileType=$2 ; shift 2 ;;
## c has an optional argument. As we are in quoted mode,
## an empty parameter will be generated if its optional
## argument is not found.
#case "$2" in
# "") echo "Option sourceHTMLFileType, no argument"; shift 2 ;;
# *) echo "Option sourceHTMLFileType, argument \`$2'"; sourceHTMLFileType=$2 ; shift 2 ;;
#esac ;;
-d|--destinationHTMLFileType) destinationHTMLFileType=$2 ; shift 2 ;;
-j|--jsFolderName) jsFolderName=$2 ; shift 2 ;;
-m|--jsBlockStartMarkStr) jsBlockStartMarkStr=$2 ; shift 2 ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
if [ 0 -ne ${#1} ];
then
echo "Remaining arguments:";
for arg do echo '--> '"\`$arg'" ; done
fi
## ENDRegion LongOption
### BEGIN TIPS
### /etc/bash_completion.d/
##function _separateJSFromHTMLFile() {
## local cur prev opts
##
## COMPREPLY=()
##
## cur="${COMP_WORDS[COMP_CWORD]}"
## prev="${COMP_WORDS[COMP_CWORD-1]}"
## opts="-h --help -f --file -o --output"
##
## if [[ ${cur} == -* ]] ; then
## COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
## return 0
## fi
##}
##complete -F _separateJSFromHTMLFile separateJSFromHTMLFile
### END TIPS
# BEGIN Tool Functions
strToGrepReg(){
local s=$1
#s=${s//\ /\\\ }
s=${s//\//\\\/}
s=${s//\"/\\\"}
echo ${s}
}
strToSedReg(){
local s=$1
#s=${s//\ /\\\ }
s=${s//\//\\\/}
s=${s//\"/\\\"}
echo ${s}
}
# END Tool Functions
# pre-format parameters
path=${path%\/}"/"
jsFolderName=${jsFolderName%%\/*}
echo "path: "$path
echo "js folder name: "$jsFolderName
jsBlockStartMarkGrepReg=$(strToGrepReg "${jsBlockStartMarkStr}")
jsBlockStartMarkSedReg=$(strToSedReg "${jsBlockStartMarkStr}")
echo "jsBlockStartMarkGrepReg "$jsBlockStartMarkGrepReg
echo "jsBlockStartMarkSedReg "$jsBlockStartMarkSedReg
successNum=0
failureNum=0
for fileName in $(grep "${jsBlockStartMarkGrepReg}" -rl --exclude=*.git* --exclude=*.svn* --exclude=*.swp --include=*${sourceHTMLFileType} ${path})
do
echo ">>--------------------------"
#pre-deal $fileName
fileName=${fileName#${path}}
echo "Found ${sourceHTMLFileType} file: ${fileName}"
if [ -w ${path}${fileName} ]
then
dos2unix -q ${path}${fileName}
else
echo "You don't have permission to modify this file( ${fileName} )";
echo "-------------------------<<";
let "failureNum=${failureNum}+1";
continue;
fi
#create folder for .js file
if [ -d ${path}${jsFolderName} ]
then
echo "Found directory: ${jsFolderName} in path: ${path}";
else
mkdir -p ${path}${jsFolderName};
echo "Made directory: ${jsFolderName} in path: ${path}";
fi
jsFileName=${fileName##*/}
jsFileName=${jsFileName%${sourceHTMLFileType##*.}}"js"
#copy javascript code from htm file and write to js file.
jsFileDir=${path}${jsFolderName}"/"${jsFileName}
#sed -n -e "/<script\ type=\"text\/javascript\">/,/<\/script>/w ${jsFileDir}" ${path}${fileName}
sed -n -e "/${jsBlockStartMarkSedReg}/,/<\/script>/w ${jsFileDir}" ${path}${fileName}
dos2unix -q ${jsFileDir}
#sed -i -e "/<script\ type=\"text\/javascript\">$/d" -e "/<\/script>$/d" ${jsFileDir}
sed -i -e "/${jsBlockStartMarkSedReg}$/d" -e "/<\/script>$/d" ${jsFileDir}
echo ".js file:"${jsFileDir}" is created."
#rename htm file
sourceFileDir=${path}${fileName}
destFileDir=${path}${fileName%${sourceHTMLFileType##*.}}${destinationHTMLFileType##*.}
if [ ${destFileDir} != ${sourceFileDir} ]
then
mv -i ${sourceFileDir} ${destFileDir}
fi
if [ -f ${sourceFileDir} ]
then
echo "${sourceFileDir} is not renamed.";
elif [ -f ${destFileDir} ]
then
echo "${sourceFileDir} is renamed as ${destFileDir}";
fileName=${fileName%${sourceHTMLFileType##*.}}${destinationHTMLFileType##*.};
else
echo "${sourceFileDir} lost!";
fi
#rm javascript code from html file
regStr='\t<script type="text/javascript" src="'${jsFolderName}'/'${jsFileName}'"></script>\n</head>'
regStr=$(strToGrepReg "${regStr}")
#sed -i -e "/<script\ type=\"text\/javascript\">/,/<\/script>/g" -e "/^$/d" -e "s/<\/head>/${regStr}/g" ${path}${fileName}
sed -i -e "/${jsBlockStartMarkSedReg}/,/<\/script>/g" -e "/^$/d" -e "s/<\/head>/${regStr}/g" ${path}${fileName}
echo "Removed js code from ${sourceHTMLFileType} file."
#sed -i -e "/<script\ type=\"text\/javascript\">/,/<\/script>/g" -e "/^$/d" ${fileName}
#sed -i -e "s/<\/head>/${regStr}/g" ${fileName}
echo "-------------------------<<"
((successNum=successNum+1))
done
echo "Done. Succeeded:${successNum}; Failed:${failureNum}."
| true
|
a2a27b525949f8f423edba866d7b14c4b7c5c413
|
Shell
|
fizyr/ros-pkgbuilds
|
/base/octomap/PKGBUILD
|
UTF-8
| 1,146
| 2.53125
| 3
|
[] |
no_license
|
# Maintainer: Maaarten de Vries <maarten@de-vri.es>
pkgname='octomap'
pkgver='1.9.0'
pkgrel=2
pkgdesc='An Efficient Probabilistic 3D Mapping Framework Based on Octrees'
url='http://octomap.github.io/'
arch=('x86_64' 'i686')
license=('GPL' 'BSD')
depends=(qt4 glu)
makedepends=(cmake)
options=(staticlibs)
source=("$pkgname-$pkgver.tar.gz::https://github.com/OctoMap/octomap/archive/v$pkgver.tar.gz")
sha512sums=('335a4ee3fe20f456afd2d8491f8fe6cfc2527d6e26aa690a69a39c1468e41d312fd84c85a1247deb11f513b9d50b8c69d34b46876f8257c205b0a99bac826237')
build() {
# Create build directory
mkdir -p "${srcdir}/build"
cd "${srcdir}/build"
# Build project
cmake "$srcdir/$pkgname-$pkgver" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr
make
}
package() {
cd "$srcdir/build"
make install DESTDIR="$pkgdir"
install -D "$srcdir/$pkgname-$pkgver/octomap/LICENSE.txt" "$pkgdir/usr/share/licenses/octomap/LICENSE.txt"
install -D "$srcdir/$pkgname-$pkgver/octovis/LICENSE.txt" "$pkgdir/usr/share/licenses/octovis/LICENSE.txt"
install -D "$srcdir/$pkgname-$pkgver/dynamicEDT3D/LICENSE.txt" "$pkgdir/usr/share/licenses/dynamicEDT3D/LICENSE.txt"
}
| true
|
4e0472ab62d7b6e2a4e1ade8a9435d1b465407d8
|
Shell
|
jscancella/chronamDeployment
|
/scripts/apache-watchdog
|
UTF-8
| 617
| 3.359375
| 3
|
[] |
no_license
|
#!/bin/sh
set -eu
if ! /opt/chronam/ENV/bin/python --version >/dev/null 2>/dev/null; then
echo "Python install is broken!"
exit 2
fi
if ! systemctl is-enabled --quiet apache2.service; then
exit 0
fi
if ! curl --output /dev/null --silent --show-error --max-time 10 --retry 6 --retry-delay 10 --retry-connrefused --fail http://localhost:80/healthz; then
echo "Apache failed the healthcheck"
if [ "$(cut -f1 -d. /proc/uptime)" -gt 900 ]; then
sudo reboot
exit 1
else
echo "System appears to have recently booted; waiting for it to stabilize"
exit 0
fi
fi
| true
|
8a4f7bf650298b69a3749411687bfd0433674a42
|
Shell
|
oveits/kubernetes-install-kibana-via-helm
|
/0_source_config.sh
|
UTF-8
| 498
| 3.28125
| 3
|
[] |
no_license
|
[ "$NAMESPACE" == "" ] && export NAMESPACE=elasticsearch
[ "$RELEASE" == "" ] && export RELEASE=kibana-v1
[ "$ELASTIC_DETECTED" == "" ] \
&& export ELASTIC_DETECTED=$(kubectl -n $NAMESPACE get svc | grep 'elastic.*client' | head -n 1 | awk '{print $1}')
[ "$ELASTICSEARCH_URL" == "" ] && [ "$ELASTIC_DETECTED" != "" ] && export ELASTICSEARCH_URL=http://${ELASTIC_DETECTED}:9200
if [ "$ELASTICSEARCH_URL" == "" ]; then
echo "ELASTICSEARCH_URL could not be detected; Exiting..." >&2
exit 1
fi
| true
|
b6a3119ac8d9b29261848c17ede07a977f251834
|
Shell
|
zhangxu2/mygit
|
/v3.3/sbin/agent_sql.sh
|
UTF-8
| 658
| 3.46875
| 3
|
[] |
no_license
|
#!/bin/sh
if [ $# -lt 5 ]
then
echo "error input"
fi
sql=$1
dbtype=$2
filepath=$3
sid=$4
user=$5
passwd=$6
dbname=$7
mkdir -p $SWWORK/tmp/agent
if [ "$filepath" = "NULL" ]
then
filepath=""
fi
func_orc()
{
sqlplus -S $user/$passwd@$sid <<!
set heading off linesize 9999 colsep'|' feedback off pagesize 0 verify off echo off
$sql
!
}
func_ifx()
{
if [ "$filepath" != "" ]
then
sets="unload to $filepath delimiter '|'"
else
sets="output to pipe cat without headings "
fi
dbaccess $dbname@$sid <<!
$sets
$sql
!
}
if [ "$dbtype" == "ORACLE" ]
then
func_orc
elif [ "$dbtype" == "INFORMIX" ]
then
func_ifx
fi
if [ $? -ne 0 ];then
exit -1
fi
exit 0
| true
|
937a1504debbda01d1006f4099218aaa66291c05
|
Shell
|
Tibiazak/umsl-cs
|
/cs2750/test/args.sh
|
UTF-8
| 199
| 3.671875
| 4
|
[] |
no_license
|
if [[ $# > 2 || $# < 1 ]]
then
echo usage: "$0 [from-file] to-file"
exit 1;
elif [[ $# == 2 ]]
then
from = "$1"
to = "$2"
echo $from and $to
else
to = "$1"
echo $to
fi
| true
|
1dc6042c9f498dcc36115932b11f0c8993a91882
|
Shell
|
fonsecapeter/miso-buddy
|
/bin/tag
|
UTF-8
| 242
| 2.6875
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
make
readonly version=`bin/miso --version`
echo "$(tput bold)Tagging $(tput setaf 1)v${version}$(tput sgr0 && tput bold)...$(tput sgr0)"
git tag -a "v${version}" -m "Version ${version}" $@ && git push origin "v${version}"
| true
|
7c475e8b2d2e72648de6644e3430afe5d1006e67
|
Shell
|
fbielejec/setup-desktop
|
/chrome/install-google-chrome.sh
|
UTF-8
| 637
| 2.765625
| 3
|
[] |
no_license
|
#!/bin/bash
rm /tmp/google-chrome-stable_current_amd64.deb
echo "################################################################"
echo "downloading google chrome latest stable edition"
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/google-chrome-stable_current_amd64.deb
sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb
rm /tmp/google-chrome-stable_current_amd64.deb
echo "################################################################"
echo "################### google chrome installed #################"
echo "################################################################"
| true
|
b301097db308058337ff0caa2811558a6450df41
|
Shell
|
HyuncheolOh/twitter_crawler
|
/tweet_factchecking_crawler.sh
|
UTF-8
| 253
| 2.59375
| 3
|
[] |
no_license
|
#!/bin/sh
while true;
do
echo "Run tweet crawler"
sleep 1
python tweet_factchecking_script.py
python tweet_script.py
timestamp=`date +%Y%m%d%H%M`
echo "$timestamp"
echo "done"
./follower_run.sh
#repeat update per day
sleep 86400
done
| true
|
e5253d63a707e3e5b49d4a143db290e6fbff83c0
|
Shell
|
MaksTinyWorkshop/domoticz_scripts
|
/sh/synology.sh
|
UTF-8
| 7,136
| 3
| 3
|
[] |
no_license
|
#!/bin/bash
#https://www.domoticz.com/wiki/NAS_Monitoring#Synology
# Settings
NASIP="192.168.100.250" # NAS IP Address
PASSWORD="monpassword" # SNMP Password
DOMO_IP="127.0.0.1" # Domoticz IP Address
DOMO_PORT="8080" # Domoticz Port
NAS_IDX="799" # NAS Switch IDX
NAS_HD1_TEMP_IDX="800" # NAS HD1 Temp IDX
#NAS_HD2_TEMP_IDX="3" # NAS HD2 Temp IDX
NAS_CPU_IDX="801" # NAS CPU IDX
NAS_MEM_IDX="802" # NAS MEM IDX
NAS_HD_SPACE_PERC_IDX="803" # NAS HD Space IDX in %
NAS_HD_SPACE_IDX="804" # NAS HD Space IDX in Go
# Check if NAS in online
PINGTIME=`ping -c 1 -q $NASIP | awk -F"/" '{print $5}' | xargs`
# echo $PINGTIME
if expr "$PINGTIME" \> 0 > /dev/null 2>&1 ; then
curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=devices&rid=$NAS_IDX" | grep "Status" | grep "On" > /dev/null 2>&1
if [ $? -eq 0 ] ; then
# echo "NAS already ON"
# Temperature HD1
HDtemp1=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.2.1.1.6.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD1_TEMP_IDX&nvalue=0&svalue=$HDtemp1" > /dev/null 2>&1
# Temperature HD2
#HDtemp2=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.2.1.1.6.1`
# Send data
#curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2"
# Free space volume in Go
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
#HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=0&svalue=$HDFree" > /dev/null 2>&1
# Free space volume in percent
HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDFreePerc=$((($HDUsed * 100) / $HDTotal))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc" > /dev/null 2>&1
# CPU utilisation
CpuUser=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.10.0`
CpuUse=$(($CpuUser + $CpuSystem))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_CPU_IDX&nvalue=0&svalue=$CpuUse" > /dev/null 2>&1
# Free Memory Available in %
MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.13.0`
MemAvailableinMo=$(($MemAvailable / 1024))
#MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemAvailableinMo" > /dev/null 2>&1
else
# echo "NAS ON"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$NAS_IDX&switchcmd=On" > /dev/null 2>&1
# Temperature HD1
HDtemp1=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.2.1.1.6.0`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD1_TEMP_IDX&nvalue=0&svalue=$HDtemp1" > /dev/null 2>&1
# Temperature HD2
HDtemp2=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.6574.2.1.1.6.1`
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD2_TEMP_IDX&nvalue=0&svalue=$HDtemp2" > /dev/null 2>&1
# Free space volume in Go
HDUnit=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.4.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDTotal=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.5.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.2.1.25.2.3.1.6.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDFree=$((($HDTotal - $HDUsed) * $HDUnit / 1024 / 1024 / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD_SPACE_IDX&nvalue=0&svalue=$HDFree" > /dev/null 2>&1
# Free space volume in percent
HDTotal=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.5.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDUsed=`snmpget -c $PASSWORD -v2c -O qv $NASIP .1.3.6.1.2.1.25.2.3.1.6.41` # Change OID to .38 on DSM 5.1 or .41 on DSM 6.0+
HDFreePerc=$((($HDUsed * 100) / $HDTotal))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_HD_SPACE_PERC_IDX&nvalue=0&svalue=$HDFreePerc" > /dev/null 2>&1
# CPU utilisation
CpuUser=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.9.0`
CpuSystem=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.11.10.0`
CpuUse=$(($CpuUser + $CpuSystem))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_CPU_IDX&nvalue=0&svalue=$CpuUse" > /dev/null 2>&1
# Free Memory Available in %
MemAvailable=`snmpget -v 2c -c $PASSWORD -O qv $NASIP 1.3.6.1.4.1.2021.4.13.0`
MemAvailableinMo=$(($MemAvailable / 1024))
#MemUsepercent=$((($MemAvailableinMo * 100) / 1024))
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$NAS_MEM_IDX&nvalue=0&svalue=$MemAvailableinMo" > /dev/null 2>&1
fi
else
curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=devices&rid=$NAS_IDX" | grep "Status" | grep "Off" > /dev/null 2>&1
if [ $? -eq 0 ] ; then
# echo "NAS already OFF"
exit
else
# echo "NAS OFF"
# Send data
curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=switchlight&idx=$NAS_IDX&switchcmd=Off" > /dev/null 2>&1
fi
fi
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.