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
993117030c85e6ba1619ee51bc9feec73fc32a20
Shell
YunShiTiger/kubernetes-devops
/scripts/init_os/init.sh
UTF-8
3,273
3.296875
3
[]
no_license
#!/bin/bash #清理防火墙规则,设置默认转发策略 function disable_firewalld(){ systemctl stop firewalld systemctl disable firewalld iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat iptables -P FORWARD ACCEPT } #同时注释 /etc/fstab 中相应的条目,防止开机自动挂载 swap 分区 function disable_swap(){ swapoff -a sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab } #关闭selinux function disable_selinux(){ setenforce 0 sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config } #linux 系统开启了 dnsmasq 后(如 GUI 环境),将系统 DNS Server 设置为 127.0.0.1,这会导致 docker 容器无法解析域名 function disable_dnsmasq(){ systemctl stop dnsmasq systemctl disable dnsmasq } #加载内核模块相关 function add_kernel_about(){ modprobe ip_vs_rr modprobe br_netfilter } #优化内核参数 function optimization_kernel(){ cat > kubernetes.conf <<EOF net.bridge.bridge-nf-call-iptables=1 net.bridge.bridge-nf-call-ip6tables=1 net.ipv4.ip_forward=1 net.ipv4.tcp_tw_recycle=0 vm.swappiness=0 # 禁止使用 swap 空间,只有当系统 OOM 时才允许使用它 vm.overcommit_memory=1 # 不检查物理内存是否够用 vm.panic_on_oom=0 # 开启 OOM fs.inotify.max_user_instances=8192 fs.inotify.max_user_watches=1048576 fs.file-max=52706963 fs.nr_open=52706963 net.ipv6.conf.all.disable_ipv6=1 net.netfilter.nf_conntrack_max=2310720 EOF cp kubernetes.conf /etc/sysctl.d/kubernetes.conf sysctl -p /etc/sysctl.d/kubernetes.conf } #设置系统时区 function set_timezone(){ # 调整系统 TimeZone timedatectl set-timezone Asia/Shanghai # 将当前的 UTC 时间写入硬件时钟 timedatectl set-local-rtc 0 # 重启依赖于系统时间的服务 systemctl restart rsyslog systemctl restart crond } function disable_no_needserver(){ systemctl stop postfix && systemctl disable postfix } #设置 rsyslogd 和 systemd journald #systemd 的 journald 是 Centos 7 缺省的日志记录工具,它记录了所有系统、内核、Service Unit 的日志。 #相比 systemd,journald 记录的日志有如下优势: #可以记录到内存或文件系统;(默认记录到内存,对应的位置为 /run/log/jounal); #可以限制占用的磁盘空间、保证磁盘剩余空间; #可以限制日志文件大小、保存的时间; #journald 默认将日志转发给 rsyslog,这会导致日志写了多份,/var/log/messages 中包含了太多无关日志,不方便后续查看,同时也影响系统性能。 function rsyslogd_set(){ mkdir /var/log/journal # 持久化保存日志的目录 mkdir /etc/systemd/journald.conf.d cat > /etc/systemd/journald.conf.d/99-prophet.conf <<EOF [Journal] # 持久化保存到磁盘 Storage=persistent # 压缩历史日志 Compress=yes SyncIntervalSec=5m RateLimitInterval=30s RateLimitBurst=1000 # 最大占用空间 10G SystemMaxUse=10G # 单日志文件最大 200M SystemMaxFileSize=200M # 日志保存时间 2 周 MaxRetentionSec=2week # 不将日志转发到 syslog ForwardToSyslog=no EOF systemctl restart systemd-journald } disable_firewalld disable_swap disable_selinux add_kernel_about optimization_kernel set_timezone disable_no_needserver rsyslogd_set
true
84f734e2f383eaa59cf01885f39b5fd79acad913
Shell
Aahana1/peellelab_scripts
/shell_scripts/fix_dir_names_local.sh
UTF-8
342
3.28125
3
[ "MIT" ]
permissive
#!/bin/sh # unzip of downloaded CNDA files creates unusable session folder names # in the form NN-blerg (e.g., 7-T1w_MPR). Run this from on top of # the directory tree to fix (e.g., cd to PL123346/scans) for FILE in * do if [ -d ${FILE} ]; then NEWNAME=`echo ${FILE} | cut -d- -f 1` mv -v "${FILE}" "${NEWNAME}" fi done
true
6520106de92da6b76019162f39f27e09aacc7af6
Shell
robertonl/guessing-game-project
/guessinggame.sh
UTF-8
507
3.75
4
[]
no_license
#!/usr/env/bin bash # File: guessinggame.sh function check_response { read response local num_files_in_dir="$(ls -h | wc -l)" while [[ $response -ne $num_files_in_dir ]] do if [[ $response -lt $num_files_in_dir ]] then echo "Your guess was too low" else echo "Your guess was too high" fi echo "Please try again" read response done echo "You guessed the correct number thank you for playing" } echo "Please enter the number of files in this directory" check_response
true
14d35f4200ebee292a8a1be9d04828ffe319fd04
Shell
kriskall/Zeeguu-Reader
/dev_setup_mac.sh
UTF-8
1,605
4.15625
4
[ "MIT" ]
permissive
#!/usr/bin/env bash # Run this script to setup your development environment. echo "...." TOP=$(cd $(dirname $0) && pwd -L) if [ "$(id -u)" == "0" ]; then echo "This script should not be run as root. " 1>&2 exit 1 fi echo "Hello developer! Let's get you setup! :)" brew install node sudo npm install --no-optional -g webpack webpack-cli sudo npm install --no-optional -g esdoc # create virtualenv, consistent with virtualenv-wrapper conventions read -p "Setup virtualenv and install python dependencies (y recommended)? " -n 1 -r echo # move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then echo "Setting up virtual environment..." if [ -z ${ZEEGUU_UMR_VENV_ROOT+x} ] then ZEEGUU_UMR_VENV_ROOT="$HOME/.venvs/z_env" echo "ZEEGUU_UMR_VENV_ROOT not set, using default ($ZEEGUU_UMR_VENV_ROOT)." fi if [ ! -d ${ZEEGUU_UMR_VENV_ROOT} ]; then mkdir -p $(dirname ${ZEEGUU_UMR_VENV_ROOT}) virtualenv -p python3.6 ${ZEEGUU_UMR_VENV_ROOT} fi source ${ZEEGUU_UMR_VENV_ROOT}/bin/activate cd "${TOP}" # install requirements pip install -r requirements.txt else read -p "Install python dependencies globally instead? This will require python3.6! " -n 1 -r echo # move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then echo "Installing dependencies..." pip install -r requirements.txt fi fi read -p "Install javascript dependencies (y recommended)? " -n 1 -r echo # move to a new line if [[ $REPLY =~ ^[Yy]$ ]] then echo "Setting up javascript dependencies..." npm install fi echo "Done!"
true
2d5d536793d9d4ee07861ec2b2d32c7f86663342
Shell
cyrilsebastian1811/CSYE6225-AMI
/provisionerScript.sh
UTF-8
4,723
2.84375
3
[]
no_license
sudo yum update -q sudo timedatectl set-timezone UTC date # Java-11 Installation and Path Setup sudo yum -y -q install java-11-openjdk-devel echo "export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))" | sudo tee -a /etc/profile source /etc/profile echo "export PATH=$PATH:$JAVA_HOME/bin" | sudo tee -a /etc/profile source /etc/profile # Tomcat-9 Installation and Path Setup sudo groupadd tomcat sudo mkdir /opt/tomcat sudo useradd -s /bin/nologin -g tomcat -d /opt/tomcat tomcat sudo yum -y -q install wget cd ~ wget -q http://apache.mirrors.pair.com/tomcat/tomcat-9/v9.0.21/bin/apache-tomcat-9.0.21.tar.gz tar -zxf apache-tomcat-9.0.21.tar.gz sudo chmod +x apache-tomcat-9.0.21/bin/*.bat sudo rm -f apache-tomcat-9.0.21/bin/*.bat sudo ls -l apache-tomcat-9.0.21/bin sudo mv apache-tomcat-9.0.21/* /opt/tomcat/ # sudo tar -zxvf apache-tomcat-9.0.21.tar.gz -C /opt/tomcat --strip-components=1 sudo rm -rf apache-tomcat-9.0.21 sudo rm -rf apache-tomcat-9.0.21.tar.gz # setting permission for tomcat cd /opt/tomcat sudo ls sudo chgrp -R tomcat conf sudo chmod g+rwx conf sudo chmod -R g+r conf sudo chown -R tomcat logs/ temp/ webapps/ work/ sudo chgrp -R tomcat bin sudo chgrp -R tomcat lib sudo chmod g+rwx bin sudo chmod -R g+r bin # Tomcat Service File echo -e "[Unit] Description=Apache Tomcat Web Application Container Wants=syslog.target network.target After=syslog.target network.target [Service] Type=forking SuccessExitStatus=143 Environment=JAVA_HOME=$JAVA_HOME Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' WorkingDirectory=/opt/tomcat ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/bin/kill -15 \$MAINPID User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/tomcat.service sudo systemctl daemon-reload sudo systemctl enable tomcat.service sudo sed -i '$ d' /opt/tomcat/conf/tomcat-users.xml sudo echo -e "\t<role rolename=\"manager-gui\"/> \t<user username=\"manager\" password=\"manager\" roles=\"manager-gui\"/> </tomcat-users>" | sudo tee -a /opt/tomcat/conf/tomcat-users.xml sudo systemctl restart tomcat.service sudo systemctl stop tomcat.service sudo systemctl status tomcat.service sudo su sudo chmod -R 777 webapps sudo chmod -R 777 work sudo rm -rf /opt/tomcat/webapps/* sudo rm -rf /opt/tomcat/work/* sudo ls /opt/tomcat/webapps sudo systemctl start tomcat.service sudo systemctl status tomcat.service # Code deploy agent Installation and Path Setup cd ~ sudo yum -y -q install ruby wget -q https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install chmod +x ./install sudo ./install auto rm -rf install # checking status of code deploy agent sudo service codedeploy-agent start sudo service codedeploy-agent status #creating json file cd ~ touch amazon-cloudwatch-agent.json cat > amazon-cloudwatch-agent.json << EOF { "agent": { "metrics_collection_interval": 10, "logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log" }, "logs": { "logs_collected": { "files": { "collect_list": [ { "file_path": "/opt/tomcat/logs/csye6225.log", "log_group_name": "csye6225_su2019", "log_stream_name": "webapp" } ] } }, "log_stream_name": "cloudwatch_log_stream" }, "metrics":{ "metrics_collected":{ "statsd":{ "service_address":":8125", "metrics_collection_interval":10, "metrics_aggregation_interval":0 } } } } EOF touch csye6225.log sudo chgrp -R tomcat csye6225.log sudo chmod -R g+r csye6225.log sudo chmod g+x csye6225.log sudo mv csye6225.log /opt/tomcat/logs/csye6225.log #Installing cloud-watch config agent cat amazon-cloudwatch-agent.json sudo mv amazon-cloudwatch-agent.json /opt/amazon-cloudwatch-agent.json cd ~ sudo wget -q https://s3.us-east-1.amazonaws.com/amazoncloudwatch-agent-us-east-1/centos/amd64/latest/amazon-cloudwatch-agent.rpm sudo rpm -U ./amazon-cloudwatch-agent.rpm sudo systemctl status amazon-cloudwatch-agent.service cd ~ sudo wget -q https://s3.amazonaws.com/configfileforcloudwatch/amazon-cloudwatch-agent.service sudo cp amazon-cloudwatch-agent.service /etc/systemd/system/ sudo systemctl enable amazon-cloudwatch-agent sudo echo "Installed everything"
true
a48a655f83050039d90f17a0533d47fdefe6c6be
Shell
lumeng/repogit-mengapps
/file_system/find-largest-files.sh
UTF-8
401
3.453125
3
[]
no_license
#!/usr/bin/env bash ## Summary: find largest files recursively TMPSUBDIR=$(mktemp -d "${TMPDIR:-/tmp/}$(basename 0).XXXXXXXXXXXX") TIMESTAMP="$(date +%s)" OUTPUTFILE="${TMPSUBDIR}/list_of_large_files__${TIMESTAMP}.txt" touch $OUTPUTFILE gfind -P -O2 . -type f -size +100M -user $USER -exec ls -pks '{}' \; | \ sort -nr -t' ' -k1,1 >> $OUTPUTFILE echo ${OUTPUTFILE} cat ${OUTPUTFILE} ## EOF
true
79b58de5abf2af29ff945018851edcf5660b6425
Shell
KeesV/kv-home-automation-config
/backupscripts/backup_postgrescontainer.sh
UTF-8
488
4.03125
4
[]
no_license
#!/bin/bash CONTAINER=$1 USER=$2 TARGETFILE=$3 echo "Creating backup of container matching" $CONTAINER CONTAINER_ID=`docker ps -l --filter "name=$CONTAINER" -q` if [ -z "$CONTAINER_ID" ] then echo "Couldn't find any container matching $CONTAINER" else echo "Found container with id $CONTAINER_ID" echo "Going to take backup using user '$USER' to target file '$TARGETFILE'" docker exec -t $CONTAINER_ID pg_dumpall -c -U $USER > $TARGETFILE echo "Backup finished!" fi
true
14eaf2937bcdb3d98c11181b5508fb0d4ec5680b
Shell
adamrehn/spirv-installer
/install-unix.sh
UTF-8
969
4.0625
4
[ "MIT" ]
permissive
#!/usr/bin/env sh # Ensure this script is run as root if [ `id -u` -ne 0 ]; then echo "Error: this script must be run as root!" exit fi # The installation locations for the SPIR-V tools and the wrappers/symlinks export SPIRVVER=1.1 export SPIRVDIR=/usr/local/spirv/$SPIRVVER export BINDIR=/usr/local/bin # Create the installation directories if they don't already exist test -d "$SPIRVDIR" || mkdir -p "$SPIRVDIR" test -d "$BINDIR" || mkdir -p "$BINDIR" # Copy the SPIR-V directory cp -R ./spirv/$SPIRVVER "$SPIRVDIR/../" # Process each of the convenience wrappers, filling in the path to spirv-clang for wrapperFile in ./wrappers/*; do wrapperName="$(basename $wrapperFile)" sed "s#__SPIRV_DIR__#$SPIRVDIR#g" $wrapperFile > "$BINDIR/$wrapperName" chmod 775 "$BINDIR/$wrapperName" done # Create symlinks for each of the binaries for binary in ./spirv/$SPIRVVER/bin/*; do binary="$(basename $binary)" ln -f -s "$SPIRVDIR/bin/$binary" "$BINDIR/$binary" done
true
64e815dda8d7d20c04bbd39db259315349779629
Shell
junewong/mybackupcode
/shell/tools_company/bak_createJsMvc
UTF-8
787
3.125
3
[]
no_license
#!/bin/bash mode=$1; if [ $mode = "-v" ];then classType="IView"; action="regView"; elif [ $mode = '-c' ];then classType="ICtrl"; action="regCtrl"; elif [ $mode = 'm' ];then classType="IModel"; action="regModel"; fi if [ $classType = '' ];then echo "Please enter the type of class, can be -v , -c or -m." exit 0; fi i=0; for className in $* do $i++; if [ $i > 1 ];then echo \/\*\* echo \* init all event of play list. echo \*\/ echo Apps.extend\( $mode, { echo _name : \'$className\', echo load : function\(\) echo { echo this.$action\(this._name\)\; echo }, echo run : function\(\) echo { echo }, echo init : function\(\) echo { echo }, echo unload : function\(\) echo { echo } echo }\)\; fi done
true
d2586b162a1d6d3ec1a066fa12b09a1e25d75365
Shell
pbmiguel/spark-demo
/deploy/databricks/deploy-job.sh
UTF-8
7,199
3.390625
3
[]
no_license
#!/bin/sh ################################################################################################################# # Deploying to databricks involves 3 steps: # # 1. List existing jobs and find the job id with cluster name # # 2. Decide next step based on number of jobs found # - If job doesn't exist, then create job # - If one job exists, then reset job # - If more than one job exists, then fail (this should never happen) # # 3. Run new job # # For details, see https://docs.databricks.com/dev-tools/api/latest/jobs.html ################################################################################################################# DATABRICKS_WORKSPACE="https://<company-name>.cloud.databricks.com" ECR_IMAGE_URL="<aws-account>.dkr.ecr.<aws-region>.amazonaws.com/<image-name>" INSTANCE_PROFILE_ARN = "arn:aws:iam::<aws-account>:instance-profile/<profile-name>" job_settings='{ "name": "'"$CLUSTER_NAME"'", "new_cluster": { "spark_version": "'"$SPARK_VERSION"'", "node_type_id": "'"$INSTANCE_TYPE"'", "driver_node_type_id": "'"$INSTANCE_TYPE"'", "autoscale": { "min_workers": '"$MIN_WORKERS"', "max_workers": '"$MAX_WORKERS"' }, "docker_image": { "url": "'"$ECR_IMAGE_URL"'" }, "aws_attributes": { "first_on_demand": 1, "availability": "SPOT_WITH_FALLBACK", "zone_id": "us-east-1b", "spot_bid_price_percent": 100, "instance_profile_arn": ""'$INSTANCE_PROFILE_ARN'"", "ebs_volume_type": "GENERAL_PURPOSE_SSD", "ebs_volume_count": 3, "ebs_volume_size": 100 }, "cluster_log_conf": { "s3": { "destination": "'"$LOG_DESTINATION_S3"'", "region": "us-east-1" } }, "spark_conf": { "spark.ui.prometheus.enabled": true, "spark.dynamicAllocation.enabled": false, "spark.shuffle.service.enabled": true, "spark.streaming.dynamicAllocation.enabled": false, "spark.databricks.aggressiveWindowDownS": 600, "spark.databricks.aggressiveFirstStepScaleUpMax": 1, "spark.databricks.aggressiveFirstStepScaleUpFraction": 0.05, "spark.executor.processTreeMetrics.enabled": true }, "custom_tags": { "Billing": "'"$CLUSTER_NAME"'" }, "spark_env_vars": { "ENV_FOR_DYNACONF": "'"$ENV_FOR_DYNACONF"'", "CLUSTER_NAME": "'"$CLUSTER_NAME"'", "MAX_WORKERS": '"$MAX_WORKERS"' }, "init_scripts": [ { "s3": { "destination": "'"$INIT_SCRIPTS_DESTINATION_S3"'", "region": "us-east-1" } } ] }, "spark_python_task": { "python_file": "file:/app/run.py" }, "max_retries": -1, "max_concurrent_runs": 1 }' echo job_settings: $job_settings ################################################################################################################# # Function for creating new job if no job exists ################################################################################################################# function create_job { echo "Creating job ..." new_job_response="$( \ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$DATABRICKS_API_TOKEN"'' \ $DATABRICKS_WORKSPACE/api/2.0/jobs/create -d ''"$job_settings"'' \ '' \ )" echo new_job_response: $new_job_response job_id="$(jq -n "$new_job_response" | jq --raw-output '.job_id')" echo job_id: $job_id # fail if creating new job fails [[ "$job_id" = null ]] && echo "Creating new job failed!" && exit 1 } ################################################################################################################# # Function for resetting job if job exists ################################################################################################################# function reset_job { echo "Resetting job ..." # reset job settings RESET_DATA='{ "job_id": '"$job_id"', "new_settings": '"$job_settings"' }' echo $RESET_DATA reset_job_response="$( \ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$DATABRICKS_API_TOKEN"'' \ $DATABRICKS_WORKSPACE/api/2.0/jobs/reset -d ''"$RESET_DATA"'' \ )" echo reset_job_response: $reset_job_response # fail if resetting old job fails [[ "$reset_job_response" != {} ]] && echo "Resetting old run failed! New run will not start!" && exit 1 # get old run id for job list_run_response="$( \ curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$DATABRICKS_API_TOKEN"'' \ $DATABRICKS_WORKSPACE/api/2.0/jobs/runs/list?job_id=''"$job_id"''&active_only=true \ )" echo list_run_response: $list_run_response old_run_id="$(jq -n "$list_run_response" | jq --raw-output '.runs | .[] | select((.state.life_cycle_state == "RUNNING") or (.state.life_cycle_state == "PENDING")) | .run_id')" echo old_run_id: $old_run_id # cancel old run cancel_run_response="$( \ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$DATABRICKS_API_TOKEN"'' \ $DATABRICKS_WORKSPACE/api/2.0/jobs/runs/cancel -d '{"run_id": "'$old_run_id'"}' \ )" echo cancel_run_response: $cancel_run_response # fail if canceling old job fails [[ "$cancel_run_response" != {} ]] && echo "Canceling old run failed! New run will not start!" && exit 1 # wait for run to cancel sleep 10 } ################################################################################################################# # 1. List existing jobs and find the job id with cluster name ################################################################################################################# job_id="$( \ curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$DATABRICKS_API_TOKEN"'' \ $DATABRICKS_WORKSPACE/api/2.0/jobs/list | \ jq --raw-output '.jobs | .[] | select(.settings.name == "'"$CLUSTER_NAME"'") | .job_id' \ )" echo job_id: $job_id ################################################################################################################# # 2. Decide next step based on number of jobs found # - If job doesn't exist, then create job # - If one job exists, then reset job # - If more than one job exists, then fail (this should never happen) ################################################################################################################# job_count="$(echo $job_id | wc -w)" echo job_count $job_count if [ $job_count = 0 ]; then echo "No existing job found. Creating new job ..." create_job elif [ $job_count = 1 ]; then echo "Job found. Resetting job ..." reset_job else echo "More than one job found. Failing deployment ..." && exit 1 fi ################################################################################################################# # 3. Run new job # the api returns {"run_id":123,"number_in_job":1} ################################################################################################################# run_job_response="$( \ curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer '"$DATABRICKS_API_TOKEN"'' \ $DATABRICKS_WORKSPACE/api/2.0/jobs/run-now -d '{"job_id": "'"$job_id"'"}' \ )" echo run_job_response: $run_job_response
true
074133de80920b0ac975e1c726fa5b0fe6752703
Shell
s-zanella/hacl-star
/.ci/script.sh
UTF-8
733
2.71875
3
[]
no_license
#!/bin/bash set -e eval $(opam config env) export Z3=z3-4.4.1-x64-ubuntu-14.04; export PATH=/home/travis/build/mitls/hacl-star/$Z3/bin:$PATH; export PATH=/home/travis/build/mitls/hacl-star:$PATH; export PATH=/home/travis/build/mitls/hacl-star/FStar/bin:$PATH; export PATH=/home/travis/build/mitls/hacl-star/kremlin:$PATH; export KREMLIN_HOME=/home/travis/build/mitls/hacl-star/kremlin export FSTAR_HOME=/home/travis/build/mitls/hacl-star/FStar echo "\"$Z3\": -traverse" >> _tags echo "\"$CLANG\": -traverse" >> _tags echo "\"FStar\": -traverse" >> _tags echo "\"kremlin\": -traverse" >> _tags echo -e "\e[31m=== Some info about the environment ===\e[0m" ocamlfind ocamlopt -config gcc --version fstar.exe --version make -C test
true
25972bb5d9ed8d7d18bfe732d15633a688504fd5
Shell
NetBSD/pkgsrc
/mail/opensmtpd/files/opensmtpd.sh
UTF-8
867
3.140625
3
[]
no_license
#!/bin/sh # # $NetBSD: opensmtpd.sh,v 1.3 2023/08/24 15:26:40 vins Exp $ # # PROVIDE: smtpd mail # REQUIRE: LOGIN # KEYWORD: shutdown # we make mail start late, so that things like .forward's are not # processed until the system is fully operational $_rc_subr_loaded . @SYSCONFBASE@/rc.subr name="smtpd" rcvar=opensmtpd : ${smtpd_config:="@PKG_SYSCONFDIR@/smtpd/${name}.conf"} : ${smtpd_server:="@PREFIX@/sbin/${name}"} : ${smtpd_flags:=""} command="${smtpd_server}" command_args="-f ${smtpd_config} -v" required_files="${smtpd_config}" pidfile="@VARBASE@/run/${name}.pid" start_precmd="smtpd_precmd" check_cmd="smtpd_check" extra_commands="check" smtpd_check() { echo "Performing sanity check on smtpd configuration:" eval ${command} ${command_args} ${smtpd_flags} -n } smtpd_precmd() { smtpd_check } load_rc_config $name run_rc_command "$1"
true
d2b814dbd5bb97b3e103af803f293f07b3b9db29
Shell
yiuked/fabric-ca
/client/enroll.sh
UTF-8
571
3.296875
3
[]
no_license
#!/bin/bash . ./base.sh echo -n "Enter user:" read USER echo -n "Enter pass:" read PASS HTTP="http" TLS="" for i in "$*"; do case $i in --tls) HTTP="https" TLS="--tls.certfiles=${FABRIC_CA_CLIENT_HOME}/users/admin/msp/cacerts/localhost-7054.pem" ;; esac done set -x ./fabric-ca-client enroll -u ${HTTP}://${USER}:${PASS}@localhost:7054 -M ${FABRIC_CA_CLIENT_HOME}/users/${USER}/msp ${TLS} res=$? set +x if [ $res -ne 0 ];then rm -rf ${FABRIC_CA_CLIENT_HOME}/fabric-ca-client-config.yaml ${FABRIC_CA_CLIENT_HOME}/users/${USER} fi
true
356ec362a71f3c4dc6d9d015ab63775737d5693f
Shell
J0sueTM/sfml-bench-files
/Pong/make.sh
UTF-8
778
3.53125
4
[ "MIT" ]
permissive
# !/bin/bash #create folders that can be unexistent if ![[ -d "bin" ]]; then echo "Log: Creating bin folder" mkdir bin/ fi #remove old files echo "Log: Removing old files" if [[ -f "bin/main" ]]; then rm bin/main fi #compile main echo "Log: Compiling main file" if [[ -f "src/main.cpp" ]]; then g++ -c src/main.cpp else echo "Error: main.cpp not found" exit 1 fi #link files echo "Log: Linking sfml to output file" if [[ -f "main.o" ]]; then g++ main.o -o bin/main -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system else echo "Error: Output file doesn't exist" exit 1 fi #run if [[ -f "bin/main" ]]; then echo "Log: Running" ./bin/main else echo "Error: Binary file doesn't exist" exit 1 fi echo "Finished" exit 0
true
ccc9948c338c684468b41c3b42a6c0d0664496e7
Shell
einzigartigerName/dotdotdot
/install
UTF-8
3,675
3.59375
4
[]
no_license
#!/usr/bin/env bash conf="$HOME/.config" scp="$HOME/.scripts" DEPS_PACMAN=( "arandr" "dunst" "feh" "fzf" "git" "htop" "i3-gaps" "nasm" "playerctl" "pulseaudio" "python-pip" "qutebrowser" "redshift" "surf" "sxhkd" "vlc" "zathura" "zathura-pdf-mupdf" "zsh" ) DEPS_AUR=( "betterlockscreen" "brave-bin" "polybar" "pulseaudio-ctl" ) # prints the usage of this script print_usage () { printf "Usage:\n\t-c\tinstall just the configs\n\t-s\tinstall just the scripts\n\t-d\tinstall just the dependencies of this setup\n\t-a\tinstall configs, scripts and dependencies\n" } # install config to $conf install_config () { # ----------------- configs ----------------- mkdir -p $conf # ZSH cp config/zsh/zshrc ~/.zshrc cp config/zsh/nelson.zsh-theme ~/.oh-my-zsh/custom/themes cp config/zsh/alias ~/.alias # dunst cp -r config/dunst $conf # i3 cp -r config/i3 $conf # Polybar cp -r config/polybar $conf # sxhkd cp -r config/sxhkd $conf # Wallpaper cp config/wallpaper.jpg ~/.wallpaper.jpg echo "DONE: installing configs" } # install scripts to $scp install_scripts () { # ----------------- scripts ----------------- mkdir -p $scp cp -r scripts/network $scp cp -r scripts/startup $scp cp -r scripts/util $scp cp -r scripts/polybar $scp echo "DONE: installing scripts" } install_dependencies () { # Installs from official Repos echo "----------- install deps via pacman -----------" sudo pacman -S ${DEPS_PACMAN[@]} # installs via pip echo "----------- install deps via python-pip --------" sudo pip install i3-workspace-swap # installs via git cd ~/ mkdir -p Programms cd Programms echo "--------------- yay ---------------\n" git clone https://aur.archlinux.org/yay.git cd yay makepkg -sic cd .. echo "DONE: installing yay\n\n" echo "----------- install deps from aur -----------" # Installs from AUR yay -S ${DEPS_AUR[@]} echo "--------------- dmenu ---------------\n" git clone https://github.com/einzigartigername/dmenu cd dmenu sudo make install clean cd .. echo "DONE: installing dmenu\n\n" echo "--------------- st ---------------\n" git clone https://github.com/LukeSmithxyz/st.git cd st sudo make install clean cd .. echo "DONE: installing st\n\n" echo "--------------- oh-my-zsh ---------------\n" sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" echo "DONE: installing oh-my-zsh\n\n" echo "--------------- xlight ---------------\n" https://github.com/einzigartigerName/xlight.git cd illuminate make && sudo make install clean cd .. echo "DONE: installing xlight\n\n" echo "----------- DONE -----------" } if [ -z "${1// }" ]; then print_usage exit fi # flags for install opts FLAG_CONFIG=0 FLAG_DEPS=0 FLAG_SCRIPT=0 while getopts "acsd" opt; do case $opt in a) # install all FLAG_CONFIG=1 FLAG_DEPS=1 FLAG_SCRIPT=1 ;; c) # install config FLAG_CONFIG=1 ;; s) # install scripts FLAG_SCRIPT=1 ;; d) # install dependencies FLAG_DEPS=1 ;; esac done if [[ "$FLAG_DEPS" -eq 1 ]]; then install_dependencies fi if [ "$FLAG_CONFIG" -gt 0 ]; then install_config fi if [[ "$FLAG_SCRIPT" -eq "1" ]]; then install_scripts fi
true
1aaa436d86aaaf6abd0d61a0a381a5aea62a4277
Shell
BYU-ODH/yvideo-deploy
/scripts/gen_dev_keys.sh
UTF-8
1,168
3.75
4
[]
no_license
#!/usr/bin/env bash services="server" rm_secrets () { for x in $services; do docker secret rm "$x""_cert" docker secret rm "$x""_key" done } gen_key_cert () { BASE_DOMAIN="$1" DAYS=1095 CONFIG_FILE="config.txt" cat > $CONFIG_FILE <<-EOF [req] default_bits = 2048 prompt = no default_md = sha256 x509_extensions = v3_req distinguished_name = dn [dn] C = CA ST = BC L = Vancouver O = Example Corp OU = Testing Domain emailAddress = webmaster@$BASE_DOMAIN CN = $BASE_DOMAIN [v3_req] subjectAltName = @alt_names [alt_names] DNS.1 = *.$BASE_DOMAIN DNS.2 = $BASE_DOMAIN EOF FILE_NAME="$BASE_DOMAIN" rm -f $FILE_NAME.* # Generate our Private Key, CSR and Certificate # Use SHA-2 as SHA-1 is unsupported from Jan 1, 2017 openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout "$FILE_NAME.key" -days $DAYS -out "$FILE_NAME.crt" -config "$CONFIG_FILE" # Protect the key #chmod 400 "$FILE_NAME.key" } rm_secrets rm -f *.key *.crt for x in $services; do gen_key_cert $x docker secret create "$x""_key" $x.key docker secret create "$x""_cert" $x.crt done rm config.txt *.key *.crt
true
f2d076f81d5df7278dcd41963d5d578b47f3c1c8
Shell
ChrisPHL/advancedcaching
/make-maemo-deb.sh
UTF-8
992
3.09375
3
[]
no_license
#!/bin/sh #IPKG='../ipkg-utils-1.7/ipkg-build' PKGROOT='maemo/advancedcaching/src/' VERSION=$1 BUILD=$2 if [ "$VERSION" == "" ] ; then echo "gimme version, plz" exit fi if [ "$BUILD" == "" ] ; then echo "gimme build, plz" exit fi cp files/advancedcaching-48.png $PKGROOT/usr/share/icons/hicolor/48x48/hildon/advancedcaching.png cp files/advancedcaching-maemo.desktop $PKGROOT/usr/share/applications/hildon/advancedcaching.desktop cp -R files/advancedcaching/* $PKGROOT/opt/advancedcaching/ rm $PKGROOT/opt/advancedcaching/*.pyc rm $PKGROOT/opt/advancedcaching/*.pyo rm $PKGROOT/opt/advancedcaching/*.class rm $PKGROOT/opt/advancedcaching/*~ rm -r $PKGROOT/opt/advancedcaching/advcaching.egg-info rm -r $PKGROOT/opt/advancedcaching/build rm -r $PKGROOT/opt/advancedcaching/dist sed -i -e "s/version = \".*\"/version = \"$VERSION\"/" $PKGROOT/../build_myapp.py sed -i -e "s/build = \".*\"/build = \"$BUILD\"#/" $PKGROOT/../build_myapp.py cd $PKGROOT cd .. python2.5 build_myapp.py
true
fdacfc124605a37e9bd2f08a997b9f336b94474f
Shell
bongiojp/hudson_build_scripts
/kickstart_scripts/ks_prepost.sh
UTF-8
1,937
3.03125
3
[]
no_license
#!/usr/bin/perl my %functionmap; my $logfile = "/root/ks_prepost.out"; sub pre() { #after networking is setup but before OS is installed } $functionmap{"preinstall"} = \&preinstall; sub post() { #after OS is installed and networking is still setup } $functionmap{"postinstall"} = \&postinstall; sub installepel() { #setup EPEL repos for rhel 6 `wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm &>> ${logfile}`; `wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm &>> ${logfile}`; `sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm &>> ${logfile}`; } $functionmap{"installepel"} = \&installepel; sub ganesha20rpms() { #install packages `yum install -y git nfs-utils nfs4-acl-tools nfs-utils-lib nfs-utils-lib-devel nfs-utils krb5-devel krb5-workstation krb5-libs python rpm-build gcc git cmake &>> ${logfile}`; } $functionmap{"ganesha20rpms"} = \&ganesha20rpms; sub build_ganesha20() { `git clone https://github.com/nfs-ganesha/nfs-ganesha.git &>> ${logfile}`; `cd nfs-ganesha/src &>> ${logfile}`; `cmake ./ -DDEBUG_SYMS=ON -DCMAKE_PREFIX_PATH=/usr/ -DCMAKE_INSTALL_PREFIX=/usr/ &>> ${logfile}`; `gmake &>> ${logfile}`; `gmake install &>> ${logfile}`; } $functionmap{"build_ganesha20"} = \&build_ganesha20; sub test() { print "TEST!!\n"; } $functionmap{"test"} = \&test; open(LOG, ">>${logfile}"); foreach(@ARGV) { if ($functionmap{$_}) { print LOG "-----------------------------------------------------\n"; print LOG "-- Executing ${_}\n"; print LOG "-----------------------------------------------------\n"; close(LOG); $functionmap{$_}->(); open(LOG, ">>${logfile}"); } else { print LOG "-----------------------------------------------------\n"; print LOG "-- Failed to execute ${_}, there is no such function.\n"; print LOG "-----------------------------------------------------\n"; } } close(LOG);
true
7c48e20bd13ff26f8130dcd08f25d2ea45ea20d7
Shell
rfminelli/patrickbrandao_docker
/nuva-smokeping/run.sh
UTF-8
1,360
3.90625
4
[]
no_license
#!/bin/sh # # Script para rodar observium em ambiente simples, de maneira rapida # _abort(){ echo; echo $@; echo; exit 1; } # Variaveis IMAGE=nuva-smokeping NAME=$IMAGE LOOPBACK=100.127.255.81 UUID=$(uuid -1) # Apagar container atual [ "$1" = "restart" ] && { echo "Limpando..." docker stop $NAME 2>/dev/null docker stop $NAME 2>/dev/null docker rm $NAME 2>/dev/null } # Dados persistentes # - pasta compartilhada entre todas as VPSs SHAREDIR=/storage/shared mkdir -p $SHAREDIR # - pasta de dados privados persistentes da VPS DATADIR=/storage/$NAME mkdir -p $DATADIR # - pasta do smokeping SMOKEDIR=/storage/_smokeping/$IMAGE mkdir -p $SMOKEDIR/include mkdir -p $SMOKEDIR/lib # Rodar docker run -d --restart=always \ -h $NAME --name=$NAME \ --user=root --cap-add=ALL --privileged \ --env UUID=$UUID \ --env LOOPBACKS=$LOOPBACK \ --env ROOT_PASSWORD=tulipa \ -p 17080:80/tcp -p 17022:22/tcp \ --mount type=bind,source=$SHAREDIR,destination=/shared,readonly=false \ --mount type=bind,source=$DATADIR,destination=/data,readonly=false \ --mount type=bind,source=$SMOKEDIR/include,destination=/etc/smokeping/include,readonly=false \ --mount type=bind,source=$SMOKEDIR/lib,destination=/var/lib/smokeping,readonly=false \ $IMAGE || _abort "Erro ao rodar container: $NAME" exit
true
b45c0a411438bee1d50871f30120e2ff64dc3ec9
Shell
samwhelp/play-ubuntu-20.04-plan
/prototype-experiment/bspwm-enhance/config/wallpaper/bin/bsp-wallpaper
UTF-8
66,501
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env bash ################################################################################ ### Head: Link ## # * https://github.com/samwhelp/skel-project-plan/blob/gh-pages/demo/sh/standalone/bin/demo-ctrl # * https://github.com/samwhelp/play-ubuntu-20.04-plan/blob/master/prototype/bspwm/config/wallpaper/bin/bsp-wallpaper ## ### Tail: Link ################################################################################ ################################################################################ ### Head: Note ## ## ## ### Tail: Note ################################################################################ ################################################################################ ### Head: Init ## ##set -e ## for Exit immediately if a command exits with a non-zero status. THE_BASE_DIR_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) THE_CMD_FILE_NAME=$(basename $0) ## ### Tail: Init ################################################################################ ################################################################################ ### Head: Util / Debug ## util_debug_echo () { if is_debug; then echo "$@" 1>&2; fi } ## ### Head: Util / Debug ################################################################################ ################################################################################ ### Head: Base ## find_dir_path () { if [ ! -d $(dirname -- "$1") ]; then dirname -- "$1" return 1 fi echo $(cd -P -- "$(dirname -- "$1")" && pwd -P) } ##THIS_BASE_DIR_PATH=$(find_dir_path $0) ## $ export DEBUG_COMPTON_CTRL=true is_debug () { if [ "$DEBUG_COMPTON_CTRL" = "true" ]; then return 0 fi return 1 } is_not_debug () { ! is_debug } base_var_init () { #THE_PLAN_DIR_PATH=$(find_dir_path "$THE_BASE_DIR_PATH/../.") THE_PLAN_DIR_PATH=$(find_dir_path "$THE_BASE_DIR_PATH/.") THE_CMD_VERSION='0.1' THE_CMD_DIR_PATH="${THE_BASE_DIR_PATH}" if [ "none${THE_CMD_FILE_NAME}" = 'none' ]; then THE_CMD_FILE_NAME="bsp-wallpaper" fi THE_CMD_FILE_PATH="${THE_CMD_DIR_PATH}/$THE_CMD_FILE_NAME" ## https://github.com/samwhelp/play-ubuntu-20.04-plan/blob/master/prototype/bspwm/config/wallpaper/bin/bsp-wallpaper THE_SELF_UPDATE_URL='https://raw.githubusercontent.com/samwhelp/play-ubuntu-20.04-plan/master/prototype/bspwm/config/wallpaper/bin/bsp-wallpaper' THE_TMP_DIR_PATH="/tmp" THE_ASSET_DIR_NAME="asset" THE_ASSET_DIR_PATH="$THE_PLAN_DIR_PATH/$THE_ASSET_DIR_NAME" THE_VAR_DIR_NAME="var" THE_VAR_DIR_PATH="$THE_PLAN_DIR_PATH/$THE_VAR_DIR_NAME" THE_PROFILE_DIR_NAME=".${THE_CMD_FILE_NAME}-profile" THE_PROFILE_DIR_PATH="$HOME/$THE_PROFILE_DIR_NAME" THE_PROJECT_DIR_NAME="$THE_CMD_FILE_NAME" THE_PROJECT_DIR_PATH="$HOME/.local/share/$THE_PROJECT_DIR_NAME" THE_CONFIG_DIR_NAME="$THE_CMD_FILE_NAME" THE_CONFIG_DIR_PATH="$HOME/.config/$THE_CONFIG_DIR_NAME" THE_CACHE_DIR_NAME="$THE_CMD_FILE_NAME" THE_CACHE_DIR_PATH="$HOME/.cache/$THE_CACHE_DIR_NAME" } base_var_dump () { is_not_debug && return 0 util_debug_echo util_debug_echo "################################################################################" util_debug_echo "### Head: var_dump" util_debug_echo "##" util_debug_echo "#" util_debug_echo "THE_PLAN_DIR_PATH=$THE_PLAN_DIR_PATH" util_debug_echo "THE_CMD_FILE_NAME=$THE_CMD_FILE_NAME" util_debug_echo "THE_CMD_FILE_PATH=$THE_CMD_FILE_PATH" util_debug_echo "THE_CMD_DIR_PATH=$THE_CMD_DIR_PATH" util_debug_echo "THE_SELF_UPDATE_URL=$THE_SELF_UPDATE_URL" util_debug_echo "THE_TMP_DIR_PATH=$THE_TMP_DIR_PATH" util_debug_echo "THE_ASSET_DIR_NAME=$THE_ASSET_DIR_NAME" util_debug_echo "THE_ASSET_DIR_PATH=$THE_ASSET_DIR_PATH" util_debug_echo "THE_VAR_DIR_NAME=$THE_VAR_DIR_NAME" util_debug_echo "THE_VAR_DIR_PATH=$THE_VAR_DIR_PATH" util_debug_echo "THE_PROFILE_DIR_NAME=$THE_PROFILE_DIR_NAME" util_debug_echo "THE_PROFILE_DIR_PATH=$THE_PROFILE_DIR_PATH" util_debug_echo "THE_PROJECT_DIR_NAME=$THE_PROJECT_DIR_NAME" util_debug_echo "THE_PROJECT_DIR_PATH=$THE_PROJECT_DIR_PATH" util_debug_echo "THE_CONFIG_DIR_NAME=$THE_CONFIG_DIR_NAME" util_debug_echo "THE_CONFIG_DIR_PATH=$THE_CONFIG_DIR_PATH" util_debug_echo "THE_CACHE_DIR_NAME=$THE_CACHE_DIR_NAME" util_debug_echo "THE_CACHE_DIR_PATH=$THE_CACHE_DIR_PATH" util_debug_echo "#" util_debug_echo "##" util_debug_echo "### Tail: var_dump" util_debug_echo "################################################################################" util_debug_echo } base_var_init base_var_dump ## ### Tail: Base ################################################################################ ################################################################################ ### Head: Util / SubCmd ## sub_cmd_find_function_name () { echo "sub_run_$1" } ## ### Tail: Util / SubCmd ################################################################################ ################################################################################ ### Head: Util / Command ## util_check_command_exists () { local function_name="$1" ##if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then util_debug_echo "[Debug] Command_Not_Exist: function_name=$function_name" return 1 fi return 0 } util_open_dir () { local target_dir_path="$1" if util_check_command_exists 'pcmanfm-qt'; then echo "pcmanfm-qt $target_dir_path" pcmanfm-qt "$target_dir_path" elif util_check_command_exists 'exo-open'; then echo "exo-open $target_dir_path" exo-open "$target_dir_path" elif util_check_command_exists 'xdg-open'; then echo "xdg-open $target_dir_path" xdg-open "$target_dir_path" else echo "$target_dir_path" return 1 fi } ## ### Head: Util / Command ################################################################################ ################################################################################ ### Head: App / Util / Self_Update ## util_make_bin_dir () { mkdir -p "$HOME/bin" } util_make_tmp_dir () { THE_TMP_DIR_PATH="/tmp/tmp.$$.$RANDOM" mkdir "$THE_TMP_DIR_PATH" } util_self_update_download_to_tmp_dir () { local tmp_file_path="${THE_TMP_DIR_PATH}/${THE_CMD_FILE_NAME}" wget -c "$THE_SELF_UPDATE_URL" -O "$tmp_file_path" } util_self_update_install_from_tmp_dir () { local tmp_file_path="${THE_TMP_DIR_PATH}/${THE_CMD_FILE_NAME}" echo "install -m 755 $tmp_file_path $THE_CMD_FILE_PATH" install -m 755 "$tmp_file_path" "$THE_CMD_FILE_PATH" } util_self_update_check_cmd_exists () { if ! [ -f "$THE_CMD_FILE_PATH" ]; then ## file not exists return 0 fi echo "File is exists:" "$THE_CMD_FILE_PATH" echo echo "Try to backup:" echo local now=$(date +%Y%m%d_%s) local bak_dir_path="${THE_CMD_FILE_PATH}.bak" local bak_file_path="${bak_dir_path}/${THE_CMD_FILE_NAME}.bak.$now" mkdir -p $bak_dir_path mv -v "$THE_CMD_FILE_PATH" "${bak_file_path}" if [ "$?" != "0" ]; then echo echo 'Backup Failure!' exit 1 fi echo return 0 } util_self_update_print_version () { echo echo "Current Version:" "$THE_CMD_FILE_PATH" version } util_self_update () { util_make_bin_dir util_make_tmp_dir util_self_update_download_to_tmp_dir util_self_update_check_cmd_exists && util_self_update_install_from_tmp_dir util_self_update_print_version } main_version () { echo $THE_CMD_VERSION } util_self_actions () { grep '^sub_run' "${THE_CMD_FILE_PATH}" | cut -d ' ' -f 1 | awk -F 'sub_run_' '{print $2}' | sort -u } ## ### Tail: App / Util / Self_Update ################################################################################ ################################################################################ ### Head: Core / Util ## ## * https://dragonspring.pixnet.net/blog/post/32935895 function util_random_range() { if [ "$#" -lt "2" ]; then echo "Usage: random_range <low> <high>" return fi low=$1 ##range=$(($2 - $1)) range=$(($2 - $1 + 1)) ## Todo: range=0 echo $(($low+$RANDOM % $range)) } ## ### Tail: Core / Util ################################################################################ ################################################################################ ### Head: Core / Model / Routine / Feh ## wallpaper_sys_remove_fehbg () { rm -f "$HOME/.fehbg" } wallpaper_sys_use () { local img_file_path="$1" feh --bg-scale "$img_file_path" & } wallpaper_sys_view () { local img_file_path="$1" feh "$img_file_path" & } ## ### Tail: Core / Model / Routine / Feh ################################################################################ ################################################################################ ### Head: Core / Model / Routine / Fehbg ## wallpaper_sys_run_check_fehbg () { local load_last="$HOME/.fehbg" if [ -x "$HOME/.fehbg" ]; then ##echo 1 $load_last exit 0 fi ##echo 2 } wallpaper_sys_run_check_fehbg_first () { local load_last="$HOME/.fehbg" if [ -x "$HOME/.fehbg" ]; then ##echo 1 $load_last return 1 fi ##echo 2 return 0 } wallpaper_sys_use_check_fehbg () { wallpaper_sys_run_check_fehbg local img_file_path="$1" wallpaper_sys_use "$img_file_path" } wallpaper_sys_use_check_fehbg_first () { local img_file_path="$1" wallpaper_sys_run_check_fehbg_first && wallpaper_sys_use "$img_file_path" } wallpaper_sys_use_check_fehbg_first_v2 () { local img_file_path="$1" if wallpaper_sys_run_check_fehbg_first; then wallpaper_sys_use "$img_file_path" fi } wallpaper_sys_use_check_fehbg_first_v3 () { local img_file_path="$1" if ! wallpaper_sys_run_check_fehbg_first; then return 1 fi wallpaper_sys_use "$img_file_path" } ## ### Tail: Core / Model / Routine / Fehbg ################################################################################ ################################################################################ ### Head: Core / Model / Subject ## wallpaper_run_use () { local img_file_path="$@" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_use "$img_file_path" } ## ### Tail: Core / Model / Subject ################################################################################ ################################################################################ ### Head: Session / Model / Routine / Feh ## wallpaper_sys_session_stop () { killall -q -9 feh } wallpaper_sys_session_start () { wallpaper_sys_remove_fehbg ##bsp-wallpaper-start wallpaper_run_boot } wallpaper_sys_session_restart () { wallpaper_sys_session_stop wallpaper_sys_session_start } wallpaper_sys_session_reconfigure () { pkill -USR1 -x feh } wallpaper_sys_session_toggle () { if pgrep -x 'wallpaper' > /dev/null; then wallpaper_sys_session_stop else wallpaper_sys_session_start fi } ## ### Tail: Session / Model / Routine / Feh ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Routine ## wallpaper_sys_backgrounds_list () { local target_dir_path="$(wallpaper_sys_backgrounds_path_name_get_valid)" cd "$target_dir_path" ##ls -1 {*.jpg,*.png} ## https://stackoverflow.com/questions/48633997/grep-for-image-urls ## egrep -o 'src=".*(\.png|\.jpg)' index.html ## grep -E -o 'src=".*(\.png|\.jpg)' index.html ##ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg|\.svg)' ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg)' cd "$OLDPWD" } wallpaper_sys_backgrounds_list_count () { wallpaper_sys_backgrounds_list | wc -l } wallpaper_sys_backgrounds_use () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_backgrounds_path_name_get_valid)" local img_file_path="${target_dir_path}/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_backgrounds_use_name_set "$img_file_name" wallpaper_sys_use "$img_file_path" } wallpaper_sys_backgrounds_view () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_backgrounds_path_name_get_valid)" local img_file_path="${target_dir_path}/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_view "$img_file_path" } wallpaper_sys_backgrounds_open_dir () { local target_dir_path="$(wallpaper_sys_backgrounds_path_name_get_valid)" util_open_dir "$target_dir_path" } wallpaper_sys_option_backgrounds_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/dir_backgrounds/use" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option/dir_backgrounds" echo 'Frozen_sunset_on_the_lake_by_Manuel_Arslanyan.jpg' > "$HOME/.config/bspwm/wallpaper/option/dir_backgrounds/use" fi } wallpaper_sys_backgrounds_use_name_get () { wallpaper_sys_option_backgrounds_file_check cat "$HOME/.config/bspwm/wallpaper/option/dir_backgrounds/use" } wallpaper_sys_backgrounds_use_name_set () { wallpaper_sys_option_backgrounds_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/dir_backgrounds/use" } ## ### Tail: DirBackgrounds / Model / Routine ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Routine / Path ## wallpaper_sys_backgrounds_path_valid () { local target_dir_path_to_set="$1" local target_dir_path_valid if [ -d "$target_dir_path_to_set" ] ; then target_dir_path_valid="$target_dir_path_to_set" else target_dir_path_valid="$HOME/Pictures" fi if [ "none${target_dir_path_valid}" = "none" ]; then target_dir_path_valid="$HOME/Pictures" fi echo "$target_dir_path_valid" } wallpaper_sys_backgrounds_path_name_get () { echo '/usr/share/backgrounds' } wallpaper_sys_backgrounds_path_name_get_valid () { local target_dir_path="$(wallpaper_sys_backgrounds_path_name_get)" target_dir_path="$(wallpaper_sys_target_dir_path_valid $target_dir_path)" echo "$target_dir_path" } ## ### Tail: DirBackgrounds / Model / Routine / Path ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Routine / Next ## wallpaper_sys_backgrounds_next_select_num () { local backgrounds local current="$(wallpaper_sys_backgrounds_use_name_get)" local list local list_count=$(wallpaper_sys_backgrounds_list_count) local line=1 local next=1 list=$(wallpaper_sys_backgrounds_list) for backgrounds in $list ; do ##echo $line if [ "$current" == "$backgrounds" ] ; then #echo $backgrounds break; fi line=$(($line + 1)) done next=$(($line + 1)) if [ $next -gt $list_count ]; then next=1 fi echo $next } wallpaper_sys_backgrounds_next_select_name () { line=$(wallpaper_sys_backgrounds_next_select_num) wallpaper_sys_get_backgrounds_name_by_backgrounds_num "$line" } ## ### Tail: DirBackgrounds / Model / Routine / Next ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Routine / Random ## wallpaper_sys_backgrounds_random_select_num () { local start=1 local end=$(wallpaper_sys_backgrounds_list_count) util_random_range "$start" "$end" } wallpaper_sys_backgrounds_random_select_name () { line=$(wallpaper_sys_backgrounds_random_select_num) wallpaper_sys_get_backgrounds_name_by_backgrounds_num "$line" } wallpaper_sys_get_backgrounds_name_by_backgrounds_num () { local line="$1" wallpaper_sys_backgrounds_list | awk "FNR == $line {print}" } ## ### Tail: DirBackgrounds / Model / Routine / Random ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Routine / Fixed ## wallpaper_sys_backgrounds_fixed_select_name () { current="$(wallpaper_sys_backgrounds_use_name_get)" echo "$current" } ## ### Tail: DirBackgrounds / Model / Routine / Fixed ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Subject ## wallpaper_run_backgrounds_path () { wallpaper_sys_backgrounds_path_name_get_valid } wallpaper_run_backgrounds_list () { wallpaper_sys_backgrounds_list } wallpaper_run_backgrounds_use () { wallpaper_sys_backgrounds_use $@ } wallpaper_run_backgrounds_view () { wallpaper_sys_backgrounds_view $@ } wallpaper_run_backgrounds_open_dir () { wallpaper_sys_backgrounds_open_dir } wallpaper_run_backgrounds_next () { local img_file_name="$(wallpaper_sys_backgrounds_next_select_name)" echo $img_file_name wallpaper_sys_backgrounds_use "$img_file_name" } wallpaper_run_backgrounds_random () { local img_file_name="$(wallpaper_sys_backgrounds_random_select_name)" echo $img_file_name wallpaper_sys_backgrounds_use "$img_file_name" } wallpaper_run_backgrounds_fixed () { local img_file_name="$(wallpaper_sys_backgrounds_fixed_select_name)" echo $img_file_name wallpaper_sys_backgrounds_use "$img_file_name" } wallpaper_run_backgrounds_recent () { ##wallpaper_sys_run_check_fehbg_first && wallpaper_run_backgrounds_fixed wallpaper_sys_run_check_fehbg wallpaper_run_backgrounds_fixed } ## ### Tail: DirBackgrounds / Model / Subject ################################################################################ ################################################################################ ### Head: DirPictures / Model / Routine ## wallpaper_sys_pictures_list () { local target_dir_path="$(wallpaper_sys_pictures_path_name_get_valid)" mkdir -p "$target_dir_path" cd "$target_dir_path" ##ls -1 {*.jpg,*.png} ##ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg|\.svg)' ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg)' cd "$OLDPWD" } wallpaper_sys_pictures_list_count () { wallpaper_sys_pictures_list | wc -l } wallpaper_sys_pictures_use () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_pictures_path_name_get_valid)" local img_file_path="${target_dir_path}/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_pictures_use_name_set "$img_file_name" wallpaper_sys_use "$img_file_path" } wallpaper_sys_pictures_view () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_pictures_path_name_get_valid)" local img_file_path="${target_dir_path}/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_view "$img_file_path" } wallpaper_sys_pictures_open_dir () { local target_dir_path="$(wallpaper_sys_pictures_path_name_get_valid)" util_open_dir "$target_dir_path" } wallpaper_sys_option_pictures_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/dir_pictures/use" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option/dir_pictures" echo 'wallpaper.jpg' > "$HOME/.config/bspwm/wallpaper/option/dir_pictures/use" fi } wallpaper_sys_pictures_use_name_get () { wallpaper_sys_option_pictures_file_check cat "$HOME/.config/bspwm/wallpaper/option/dir_pictures/use" } wallpaper_sys_pictures_use_name_set () { wallpaper_sys_option_pictures_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/dir_pictures/use" } ## ### Tail: DirPictures / Model / Routine ################################################################################ ################################################################################ ### Head: DirPictures / Model / Routine / Path ## wallpaper_sys_pictures_path_valid () { local target_dir_path_to_set="$1" local target_dir_path_valid if [ -d "$target_dir_path_to_set" ] ; then target_dir_path_valid="$target_dir_path_to_set" else target_dir_path_valid="/usr/share/backgrounds" fi if [ "none${target_dir_path_valid}" = "none" ]; then target_dir_path_valid="/usr/share/backgrounds" fi echo "$target_dir_path_valid" } wallpaper_sys_pictures_path_name_get () { echo "$HOME/Pictures/Wallpaper" } wallpaper_sys_pictures_path_name_get_valid () { local target_dir_path="$(wallpaper_sys_pictures_path_name_get)" target_dir_path="$(wallpaper_sys_target_dir_path_valid $target_dir_path)" echo "$target_dir_path" } ## ### Tail: DirPictures / Model / Routine / Path ################################################################################ ################################################################################ ### Head: DirPictures / Model / Routine / Next ## wallpaper_sys_pictures_next_select_num () { local pictures local current="$(wallpaper_sys_pictures_use_name_get)" local list local list_count=$(wallpaper_sys_pictures_list_count) local line=1 local next=1 list=$(wallpaper_sys_pictures_list) for pictures in $list ; do ##echo $line if [ "$current" == "$pictures" ] ; then #echo $pictures break; fi line=$(($line + 1)) done next=$(($line + 1)) if [ $next -gt $list_count ]; then next=1 fi echo $next } wallpaper_sys_pictures_next_select_name () { line=$(wallpaper_sys_pictures_next_select_num) wallpaper_sys_get_pictures_name_by_pictures_num "$line" } ## ### Tail: DirPictures / Model / Routine / Next ################################################################################ ################################################################################ ### Head: DirPictures / Model / Routine / Random ## wallpaper_sys_pictures_random_select_num () { local start=1 local end=$(wallpaper_sys_pictures_list_count) util_random_range "$start" "$end" } wallpaper_sys_pictures_random_select_name () { line=$(wallpaper_sys_pictures_random_select_num) wallpaper_sys_get_pictures_name_by_pictures_num "$line" } wallpaper_sys_get_pictures_name_by_pictures_num () { local line="$1" wallpaper_sys_pictures_list | awk "FNR == $line {print}" } ## ### Tail: DirPictures / Model / Routine / Random ################################################################################ ################################################################################ ### Head: DirPictures / Model / Routine / Fixed ## wallpaper_sys_pictures_fixed_select_name () { current="$(wallpaper_sys_pictures_use_name_get)" echo "$current" } ## ### Tail: DirPictures / Model / Routine / Fixed ################################################################################ ################################################################################ ### Head: DirPictures / Model / Subject ## wallpaper_run_pictures_path () { wallpaper_sys_pictures_path_name_get_valid } wallpaper_run_pictures_list () { wallpaper_sys_pictures_list } wallpaper_run_pictures_use () { wallpaper_sys_pictures_use $@ } wallpaper_run_pictures_view () { wallpaper_sys_pictures_view $@ } wallpaper_run_pictures_open_dir () { wallpaper_sys_pictures_open_dir } wallpaper_run_pictures_next () { local img_file_name="$(wallpaper_sys_pictures_next_select_name)" echo $img_file_name wallpaper_sys_pictures_use "$img_file_name" } wallpaper_run_pictures_random () { local img_file_name="$(wallpaper_sys_pictures_random_select_name)" echo $img_file_name wallpaper_sys_pictures_use "$img_file_name" } wallpaper_run_pictures_fixed () { local img_file_name="$(wallpaper_sys_pictures_fixed_select_name)" echo $img_file_name wallpaper_sys_pictures_use "$img_file_name" } wallpaper_run_pictures_recent () { ##wallpaper_sys_run_check_fehbg_first && wallpaper_run_pictures_fixed wallpaper_sys_run_check_fehbg wallpaper_run_pictures_fixed } ## ### Tail: DirPictures / Model / Subject ################################################################################ ################################################################################ ### Head: DirXfce4Backdrops / Model / Routine ## wallpaper_sys_xfce4_backdrops_list () { local target_dir_path="$(wallpaper_sys_xfce4_backdrops_path_name_get_valid)" mkdir -p "$target_dir_path" cd "$target_dir_path" ##ls -1 {*.jpg,*.png} ##ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg|\.svg)' ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg)' cd "$OLDPWD" } wallpaper_sys_xfce4_backdrops_list_count () { wallpaper_sys_xfce4_backdrops_list | wc -l } wallpaper_sys_xfce4_backdrops_use () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_xfce4_backdrops_path_name_get_valid)" local img_file_path="${target_dir_path}/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_xfce4_backdrops_use_name_set "$img_file_name" wallpaper_sys_use "$img_file_path" } wallpaper_sys_xfce4_backdrops_view () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_xfce4_backdrops_path_name_get_valid)" local img_file_path="${target_dir_path}/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_view "$img_file_path" } wallpaper_sys_xfce4_backdrops_open_dir () { local target_dir_path="$(wallpaper_sys_xfce4_backdrops_path_name_get_valid)" util_open_dir "$target_dir_path" } wallpaper_sys_option_xfce4_backdrops_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/dir_xfce4_backdrops/use" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option/dir_xfce4_backdrops" echo 'balance.jpg' > "$HOME/.config/bspwm/wallpaper/option/dir_xfce4_backdrops/use" fi } wallpaper_sys_xfce4_backdrops_use_name_get () { wallpaper_sys_option_xfce4_backdrops_file_check cat "$HOME/.config/bspwm/wallpaper/option/dir_xfce4_backdrops/use" } wallpaper_sys_xfce4_backdrops_use_name_set () { wallpaper_sys_option_xfce4_backdrops_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/dir_xfce4_backdrops/use" } ## ### Tail: DirXfce4Backdrops / Model / Routine ################################################################################ ################################################################################ ### Head: DirBackgrounds / Model / Routine / Path ## wallpaper_sys_xfce4_backdrops_path_valid () { local target_dir_path_to_set="$1" local target_dir_path_valid if [ -d "$target_dir_path_to_set" ] ; then target_dir_path_valid="$target_dir_path_to_set" else target_dir_path_valid="/usr/share/backgrounds" fi if [ "none${target_dir_path_valid}" = "none" ]; then target_dir_path_valid="/usr/share/backgrounds" fi echo "$target_dir_path_valid" } wallpaper_sys_xfce4_backdrops_path_name_get () { echo '/usr/share/xfce4/backdrops' } wallpaper_sys_xfce4_backdrops_path_name_get_valid () { local target_dir_path="$(wallpaper_sys_xfce4_backdrops_path_name_get)" target_dir_path="$(wallpaper_sys_target_dir_path_valid $target_dir_path)" echo "$target_dir_path" } ## ### Tail: DirBackgrounds / Model / Routine / Path ################################################################################ ################################################################################ ### Head: DirXfce4Backdrops / Model / Routine / Next ## wallpaper_sys_xfce4_backdrops_next_select_num () { local xfce4_backdrops local current="$(wallpaper_sys_xfce4_backdrops_use_name_get)" local list local list_count=$(wallpaper_sys_xfce4_backdrops_list_count) local line=1 local next=1 list=$(wallpaper_sys_xfce4_backdrops_list) for xfce4_backdrops in $list ; do ##echo $line if [ "$current" == "$xfce4_backdrops" ] ; then #echo $xfce4_backdrops break; fi line=$(($line + 1)) done next=$(($line + 1)) if [ $next -gt $list_count ]; then next=1 fi echo $next } wallpaper_sys_xfce4_backdrops_next_select_name () { line=$(wallpaper_sys_xfce4_backdrops_next_select_num) wallpaper_sys_get_xfce4_backdrops_name_by_xfce4_backdrops_num "$line" } ## ### Tail: DirXfce4Backdrops / Model / Routine / Next ################################################################################ ################################################################################ ### Head: DirXfce4Backdrops / Model / Routine / Random ## wallpaper_sys_xfce4_backdrops_random_select_num () { local start=1 local end=$(wallpaper_sys_xfce4_backdrops_list_count) util_random_range "$start" "$end" } wallpaper_sys_xfce4_backdrops_random_select_name () { line=$(wallpaper_sys_xfce4_backdrops_random_select_num) wallpaper_sys_get_xfce4_backdrops_name_by_xfce4_backdrops_num "$line" } wallpaper_sys_get_xfce4_backdrops_name_by_xfce4_backdrops_num () { local line="$1" wallpaper_sys_xfce4_backdrops_list | awk "FNR == $line {print}" } ## ### Tail: DirXfce4Backdrops / Model / Routine / Random ################################################################################ ################################################################################ ### Head: DirXfce4Backdrops / Model / Routine / Fixed ## wallpaper_sys_xfce4_backdrops_fixed_select_name () { current="$(wallpaper_sys_xfce4_backdrops_use_name_get)" echo "$current" } ## ### Tail: DirXfce4Backdrops / Model / Routine / Fixed ################################################################################ ################################################################################ ### Head: DirXfce4Backdrops / Model / Subject ## wallpaper_run_xfce4_backdrops_path () { wallpaper_sys_xfce4_backdrops_path_name_get_valid } wallpaper_run_xfce4_backdrops_list () { wallpaper_sys_xfce4_backdrops_list } wallpaper_run_xfce4_backdrops_use () { wallpaper_sys_xfce4_backdrops_use $@ } wallpaper_run_xfce4_backdrops_view () { wallpaper_sys_xfce4_backdrops_view $@ } wallpaper_run_xfce4_backdrops_open_dir () { wallpaper_sys_xfce4_backdrops_open_dir } wallpaper_run_xfce4_backdrops_next () { local img_file_name="$(wallpaper_sys_xfce4_backdrops_next_select_name)" echo $img_file_name wallpaper_sys_xfce4_backdrops_use "$img_file_name" } wallpaper_run_xfce4_backdrops_random () { local img_file_name="$(wallpaper_sys_xfce4_backdrops_random_select_name)" echo $img_file_name wallpaper_sys_xfce4_backdrops_use "$img_file_name" } wallpaper_run_xfce4_backdrops_fixed () { local img_file_name="$(wallpaper_sys_xfce4_backdrops_fixed_select_name)" echo $img_file_name wallpaper_sys_xfce4_backdrops_use "$img_file_name" } wallpaper_run_xfce4_backdrops_recent () { ##wallpaper_sys_run_check_fehbg_first && wallpaper_run_xfce4_backdrops_fixed wallpaper_sys_run_check_fehbg wallpaper_run_xfce4_backdrops_fixed } ## ### Tail: DirXfce4Backdrops / Model / Subject ################################################################################ ################################################################################ ### Head: DirTargetDir / Model / Routine ## wallpaper_sys_target_dir_list () { local target_dir_path="$(wallpaper_sys_target_dir_path_name_get_valid)" mkdir -p "$target_dir_path" cd "$target_dir_path" ##ls -1 {*.jpg,*.png} ##ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg|\.svg)' ls -1 | grep -E -o '.*(\.png|\.jpg|\.jpeg)' cd "$OLDPWD" } wallpaper_sys_target_dir_list_count () { wallpaper_sys_target_dir_list | wc -l } wallpaper_sys_target_dir_use () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_target_dir_path_name_get_valid)" local img_file_path="$target_dir_path/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_target_dir_use_name_set "$img_file_name" wallpaper_sys_use "$img_file_path" } wallpaper_sys_target_dir_view () { local img_file_name="$@" if [ "none${img_file_name}" = "none" ]; then echo 'Need {img_file_name}' return fi local target_dir_path="$(wallpaper_sys_target_dir_path_name_get_valid)" local img_file_path="$target_dir_path/${img_file_name}" if ! [ -f "$img_file_path" ]; then echo "File_Not_Exists: ${img_file_path}" return 1 fi wallpaper_sys_view "$img_file_path" } wallpaper_sys_target_dir_open_dir () { local target_dir_path="$(wallpaper_sys_target_dir_path_name_get_valid)" util_open_dir "$target_dir_path" } wallpaper_sys_option_target_dir_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/dir_target_dir/use" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option/dir_target_dir" echo 'wallpaper.jpg' > "$HOME/.config/bspwm/wallpaper/option/dir_target_dir/use" fi } wallpaper_sys_target_dir_use_name_get () { wallpaper_sys_option_target_dir_file_check cat "$HOME/.config/bspwm/wallpaper/option/dir_target_dir/use" } wallpaper_sys_target_dir_use_name_set () { wallpaper_sys_option_target_dir_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/dir_target_dir/use" } ## ### Tail: DirTargetDir / Model / Routine ################################################################################ ################################################################################ ### Head: DirTargetDir / Model / Routine / Path ## wallpaper_sys_target_dir_path_valid () { local target_dir_path_to_set="$1" local target_dir_path_valid if [ -d "$target_dir_path_to_set" ] ; then target_dir_path_valid="$target_dir_path_to_set" else target_dir_path_valid='/usr/share/backgrounds' fi if [ "none${target_dir_path_valid}" = "none" ]; then target_dir_path_valid='/usr/share/backgrounds' fi echo "$target_dir_path_valid" } wallpaper_sys_option_target_dir_path_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/target_dir_path" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option" echo '/usr/share/backgrounds' > "$HOME/.config/bspwm/wallpaper/option/target_dir_path" fi } wallpaper_sys_target_dir_path_name_get () { wallpaper_sys_option_target_dir_path_file_check cat "$HOME/.config/bspwm/wallpaper/option/target_dir_path" } wallpaper_sys_target_dir_path_name_set () { wallpaper_sys_option_target_dir_path_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/target_dir_path" } wallpaper_sys_target_dir_path_name_get_valid () { ##echo wallpaper_sys_target_dir_path_name_get_valid local target_dir_path="$(wallpaper_sys_target_dir_path_name_get)" target_dir_path="$(wallpaper_sys_target_dir_path_valid $target_dir_path)" echo "$target_dir_path" } wallpaper_sys_target_dir_path_name_set_valid () { ##echo wallpaper_sys_target_dir_path_name_set_valid local target_dir_path="$1" target_dir_path="$(wallpaper_sys_target_dir_path_valid $target_dir_path)" wallpaper_sys_target_dir_path_name_set "$target_dir_path" echo "$target_dir_path" } ## ### Tail: DirTargetDir / Model / Routine / Path ################################################################################ ################################################################################ ### Head: DirTargetDir / Model / Routine / Next ## wallpaper_sys_target_dir_next_select_num () { local target_dir local current="$(wallpaper_sys_target_dir_use_name_get)" local list local list_count=$(wallpaper_sys_target_dir_list_count) local line=1 local next=1 list=$(wallpaper_sys_target_dir_list) for target_dir in $list ; do ##echo $line if [ "$current" == "$target_dir" ] ; then #echo $target_dir break; fi line=$(($line + 1)) done next=$(($line + 1)) if [ $next -gt $list_count ]; then next=1 fi echo $next } wallpaper_sys_target_dir_next_select_name () { line=$(wallpaper_sys_target_dir_next_select_num) wallpaper_sys_get_target_dir_name_by_target_dir_num "$line" } ## ### Tail: DirTargetDir / Model / Routine / Next ################################################################################ ################################################################################ ### Head: DirTargetDir / Model / Routine / Random ## wallpaper_sys_target_dir_random_select_num () { local start=1 local end=$(wallpaper_sys_target_dir_list_count) util_random_range "$start" "$end" } wallpaper_sys_target_dir_random_select_name () { line=$(wallpaper_sys_target_dir_random_select_num) wallpaper_sys_get_target_dir_name_by_target_dir_num "$line" } wallpaper_sys_get_target_dir_name_by_target_dir_num () { local line="$1" wallpaper_sys_target_dir_list | awk "FNR == $line {print}" } ## ### Tail: DirTargetDir / Model / Routine / Random ################################################################################ ################################################################################ ### Head: DirTargetDir / Model / Routine / Fixed ## wallpaper_sys_target_dir_fixed_select_name () { current="$(wallpaper_sys_target_dir_use_name_get)" echo "$current" } ## ### Tail: DirTargetDir / Model / Routine / Fixed ################################################################################ ################################################################################ ### Head: DirTargetDir / Model / Subject ## wallpaper_run_target_dir_path () { local target_dir_path="$1" if [ "none${target_dir_path}" = "none" ]; then wallpaper_sys_target_dir_path_name_get_valid return fi wallpaper_sys_target_dir_path_name_set_valid "$target_dir_path" } wallpaper_run_target_dir_list () { wallpaper_sys_target_dir_list } wallpaper_run_target_dir_use () { wallpaper_sys_target_dir_use $@ } wallpaper_run_target_dir_view () { wallpaper_sys_target_dir_view $@ } wallpaper_run_target_dir_open_dir () { wallpaper_sys_target_dir_open_dir } wallpaper_run_target_dir_next () { local img_file_name="$(wallpaper_sys_target_dir_next_select_name)" echo $img_file_name wallpaper_sys_target_dir_use "$img_file_name" } wallpaper_run_target_dir_random () { local img_file_name="$(wallpaper_sys_target_dir_random_select_name)" echo $img_file_name wallpaper_sys_target_dir_use "$img_file_name" } wallpaper_run_target_dir_fixed () { local img_file_name="$(wallpaper_sys_target_dir_fixed_select_name)" echo $img_file_name wallpaper_sys_target_dir_use "$img_file_name" } wallpaper_run_target_dir_recent () { ##wallpaper_sys_run_check_fehbg_first && wallpaper_run_target_dir_fixed wallpaper_sys_run_check_fehbg wallpaper_run_target_dir_fixed } ## ### Tail: DirTargetDir / Model / Subject ################################################################################ ################################################################################ ### Head: List / Model / Routine / ListType ## wallpaper_sys_list_type_valid () { local list_type_enum="$(wallpaper_sys_list_type_enum)" local list_type_to_set="$1" local list_type local list_type_valid for list_type in $list_type_enum ; do if [ "$list_type_to_set" == "$list_type" ] ; then list_type_valid="$list_type_to_set" break; fi done if [ "none${list_type_valid}" = "none" ]; then list_type_valid='backgrounds' fi echo "$list_type_valid" } wallpaper_sys_list_type_enum () { cat << EOF theme backgrounds pictures xfce4_backdrops target_dir EOF } wallpaper_sys_option_list_type_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/list_type" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option" echo 'backgrounds' > "$HOME/.config/bspwm/wallpaper/option/list_type" fi } wallpaper_sys_list_type_name_get () { wallpaper_sys_option_list_type_file_check cat "$HOME/.config/bspwm/wallpaper/option/list_type" } wallpaper_sys_list_type_name_set () { wallpaper_sys_option_list_type_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/list_type" } wallpaper_sys_list_type_name_get_valid () { ##echo wallpaper_sys_list_type_name_get_valid local list_type="$(wallpaper_sys_list_type_name_get)" list_type="$(wallpaper_sys_list_type_valid $list_type)" echo "$list_type" } wallpaper_sys_list_type_name_set_valid () { ##echo wallpaper_sys_list_type_name_set_valid local list_type="$1" list_type="$(wallpaper_sys_list_type_valid $list_type)" wallpaper_sys_list_type_name_set "$list_type" echo "$list_type" } ## ### Tail: List / Model / Routine / ListType ################################################################################ ################################################################################ ### Head: List / Model / Routine ## wallpaper_sys_run_list_find_function_name () { echo "wallpaper_run_list_sub_$1" } wallpaper_sys_run_next_find_function_name () { echo "wallpaper_run_next_sub_$1" } wallpaper_sys_run_random_find_function_name () { echo "wallpaper_run_random_sub_$1" } wallpaper_sys_run_fixed_find_function_name () { echo "wallpaper_run_fixed_sub_$1" } wallpaper_sys_run_recent_find_function_name () { echo "wallpaper_run_recent_sub_$1" } ## ### Tail: List / Model / Routine ################################################################################ ################################################################################ ### Head: List / Model / Subject / ListType ## wallpaper_run_list_type_enum () { wallpaper_sys_list_type_enum } wallpaper_run_list_type () { local list_type="$1" if [ "none${list_type}" = "none" ]; then wallpaper_sys_list_type_name_get_valid return fi wallpaper_sys_list_type_name_set_valid "$list_type" } ## ### Tail: List / Model / Subject / ListType ################################################################################ ################################################################################ ### Head: List / Model / Subject / List / Sub ## wallpaper_run_list_sub_default () { ##util_debug_echo 'wallpaper_run_list_sub_default' wallpaper_run_backgrounds_list } wallpaper_run_list_sub_theme () { ##util_debug_echo 'wallpaper_run_list_sub_theme' wallpaper_run_theme_list } wallpaper_run_list_sub_backgrounds () { ##util_debug_echo 'wallpaper_run_list_sub_backgrounds' wallpaper_run_backgrounds_list } wallpaper_run_list_sub_pictures () { ##util_debug_echo 'wallpaper_run_list_sub_pictures' wallpaper_run_pictures_list } wallpaper_run_list_sub_xfce4_backdrops () { ##util_debug_echo 'wallpaper_run_list_sub_xfce4_backdrops' wallpaper_run_xfce4_backdrops_list } wallpaper_run_list_sub_target_dir () { ##util_debug_echo 'wallpaper_run_list_sub_target_dir' wallpaper_run_target_dir_list } ## ### Tail: List / Model / Subject / List / Sub ################################################################################ ################################################################################ ### Head: List / Model / Subject / Next / Sub ## wallpaper_run_next_sub_default () { ##util_debug_echo 'wallpaper_run_next_sub_default' wallpaper_run_backgrounds_next } wallpaper_run_next_sub_theme () { ##util_debug_echo 'wallpaper_run_next_sub_theme' wallpaper_run_theme_next } wallpaper_run_next_sub_backgrounds () { ##util_debug_echo 'wallpaper_run_next_sub_backgrounds' wallpaper_run_backgrounds_next } wallpaper_run_next_sub_pictures () { ##util_debug_echo 'wallpaper_run_next_sub_pictures' wallpaper_run_pictures_next } wallpaper_run_next_sub_xfce4_backdrops () { ##util_debug_echo 'wallpaper_run_next_sub_xfce4_backdrops' wallpaper_run_xfce4_backdrops_next } wallpaper_run_next_sub_target_dir () { ##util_debug_echo 'wallpaper_run_next_sub_target_dir' wallpaper_run_target_dir_next } ## ### Tail: List / Model / Subject / Next / Sub ################################################################################ ################################################################################ ### Head: List / Model / Subject / Random / Sub ## wallpaper_run_random_sub_default () { ##util_debug_echo 'wallpaper_run_random_sub_default' wallpaper_run_backgrounds_random } wallpaper_run_random_sub_theme () { ##util_debug_echo 'wallpaper_run_random_sub_theme' wallpaper_run_theme_random } wallpaper_run_random_sub_backgrounds () { ##util_debug_echo 'wallpaper_run_random_sub_backgrounds' wallpaper_run_backgrounds_random } wallpaper_run_random_sub_pictures () { ##util_debug_echo 'wallpaper_run_random_sub_pictures' wallpaper_run_pictures_random } wallpaper_run_random_sub_xfce4_backdrops () { ##util_debug_echo 'wallpaper_run_random_sub_xfce4_backdrops' wallpaper_run_xfce4_backdrops_random } wallpaper_run_random_sub_target_dir () { ##util_debug_echo 'wallpaper_run_random_sub_target_dir' wallpaper_run_target_dir_random } ## ### Tail: List / Model / Subject / Random / Sub ################################################################################ ################################################################################ ### Head: List / Model / Subject / Fixed / Sub ## wallpaper_run_fixed_sub_default () { ##util_debug_echo 'wallpaper_run_fixed_sub_default' wallpaper_run_backgrounds_fixed } wallpaper_run_fixed_sub_theme () { ##util_debug_echo 'wallpaper_run_fixed_sub_theme' wallpaper_run_theme_fixed } wallpaper_run_fixed_sub_backgrounds () { ##util_debug_echo 'wallpaper_run_fixed_sub_backgrounds' wallpaper_run_backgrounds_fixed } wallpaper_run_fixed_sub_pictures () { ##util_debug_echo 'wallpaper_run_fixed_sub_pictures' wallpaper_run_pictures_fixed } wallpaper_run_fixed_sub_xfce4_backdrops () { ##util_debug_echo 'wallpaper_run_fixed_sub_xfce4_backdrops' wallpaper_run_xfce4_backdrops_fixed } wallpaper_run_fixed_sub_target_dir () { ##util_debug_echo 'wallpaper_run_fixed_sub_target_dir' wallpaper_run_target_dir_fixed } ## ### Tail: List / Model / Subject / Fixed / Sub ################################################################################ ################################################################################ ### Head: List / Model / Subject / Recent / Sub ## wallpaper_run_recent_sub_default () { ##util_debug_echo 'wallpaper_run_recent_sub_default' wallpaper_run_backgrounds_recent } wallpaper_run_recent_sub_theme () { ##util_debug_echo 'wallpaper_run_recent_sub_theme' wallpaper_run_theme_recent } wallpaper_run_recent_sub_backgrounds () { ##util_debug_echo 'wallpaper_run_recent_sub_backgrounds' wallpaper_run_backgrounds_recent } wallpaper_run_recent_sub_pictures () { ##util_debug_echo 'wallpaper_run_recent_sub_pictures' wallpaper_run_pictures_recent } wallpaper_run_recent_sub_xfce4_backdrops () { ##util_debug_echo 'wallpaper_run_recent_sub_xfce4_backdrops' wallpaper_run_xfce4_backdrops_recent } wallpaper_run_recent_sub_target_dir () { ##util_debug_echo 'wallpaper_run_recent_sub_target_dir' wallpaper_run_target_dir_recent } ## ### Tail: List / Model / Subject / Recent / Sub ################################################################################ ################################################################################ ### Head: List / Model / Subject ## wallpaper_run_list () { local args="$@" local list_type="$(wallpaper_sys_list_type_name_get_valid)" local function_name="$(wallpaper_sys_run_list_find_function_name $list_type)" ##echo $function_name # if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then ##util_debug_echo "[Debug] wallpaper_run_list_sub_not_exist: list_type=$list_type; function_name=$function_name" wallpaper_run_list_sub_default "$args" return 0 fi "$function_name" "$args" ## run sub function } wallpaper_run_next () { local args="$@" local list_type="$(wallpaper_sys_list_type_name_get_valid)" local function_name="$(wallpaper_sys_run_next_find_function_name $list_type)" ##echo $function_name # if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then ##util_debug_echo "[Debug] wallpaper_run_list_sub_not_exist: list_type=$list_type; function_name=$function_name" wallpaper_run_next_sub_default "$args" return 0 fi "$function_name" "$args" ## run sub function } wallpaper_run_random () { local args="$@" local list_type="$(wallpaper_sys_list_type_name_get_valid)" local function_name="$(wallpaper_sys_run_random_find_function_name $list_type)" ##echo $function_name # if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then ##util_debug_echo "[Debug] wallpaper_run_list_sub_not_exist: list_type=$list_type; function_name=$function_name" wallpaper_run_random_sub_default "$args" return 0 fi "$function_name" "$args" ## run sub function } wallpaper_run_fixed () { local args="$@" local list_type="$(wallpaper_sys_list_type_name_get_valid)" local function_name="$(wallpaper_sys_run_fixed_find_function_name $list_type)" ##echo $function_name # if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then ##util_debug_echo "[Debug] wallpaper_run_list_sub_not_exist: list_type=$list_type; function_name=$function_name" wallpaper_run_fixed_sub_default "$args" return 0 fi "$function_name" "$args" ## run sub function } wallpaper_run_recent () { local args="$@" local list_type="$(wallpaper_sys_list_type_name_get_valid)" local function_name="$(wallpaper_sys_run_recent_find_function_name $list_type)" ##echo $function_name # if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then ##util_debug_echo "[Debug] wallpaper_run_list_sub_not_exist: list_type=$list_type; function_name=$function_name" wallpaper_run_recent_sub_default "$args" return 0 fi "$function_name" "$args" ## run sub function } ## ### Tail: List / Model / Subject ################################################################################ ################################################################################ ### Head: List / Model / Routine / BootType ## wallpaper_sys_boot_type_valid () { local boot_type_enum="$(wallpaper_sys_boot_type_enum)" local boot_type_to_set="$1" local boot_type local boot_type_valid for boot_type in $boot_type_enum ; do if [ "$boot_type_to_set" == "$boot_type" ] ; then boot_type_valid="$boot_type_to_set" break; fi done if [ "none${boot_type_valid}" = "none" ]; then boot_type_valid='recent' fi echo "$boot_type_valid" } wallpaper_sys_boot_type_enum () { cat << EOF off recent fixed next random EOF } wallpaper_sys_option_boot_type_file_check () { if ! [ -e "$HOME/.config/bspwm/wallpaper/option/boot_type" ] ; then mkdir -p "$HOME/.config/bspwm/wallpaper/option" echo 'recent' > "$HOME/.config/bspwm/wallpaper/option/boot_type" fi } wallpaper_sys_boot_type_name_get () { wallpaper_sys_option_boot_type_file_check cat "$HOME/.config/bspwm/wallpaper/option/boot_type" } wallpaper_sys_boot_type_name_set () { wallpaper_sys_option_boot_type_file_check echo "$1" > "$HOME/.config/bspwm/wallpaper/option/boot_type" } wallpaper_sys_boot_type_name_get_valid () { ##echo wallpaper_sys_boot_type_name_get_valid local boot_type="$(wallpaper_sys_boot_type_name_get)" boot_type="$(wallpaper_sys_boot_type_valid $boot_type)" echo "$boot_type" } wallpaper_sys_boot_type_name_set_valid () { ##echo wallpaper_sys_boot_type_name_set_valid local boot_type="$1" boot_type="$(wallpaper_sys_boot_type_valid $boot_type)" wallpaper_sys_boot_type_name_set "$boot_type" echo "$boot_type" } ## ### Tail: List / Model / Routine / BootType ################################################################################ ################################################################################ ### Head: Boot / Model / Routine / Theme ## wallpaper_boot_util_start_v1 () { local config_dir_path="$1" local conf ##for conf in "$config_dir_path"/*.conf ; do for conf in "$config_dir_path"/main.conf ; do #echo $conf feh --bg-scale $(cat "$conf") & done } wallpaper_boot_util_start_v2 () { local config_dir_path="$1" local conf ##for conf in $(find "$config_dir_path" -name *.conf); do for conf in $(find "$config_dir_path" -name main.conf); do #echo $conf feh --bg-scale $(cat "$conf") & done } wallpaper_boot_theme_config_dir_path () { local theme_dir_path="$(wallpaper_boot_theme_dir_path)" local theme_config_dir_path="$theme_dir_path/config/on" if [ -d "$theme_config_dir_path" ] ; then echo "$theme_config_dir_path" return 0 fi echo "$theme_dir_path" return 1 } wallpaper_boot_theme_dir_path () { local theme_dir_path theme_dir_path="$(wallpaper_boot_theme_dir_path_find_by_option)" if [ -d "$theme_dir_path" ] ; then echo "$theme_dir_path" return 0 fi theme_dir_path="$(wallpaper_boot_theme_dir_path_find_by_default)" if [ -d "$theme_dir_path" ] ; then echo "$theme_dir_path" return 0 fi theme_dir_path="$HOME/.config/wallpaper" echo "$theme_dir_path" return 0 } wallpaper_boot_theme_dir_path_find_by_option () { ## ~/.config/bspwm/wallpaper/theme/some_theme wallpaper_boot_theme_dir_path_create $(wallpaper_boot_option_theme_get) } wallpaper_boot_theme_dir_path_find_by_default () { ## ~/.config/bspwm/wallpaper/theme/default wallpaper_boot_theme_dir_path_create $(wallpaper_boot_option_theme_default) } wallpaper_boot_theme_dir_path_create () { local theme_name="$1" ## ~/.config/bspwm/wallpaper/theme/theme_name echo "$HOME/.config/bspwm/wallpaper/theme/$theme_name" } wallpaper_boot_option_theme_default () { echo 'default' } wallpaper_boot_option_theme_get () { wallpaper_sys_option_theme_file_check ## ~/.config/bspwm/wallpaper/option/theme cat "$HOME/.config/bspwm/wallpaper/option/theme" } ## ### Tail: Boot / Model / Routine / Theme ################################################################################ ################################################################################ ### Head: Boot / Model / Routine ## wallpaper_sys_run_boot_find_function_name () { echo "wallpaper_run_boot_sub_$1" } ## ### Tail: Boot / Model / Routine ################################################################################ ################################################################################ ### Head: Boot / Model / Subject / BootType ## wallpaper_run_boot_type_enum () { wallpaper_sys_boot_type_enum } wallpaper_run_boot_type () { local boot_type="$1" if [ "none${boot_type}" = "none" ]; then wallpaper_sys_boot_type_name_get_valid return fi wallpaper_sys_boot_type_name_set_valid "$boot_type" } ## ### Tail: Boot / Model / Subject / BootType ################################################################################ ################################################################################ ### Head: List / Model / Subject / Next / Sub ## wallpaper_run_boot_sub_default () { ##util_debug_echo 'wallpaper_run_boot_sub_default' ##wallpaper_run_backgrounds_boot wallpaper_boot_by_check_fehbg } wallpaper_run_boot_sub_off () { util_debug_echo 'wallpaper_run_boot_sub_off' echo 'off' exit 0; } wallpaper_run_boot_sub_recent () { util_debug_echo 'wallpaper_run_boot_sub_recent' wallpaper_run_recent } wallpaper_run_boot_sub_fixed () { util_debug_echo 'wallpaper_run_boot_sub_fixed' wallpaper_run_fixed } wallpaper_run_boot_sub_next () { util_debug_echo 'wallpaper_run_boot_sub_next' wallpaper_run_next } wallpaper_run_boot_sub_random () { util_debug_echo 'wallpaper_run_boot_sub_random' wallpaper_run_random } ## ### Tail: List / Model / Subject / Next / Sub ################################################################################ ################################################################################ ### Head: Boot / Model / Subject ## wallpaper_run_boot () { local args="$@" local boot_type="$(wallpaper_sys_boot_type_name_get_valid)" local function_name="$(wallpaper_sys_run_boot_find_function_name $boot_type)" ##echo $function_name # if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then ##util_debug_echo "[Debug] wallpaper_run_boot_sub_not_exist: boot_type=$boot_type; function_name=$function_name" wallpaper_run_boot_sub_default "$args" return 0 fi "$function_name" "$args" ## run sub function } wallpaper_boot_simple () { feh --bg-scale $(cat "$HOME/.config/bspwm/wallpaper/wallpaper-fallback.conf") & } wallpaper_boot_theme_default () { local config_dir_path="$HOME/.config/bspwm/wallpaper/theme/default/config/on" wallpaper_boot_util_start_v1 "$config_dir_path" ##wallpaper_boot_util_start_v2 "$config_dir_path" } wallpaper_boot_by_check_fehbg () { local load_last="$HOME/.fehbg" if [ -x "$HOME/.fehbg" ]; then ##echo 1 $load_last return 0 fi ##echo 2 wallpaper_boot_by_option } wallpaper_boot_by_option () { local config_dir_path config_dir_path="$(wallpaper_boot_theme_config_dir_path)" config_dir_path_check_exist="$?" if [ "$config_dir_path_check_exist" = "1" ] ; then ## not exists wallpaper_boot_simple return 0; fi wallpaper_boot_util_start_v1 "$config_dir_path" ##wallpaper_boot_util_start_v2 "$config_dir_path" } ## ### Tail: Boot / Model / Subject ################################################################################ ################################################################################ ### Head: App / Action ## sub_run_help () { main_usage } sub_run_version () { main_version } sub_run_self_update () { util_self_update } sub_run_self_actions () { util_self_actions } ## ### Tail: App / Action ################################################################################ ################################################################################ ### Head: Core / Action ## sub_run_use () { wallpaper_run_use $@ } ## ### Tail: Core / Action ################################################################################ ################################################################################ ### Head: Session / Action ## sub_run_start () { wallpaper_sys_session_start } sub_run_stop () { wallpaper_sys_session_stop } sub_run_restart () { wallpaper_sys_session_restart } sub_run_reconfigure () { wallpaper_sys_session_reconfigure } sub_run_toggle () { wallpaper_sys_session_toggle } ## ### Tail: Session / Action ################################################################################ ################################################################################ ### Head: DirBackgrounds / Action ## sub_run_backgrounds_path () { wallpaper_run_backgrounds_path $@ } sub_run_backgrounds_list () { wallpaper_run_backgrounds_list } sub_run_backgrounds_use () { wallpaper_run_backgrounds_use $@ } sub_run_backgrounds_view () { wallpaper_run_backgrounds_view $@ } sub_run_backgrounds_open_dir () { wallpaper_run_backgrounds_open_dir } sub_run_backgrounds_next () { wallpaper_run_backgrounds_next } sub_run_backgrounds_random () { wallpaper_run_backgrounds_random } ## ### Tail: DirBackgrounds / Action ################################################################################ ################################################################################ ### Head: DirPictures / Action ## sub_run_pictures_path () { wallpaper_run_pictures_path $@ } sub_run_pictures_list () { wallpaper_run_pictures_list } sub_run_pictures_use () { wallpaper_run_pictures_use $@ } sub_run_pictures_view () { wallpaper_run_pictures_view $@ } sub_run_pictures_open_dir () { wallpaper_run_pictures_open_dir $@ } sub_run_pictures_next () { wallpaper_run_pictures_next } sub_run_pictures_random () { wallpaper_run_pictures_random } ## ### Tail: DirPictures / Action ################################################################################ ################################################################################ ### Head: DirXfce4Backdrops / Action ## sub_run_xfce4_backdrops_path () { wallpaper_run_xfce4_backdrops_path $@ } sub_run_xfce4_backdrops_list () { wallpaper_run_xfce4_backdrops_list } sub_run_xfce4_backdrops_use () { wallpaper_run_xfce4_backdrops_use $@ } sub_run_xfce4_backdrops_view () { wallpaper_run_xfce4_backdrops_view $@ } sub_run_xfce4_backdrops_open_dir () { wallpaper_run_xfce4_backdrops_open_dir $@ } sub_run_xfce4_backdrops_next () { wallpaper_run_xfce4_backdrops_next } sub_run_xfce4_backdrops_random () { wallpaper_run_xfce4_backdrops_random } ## ### Tail: DirXfce4Backdrops / Action ################################################################################ ################################################################################ ### Head: DirTargetDir / Action ## sub_run_target_dir_path () { wallpaper_run_target_dir_path $@ } sub_run_target_dir_list () { wallpaper_run_target_dir_list } sub_run_target_dir_use () { wallpaper_run_target_dir_use $@ } sub_run_target_dir_view () { wallpaper_run_target_dir_view $@ } sub_run_target_dir_open_dir () { wallpaper_run_target_dir_open_dir $@ } sub_run_target_dir_next () { wallpaper_run_target_dir_next } sub_run_target_dir_random () { wallpaper_run_target_dir_random } ## ### Tail: DirTargetDir / Action ################################################################################ ################################################################################ ### Head: List / Action ## sub_run_list_type_enum () { wallpaper_run_list_type_enum } sub_run_list_type () { wallpaper_run_list_type $@ } sub_run_list () { wallpaper_run_list } sub_run_next () { wallpaper_run_next } sub_run_random () { wallpaper_run_random } sub_run_fixed () { wallpaper_run_fixed } sub_run_recent () { wallpaper_run_recent } ## ### Tail: List / Action ################################################################################ ################################################################################ ### Head: Boot / Action ## sub_run_boot_type_enum () { wallpaper_run_boot_type_enum } sub_run_boot_type () { wallpaper_run_boot_type $@ } sub_run_boot () { wallpaper_run_boot } sub_run_boot_simple () { wallpaper_boot_simple } sub_run_boot_theme_default () { wallpaper_boot_theme_default } sub_run_boot_by_option () { wallpaper_boot_by_option } sub_run_boot_by_check_fehbg () { wallpaper_boot_by_check_fehbg } ## ### Tail: Boot / Action ################################################################################ ################################################################################ ### Head: Test / Action ## sub_run_test () { echo 'Toto: Sub' echo echo 'For Test' ##wallpaper_sys_use_check_fehbg '/usr/share/backgrounds/Frozen_sunset_on_the_lake_by_Manuel_Arslanyan.jpg' ##wallpaper_sys_use_check_fehbg_first '/usr/share/backgrounds/Frozen_sunset_on_the_lake_by_Manuel_Arslanyan.jpg' ##wallpaper_sys_use_check_fehbg_first_v2 '/usr/share/backgrounds/Frozen_sunset_on_the_lake_by_Manuel_Arslanyan.jpg' ##wallpaper_sys_use_check_fehbg_first_v3 '/usr/share/backgrounds/Frozen_sunset_on_the_lake_by_Manuel_Arslanyan.jpg' } ## ### Tail: Test / Action ################################################################################ ################################################################################ ### Head: Main ## main_usage () { ##local cmd_name="$0" local cmd_name="$THE_CMD_FILE_NAME" cat << EOF Usage: ## synopsis $ $cmd_name [action] ## version $ $cmd_name version ## self_update $ $cmd_name self_update ## help $ $cmd_name help ## control $ $cmd_name start $ $cmd_name stop $ $cmd_name restart $ $cmd_name toggle ## use $ $cmd_name use {img_file_path} ## list $ $cmd_name list_type_enum $ $cmd_name list_type {list_type} $ $cmd_name list $ $cmd_name random $ $cmd_name next ## theme $ $cmd_name theme [name] $ $cmd_name theme_list $ $cmd_name theme_next $ $cmd_name theme_random ## backgrounds $ $cmd_name backgrounds_list $ $cmd_name backgrounds_use {img_file_name} $ $cmd_name backgrounds_view {img_file_name} $ $cmd_name backgrounds_open_dir $ $cmd_name backgrounds_next $ $cmd_name backgrounds_random ## pictures $ $cmd_name pictures_list $ $cmd_name pictures_use {img_file_name} $ $cmd_name pictures_view {img_file_name} $ $cmd_name pictures_open_dir $ $cmd_name pictures_next $ $cmd_name pictures_random ## xfce4_backdrops $ $cmd_name xfce4_backdrops_list $ $cmd_name xfce4_backdrops_use {img_file_name} $ $cmd_name xfce4_backdrops_view {img_file_name} $ $cmd_name xfce4_backdrops_open_dir $ $cmd_name xfce4_backdrops_next $ $cmd_name xfce4_backdrops_random ## target_dir $ $cmd_name target_dir_path $ $cmd_name target_dir_list $ $cmd_name target_dir_use {img_file_name} $ $cmd_name target_dir_view {img_file_name} $ $cmd_name target_dir_open_dir $ $cmd_name target_dir_next $ $cmd_name target_dir_random Example: ## theme / help $ $cmd_name theme_help ## theme / list $ $cmd_name theme_list ## theme / get $ $cmd_name theme ## theme / set $ $cmd_name theme 'default' $ $cmd_name theme 'bionic.Spices_in_Athens' $ $cmd_name theme 'bionic.Manhattan_Sunset' ## use $ $cmd_name use '/usr/share/backgrounds/Spices_in_Athens_by_Makis_Chourdakis.jpg' Debug: $ export DEBUG_COMPTON_CTRL=true EOF } main_check_args_size () { if [ $1 -le 0 ]; then shift main_run_default_sub_cmd "$@" exit 1 fi } main_run_default_sub_cmd () { main_usage "$@" } main_run_sub_cmd () { local sub_cmd="$1" shift local args="$@" local function_name=$(sub_cmd_find_function_name "$sub_cmd") ## if ! command -v $function_name > /dev/null; then if ! type -p $function_name > /dev/null; then util_debug_echo "[Debug] sub_cmd_function_not_exist: sub_cmd=$sub_cmd; function_name=$function_name" echo main_run_default_sub_cmd "$args" return 1 fi "$function_name" "$args" ## run sub cmd function } ## Start main_check_args_size $# "$@" main_run_sub_cmd "$@" ## ### Tail: Main ################################################################################
true
5a701d0a2ec6add1ddfb66443ec698d75fe3ea2f
Shell
parasbhanot/EvsB
/board/overlay/home/delsys/delservices/fwdd/download.sh
UTF-8
795
3.328125
3
[]
no_license
#!/bin/bash uid=$1 file=$2 url=$3 logger -p local3.info -t downloader "Downloading $file from URL $url" if [ -d "/home" ];then homedir=/home else homedir=$HOME fi fwdslogdir=$homedir/log/fwds mkdir -p $fwdslogdir echo "Downloading uid: $uid , File: $file , url: $url" > $fwdslogdir/download.txt 2>&1 #curl -u $uid -o $file --url $url --limit-rate 200000 -v > $fwdslogdir/download.txt 2>&1 curl -u $uid -o $file $url --connect-timeout 15 --max-time 600 -Y 3000 -y 60 --limit-rate 200000 -v >> $fwdslogdir/download.txt 2>&1 retcode=$? echo "finished, return code: $retcode" echo "finished, return code: $retcode" >> $fwdslogdir/download.txt 2>&1 logger -p local3.info -t downloader "finished, return code: $retcode , Check download details in $fwdslogdir/download.txt" exit $retcode
true
f1adeb4b1afb3606cc75ac0641ab1181cf75d5d6
Shell
smearedink/phase-connect
/initialize_wraps.sh
UTF-8
1,271
3.71875
4
[]
no_license
#!/bin/sh ### This must be run first, before update_wraps.sh ### Your .tim file must have a "PHASEA" and a "PHASEB" in it ### See the README for more info # specify version of TEMPO we're using # path to $TEMPO directory, which contains tempo.cfg, obsys.dat, etc. TEMPO= # path to tempo executable alias tempo= # Define here wrap limits for JUMPs # a1 and a2 are the lower and upper limits of the range of trial integer # phase wraps for PHASEA a1= a2= # b1 and b2 are the lower and upper limits of the range of trial integer # phase wraps for PHASEB b1= b2= ##### YOU SHOULD NOT NEED TO EDIT BEYOND THIS LINE rm -rf WRAPs.dat a="$a1" l=0 while [ "$a" -lt "$a2" ] # this is loop1 do b="$b1" while [ "$b" -lt "$b2" ] # this is loop2 do # Make a script for replacing the JUMP flags echo "sed 's/PHASEA/PHASE "$a"/' J1913+06.tim | sed 's/PHASEB/PHASE "$b"/' > trial.tim " > edtim # Execute it sh edtim # Run tempo on this file tempo trial.tim -f J1913+06.par -w chi2=`cat tempo.lis | tail -1 | awk '{print $5}'` echo $a $b $chi2 >> WRAPs.dat l=`expr $l + 1` b=`expr $b + 1` done a=`expr $a + 1` done sort -nr -k3 WRAPs.dat | grep -v post echo Made a total of $l trials exit
true
c154815ed13e13ae514fe5efe521d8026732aaec
Shell
xianfengyuan/dockers
/jira/bin/setup_databases
UTF-8
976
2.9375
3
[ "MIT" ]
permissive
#!/usr/bin/env bash echo ">> Start PostgreSQL 9.3" docker run -d --name postgres postgres:9.3 echo ">> Waiting for PostgreSQL to start" docker logs -f postgres 2>&1 | tee /dev/stderr | grep --color --silent 'PostgreSQL init process complete; ready for start up.' echo ">> Creating JIRA database on PostgreSQL" docker run --link postgres:db postgres:9.3 psql --host db --user postgres --command "create database jiradb owner postgres encoding 'utf8';" echo ">> Start MySQL 5.6" docker run -d --name mysql --volume /run -e MYSQL_ROOT_PASSWORD=mysecretpassword mysql:5.6 echo ">> Waiting for MySQL to start" docker logs -f mysql 2>&1 | tee /dev/stderr | grep --silent 'MySQL init process done. Ready for start up.' # | grep --color --silent '3306 MySQL Community Server (GPL)' echo ">> Creating JIRA database on MySQL" docker run --link mysql:db mysql:5.6 mysql --host db --user=root --password=mysecretpassword --execute 'CREATE DATABASE jiradb CHARACTER SET utf8 COLLATE utf8_bin;'
true
e2716a7ee032ae5e87e73715f92dd2e9cb55d630
Shell
BevapDin/lfs-scripts
/fs/usr/sbin/updatekernel
UTF-8
1,044
4.28125
4
[]
no_license
#! /bin/bash usage() { cat <<-HERE This scripts updates the symlinks on /boot (vmlinuz.*) to thhe new kernel. That is: move vmliniz to vmlinuz.old and vmlinuz.new to vmlinuz HERE exit 1 } case "$1" in -?|-h|--help) usage ;; '') ;; *) echo "Unknown paramter: $1" 1>&2 exit 1 esac vm="/boot/vmlinuz" vmnewname="lfskernel-$(uname -r)" vmnew="/boot/$vmnewname" if ! mount | grep -q /boot ; then mount /boot || exit $? fi if ! [ -e "$vmnew" ] ; then echo "Missing $vmnew this is supposed to be the current kernel!" 1>&2 exit 1 fi # 1. backup current kernel symlink (if exists) if [ -e "$vm" ] ; then if [ "$(readlink "$vm")" = "$vmnewname" ] ; then echo "Symlink $vm is already uptodate: $vmnewname" exit 0 fi # Delete previously old kernel symlink if [ -e "$vm.old" ] ; then rm -v "$vm.old" || exit $? fi # Make the current symlink the old symlink mv -v "$vm" "$vm.old" || exit $? fi # Noew "$vm" does not exists and can be linked ln -v -s "$vmnewname" "$vm" || exit $? chown -h kernel:kernel "$vm" exit 0
true
1f9fbf6c27812d96bffff968b4e791560f7b44bd
Shell
grawity/code
/bin/annex-placeholder
UTF-8
1,730
4.09375
4
[ "MIT" ]
permissive
#!/usr/bin/env bash . lib.bash || exit url_size() { local url=$1 size=$(curl -fsS --head "$url" | tr A-Z a-z | awk -F: '/^content-length:/ {print $2}' | tr -dc 0-9) echo $size } algo="" name="" size=-1 url="" use_ext=0 while getopts ":125u:s:" OPT; do case $OPT in 1) algo=SHA1;; 2) algo=SHA256;; 5) algo=MD5;; s) size=$OPTARG;; u) url=$OPTARG;; *) lib:die_getopts;; esac done; shift $((OPTIND-1)) name=$1 hash=$2 if [[ $name == */* && ! $url ]]; then notice "name is an URL; automatically using basename" url=$name name=${url##*/} fi if [[ ! $algo ]]; then case ${#hash} in 32) algo=MD5;; 40) algo=SHA1;; 64) algo=SHA256;; *) die "could not guess algorithm for given hash";; esac notice "guessing '$algo' as hash algorithm" fi algo=${algo^^} hash=${hash,,} case $algo in MD5) hash_re='^[0-9a-f]{32}$';; SHA1) hash_re='^[0-9a-f]{40}$';; SHA256) hash_re='^[0-9a-f]{64}$';; esac if [[ ! $hash_re ]]; then die "unknown hash algorithm '$algo'" elif [[ ! $hash =~ $hash_re ]]; then die "hash does not match the format for $algo" fi if [[ $url ]]; then # TODO: merge this mess into similar code above if [[ $url == */ || $url == *[?#]* ]]; then die "URL does not point to a file" fi name=$(basename "$url") size=$(url_size "$url") fi if (( size == -1 )); then warn "size (-s) was not specified" fi link=".git/annex/objects/" link+="$algo" if (( use_ext )); then link+="E" fi if (( size != -1 )); then link+="-s$size" fi link+="--$hash" if (( use_ext )) && [[ $name == *.* ]]; then link+=".${name##*.}" fi ln -nsf "$link" "$name" git annex add "$name" git annex info "$name" if [[ $url ]]; then info "registering annexed file URL" git annex addurl --file="$name" "$url" fi
true
a534f8d6941be78f942c02c979e13b06e54eead1
Shell
dgreid/crosvm
/tools/install-armhf-deps
UTF-8
1,134
2.765625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env bash # Copyright 2021 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. set -ex sudo apt-get install --yes --no-install-recommends \ g++-arm-linux-gnueabihf \ gcc-arm-linux-gnueabihf \ libc-dev:armhf \ libcap-dev:armhf \ libdbus-1-dev:armhf \ libdrm-dev:armhf \ libepoxy-dev:armhf \ libssl-dev:armhf \ libwayland-dev:armhf \ libxext-dev:armhf rustup target add armv7-unknown-linux-gnueabihf # Generate a cross file for meson to compile for armhf sudo mkdir -p -m 0755 /usr/local/share/meson/cross sudo tee /usr/local/share/meson/cross/armhf >/dev/null <<EOF [binaries] c = '/usr/bin/arm-linux-gnueabihf-gcc' cpp = '/usr/bin/arm-linux-gnueabihf-g++' ar = '/usr/bin/arm-linux-gnueabihf-ar' strip = '/usr/bin/arm-linux-gnueabihf-strip' objcopy = '/usr/bin/arm-linux-gnueabihf-objcopy' ld= '/usr/bin/arm-linux-gnueabihf-ld' pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config' [properties] [host_machine] system = 'linux' cpu_family = 'arm' cpu = 'arm7hlf' endian = 'little' EOF
true
a35231050b95dac347c0dd1634d446b34bafd6b0
Shell
seborama/Camp2018-Security-TT
/scripts/cmds/installers/helm.sh
UTF-8
639
3.4375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash # A desirable attribute of a sub-script is that it does not use global env variables that # were created by its parents (bash and system env vars are ok). Use function arguments instead to # pass such variables # There should be scarce exceptions to this rule (such as a var that contains the script main install dir) ##################################################################### function install_Helm() { ##################################################################### banner "Installing Helm" isAlreadyAvailableOnCLI "helm" && return brew_install kubernetes-helm || exit 1 } install_Helm
true
04b80ed70c826a754f01cf4e046236e6c063632a
Shell
wturner/tangelo
/scripts/vagrant-provisioning.sh
UTF-8
1,504
3.1875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash # 10gen repo for mongo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list # Install needed packages apt-get update apt-get install -y \ build-essential \ cmake-curses-gui \ git \ python-pip \ python-dev \ python-sphinx \ vim \ curl \ couchdb \ mongodb-10gen \ uglifyjs # Configure couch to work under port forwarding cp /vagrant/scripts/vagrant-couchdb-local.ini /etc/couchdb/local.ini # Restart couch. Note that '/etc/init.d/couchdb stop' does not seem to work, nor does 'couchdb -d'. # See http://serverfault.com/questions/79453/why-cant-i-access-my-couchdb-instance-externally-on-ubuntu-9-04-server # and http://maythesource.com/2012/06/15/killing-couchdb-on-ubuntu-10-04/ ps -U couchdb -o pid= | xargs kill -9 /etc/init.d/couchdb start # Install python packages pip install cherrypy pymongo ws4py autobahn # Make the Tangelo build dir cd /vagrant rm -rf build sudo -u vagrant mkdir build cd build # Configure Tangelo sudo -u vagrant cmake \ -DSERVER_HOSTNAME:STRING=0.0.0.0 \ -DDEPLOY_DOCUMENTATION:BOOL=ON \ .. # Build Tangelo sudo -u vagrant make # Start Tangelo service sudo -u vagrant deploy/tangelo start echo 'provisioning complete' echo 'serving CouchDB on the host machine at http://localhost:6984' echo 'serving Tangelo on the host machine at http://localhost:9000'
true
674042d0b00c6adb086694be61f813b85d1e5c55
Shell
bk1472/libdev
/utils/creatmak.sh
UTF-8
970
3.3125
3
[]
no_license
#!/bin/bash FILE=$(find . -name "makelist.txt") find . -name "*.mak" | xargs rm -f for list in $FILE; do _dir=`dirname $list` _mod=`basename $_dir` _makfile="$_dir/`basename $_dir`.mak" echo "#############################################################################" > $_makfile echo "#" >> $_makfile echo "# LGE. ROBOT RESEARCH LABORATORY" >> $_makfile echo "# COPYRIGHT(c) LGE CO.,LTD. 2017. SEOUL, KOREA." >> $_makfile echo "# All rights are reserved." >> $_makfile echo "# Do not edit this file! (Automatically created)" >> $_makfile echo "#" >> $_makfile echo "# File Name : ${_mod}.mak" >> $_makfile echo "#" >> $_makfile echo "#############################################################################" >> $_makfile cat $list | sed 's/[\t ]*//g' | sed -n '/^srcs/p' | sed "s|srcs|${_mod}_srcs|g" >> $_makfile done
true
6feaf57084883eb70eade8d29d04bf405e31400d
Shell
aks60808/COMP9044
/9044AS1/legit/legit-rm
UTF-8
4,178
3.46875
3
[]
no_license
#!/bin/dash # author: Heng-Chuan Lin (z5219960@unsw.edu.au) # class: 9041 soft-con # file description: remove the file from cached or cached + workingdir # written in 14/07/2019 forced=0 cached=0 current=`ls -1 .legit/repo/master/commit | tail -1` for argv in $@ do if [ $argv = "--force" ] then forced=1 elif [ $argv = "--cached" ] then cached=1 fi done if [ -f ".legit/branch_log.txt" ] then branch=`cat .legit/branch_log.txt` else branch="master" fi for file in $@ do if [ $file != "--force" -a $file != "--cached" ] then if [ $cached -eq 0 -a $forced -eq 0 ] then if [ -f $file -a -f .legit/repo/$branch/index/$file -a -f .legit/repo/$branch/commit/$current/$file ] then if ! cmp -s $file .legit/repo/$branch/index/$file && cmp -s .legit/repo/$branch/index/$file .legit/repo/$branch/commit/$current/$file then echo "$0: error: '$file' in repository is different to working file" exit 1 elif ! cmp -s $file .legit/repo/$branch/index/$file && ! cmp -s .legit/repo/$branch/index/$file .legit/repo/$branch/commit/$current/$file then echo "$0: error: '$file' in index is different to both working file and repository" exit 1 elif cmp -s $file .legit/repo/$branch/index/$file && ! cmp -s .legit/repo/$branch/index/$file .legit/repo/$branch/commit/$current/$file then echo "$0: error: '$file' has changes staged in the index" exit 1 fi elif [ -f $file -a -f .legit/repo/$branch/index/$file -a ! -f .legit/repo/$branch/commit/$current/$file ] then echo "$0: error: '$file' has changes staged in the index" exit 1 elif [ -f $file -a ! -f .legit/repo/$branch/index/$file -a ! -f .legit/repo/$branch/commit/$current/$file ] then echo "$0: error: '$file' is not in the legit repository" exit 1 fi elif [ $cached -eq 1 -a $forced -eq 0 ] then if [ -f $file -a -f .legit/repo/$branch/index/$file -a -f .legit/repo/$branch/commit/$current/$file ] then if ! cmp -s $file .legit/repo/$branch/index/$file && ! cmp -s .legit/repo/$branch/index/$file .legit/repo/$branch/commit/$current/$file then echo "$0: error: '$file' in index is different to both working file and repository" exit 1 fi elif [ -f $file -a ! -f .legit/repo/$branch/index/$file -a ! -f .legit/repo/$branch/commit/$current/$file ] then echo "$0: error: '$file' is not in the legit repository" exit 1 fi elif [ $forced -eq 1 -a $cached -eq 0 ] then if [ ! -f .legit/repo/$branch/index/$file ] then echo "$0: error: '$file' is not in the legit repository" exit 1 fi fi fi done for file in $@ do if [ $file != "--force" -a $file != "--cached" ] then if [ $cached -eq 0 -a $forced -eq 0 ] then if [ -f $file -a -f .legit/repo/$branch/index/$file -a -f .legit/repo/$branch/commit/$current/$file ] then if cmp -s $file .legit/repo/$branch/commit/$current/$file then rm $file rm .legit/repo/$branch/index/$file fi fi elif [ $cached -eq 1 -a $forced -eq 0 ] then if [ -f $file -a -f .legit/repo/$branch/index/$file -a -f .legit/repo/$branch/commit/$current/$file ] then if cmp -s $file .legit/repo/$branch/index/$file || cmp -s .legit/repo/$branch/index/$file .legit/repo/$branch/commit/$current/$file then rm .legit/repo/$branch/index/$file fi elif [ -f $file -a -f .legit/repo/$branch/index/$file -a ! -f .legit/repo/$branch/commit/$current/$file ] then if cmp -s $file .legit/repo/$branch/index/$file || cmp -s .legit/repo/$branch/index/$file .legit/repo/$branch/commit/$current/$file then rm .legit/repo/$branch/index/$file fi fi elif [ $forced -eq 1 -a $cached -eq 0 ] then if [ -f .legit/repo/$branch/index/$file -a -f $file ] then rm .legit/repo/$branch/index/$file rm $file elif [ -f .legit/repo/$branch/index/$file ] then rm .legit/repo/$branch/index/$file fi elif [ $forced -eq 1 -a $cached -eq 1 ] then if [ -f .legit/repo/$branch/index/$file ] then rm .legit/repo/$branch/index/$file fi fi fi done
true
a317b51b88cc54b02b6b085b0807b0d1fd3518cf
Shell
snapcrafters/arduino
/scripts/check-permissions
UTF-8
1,361
3.59375
4
[]
no_license
#!/bin/bash GROUP=$(stat -c '%G' /dev/ttyS0) YAD_TITLE="Grant permissions" TEXT1="\ <b>WARNING\\n\\n\ The Arduino IDE will not be able to upload programs to boards</b> because this user (<tt>$USER</tt>) does not have permission to access USB boards. To fix this, please open a terminal and run the following command.\\n\ " COMMAND="\ <tt>sudo usermod -a -G $GROUP $USER</tt>\ " TEXT2="\ \\n\ After this, <b>reboot your computer</b> and start the Arduino IDE again.\ \\n\\n\ If you have any problems, please let us know by creating an issue here:\\n\ " URL="\ https://github.com/snapcrafters/arduino/issues/\ " TEXT4="\\n\\n" if [[ -n "$DEBUG_CHECK_PERMISSIONS" || ( ! -f $SNAP_USER_COMMON/dont-warn-permissions && "$(groups)" != *"$GROUP"* ) ]]; then # I'm using `form` here instead of `text`, because that allows me to split # the text into multiple parts which can each be selected independently. yad \ --title="$YAD_TITLE" \ --form \ --center \ --width=600 \ --field="$TEXT1":LBL \ --field="$COMMAND":LBL \ --field="$TEXT2":LBL \ --field="$URL":LBL \ --field="$TEXT4":LBL \ --field="Don't show this warning again":CHK \ --focus-field=2 \ --on-top \ --borders=50 \ --selectable-labels \ --button=gtk-ok 2>&1 | grep TRUE && touch $SNAP_USER_COMMON/dont-warn-permissions fi exec "$@"
true
99ded11faf32851500858150c232a79d5ae712b1
Shell
chefgs/cloud_init_sample
/cloud_init_ansible.txt
UTF-8
1,004
3.375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash mkdir -p /data/installers mkdir -p /data/ansible cd /data/installers/ rm -rf /data/ansible/* outfile='/var/log/userdata.out' # Install wget if [ ! -f /bin/wget ] ; then yum install wget -y >> $outfile fi # Install Ansible if [ ! -f /bin/ansible ] ; then echo "Installing Ansible" >> $outfile yum install ansible -y >> $outfile fi # Install git if [ ! -f /bin/git ] ; then yum install git -y >> $outfile fi # Clone rpm creation repo cd /data/cookbooks echo "Creating dummmy rpm" >> $outfile git clone https://github.com/chefgs/create_dummy_rpm.git >> $outfile cd create_dummy_rpm chmod +x create_rpm.sh ./create_rpm.sh spec_file/my-monitoring-agent.spec >> $outfile # Clone Ansible repo cd /data/ansible echo "Playbook Repo cloning" >> $outfile git clone https://github.com/chefgs/ansible_playbooks.git >> $outfile echo "Executing Playbook" >> $outfile cd /data/ansible/ansible_playbooks/cloud_init_playbook/ ansible-playbook playbook.yml -i ansible/hosts.ini >> /var/log/ansiblerun.out
true
96a5577ab12a6d814dbabbcd83b6d3f5223821c8
Shell
ivanvc/dotfiles
/_asdf/bin/asdf-magic
UTF-8
165
2.515625
3
[ "WTFPL" ]
permissive
#!/bin/sh [ ! -f .tool-versions ] && echo "Couldn't find .tool-versions file" && exit 1 cut -d ' ' -f1 .tool-versions | xargs -I{} asdf plugin add {} asdf install
true
1ee75c6208326f75a485b24218a84fbf82154367
Shell
blacksqr/dbus-snit
/examples/hello-server.tcl
UTF-8
1,330
3.046875
3
[]
no_license
#!/bin/sh ############################################################################ # # # Example of using dbus_snit library # # # # Copyright (c) 2008 Alexander Galanin <gaa.nnov@mail.ru> # # # # This code placed into public domain. # # # ############################################################################ # $Id: hello-server.tcl 26 2009-01-05 14:37:34Z al $ # \ exec tclsh "$0" "$@" package require Tcl 8.5 package require dbus 0.7 lappend auto_path ../lib package require dbus_snit 0.1 namespace import ::dbus::snit::* source hello_interface.def BusConnection bus session -names com.example.hello.server ::snit::type HelloServer { ::dbus::type ::dbus::implements com.example.hello.server.Iface method Hello {name country} { puts "Called method Hello with args: [ list $name $country ]" return "Hello, $name from $country!" } } set server [ HelloServer %AUTO% ] bus bind /say/hello $server vwait forever
true
1adeda11586b0c7424ecb163450a93c31c578ba7
Shell
openshift/oc
/hack/generate-versioninfo.sh
UTF-8
2,065
3.375
3
[ "Apache-2.0" ]
permissive
#! /usr/bin/env bash source "$(dirname "${BASH_SOURCE}")/lib/init.sh" # Generates the .syso file used to add compile-time VERSIONINFO metadata to the # Windows binary. function os::build::generate_windows_versioninfo() { if [[ "${SOURCE_GIT_TAG}" =~ ^[a-z-]*([0-9]+)\.([0-9]+)\.([0-9]+).* ]] ; then local major=${BASH_REMATCH[1]} local minor=${BASH_REMATCH[2]} local patch=${BASH_REMATCH[3]} fi local windows_versioninfo_file=`mktemp --suffix=".versioninfo.json"` cat <<EOF >"${windows_versioninfo_file}" { "FixedFileInfo": { "FileVersion": { "Major": ${major}, "Minor": ${minor}, "Patch": ${patch} }, "ProductVersion": { "Major": ${major}, "Minor": ${minor}, "Patch": ${patch} }, "FileFlagsMask": "3f", "FileFlags ": "00", "FileOS": "040004", "FileType": "01", "FileSubType": "00" }, "StringFileInfo": { "Comments": "", "CompanyName": "Red Hat, Inc.", "InternalName": "openshift client", "FileVersion": "${SOURCE_GIT_TAG}", "InternalName": "oc", "LegalCopyright": "© Red Hat, Inc. Licensed under the Apache License, Version 2.0", "LegalTrademarks": "", "OriginalFilename": "oc.exe", "PrivateBuild": "", "ProductName": "OpenShift Client", "ProductVersion": "${SOURCE_GIT_TAG}", "SpecialBuild": "" }, "VarFileInfo": { "Translation": { "LangID": "0409", "CharsetID": "04B0" } } } EOF goversioninfo -o ${OS_ROOT}/cmd/oc/oc.syso ${windows_versioninfo_file} } readonly -f os::build::generate_windows_versioninfo os::build::generate_windows_versioninfo
true
33854e8f6ef85ee5aa1354e258188e2846645534
Shell
twistedmove/jsalt2019-diadet
/egs/sitw_noisy/v1.py/path.sh
UTF-8
2,033
3.015625
3
[ "Apache-2.0" ]
permissive
export JSALT_ROOT=$(readlink -f `pwd -P`/../../..) export TOOLS_ROOT=$JSALT_ROOT/tools export KALDI_ROOT=$TOOLS_ROOT/kaldi/kaldi export PATH=$PWD/utils/:$KALDI_ROOT/tools/openfst/bin:$KALDI_ROOT/tools/sph2pipe_v2.5:$PWD:$PATH [ ! -f $KALDI_ROOT/tools/config/common_path.sh ] && echo >&2 "The standard file $KALDI_ROOT/tools/config/common_path.sh is not present -> Exit!" && exit 1 . $KALDI_ROOT/tools/config/common_path.sh export LC_ALL=C #sctk PATH=$KALDI_ROOT/tools/sctk-2.4.10/src/md-eval:$PATH KERAS_PATH=$TOOLS_ROOT/keras HYP_ROOT=$TOOLS_ROOT/hyperion/hyperion #Anaconda env CONDA_ROOT=$TOOLS_ROOT/anaconda/anaconda3.5 if [ -f "CONDA_ROOT/etc/profile.d/conda.sh" ]; then #for conda version >=4.4 do . $CONDA_ROOT/etc/profile.d/conda.sh conda activate else #for conda version <4.4 do PATH=$CONDA_ROOT/bin:$PATH fi if [ "$(hostname --domain)" == "cm.gemini" ];then module load cuda10.0/toolkit module load ffmpeg #CuDNN env CUDNN_ROOT=$TOOLS_ROOT/cudnn/cudnn-10.0-v7.4 #torch env export TORCH=pytorch1.0_cuda10.0 else LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH if [ ! -d /usr/local/cuda/lib64 ]; then LD_LIBRARY_PATH=$HOME/usr/local/cuda/lib64:$LD_LIBRARY_PATH fi #CuDNN env CUDNN_ROOT=$TOOLS_ROOT/cudnn/cudnn-9.0-v7.4 #torch env export TORCH=pytorch1.0_cuda9.0 fi # export CPATH=$HOME/usr/local/cudnn-v5.1/include:/usr/local/cuda/include:$CPATH # export LIBRARY_PATH=$HOME/usr/local/cudnn-v5.1/lib64:/usr/local/cuda/lib64:/usr/local/cuda/lib:$LIBRARY_PATH export MPLBACKEND="agg" export PATH=$HYP_ROOT/hyperion/bin:/usr/local/cuda/bin:$PATH export PYTHONPATH=$HYP_ROOT:$KERAS_PATH:$PYTHONPATH export LD_LIBRARY_PATH export LC_ALL=C wait_file() { local file="$1"; shift local wait_seconds="${2:-30}"; shift # 10 seconds as default timeout for((i=0; i<$wait_seconds; i++)); do [ -f $file ] && return 1 sleep 1s done return 0 } export -f wait_file
true
6dff3a8aff72a8e226c906554f303f1f55fb38e9
Shell
bradhe/dumbos
/scripts/install_qemu.sh
UTF-8
319
2.984375
3
[]
no_license
#!/bin/bash ## # Installs QEmu from source. # cc=/usr/bin/gcc-4.2 tmp_dir=/tmp/qemu mkdir -p $tmp_dir cd $tmp_dir curl http://wiki.qemu.org/download/qemu-0.15.1.tar.gz > qemu-0.15.1.tar.gz tar -xf qemu-0.15.1.tar.gz cd qemu-0.15.1 ./configure --cc=$cc --disable-darwin-user --disable-bsd-user make sudo make install
true
6df84463bf2aa55444eb5cd10385045d2cff27f1
Shell
prathmesh6464/JavaFellowShip
/ElIf/ConvertDigitToWord.sh
UTF-8
521
3.34375
3
[]
no_license
#!/bin/bash -x read -p "Enter Any Value : " digit if [[ digit -eq 0 ]] then echo "Zero"; elif [[ digit -eq 1 ]] then echo "One"; elif [[ digit -eq 2 ]] then echo "Two"; elif [[ digit -eq 3 ]] then echo "Three"; elif [[ digit -eq 4 ]] then echo "Four"; elif [[ digit -eq 5 ]] then echo "Five"; elif [[ digit -eq 6 ]] then echo "Six"; elif [[ digit -eq 7 ]] then echo "Seven"; elif [[ digit -eq 8 ]] then echo "Eight"; elif [[ digit -eq 9 ]] then echo "Nine"; else echo "Please Enter One Digit Value"; fi
true
973d69ad81863585b32587e62e914ba7365b11ef
Shell
qpanvisz/oidc-testing-playground
/bin/keycloak/create
UTF-8
354
2.59375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash DOCKER_CONTAINER_NAME=keycloak DOCKER_IMAGE=jboss/keycloak KEYCLOAK_USER=user KEYCLOAK_PASSWORD=password DATABASE=H2 PORT=${PORT:-7777} docker pull $DOCKER_IMAGE docker run -p $PORT:8080 --name $DOCKER_CONTAINER_NAME \ -e KEYCLOAK_USER=$KEYCLOAK_USER \ -e KEYCLOAK_PASSWORD=$KEYCLOAK_PASSWORD \ -e DB_VENDOR=$DATABASE \ -d $DOCKER_IMAGE
true
442c8fb84fd5a26ca5589ec988c9e4a298c1dd29
Shell
deanomus/bash-scripts
/sort.sh
UTF-8
300
3.296875
3
[]
no_license
#/bin/bash for D in *; do if [ -d "${D}" ]; then echo "Enter directory: ${D}" # your processing here mkdir ${D}/raw mkdir ${D}/jpg cd ${D} for f in *.JPG; do echo "moving: ${f}" mv ${f} jpg/ done for f in *.ARW; do echo "moving: ${f}" mv ${f} raw/ done cd .. fi done
true
5524441bd525c226af83dc83c1dbe751de849972
Shell
court-jus/dotfiles
/bin/udev_monitor_change.sh
UTF-8
467
2.546875
3
[ "MIT" ]
permissive
#!/bin/bash # /etc/udev/rules.d/80-monitor.rules contains : # ACTION=="change", SUBSYSTEM=="drm", RUN+="/home/ghislain/bin/udev_monitor_change.sh" export DISPLAY=:0 export XAUTHORITY=/home/ghislain/.Xauthority if xrandr | grep "HDMI-2 connected"; then echo "ondock" | tee -a $LOG /home/ghislain/.screenlayout/default_layout.sh else echo "solo" | tee -a $LOG /home/ghislain/.screenlayout/solo.sh fi /usr/bin/Esetroot /home/ghislain/Images/lock.png
true
841fe26e76563cd1a746340a153876ea1768d86e
Shell
seiyab/rust-cc
/test/test.sh
UTF-8
1,417
3.203125
3
[]
no_license
#!/bin/bash try() { export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ expected="$1" input="$2" ./main "$input" > tmp.s gcc -o tmp tmp.s ./tmp actual="$?" if [ "$actual" = "$expected" ]; then echo "$input => $actual" else echo "$input => $expected expected, but got $actual" exit 1 fi } try 0 "func main() 0" try 3 "func main() 1+2" try 21 "func main() 5+20-4" try 12 "func main() 3 * 4" try 5 "func main() 1 + 2 * 3 - 4 / 2" try 10 "func main() (2 * 3) + (1 * 4)" try 17 "func main() -3 + 20" try 7 "func main() 10 - +(1+2)" try 1 "func main() 4 > 3" try 0 "func main() 7 <= 6" try 0 "func main() 1 + 2 + 3 + 4 == 3 * 2" try 1 "func main() 7 != 7 + 1" try 1 "func main() { 1 }" try 5 "func main() { let x := 5 x }" try 14 "func main() { let a := 3 let b := 5 * 6 - 8 a + b / 2 }" try 3 "func main() { let one := 1 let two := 2 let three := one + two three }" try 3 "func main() if 1 < 2 then 3 else 4" try 20 "func main() { let x := 3 if x * 2 < 5 then { let a := 1 let b := 2 a + b } else { let u := 4 let v := 5 u * v } }" try 3 "func main() { let x := 1 let y := if x == 1 then { let x := 2 x } else { let x := 3 x } x + y }" try 8 "func main() { fib(6) } func fib(n) { if n == 0 then { 0 } else if n == 1 then { 1 } else { fib(n-1) + fib(n-2) } }" echo OK
true
a1500025a4230879f66d02ba808739514f16d1e7
Shell
paulboot/network-tools
/cron-vlandump-nexus.sh
UTF-8
2,307
3.109375
3
[]
no_license
#!/bin/bash ##Crontab entry # LANG="en_US.UTF-8" # COLUMNS=240 # CISCOCMDPAD="/opt/ciscocmd" # http_proxy=http://proxy.zzz.com:8080/ # https_proxy=http://proxy.zzz.com:8080/ # m h dom mon dow command # Cisco-cmd commands # */5 * * * * $CISCOCMDPAD/bin/cron-vlandump-nexus.sh >> $CISCOCMDPAD/log/cron-vlandump.log 2>&1 SCRIPT="vlandump-nexus" PAD="/opt/ciscocmd/bin" CONFIGPAD="/opt/ciscocmd/etc" OUTROOTPAD="/var/www/html/vlan/nexus" DATE=`/bin/date +'%F'` TIME=`/bin/date +'%H:%M:%S'` MONTH=`/bin/date +'%Y-%B'` echo "Start cron-$SCRIPT($BASHPID) at $TIME on $DATE" OUTFILE="$SCRIPT-$DATE-$TIME" OUTPAD="$OUTROOTPAD/$MONTH/$DATE" if [ ! -d $OUTPAD ] then mkdir -p $OUTPAD fi echo "VLAN poortbezetting $SCRIPT om $TIME op $DATE" > "$OUTPAD/$OUTFILE.tmp" echo >> "$OUTPAD/$OUTFILE.tmp" #S-gebouw #show interface status #show interface trunk | be Allowed #show port-channel summary | exclude NONE OUTFILE="R-gebouw-$SCRIPT-$DATE-$TIME" cat > "$OUTPAD/$OUTFILE.tmp" <<End-of-text ################################# ## MER R-gebouw ## #################################" End-of-text $PAD/ciscocmd -f -t 10.20.1.1 -u xxx -p '1234' -r $CONFIGPAD/vlan-nexus-commands.txt >> "$OUTPAD/$OUTFILE.tmp" echo " " >> "$OUTPAD/$OUTFILE.tmp" sed -r 's/\^D//' "$OUTPAD/$OUTFILE.tmp" > "$OUTPAD/$OUTFILE.txt" /usr/bin/txt2html --outfile "$OUTPAD/$OUTFILE.html" --preformat_trigger_lines 0 "$OUTPAD/$OUTFILE.txt" /bin/rm "$OUTPAD/$OUTFILE.tmp" "$OUTPAD/$OUTFILE.txt" /bin/cp "$OUTPAD/$OUTFILE.html" "$OUTROOTPAD/R-gebouw-$SCRIPT-laatste.html" OUTFILE="S-gebouw-$SCRIPT-$DATE-$TIME" cat > "$OUTPAD/$OUTFILE.tmp" <<End-of-text ################################# ## MER S-gebouw ## #################################" End-of-text $PAD/ciscocmd -f -t 10.20.1.1 -u xxx -p '1234' -r $CONFIGPAD/vlan-nexus-commands.txt >> "$OUTPAD/$OUTFILE.tmp" echo " " >> "$OUTPAD/$OUTFILE.tmp" sed -r 's/\^D//' "$OUTPAD/$OUTFILE.tmp" > "$OUTPAD/$OUTFILE.txt" /usr/bin/txt2html --outfile "$OUTPAD/$OUTFILE.html" --preformat_trigger_lines 0 "$OUTPAD/$OUTFILE.txt" /bin/rm "$OUTPAD/$OUTFILE.tmp" "$OUTPAD/$OUTFILE.txt" /bin/cp "$OUTPAD/$OUTFILE.html" "$OUTROOTPAD/S-gebouw-$SCRIPT-laatste.html" DATE=`/bin/date +'%F'` TIME=`/bin/date +'%H:%M:%S'` echo "Exit cron-$SCRIPT($BASHPID) at $TIME on $DATE"
true
1d99d396054199cac2df84a5ceb750ea7c984ca8
Shell
GunioRobot/Data-Journalism-Developer-Studio
/Desktop/Install-Scripts/install-system.bash
UTF-8
604
2.5625
3
[]
no_license
#! /bin/bash -v export DISPLAY=:0.0 xhost + export PATH=/usr/local/bin:$PATH unset JAVA_HOME; R CMD javareconf # needed for rJava R --vanilla --slave < load-system.R 2>&1 | tee load-system.log # set up environment variables, e.g., PDF reader if [ -e /usr/lib/R/etc/Renviron ] then cp Renviron32 /usr/lib/R/etc/Renviron fi if [ -e /usr/lib64/R/etc/Renviron ] then cp Renviron64 /usr/lib64/R/etc/Renviron fi if [ -e /usr/local/lib/R/etc/Renviron ] then cp Renviron32 /usr/local/lib/R/etc/Renviron fi if [ -e /usr/local/lib64/R/etc/Renviron ] then cp Renviron64 /usr/local/lib64/R/etc/Renviron fi
true
68f9371621a223f48a9d070794c0de5bc60b526c
Shell
nuttingd/gitlab-helm-chart
/scripts/database-upgrade
UTF-8
3,606
3.890625
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env bash set -e # Set the timestamp to something predictable so we can use it between backup and restore fake_timestamp="database_upgrade_4" script_name="database-upgrade" usage() { echo "USAGE: ${script_name} [-r RELEASE] [-n NAMESPACE] pre|post" } selector() { base="app=${1}" if [ -n "${release}" ] then base+=",release=${release}" fi echo "${base}" } # Run command in the task-runner pod in_task_runner() { task_pod=$(kubectl ${namespace} get pods -l "$(selector task-runner)" --field-selector status.phase=Running -o custom-columns=N:.metadata.name --no-headers | grep -v backup | head -n 1) kubectl ${namespace} exec -it "${task_pod}" -- "${@}" } database_service() { kubectl ${namespace} get service -l "$(selector postgresql)" -o template --template='{{ range .items }}{{ if ne .spec.clusterIP "None" }}{{.metadata.name}}{{ end }}{{ end }}' } # Patches the given deployment with the given number of replicas patch_replicas() { local deployment="${1}" local replicas="${2}" kubectl ${namespace} patch deployment "${deployment}" -p "{\"spec\": {\"replicas\": ${replicas}}}" } pre() { in_task_runner backup-utility -t "${fake_timestamp}" --skip repository,registry,uploads,artifacts,lfs,packages,repositories } post() { # The services that connect to the database, they need to be shutdown before we can restore database_connectors="webservice sidekiq gitlab-exporter" # This will store the original number of replicas, so we can restore the deployments when we're done declare -A replicas # Create a configmap to store the replicas count for each deployment if ! kubectl ${namespace} create configmap "${script_name}" then existing=true fi # Find the number of replicas for each deployment and shutdown database accessing deployments for app in ${database_connectors} do info=$(kubectl ${namespace} get deployment -l "$(selector ${app})" -o template --template='{{ range .items }}{{.metadata.name}},{{.spec.replicas}}{{ end }}') deployment=$(echo "${info}" | cut -d, -f1) if [ -z "$deployment" ] then continue fi if [ -n "${existing}" ] then replicas[${deployment}]=$(kubectl ${namespace} get configmap "${script_name}" -o template --template="{{ index .data \"${deployment}\" }}") else count=$(echo "${info}" | cut -d, -f2) replicas[${deployment}]=${count} kubectl ${namespace} patch configmap "${script_name}" -p "{\"data\": { \"${deployment}\": \"${count}\" }}" fi echo "Stopping: ${deployment}" patch_replicas "${deployment}" 0 done # Restore the database in_task_runner backup-utility --restore -t "${fake_timestamp}" --skip repository,registry,uploads,artifacts,lfs,packages,repositories in_task_runner gitlab-rake db:migrate # Start the deployments back up for dep in "${!replicas[@]}" do echo "Starting: ${dep}" patch_replicas "${dep}" "${replicas[$dep]}" done # If we made it here, restore was successful, remove the configmap kubectl ${namespace} delete configmap "${script_name}" } while getopts :r:n: opt do case "${opt}" in r) release="${OPTARG}" ;; n) namespace="-n ${OPTARG}" ;; *) usage ;; esac done shift "$((OPTIND -1))" case ${1} in pre) pre ;; post) post ;; *) usage ;; esac
true
c37e1d0f1e1d633ada4646033b9dd60013695133
Shell
ddmin/CodeSnippets
/ANACHRO/arch-2install
UTF-8
3,357
2.734375
3
[]
no_license
#!/bin/bash # install - installs and configure machine automatically (Arch) # Update System sudo pacman -Syyu # base-devel sudo pacman -S base-devel # Install git yes | sudo pacman -S git # Papirus Icons wget -qO- https://git.io/papirus-icon-theme-install | DESTDIR="$HOME/.local/share/icons" sh # install rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # install golang wget "https://golang.org/dl/go1.15.3.linux-amd64.tar.gz" sudo tar -C /usr/local -xzf go1.*15*.3.linux-amd64.tar.gz export PATH="$PATH:/usr/local/go/bin" export GOPATH="$HOME/Code/Go" # install logo-ls go get -u github.com/ddmin/logo-ls # Firefox Addons cd .. go run firefox.go & sleep 1 && firefox localhost:3000 cd - # Enable AUR git clone https://aur.archlinux.org/yay.git /tmp/yay cd /tmp/yay makepkg -si cd - # Arc Dark Theme wget -qO- https://raw.githubusercontent.com/PapirusDevelopmentTeam/arc-kde/master/install.sh | sh # Install fzf git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf yes | ~/.fzf/install # install gnome-terminal yes | sudo pacman -S gnome-terminal # Install curl yes | sudo pacman -S curl # install wget yes | sudo pacman -S wget # Install vim yes | sudo pacman -S vim # Install nvim yes | sudo pacman -S neovim # Install node version manager curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash # Install python2 # ./python2_install # Install python3 and pip3 yes | sudo pacman -S python3 pip3 install --upgrade setuptools # install powerline go get -u github.com/justjanne/powerline-go # powerline fonts wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf mv PowerlineSymbols.otf ~/.local/share/fonts/ sudo fc-cache -vf ~/.local/share/fonts/ mkdir -p /home/ddmin/.config/fontconfig mv 10-powerline-symbols.conf /home/ddmin/.config/fontconfig/conf.d # Dependencies yes | sudo pacman -S libxext yes | sudo pacman -S cmake # install ueberzug pip3 install ueberzug # Install ffmpegthumbnailer yes | sudo pacman -S ffmpegthumbnailer # Install lynx yes | sudo pacman -S lynx # Install mpv yes | sudo pacman -S mpv # Install vlc yes | sudo pacman -S vlc # Install feh yes | sudo pacman -S feh # pywal pip3 install pywal # Install cmus yes | sudo pacman -S cmus # Install neofetch yes | sudo pacman -S neofetch # Install rofi # Command to run rofi: rofi -modi drun -show drun -show-icons yes | sudo pacman -S rofi # Install imagemagick yes | sudo pacman -S imagemagick # Install zathura yes | sudo pacman -S zathura # Install id3v2 yes | sudo pacman -S id3v2 # install logo-ls yay -S logo-ls # Install ranger # pip install method pip3 install ranger-fm # Install ranger devicons git clone https://github.com/ddmin/ranger_devicons.git /tmp/devicons cd /tmp/devicons make install cd - # Copy ranger configs ranger --copy-config=all # Dotfiles git clone https://github.com/ddmin/Dotfiles.git /tmp/dots cd /tmp/dots/dotfiles ./setup.sh cd - echo 'Setup Complete' echo 'Please reboot your machine.'
true
d653c4b554c07f749ca4559e423229d321d5bc7e
Shell
Bjoern-ek/RasPi-Relais
/set-i2c
UTF-8
462
2.984375
3
[]
no_license
#!/bin/bash ADDR=0x38 PRG="/usr/sbin/i2cset -y 1 $ADDR" MW=`/usr/sbin/i2cget -y 1 $ADDR` Z=$1 A=$2 bytefunc() { . f_bitmask case $Z in S) Y=`clrbit $MW $A` ;; C) Y=`setbit $MW $A` ;; *) echo "falsche Parameter" >> /tmp/heiz.log exit 0 ;; esac $PRG $Y } # do bytefunc
true
33a54694441fcb670ca0f07b261f43ded0ca8958
Shell
orrecx/martreiss
/3_build_final_sys/vfs_config_scripts/sys_config_main.sh
UTF-8
556
2.75
3
[ "Apache-2.0" ]
permissive
#no need for shebang because /bin/bash does not exist and this script is being run by bash SYS_CONF_SCRIPTS_DIR="$WRK/vfs_scripts" source $SYS_CONF_SCRIPTS_DIR/utils.sh echo "================ LFS SYS CONFIGURATION MAIN ================" s_start $0 S=$? $SYS_CONF_SCRIPTS_DIR/bootscripts.sh $SYS_CONF_SCRIPTS_DIR/devices_handling_and_network_conf.sh $SYS_CONF_SCRIPTS_DIR/sysvinit_and_confs.sh $SYS_CONF_SCRIPTS_DIR/build_kernel.sh $SYS_CONF_SCRIPTS_DIR/make_lfs_bootable.sh $SYS_CONF_SCRIPTS_DIR/set_system_version.sh s_end $0 E=$? s_duration $0 $S $E
true
298cd280625c55c9e7a6e6a91e8b009049707e5d
Shell
spkngb/webc
/.git-fixups/007-nginx.sh
UTF-8
252
2.546875
3
[]
no_license
#!/bin/sh echo "Fixing nginx permissions" mkdir -vp /var/log/nginx/ touch /var/log/nginx/access.log touch /var/log/nginx/error.log chown root:adm /var/log/nginx/ chown www-data:adm /var/log/nginx/* chmod 755 /var/log/nginx/ chmod 640 /var/log/nginx/*
true
96b7fa9f057eaaefbca5de9870a0fe4b2376419b
Shell
BackupTheBerlios/iphone-binutils-svn
/branches/landonf-odcctools/SDK/extract.sh
UTF-8
3,109
3.96875
4
[]
no_license
#!/bin/sh set -e DISTDIR=arm-apple-darwin SDKROOT=/Developer/SDKs/MacOSX10.4u.sdk FRAMEWORK_ROOT=${SDKROOT}/System/Library/Frameworks TOPSRCDIR=`pwd` MAKEDISTFILE=0 UPDATEPATCH=0 while [ $# -gt 0 ]; do case $1 in --distfile) shift MAKEDISTFILE=1 ;; --updatepatch) shift UPDATEPATCH=1 ;; --heavenly) shift HEAVENLY=$1 shift ;; --help) echo "Usage: $0 [--help] [--distfile] [--updatepatch] [--heavenly dir]" 1>&2 exit 0 ;; *) echo "Unknown option $1" 1>&2 exit 1 esac done if [ "$HEAVENLY" == "" ]; then echo "Missing required --heavenly option" exit 1 fi if [ ! -d "$HEAVENLY" ]; then echo "$HEAVENLY does not exist" exit 1 fi if [ "`tar --help | grep -- --strip-components 2> /dev/null`" ]; then TARSTRIP=--strip-components else TARSTRIP=--strip-path fi PATCHFILESDIR=${TOPSRCDIR}/patches PATCHFILES=`cd "${PATCHFILESDIR}" && find * -type f \! -path \*/.svn\*` ADDEDFILESDIR=${TOPSRCDIR}/files if [ -d "${DISTDIR}" ]; then echo "${DISTDIR} already exists. Please move aside before running" 1>&2 exit 1 fi mkdir -p ${DISTDIR} echo "Merging content from $SDKROOT" if [ ! -d "$SDKROOT" ]; then echo "$SDKROOT must be present" 1>&2 exit 1 fi # Standard includes tar cf - -C "$SDKROOT/usr/" include | tar xf - -C ${DISTDIR} # CarbonCore mkdir -p ${DISTDIR}/include/CarbonCore tar cf - -C "$FRAMEWORK_ROOT/CoreServices.framework/Frameworks/CarbonCore.framework/Headers" . | tar xf - -C ${DISTDIR}/include/CarbonCore # CoreGraphics mkdir -p ${DISTDIR}/include/CoreGraphics tar cf - -C "$FRAMEWORK_ROOT/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers" . | tar xf - -C ${DISTDIR}/include/CoreGraphics # Standard libraries tar cf - -C "$HEAVENLY/usr" lib | tar xf - -C ${DISTDIR} set +e INTERACTIVE=0 echo "Applying patches" for p in ${PATCHFILES}; do dir=`dirname $p` if [ $INTERACTIVE -eq 1 ]; then read -p "Apply patch $p? " REPLY else echo "Applying patch $p" fi pushd ${DISTDIR}/$dir > /dev/null patch --backup --posix -p0 < ${PATCHFILESDIR}/$p if [ $? -ne 0 ]; then echo "There was a patch failure. Please manually merge and exit the sub-shell when done" $SHELL if [ $UPDATEPATCH -eq 1 ]; then find . -type f | while read f; do if [ -f "$f.orig" ]; then diff -u -N "$f.orig" "$f" fi done > ${PATCHFILESDIR}/$p fi fi find . -type f -name \*.orig -exec rm -f "{}" \; popd > /dev/null done set -e echo "Adding new files" tar cf - --exclude=CVS --exclude=.svn -C ${ADDEDFILESDIR} . | tar xvf - -C ${DISTDIR} echo "Deleting cruft" find ${DISTDIR} -name Makefile -exec rm -f "{}" \; find ${DISTDIR} -name \*~ -exec rm -f "{}" \; find ${DISTDIR} -name .\#\* -exec rm -f "{}" \; if [ $MAKEDISTFILE -eq 1 ]; then DATE=$(date +%Y%m%d) mv ${DISTDIR} ${DISTDIR}-$DATE tar jcf ${DISTDIR}-$DATE.tar.bz2 ${DISTDIR}-$DATE fi echo "WARNING: ${DISTDIR} contains NON-REDISTRIBUTABLE Mac OS X components, merged from ${SDKROOT}. Do not re-distribute this directory!" exit 0
true
4b378b3855fde0cacc59c1d5c8a9be7b89d06cb6
Shell
giuliostramondo/atrace_utils
/patterns_to_solve/das5_parallelization.sh
UTF-8
152
2.515625
3
[]
no_license
#!/bin/bash for p in $(ls | grep atrace ) do echo $p for scheme in ReRo ReCo RoCo ReTr do prun -np 1 ../schedule_atrace.py $p $scheme & done done
true
1a6b58212862b4119e1135e32cc437357276b613
Shell
MisterCyp/dockerfiles
/rufy/transcode/rootfs/usr/local/bin/run.sh
UTF-8
1,252
2.609375
3
[ "CC0-1.0" ]
permissive
#!/bin/sh addgroup -g ${GID} rufy && adduser -h /var/www/RuFy -s /bin/sh -D -G rufy -u ${UID} rufy if [ $WEBROOT != "/" ]; then sed -i 's|<webroot>|'${WEBROOT}\/'|g' /etc/nginx/nginx.conf sed -i 's|<webroot2>|'${WEBROOT}'|g' /etc/nginx/nginx.conf sed -i -e '\#URI# s#/rufy#'${WEBROOT}'#' /var/www/RuFy/RuFy/settings.py sed -i -e '\#URI# s#rufy/#'${WEBROOT:1}'/#' /var/www/RuFy/RuFy/urls.py else sed -i 's|<webroot>|/|g' /etc/nginx/nginx.conf sed -i 's|<webroot2>|/|g' /etc/nginx/nginx.conf sed -i -e '\#URI# s#/rufy##' /var/www/RuFy/RuFy/settings.py sed -i -e '\#URI# s#rufy/##' /var/www/RuFy/RuFy/urls.py fi if [ ! -f "/var/www/RuFy/db/db.sqlite3" ];then mv -v /var/www/RuFy/config/db-init.sqlite3 /var/www/RuFy/db/db.sqlite3 fi mkdir -p /var/www/RuFy/log /var/www/RuFy/venv/bin/python /var/www/RuFy/manage.py collectstatic_js_reverse /var/www/RuFy/venv/bin/python /var/www/RuFy/manage.py makemigrations /var/www/RuFy/venv/bin/python /var/www/RuFy/manage.py migrate cd /var/www/RuFy/nodejs npm install chown -R rufy:rufy /var/www/RuFy /watch /tmp chmod +x /var/www/RuFy/gunicorn_start sh /var/www/RuFy/gunicorn_start & node /var/www/RuFy/nodejs/index.js & supervisord -c /usr/local/etc/supervisord.conf
true
c7e9e499c058e362d0ee946cf75b42394f03dd05
Shell
paulburton/Arch-Linux-Repository
/ubuntu/humanity-icon-theme/PKGBUILD
UTF-8
516
2.640625
3
[]
no_license
# Maintainer: György Balló <ballogy@freestart.hu> pkgname=humanity-icon-theme pkgver=0.5.3.4 pkgrel=1 pkgdesc="Elementary Icons for Humans" arch=('any') url="https://launchpad.net/humanity" license=('GPL') depends=('gnome-icon-theme') source=(https://launchpad.net/ubuntu/+archive/primary/+files/${pkgname}_$pkgver.tar.gz) md5sums=('b8da5413c41fccc0f53a8b23415aebf9') build() { /bin/true } package() { cd "$srcdir/$pkgname-$pkgver" mkdir -p "$pkgdir/usr/share/icons" cp -r Humanity Humanity-Dark "$pkgdir/usr/share/icons" }
true
180ccc924909212b48b377452dff7a0099f93755
Shell
aceway/tools
/bash/remote_release.sh
UTF-8
6,885
3.421875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash RED="\033[0;31m" GREEN="\033[0;32m" BLUE="\033[0;34m" YELLOW="\033[0;33m" GRAY="\033[0;37m" LIGHT_RED="\033[1;31m" LIGHT_YELLOW="\033[1;33m" LIGHT_GREEN="\033[1;32m" LIGHT_BLUE="\033[0;34m" LIGHT_GRAY="\033[1;37m" END="\033[0;00m" dt=`date +"%Y %m %d %H %M %S"` array=($dt) year=${array[0]} month=${array[1]} day=${array[2]} hour=${array[3]} minute=${array[4]} second=${array[5]} #线上入口服务器用 key 避免交互输入密码 function rsync_for_release() { echo project_name="project_app" frm_local=$1 to_remote=$2 user=$3 host=$4 port=$5 #key="${HOME}/.ssh/project_app" ex_list=$6 echo -e ${YELLOW}"rsync local ${project_name} to ${RED}${host}${END}:" echo -e "\tFROM LOCAL DIR:${frm_local}" echo -e "\tTO REMOTE DIR:${to_remote}" cmd="rsync" ${cmd} -vr --exclude-from ${ex_list} --progress "-e ssh -p ${port}" ${frm_local} ${user}@${host}:${to_remote} #${cmd} -vr --exclude-from ${ex_list} --progress "-e ssh -p ${port} -i ${key} " ${frm_local} ${user}@${host}:${to_remote} } ##线上服务器内部用 sshpass 解决交互的输入密码, 后继可以考虑用 key 的方式, 并远程自动重启服务 function remote_stop() { echo remote_host="$1" remote_path="$2" server_ip="$3" pname="$4" remote_file="${remote_path}/${pname}/bin/lib*.so" rpasswd="xxxxxxx" user="username" passwd="xxxxxxx" port="22" #key="${HOME}/.ssh/project_app" echo -e "IN REMOTE ${remote_host} ${RED} STOP ${YELLOW}${pname}${END} ${RED}${server_ip}${END}:" stop_it="~/project_app/${pname}/stop" echo -e "${RED}stop${YELLOW} ${pname}${END}" #cmd="ssh -p${port} -i ${key} ${user}@${remote_host} sshpass -p ${passwd} ssh ${user}@${server_ip} ${stop_it}" cmd="sshpass -p ${rpasswd} ssh -p${port} ${user}@${remote_host} sshpass -p ${passwd} ssh -p${port} ${user}@${server_ip} ${stop_it}" ${cmd} } ##线上服务器内部用 sshpass 解决交互的输入密码, 后继可以考虑用 key 的方式, 并远程自动重启服务 function remote_distribute() { echo remote_host="$1" remote_path="$2" server_ip="$3" pname="$4" remote_file="${remote_path}/${pname}/bin/lib*.so" dist_path="~/project_app/${pname}/bin/" rpasswd="xxxx" user="username" passwd="xxxxxxx" port="22" #key="${HOME}/.ssh/project_app" echo -e "IN REMOTE ${remote_host} DISTRIBUTE ${YELLOW}${pname}${END} to ${RED}${server_ip} ${dist_path}${END}:" #cmd="ssh -p${port} -i ${key} ${user}@${remote_host} sshpass -p ${passwd} scp ${remote_file} ${user}@${server_ip}:${dist_path}" cmd="sshpass -p ${rpasswd} ssh -p${port} ${user}@${remote_host} sshpass -p ${passwd} scp -P${port} ${remote_file} ${user}@${server_ip}:${dist_path}" ${cmd} if [ "${pname}" = "online" ];then remote_file="${remote_path}/${pname}/bin/conf/*" dist_path="~/project_app/${pname}/bin/conf/" user="username" passwd="xxxxxxx" port="22" #key="${HOME}/.ssh/project_app" echo -e "IN REMOTE ${remote_host} DISTRIBUTE ${YELLOW}${pname}${END} to ${RED}${server_ip} ${dist_path}${END}:" #cmd="ssh -p${port} -i ${key} ${user}@${remote_host} sshpass -p ${passwd} scp -r ${remote_file} ${user}@${server_ip}:${dist_path}" cmd="sshpass -p ${rpasswd} ssh -p${port} ${user}@${remote_host} sshpass -p ${passwd} scp -P${port} -r ${remote_file} ${user}@${server_ip}:${dist_path}" ${cmd} fi sleep 1 } ##线上服务器内部用 sshpass 解决交互的输入密码, 后继可以考虑用 key 的方式, 并远程自动重启服务 function remote_start() { echo remote_host="$1" remote_path="$2" server_ip="$3" pname="$4" rpasswd="xxxx" remote_file="${remote_path}/${pname}/bin/lib*.so" user="username" passwd="xxxxxxx" port="22" #key="${HOME}/.ssh/project_app" echo -e "IN REMOTE ${remote_host} ${RED} START ${YELLOW}${pname}${END} ${RED}${server_ip}${END}:" start_it="~/project_app/${pname}/startup" #cmd="ssh -p${port} -i ${key} ${user}@${remote_host} sshpass -p ${passwd} ssh ${user}@${server_ip} ${start_it} " cmd="sshpass -p ${rpasswd} ssh -p${port} ${user}@${remote_host} sshpass -p ${passwd} ssh -p${port} ${user}@${server_ip} ${start_it} " ${cmd} sleep 1 echo -e "${GREEN}FINISH ${pname}${END}" } THE_PATH=`dirname $0` cd ${THE_PATH} cd "./project_app/online/bin/" ./update.conf cd ../../../ # #注意下面三个路径,local_path 末尾的 / 不可少和 remote_path 末尾的 / 不可有, remote_path 使用绝对路径 # local_path="./project_app/" exc_list_file="./exclude.list" remote_path="/home/username/release-center/project_app/${year}-${month}-${day}-${hour}" rhost="10.1.1.237" rport=22 ruser="username" if [ ! -f ${exc_list_file} ]; then touch ${exc_list_file} fi # 发布本地程序到 中心服务器上 --- 发布 project_app 目录下的 文件, 要忽略文件在 exclude.list 中添加 rsync_for_release $local_path $remote_path $ruser $rhost $rport $exc_list_file #从远程的中心服务器, 停止各个 业务服务器上的程序 pname="app_1" ip="127.0.0.1" remote_stop ${rhost} ${remote_path} ${ip} ${pname} pname="app_2" ip="127.0.0.1" remote_stop ${rhost} ${remote_path} ${ip} ${pname} pname="app_3" ip="127.0.0.1" remote_stop ${rhost} ${remote_path} ${ip} ${pname} pname="app_4" ip="127.0.0.1" remote_stop ${rhost} ${remote_path} ${ip} ${pname} pname="app_5" ip="127.0.0.1" remote_stop ${rhost} ${remote_path} ${ip} ${pname} pname="app_6" ip="127.0.0.1" #remote_stop ${rhost} ${remote_path} ${ip} ${pname} #从远程的中心服务器, 分发程序到各个 业务服务器上 --- 只更新 so 文件 pname="app_1" ip="127.0.0.1" remote_distribute ${rhost} ${remote_path} ${ip} ${pname} pname="app_2" ip="127.0.0.1" remote_distribute ${rhost} ${remote_path} ${ip} ${pname} pname="app_3" ip="127.0.0.1" remote_distribute ${rhost} ${remote_path} ${ip} ${pname} pname="app_4" ip="127.0.0.1" remote_distribute ${rhost} ${remote_path} ${ip} ${pname} pname="app_5" ip="127.0.0.1" remote_distribute ${rhost} ${remote_path} ${ip} ${pname} pname="app_6" ip="127.0.0.1" remote_distribute ${rhost} ${remote_path} ${ip} ${pname} #从远程的中心服务器, 启动各个 业务服务器上的程序 pname="app_6" ip="127.0.0.1" #remote_start ${rhost} ${remote_path} ${ip} ${pname} pname="app_5" ip="127.0.0.1" remote_start ${rhost} ${remote_path} ${ip} ${pname} pname="app_4" ip="127.0.0.1" remote_start ${rhost} ${remote_path} ${ip} ${pname} pname="app_3" ip="127.0.0.1" remote_start ${rhost} ${remote_path} ${ip} ${pname} pname="app_2" ip="127.0.0.1" remote_start ${rhost} ${remote_path} ${ip} ${pname} pname="app_1" ip="127.0.0.1" remote_start ${rhost} ${remote_path} ${ip} ${pname}
true
989d6dda5637c6bcea1e98e3b8104dfe3fd20e43
Shell
maledorak/LABS
/dotfiles/home/scripts/devices/ku-1255_set_sensitivity
UTF-8
837
3.8125
4
[]
no_license
#!/bin/bash # # Set sensitivity for Lenovo Thinkpad KU-1255 Keyboard # using: sudo ./ku-1255_set_sensitivity 250 # # Resources: # http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoint # https://wiki.archlinux.org/index.php/TrackPoint # SENSITIVITY=$1 # default 160 if [ -z "$SENSITIVITY" ] then SENSITIVITY=255 echo "First argument is empty, sensitivity will be set to ${SENSITIVITY}" fi NAME="Lenovo ThinkPad Compact Keyboard with TrackPoint" DATA=$(lsusb | grep "$NAME") BUS=$(echo "$DATA" | grep -Po 'Bus \K0*[1-9]+') DEV=$(echo "$DATA" | grep -Po 'Device \K0*[1-9]+') DEVPATH="/sys$(udevadm info /dev/bus/usb/"$BUS"/"$DEV" -q path)" SENSITIVITY_PATH=$(find "$DEVPATH" -name "sensitivity") echo "Sensitivity ${SENSITIVITY} will be set." echo "In path ${SENSITIVITY_PATH}" echo -n "$SENSITIVITY" > "$SENSITIVITY_PATH"
true
4d3f17bb57198b441a81cf9396807ceb0a874484
Shell
leograba/lava-tests
/apalis_tk1/resources/read-ahead-threshold-values.sh
UTF-8
266
2.796875
3
[]
no_license
#!/bin/sh set -x MOD_ID=$(cat /proc/device-tree/toradex,product-id) case $MOD_ID in # apalis TK1 2GB 0034) export MMC=4096 ; export SD1=1024 ; export SD2=512 export MMC_MOUNT=mmcblk0 ; export SD1_MOUNT=mmcblk1 ; export SD2_MOUNT=mmcblk2 ;; *) false ; esac
true
eb3b2566a3cf863ffc342fba76eb28b742bfa848
Shell
forno/dotfiles
/setup.sh
UTF-8
889
3.921875
4
[ "Unlicense" ]
permissive
#!/bin/sh filter_out_ignore(){ while read line do [ "$line" = '.' ] || [ "$line" = '..' ] || [ "$line" = '.git' ] || [ "$line" = '.gitignore' ] || [ "$line" = '.gitmodules' ] && continue echo $line done } DOT_FILES=`echo .* | tr ' ' '\n' | filter_out_ignore | tr '\n' ' '` echo "List of targets: $DOT_FILES" echo "When link file, I say put." cd `dirname $0` DOT_FILES_DIR=`pwd` for file in $DOT_FILES do if [ -e $HOME/$file ]; then if [ -L $HOME/$file ]; then echo "found symbolick link on HOME: $file" continue fi if [ -d $HOME/$file ]; then echo "found dirctory on HOME: $file" continue fi echo "found raw(normal) file." mv $HOME/$file $HOME/$file.autobackup echo "backup old file to: $file.autobackup" fi ln -s "$DOT_FILES_DIR/$file" "$HOME/$file" echo "put symbolic link: $file" done
true
4b15355bb30cb37e55ae257dfcb51fbb2ef85bca
Shell
Nevondo/server-tools
/blocklist/start.sh
UTF-8
1,250
3.390625
3
[ "MIT" ]
permissive
#!/bin/bash function checkDependencies { dpkg --get-selections | grep '^ipset' >/dev/null if [[ $? = 1 ]]; then apt-get install ipset -y fi dpkg --get-selections | grep '^xtables-addons-source' >/dev/null if [[ $? = 1 ]]; then apt-get install xtables-addons-source -y fi dpkg --get-selections | grep '^module-assistant' >/dev/null if [[ $? = 1 ]]; then apt-get install module-assistant -y fi dpkg --get-selections | grep '^perl' >/dev/null if [[ $? = 1 ]]; then apt-get install perl -y fi } function insertBlocklist { wget -O blocklist.pl https://git.nevondo.com/Nevondo/server-tools/raw/master/blocklist/blocklist.pl mv blocklist.pl /opt/blocklist.pl chmod +x /opt/blocklist.pl } function checkCron { if [ ! -f /etc/cron.hourly/blocklist ]; then echo "#!/bin/bash" >> /etc/cron.hourly/blocklist echo "/usr/bin/perl /opt/blocklist.pl >/dev/null 2>&1" >> /etc/cron.hourly/blocklist chmod +x /etc/cron.hourly/blocklist fi } if [ "`id -u`" != "0" ]; then echo "Wechsle zu dem Root Benutzer!" su root fi if [ "`id -u`" != "0" ]; then echo "Nicht als Rootbenutzer ausgeführt, Abgebrochen!" exit fi checkDependencies insertBlocklist checkCron
true
547e02416d6c1914131bb475c1eefc0017e3f9f8
Shell
xebecproject/xebec
/docker/build-docker.sh
UTF-8
512
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR/.. DOCKER_IMAGE=${DOCKER_IMAGE:-xebecproject/xebecd-develop} DOCKER_TAG=${DOCKER_TAG:-latest} BUILD_DIR=${BUILD_DIR:-.} rm docker/bin/* mkdir docker/bin cp $BUILD_DIR/src/xebecd docker/bin/ cp $BUILD_DIR/src/xebec-cli docker/bin/ cp $BUILD_DIR/src/xebec-tx docker/bin/ strip docker/bin/xebecd strip docker/bin/xebec-cli strip docker/bin/xebec-tx docker build --pull -t $DOCKER_IMAGE:$DOCKER_TAG -f docker/Dockerfile docker
true
d69d0bf442baa79488df00f0b98cb0004142121e
Shell
ChengGuan3/libOTe
/build.sh
UTF-8
189
2.6875
3
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain", "Unlicense" ]
permissive
#!/bin/bash mkdir -p out mkdir -p out/build mkdir -p out/build/linux cd out/build/linux #if [ ! -f ./Makefile ] || [ "$#" -ne 0 ]; then #fi cmake ../../.. $@ make -j cd ../../..
true
08d1d3948eaf935acd53a94d0a4285f1c17723f9
Shell
arcolinuxiso/carli-pkgbuild
/plymouth-theme-monoarch/PKGBUILD
UTF-8
883
2.515625
3
[]
no_license
# Maintainer: Marco Buzzanca <marco /DOT/ bzn /AT/ gmail /DOT/ com> pkgname=plymouth-theme-monoarch pkgver=0.1 pkgrel=1 pkgdesc='Monochrome Arch Linux theme for Plymouth' arch=('any') url='https://farsil.github.io/monoarch/' license=('MIT') depends=('plymouth') install=$pkgname.install source=("https://github.com/farsil/monoarch/archive/$pkgver.tar.gz" "$pkgname.install") sha256sums=('e26fe7100dbe612b517037a55488f5ae25976b55e60a542c53623073e52a5ca1' 'efc4134ab3a534dbd0b92ec1abc55f17cda2968c0d5c6a855fe0cb760b4b291a') package() { cd "$srcdir/monoarch-$pkgver" install -d "$pkgdir/usr/share/plymouth/themes/monoarch/images/" install -Dm644 monoarch.* "$pkgdir/usr/share/plymouth/themes/monoarch/" install -Dm644 images/* "$pkgdir/usr/share/plymouth/themes/monoarch/images/" install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" }
true
24529f121d7641de38b2ea256593e23263efdebd
Shell
nikhil-thomas/wos
/shell-scripts/itimer
UTF-8
391
3.3125
3
[]
no_license
#!/usr/bin/env bash hrs=$1 mins=$2 secs=$3 cycles=$4 beeps=$5 hrs=${hrs:-0} mins=${mins:-0} secs=${secs:-0} cycles=${cycles:-1} function itimer() { local interval=$1 for (( i=0;i<$cycles;i++ )); do echo cycle=$(( i + 1 ))/$cycles #for (( j=$interval;j>0;j-- ));do # sleep 1 # echo ${j}s # done pmdr $1 $beeps done } itimer $(( $(hm2s $hrs $mins) + secs ))
true
6665b06e7f8c6586f9e354b340b69f9f5857d7a7
Shell
nevesnunes/env
/common/code/snippets/sysadmin/pdfs.sh
UTF-8
860
2.640625
3
[ "MIT" ]
permissive
# start with a bunch of PNG images of your zine pages # convert them all to PDF for i in *.png do # imagemagick is the best thing in the world convert $i $i.pdf done # pdftk is awesome for combining pdfs into a single pdf pdftk *.pdf cat output zine.pdf # pdfmod is a GUI that lets you reorder pages pdfmod zine.pdf # pdfcrop lets you add margins to the pdf. this is good because otherwise the # printer will cut off stuff at the edges pdfcrop --margin '29 29 29 29' zine.pdf zine-intermediate.pdf # pdfjam is this wizard tool that lets you take a normal ordered pdf and turn # it into something you can print as a booklet on a regular printer. # no more worrying about photocopying machines pdfjam --booklet true --landscape --suffix book --letterpaper --signature 12 --booklet true --landscape zine-intermediate.pdf -o zine-booklet.pdf
true
7cb246f82e6609acdfb6f0ecefc12927f79d792f
Shell
lvjonok/operating-systems-f21
/week05/ex2_problem.sh
UTF-8
405
3.4375
3
[]
no_license
# We should check existence of this file before writing to it anything if ! [ -f ex2.txt ] then echo -n 0 >> ex2.txt fi while : do # nothing stops other processes to execute some operations on file ex2 here # that means two processes easily could read the same last integer and # result in missed pattern in the resulting file echo -n "\n$(($(tail -n 1 ex2.txt) + 1))" >> ex2.txt done
true
b2bfdc55b376ea9ecf901c4e310aff639914f60c
Shell
CMSgov/beneficiary-fhir-data
/ops/terraform/env/mgmt/base_config/scripts/edit-eyaml.sh
UTF-8
1,448
3.859375
4
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env bash # This is a simple script that assists operators with editing values stored # in encrypted yaml files. As of this writing, this targets the ansible-vault # encryption mechanism, and depends on access to the appropriate SSM Parameter # Store hierarchy to resolve the password. # This is intended for use in local development. # # Globals: # SCRIPTS_DIR the parent directory of this script # MODULE_DIR the parent directory of SCRIPTS_DIR, assumed to be the "base_config" module # EYAML_FILE formatted "$1" positional argument for relative file resolution # SSM_VAULT_PASSWORD_PATH SSM Hierarchy containing the ansible vault password # # Arguments: # $1 is the desired eyaml file that can be entered with or without qualifying path or # suffix. `values/foo.eyaml`, `values/foo`, `foo.eyaml` and `foo` are equivalent. SCRIPTS_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") MODULE_DIR="$(dirname "$SCRIPTS_DIR")" EYAML_FILE="$(basename "$1" | sed 's/\.eyaml//').eyaml" SSM_VAULT_PASSWORD_PATH="/bfd/mgmt/jenkins/sensitive/ansible_vault_password" # open a desired eyaml file from a temporary, decrypted, user-owned location on disk # in the user's desired `$EDITOR` ansible-vault edit --vault-password-file=<( aws ssm get-parameter \ --region us-east-1 \ --output text \ --with-decryption \ --query 'Parameter.Value' \ --name "$SSM_VAULT_PASSWORD_PATH" ) "$MODULE_DIR/values/${EYAML_FILE}"
true
9aa1bf8c782ab596c7ed1d7cba9d0895bce67200
Shell
AlexandreMPDias/awesome-scripts-unix
/bin/yumm
UTF-8
1,418
3.734375
4
[]
no_license
#!/bin/bash if [ "$1" == "--help" ]; then echo "Yumm" echo "Builds and then runs" echo "valid flags: [--r][--d][--no-package]" echo echo "-r : Skip run" echo "-d : Skip declarations" echo "-b : Skip build" echo "-no-package: Builds all packages" fi for arg in "$@"; do if [[ $arg == -* ]]; then if [ $arg == "-r" ]; then noRun="1" elif [ $arg == "-b" ]; then noBuild="1" elif [ $arg == "-d" ]; then noD="1" elif [ $arg == "-no-package" ]; then noPackage="1" else echo Invalid flag. For help, run [ yumm help ] exit 1 fi else if [ -z $first ]; then first=$arg elif [ -z $second ]; then second=$arg fi fi done if [ "$noBuild" == "1" ]; then echo "No build flag is active. Skipping Build" second="$first" elif [ "$noPackage" == "1" ]; then echo "[yumm] No Package selected. Building everything" yarn build elif [ -z $first ]; then echo "[yumm] No Package selected. Building everything" yarn build else echo "[yumm] Building: $first" yarn "build:$first" fi yarn awesome if [ "$noRun" == "1" ]; then exit 0 elif [ "$noPackage" == "1" ]; then if [ -z $first ]; then yarn run:web fi elif [ -z $second ]; then yarn run:web else yarn run:$second fi
true
4ad39b71699169526a24c2e8a0774f267f725ce0
Shell
DianaBelePublicRepos/BashBasics
/BashBasicsPartIII/basicsPassingOptionsWithValues.sh
UTF-8
605
4.15625
4
[]
no_license
#! /bin/bash #Sometimes you need options with additional parameter values like this: #./myscript -a value1 -b -c value2 while [ -n "$1" ]; do # while loop starts case "$1" in -a) echo "-a option passed" ;; -b) param="$2" echo "-b option passed, with value $param" shift ;; -c) echo "-c option passed" ;; --) shift # The double dash makes them parameters break ;; *) echo "Option $1 not recognized" ;; esac shift done total=1 for param in "$@"; do echo "#$total: $param" total=$(($total + 1)) done
true
42901a828f32093e89f5aa305911004136d6d6e6
Shell
tioammar/tcp_bandwidth_tester
/change
UTF-8
289
2.84375
3
[]
no_license
#!/bin/bash #Change the current congestion control algorithm to the algorithm specified by commandline argument. #Specified algorithm must be one of the available algorithms in /proc/sys/net/ipv4/tcp_available_congestion_control #Run as root. sysctl net.ipv4.tcp_congestion_control="$1"
true
adee824b64c5aa00574a5a4c8af520c4a70be68d
Shell
MrGunnery/Samba
/Script/Script.txt
UTF-8
495
3.1875
3
[]
no_license
#!/bin/bash fichier=$1 while read ligne do login=$(echo $ligne | cut -d: -f1) mdp=$(echo $ligne | cut -d: -f2) group=$(echo $ligne | cut -d: -f3) echo "Création de l'utilisateur "$login adduser $login -g $group echo -e "$mdp\n$mdp" | (smbpasswd -a -s $login) mkdir /profiles/$login mkdir /profiles/$login.V2 chmod 700 /profiles/$login chmod 700 /profiles/$login.V2 chown $login:$group /profiles/$login chown $login:$group /profiles/$login.V2 done < $fichier exit 0
true
0adc1445d900917f45b559389d4dbe9b8fee9778
Shell
SteeleDesmond/pcp-sdn
/pcp_sdn_source/scripts/resources/create_file.sh
UTF-8
2,949
5
5
[ "MIT" ]
permissive
#!/bin/bash # # This script creates a file of the specified type in the "[home]/tmp" directory. # #=============================================================================== PROGNAME="$(basename "$0")" #------------------------------------------------------------------------------- TEMP_DIR="$HOME"'/tmp' if [ ! -d "$TEMP_DIR" ]; then mkdir -p "$TEMP_DIR" fi #------------------------------------------------------------------------------- option_do_not_create=0 option_file_type='file' option_permissions=766 option_no_output=0 USAGE=" Create a file in the home temporary directory with the specified base name and print the file path. Usage: $PROGNAME [options]... [base name] Options: -n, --do-not-create - do not create the file if it does not exist -t [type], --type [type] - file type to create: 'file', 'dir', 'pipe'; if the file already exists, it will be left intact, even if it is a file of different type -p [perms], --permissions [perms] - file permissions to assign; if the file exists, permissions are left intact -s, --no-output - do not print the file path -h, --help " usage_and_exit() { # Print the usage string to stderr and exit. # $1 - usage string to print echo "$USAGE" 1>&2 exit 1 } #------------------------------------------------------------------------------- # Parse options while [[ "${1:0:1}" = "-" && "$1" != "--" ]]; do case "$1" in -n | --do-not-create ) option_do_not_create=1 shift ;; -t | --type ) option_file_type="$2" shift ;; -p | --permissions ) option_permissions="$2" shift ;; -s | --no-output ) option_no_output=1 shift ;; -h | --help ) usage_and_exit ;; * ) if [ -n "$1" ]; then echo "${PROGNAME}: unknown option: '$1'" 1>&2 fi usage_and_exit ;; esac shift done if [ "$1" = "--" ]; then shift fi #------------------------------------------------------------------------------- if [ -z "$1" ]; then echo "${PROGNAME}: base name not specified" usage_and_exit fi #------------------------------------------------------------------------------- file_to_create="$TEMP_DIR"'/'"$1"'-log' if [ "${option_do_not_create}" -eq 0 ]; then case "${option_file_type}" in file ) if [ ! -e "$file_to_create" ]; then : > "$file_to_create" chmod "${option_permissions}" "$file_to_create" fi ;; dir ) if [ ! -e "$file_to_create" ]; then mkdir -p "$file_to_create" --mode="${option_permissions}" fi ;; pipe ) if [ ! -e "$file_to_create" ]; then mkfifo "$file_to_create" --mode="${option_permissions}" fi ;; * ) echo "${PROGNAME}: invalid type: '$1'" 1>&2 usage_and_exit ;; esac fi #------------------------------------------------------------------------------- if [ "${option_no_output}" -eq 0 ]; then echo "$file_to_create" fi
true
33d33fdf43159288d1c8a9b2934ac49aea94f0fb
Shell
pegasus-isi/pegasus-ensemble-manager-examples
/workflows/wf-java/plan.sh
UTF-8
1,475
3.203125
3
[]
no_license
#!/bin/bash set -e set -v TOP_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P ) cd $TOP_DIR # build the dax generator export CLASSPATH=.:`pegasus-config --classpath` javac --release 8 BlackDiamondDAX.java # generate the dax java BlackDiamondDAX /usr blackdiamond.yml # create the site catalog cat >sites.xml <<EOF <?xml version="1.0" encoding="UTF-8"?> <sitecatalog xmlns="http://pegasus.isi.edu/schema/sitecatalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pegasus.isi.edu/schema/sitecatalog http://pegasus.isi.edu/schema/sc-4.0.xsd" version="4.0"> <site handle="condorpool" arch="x86_64" os="LINUX" osrelease="" osversion="" glibc=""> <profile namespace="env" key="PEGASUS_HOME" >/usr</profile> <profile namespace="condor" key="universe" >vanilla</profile> <profile namespace="pegasus" key="style" >condor</profile> </site> <site handle="local" arch="x86_64" os="LINUX" osrelease="" osversion="7" glibc=""> <directory path="$HOME/workflows/scratch" type="shared-scratch" free-size="" total-size=""> <file-server operation="all" url="file://$HOME/workflows/scratch"> </file-server> </directory> <directory path="$HOME/workflows/outputs" type="local-storage" free-size="" total-size=""> <file-server operation="all" url="file://$HOME/workflows/outputs"> </file-server> </directory> </site> </sitecatalog> EOF # plan the workflow pegasus-plan \ --output-sites local \ --conf pegasusrc \ blackdiamond.yml
true
3e43aa29c8c800319eec7ae99b7f8ecbe62b69c8
Shell
JRasmusBm/dotfiles
/bin/git-big
UTF-8
140
2.75
3
[]
no_license
#!/bin/sh set -e _git_bisect_good() { ( cd "$(git rev-parse --show-toplevel)" git bisect good "$@" ) } _git_bisect_good "$@"
true
5ce194572f3337c8f8254f704b91a4a255b332b2
Shell
shwchurch3/t5
/bin/cron-sync.sh
UTF-8
700
2.984375
3
[]
no_license
#!/bin/bash . ~/.bashrc DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" cronScriptPath=/etc/cron.d/hugo-sync cronScriptEnv=/etc/cron.d/hugo-sync.env.sh env > ${cronScriptEnv} cat ${cronScriptEnv} hugoGithubRoot=/home/ec2-user/hugo/github syncFile=${hugoGithubRoot}/t5/bin/sync.sh logPath=${hugoGithubRoot}/sync.log scriptToRun="source ${cronScriptEnv}; /bin/bash ${syncFile} > ${logPath} 2>&1" echo "1 14 * * * root ${scriptToRun}" > ${cronScriptPath} echo "1 21 * * 6 root ${scriptToRun}" > "${cronScriptPath}_1" cat ${cronScriptPath} cat ${cronScriptPath}_1 service crond restart echo "Crontab restart, new PID: $(pgrep cron)" echo "sudo tail -f /var/log/cron*"
true
56aecaec333f4d23ceccfe222118e129804861be
Shell
vishnuak15/shell-scripting
/reader.sh
UTF-8
222
3.359375
3
[]
no_license
#!/usr/bin/env bash # read a file in linux shell COUNT=1 while IFS='' read -r LINE do echo "LINE $COUNT: $LINE" ((COUNT++)) done < "$1" exit 0 # command for writing a file: ./reader.sh names.txt >> output.txt
true
6820e9d32df4c49c5b6c26734738eff98edcee8e
Shell
eacousineau/dotfiles_template
/tmux-copy.sh
UTF-8
172
2.796875
3
[]
no_license
#!/bin/bash set -e if [[ -n "${_SSH_DISPLAY}" ]]; then export DISPLAY=${_SSH_DISPLAY} fi mkdir -p ~/tmp tee ~/tmp/tmux-clipboard.txt | xclip -in -selection clipboard
true
847d7d88953332f180db17ed72b0809d20d9820d
Shell
jpikl/tower-quest
/run.sh
UTF-8
243
3.5625
4
[ "MIT" ]
permissive
#!/bin/sh LOVE=/usr/bin/love print_and_exec() { echo "Executing: " "$@" "$@" } if [ -x $LOVE ]; then print_and_exec $LOVE . "$@" else echo "No $LOVE executable found" echo "Download and install LOVE 2d from https://love2d.org" fi
true
bca6c2595af6ab6a1ab5da60f3b14de60ac80c12
Shell
nukala/docker
/redsen/scr2
UTF-8
526
3.546875
4
[]
no_license
#! /bin/sh # /etc/init.d/redsen # REDSEN_CONFS=/redsen/conf REDSEN_HOME=/usr/local/bin export REDSEN_HOME REDSEN_CONFS # Carry out specific functions when asked to by the system case "$1" in start) echo "Starting script redsen " /redsen/bin/redis.sh start 01 /redsen/bin/sentinel.sh start 01 ;; stop) echo "Stopping script redsen " /redsen/bin/redis.sh stop 01 /redsen/bin/sentinel.sh stop 01 ;; *) echo "Usage: /etc/init.d/redsen {start|stop}" exit 1 ;; esac exit 0
true
092147fa5aabc7746f181c3606256ec20e33001b
Shell
mlibrary/chipmunk-client
/bin/batch-ead-bag
UTF-8
1,487
4.125
4
[]
no_license
#!/bin/bash if [[ -z "$4" ]]; then echo "Usage: batch-ead-bag <audio|video> <EAD file> <EAD URL> <directory> [additional_directory...]" exit 1 fi if [[ -n "$CHIPMUNK_HOME" ]]; then if [[ -x "$CHIPMUNK_HOME/bin/makebag" ]]; then MAKEBAG="$CHIPMUNK_HOME/bin/makebag" else echo "If CHIPMUNK_HOME is set, it must point to a chipmunk-client directory with bin/makebag in it." exit 1 fi elif [[ ! "$(which makebag)" ]]; then echo "The chipmunk-client bin directory (with makebag and upload) must be on the PATH or you must set CHIPMUNK_HOME to the client directory." exit 1 else MAKEBAG="$(which makebag)" fi if [[ -z "$CHIPMUNK_LOGS" ]]; then echo "You must set CHIPMUNK_LOGS to a directory that is writeable for log files." exit 1 fi mkdir -p "$CHIPMUNK_LOGS" CONTENT_TYPE="$1" EAD_FILE="$2" EAD_URL="$3" shift shift shift LOGFILE="$CHIPMUNK_LOGS/batch-$(date +"%Y%m%d%H%M%S").log" echo "Making batch of bags of type: $CONTENT_TYPE" echo "Logging to: $LOGFILE" echo "----" for file in "$@"; do barcode="$(basename "$file")" directory="$(dirname "$file")" output="$directory/bagged/$(basename "$file")" if [[ ! $barcode =~ ^39015.* ]]; then echo "Skipping apparent non-barcode $barcode"; continue fi mkdir -p "$directory"/bagged echo "Bagging $barcode to $output" "$MAKEBAG" -s "$file" --metadata-type EAD --metadata-path="$EAD_FILE" --metadata-url="$EAD_URL" "$CONTENT_TYPE" "$barcode" "$output" 2>&1 | tee -a "$LOGFILE" done
true
0b02d7f9eaa5f02b5bab228b3f0dfdebde24c4f6
Shell
CAIDA/grip-tools
/scripts/consumer-rerun/run-moas.sh
UTF-8
781
2.609375
3
[]
no_license
#!/bin/bash #SBATCH --job-name=grip-moas-2020 #SBATCH --output="logs/observatory-rerun-moas.%j.%N.out" #SBATCH --error="logs/observatory-rerun-moas.%j.%N.err" #SBATCH --partition=compute #SBATCH -t 48:00:00 #SBATCH --mem=120G #SBATCH --cpus-per-task=6 #SBATCH --nodes=1 #SBATCH --no-requeue ### SLURM will requeue jobs if there is a node failure. #SBATCH --export=ALL #SBATCH -A TG-CIS200040 ### HIJACKS grant #SBATCH --array=0-1 ### $SLURM_ARRAY_TASK_ID TIME=`date +%Y-%m-%d-%H` for i in `seq 0 23`; do TID=$(($i + $SLURM_ARRAY_TASK_ID*2)) # run for a whole year, 4 tasks per month, total of 48 tasks python run.py -s 1577836800 -e 1609459200 -t moas -T 48 -i $TID > "logs/$TIME-moas-$TID.out" 2>"logs/$TIME-moas-$TID.err" & done wait
true
8e5f95fa34737af0ae7c7f580e5b5384fc70880f
Shell
arch-beryllium/bootsplash
/PKGBUILD
UTF-8
1,082
2.59375
3
[]
no_license
pkgname=bootsplash pkgver=0.1 pkgrel=2 pkgdesc='Bootsplash' arch=('i686' 'x86_64' 'aarch64') license=('GPL2') makedepends=('gcc' 'imagemagick') options=('!libtool' '!emptydirs') source=('https://gitlab.manjaro.org/manjaro-arm/packages/extra/bootsplash-packer/-/raw/master/bootsplash_file.h' 'https://gitlab.manjaro.org/manjaro-arm/packages/extra/bootsplash-packer/-/raw/master/bootsplash-packer.c' 'bootsplash.sh' 'bootsplash.initcpio_install' 'spinner.gif' 'logo.png') md5sums=('4a251bae57a652bfa32361144815153c' '44df81a35ef9d008fffdc94800694f9c' '7eed6221f5fb41d07a10581e0987e0ae' '4dcf4ae407080cb7014cff4f5f9baac9' '6267db671e80e80a0a6db81126a2d9dd' 'ff61bd3f636a2be51c912ea30491a05a') build() { cd "${srcdir}" ${CC:-gcc} $CFLAGS -o bootsplash-packer bootsplash-packer.c sh ./bootsplash.sh } package() { cd "${srcdir}" install -Dm644 bootsplash "$pkgdir/usr/lib/firmware/bootsplash" install -Dm644 bootsplash.initcpio_install "$pkgdir/usr/lib/initcpio/install/bootsplash" }
true
a19a3d0f409d51aa9ddefeaa73ee46486c4b5986
Shell
TimSvensson/Introduction-to-Parallel-Programming
/ass_2/ex_1/integration_script.sh
UTF-8
477
3.421875
3
[]
no_license
#!/bin/bash f="./results.txt" run="./out/integrate.out" args="1 10 100 1000 10000 100000 1000000" echo "" echo "Running script" $0 echo "" echo "Results from running integration.out with different arguments." > ${f} echo "" >> ${f} for i in {0..4} do numThreads=$((2 ** $i)) echo "Running with" $numThreads "thread(s)" >> $f for numTrapezes in $args do out=$($run $numThreads $numTrapezes) echo $out echo " $out" >> $f done echo "" >> $f done
true
04c4816989d5af842e8575412eb0b9f846045f72
Shell
miaocunfa/OpsNotes
/运维/Zabbix/指标/network_status.sh
UTF-8
807
2.953125
3
[]
no_license
#!/bin/bash eth=$1 io=$2 net_file="/proc/net/dev" if [ $2 == "in" ] then n_new=`grep "$eth" $net_file|awk '{print $2}'` n_old=`tail -1 /tmp/neti.log` n=`echo "$n_new-$n_old"|bc` d_new=`date +%s` d_old=`tail -2 /tmp/neti.log|head -1` d=`echo "$d_new-$d_old"|bc` if_net=`echo "$n/$d"|bc` echo $if_net date +%s>>/tmp/neti.log grep "$eth" $net_file|awk '{print $2}'>>/tmp/neti.log elif [ $2 == "out" ] then n_new=`grep "$eth" $net_file|awk '{print $10}'` n_old=`tail -1 /tmp/neto.log` n=`echo "$n_new-$n_old"|bc` d_new=`date +%s` d_old=`tail -2 /tmp/neto.log|head -1` d=`echo "$d_new-$d_old"|bc` if_net=`echo "$n/$d"|bc` echo $if_net date +%s>>/tmp/neto.log grep "$eth" $net_file|awk '{print $10}'>>/tmp/neto.log else echo 0 fi
true
913a71022400e052ab23b60953d54fbd17545e83
Shell
level5/LaTeX
/programming/code/shell/abs-guide/chapter04/variables.sh
UTF-8
540
3.5
4
[]
no_license
#! /bin/bash variable1=23 echo variable1 # variable1 echo $variable1 # 23 a=375 hello=$a # no whitespace between '=' and '$a' echo hello # hello echo $hello # 375 echo ${hello} # 375, same as above, in certain context, only this form works. # "" weak quoting or partial quoting, no interfere with variable substitution # '' strrong quoting or full quoting, no variable substitution will take place. echo "$hello" # 375 echo hello="A B C D" echo $hello # A B C D echo "$hello" # A B C D
true
c5016a16c676301a7436a3c6135e33b102e1365a
Shell
cyborgmg/kraken.parent
/kraken.war/jrebel.sh
UTF-8
769
2.78125
3
[]
no_license
#!/bin/bash pserver=/root/java/servers/10.0.0.Final pproject=/root/java/workspace/kraken/kraken.war for pfile in $( find $pproject/src/main/webapp/ | grep -i \.xhtml$ ) do file=$(basename $pfile) for eappfile in $( find $pserver/standalone/ -iname $file ) do cp -vu $pfile $eappfile done done for pfile in $( find $pproject/src/main/webapp/css/ | grep -i \.css$ ) do file=$(basename $pfile) for eappfile in $( find $pserver/standalone/ -iname $file ) do cp -vu $pfile $eappfile done done for pfile in $( find $pproject/src/main/webapp/ | grep -i \.html$ ) do file=$(basename $pfile) for eappfile in $( find $pserver/standalone/ -iname $file ) do cp -vu $pfile $eappfile done done
true
32231b1f7970ff4386e8986e90bedb791d170cd0
Shell
Seni-J/SharedHosting
/addUser.sh
UTF-8
3,734
3.46875
3
[]
no_license
echo "Enter the new username : " read username echo "Enter the domain name for this site : " read domain echo "Enter the new username password : " read -s password echo "Enter the actual mysql root password : " read -s rootpwd # ajoute un utilisateur adduser --disabled-password --gecos "" $username echo $username":"$password|chpasswd # Add little php homepage on the future user repertory echo "Configuration du site" mkdir -p /var/www/$domain/html echo "Ajout d'une page internet" touch /var/www/$domain/html/index.html cat > /var/www/$domain/html/index.html <<TEXTBLOCK <div style="text-align: center;"> <h1>Bienvenue sur le site $username !</h1> </div> <?php phpinfo(); TEXTBLOCK # Configure rights for the user echo "- Configuring user rights" chown -R $username:$username /home/$username chmod 770 /home/$username # create php pool echo "- Configuring php pool" touch /etc/php/7.0/fpm/pool.d/$username.conf cat > /etc/php/7.0/fpm/pool.d/$username.conf <<TEXTBLOCK [$domain] user = $username group = $username listen = /run/php/php7.0-fpm-$username.sock listen.owner = www-data listen.group = www-data php_admin_value[disable_functions] = exec,passthru php_admin_flag[allow_url_fopen] = off pm = dynamic pm.max_children = 5 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 chdir = / TEXTBLOCK # config nginx echo "- Configuring nginx" touch /etc/nginx/sites-available/$username.conf cat > /etc/nginx/sites-available/$username.conf <<TEXTBLOCK server { listen 80; listen [::]:80; root /var/www/$domain/html; # Add index.php to the list if you are using PHP index index.html index.htm index.php; server_name $domain; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files \$uri \$uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm-$username.sock; } } TEXTBLOCK # enable the new site ln -s /etc/nginx/sites-available/$username.conf /etc/nginx/sites-enabled/ # utilisateur mariaDB echo "- Creating Database" mysql -uroot -p$rootpwd <<EOF CREATE DATABASE db_$username; CREATE USER '$username'@'%' IDENTIFIED BY '$password'; GRANT ALL privileges on db_$username.* to '$username'@'%' identified by '$password'; FLUSH privileges; EOF # bloquer accès au home aux autres utilisateurs chmod 700 /home/$username # bloquer accès au répertoire du site aux autres utilisateurs chmod 711 /var/www/$domain # assigner l'utilisateur à son home chown $username:$username /home/$username # assigner le site à l'utilisateur chown -R $username:$username /var/www/$domain # permet à l'utilisateur de modier le contenu de son chmod 751 /var/www/$domain/html/ # affiche la page internet de l'utilisateur chmod 640 /var/www/$domain/html/* # ajout du groupe pour les autres utilisateurs puissent voir le site chgrp www-data /var/www/$domain/html/* # Restart nginx/php echo "- Reloading configs" service nginx reload service php7.0-fpm reload echo "- Config reloaded" # Little sucess message echo -e "\033[1;32m" cat <<TEXTBLOCK -------------------------------------------------------------- User sucessfuly created ! Enjoy your work ! -------------------------------------------------------------- Username : $username Password : *** Domain Name : $domain SQL Database : DB_$username You can use your identifiers to copy files into your dedicated repertory with CP over SSH -------------------------------------------------------------- TEXTBLOCK echo -e "\033[0m"
true
e731371e58177aee63ed2b1061a7830de12d3ef2
Shell
sansajn/test
/bash/dist_version.sh
UTF-8
210
3.5
4
[]
no_license
#!/bin/bash # how to detect specified distribution like xenial, focal, ... codename=`lsb_release -c|awk '{print $2}'` if [ $codename == "xenial" ]; then echo xenial detected else echo sorry, not xenial fi
true
585cbb7cb8c2a243a14132882249484efaddb388
Shell
timmyjose-study/cpp-crash-course
/runcpp.sh
UTF-8
144
2.796875
3
[ "Unlicense" ]
permissive
#!/bin/bash file="$1" filename="${file%.*}" shift 1 clang++ -Wall -std=c++20 -o ${filename} ${file} $@ && ./${filename} rm -rf ${filename} *.o
true
043379f6422fb13ae1dca8025ee689d5f8524b54
Shell
elifesciences/builder-base-formula
/elife/config/etc-cron.daily-logrotate
UTF-8
1,150
3.765625
4
[ "MIT" ]
permissive
#!/bin/sh # Clean non existent log file entries from status file cd /var/lib/logrotate test -e status || touch status head -1 status > status.clean sed 's/"//g' status | while read logfile date do [ -e "$logfile" ] && echo "\"$logfile\" $date" done >> status.clean mv status.clean status test -x /usr/sbin/logrotate || exit 0 capture_file=/var/log/daily-logrotate.log # note: sh redirection differs slightly from bash redirection. # this sends stderr to stdout and stdout to the capture file /usr/sbin/logrotate /etc/logrotate.conf --verbose > "$capture_file" 2>&1 # logrotate doesn't appear to exit with a non-zero status when there is a # problem rotating a logfile so we have to grep the output. # failing to find a problem (|| true) is ok as well #grep --quiet -i "error:" "$capture_file" && logger "logrotate encountered an error on $(hostname): $capture_file" || true # same as above, but we're filtering out a bogus case logrotate is letting through in Ubuntu 18.04 set pipefail cat "$capture_file" | python3 /usr/local/bin/logrotate_noise_filter.py && logger "logrotate encountered an error on $(hostname): $capture_file" || true
true
4677008bf3e57b6f71a3ea5741c36989a282a1b0
Shell
pablo-mayrgundter/freality
/fun/randcolor.sh
UTF-8
188
3.015625
3
[]
no_license
#!/bin/bash export TERM=linux COLUMNS=$1 LINES=$2 while true ; do x=$((RANDOM%COLUMNS)) y=$((RANDOM%LINES)) c=$((40+(RANDOM%10))) echo -en "\033[$y;${x}f\033[1;${c}m " done
true
0be43325f76a0695ff92c727628d234e48c1f42c
Shell
mbautin/dev-env-setup
/run_from_bashrc.sh
UTF-8
803
2.84375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash # This should be invoked from ~/.bashrc. # -------------------------------------------------------------------------------- # gitprompt configuration # -------------------------------------------------------------------------------- # Set config variables first GIT_PROMPT_ONLY_IN_REPO=0 # GIT_PROMPT_FETCH_REMOTE_STATUS=0 # uncomment to avoid fetching remote status # This needs to be in some conf file in ~/.<something> along with other settings. # GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${HOSTNAME%%.*}:${Yellow}${PathShort}${ResetColor}" # GIT_PROMPT_END=... # uncomment for custom prompt end sequence # as last entry source the gitprompt script export _DEV_ENV_SETUP_DIR=$( dirname "${BASH_SOURCE}" ) . $_DEV_ENV_SETUP_DIR/bash-git-prompt/gitprompt.sh
true
d2d20543c579de0ae699c680d7e2f25ab893ea8d
Shell
htcondor/htmap
/docker/entrypoint.sh
UTF-8
627
3.296875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash set -e # set up directories for state _condor_local_dir=`condor_config_val LOCAL_DIR` || exit 5 mkdir -p "$_condor_local_dir/lock" "$_condor_local_dir/log" "$_condor_local_dir/run" "$_condor_local_dir/spool" "$_condor_local_dir/execute" "$_condor_local_dir/cred_dir" # start condor condor_master # once the shared port daemon wakes up, use condor_who to wait for condor to stand up while [[ ! -s "${_condor_local_dir}/log/SharedPortLog" ]] do sleep .01 done sleep 1 # fudge factor to let shared port *actually* wake up condor_who -wait:60 'IsReady && STARTD_State =?= "Ready"' > /dev/null exec "$@"
true
a5a94d3efe89333e5d44bd0629d5e213a3054538
Shell
dbeley/scripts
/powermenu_wofi.sh
UTF-8
334
3.671875
4
[]
no_license
#!/usr/bin/env bash # This script displays a power menu with wofi pgrep -x wofi && exit 1 OPTIONS="Reboot\nPoweroff\nSleep" choice="$(echo -e $OPTIONS | wofi -i -dmenu )" [ -z "$choice" ] && exit 1 case "$choice" in Reboot) systemctl reboot ;; Poweroff) systemctl poweroff ;; Sleep) systemctl suspend ;; *) ;; esac exit 0
true
be9631bad7fc7acf0c75d74a0c169443b9e8b02a
Shell
markuslindenberg/debuilder
/build.sh
UTF-8
347
2.703125
3
[ "Apache-2.0" ]
permissive
#!/bin/bash set -e cp -r /input /build/source && chown -R build: /build/source cd /tmp && mk-build-deps -i -r /build/source/debian/control cd /build/source && sudo -E -u build debuild -us -uc -b OWNER=$(stat -c %u:%g /output) && \ find /build -maxdepth 1 -type f \ -execdir cp -f -t /output '{}' \; \ -execdir chown "$OWNER" '/output/{}' \;
true
abe9f68c71ac3312ecb2ddb33dbcad348249196f
Shell
Alexis01/Practica1SistemasOperativos
/quien.sh
UTF-8
936
3.828125
4
[]
no_license
#!/bin/bash #Ejercicio propuesto pratica 1 SO - Valentin Blanco Gomez y Antonio Calvo Morata #Comprueba el # de parametros if [ $# != 1 ] ; then echo "Uso: ./quien.sh fichero_de_passwd" 1>&2 exit 1 fi #Comprueba el fichero password if [ ! -f "$1" ] ; then echo "El fichero $1 no existe o no es regular." 1>&2 exit 2 fi #Bucle principal while [ true ] ; do echo -n "Introduzca el usuario (fin para acabar): " read user if [ "$user" = "fin" ] ; then echo "Gracias" exit 0 fi #Busca lineas que empiezen con el usuario y seguidas de : datos=$(grep -E "^$user:" $1) if [ $? != 0 ] ; then echo "El usuario $user no existe en $1." 1>&2 else #Muestra los diferentes campos pedidos en el ejercicio echo -e "Login: $user\t\tNombre: $(echo $datos | cut -d : -f 5)" echo -e "UID: $(echo $datos | cut -d : -f 3)\t\tGID: $(echo $datos | cut -d : -f 4)" echo -e "Home: $(echo $datos | cut -d : -f 6)\tShell: $(echo $datos | cut -d : -f 7)" fi done
true
0bc2f65605e897f87ee494526e440c52ce9295f9
Shell
lnadolski/tracy-3.5
/gnuplot/dynap_err_plt.sh
UTF-8
3,587
2.625
3
[]
no_license
#!/bin/sh prm1=${1-0} gnuplot << EOP ps = $prm1; phys_app = 0; f_s = 24; l_w = 2; if (ps == 0) \ set terminal x11; \ else if (ps == 1) \ set terminal postscript enhanced color solid lw l_w "Times-Roman" f_s; \ ext = "ps"; \ else if (ps == 2) \ set terminal postscript eps enhanced color solid lw l_w "Times-Roman" f_s; \ ext = "eps"; \ else if (ps == 3) \ set terminal pdf enhanced color solid lw l_w font "Times-Roman f_s"; \ ext = "pdf"; \ else if (ps == 4) \ set term pngcairo enhanced color solid lw l_w font "Times-Roman f_s"; \ ext = "png"; set grid; set style line 1 lt 1 lw 1 lc rgb "blue" ps 2 pt 1; set style line 2 lt 1 lw 1 lc rgb "green" ps 2 pt 1; set style line 3 lt 1 lw 1 lc rgb "red" ps 2 pt 1; # draw projection of mechanical aperture Ax = 17.5; Ay = 12.5; beta_max_y = 25.5; beta_inj_y = 3.1; if (phys_app) \ x_hat = Ax; y_hat = Ay*sqrt(beta_inj_y/beta_max_y); \ set arrow from -x_hat, 0.0 to -x_hat, y_hat nohead \ lt 1 lw 1 lc rgb "black"; \ set arrow from -x_hat, y_hat to x_hat, y_hat nohead \ lt 1 lw 1 lc rgb "black"; \ set arrow from x_hat, y_hat to x_hat, 0.0 nohead \ lt 1 lw 1 lc rgb "black"; if (ps) set output "dynap_err_1.".(ext); set title "Dynamic Aperture\n"; set xlabel "x [mm]"; set ylabel "y [mm]"; #set xrange [-20:20]; #set yrange [0:4]; plot "DA_bare_0.00.out" using 1:2 title "bare" with linespoints ls 1, \ "DA_real_0.00.out" using 1:2 notitle with points ls 3; if (!ps) pause mouse "click on graph to cont.\n"; unset arrow; if (ps) set output "dynap_err_2.".(ext); #set multiplot; #set size 1.0, 0.5; set origin 0.0, 0.5; set title "Horizontal Momentum Aperture\n"; set xlabel "{/Symbol d} [%]"; set ylabel "x^ [mm]"; set yrange [0:]; plot "DA_bare.out" using 1:5 title "bare" with linespoints ls 2, \ "DA_real.out" using 1:11:13 title "w errors" with errorbars ls 1, \ "DA_real.out" using 1:11 notitle with lines ls 1; if (!ps) pause mouse "click on graph to cont.\n"; if (ps) set output "dynap_err_3.".(ext); #set origin 0.0, 0.0; set title "Vertical Momentum Aperture\n"; set xlabel "{/Symbol d} [%]"; set ylabel "y^ [mm]"; set yrange [0:]; plot "DA_bare.out" using 1:6 title "bare" with linespoints ls 2, \ "DA_real.out" using 1:14:16 title "w errors" with errorbars ls 3, \ "DA_real.out" using 1:14 notitle with lines ls 3; #unset multiplot; if (!ps) pause mouse "click on graph to cont.\n"; unset output; # Workaround bug for multiplot. reset; set grid; set style line 1 lt 1 lw 1 lc rgb "blue" ps 2 pt 1; set style line 2 lt 1 lw 1 lc rgb "green" ps 2 pt 1; set style line 3 lt 1 lw 1 lc rgb "red" ps 2 pt 1; if (ps) set output "dynap_err_4.".(ext); #set multiplot; #set size 1.0, 0.5; set origin 0.0, 0.5; set title "Horizontal Momentum Acceptance\n"; set xlabel "{/Symbol d} [%]"; set ylabel "A_x [mm{/Symbol \327}mrad]"; set yrange [0:]; plot "DA_bare.out" using 1:3 title "bare" with linespoints ls 2, \ "DA_real.out" using 1:5:7 title "w errors" with errorbars ls 1, \ "DA_real.out" using 1:5 notitle with lines ls 1; if (!ps) pause mouse "click on graph to cont.\n"; if (ps) set output "dynap_err_5.".(ext); #set origin 0.0, 0.0; set title "Vertical Momentum Acceptance\n"; set xlabel "{/Symbol d} [%]"; set ylabel "A_y [mm{/Symbol \327}mrad]"; set yrange [0:]; plot "DA_bare.out" using 1:4 title "bare" with linespoints ls 2, \ "DA_real.out" using 1:8:10 title "w errors" with errorbars ls 3, \ "DA_real.out" using 1:8 notitle with lines ls 3; #unset multiplot; if (!ps) pause mouse "click on graph to cont.\n"; EOP
true
868108d40aca4138b44248fce37a2472c896dddc
Shell
DavidWittman/curbguide
/slack-notify.sh
UTF-8
530
3.765625
4
[]
no_license
#!/bin/bash set -e # Set this to your Slack webhook URL SLACK_WEBHOOK="" INTERVAL="${INTERVAL:-300}" log() { echo "[$(date '+%T')] $*" } while :; do log "Searching for available timeslot..." RESULT=$(pipenv run ./curbguide.py "$@") echo "$RESULT" COUNT=$(grep -c "N/A" <<<"$RESULT") if [[ "$COUNT" -lt 5 ]]; then log "Pickup found! Sending notification..." curl -s "$SLACK_WEBHOOK" --data-urlencode 'payload={"text": "```'"$RESULT"'```"}' > /dev/null fi sleep "$INTERVAL" done
true
19e98abf6476afed1c1900008cfbb6030d5f1efa
Shell
ericfortmeyer/student-assignment-scheduler
/build/pre-production-deploy.sh
UTF-8
147
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env sh REMOTE_HOST=$1 REMOTE_USER=$2 DIR="$(dirname $0)" BRANCH=staging source $DIR/deploy.sh deploy $REMOTE_HOST $REMOTE_USER $BRANCH
true
9887f077842975f133d4e361d7c208df3151af49
Shell
r2d4/go-starter
/rename.sh
UTF-8
954
2.9375
3
[ "Apache-2.0" ]
permissive
#!/bin/bash NEW_PROJECT=$1 COMPANY=$2 CURRENT_ORG=$(realpath --relative-to=$GOPATH/src $PWD) OLD_ORG=github.com/r2d4/go-starter OLD_PROJECT=go-starter mv cmd/$OLD_PROJECT cmd/$NEW_PROJECT mv pkg/$OLD_PROJECT pkg/$NEW_PROJECT find . -name $OLD_PROJECT.go -type f | sed -e "p;s/$OLD_PROJECT/$NEW_PROJECT/" | xargs -n2 mv # find . -name $OLD_PROJECT -type d | sed -e "p;s/$OLD_PROJECT/$NEW_PROJECT/" | xargs -n2 mv find . -type f ! -name rename.sh -exec \ sed -i 's/COMPANY LLC/$COMPANY/g' {} + find . -type f ! -name rename.sh -exec \ sed -i 's/$OLD_PROJECT/$NEW_PROJECT/g' {} + go get github.com/r2d4/fiximports fiximports -new-import '$(CURRENT_ORG)$1' -old-import '$(OLD_ORG)' -regex . fiximports -new-import '$(CURRENT_ORG)/cmd/$1' -old-import '$OLD_ORG/cmd' -regex . fiximports -new-import '$(CURRENT_ORG)/pkg/$1' -old-import '$OLD_ORG/pkg' -regex . find . -type f ! -name rename.sh -exec \ sed -i 's/$OLD_ORG/$NEW_ORG/g' {} +
true
8802ff8b7af945f0442f4ee985c4c818b1ec0243
Shell
masayukist/sad_scripts
/useradd.sh
UTF-8
1,894
3.671875
4
[]
no_license
#!/bin/sh +x . ./config.sh UID_NUMBER=`./include/nextid.sh` echo User ID will be set to $UID_NUMBER GID_NUMBER=${START_GID} echo -n "${0}: login name? " read USERNAME STDOUT=`id ${USERNAME} 2>&1` if [ ${?} = 0 ]; then echo Username ${USERNAME} is already used. Please specify another username. exit 1 fi echo -n "${0}: sur(family) name? " read SUR_NAME echo -n "${0}: given(first) name? " read GIVEN_NAME echo -n "${0}: mail address? " read MAIL PASSWORD=`./include/passgen.sh` DESC_NAME="${GIVEN_NAME} ${SUR_NAME}" echo ----------------- echo New User: $USERNAME echo Full Name: $GIVEN_NAME $SUR_NAME echo User ID: $UID_NUMBER echo Initial password is ${PASSWORD} echo ----------------- . ./include/confirm.sh samba-tool user create ${USERNAME} ${PASSWORD} \ --must-change-at-next-login \ --surname="${SUR_NAME}" \ --given-name="${GIVEN_NAME}" \ --description="${GIVEN_NAME} ${SUR_NAME}" \ --mail-address=$MAIL \ --nis-domain="${DOMAIN}" \ --uid=${USERNAME} \ --uid-number=${UID_NUMBER} \ --gid-number=${GID_NUMBER} \ --login-shell=/bin/bash \ --unix-home=${HOME_DIR_BASE}/${USERNAME} if test $? -ne 0 then echo E-mail is not sent. exit fi eval "echo \"`cat templates/pass_gen_mail.txt`\"" > useradd_mail.tmp.txt export LC_CTYPE=ja_JP.UTF-8 cat useradd_mail.tmp.txt | mailx -s "${MAIL_TITLE}" -r ${MAIL_FROM} -b ${MAIL_BCC} ${MAIL} rm useradd_mail.tmp.txt #confirm the account #while : #do # id ${USERNAME} # if [ $? -eq 0 ]; then # echo ${USERNAME}\'s authentication information is updated. # break # fi # echo waiting the update of ${USERNAME}\'s authentication information ... retry after 5 seconds # sleep 5 #done #set expiry echo "This user account will be expired in ${EXPIRE_DAYS} days." samba-tool user setexpiry --days=${EXPIRE_DAYS} ${USERNAME} for x in ./useradd.d/*.sh do . ${x} done
true
01342ce6b162ebef9b253b4c92d53f34d6341517
Shell
jukylin/cilium
/tests/11-getting-started.sh
UTF-8
4,703
3.59375
4
[ "GPL-1.0-or-later", "Apache-2.0" ]
permissive
#!/bin/bash dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) source "${dir}/helpers.bash" # dir might have been overwritten by helpers.bash dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) TEST_NAME=$(get_filename_without_extension $0) LOGS_DIR="${dir}/cilium-files/${TEST_NAME}/logs" redirect_debug_logs ${LOGS_DIR} set -ex log "${TEST_NAME} has been deprecated and replaced by /test/runtime/Policies.go:L3/L4 Checks, L7 Checks" exit 0 DEMO_CONTAINER="cilium/demo-client" HTTPD_CONTAINER_NAME="service1-instance1" ID_SERVICE1="id.service1" ID_SERVICE2="id.service2" function cleanup { log "beginning cleanup for ${TEST_NAME}" log "deleting all policies" cilium policy delete --all 2> /dev/null || true log "removing container ${HTTPD_CONTAINER_NAME}" docker rm -f ${HTTPD_CONTAINER_NAME} 2> /dev/null || true log "removing Docker network ${TEST_NET}" remove_cilium_docker_network monitor_stop log "finished cleanup for ${TEST_NAME}" } function finish_test { log "finishing up ${TEST_NAME}" gather_files ${TEST_NAME} ${TEST_SUITE} cleanup log "done finishing up ${TEST_NAME}" } trap finish_test EXIT cleanup monitor_start logs_clear log "checking cilium status" cilium status create_cilium_docker_network log "starting example service with Docker" docker run -d --name ${HTTPD_CONTAINER_NAME} --net ${TEST_NET} -l "${ID_SERVICE1}" cilium/demo-httpd log "importing l3_l4_policy.json" cat <<EOF | policy_import_and_wait - [{ "endpointSelector": {"matchLabels":{"${ID_SERVICE1}":""}}, "ingress": [{ "fromEndpoints": [ {"matchLabels":{"${ID_SERVICE2}":""}} ], "toPorts": [{ "ports": [{"port": "80", "protocol": "tcp"}] }] }] }] EOF monitor_clear log "pinging service1 from service3" docker run --rm -i --net ${TEST_NET} -l "id.service3" --cap-add NET_ADMIN ${DEMO_CONTAINER} ping -c 10 ${HTTPD_CONTAINER_NAME} && { abort "Error: Unexpected success pinging ${HTTPD_CONTAINER_NAME} from service3" } monitor_clear log "pinging service1 from service2" docker run --rm -i --net ${TEST_NET} -l "${ID_SERVICE2}" --cap-add NET_ADMIN ${DEMO_CONTAINER} ping -c 10 ${HTTPD_CONTAINER_NAME} && { abort "Error: Unexpected success pinging ${HTTPD_CONTAINER_NAME} from service2" } monitor_clear log "performing HTTP GET on ${HTTPD_CONTAINER_NAME}/public from service2 (expected: 200)" RETURN=$(docker run --rm -i --net ${TEST_NET} -l "${ID_SERVICE2}" ${DEMO_CONTAINER} /bin/bash -c "curl -s --output /dev/stderr -w '%{http_code}' -XGET http://${HTTPD_CONTAINER_NAME}/public") if [[ "${RETURN//$'\n'}" != "200" ]]; then abort "Error: Could not reach ${HTTPD_CONTAINER_NAME}/public on port 80" fi monitor_clear log "performing HTTP GET on ${HTTPD_CONTAINER_NAME}/private from service2 (expected: 200)" RETURN=$(docker run --rm -i --net ${TEST_NET} -l "${ID_SERVICE2}" ${DEMO_CONTAINER} /bin/bash -c "curl -s --output /dev/stderr -w '%{http_code}' -XGET http://${HTTPD_CONTAINER_NAME}/private") if [[ "${RETURN//$'\n'}" != "200" ]]; then abort "Error: Could not reach ${HTTPD_CONTAINER_NAME}/private on port 80" fi log "importing l7_aware_policy.json" cilium policy delete --all cat <<EOF | policy_import_and_wait - [{ "endpointSelector": {"matchLabels":{"${ID_SERVICE1}":""}}, "ingress": [{ "fromEndpoints": [ {"matchLabels":{"${ID_SERVICE2}":""}}, {"matchLabels":{"reserved:host":""}} ] }] },{ "endpointSelector": {"matchLabels":{"${ID_SERVICE2}":""}}, "egress": [{ "toPorts": [{ "ports": [{"port": "80", "protocol": "tcp"}], "rules": { "HTTP": [{ "method": "GET", "path": "/public" }] } }] }] }] EOF monitor_clear log "performing HTTP GET on ${HTTPD_CONTAINER_NAME}/public from service2 (expected: 200)" RETURN=$(docker run --rm -i --net ${TEST_NET} -l "${ID_SERVICE2}" ${DEMO_CONTAINER} /bin/bash -c "curl -s --output /dev/stderr -w '%{http_code}' -XGET http://${HTTPD_CONTAINER_NAME}/public") if [[ "${RETURN//$'\n'}" != "200" ]]; then abort "Error: Could not reach ${HTTPD_CONTAINER_NAME}/public on port 80" fi monitor_clear log "performing HTTP GET on ${HTTPD_CONTAINER_NAME}/private from service2 (expected: 403)" RETURN=$(docker run --rm -i --net ${TEST_NET} -l "${ID_SERVICE2}" ${DEMO_CONTAINER} /bin/bash -c "curl -s --output /dev/stderr -w '%{http_code}' --connect-timeout 15 -XGET http://${HTTPD_CONTAINER_NAME}/private") # FIXME: re-renable when redirect issue is resolved #if [[ "${RETURN//$'\n'}" != "403" ]]; then # abort "Error: Unexpected success reaching ${HTTPD_CONTAINER_NAME}/private on port 80" #fi log "deleting all policies in Cilium" cilium policy delete --all test_succeeded "${TEST_NAME}"
true