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 |
---|---|---|---|---|---|---|---|---|---|---|---|
e6f64d07cc6373864c9f481b2c1a6ce93c9fe280
|
Shell
|
sybond/MiSphere-hack
|
/firmware/usr/local/share/script/load.sh
|
UTF-8
| 1,585 | 3.328125 | 3 |
[] |
no_license
|
#!/bin/sh
if [ ! -e /tmp/wifi.preloaded ]; then
/usr/local/share/script/preload.sh
fi
rm -f /tmp/wifi.preloaded
KO=bcmdhd.ko
# BCM will get name by configure.
BCM=bcmdhd
P_FW="firmware_path=/usr/local/${BCM}/fw"
P_NVRAM="nvram_path=/usr/local/${BCM}/nvram.txt"
P_IF="iface_name=wlan"
P_DBG="dhd_msg_level=0x00"
load_mod()
{
# mac=`cat /tmp/wifi0_mac`
# if [ "${mac}" != "00:00:00:00:00:00" ] && [ "${mac}" != "" ]; then
# insmod /lib/modules/${KO} ${P_FW}_apsta.bin ${P_NVRAM} ${P_IF} ${P_DBG} $1 amba_initmac=${mac}
# else
insmod /lib/modules/${KO} ${P_FW}_apsta.bin ${P_NVRAM} ${P_IF} ${P_DBG} $1
# fi
}
case $1 in
sta)
load_mod op_mode=1
;;
p2p)
load_mod op_mode=1
;;
*)
# Set as AP
load_mod op_mode=2
;;
esac
# Needed for App.
touch /tmp/wifi.loaded
# Disable WiFi CPU offloading
if [ -e /sys/module/bcmdhd/parameters/tx_coll_max_time ] && [ -e /proc/ambarella/clock ]; then
gclk_cortex=`cat /proc/ambarella/clock | grep gclk_cortex|awk '{print $2}'`
if [ "${gclk_cortex}" != "" ] && [ ${gclk_cortex} -gt 504000000 ]; then
echo 0 > /sys/module/bcmdhd/parameters/tx_coll_max_time
fi
fi
#fix A9S bcm43340 SDIO command 53 timeout issue
if [ `grep gclk_sdio /proc/ambarella/clock|awk '{print $2}'` -ge 44000000 ] && \
[ "`zcat /proc/config.gz | grep CONFIG_PLAT_AMBARELLA_S2E=y`" != "" ] && \
[ -e /sys/module/bcmdhd/parameters/info_string ] && \
[ "`grep 1.88.45.11 /sys/module/bcmdhd/parameters/info_string`" != "" ] && \
[ "`grep a94c /sys/module/bcmdhd/parameters/info_string`" != "" ]; then
echo 43636363 > /sys/kernel/debug/mmc0/clock
fi
| true |
c3c21999c2bb3967de1422908e02771495adc351
|
Shell
|
diegoep/field-workshops-terraform
|
/instruqt-tracks/sentinel-for-terraform-v1/exercise-4/check-sentinel
|
UTF-8
| 1,702 | 3.09375 | 3 |
[] |
no_license
|
#!/bin/sh -l
set -e
grep -q "google_compute_instance" restrict-gcp-instance-image.sentinel || fail-message "You have not replaced '<data_source_type>' with 'google_compute_instance' yet."
grep -qL "<expression_1>" restrict-gcp-instance-image.sentinel && fail-message "You have not replaced '<expression_1>' yet."
grep -q "r.applied.boot_disk\[0\].initialize_params\[0\].image" restrict-gcp-instance-image.sentinel || fail-message "You have not replaced '<expression_1>' with 'r.applied.boot_disk[0].initialize_params[0].image' yet."
grep -qL "<expression_2>" restrict-gcp-instance-image.sentinel && fail-message "You have not replaced '<expression_2>' yet."
grep -q "debian-cloud/debian-9" restrict-gcp-instance-image.sentinel || fail-message "You have not replaced '<expression_2>' with 'debian-cloud/debian-9' yet."
grep -qL "<add_validation_function_call>" restrict-gcp-instance-image.sentinel && fail-message "You have not replaced '<add_validation_function_call>' yet. You should call the 'validate_images' function and assign the result to a boolean variable."
grep -qL "<add_main_rule>" restrict-gcp-instance-image.sentinel && fail-message "You have not replaced '<add_main_rule>' yet. You should define a main rule that evaluates a boolean variable."
grep -q "sentinel test -run=gcp -verbose" /root/.bash_history || grep -q "sentinel test -run=gcp" /root/.bash_history || fail-message "You haven't tested the restrict-gcp-instance-image.sentinel policy against the test cases yet. Please run 'sentinel test -run=acm -verbose'"
sentinel test -run=gcp
rc=$?
if [ $rc -ne 0 ]; then
fail-message "Your policy did not pass both test cases. Please revise and test it again."
fi
exit 0
| true |
48a9069ec31677889f8f3e44c13d980ad26226ee
|
Shell
|
rbrecheisen/scripts
|
/imagemend/misc/nii_to_txt.sh
|
UTF-8
| 610 | 3.203125 | 3 |
[] |
no_license
|
#!/bin/bash
subj_f="/data/raw_data/imagemend/uio/smri/subjects.csv"
subj_d="/data/raw_data/imagemend/uio/smri/raw"
file_1="swc1nu.nii"
file_2="swc2nu.nii"
rm -f runner; touch runner; chmod a+x runner
echo "if [[ \${1} == \\#* ]]; then" >> runner
echo " exit 1" >> runner
echo "fi" >> runner
echo "echo \"Exporting voxels for subject \${1}\"" >> runner
echo "fslmeants -i ${subj_d}/\${1}/${file_1} -o ${subj_d}/\${1}/${file_1}.txt --showall" >> runner
echo "fslmeants -i ${subj_d}/\${1}/${file_2} -o ${subj_d}/\${1}/${file_2}.txt --showall" >> runner
parallel -a ${subj_f} ./runner
rm -f runner
echo "Done"
| true |
68e921fd598bd8572f95091a468d335b647db126
|
Shell
|
msimerson/Mail-Toaster-6
|
/provision/smf.sh
|
UTF-8
| 2,521 | 3.15625 | 3 |
[] |
permissive
|
#!/bin/sh
. mail-toaster.sh || exit
export JAIL_START_EXTRA=""
export JAIL_CONF_EXTRA=""
mt6-include php
mt6-include nginx
SMF_VER=2.1.4
install_smf()
{
install_nginx
install_php 81 "filter gd mysqli pdo_mysql session zlib"
if [ ! -d "$STAGE_MNT/usr/local/www" ]; then
mkdir -p "$STAGE_MNT/usr/local/www" || exit
fi
fetch -m -o "$STAGE_MNT/data/smf.tar.gz" \
https://github.com/SimpleMachines/SMF/archive/refs/tags/v$SMF_VER.tar.gz || exit
stage_exec sh -c 'cd /usr/local/www; tar -xzf /data/smf.tar.gz' || exit
stage_exec sh -c "cd /usr/local/www && mv SMF-$SMF_VER smf" || exit
for _f in attachments avatars cache Packages Packages/installed.list Smileys Themes agreement.txt Settings.php Settings_bak.php; do
if [ -e "$STAGE_MNT/usr/local/www/smf/$_f" ]; then
chown www:www "$STAGE_MNT/usr/local/www/smf/$_f" || exit
fi
done
stage_pkg_install aspell
}
configure_nginx_server()
{
_NGINX_SERVER='
server_name smf;
location /smf/images/custom_avatars/ {
alias /data/custom_avatars/;
index index.php;
expires max;
try_files $uri =404;
}
location ~ ^/smf/(.+\.php)(/.*)?$ {
alias /usr/local/www/smf;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$1;
fastcgi_param PATH_INFO $2;
}
location /smf/ {
alias /usr/local/www/smf/;
index index.php;
try_files $uri $uri/ =404;
}
'
export _NGINX_SERVER
configure_nginx_server_d smf
}
configure_smf()
{
configure_php smf
configure_nginx smf
configure_nginx_server
if [ -f "$ZFS_DATA_MNT/smf/Settings.php" ]; then
tell_status "preserving Settings.php"
cp "$ZFS_DATA_MNT/smf/Settings.php" "$STAGE_MNT/usr/local/www/smf/" || exit
elif [ -f "$ZFS_JAIL_MNT/smf/usr/local/www/smf/Settings.php" ]; then
preserve_file smf /usr/local/www/smf/Settings.php
else
tell_status "installing sample Settings.php"
cp "$STAGE_MNT/usr/local/www/smf/other/Settings.php" "$STAGE_MNT/usr/local/www/smf/" || exit
tell_status "post-install configuration will be required"
sed -i '' \
-e "/boardurl/ s/127.0.0.2/$TOASTER_HOSTNAME/" \
-e "/db_server/ s/localhost/mysql/" \
"$STAGE_MNT/usr/local/www/smf/Settings.php"
fi
}
start_smf()
{
start_php_fpm
start_nginx
}
test_smf()
{
test_php_fpm
test_nginx
echo "it worked"
}
base_snapshot_exists || exit
create_staged_fs smf
start_staged_jail smf
install_smf
configure_smf
start_smf
test_smf
promote_staged_jail smf
| true |
98edba5bed5706492887df1dbd8d28c49694616b
|
Shell
|
egocampo/bashLinux
|
/divisor
|
UTF-8
| 869 | 3.265625 | 3 |
[] |
no_license
|
#!/bin/bash
#
contador=0
#
# LA PRIMER DECLARACION AL LLAMAR LA FUNCION ES EL NOMBRE DEL ARCHIVO ORIGINAL
nombre=$1
#
# LA SEGUNDA DECLARACION INDICA EN GRUPOS DE CUANTAS HOJAS SEPARAR
separaren=$2
#
# CON SED BORRO EL .PDF PARA EL ARHIVO DE SALIDA
salida=$(echo $nombre | sed 's/.pdf//g')
#
# CUENTO CUANTAS PAGINAS TIENE EL ARCHIVO
cpag=$(pdftk $nombre dump_data | awk '/NumberOfPages/{print $2}')
#
# DEFINO HASTA DONDE VA A CONTAR EL SEPARADOR PRINCIPAL
let hasta=$cpag/separaren
#
#
while [ $contador -lt $hasta ]; do
let inicial=separaren*$contador+1
let aux=$contador+1
let final=separaren*$aux
pdftk $nombre cat $inicial-$final output $salida$contador.pdf
let contador=contador+1
done
#
# JUNTO LAS HOJAS QUE RESTARON
let aux2=separaren*$hasta
let inicial2=$aux2+1
let final2=$cpag
pdftk $nombre cat $inicial2-$final2 output $salida$contador.pdf
| true |
a7bb7fe6bb9cd655a0e0ac5f29121328667f5e2c
|
Shell
|
ClickHouse/ClickHouse
|
/tests/queries/0_stateless/01164_detach_attach_partition_race.sh
|
UTF-8
| 1,465 | 3.046875 | 3 |
[
"BSL-1.0",
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
# Tags: race
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT -q "drop table if exists mt"
$CLICKHOUSE_CLIENT -q "create table mt (n int) engine=MergeTree order by n settings parts_to_throw_insert=5000"
$CLICKHOUSE_CLIENT -q "insert into mt values (1)"
$CLICKHOUSE_CLIENT -q "insert into mt values (2)"
$CLICKHOUSE_CLIENT -q "insert into mt values (3)"
function thread_insert()
{
local TIMELIMIT=$((SECONDS+$1))
while [ $SECONDS -lt "$TIMELIMIT" ]; do
$CLICKHOUSE_CLIENT -q "insert into mt values (rand())";
done
}
function thread_detach_attach()
{
local TIMELIMIT=$((SECONDS+$1))
while [ $SECONDS -lt "$TIMELIMIT" ]; do
$CLICKHOUSE_CLIENT -q "alter table mt detach partition id 'all'";
$CLICKHOUSE_CLIENT -q "alter table mt attach partition id 'all'";
done
}
function thread_drop_detached()
{
local TIMELIMIT=$((SECONDS+$1))
while [ $SECONDS -lt "$TIMELIMIT" ]; do
$CLICKHOUSE_CLIENT --allow_drop_detached 1 -q "alter table mt drop detached partition id 'all'";
done
}
export -f thread_insert;
export -f thread_detach_attach;
export -f thread_drop_detached;
TIMEOUT=10
thread_insert $TIMEOUT &
thread_detach_attach $TIMEOUT 2> /dev/null &
thread_detach_attach $TIMEOUT 2> /dev/null &
thread_drop_detached $TIMEOUT 2> /dev/null &
wait
$CLICKHOUSE_CLIENT -q "drop table mt"
| true |
3818f08baa808e268d5d6ce75c05e13926e5f9df
|
Shell
|
adkozlov/parsing-2013-lab_03
|
/run.sh
|
UTF-8
| 328 | 3.15625 | 3 |
[] |
no_license
|
#!/bin/bash
cd tests
for haskellfile in `ls | grep -e ".hs"`; do
filename=${haskellfile%.*}
ghc ${haskellfile}
echo "haskell out:"
./${filename}
echo "java out:"
javafile="Translated_"${filename}".java"
javac $javafile
java ${javafile%.*}
ls | grep -v 'java\|hs$' | xargs rm
done
cd ..
| true |
c333a53de9bf0b8055d0568a34cffee7b9d26686
|
Shell
|
Vinotha16/WIN_ROLLBACK
|
/templates/linux_actualfacts/centos6/imap_2210_actual.fact
|
UTF-8
| 186 | 2.8125 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
cmd=$(rpm -q dovecot)
if [ $(sudo rpm -qa dovecot | wc -l) -ne 0 ]; then
echo "{ \"imap_2210_actual\" : \"\" }"
else
echo "{ \"imap_2210_actual\" : \"$cmd\" }"
exit 1
fi
| true |
8c5bc3a4ceeea359048dbae288b6bf40885063de
|
Shell
|
AnthonyAstige/.dotfiles
|
/.fzf.bash
|
UTF-8
| 2,211 | 3.28125 | 3 |
[] |
no_license
|
# https://github.com/BurntSushi/ripgrep/issues/169#issuecomment-312450875
# https://github.com/BurntSushi/ripgrep/issues/169#issuecomment-333229762
if [[ $(uname) == "Darwin" ]]; then
# dirname on OS X behaves funky, get gdirname via
# brew install coreutils
export dirname_command="gdirname"
else
export dirname_command="dirname"
fi
# My config
# --files: List files that would be searched but do not search
# --hidden: Search hidden files and folders
# `git rev-parse --show-toplevel` : Search git repository always
# --follow: Follow symlinks
export FZF_DEFAULT_COMMAND='rg `git rev-parse --show-toplevel` --ignore-file ~/.bi-rg-ignore --files --hidden --follow'
export FZF_ALT_C_COMMAND='rg `git rev-parse --show-toplevel` --ignore-file ~/.bi-rg-ignore --files --hidden --follow --null --sort-files | xargs -0 $dirname_command | sort -u'
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND
# export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND --null 2> /dev/null | xargs -0 dirname | uniq"
# https://github.com/BurntSushi/ripgrep/issues/169#issuecomment-333229762
if [[ $(uname) == "Darwin" ]]; then
# dirname on OS X behaves funky, get gdirname via
# brew install coreutils
export dirname_command="gdirname"
else
export dirname_command="dirname"
fi
_fzf_compgen_dir() {
rg --hidden --files --ignore-file ~/.bi-rg-ignore --null "$1" 2>/dev/null | xargs -0 "$dirname_command" | awk '!h[$0]++'
}
# Preview commentes:
# * Don't parse binary
# * Remove extra info if there from oneliner searchers, colorize if possible otherwise simple
# * Keep some extra chars in case color signifiers?
export FZF_DEFAULT_OPTS="--preview "\
"'[[ \$(file --mime {}) =~ binary ]] && "\
"echo {} is binary || "\
"(rougify \$( cut -d ':' -f 1 <<< "{}" ) || cat \$( cut -d ':' -f 1 <<< "{}" )) 2> /dev/null "\
"| head -500' "\
"--height 80% "\
"--bind ctrl-f:page-down,ctrl-b:page-up"
# Basics setup fzf
# ---------
if [[ ! "$PATH" == *~/.fzf/bin* ]]; then
export PATH="$PATH:~/.fzf/bin"
fi
# Auto-completion
# ---------------
source ~/.fzf/shell/completion.bash
# Key bindings
# ------------
# declare -x FZF_ALT_C_COMMAND="cd ~/; bfs -type d -nohidden | sed 's/^\\./\\/Users\\/anthony\\//'"
source ~/.fzf-key-bindings.bash
| true |
8fb2dae62efacefd7f214accab2dc02657686199
|
Shell
|
danielrobertomendes/trabalho-shell-01
|
/configura_rede.sh
|
UTF-8
| 702 | 2.96875 | 3 |
[] |
no_license
|
#!/bin/bash
# Escrito por Daniel Mendes e Franklin Moraes.
# Serve para ativar o dhcp na placa de rede designada e modificar o nome do computador.
# Interage com o usuário solicitando o nome da interface de rede.
echo "Qual o nome da sua interface de rede?"
# Efetue a leitura da informação passada pelo usuário.
read interface
# Força o uso do DHCP na interface informada.
sudo dhclient $interface
# Espaçamento.
echo ""
# Interage com o usuário solicitando o nome para o computador rede.
echo "Digite seu nome_sobrenome para renomear o computador:"
# Efetue a leitura da informação passada pelo usuário.
read nome
# Uso da informação passada para atualizar nome do computador.
sudo hostname $nome
| true |
382ad4e49ce2b3b1079ce685d64ce42f01a63b91
|
Shell
|
townie/install-scripts
|
/install_java.sh
|
UTF-8
| 1,129 | 3.078125 | 3 |
[] |
no_license
|
#!/bin/bash
if [ ! "`java -version > /dev/null 2>&1 | grep jdk1.7.0_45`" ] ;then
if [ ! -d /usr/lib/jvm ];then mkdir /usr/lib/jvm;fi
wget -qNO /tmp/jdk-jdk1.7.0_45-linux-x64.tar.gz https://s3.amazonaws.com/backupify-packages/jdk-1.7.0_45-linux-x64.tar.gz
tar -xzf /tmp/jdk-jdk1.7.0_45-linux-x64.tar.gz -C /usr/lib/jvm
if [ "`update-alternatives --list java | grep java`" ];then
update-alternatives --remove-all java
update-alternatives --remove-all javac
update-alternatives --remove-all javaws
update-alternatives --remove-all jconsole
fi
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_45/bin/javaws" 1
update-alternatives --install "/usr/bin/jconsole" "jconsole" "/usr/lib/jvm/jdk1.7.0_45/bin/jconsole" 1
update-alternatives --install "/usr/bin/jstat" "jstat" "/usr/lib/jvm/jdk1.7.0_45/bin/jstat" 1
update-alternatives --install "/usr/bin/jmap" "jmap" "/usr/lib/jvm/jdk1.7.0_45/bin/jmap" 1
fi
| true |
c34cd80ed18f269ea689a64dead027d6678097ec
|
Shell
|
ttsui/bin
|
/gnome-backgrounds-xmlgen.sh
|
UTF-8
| 2,228 | 3.828125 | 4 |
[] |
no_license
|
#!/bin/bash
# gnome-backgrounds-xmlgen.sh
#
# usage:./gnome-backgrounds-xmlgen.sh background_dir_1 background_dir_2
# background_dir_3
#
# description: simply generate a backgrounds xml that can be consumed by
# gnome's background configuration
#
# author: ubuntuforums.org username 'ozhoo'
#
# note: only looks for .JPG and .jpg files
# output file
FILENAME=backgrounds.xml
# start time
YEAR=2009
MONTH=08
DAY=01
HOUR=00
MINUTE=00
SECOND=00
# time to show background (seconds)
WALLDURATION=900.0
# transition time (seconds)
TRANSDURATION=5.0
# script specifics
DIRS=$*
T1="echo -e \t"
T2="echo -e \t\t"
echo "<background>" > "$FILENAME"
${T1}"<starttime>" >> "$FILENAME"
${T2}"<year>${YEAR}</year>" >> "$FILENAME"
${T2}"<month>${MONTH}</month>" >> "$FILENAME"
${T2}"<day>${DAY}</day>" >> "$FILENAME"
${T2}"<hour>${HOUR}</hour>" >> "$FILENAME"
${T2}"<minute>${MINUTE}</minute>" >> "$FILENAME"
${T2}"<second>${SECOND}</second>" >> "$FILENAME"
${T1}"</starttime>" >> "$FILENAME"
get_first()
{
for d in $DIRS; do
find "$d"|grep -i .jpg|while read j; do
echo "$j"
break
done
break
done
}
FIRST="$(get_first)"
${T1}"<static>" >> "$FILENAME"
${T2}"<duration>${WALLDURATION}</duration>" >> "$FILENAME"
${T2}"<file>${FIRST}</file>" >> "$FILENAME"
${T1}"</static>" >> "$FILENAME"
${T1}"<transition>" >> "$FILENAME"
${T2}"<duration>${TRANSDURATION}</duration>" >> "$FILENAME"
${T2}"<from>${FIRST}</from>" >> "$FILENAME"
for d in $DIRS; do
find "$d"|grep -i .jpg|while read j; do
if [ "$j" == "$FIRST" ]; then
continue
else
${T2}"<to>${j}</to>" >> "$FILENAME"
${T1}"</transition>" >> "$FILENAME"
${T1}"<static>" >> "$FILENAME"
${T2}"<duration>${WALLDURATION}</duration>" >> "$FILENAME"
${T2}"<file>${j}</file>" >> "$FILENAME"
${T1}"</static>" >> "$FILENAME"
${T1}"<transition>" >> "$FILENAME"
${T2}"<duration>${TRANSDURATION}</duration>" >> "$FILENAME"
${T2}"<from>${j}</from>" >> "$FILENAME"
fi
done
done
${T2}"<to>${FIRST}</to>" >> "$FILENAME"
${T1}"</transition>" >> "$FILENAME"
echo "</background>" >> "$FILENAME"
| true |
fb1ee077c531c84138399f22963867ff665825a8
|
Shell
|
johnae/dotfiles
|
/home/.profile.d/004_ruby_extensions.sh
|
UTF-8
| 1,576 | 3.015625 | 3 |
[] |
no_license
|
## rbenv
if which rbenv > /dev/null; then eval "$(rbenv init - --no-rehash $RUNNING_SHELL)"; fi
DEFAULT_JRUBY_OPTS="--1.9 -J-noverify -Xcompile.invokedynamic=false -J-Dfile.encoding=UTF8 -J-Xms512m -J-Xmx2048m"
## use 32-bit client for much faster startup - see 64-bit below about how it can be just as fast
jruby_32bit()
{
export JRUBY_OPTS="$DEFAULT_JRUBY_OPTS -J-d32 --client"
}
## this uses the 64-bit version - the opts passed seem to be just as good as using 32-bits client version
jruby_64bit()
{
export JRUBY_OPTS="$DEFAULT_JRUBY_OPTS -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-XX:+UseCompressedOops --server"
}
jruby_use_drip()
{
export JAVACMD=`which drip`
export DRIP_INIT_CLASS=org.jruby.main.DripMain
}
set_jruby_home()
{
JRUBY_PATH=$(dirname $(dirname `which jruby`))
#JRUBY_PATH="$HOME/.rbenv/versions/$RBENV_VERSION"
REALPATH=`readlink -n $JRUBY_PATH`
if [ -z "$REALPATH" ]; then
REALPATH=$JRUBY_PATH
fi
export JRUBY_HOME=$REALPATH
}
## let's default to the 32-bit version for faster development/spec/whatever times
## nope, we CAN use the 64-bit version and get startup as fast as 32-bit
jruby_64bit
set_torquebox_ruby()
{
export PATH=`echo $PATH | sed -E 's/^\/.*rbenv\/shims:?//g'`
export TORQUEBOX_HOME=~/Local/torquebox/torquebox
export JBOSS_HOME=$TORQUEBOX_HOME/jboss
export JRUBY_HOME=$TORQUEBOX_HOME/jruby
export PATH=$JRUBY_HOME/bin:$PATH
}
alias r="rails"
alias rs="rails s thin"
alias b="bundle"
alias be="b exec"
alias bi="b install"
alias bu="b update"
alias spec="be rspec --tty -f d spec/"
| true |
dbf1535d2bb77509f5fc96c48d247347efe40f6c
|
Shell
|
SimformSolutionsPvtLtd/DevOps
|
/Software-installtion-scripts/phpinstall-ubuntu.sh
|
UTF-8
| 802 | 3.484375 | 3 |
[] |
no_license
|
#!/bin/bash
echo "Do you want to install php ? yes or no"
read x
if [[ "${x}" = "yes" ]]
then
read -p "Enter PHP Version : " version
echo
echo "Entered PHP version is - $version"
echo "=================================="
sudo apt-get update -y
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php$version
sudo apt install php$version-bcmath -y
sudo apt install php$version-fpm -y
sudo apt-get install php$version-mbstring
sudo apt install php$version-common php$version-mysql php$version-xml php$version-xmlrpc php$version-curl php$version-gd php$version-imagick php$version-cli php$version-dev php$version-imap php$version
sudo update-alternatives --config php
else
echo "php installation option is not chosen"
fi
| true |
664e7296a1d44c31d1ed571155a3fdad8a10f5b0
|
Shell
|
hypoport/webhook
|
/trigger-teamcity-build.sh
|
UTF-8
| 418 | 3.078125 | 3 |
[
"MIT"
] |
permissive
|
#!/bin/sh
REPO="$1"
TAG="$2"
BUILD_TYPE_ID="$3"
TEAMCITY_BASE_URL="http://teamcity.hypoport.local/teamCity"
if [[ "$#" -eq 1 ]]
then
REPO=$(echo $1 | cut -d\ -f1)
TAG=$(echo $1 | cut -d\ -f2)
BUILD_TYPE_ID=$(echo $1 | cut -d\ -f3)
fi
eval "echo \"$(cat ./teamcity_build.xml.tmpl)\"" | curl -X POST "${TEAMCITY_BASE_URL}/guestAuth/app/rest/buildQueue" \
-H "Content-Type: application/xml" \
-d @-
| true |
bb724ad78ecadd55bc01665c0cfbd933c3c137aa
|
Shell
|
franciscofranco/ramdisks
|
/anykernel.sh
|
UTF-8
| 2,628 | 2.515625 | 3 |
[] |
no_license
|
# AnyKernel2 Ramdisk Mod Script
# osm0sis @ xda-developers
## AnyKernel setup
# begin properties
properties() {
kernel.string=Franco Kernel by franciscofranco @ xda-developers
do.devicecheck=1
do.modules=0
do.cleanup=1
do.cleanuponabort=1
device.name1=angler
} # end properties
# shell variables
block=/dev/block/platform/soc.0/f9824900.sdhci/by-name/boot;
is_slot_device=0;
ramdisk_compression=auto;
## AnyKernel methods (DO NOT CHANGE)
# import patching functions/variables - see for reference
. /tmp/anykernel/tools/ak2-core.sh;
## AnyKernel file attributes
# set permissions/ownership for included ramdisk files
chmod -R 750 $ramdisk/*;
chown -R root:root $ramdisk/*;
## AnyKernel install
dump_boot;
# begin ramdisk changes
# fstab.angler
insert_line fstab.angler "data f2fs" after "data ext4" "/dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata /data f2fs rw,nosuid,nodev,noatime,nodiratime,inline_xattr wait,formattable,encryptable=/dev/block/platform/soc.0/f9824900.sdhci/by-name/metadata";
insert_line fstab.angler "cache f2fs" after "cache ext4" "/dev/block/platform/soc.0/f9824900.sdhci/by-name/cache /cache f2fs rw,nosuid,nodev,noatime,nodiratime,inline_xattr wait,check,formattable";
patch_fstab fstab.angler none swap flags "zramsize=533413200" "zramsize=1066826400";
patch_fstab fstab.angler /system ext4 flags "wait,verify=/dev/block/platform/soc.0/f9824900.sdhci/by-name/metadata" "wait";
patch_fstab fstab.angler /vendor ext4 flags "wait,verify=/dev/block/platform/soc.0/f9824900.sdhci/by-name/metadata" "wait";
patch_fstab fstab.angler /data ext4 flags "wait,check,forcefdeorfbe=/dev/block/platform/soc.0/f9824900.sdhci/by-name/metadata" "wait,check,encryptable=/dev/block/platform/soc.0/f9824900.sdhci/by-name/metadata";
# init.angler.rc
insert_line init.angler.rc "init.fk.rc" after "import init.angler.sensorhub.rc" "import init.fk.rc";
insert_line init.angler.rc "performance_profiles" after "import init.angler.sensorhub.rc" "import init.performance_profiles.rc";
replace_string init.angler.rc "# verity_load_state" " verity_load_state" "# verity_load_state";
replace_string init.angler.rc "# verity_update_state" " verity_update_state" "# verity_update_state";
replace_section init.angler.rc "service atfwd" " " "service atfwd /system/bin/ATFWD-daemon\n disabled\n class late_start\n user system\n group system radio\n";
# sepolicy
$bin/magiskpolicy --load sepolicy --save sepolicy \
"allow init rootfs file execute_no_trans" \
;
# end ramdisk changes
write_boot;
## end install
| true |
74fc609b13fa7d0efcc3203cf1a8c8f7434fcc45
|
Shell
|
c2y2/shell
|
/cc_ddos/check_proxy.sh
|
UTF-8
| 1,171 | 3.875 | 4 |
[] |
no_license
|
#!/bin/bash
#get proxy list
declare check_threads=10
declare line
declare times
declare ip
declare port
declare i
declare j
declare mod
function quit() {
exit "$1"
}
#echo "start check proxy's functionality..."
#retarget the input file to stdin
if [ "$#" -gt "0" ]
then
exec 0<$1
else
exec 1>&2
echo "usage: bash $0 proxyListFile.txt"
echo "error: must have one input arg"
quit 1
fi
#check proxy's functionality
times=0
while read line
do
times=$((times+1))
j=0
for i in `echo $line | tr ' ' '\n' | grep -E '^[^\s].*$'`
do
j=$((j+1))
if [ "$j" -eq 1 ]
then
ip=$i
else
port=$i
fi
done
#echo "times=$times ip=$ip port=$port"
# start test
if GET -t 5 -p "http://$ip:$port" "http://baidu.com" &>/dev/null
then
echo "$ip $port"
echo ":) ip=$ip port=$port " &>/dev/null
else
echo "invalid ip=$ip port=$port : please check ip:host or network" &>/proc/self/fd/2
fi &
mod=$((times%check_threads))
if [ "$mod" -eq "0" ]
then
wait
fi
done
#close the fd of input file
exec 0>&-
quit 0
#exit
| true |
a76c596f8727069f22c53a932d82c2ab579fb103
|
Shell
|
blckct/concourse-bosh-release
|
/jobs/worker/templates/ctl.erb
|
UTF-8
| 930 | 3.4375 | 3 |
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# vim: ft=sh
set -e -u
RUN_DIR=/var/vcap/sys/run/worker
mkdir -p $RUN_DIR
PIDFILE=${RUN_DIR}/worker.pid
LOG_DIR=/var/vcap/sys/log/worker
mkdir -p $LOG_DIR
exec 1>> $LOG_DIR/worker.stdout.log
exec 2>> $LOG_DIR/worker.stderr.log
/var/vcap/jobs/worker/bin/pre_start
source /var/vcap/jobs/worker/config/env.sh
set -x
function increase_max_open_fds() {
ulimit -n 65536
}
function increase_max_procs() {
echo 4194304 > /proc/sys/kernel/pid_max
ulimit -u unlimited
}
case $1 in
start)
increase_max_open_fds
increase_max_procs
start-stop-daemon \
--pidfile $PIDFILE \
--make-pidfile \
--start \
--exec /var/vcap/packages/concourse/bin/concourse worker
;;
stop)
start-stop-daemon \
--pidfile $PIDFILE \
--remove-pidfile \
--stop \
--oknodo \
--retry=TERM/15/QUIT/2/KILL
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
| true |
234a8f12ed609241b4572fad4fe56d21c819fbdf
|
Shell
|
shr-distribution/meta-smartphone
|
/meta-xiaomi/recipes-core/systemd/systemd-machine-units/hciattach.sh
|
UTF-8
| 716 | 3.265625 | 3 |
[] |
no_license
|
#!/bin/sh
#Maximum number of attempts to enable hcismd to try to get
# hci0 to come online. Writing to sysfs too early seems to
# not work, so we loop.
MAXTRIES=15
#setprop bluetooth.hciattach true
setprop ro.qualcomm.bt.hci_transport smd
setprop qcom.bt.dev_power_class 2
setprop qcom.bt.le_dev_pwr_class 2
i=1
while [ ! $i -gt $MAXTRIES ] ; do
echo 1 > /sys/module/hci_smd/parameters/hcismd_set
sleep 1
if [ -e /sys/class/bluetooth/hci0 ] ; then
# found hci0, so unblock bluetooth and exit successfully
/usr/sbin/rfkill unblock bluetooth
hciconfig hci0 up
/usr/sbin/rfkill block bluetooth
exit 0
fi
i=$((i+1))
done
# must have gotten through all our retries, fail
exit 1
| true |
f47cd9b4f11b53fc42f9c7abb702a617e70f9833
|
Shell
|
enjmiah/SoftRas
|
/examples/recon/download_dataset.sh
|
UTF-8
| 440 | 3 | 3 |
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
if [ -e "./data/mesh_reconstruction_dataset.zip" ]; then
unzip ./data/mesh_reconstruction_dataset.zip -d ./data/datasets
mv ./data/datasets/mesh_reconstruction/* ./data/datasets/
rm -rf /data/datasets/mesh_reconstruction
else
echo "Please download dataset from https://drive.google.com/open?id=1fY9IWK7yEfLOmS3wUgeXM3NIivhoGhsg, put it in ./data/mesh_reconstruction_dataset.zip, and run this script."
fi
| true |
7cf28554db58397d67438594ac9e9f110f3b7a87
|
Shell
|
olegfedoseev/docker-satis
|
/start.sh
|
UTF-8
| 466 | 2.875 | 3 |
[
"MIT"
] |
permissive
|
#!/bin/bash
mkdir /root/.ssh && ssh-keygen -t rsa -b 2048 -P "" -f /root/.ssh/id_rsa
echo -e "\n\nPublic key for Satis:"
cat /root/.ssh/id_rsa.pub
echo -e "\n\n"
echo "Creating known_hosts..."
for domain in $PRIVATE_DOMAINS ; do
ssh-keyscan -t rsa $domain >> /root/.ssh/known_hosts
done
chown -R www-data:www-data /var/www/satisfy/web/dist /var/www/composer
cp -r /root/.ssh /var/www/.ssh && chown -R www-data:www-data /var/www/.ssh
exec apache2-foreground
| true |
a440054421892a4ffffce7e6c0484fdac3e7fd72
|
Shell
|
Raniita/dotfiles
|
/wayland/.config/waybar/mediaplayer.sh
|
UTF-8
| 348 | 2.828125 | 3 |
[] |
no_license
|
#!/bin/sh
player_status=$(playerctl -p spotify status 2> /dev/null)
if [ "$player_status" = "Playing" ]; then
echo " $(playerctl -p spotify metadata artist) - $(playerctl -p spotify metadata title)"
elif [ "$player_status" = "Paused" ]; then
echo " $(playerctl -p spotify metadata artist) - $(playerctl -p spotify metadata title)"
fi
| true |
ab4e10f009516ae91ab52a6a16220fbb19aac8d8
|
Shell
|
nurey/disclosed
|
/load.sh
|
UTF-8
| 688 | 3.921875 | 4 |
[
"MIT"
] |
permissive
|
#!/bin/bash
#FILE can be "all" or a specific file
FILE=$1
KIND=$2 # eg. Contract
function load_one {
ONE=$1
echo "loading $ONE"
appcfg.py upload_data \
--config_file=app2/contract_loader.py \
--filename="$ONE" \
--kind=$KIND \
app2
##simulate success
#yes --version > /dev/null
##simulate failure
#fail
if [ $? -eq 0 ]; then
echo "Successfully imported $i, moving to uploaded"
#mv $i scraper/data/uploaded
else
echo "Failed to import $i"
fi
}
if [ "$FILE" = "all" ]; then
# load in order from oldest to newest
for i in `ls -1tr scraper/data/*.csv`; do
load_one $i
done
else
load_one $FILE
fi
| true |
a90f107dfd7e8c641d120276b3f11fed59ebf40e
|
Shell
|
tripleo1/Paladin1991-Last-Xmonad
|
/eww/scripts/highlight
|
UTF-8
| 1,803 | 3.234375 | 3 |
[] |
no_license
|
#!/bin/bash
# Get currente theme
Eww_Currente_Theme=$(cat ~/.config/eww/eww.scss | grep @import | cut -d '"' -f2)
Gtk_Currente_Theme=$(cat ~/.themes/Midday/gtk-3.0/gtk.css | grep @import | cut -d '"' -f2)
# Get currente highlight color
Eww_Currente_Color=$(cat ~/.config/eww/$Eww_Currente_Theme | grep highlight | cut -d '#' -f2 | sed 's/;//g')
Gtk_Currente_Color=$(cat ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme | grep highlight | cut -d '#' -f2 | sed 's/;//g')
# Colors
# Red #ff5471
red="ff5471"
# Green #00FA9A
green="00FA9A"
# Purple #cb94ff
purple="cb94ff"
# Orange ##f6ff78
orange="f6ff78"
# Blue #00d2ff
blue="00d2ff"
# Cyan #00FFFF
cyan="00FFFF"
RED(){
sed -i "s/$Eww_Currente_Color/$red/g" ~/.config/eww/$Eww_Currente_Theme
sed -i "s/$Gtk_Currente_Color/$red/g" ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme
}
GREEN(){
sed -i "s/$Eww_Currente_Color/$green/g" ~/.config/eww/$Eww_Currente_Theme
sed -i "s/$Gtk_Currente_Color/$green/g" ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme
}
PURPLE(){
sed -i "s/$Eww_Currente_Color/$purple/g" ~/.config/eww/$Eww_Currente_Theme
sed -i "s/$Gtk_Currente_Color/$purple/g" ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme
}
ORANGE(){
sed -i "s/$Eww_Currente_Color/$orange/g" ~/.config/eww/$Eww_Currente_Theme
sed -i "s/$Gtk_Currente_Color/$orange/g" ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme
}
BLUE(){
sed -i "s/$Eww_Currente_Color/$blue/g" ~/.config/eww/$Eww_Currente_Theme
sed -i "s/$Gtk_Currente_Color/$blue/g" ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme
}
CYAN(){
sed -i "s/$Eww_Currente_Color/$cyan/g" ~/.config/eww/$Eww_Currente_Theme
sed -i "s/$Gtk_Currente_Color/$cyan/g" ~/.themes/Midday/gtk-3.0/$Gtk_Currente_Theme
}
case $1 in
red) RED ;;
green) GREEN ;;
purple) PURPLE ;;
orange) ORANGE ;;
blue) BLUE ;;
cyan) CYAN ;;
esac
| true |
04576d7b021dbce87452e74b3f1878ee00b2c174
|
Shell
|
dominiquehunziker/meta-ros-test-sdk
|
/src/target/run.sh
|
UTF-8
| 1,229 | 3.046875 | 3 |
[] |
no_license
|
#!/bin/bash
set -e
# Fix network configuration
echo "127.0.0.1 $(cat /etc/hostname)" >> /etc/hosts
# Install binaries built with SDK
tar xf /home/root/data.tar -C /
# Setup ROS environment for building a binary
export ROS_DISTRO=indigo
export ROS_MASTER_URI=http://localhost:11311
export ROS_PACKAGE_PATH=/opt/ros/${ROS_DISTRO}/share:/opt/ros/cross_compiled/share
export PATH=$PATH:/opt/ros/${ROS_DISTRO}/bin:/opt/ros/cross_compiled/bin
export LD_LIBRARY_PATH=/opt/ros/${ROS_DISTRO}/lib:/opt/ros/cross_compiled/lib
export PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python2.7/site-packages:/opt/ros/cross_compiled/lib/python2.7/site-packages
export CMAKE_PREFIX_PATH=/opt/ros/${ROS_DISTRO}:/opt/ros/cross_compiled
# Prepare workspace
mkdir -p /home/root/ws/src
cd /home/root/ws/src
# Initialize the workspace
catkin_init_workspace
# Setup package
catkin_create_pkg --rosdistro indigo runner roscpp my_pkg
cp /home/root/src/runner.cpp /home/root/ws/src/runner/src
cp /home/root/src/CMakeLists.txt /home/root/ws/src/runner
cd /home/root/ws
# Build package
catkin_make install
# Setup ROS environment for execution
. install/setup.bash
# Run simple test
echo "===== RUN SIMPLE TEST ====="
roslaunch /home/root/src/test.launch
| true |
f434df3a4f44e8f6de8446602b6b06eaeb8b13bb
|
Shell
|
riyadennis/bashExperiments
|
/todo.sh
|
UTF-8
| 521 | 3.953125 | 4 |
[] |
no_license
|
#!/bin/sh
# Manage a simple todo list using bash
FILE=~/Documents/todo
date=`date`
if [ -w "$FILE" ]
then
echo "You have existing things in your todo:"
while IFS= read -r varname; do
printf '%s\n' "$varname"
done < "$FILE"
echo "Do you want to clear your todo yes/no"
read choice
if [ $choice="yes" ]
then
truncate -s0 file
echo "Todo cleared"
fi
else
echo >> $FILE
sudo chmod 777 "$FILE"
fi
echo "Enter things you want to add to your todo"
read todo
echo "$todo ---- $date" >> $FILE
| true |
832d4063be074e9a17fdba4bf8426730bc198651
|
Shell
|
bsingr/fitness-tracker
|
/scripts/ci-git-commit-and-push
|
UTF-8
| 1,616 | 3.796875 | 4 |
[] |
no_license
|
#!/bin/bash
# inspired by https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
set -e # Exit with nonzero exit code if anything fails
set -x # Print vars and statements
SOURCE_BRANCH="master"
TARGET_BRANCH="master"
pwd # debug
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
# if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
# echo "Skipping deploy (not on correct branch)"
# exit 0
# fi
# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`
# Now let's go have some fun with the cloned repo
git config user.name "CI"
git config user.email "$COMMIT_AUTHOR_EMAIL"
# If there are no changes to the compiled out (e.g. this is a README update) then just bail.
if git diff --quiet; then
echo "No changes to the output on this push; exiting."
exit 0
fi
# Commit the "changes", i.e. the new version.
# The delta will show diffs between new and old versions.
git add -A .
git commit -m "CI ${SHA}"
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in ./deploy-key.enc -out ./deploy-key -d
chmod 600 ./deploy-key
eval `ssh-agent -s`
ssh-add deploy-key
# Now that we're all set up, we can push.
git status
git push $SSH_REPO HEAD:$TARGET_BRANCH -v
| true |
27f31941876edacaf423e623d2cda806be93012b
|
Shell
|
fakenumbers/fakenumbers.github.io
|
/scripts/livecheck.sh
|
UTF-8
| 637 | 3.828125 | 4 |
[
"CC0-1.0"
] |
permissive
|
#!/bin/bash
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
if [ $# -lt 2 ]; then
echo "Usage: livecheck.sh <category> <number>";
echo "Does a live check using curl and \
prints \"found <number>\" and exits with error 0 on match, otherwise error 1";
echo "Attention: Do not use for bulk checks, download latest repository from \
https://github.com/fakenumbers/fakenumbers.github.io instead and run bulkcheck.sh locally"
exit;
fi
if curl --head --fail "https://fakenumbercheck.tk/$1/$2" >/dev/null 2>&1; then
# match
echo "found $2"
exit 0;
else
# not blacklisted
exit 1;
fi
| true |
f2db9be5c1bb73e3a61b289f27f973cc26e2cd0f
|
Shell
|
bongster228/UNLVCS302
|
/Asst8/Asst08/a8tst
|
UTF-8
| 2,366 | 3.9375 | 4 |
[] |
no_license
|
#!/bin/bash
# CS 302, assignment #8 test script.
# ---------------------------------------------------------
# Initial checks.
# Ensure executable file exists.
# Verify availability of testing support files.
if [ -z $1 ]; then
echo "Error, must provide executable file name."
exit
fi
if [ ! -e $1 ] || [ ! -x $1 ]; then
echo "Error, unable to find $1 executable file."
exit
fi
if [ ! -e p0.txt ]; then
echo "Error, unable to find test input files."
exit
fi
if [ ! -e mstr0.txt ]; then
echo "Error, unable to find test solution files."
exit
fi
# ---------------------------------------------------------
# Test priority queue data structure
#
clear
echo "${bolded}CS 302 Assignment #8 Test Script${normal}"
echo
echo
echo "./pqTest > outPQtest.txt"
./pqTest > outPQtest.txt
if `diff outPQtest.txt mstrPQtest.txt >/dev/null`; then
echo "PQ Test Successful"
else
diff outPQtest.txt mstrPQtest.txt
fi
echo
echo
# ---------------------------------------------------------
# Begin tests.
# puzzle files are in data/
#
inFile="p"
ansFile="mstr"
outFile="out"
ext=".txt"
alt=a
alt2=b
iter=0
for ((i=0; i<=24; i++))
do
#
echo "./"$1" $inFile$iter$ext >$outFile$iter$ext"
./$1 $inFile$iter$ext >$outFile$iter$ext
if `diff $outFile$iter$ext $ansFile$iter$ext >/dev/null` ||
`diff $outFile$iter$ext $ansFile$iter$alt$ext >/dev/null` ||
`diff $outFile$iter$ext $ansFile$iter$alt2$ext >/dev/null`; then
echo "Test $iter Successful"
else
diff $outFile$iter$ext $ansFile$iter$ext
fi
echo
echo
((iter++))
#
done
#
# ---------------------------------------------------------
# Final test with valgrind
#
echo -e "\n**********************************************************************"
echo "Final test - check for memory leaks."
echo
echo " Should show: \"All heap blocks were freed -- no leaks are possible\""
echo " And no other errors."
echo " Note, may see: Warning: set address range perms: large range"
echo " (which is OK)"
echo
iter=21
echo "Final Test:"
echo
echo "valgrind ./$1 $inFile$iter$ext >$outFile$iter$ext"
valgrind ./$1 $inFile$iter$ext >$outFile$iter$ext
if `diff $outFile$iter$ext $ansFile$iter$ext >/dev/null` ||
`diff $outFile$iter$ext $ansFile$iter$alt$ext >/dev/null`; then
echo "Test $iter Successful"
else
diff $outFile$iter$ext $ansFile$iter$ext
fi
# -----
echo
echo "Test Script Done."
| true |
17eeaea66f222709f2a3c784add4995401f5bdaf
|
Shell
|
omergencer/vagrant-big-data-env-master
|
/scripts/setup-kafka.sh
|
UTF-8
| 426 | 3.390625 | 3 |
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
source "/vagrant/scripts/common.sh"
function installRemoteKAFKA {
echo "install KAFKA from remote file"
curl ${CURL_OPTS} -o /vagrant/resources/$KAFKA_ARCHIVE -O -L $KAFKA_MIRROR_DOWNLOAD
tar -xzf /vagrant/resources/$KAFKA_ARCHIVE -C /usr/local
}
function installKAFKA {
installRemoteKAFKA
ln -s /usr/local/$KAFKA_RELEASE /usr/local/KAFKA
}
echo "setup KAFKA"
installKAFKA
echo "KAFKA setup complete"
| true |
adf151bec641ac6b4b2329d23e0c6650909a277b
|
Shell
|
IFB-ElixirFr/LinuxEBAII
|
/docs/_build/jupyter_execute/09_manipulate.sh
|
UTF-8
| 658 | 2.890625 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
# On se déplace dans annotations
# remplacer <project>
# cd /shared/projects/<project>/annotations/hg38
cd /shared/projects/form_2022_32/coursLinux/demo/annotations/hg38
mkdir bed; cd bed
# On télécharge le fichier
wget https://zenodo.org/record/5716151/files/hg38_exons.bed.gz
# Le fichier compressé (finit par ".gz"). Il pèse 8,4Mo.
ls -lh
# Vérification du type de fichier
file hg38_exons.bed.gz
# On le décompresse
gunzip hg38_exons.bed.gz
# Le fichier a perdu l'extension gz. Il pèse 81Mo.
ls -lh
# Vérification du type de fichier : il a changé.
file hg38_exons.bed
head -n 10 hg38_exons.bed
wc -l hg38_exons.bed # 1261870 exons
| true |
009ee5c4232fa0f9b1f11c863efd66a2a6d823e5
|
Shell
|
lichuanky/dotfiles-vps
|
/startup.sh
|
UTF-8
| 1,123 | 2.546875 | 3 |
[] |
no_license
|
## Hard info
cat /proc/cpuinfo
cat /proc/meminfo
free –m
## Disk IO
dd if=/dev/zero of=test bs=64k count=4k oflag=dsync
dd if=/dev/zero of=test bs=8k count=256k conv=fdatasync
## Test speed
wget https://cachefly.cachefly.net/100mb.test
wget freevps.us/downloads/bench.sh -O - -o /dev/null | bash
## OneinStack(https://oneinstack.com/)
yum -y install wget screen curl python #for CentOS/Redhat
# apt-get -y install wget screen curl python #for Debian/Ubuntu
# wget http://aliyun-oss.linuxeye.com/oneinstack-full.tar.gz #阿里云用户下载
# wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz #包含源码,国内外均可下载
wget http://mirrors.linuxeye.com/oneinstack.tar.gz #不包含源码,建议仅国外主机下载
tar xzf oneinstack-full.tar.gz cd oneinstack #如果需要修改目录(安装、数据存储、Nginx日志),请修改options.conf文件
screen -S oneinstack #如果网路出现中断,可以执行命令`screen -r oneinstack`重新连接安装窗口
./install.sh #注:请勿sh install.sh或者bash install.sh这样执行
##====== End OneinStack ======
| true |
c65196e1c4f9d9dea54b3f2d1f00532ba4e93691
|
Shell
|
ngoyal16/shell_pratice
|
/scriptprog3.sh
|
UTF-8
| 154 | 3.3125 | 3 |
[] |
no_license
|
if [ $# -eq 0 ]
then
echo "command line arguments are missing"
exit 1
fi
n=$1
i=0
while [ $i -lt ${#n} ]; do echo ${n:$i:1}; i=$((i+1));done
| true |
160df9dd69a54a7e0df99e05769d8974070f53e5
|
Shell
|
duckwork/bespoke
|
/bin/bait
|
UTF-8
| 303 | 3.21875 | 3 |
[] |
no_license
|
#! /usr/bin/env dash
# watch for events and ACT
fifo=$TMP/bait.fifo;
# wm bait -f => get fifo and quit
[ "$1" = "-f" ] && {
printf '%s\n' $fifo;
exit $SUCCESS;
}
[ -p $fifo ] && rm $fifo;
mkfifo $fifo;
wew -s > $fifo &
printf '%s\n' $!
while IFS=: read ev wid; do
$HKS/$ev $wid;
done < $fifo;
| true |
8a5cd7fc486579f78236040134eb9cd9e3c73d2c
|
Shell
|
aroq/toolbox-ansistrano
|
/tools/ansistrano
|
UTF-8
| 2,024 | 3.328125 | 3 |
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
# shellcheck disable=SC1090
# shellcheck disable=SC1091
TOOLBOX_DEPS_DIR=${TOOLBOX_DEPS_DIR:-toolbox/deps}
# Includes
. "${TOOLBOX_DEPS_DIR}/toolbox-utils/includes/init.sh"
. "${TOOLBOX_DEPS_DIR}/toolbox-utils/includes/util.sh"
. "${TOOLBOX_DEPS_DIR}/toolbox-utils/includes/log.sh"
. "${TOOLBOX_DEPS_DIR}/toolbox-exec/includes/exec.sh"
# Directory where playbook files are contained
TOOLBOX_ANSISTRANO_PLAYBOOK_DIR=${TOOLBOX_ANSISTRANO_PLAYBOOK_DIR:-toolbox/ansible}
# Ansible playbook filename
TOOLBOX_ANSISTRANO_PLAYBOOK=${TOOLBOX_ANSISTRANO_PLAYBOOK:-deployWithAnsistrano.yml}
# Directory to prepare artifact archive
TOOLBOX_ANSISTRANO_ARTIFACT_DIR=${TOOLBOX_ANSISTRANO_ARTIFACT_DIR:-../../.docroot}
# Artifact file
TOOLBOX_ANSISTRANO_ARTIFACT_FILE=${TOOLBOX_ANSISTRANO_ARTIFACT_FILE:-artifact.tar.gz}
# Deployment environment
TOOLBOX_ANSISTRANO_DEPLOY_ENVIRONMENT=${TOOLBOX_ANSISTRANO_DEPLOY_ENVIRONMENT:-}
# Ansible inventory (use 'hostname,' to deploy to the single host)
TOOLBOX_ANSISTRANO_INVENTORY=${TOOLBOX_ANSISTRANO_INVENTORY:-${TOOLBOX_ANSISTRANO_PLAYBOOK_DIR}/${TOOLBOX_ANSISTRANO_DEPLOY_ENVIRONMENT}.inventory.yaml}
# Ansistrano to deploy to
TOOLBOX_ANSISTRANO_DEPLOY_TO=${TOOLBOX_ANSISTRANO_DEPLOY_TO:-}
# Ansistrano deploy via
TOOLBOX_ANSISTRANO_DEPLOY_VIA=${TOOLBOX_ANSISTRANO_DEPLOY_VIA:-copy_unarchive}
# Path for Ansistrano to deploy from
# TODO: Update for absolute paths handling
TOOLBOX_ANSISTRANO_DEPLOY_FROM=${TOOLBOX_ANSISTRANO_DEPLOY_FROM:-${TOOLBOX_ANSISTRANO_ARTIFACT_DIR}/${TOOLBOX_ANSISTRANO_ARTIFACT_FILE}}
toolbox_run "Deploy the artifact with Ansistrano" \
ansible-playbook "${TOOLBOX_ANSISTRANO_PLAYBOOK_DIR}/${TOOLBOX_ANSISTRANO_PLAYBOOK}" \
-i "${TOOLBOX_ANSISTRANO_INVENTORY}" \
-e ansistrano_deploy_to="${TOOLBOX_ANSISTRANO_DEPLOY_TO}" \
-e ansistrano_deploy_from="${TOOLBOX_ANSISTRANO_DEPLOY_FROM}" \
-e deploy_environment="${TOOLBOX_ANSISTRANO_DEPLOY_ENVIRONMENT}" \
-e ansistrano_deploy_via="${TOOLBOX_ANSISTRANO_DEPLOY_VIA}"
| true |
68df7395a326077fccb69c0b7aa7903d8ff427e6
|
Shell
|
XGWang0/Suse_testsuite
|
/sets/qa_testset_automation/automation/qaset/conf/SLE11SP3.conf
|
UTF-8
| 691 | 3.296875 | 3 |
[] |
no_license
|
#!/bin/bash
__import conf/common.conf
# both REPO_URLS* and REPO_NAMES should have the size.
SQ_REPO_NAMES=(
'qa-ibs'
'sle-sdk'
)
SQ_REPO_URLS_DE=(
)
SQ_REPO_URLS_BJ=(
)
function sq_prep_SLE11SP3_get_repo_url_by_name {
local _repo_name=$1
local _SLE_build=$2
local _arch=$3
local _repo_mirror=$4
local _sdk_arch
_RELEASE=${_release}
if test ${_arch} == "i586"; then
_sdk_arch="i386"
else
_sdk_arch=${_arch}
fi
case ${_repo_name} in
'qa-ibs') echo "http://dist.suse.de/ibs/QA:/Head/SUSE_SLE-11-SP3_GA/";;
'sle-sdk') echo "http://dist.suse.de/install/SLP/SLE-11-SP3-SDK-LATEST/${_sdk_arch}/DVD1/";;
esac
}
| true |
b94eb69c0f655a408cc010331f3e7b09557a6981
|
Shell
|
andrejbaran/cli
|
/scripts/configdev.sh
|
UTF-8
| 667 | 3.015625 | 3 |
[
"MIT"
] |
permissive
|
##
# Author: JP Lew (jp@cto.ai)
# Date: Friday, 10th May 2019 8:38:24 am
#
# Usage:
# Run this to set up your dev environment.
#
# Point your ops command from bin/ run to bin/run.dev. This will allow you to
# set your environment at run-time like this: `NODE_ENV=staging ops init`
#
# It also enables path aliases (~) in your Typescript files.
#
# Copyright (c) 2019 CTO.ai
##
#! /bin/bash
CLI_DIR="$( cd "$(dirname "$0")" ; cd .. ; pwd -P )"
NODE_MODULES_DIR="$(npm config get prefix)"
OPS_BINARY="$NODE_MODULES_DIR/bin/ops"
if [ -f $OPS_BINARY ]; then
rm $OPS_BINARY
fi
ln -s $CLI_DIR/bin/run.dev $OPS_BINARY
tsc -b src
link-module-alias
export DEBUG=ops:*
| true |
17c465e33620986b01cf4148bf7aa3fc8e599a45
|
Shell
|
otsaloma/docsets
|
/index.sh
|
UTF-8
| 312 | 3.28125 | 3 |
[
"MIT"
] |
permissive
|
#!/bin/bash
set -e
FAILED=""
ROOT_DIR="$(pwd)"
export PYTHONPATH=$ROOT_DIR:$PYTHONPATH
for DIRECTORY; do
echo "Entering $DIRECTORY..."
cd "$ROOT_DIR/$DIRECTORY/Contents/Resources"
./index.py || FAILED="$FAILED $DIRECTORY"
done
for DIRECTORY in $FAILED; do
echo "INDEX FAILED FOR $DIRECTORY"
done
| true |
79024efbfdbd35bc8fbf347a4a05a47df6632d02
|
Shell
|
dcjones/craigcitro-dotfiles
|
/xsession
|
UTF-8
| 1,767 | 3.046875 | 3 |
[] |
no_license
|
#!/bin/bash -l
#
# I blatantly stole this from Ami when setting up
# ratpoison. Lots of stuff is commented out for now.
# In addition, I'm marking the stuff that I blatantly stole
# from him so that I remember that I have no idea what it is. ;)
#
# I'm not sure if I should need this at the beginning, but it doesn't
# seem to get loaded by default:
xrdb <~/.Xdefaults
# I love a reasonable repeat rate
xset r rate 200 40
# stolen
#if [ $(ps axuwww|grep " $PPID[ ]"|grep gdm|wc -l) -gt 0 ]; then
# xauth -f ~/.Xauthority merge \
# $(cat /proc/$(ps --ppid $(ps axuwww|grep gdm-session-worke[r]| \
# awk '{print $2}') | grep ratpoison | \
# awk '{print $1}')/environ|tr '\000' '\012'|sed -n -e 's/XAUTHORITY=//p')
#fi
export XAUTHORITY=~/.Xauthority
# fix the nvidia monitor flicker
/usr/bin/nvidia-settings -a [gpu:0]/GPUPowerMizerMode=1
# stolen
/usr/bin/xsetroot -solid black
# stolen
/usr/bin/xmodmap ~/.xmodmaprc
# stolen
#/usr/bin/gnome-screensaver &
# For some reason, gnome-screensaver wouldn't work for me. I'd always
# start up and get the following message:
# WARNING **: Failed to get session presence proxy: Could not get owner of name 'org.gnome.SessionManager': no such name
# I didn't try hard to diagnose it. Instead, I switched to xscreensaver:
# make sure to kill existing copies of xscreensaver
xscreensaver-command -exit
# (2010 Sep 27) currently, goobuntu is still sticking something in my
# way that starts gnome-screensaver; here's a hacky fix:
killall gnome-screensaver
# run a new one
xscreensaver &
# stolen
/usr/bin/xset -b
# set up my mouse button appropriately:
xinput set-button-map $(xinput --list | grep "Evoluent" | sed -e "s/.*id=\([0-9]*\).*/\1/g") 1 2 3 4 5 6 7 3 8
# start the WM
exec /usr/bin/ratpoison
| true |
9f54ba8e898547c8de9ee730b9ae706c9817ecb8
|
Shell
|
kafkapre/tech-edu-webapp-google-technologies
|
/k8s/build-all-docker-images.sh
|
UTF-8
| 1,348 | 3.421875 | 3 |
[
"MIT"
] |
permissive
|
#! /bin/bash
currentDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
function check {
_isOK=$1
_action=$2
_imagName=$3
if [ "$_isOK" != "0" ];
then
echo -e "\nDocker $_action of image [$_imageName] failed. Script exited.\n"
exit 1
fi
}
source $currentDir/cluster.conf
echo "Is version [$dockerImageVersion] ok? (y/n)"
read isOk
if [ "$isOk" == "y" ];
then
action="build"
$currentDir/../golang-server/docker-build.sh "$dockerImageVersion"
check $? "$action" "golang-server"
$currentDir/../lb/docker-build.sh "$dockerImageVersion"
check $? "$action" "lb"
$currentDir/../client/docker-build.sh "$dockerImageVersion"
check $? "$action" "ui-server"
if [ "$1" == "-p" ];
then
action="push"
gcloud docker -- push "us.gcr.io/sonic-trail-154010/edu-ui-server:$dockerImageVersion"
check $? "$action" "info-server"
gcloud docker -- push "us.gcr.io/sonic-trail-154010/edu-golang-server:$dockerImageVersion"
check $? "$action" "comments-serverr"
gcloud docker -- push "us.gcr.io/sonic-trail-154010/edu-ui-server:$dockerImageVersion"
check $? "$action" "lb"
gcloud docker -- push "us.gcr.io/sonic-trail-154010/edu-lb:$dockerImageVersion"
check $? "$action" "ui-server"
fi
else
echo "Script finished."
exit 0
fi
exit 0
| true |
a53eef78612a8b4c460057eed881e4b30568fde8
|
Shell
|
openwall/Owl
|
/packages/xinetd/xinetd.init
|
UTF-8
| 1,507 | 3.71875 | 4 |
[] |
no_license
|
#!/bin/sh
# $Owl: Owl/packages/xinetd/xinetd.init,v 1.8 2005/11/16 13:32:46 solar Exp $
#
# chkconfig: 345 56 50
# description: \
# xinetd is a powerful replacement for inetd. xinetd has access \
# control machanisms, extensive logging capabilities, the ability \
# to make services available based on time, and can place limits \
# on the number of servers that can be started, among other things.
#
# processname: /usr/sbin/xinetd
# config: /etc/xinetd.conf
# pidfile: /var/run/xinetd.pid
# Source function library.
. /etc/rc.d/init.d/functions
OWL_STARTUP_ENABLE=1
# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network
case "$1" in
start|restart)
test "$NETWORKING" = "yes" || exit 0
test -x /usr/sbin/xinetd -a -f /etc/xinetd.conf || exit 1
esac
case "$1" in
start)
if [ "0$OWL_STARTUP_VERSION" -ge 3 ]; then
daemon --pidfile /var/run/xinetd.pid --expect-user root \
-- xinetd -pidfile /var/run/xinetd.pid
else
daemon xinetd -pidfile /var/run/xinetd.pid
fi
;;
stop)
if [ "0$OWL_STARTUP_VERSION" -ge 3 ]; then
killproc --pidfile /var/run/xinetd.pid --expect-user root xinetd
else
killproc xinetd
fi
;;
status)
status --pidfile /var/run/xinetd.pid --expect-user root xinetd
;;
restart)
$0 stop
$0 start
;;
reload)
if [ "0$OWL_STARTUP_VERSION" -ge 3 ]; then
killproc --pidfile /var/run/xinetd.pid --expect-user root \
-HUP xinetd
else
killproc xinetd -HUP
fi
;;
*)
echo "Usage: xinetd {start|stop|status|restart|reload}"
exit 1
esac
exit $?
| true |
dc002e1a9d90e546a24a075e0ad9c92129221232
|
Shell
|
balena-io-experimental/balena-rtc-multicontainer
|
/rtc/start.sh
|
UTF-8
| 657 | 3.90625 | 4 |
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Parse RTC date into unixtime
rtcdate=$(hwclock -l)
# required to format the date string on busybox date, not requir
unix_rtcdate=$(date -D "%c" -d "${rtcdate}" "+%s")
# With coreutils date the conversion should be
# unix_rtcdate=$(date -d "${rtcdate}" "+%s")
# Get current system unixtime
unix_systemdate=$(date "+%s")
# Only restore time if it's ahead of system time
if [ "${unix_rtcdate}" -gt "${unix_systemdate}" ]; then
echo "Restoring system time from RTC"
hwclock --hctosys
else
echo "System time is ahead of RTC, not restoring"
fi
## Do the main work, whatever it may be...
while : ; do date; sleep "${INTERVAL:-15}"; done
| true |
4830c6da915fd7da1e71bb5af29aa38582817d97
|
Shell
|
CycloneAwakening/ZonamaDev
|
/docs/Old_Fastrack_VM-20130427231338/files/home/swgemu/bin/myip
|
UTF-8
| 490 | 3.625 | 4 |
[
"MIT"
] |
permissive
|
#!/bin/bash
#
# myip - Display ip of this VM
#
# Author: Lord Kator <lordkator@swgemu.com>
#
# Created: Sat Apr 27 22:53:44 UTC 2013
#
#
ip_address=$(/sbin/ifconfig eth0 | sed -n '/inet addr:/s/.*addr:\([^ ]*\) .*/\1/p')
if [ ! -n "$ip_address" ]; then
echo "** Failed to determine ip address!? **"
fi
cd ~/run
port=$(echo 'print(LoginPort)' | lua -l 'conf/config' -)
echo "Server ip : $ip_address"
echo "Login port: $port"
case $0 in
*_w )
read -p "Press <ENTER> to exit: "
;;
esac
exit 0
| true |
baea964ab6110b4f87d0464e87d5556ab2b99fff
|
Shell
|
krgko/learning-monitoring
|
/gp/download-jmeter.sh
|
UTF-8
| 239 | 2.59375 | 3 |
[] |
no_license
|
#!/bin/bash
echo "Download Jmeter ..."
wget https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.2.1.zip
echo "Unzip ..."
unzip apache-jmeter-5.2.1.zip
echo "Clear zip file ..."
rm apache-jmeter-5.2.1.zip
echo "Completed !!!"
| true |
2d35b3d28c8a71e083653879da76890df11146df
|
Shell
|
drwest143/matrix
|
/process/site-add.sh
|
UTF-8
| 14,975 | 3.609375 | 4 |
[] |
no_license
|
#!/bin/bash
# Add site script
#
# Params: domainname.com dbname dbuser dbpasswd
#
# Version 1.2 - April 16th, 2014
#
source /var/git/server-project/lib/svr-proj-libs.sh
GIT_TEMPLATE_PATH="/var/git/server-project/vhost-template";
TEMPLATE_PATH="$VHOST_PATH/vhost-template";
LOG_PATH="/var/log/httpd";
# Get IP for eth0
IP=`ifconfig eth0 | grep inet | grep -v inet6 | awk -F: '{ print $2 }' | awk '{ print $1 }'`;
ALL_IPS="";
ALL_INTERNAL_IPS="";
ALL_INTERNAL_WEB_IPS="";
SSL="";
HTTP_IPPORTS="";
HTTPS_IPPORTS="";
ALL_INTERNAL_WEB_IPS="";
PUB_HTTPS_WEB_IPPORTS="";
INT_HTTPS_WEB_IPPORTS="";
PUB_HTTP_WEB_IPPORTS="";
INT_HTTP_WEB_IPPORTS="";
# TODO: Prompt for SSL redirect
# TODO: prompt for git path
function display_req_parms {
echo;
echo "######################################################################################";
echo "You must supply the domain and optionally the DB name, DB user and DB pass";
echo "Example: ";
echo " $0 domainname.com dbname dbuser dbpass";
echo "######################################################################################";
echo;
exit 1;
}
function remove_domain_www {
echo;
echo 'It is not necessary to append www to the domain!';
echo ' Removing...';
echo;
DOMAIN=`echo $DOMAIN | sed 's/^www\.//'`;
SAFEDOMAIN=`echo $DOMAIN | sed 's/\./-/g'`;
}
root_check;
check_which_server;
# Make sure params were supplied
if [ -z "$1" ]; then
# Domain name was not supplied
display_req_parms;
fi;
# Lowercase domain name
DOMAIN=`echo "$1" | tr '[A-Z]' '[a-z]'`;
# Domain name with dashes removed for dev/qa environments
SAFEDOMAIN=`echo $DOMAIN | sed 's/\./-/g'`;
SITE_PATH="$VHOST_PATH/$DOMAIN";
VHOST_SYMLINK="/etc/httpd/conf.d/vhost-$DOMAIN.conf";
CONF_FILE="$SITE_PATH/config/$VHOST_CONF"
# Check to see if domain has www on it and remove it if so
echo "$DOMAIN" | grep -e "^www." &> /dev/null && remove_domain_www;
# DB Credentials
# Max length for DB name in MySQL is 64 chars
if [ -z "$2" ]; then
# Replace dots in domain name with - & Truncate to first 64 chars
# TODO: Strip out invalid characters!
DB_NAME=`echo ${DOMAIN:0:63} | sed 's/[\.-]//g'`;
else
# Use supplied DB name
DB_NAME="$2";
fi;
# Max username length is 16 chars...
if [ -z "$3" ]; then
# Generate a DB Username
# Remove dots and dashes and only grab first 16 chars
DB_USER=`echo ${DOMAIN:0:15} | sed 's/[\.-]//g'`;
else
# Use provided DB Username
DB_USER="$3";
fi;
if [ -z "$4" ]; then
# Generate random password for DB
DB_PASSWD=`openssl rand -base64 6`;
else
# Use the DB password supplied
DB_PASSWD="$4";
fi;
DB_HOST="127.0.0.1";
# Check to make sure auto-generated and/or user supplied values were not blank
if [ -z "$DB_NAME" ]; then
echo "DB_NAME was empty! Please specify a database name and/or single-quote database name...";
exit 1;
fi;
if [ -z "$DB_USER" ]; then
echo "DB_USER was empty! Please specify user and/or single-quote user...";
exit 1;
fi;
if [ -z "$DB_PASSWD" ]; then
echo "DB_PASSWD was empty! Please specify a password and/or single-quote password...";
exit 1;
fi;
if [ `echo "$DOMAIN $DB_NAME $DB_USER $DB_PASSWD" | grep "[',]"` ]; then
echo "Invalid characters detected in domain name, database name, database user name, or password!";
exit 1;
fi;
function display_info {
# Show some info and prompt user to continue
echo;
echo "##################################################################";
echo "Verify site information before proceeding:";
#echo " Project ID: $PROJID";
echo " Site Path: $SITE_PATH";
echo " Domain name: $DOMAIN";
echo " DB Host: $DB_HOST";
echo " DB Name: $DB_NAME";
echo " DB User: $DB_USER";
echo " DB Pass: $DB_PASSWD";
echo " SSL: $SSL";
#echo " Conf file: $CONF_FILE";
#echo " vHost Symlink: $VHOST_SYMLINK";
echo " HTTP IP/Ports: $HTTP_IPPORTS";
if [ "$SSL" == "y" ]; then
echo " HTTPS IP/Ports: $HTTPS_IPPORTS";
fi;
echo " DB ACLs: $ALL_INTERNAL_IPS";
echo;
echo "Press enter to continue or CTRL + C to cancel.";
read -p "##################################################################";
}
function check_db_creds {
echo "Checking DB credentials for DB Name: $DB_NAME - User: $DB_USER";
local DB_NAME_LEN=${#DB_NAME};
local DB_USER_LEN=${#DB_USER};
local DB_PASS_LEN=${#DB_PASSWD};
if [ "$DB_NAME_LEN" -lt 3 ]; then
echo " DB Name is too small! Length: $DB_NAME_LEN - Min: 3 - Exiting...";
exit 1;
fi;
if [ "$DB_NAME_LEN" -gt 64 ]; then
echo " DB Name is too large! Length: $DB_NAME_LEN - Max: 64 - Exiting...";
exit 1;
fi;
if [ "$DB_USER_LEN" -lt 3 ]; then
echo " DB Username is too small! Length: $DB_USER_LEN - Min: 3 - Exiting...";
exit 1;
fi;
if [ "$DB_USER_LEN" -gt 16 ]; then
echo " DB Username is too large! Length: $DB_USER_LEN - Max: 16 - Exiting...";
exit 1;
fi;
if [ "$DB_PASS_LEN" -lt 3 ]; then
echo " DB password is too small! Length: $DB_PASS_LEN - Min: 3 - Exiting...";
exit 1;
fi;
# TODO: Max password length
}
function db_exists_check {
echo "Checking to see if DB: $DB_NAME exists...";
local RES=`$MYSQLSHOW_CMD $DB_NAME | grep -v "Wildcard" | grep -o "$DB_NAME" 2>&1`;
if [ "$RES" == "$DB_NAME" ]; then
echo " Database: $DB_NAME already exists! Exiting...";
# TODO: Prompt user to continue?
exit 1;
fi;
echo " DB: $DB_NAME does not exist!";
}
function setup_db {
echo "Creating DB...";
mysql -e"CREATE DATABASE $DB_NAME;";
if [ "$?" -ne 0 ]; then
echo " Error creating DB!";
exit 1;
fi;
for i in $ALL_INTERNAL_IPS; do
echo " Granting user: '$DB_USER' access from: '$i'";
mysql -e"GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'$i' IDENTIFIED BY '$DB_PASSWD';";
if [ "$?" -ne 0 ]; then
echo " Error creating database user!";
exit 1;
fi;
done;
echo " Done setting up database...";
}
function vhost_exists_check {
echo "Checking to see if vHost already exists in: $SITE_PATH";
if [ -e $SITE_PATH ]; then
echo "$SITE_PATH already exists! Exiting...";
# TODO: question user if they want to continue if it already exists?
exit 1;
fi;
echo "Checking to see if sym-link already exists in: $VHOST_SYMLINK";
if [ -e $VHOST_SYMLINK ]; then
echo "$VHOST_SYMLINK already exists! Exiting...";
# TODO: question user if they want to continue if it already exists?
exit 1;
fi;
}
function create_vhost {
echo "Creating vhost: $DOMAIN";
# Pull down dir structure via git
echo " Exporting git vhost-template..";
(cd $GIT_TEMPLATE_PATH && git checkout-index -a -f --prefix=$VHOST_PATH/)
mv -v $TEMPLATE_PATH $SITE_PATH;
sed -i '/^##/d' $CONF_FILE;
# NOTE: Do this before the section containing IP so it doesn't turn SSLIP into SSLx.x.x.x
if [ "$SSL" == "n" ]; then
echo " Removing SSL from vhost template";
sed -i '/BEGINSSL/,/ENDSSL/d' $CONF_FILE;
# Remove SSL certs
rm -fv $SITE_PATH/ssl/*
else
echo " Configuring SSL...";
listen_ssl_port_all_web_nodes $NEXTSSLPORT $CONF_FILE;
#SSLIP=`echo $ALL_IPS | sed "s/80/443/"`;
sed -i 's/SSLIP/'"$HTTPS_IPPORTS"'/' $CONF_FILE;
sed -i 's/BEGINSSL//' $CONF_FILE;
sed -i 's/ENDSSL//' $CONF_FILE;
fi
# Configure the vhost config file specifically for this site
sed -i 's/SAFEDOMAIN/'"$SAFEDOMAIN"'/g' $CONF_FILE;
sed -i 's/DOMAIN/'"$DOMAIN"'/g' $CONF_FILE;
#sed -i 's/PROJID/'"$PROJID"'/g' $CONF_FILE;
sed -i 's,VHOSTPATH,'"$VHOST_PATH"',g' $CONF_FILE;
sed -i 's,SITE_PATH,'"$SITE_PATH"',g' $CONF_FILE;
sed -i 's/IP/'"$HTTP_IPPORTS"'/g' $CONF_FILE;
sed -i 's/MYSQLHOST/'"$DB_HOST"'/g' $CONF_FILE;
sed -i 's/MYSQLDB/'"$DB_NAME"'/g' $CONF_FILE;
sed -i 's/MYSQLUSER/'"$DB_USER"'/g' $CONF_FILE;
sed -i 's,MYSQLPASS,'"$DB_PASSWD"',g' $CONF_FILE;
# Log file path
ACCESS_LOG="$LOG_PATH/vhost-$DOMAIN-access.log";
ERROR_LOG="$LOG_PATH/vhost-$DOMAIN-error.log";
# Create Log files on all web servers
run_cmd_all_web_nodes "touch $ACCESS_LOG && touch $ERROR_LOG;";
# Make Apache own log files on all web servers
run_cmd_all_web_nodes "chown apache:apache $ACCESS_LOG && chown apache:apache $ERROR_LOG;";
# Make sure log dir exists on all web servers
run_cmd_all_web_nodes "mkdir -p $SITE_PATH/logs && mkdir -p $SITE_PATH/logs;";
# Symlink vhost log path to real log path (so they are all in one place) on all web servers
run_cmd_all_web_nodes "ln -s $ACCESS_LOG $SITE_PATH/logs/access.log && ln -s $ERROR_LOG $SITE_PATH/logs/error.log;";
# Make sure htdocs folder exists
mkdir -p $SITE_PATH/htdocs/
# Make developers own webroot
chgrp -R developers $SITE_PATH/htdocs/
# Create a symlink in the Apache conf.d folder to the new vhost config file
ln -s $CONF_FILE $VHOST_SYMLINK;
echo "Wrote symlink: $VHOST_SYMLINK to: $CONF_FILE - Contents:";
cat $CONF_FILE;
echo;
# Make sure these files are the same
diff $VHOST_SYMLINK $CONF_FILE &> /dev/null;
RES="$?";
if [ "$RES" -ne 0 ]; then
echo "Vhost config file symlink differs from actual file! Exiting...";
exit 1;
fi;
}
function create_remote_vhost_symlink {
local HOST="$1";
echo "Creating vhost symlink on host: $HOST";
ssh -q root@$HOST "if [ ! -f $VHOST_SYMLINK ]; then ln -s $CONF_FILE $VHOST_SYMLINK && echo ' Created' || ' Not created!'; fi";
}
function get_all_web_server_ips {
#echo "Getting all host IPs...";
IPSFILE='/tmp/ipsfile';
rm $IPSFILE &> /dev/null;
for HOST in `cat /etc/web-server-list`; do
#echo " Getting IP for Host $HOST";
ssh -q root@$HOST "ifconfig eth0 | grep inet | grep -v inet6 | awk -F: '{ print \$2 }' | awk '{ print \$1 }'" | tr -d '\n' >> $IPSFILE;
echo -n " " >> $IPSFILE
done;
# Remove trailing whitespace
ALL_IPS=`cat $IPSFILE | sed 's/ *$//g'`;
echo " Got web server IPs: '$ALL_IPS'";
rm $IPSFILE;
}
function get_all_internal_web_server_ips {
#echo "Getting all internal host IPs...";
IPSFILE='/tmp/ipsfile';
rm $IPSFILE &> /dev/null;
for HOST in `cat /etc/web-server-list`; do
#echo " Getting IP for Host $HOST";
ssh -q root@$HOST "ifconfig eth0:0 | grep inet | grep -v inet6 | awk -F: '{ print \$2 }' | awk '{ print \$1 }'" | tr -d '\n' >> $IPSFILE;
echo -n " " >> $IPSFILE
done;
# Remove trailing whitespace
ALL_INTERNAL_WEB_IPS=`cat $IPSFILE | sed 's/ *$//g'`;
echo " Got Internal Web Server IPS: '$ALL_INTERNAL_WEB_IPS'";
rm $IPSFILE;
}
function get_all_internal_ips {
#echo "Getting all internal host IPs...";
IPSFILE='/tmp/ipsfile';
rm $IPSFILE &> /dev/null;
for HOST in `cat /etc/server-list`; do
#echo " Getting IP for Host $HOST";
ssh -q root@$HOST "ifconfig eth0:0 | grep inet | grep -v inet6 | awk -F: '{ print \$2 }' | awk '{ print \$1 }'" | tr -d '\n' >> $IPSFILE;
echo -n " " >> $IPSFILE
done;
echo -n "127.0.0.1" >> $IPSFILE;
# Remove trailing whitespace
ALL_INTERNAL_IPS=`cat $IPSFILE | sed 's/ *$//g'`;
echo " Got Internal IPS: '$ALL_INTERNAL_IPS'";
rm $IPSFILE;
}
function ssl_prompt {
if [ `hostname -s` == "stage" ]; then
echo "Enabling SSL for staging...";
SSL="y";
else
echo;
echo "Enable SSL for this site?"
echo;
select yn in "Yes" "No"; do
case $yn in
Yes ) SSL="y"; break;;
No ) SSL="n"; break;;
esac
done
fi;
}
function add_port_to_ip_list {
local __resultvar="$1";
local IPLIST="$2";
local PORT="$3";
local __result="";
for i in $IPLIST; do
__result="$i:$PORT $__result";
done;
# Remove trailing whitespace
__result=`echo $__result | sed 's/ *$//'`;
eval $__resultvar="'$__result'";
}
function get_next_ssl_port {
local __resultvar="$1";
local __result="";
__result=`grep 'Listen' $SSL_LISTEN_FILE | sort | tail -n1 | awk '{print $2}' | awk -F':' '{print $2}'`;
let __result++;
echo " Next available SSL port: '$__result'";
eval $__resultvar="'$__result'";
}
function listen_ssl_port_all_web_nodes {
local PORT="$1";
local VHOSTCONFFILE="$2";
if [ ! `echo $PORT | grep -e '^1[0-9]\{4\}$'` ]; then
echo;
echo "Attempted to configure Apache to listen on an invalid SSL port! ($PORT)";
echo "Exiting....";
echo;
exit 1;
fi;
for i in `cat /etc/web-server-list`; do
ssh -q root@$i "echo -e \"# $VHOSTCONFFILE\\nListen \`ifconfig eth0:0 | grep inet | awk -F' ' '{print \$2}' | awk -F':' '{print \$2}'\`:$PORT https\" >> $SSL_LISTEN_FILE";
RES="$?";
if [ "$RES" -ne 0 ]; then
echo;
echo "Error writing SSL Listen directive to Host: '$i' - File: '$SSL_LISTEN_FILE'";
echo "Exiting....";
echo;
exit 1;
fi;
done;
echo " Reserved SSL port: $PORT for '$VHOSTCONFFILE'";
}
function add_to_staging {
ADD_TO_STAGING="n";
if [ `hostname -s` == "stage" ]; then
# Nothing to do since we are on staging
echo;
else
echo;
echo "Add site to staging?"
echo;
select yn in "Yes" "No"; do
case $yn in
Yes ) ADD_TO_STAGING="y"; break;;
No ) ADD_TO_STAGING="n"; break;;
esac
done
fi;
if [ "$ADD_TO_STAGING" == "y" ]; then
echo;
echo "Adding to staging...";
echo;
# This means cannot use ' char...
# TODO: Check input for ' char
ssh -t root@stage-int "site-add.sh '$DOMAIN' '$DB_NAME' '$DB_USER' '$DB_PASSWD'";
RES=$?;
#echo "RESULT FROM ADD TO STAGING: '$RES'";
if [ "$RES" != "0" ]; then
echo;
echo "Failed adding to staging! Exiting...";
echo;
exit 1;
else
echo;
echo "Done adding in staging...";
echo "Adding to production next";
echo;
fi;
fi;
}
##########################################
# BEGIN - Script logic
##########################################
echo 'Done';
exit 1;
get_all_web_server_ips;
get_all_internal_ips;
get_all_internal_web_server_ips;
# Perform some checks
check_db_creds;
check_apache_all_nodes;
apache_running_all_hosts;
db_exists_check;
vhost_exists_check;
add_to_staging;
# Ask user if site will be SSL or not
ssl_prompt;
add_port_to_ip_list INT_HTTP_WEB_IPPORTS "$ALL_INTERNAL_WEB_IPS" 80
add_port_to_ip_list PUB_HTTP_WEB_IPPORTS "$ALL_IPS" 80
# List of HTTP IP:PORT
HTTP_IPPORTS="$INT_HTTP_WEB_IPPORTS $PUB_HTTP_WEB_IPPORTS";
if [ "$SSL" == "y" ]; then
# Get the next available SSL port for load balanced IPs
get_next_ssl_port NEXTSSLPORT
add_port_to_ip_list INT_HTTPS_WEB_IPPORTS "$ALL_INTERNAL_WEB_IPS" $NEXTSSLPORT
add_port_to_ip_list PUB_HTTPS_WEB_IPPORTS "$ALL_IPS" 443
# List of HTTPS/SSL IP:PORT
HTTPS_IPPORTS="$PUB_HTTPS_WEB_IPPORTS $INT_HTTPS_WEB_IPPORTS";
fi
# Display settings to user before creating anything
display_info;
setup_db;
create_vhost;
force_csync2;
# TODO: autodetect which host this is in case web1 is administratively down
for i in `cat /etc/web-server-list`; do
check_apache $i;
#force_rsync $i;
create_remote_vhost_symlink $i;
# Check apache again to make sure there are no issues with the config file
check_apache $i;
restart_apache $i;
apache_health_check $i;
echo "Web content updated and Apache restarted on Host: $HOST";
done;
flush_privileges;
echo;
echo "##############################################";
echo " DONE";
echo "##############################################";
echo;
##########################################
# END - Script logic
##########################################
| true |
350af42c4b03785575c4234baf13ee3681ca7332
|
Shell
|
varnitasur/remoterepo1
|
/test.sh
|
UTF-8
| 52 | 2.640625 | 3 |
[] |
no_license
|
for i in `ls`
do
if [ -f $i ]
then
echo $i
fi
done
| true |
131937c3e384391d3cb443c8bb1d68e0af101986
|
Shell
|
daelomin/env4
|
/common/softwares/templates/scripts/launch.sh
|
UTF-8
| 3,225 | 3.46875 | 3 |
[] |
no_license
|
#!/bin/bash
#--------init ENV-----------
. /etc/profile.d/modules.sh
module purge
# must come after module purge (else reset!)
export MODULEPATH=/cm/shared/modulefiles:$MODULEPATH
echo "MODULEPATH=" $MODULEPATH
echo "MODULE LIST loaded before task:"
module list
module load use.own
module load taskcenter/common
## Uncomment this, if you wish to use a module
#MYMODULE=$1
# Comment this, if you wish to use a module
MYMODULE="notneeded"
if [ -z "$MYMODULE" ]; then
echo "Missing task module! Aborting!"
exit 1
else
module load $MYMODULE
#export EXPNAME=INDO_3DOM_v1
echo "Using $MYMODULE !"
fi
##########################################################
## EDIT HERE!!!
##########################################################
USERDIR=$PWD
## The NAME of the PACK for this task. (DO NOT INCLUDE PATH!)
## Will be downloaded locally
## in the temporary execution directory of the task. This file should
## be generated through the make_task_tar.sh command (following a
## create_task_structure.sh command and proper editing)
PACK=./T_ATM_TASK.tgz
## The Master script / executable within the PACK
MASTER=master.sh
##########################################################
## NO EDITING NECESSARY BELOW THIS LINE
##########################################################
. $COMMON_HOME/bin/cips_bash_functions.sh
exportcipsfunctions
cb_host ## Host Banner
cb_start ## Start Banner
## Activate Debug mode on integration server
if [ $HOSTNAME == "cipsinteg" ]; then
set -x
else # oper.q & others
set +x
fi
## Check if DMT_PATH_EXEC is set
if [ -z "$DMT_PATH_EXEC" ]; then
if [ ! -z "$USERDIR" ]; then
DMT_PATH_EXEC=$USERDIR
else
echo "No USERDIR or DMT_PATH_EXEC is set. Aborting"
exit 1
fi
fi
echo "#########################################################"
echo ""
echo "SOURCE DIRECTORY IS DMT_PATH_EXEC = $DMT_PATH_EXEC"
echo "WORKING DIRECTORY IS PWD = " $PWD
echo "DATE IS DMT_DATE_PIVOT = $DMT_DATE_PIVOT"
echo "DMT_LOG = $DMT_LOG"
echo "SMSNODE = $SMSNODE"
echo "SCRATCHDIR = $SCRATCHDIR"
echo "TASK_MODULE = $MYMODULE"
echo ""
echo "SLURM_JOB_ID = $SLURM_JOB_ID"
echo ""
echo "#########################################################"
## For automatic reporting of errors to Zabbix
function zabbix_sender {
key=$1
value=$2
HOSTNAME=`hostname -s`
Z=/usr/sbin/zabbix_sender
if [ -z "$SHARED_HOME" ]; then
export SHARED_HOME=/shared
fi
$Z -z zabbixsrv -s $HOSTNAME -k "$key" -o "$value" >> $SHARED_HOME/zabbix/logs/opertasks_crashes.log
}
## Set-up task directories
export TASK_MAIN=$PWD
export TASK_IN=$PWD/input
export TASK_OUT=$PWD/out
export TASK_RESOURCES=$PWD/resources
export TASK_BIN=$PWD/bin
export TASK_RUN=$PWD/run
## copy the PACK to workdir
cp $DMT_PATH_EXEC/${PACK} .
## untar the PACK
tar xmfvz ${PACK}
## link all files in run directory
cd $TASK_RUN
## launch the MASTER script
$TASK_BIN/$MASTER
if [ $? != 0 ]; then
echo "Error(s) detected in MASTER script. Please see execution logs"
echo "Aborting and sending to SMS..."
exit 1
smsabort
#zabbix-sender taskcrasho
zabbix_sender "cips.task.error" "The Following Task has crashed : $PACK"
fi
echo "cd $TASK_MAIN"
## CIPS Task End Banner
cb_end ## End Banner
| true |
128f243dea968d3f8a44ce34254b8e45aeae31ec
|
Shell
|
William-LP/aKa
|
/aKa.sh
|
UTF-8
| 811 | 3.875 | 4 |
[] |
no_license
|
add() {
shift
alias=$1
command=$2
if [ $# -lt 2 ]; then
if [ $# -eq 0 ]; then
echo -n "Enter your alias name and press enter [ENTER]: "
read alias
fi
echo -n "Enter an associated command for $alias and press enter [ENTER]: "
read command
fi
echo $alias : $command > aKa.list
exit
}
help() {
cat help
}
remove() {
echo remove
}
list() {
cat aKa.list
}
version() {
echo version
}
main() {
if [ $# -eq 0 ]; then
help
fi
while [ $# -ne 0 ];do
if [ "$1" = "--add" ] || [ "$1" = "-a" ]; then
add $*
elif [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
help
elif [ "$1" = "--remove" ] || [ "$1" = "-r" ];then
remove
elif [ "$1" = "--list" ] || [ "$1" = "-l" ]; then
list
elif [ "$1" = "--version" ]; then
version
else
help
fi
shift
done
}
main $*
| true |
e4aad1f2cba2ea949f15d9f692c5e675b939b7c1
|
Shell
|
raghu147/Workspaces
|
/a8/sort.sh
|
UTF-8
| 879 | 3.140625 | 3 |
[] |
no_license
|
input=$1
output=$2
publicDNS=$(cat publicDNS.txt)
listOfDNS="$publicDNS"
count=0
#echo ${#source[@]}
for i in $(echo $listOfDNS | tr " " "\n")
do
count=$(($count+1))
done
if [ $count -eq 2 ]
then
ports="8000 8001"
fi
if [ $count -eq 8 ]
then
ports="8000 8001 8002 8003 8004 8005 8006 8007"
fi
serverNumber=0
for i in $(echo $listOfDNS | tr " " "\n")
do
if [ $serverNumber -ne 0 ]
then
ssh -oStrictHostKeyChecking=no -i "key.pem" ec2-user@$i "java -jar Climate.jar $count $serverNumber $input $output 7777 $ports"
fi
serverNumber=$(($serverNumber+1))
done
serverNumber=0
for i in $(echo $listOfDNS | tr " " "\n")
do
if [ $serverNumber -eq 0 ]
then
ssh -oStrictHostKeyChecking=no -i "key.pem" ec2-user@$i "java -jar Climate.jar $count $serverNumber $input $output 7777 $ports"
fi
serverNumber=$(($serverNumber+1))
done
#sh -c 'nohup ./dostuff > dev/null 2>&1 &'
| true |
662fef5b52ceb04d798e3da03ab7a40a10a4f8fc
|
Shell
|
jtalks-org/jtalks-infra
|
/templates/default/confluence.service.erb
|
UTF-8
| 456 | 3.484375 | 3 |
[] |
no_license
|
#!/bin/bash
# Start and stop Confluence server
CONFLUENCE_DIRECTORY=<%= @dir %>
case "$1" in
start)
$CONFLUENCE_DIRECTORY/bin/start-confluence.sh
echo started.
exit 0
;;
stop)
$CONFLUENCE_DIRECTORY/bin/stop-confluence.sh
echo stopped.
exit 0
;;
restart)
$0 stop
sleep 5
$0 start
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
| true |
b0f58a81f6559a2488cbfe0cfd411251d2aad8c7
|
Shell
|
Cesar-Hack-Gray/release-download
|
/install_infectador
|
UTF-8
| 1,276 | 2.609375 | 3 |
[] |
no_license
|
#!/bin/bash
apt update &>> install.log
if [ -e /data/data/com.termux/files/usr/bin ]; then
if [ -e $PREFIX/lib/apktool.jar ]; then
rm $PREFIX/lib/apktool.jar
fi
if [ -e $PREFIX/bin/apktool ]; then
rm $PREFIX/bin/apktool
fi
if [ -e $PREFIX/bin/dalvikvm ]; then
sed -i "s/export/#export/g" $PREFIX/bin/dalvikvm
fi
cd $HOME/infectador-framework
wget https://raw.githubusercontent.com/Cesar-Hack-Gray/infectador-framework/master/apktool &>> install.log
wget https://raw.githubusercontent.com/Cesar-Hack-Gray/infectador-framework/master/apktool.jar &>> install.log
mv $HOME/infectador-framework/apktool $PREFIX/bin/
mv $HOME/infectador-framework/apktool.jar $PREFIX/lib/
chmod 700 $PREFIX/bin/apktool
chmod 700 $PREFIX/lib/apktool.jar
if [ -e /data/data/com.termux/files/home/metasploit-framework ]; then
Cesar='/data/data/com.termux/files/home/metasploit-framework'
fi
if [ -e /data/data/com.termux/files/usr/opt/metasploit-framework ]; then
Cesar='/data/data/com.termux/files/usr/opt/metasploit-framework'
fi
if [ -e $Cesar/lib/msf/core/payload/apk.rb ]; then
mv $Cesar/lib/msf/core/payload/apk.rb $Cesar/lib/msf/core/payload/apk.rb.0
wget https://raw.githubusercontent.com/Cesar-Hack-Gray/release-download/master/apk.rb &>> install.log
fi
else
apt update &>> install.log
fi
| true |
cc9d20061db8682300c7a53e0ca35f40a4e08af4
|
Shell
|
walidKH007/Scripting
|
/synchro.sh
|
UTF-8
| 2,426 | 3.46875 | 3 |
[] |
no_license
|
#!/bin/bash
##################C2#######################
####### add_files.sh###########
echo " The files/directories that you want to add for synchronization are : $* "
for i in $*
do
cp $i dossier2/
done
echo " le dossier est pour pour se synchronizer "
####### file_update.sh#####
#!/bin/bash
var=`rsync -avun /root/dossier2 root@10.0.2.17:/root/sync | grep -v sent | grep -v total | grep -v sending | sed 1d`
if [ $? -eq 0 ]; then
echo -e "les fichiers qui sont mise a jour sont : \n$var "
else
echo "pas de modifs "
fi
#### sync_files.sh (with log) ########
rsync -av --update --progress --log-file=C2.log /root/dossier2 root@10.0.2.17:/root/sync
if [ $? -eq 0 ]; then
echo "Files are synced successfully "
else
echo "Error while running the command"
fi
#########################C3###########################
####### add_files.sh###########
echo " The files/directories that you want to add for synchronization are : $* "
for i in $*
do
cp $i dossier3/
done
echo " le dossier est pour pour se synchronizer "
####### file_update.sh#####
#!/bin/bash
var=`rsync -avun /root/dossier3 root@10.0.2.17:/root/sync | grep -v sent | grep -v total | grep -v sending | sed 1d`
if [ $? -eq 0 ]; then
echo -e "les fichiers qui sont mise a jour sont : \n$var "
else
echo "pas de modifs "
fi
#### sync_files.sh (with log) ########
rsync -av --update --progress --log-file=C3.log /root/dossier3 root@10.0.2.17:/root/sync
###################### Host Script ##########################
###### Add_files_sync.sh####
#!/bin/bash
#### Adding file for syncing in C2 And C3 ###########
echo "Files to add to sync repository in C2 :"
#lxc-attach -n C2 -- /root/./add_files.sh f1
lxc-attach -n C2 -- bash /root/add_files.sh /root/f1
echo "Files to add to sync repository in C3 :"
#lxc-attach -n C3 -- /root/./add_files.sh file1
lxc-attach -n C3 -- bash /root/add_files.sh /root/file1
echo "Files are Added successfuly to sync repository"
######## files_sync.sh #########
#!/bin/bash
echo "*******Sync process in C2*******"
lxc-attach -n C2 -- /root/./sync_files.sh
echo "*******Sync process in C3*******"
lxc-attach -n C3 -- /root/./sync_files.sh
#######version_files_sync.sh#########
#!/bin/bash
##### Testing the version of Files in C1,C2 and C3
echo "****** In C2 *******"
lxc-attach -n C2 -- /root/./file_update.sh
echo "****** In C3 *******"
lxc-attach -n C3 -- /root/./file_update.sh
| true |
e72ff7fcad4d9da090c8748610abd0d4d228abb6
|
Shell
|
pkgix/pkgix-repo
|
/pkgs/util/pigz
|
UTF-8
| 143 | 2.546875 | 3 |
[] |
no_license
|
metapkg=util/pigz-2.2.5
version=2.2.5
description="Metapackage for pigz"
satisfied() {
which pigz &> /dev/null
}
# vim: set ft=sh :
| true |
ffa068ad8c83695a6af9d97953d9f469e263c1ad
|
Shell
|
magabytarv/pruebaEmpleados
|
/modules/utils/server_structure.sh
|
UTF-8
| 257 | 3.390625 | 3 |
[] |
no_license
|
#!/bin/bash
function create_server_structure()
{
server_dir="../server/application/modules"
server_folders_module=(models views controllers)
for item in ${server_folders_module[*]}
do
mkdir -p $server_dir/$modulo/$item;
done
}
| true |
9f599200e7ea9611b2425f2db28773004be58bb5
|
Shell
|
wangzheng422/operator-metering
|
/images/helm-operator/add-label.sh
|
UTF-8
| 269 | 2.796875 | 3 |
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
set -e
set -u
: "${FAQ_BIN:=faq}"
export PRUNE_LABEL_KEY=${1:?}
export PRUNE_LABEL_VALUE=${2:?}
# shellcheck disable=SC2016
"$FAQ_BIN" \
-f yaml -o yaml -r -M \
'select(. != null) | .metadata.labels[$ENV.PRUNE_LABEL_KEY]=$ENV.PRUNE_LABEL_VALUE'
| true |
fbd56a34c77f2b48b4b12c75e22f16f68851f868
|
Shell
|
garygriswold/SafeBible
|
/OBSOLETE/Server/deploy.sh
|
UTF-8
| 331 | 2.59375 | 3 |
[
"MIT",
"LicenseRef-scancode-public-domain"
] |
permissive
|
#!/bin/sh
SERVER=cloud.shortsands.com
export COPYFILE_DISABLE=true # exclude Mac OSX resource forks (._*)
tar -cvf server.tar --exclude='.DS_Store' www
scp -P7022 server.tar root@$SERVER:/root/Server
ssh root@$SERVER -p7022 "cd /root/Server; tar -xvf server.tar"
echo "Login to server and tail /root/Server/www/server.log"
| true |
936c32631156a7713ac8c9c3a97cc4ab9d9d907f
|
Shell
|
Mazic4/Information-Retrival-Yelp
|
/rename-deps.sh
|
UTF-8
| 219 | 3.203125 | 3 |
[] |
no_license
|
#!/bin/bash
BASE=$(dirname $0)
TARGET="$BASE/target/scala-2.11/HLTA-assembly-1.1-deps.jar"
if [[ -e $TARGET ]]; then
mv $TARGET $BASE/target/scala-2.11/HLTA-deps.jar
else
echo "$TARGET does not exist."
exit -1
fi
| true |
1f3a47e680419f0ca2f8de1d1fe2ee894aadffd8
|
Shell
|
patrickgardella/rpi-motd
|
/10-load-avg
|
UTF-8
| 1,492 | 4.125 | 4 |
[] |
no_license
|
#!/bin/bash
#
# Function to place text at left side of box and and put some '#'s around it
left(){
SP=$(( 62 - ${#1} ))
# put message together (formatted left-side message)
FLM=" # $1"$(printf %"$SP"s)"#"
}
#
# get system information
## system load
load=$(awk '{print $1}' /proc/loadavg)
#
## memory use
memUse=$(awk '/^MemTotal:/ {total=$2} /^MemFree:/ {free=$2} /^Buffers:/ {buffers=$2} /^Cached:/ {cached=$2} END { printf("%3.1f%%", (total-(free+buffers+cached))/total*100)}' /proc/meminfo)
#
## up time
UT=$(awk '{$0=$1} {FS="."; $0=$0; print $1}' < /proc/uptime)
# convert seconds to days/hours/minutes
DAYS=$(($UT / 86400));REM=$(($UT-( $DAYS * 86400 )))
HOURS=$(($REM / 3600));REM=$(($REM-( $HOURS * 3600 )))
MINS=$(($REM / 60))
#
# single / plural text
if [ $DAYS == 0 ]; then DTXT=""
elif [ $DAYS == 1 ]; then DTXT="$DAYS day,"
else DTXT="$DAYS days,"
fi
#
if [ $HOURS == 0 ]; then HTXT=""
elif [ $HOURS == 1 ]; then HTXT="$HOURS hour and"
else HTXT="$HOURS hours and"
fi
#
if [ $MINS == 0 ]; then MTXT=""
elif [ $MINS == 1 ]; then MTXT="$MINS minute"
else MTXT="$MINS minutes"
fi
upTime="$DTXT $HTXT $MTXT"
#
## number of running processes
procs=$(/bin/ls -d /proc/[0-9]* | wc -l)
#
left "Load: $load ... Memory usage: $memUse ... Processes: $procs"
MSG1="$FLM"
left "Uptime: $upTime"
MSG2="$FLM"
#
# end of pre-processing
#
echo -e "$MSG1"
echo -e "$MSG2"
echo " # #"
| true |
eec554b404d255c27105bf3726c7542751a5f576
|
Shell
|
hringriin/dotfiles
|
/bash/shutdown.bash
|
UTF-8
| 875 | 3.46875 | 3 |
[] |
no_license
|
#!/bin/bash
# shutdown i3 or arch linux
i3exit="Exit i3"
shutdownc="Shutdown computer"
rebootc="Reboot computer"
case $(echo -e "${i3exit}\n${shutdownc}\n${rebootc}" | rofi -dmenu -markup-rows -i -p "What to do?") in
${i3exit})
if [[ $(echo -e "No\nYes" | rofi -dmenu -markup-rows -i -p "Really ${i3exit}?") == "Yes" ]] ; then
i3-msg exit
fi
;;
${shutdownc})
if [[ $(echo -e "No\nYes" | rofi -dmenu -markup-rows -i -p "Really ${shutdownc}?") == "Yes" ]] ; then
shutdown -h now
fi
;;
${rebootc})
if [[ $(echo -e "No\nYes" | rofi -dmenu -markup-rows -i -p "Really ${rebootc}?") == "Yes" ]] ; then
reboot
fi
;;
"") # in case the escape key is pressed
;;
*)
notify-send --icon=warning "Unrecognized Command" "Doing nothing"
esac
| true |
719536ca0fd101eca6aff80aaeaabe207d9f6c16
|
Shell
|
aapon00/LTB2021
|
/pbs/one_node_experiment.pbs
|
UTF-8
| 2,406 | 3.40625 | 3 |
[] |
no_license
|
#!/bin/bash
#PBS -N DICELAB_one_node_iot_run
#PBS -l select=1:ncpus=16:chip_type=e5-2665:interconnect=fdr:mem=60gb,walltime=00:30:00,place=pack
#PBS -j oe
#PBS -q workq
######################################################
#$TMPDIR is used to access local_scratch -> /local_scratch/pbs.$PBS_JOBID/
#if [ ! -z "$PARAMETER_LOC" ]; then PARAMETER_LOC=/zfs/dicelab/DigitalPlant/bash_scripts/parameters.list; fi
#REPO=$(cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" && git rev-parse --show-toplevel)
#Declare constants
REPO=/zfs/dicelab/DigitalPlant
echo $REPO is repo
#the results parent directory
RESULTS=$REPO/results
if [[ ! -d $TMPDIR ]]; then
echo "Setting TMPDIR to ."
TMPDIR=./
fi
#TMPDIR=./ #to use system tmpdir, keep commented
GENERATE_DATA_LOC=$REPO/C_Synthetic_Data_Generator/cmake/generate_data
PARAMETER_LOC=$REPO/bash_scripts/parameters.list
DRIVER_SCRIPT_LOC=$REPO/bash_scripts/run_multiple_sensors.sh
CONN_LOC=$REPO/connection_strings/connection_strings_10000.list
echo $PARAMETER_LOC $GENERATE_DATA_LOC $CONN_LOC $DRIVER_SCRIPT_LOC
#Create folder in /local_scratch, timestamped and with the node name
FOLDER=$(echo $(date +"%B_%d_%H_%M_%S")_$HOSTNAME | cut -d . -f 1)
#Create final results folder
mkdir $RESULTS/$FOLDER/
if [[ ! -d $RESULTS/$FOLDER ]]; then
echo "Failed to create final results folder at $RESULTS/$FOLDER"
exit 1
fi
#Create temp logging folder
mkdir $TMPDIR/$FOLDER
if [[ ! -d $TMPDIR/$FOLDER ]]; then
echo "Failed to create log folder"
exit 1
fi
#CHANGE DIR to logging folder
cd $TMPDIR/$FOLDER
mkdir logs
echo $PARAMETER_LOC $GENERATE_DATA_LOC $CONN_LIST_LOC $DRIVER_SCRIPT_LOC >> log.out
#Copy files to /local_scratch
cp $PARAMETER_LOC ./parameters
cp $GENERATE_DATA_LOC ./generate_data
cp $DRIVER_SCRIPT_LOC ./driver.sh
cp $CONN_LOC ./conn.list
#Confirm everything got coppied
#TODO
#Possible assert statement?
#See what's running. Ignoring root
ps aux | grep -v root >> log.out
#Set up enviornment | gcc and spack
module load gcc/8.2.0
source /zfs/dicelab/whalabi/spack/share/spack/setup-env.sh
spack load azureiot@LTS_05_2020_Ref01
ls -al >> log.out
#Run script. Also time it.
time /bin/bash ./driver.sh ./parameters ./conn.list ./logs ./generate_data >> log.out 2>> log.err
#Move files to results, and then clean up
rm *.list ./generate_data ./driver.sh
mv * $RESULTS/$FOLDER
#Catch anything left
rm -rf $TMPDIR/$FOLDER
| true |
5b2229ef8411297a14174d555e52e53749d06318
|
Shell
|
wont/recommendsystem
|
/tools/mysql.sh
|
UTF-8
| 734 | 3.171875 | 3 |
[] |
no_license
|
#!/bin/bash
if [ -z $1 ];then
echo 'USAGE:CONTENTTITLEAND FILENAME'
exit 0
fi
filename=result
echo "">$filename
URL=(`sed -n 's/.*>\(.*\)<\/url>/\1/p' $1`)
DOCNO=(`sed -n 's/.*>\(.*\)<\/docno>/\1/p' $1`)
CONTENTTITLE=(`sed -n 's/.*>\(.*\)<\/contenttitle>/\1/p' $1`)
CONTENT=(`sed -n 's/.*>\(.*\)<\/content>/\1/p' $1`)
FILE=(`ls -l $filename >/dev/null 2>&1 | awk '{print $8}'`)
if [ ! -z $FILE ];then
#echo -e "host\t\toidgroupname\t\tcomm\t\tdesc" >$filename
DD=""
fi
for((i=0;i<${#URL[@]};i++));do
#echo -e "${URL[i]}\t${DOCNO[i]}\t${CONTENTTITLE[i]}\t\t${CONTENT[i]}" >>$filename
echo "insert into news (url,docno,contenttitle,content)values('${URL[i]}','${DOCNO[i]}','${CONTENTTITLE[i]}','${CONTENT[i]}');" >>$filename
done
| true |
01462f2001bf67cca4039fde842f34e4acede2cc
|
Shell
|
petronny/aur3-mirror
|
/lyx-svn/PKGBUILD
|
UTF-8
| 1,086 | 2.609375 | 3 |
[] |
no_license
|
# Contributor: Adria Arrufat <swiftscythe@gmail.com>
pkgname=lyx-svn
pkgver=40284
pkgrel=1
pkgdesc="An advanced open-source document processor."
arch=(i686 x86_64)
url='http://www.lyx.org'
depends=('qt' 'texlive-core' 'python' 'perl' 'imagemagick' 'aspell' 'aiksaurus' 'boost')
optdepends=('texlive-latex3: pdf export')
makedepends=('bc' 'cmake' 'subversion')
license=('GPL')
source=('lyx.desktop' 'lyx.png')
md5sums=('c11db315dc99254a4118827f98922623'
'fcbfb9c9d4716f69ae8c64cf13e9a6fb')
_svntrunk=svn://svn.lyx.org/lyx/lyx-devel/trunk
_svnmod=lyx
build() {
svn co $_svntrunk $_svnmod
msg "SVN checkout done or server timeout"
msg "Starting make..."
export PYTHON=python2
cp -r $_svnmod $_svnmod-build
cd $_svnmod-build/
./autogen.sh
./configure --prefix=/usr \
--with-frontend=qt4 --enable-build-type=release
make || return 1
make -j 2 DESTDIR=${pkgdir} install || return 1
# install desktop entry
install -Dm644 ${srcdir}/lyx.desktop \
${pkgdir}/usr/share/applications/lyx.desktop || return 1
cp ${srcdir}/lyx.png ${pkgdir}/usr/share/lyx/images/lyx.png
}
| true |
086520cc7f8533777fad8a72587afdb9583e2bec
|
Shell
|
tacmath/corewar
|
/corewar/scriptos/testos.sh
|
UTF-8
| 956 | 3.6875 | 4 |
[] |
no_license
|
#!/bin/bash
if [ ! -d "../cor" ]
then
echo "cor folder is missing"
exit
fi
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
arr=(../cor/*)
error=0
nb=1
if [ $# -gt 0 ]
then
if [ $1 -gt $nb ]
then
nb=$1
fi
fi
if [ $# -gt 1 ]
then
if [ $2 -gt $nb ]
then
nb=$2
fi
fi
for (( n=0; n<$nb; n++ ))
do
p1=$((RANDOM%${#arr[@]}))
p2=$((RANDOM%${#arr[@]}))
p3=$((RANDOM%${#arr[@]}))
p4=$((RANDOM%${#arr[@]}))
echo ${arr[$p1]} "VS" ${arr[$p2]} "VS" ${arr[$p3]} "VS" ${arr[$p4]}
../corewar ${arr[$p1]} ${arr[$p2]} ${arr[$p3]} ${arr[$p4]} -v > .tmp1
../../resources/corewar ${arr[$p1]} ${arr[$p2]} ${arr[$p3]} ${arr[$p4]} -v 31 > .tmp2
diff .tmp1 .tmp2 > resdiff
if [ $? -eq 0 ]
then
echo "${GREEN}OK${NC}"
else
echo "${RED}/!\\KO/!\\${NC}"
((error++))
fi
done
if [ $error -eq 0 ]
then
echo ${GREEN}
else
echo ${RED}
fi
echo "\033[1mErrors = $error / $nb${NC}\033[0m"
if [ "$1" = "-d" ]
then
rm -rf .tmp1 .tmp2 resdiff
fi
exit $error
| true |
5ef43e3dbcf4657281d02f32177cee3963eaaec4
|
Shell
|
cstoribal/SFF_Algorithm
|
/src/scripts/script_parallel.sh
|
UTF-8
| 1,592 | 3.390625 | 3 |
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
#!/bin/bash
##include <stdio.h>
#Only if usefull, for instance if this location is RAM
cp ./SFFDataMgmt /data/tmp/
cp ./ProjSFF /data/tmp/
### The actual program
run_command() {
prog_param="/data/tmp/SFFDataMgmt -M "
prog_sff="/data/tmp/ProjSFF -optf "$2" -D "
linecode=$prog_param""$1" -f "$3
echo $linecode
eval $linecode
mkdir ${1%??????????}
cd ${1%??????????}
mkdir $4
cd $4 #enter subfolders. Caution, it is actually 3 leveled-subfolder
linecode=$prog_sff""$3
echo $linecode
eval $linecode
cd ..
cd ..
cd ..
}
export -f run_command
# Logging the output of each sample (all parameters)
convert_and_run() {
sampname=${3##*/}
sampname=${sampname%?????????}
parallel -j 1 --resume-failed --joblog ./exp/log/$4/$sampname.log run_command ::: $1 ::: $2 ::: $3 ::: $4
}
export -f convert_and_run
#LIST_FOLD=( "customseries/" "Semireal/semireal_mb4/" "Semireal/semireal_mb2/" "Semireal/semireal_mb1/" "Semireal/semireal_mb3/" "Simulations/simu4/" "Simulations/simu5/" "Simulations/s96serie/" "Simulations/")
LIST_FOLD=( "Semireal/semireal_mb4/" "Semireal/semireal_mb1/")
LIST_PARAMS=("./exp/*.param.txt")
opt_param=" 0 "
mkdir "./exp"
mkdir "./exp/log"
for fold in ${LIST_FOLD[*]}
do
subdir=${fold//\//_}
subdir=${subdir%?}
LIST_SAMP=("/data/data/Stage/Samples/"$fold*.txt)
mkdir ./exp/log/$subdir
parallel -j 6 --resume-failed --joblog ./exp/log/$subdir.log convert_and_run ::: "${LIST_PARAMS[*]}" ::: $opt_param ::: ${LIST_SAMP[*]} ::: $subdir
done
cd ./exp
../concatenate.sh
cd ..
| true |
fffb6a340800402c7531af1257499df218f6e8a4
|
Shell
|
xfhxfh1212/starcoin
|
/scripts/coverage_report.sh
|
UTF-8
| 2,454 | 3.875 | 4 |
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
# Check that the test directory and report path arguments are provided
if [ $# -lt 2 ] || ! [ -d "$1" ]; then
echo "Usage: $0 <testdir> <outdir> [--batch]"
echo "All tests in <testdir> and its subdirectories will be run to measure coverage."
echo "The resulting coverage report will be stored in <outdir>."
echo "--batch will skip all prompts."
exit 1
fi
# User prompts will be skipped if '--batch' is given as the third argument
SKIP_PROMPTS=0
if [ $# -eq 3 ] && [ "$3" == "--batch" ]; then
SKIP_PROMPTS=1
fi
# Set the directory containing the tests to run (includes subdirectories)
TEST_DIR=$1
# Set the directory to which the report will be saved
COVERAGE_DIR=$2
# This needs to run in starcoin
STARCOIN_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
if [ "$(pwd)" != "$STARCOIN_DIR" ]; then
echo "Error: This needs to run from starcoin/, not in $(pwd)" >&2
exit 1
fi
#set -e
# Check that grcov is installed
if ! [ -x "$(command -v grcov)" ]; then
echo "Error: grcov is not installed." >&2
if [ $SKIP_PROMPTS -eq 0 ]; then
read -p "Install grcov? [yY/*] " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ "$0" == "$BASH_SOURCE" ]] && exit 1 || return 1
fi
cargo install grcov
else
exit 1
fi
fi
# Check that lcov is installed
if ! [ -x "$(command -v lcov)" ]; then
echo "Error: lcov is not installed." >&2
echo "Documentation for lcov can be found at http://ltp.sourceforge.net/coverage/lcov.php"
echo "If on macOS and using homebrew, run 'brew install lcov'"
exit 1
fi
# Warn that cargo clean will happen
if [ $SKIP_PROMPTS -eq 0 ]; then
read -p "Generate coverage report? This will run cargo clean. [yY/*] " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ "$0" == "$BASH_SOURCE" ]] && exit 1 || return 1
fi
fi
# Set the flags necessary for coverage output
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off"
export RUSTC_BOOTSTRAP=1
export CARGO_INCREMENTAL=0
export RUST_MIN_STACK=8388608 # 8 * 1024 * 1024
echo check ulimits
ulimit -a
# Clean the project
echo "Cleaning project..."
(
cd "$TEST_DIR"
cargo clean
)
# Run tests
echo "Running tests..."
cargo xtest --html-lcov-dir="${COVERAGE_DIR}" --no-fail-fast --lib -j 10 || true
echo "Done. Please view report at ${COVERAGE_DIR}/index.html"
| true |
18ab8379c59b620b949f1af8a29c07b371498847
|
Shell
|
siorifriendsprojects/siorifriends
|
/laradock.sh
|
UTF-8
| 1,011 | 3.8125 | 4 |
[] |
no_license
|
#!/bin/bash
# author : Alucky4423
# Laradock の相対パス
LARADOCK_PATH=".laradock/"
up () {
docker-compose up -d nginx phpmyadmin
}
down () {
docker-compose down
}
exeCommand () {
docker-compose exec workspace $*
}
showHelp () {
cat << EOS
Usage:
laradock [option] <command_name>
Option:
-h, --help このhelpを表示する。
Commands:
up laradock を起動する。
down laradock を終了する。
up, down 以外のcommandを渡すと、
laradock_workspace にcommand が渡され、実行されます。
Examples:
./laradock.sh php artisan make:controller
./laradock.sh php artisan migrate
./laradock.sh vendor/bin/phpunit
のヮの
EOS
}
# validate
# 引数が0かhelpオプションなら、helpを表示
if [ "$#" == "0" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
showHelp
exit 0
fi
pushd $LARADOCK_PATH >& /dev/null
if [ "$1" == "up" ] || [ "$1" == "down" ]; then
eval "$1"
else
exeCommand $*
fi
popd >& /dev/null
| true |
6332c48fdb19fde10bce714bb2da9a02c21caf31
|
Shell
|
terlar/dotfiles
|
/bin/.local/bin/ssh-install-terminfo
|
UTF-8
| 284 | 3.078125 | 3 |
[] |
no_license
|
#!/usr/bin/env bash
[[ "${TRACE}" ]] && set -x
set -eu
set -o pipefail
main() {
local host="${1?host was not provided}"
# shellcheck disable=2016
local cmd='cat > "$TERM.info" && tic -x "$TERM.info"'
# shellcheck disable=2029
infocmp -x | ssh -t "${host}" "${cmd}"
}
main "$@"
| true |
a632147bb159787ef631d99dd9f94f2584691e3d
|
Shell
|
Markus-FN/omnios-wiki
|
/Attachments/ssl_services_to_restart.sh
|
UTF-8
| 464 | 3.421875 | 3 |
[] |
no_license
|
#!/bin/bash
# Find a list of services to restart when OpenSSL libraries are updated.
ctids=(
$(for i in `pgrep -z $(zonename)`; do \
pldd $i 2>&1 | \
egrep -e 'lib(ssl|crypto).so' >/dev/null && \
ps -octid -p $i | \
sed -e '1d; s/[^0-9]//g;' ; done | \
sort -n | uniq)
)
length=`expr ${#ctids[@]} - 1`
elems=$(eval echo {0..$length})
for index in $elems; do \
svcs -o fmri,ctid -a | egrep "[^0-9]${ctids[$index]}$" | awk '{ print $1 }'
done
| true |
e237f56d81e8f42a3ce8ff12caa6b4aafe5605b6
|
Shell
|
clojerl/asdf-clojerl
|
/bin/install
|
UTF-8
| 677 | 3.59375 | 4 |
[] |
no_license
|
#!/usr/bin/env bash
set -Eeuo pipefail
printf "Installing clojerl %s\n" "$ASDF_INSTALL_VERSION"
if [[ "$ASDF_DOWNLOAD_PATH" == "" ]] ; then
tmpdir="$(mktemp -d -t 'asdf_XXXXXXXXXX')"
export ASDF_DOWNLOAD_PATH="$tmpdir"
trap 'rm -rf "$ASDF_DOWNLOAD_PATH"' EXIT
"$(dirname "$0")/download"
fi
cp -R "${ASDF_DOWNLOAD_PATH}/." "$ASDF_INSTALL_PATH"
# Build from source in a subshell because we don't want to disturb current working dir
# Reference: https://github.com/asdf-vm/asdf-elixir/blob/master/bin/install#L64
(
cd "$ASDF_INSTALL_PATH" || exit;
make
)
if [ $? -ne 0 ]; then
echo "Build failed, cleaning..."
rm -rf "$ASDF_INSTALL_PATH"
exit 1
fi
| true |
1eddf3daeaf37dd08cb097d7a52237c5820ebcd6
|
Shell
|
wrenth04/download-scripts
|
/bilibili/bilibili-v2.sh
|
UTF-8
| 1,360 | 3.28125 | 3 |
[
"MIT"
] |
permissive
|
#!/bin/bash
AGENT="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36"
url="$1"
html=$(cat data.html)
series_title=${html#*series_title\":\"}; series_title=${series_title%%\"*}
x=${html#*epList}
x2=${x#*\"aid\":}
while [ "$x" != "$x2" ]; do
avid=${x2%%,*}
cid=${x2#*cid\":}, cid=${cid%%,*}
ep_id=${x2#*ep_id\":}, ep_id=${ep_id%%,*}
title=${x2#*index_title\":\"}, title=${title%%\"*}
ep=${x2#*\"index\":\"}, ep=${ep%%\"*}
ep=$((ep+100)); ep=${ep#1}
api="https://api.bilibili.com/pgc/player/web/playurl?avid=$avid&cid=$cid&qn=0&type=&otype=json&ep_id=$ep_id&fnver=0&fnval=16"
json=$(wget -O - -q -U "$AGENT" "https://api.bilibili.com/pgc/player/web/playurl?avid=$avid&cid=$cid&qn=0&type=&otype=json&ep_id=$ep_id&fnver=0&fnval=16")
echo "$title"
echo "$json"
i=0
y=${json}
y2=${y#*\"url\":\"}
while [ "$y" != "$y2" ]; do
video=${y2%%\"*}
id=$((i+100)); id=${id#1}
echo "$id $video"
file="tmp-$id.tmp"
if [ $i = 0 ]; then
echo "file '$file'" > input.txt
else
echo "file '$file'" >> input.txt
fi
wget -O "$file" -U "$AGENT" "$video"
i=$((i+1))
y=${y2}
y2=${y#*\"url\":\"}
done
echo $files
ffmpeg -y -f concat -i input.txt -c copy "$series_title-$ep-$title.mp4"
x=${x2}
x2=${x#*\"aid\":}
done
| true |
8d613c89d696f819dc1a01cfc9cf60da12ea5e0b
|
Shell
|
ChengCat/L2
|
/bootstrap/buildl2
|
UTF-8
| 2,398 | 3.015625 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
#!/usr/bin/env bash
# Compile L2 program source into object files
../bin/bootstrapped_l2compile core-meta.l2 64-numbers-meta.l2 text-meta.l2 flow-meta.l2 list-meta.l2 ../bin/x86_64.o x86-64-linux-interface-meta.l2 lexer-meta.l2 elf-meta.l2 x86-64-object-meta.l2 expressions-meta.l2 x86-64-assembler-meta.l2 x86-64-generator-meta.l2 - x86-64-linux-interface.l2 lexer.l2 x86-64-object.l2 expressions.l2 x86-64-assembler.l2 preparer.l2 x86-64-generator.l2 compile.l2 list.l2 64-numbers.l2
# Each produced object file is wrapped in an anonymous function to initialize it. Hence print out labels for them:
echo $'.globl x8664linuxinterfaceo\n.text\nx8664linuxinterfaceo:\n' > "x86-64-linux-interface.s"
echo $'.globl lexero\n.text\nlexero:\n' > "lexer.s"
echo $'.globl x8664objecto\n.text\nx8664objecto:\n' > "x86-64-object.s"
echo $'.globl expressionso\n.text\nexpressionso:\n' > "expressions.s"
echo $'.globl x8664assemblero\n.text\nx8664assemblero:\n' > "x86-64-assembler.s"
echo $'.globl preparero\n.text\npreparero:\n' > "preparer.s"
echo $'.globl x8664generatoro\n.text\nx8664generatoro:\n' > "x86-64-generator.s"
echo $'.globl compileo\n.text\ncompileo:\n' > "compile.s"
echo $'.globl listo\n.text\nlisto:\n' > "list.s"
echo $'.globl numbers64o\n.text\nnumbers64o:\n' > "64-numbers.s"
# Print out some assembly to call each initializer one by one
echo $'.globl _start\n.text\n_start:\ncall x8664linuxinterfaceo\ncall lexero\ncall x8664objecto\ncall expressionso\ncall x8664assemblero\ncall preparero\ncall x8664generatoro\ncall listo\ncall numbers64o\ncall compileo\n' > "start.s"
# Link everything together, including x86_64.o which contains system interface
gcc -nostdlib x86-64-linux-interface.s x86-64-linux-interface.o lexer.s lexer.o x86-64-object.s x86-64-object.o expressions.s expressions.o x86-64-assembler.s x86-64-assembler.o preparer.s preparer.o x86-64-generator.s x86-64-generator.o compile.s compile.o list.s list.o 64-numbers.s 64-numbers.o ../bin/x86_64.o start.s -o ../bin/bootstrapped_l2compile
# Remove the scaffolding
rm "x86-64-linux-interface.s" "lexer.s" "x86-64-object.s" "expressions.s" "x86-64-assembler.s" "preparer.s" "x86-64-generator.s" "compile.s" "list.s" "64-numbers.s" "x86-64-linux-interface.o" "lexer.o" "x86-64-object.o" "expressions.o" "x86-64-assembler.o" "preparer.o" "x86-64-generator.o" "compile.o" "list.o" "64-numbers.o" "start.s"
| true |
5869f13a0178c3a6d8ac716e25529181875c5643
|
Shell
|
artus/azure-bigchaindb-templates
|
/run.sh
|
UTF-8
| 537 | 3.390625 | 3 |
[] |
no_license
|
#!/bin/bash
# Artus Vranken
# ======================================================
#
# BigchainDB deployment templates for azure help-script.
#
# ======================================================
VARIABLES="$(pwd)/etc/variables.sh";
DEPLOYMENT="$1";
#
# Start
#
case "$DEPLOYMENT" in
single-simple)
cd "development/single-simple";
bash "single-simple.sh";
;;
az-single-simple)
cd "development/single-simple";
bash az-single-simple.sh $2 $3 $4;
;;
*)
echo "No valid deployment specified...";
exit 1;
;;
esac;
| true |
4fc0962d228932b18cb4c6cef6340e7bc98bbabd
|
Shell
|
ampproject/amphtml
|
/validator/js/chromeextension/package_extension.sh
|
UTF-8
| 756 | 3.15625 | 3 |
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash -ex
#
# A script to package only the necessary files of the extension.
echo "Building chrome extension"
./build_extension.sh
echo "Packaging chrome extension"
VERSION=$(egrep "\"version\":" manifest.json | cut -d\" -f4)
zip -r extension-"$VERSION".zip ./ -x bower.json build_extension.sh \
icon-64.png package_extension.sh polymer.html polymer-extension-toolbar.html \
popup-validator.html popup-validator-not-present.html \
promotional-440.png README.md screenshot-chrome-1.png \
screenshot-chrome-2.png screenshot-opera-1.png screenshot-opera-2.png
echo "Removing generated files"
rm popup-validator.build.html popup-validator.build.js
rm popup-validator-not-present.build.html popup-validator-not-present.build.js
echo "Done"
| true |
944762a8df4c6a604495912c657ca4832664f7b5
|
Shell
|
nearff99/llvm-obfuscator-arm
|
/bin/arm-linux-gnueabihf-clang++
|
UTF-8
| 2,297 | 2.90625 | 3 |
[
"MIT",
"NCSA",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
#!/usr/bin/env bash
# Copyright (C) 2017-2018 Swift Navigation Inc.
# Contact: Swift Navigation <dev@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
if [[ "${LLVM_OBF_USE_BR_TOOLCHAIN}" ]]; then
T=${HOST_DIR}/opt/ext-toolchain
export LD_LIBRARY_PATH="${T}/lib/gcc/arm-linux-gnueabihf/6.2.1"
TOOLCHAIN_OPTS="\
--sysroot=${T}/arm-linux-gnueabihf/libc \
\
-fuse-ld=${T}/arm-linux-gnueabihf/bin/ld \
\
-B ${T}/lib/gcc/arm-linux-gnueabihf/6.2.1/ \
\
-I ${T}/arm-linux-gnueabihf/include/c++/6.2.1/ \
-I ${T}/arm-linux-gnueabihf/include/c++/6.2.1/arm-linux-gnueabihf/ \
\
-L ${T}/lib/gcc/arm-linux-gnueabihf/6.2.1/ \
-L /piksi_buildroot/buildroot/host_output/host/opt/ext-toolchain/lib/gcc/i686-pc-linux-gnu/4.7.2 \
-Wno-unused-command-line-argument"
else
D=$( (cd `dirname $0`/../.. >/dev/null; pwd -P) )
R=$D/sysroot
export LD_LIBRARY_PATH="${R}/usr/lib/x86_64-linux-gnu:${R}/usr/x86_64-linux-gnu/arm-linux-gnueabihf/lib:${R}/usr/arm-linux-gnueabihf/lib:$LD_LIBRARY_PATH"
TOOLCHAIN_OPTS="\
\
-fuse-ld=${D}/wrappers/bin/arm-linux-gnueabihf-ld \
--sysroot=${R} \
\
-B ${R}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8 \
\
-I ${R}/usr/arm-linux-gnueabihf/include \
-I ${R}/usr/arm-linux-gnueabihf/include/c++/4.8.5 \
-I ${R}/usr/arm-linux-gnueabihf/include/c++/4.8.5/arm-linux-gnueabihf \
\
-L ${R}/usr/arm-linux-gnueabi/libhf \
-L ${R}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8 \
-L ${R}/usr/lib/x86_64-linux-gnu \
-L ${R}/usr/x86_64-linux-gnu/arm-linux-gnueabihf/lib \
-L ${R}/usr/arm-linux-gnueabihf/lib \
\
-Wl,-rpath-link=${R}/usr/arm-linux-gnueabi/libhf \
-Wl,-rpath-link=${R}/usr/arm-linux-gnueabihf/lib \
\
-Wno-unused-command-line-argument"
fi
exec ${D}/bin/clang++ \
${TOOLCHAIN_OPTS} \
-ccc-gcc-name arm-linux-gnueabihf-gcc \
--target=arm-linux-gnueabihf \
-mfloat-abi=hard \
-mcpu=cortex-a9 \
$@
| true |
39b89c606187cb00c4e23c72f0c7dc794a13aa1a
|
Shell
|
pieczon/sw2017-2018
|
/zadanie1-2.sh
|
UTF-8
| 298 | 3.515625 | 4 |
[] |
no_license
|
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Wymgana liczba argumentów to 2"
elif [ $# -eq 2 ]; then
echo "Wypisanie dwóch napisów: $1 i $2"
echo "Zapisywanie informacji: $1, do pliku o nazwie: $2"
touch $2
echo "$1">$2
else echo "Błędna liczba parametrów, wprowadz min. 2 parametry!"
fi
exit 0
| true |
66ffa39a3e2aa232999b270df49cf0561ffe3098
|
Shell
|
timotalvitie/git_bash_scripts
|
/git_batch_pull.sh
|
UTF-8
| 691 | 3.96875 | 4 |
[] |
no_license
|
#!/bin/bash
echo "--Start"
RED='\033[1;31m'
GREEN='\033[1;32m'
YELLOW='\033[1;33m'
NOCOLOR='\033[0m'
for d in */; do
printf "${NOCOLOR}Checking $d..."
cd $d
# Check if the current directory is a git directory
if git rev-parse --git-dir > /dev/null 2>&1
then
# Get the output message (combined stdout and stderr) and status code
PULL_OUTPUT="$(git pull 2>&1)"
PULL_STATUS=$?
if [[ $PULL_STATUS == 1 ]]
then
printf "${RED} ERROR - "
else
printf "${GREEN} OK - "
fi
printf "${PULL_OUTPUT}"
else
printf "${YELLOW} SKIPPED -not a git repository"
fi
echo ""
cd ..
done
printf "${NOCOLOR}"
echo "--Done."
| true |
3f9504b953dbae2369abb087f6b528541b227560
|
Shell
|
amitv87/EC20CEFAG
|
/ql-ol-sdk/ql-ol-rootfs/usr/kernel-tests/modsign/modsign_test.sh
|
UTF-8
| 3,915 | 3.328125 | 3 |
[] |
no_license
|
# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if [ -d /system/lib/modules/ ]; then
modpath=/system/lib/modules
cp $modpath/modsign_test_module.ko /data/modsign_test_module.ko
modpath=/data
elif [ -d /kernel-tests/modules/lib/modules/$(uname -r)/extra ]; then
modpath=/kernel-tests/modules/lib/modules/$(uname -r)/extra
elif [ -d /kernel-tests/modules/lib/modules/$(uname -r)-dirty/extra ]; then
modpath=/kernel-tests/modules/lib/modules/$(uname -r)-dirty/extra
fi
modsign_test_module=${modpath}/modsign_test_module.ko
modsign_test_module_name=modsign_test_module
test_result=1
if [ $# -ne 0 ];then
while [ $# -gt 0 ]
do
case $1 in
-n | --nominal | -r | --repeatability | -a | --adversarial | -s | --stress)
shift 1
;;
-h | --help | *)
echo "Usage: $0 [-n | --nominal] [-r | --repeatability] [-a | --adversarial] [-s | --stress]"
exit 1
;;
esac
done
fi
modsign_test() {
if [ ! -d $modpath ]; then
echo "ERROR: Couldn't find a path to the kernel module."
test_result=1
return;
fi
# remove modsign_test_module before test
lsmod | grep "$modsign_test_module_name"
if [ $? -eq 0 ]; then
rmmod $modsign_test_module > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: failed to remove module $modsign_test_module_name"
test_result=1
return;
fi
fi
insmod $modsign_test_module
if [ $? -ne 0 ]; then
echo "ERROR: failed to load module $modsign_test_module_name"
test_result=1
return;
fi
rmmod $modsign_test_module > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: failed to remove module $modsign_test_module_name"
test_result=1
return;
fi
sed -i '1s/^/z/' $modsign_test_module
insmod $modsign_test_module
if [ $? -eq 0 ]; then
echo "ERROR: $modsign_test_module_name signed module got loaded even after being modified."
test_result=1
return;
fi
sed -i '1s/.//' $modsign_test_module
insmod $modsign_test_module
if [ $? -ne 0 ]; then
echo "ERROR: failed to load module $modsign_test_module_name"
test_result=1
return;
fi
# remove modsign_test_module after test
rmmod $modsign_test_module > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: failed to remove module $modsign_test_module_name"
test_result=1
return;
fi
test_result=0
return;
}
modsign_test
if [ $? -ne 0 ]; then
exit 1
fi
if [ "$test_result" -eq "0" ]; then
echo "Test passed"
exit 0
else
echo "Test failed"
exit 1
fi
| true |
6dec4c76f784b381bacecd0c3d497b69046c9d94
|
Shell
|
madris112/Blockchain-Ration-System
|
/backend/scripts/generate.sh
|
UTF-8
| 1,619 | 2.640625 | 3 |
[] |
no_license
|
#!/bin/bash
ls
cd ..
export IMAGE_TAG=1.4
echo "Generating cryto material for peers..."
mkdir ./channel-artifacts
cryptogen generate --config=./crypto-config.yaml
echo "Generating channel artifacts and genesis block..."
configtxgen -profile LEANOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
configtxgen -profile LEANChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mainchannel
CURRENT_DIR=$PWD
cd ./base
cp docker-compose-base-template.yaml docker-compose-base.yaml
OPTS="-i"
cd $CURRENT_DIR
cd ./crypto-config/peerOrganizations/central_gov.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
cd ./base
sed $OPTS "s/CA1_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-base.yaml
cd $CURRENT_DIR
cd ./crypto-config/peerOrganizations/state_gov.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
cd ./base
sed $OPTS "s/CA2_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-base.yaml
cd $CURRENT_DIR
cd ./crypto-config/peerOrganizations/district_office.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
cd ./base
sed $OPTS "s/CA3_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-base.yaml
cd $CURRENT_DIR
cd ./crypto-config/peerOrganizations/ration_shops.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
cd ./base
sed $OPTS "s/CA4_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-base.yaml
cd $CURRENT_DIR
cd ./crypto-config/peerOrganizations/citizens.example.com/ca/
PRIV_KEY=$(ls *_sk)
cd $CURRENT_DIR
cd ./base
sed $OPTS "s/CA5_PRIVATE_KEY/${PRIV_KEY}/g" docker-compose-base.yaml
cd $CURRENT_DIR
cd ./scripts
bash ./auxiliary/ccp-generate.sh
Install Go dependencies
bash ./auxiliary/go-mod.sh
| true |
33843d81d22d708ec5985f3d4c7deff730f81489
|
Shell
|
csb1024/djinn_csb
|
/tonic-suite/experiment.sh
|
UTF-8
| 6,749 | 3.390625 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
# DIRS
ROOT_DIR=$HOME/org/djinn-1.0
SERVER_DIR=$ROOT_DIR/service
CLIENT_DIR=$ROOT_DIR/tonic-suite
MON_DIR=$HOME/git/gpu-cloud/monitor/cpp3
#SERVER SCRIPTS
GPU_SERVER_SH=$SERVER_DIR/executeServer.sh
CPU_SERVER_SH=$SERVER_DIR/executeCPUServer.sh
#CLIENT SCRIPTS
IMG_SH=$CLIENT_DIR/img/execImg_Djinn_no_mpi.sh
NLP_SH=$CLIENT_DIR/nlp/execNlp_Djinn_no_mpi.sh
#MONITOR BINARY
MON_BIN=nvml_mon
#Experiment related variables
#Experiment related variables
#MEANS=( '1' '0.1' '0.01' '0.00125')
MEANS=( '0.01')
means_num=${#MEANS[@]}
APPS=('dig' 'imc' 'face' 'ner' 'chk' 'pos')
#APPS=('dig' 'imc' 'face')
#APPS=('ner' 'chk' 'pos')
#APPS=('face')
apps_num=${#APPS[@]}
#FLAGS
mon_flag=0 # flag for running monitor
server_flag=0 # flag for starting up server
flag_1=0 # GPU_PEB , all_gpu
flag_2=0 # CON_PEB, fixed
flag_3=0 # PEB_PEB, fixed
flag_4=1 # EB_EB, fixed
# # of requests for this experiment
NREQ=5000
for ((i=0; i<${means_num}; i++))
do
mean=${MEANS[${i}]}
batch=1
#for mean in $MEANS
#do
ROOT_RESULT_DIR=$CLIENT_DIR/results/$mean
#####################
#1)experiment : GPU_PEB, all_GPU
#####################
if [ $flag_1 -eq 1 ]
then
RESULT_DIR=$ROOT_RESULT_DIR/ALL_GPU
mkdir -p $RESULT_DIR
#wait for previous server to fully shutdown
sleep 5
# start monitor if flag is setted
if [ $server_flag -eq 1 ]
then
# 1. start GPU s1rver
cd $SERVER_DIR
$GPU_SERVER_SH all_gpu PEB PEB &
# give some time to startup
sleep 15
# 2 warmup
echo "warmup for server"
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app 1 1 0
else
cd $CLIENT_DIR/img
$IMG_SH $app 1 1 0
fi
sleep 1
done
fi
# 3 the real experimnet
if [ $mon_flag -eq 1 ]
then
mon_num=4
for (( k=0; k<${mon_num}; k++ ))
do
$MON_DIR/$MON_BIN $RESULT_DIR 0 $k-log.txt &
mon_pids[${k}]=$!
done
sleep 2
fi
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app $NREQ $batch $mean &
else
cd $CLIENT_DIR/img
$IMG_SH $app $NREQ $batch $mean &
fi
pids[${h}]=$!
done
for pid in ${pids[*]}; do
wait $pid
done # pid
sleep 60
if [ $mon_flag -eq 1 ]
then
for mon_pid in ${mon_pids[*]}; do
kill -SIGINT $mon_pid
done #mon_pid
fi
# 4 stop server and clean up data
pkill djinn
mv $SERVER_DIR/log.txt $RESULT_DIR/gpu.csv
fi
#####################
#2) experiment : CON_PEB, fixed
#####################
if [ $flag_2 -eq 1 ]
then
RESULT_DIR=$ROOT_RESULT_DIR/CON_PEB
mkdir -p $RESULT_DIR
#wait for previous server to fully shutdown
sleep 5
# start monitor if flag is setted
if [ $server_flag -eq 1 ]
then
# 1. start GPU s1rver
cd $SERVER_DIR
$GPU_SERVER_SH fixed CON PEB &
# give some time to startup
sleep 15
# 2 warmup
echo "warmup for server"
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app 1 1 0
else
cd $CLIENT_DIR/img
$IMG_SH $app 1 1 0
fi
sleep 1
done
fi
# 3 the real experimnet
if [ $mon_flag -eq 1 ]
then
mon_num=4
for (( k=0; k<${mon_num}; k++ ))
do
$MON_DIR/$MON_BIN $RESULT_DIR 0 $k-log.txt &
mon_pids[${k}]=$!
done
sleep 2
fi
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app $NREQ $batch $mean &
else
cd $CLIENT_DIR/img
$IMG_SH $app $NREQ $batch $mean &
fi
pids[${h}]=$!
done
for pid in ${pids[*]}; do
wait $pid
done # pid
sleep 60
if [ $mon_flag -eq 1 ]
then
for mon_pid in ${mon_pids[*]}; do
kill -SIGINT $mon_pid
done #mon_pid
fi
# 4 stop server and clean up data
pkill djinn
mv $SERVER_DIR/log.txt $RESULT_DIR/gpu.csv
fi
#####################
#3) experiment : PEB_PEB , fixed
#####################
if [ $flag_3 -eq 1 ]
then
RESULT_DIR=$ROOT_RESULT_DIR/PEB_PEB
mkdir -p $RESULT_DIR
#wait for previous server to fully shutdown
sleep 5
# start monitor if flag is setted
if [ $server_flag -eq 1 ]
then
# 1. start GPU s1rver
cd $SERVER_DIR
$GPU_SERVER_SH fixed PEB PEB &
# give some time to startup
sleep 15
# 2 warmup
echo "warmup for server"
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app 1 1 0
else
cd $CLIENT_DIR/img
$IMG_SH $app 1 1 0
fi
sleep 1
done
fi
# 3 the real experimnet
if [ $mon_flag -eq 1 ]
then
mon_num=4
for (( k=0; k<${mon_num}; k++ ))
do
$MON_DIR/$MON_BIN $RESULT_DIR 0 $k-log.txt &
mon_pids[${k}]=$!
done
sleep 2
fi
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app $NREQ $batch $mean &
else
cd $CLIENT_DIR/img
$IMG_SH $app $NREQ $batch $mean &
fi
pids[${h}]=$!
done
for pid in ${pids[*]}; do
wait $pid
done # pid
sleep 60
if [ $mon_flag -eq 1 ]
then
for mon_pid in ${mon_pids[*]}; do
kill -SIGINT $mon_pid
done #mon_pid
fi
# 4 stop server and clean up data
pkill djinn
mv $SERVER_DIR/log.txt $RESULT_DIR/gpu.csv
fi
#####################
#4) experiment : EB_EB, fixed
#####################
if [ $flag_4 -eq 1 ]
then
RESULT_DIR=$ROOT_RESULT_DIR/EB_EB
mkdir -p $RESULT_DIR
#wait for previous server to fully shutdown
sleep 5
# start monitor if flag is setted
if [ $server_flag -eq 1 ]
then
# 1. start GPU s1rver
cd $SERVER_DIR
$GPU_SERVER_SH fixed EB EB &
# give some time to startup
sleep 15
# 2 warmup
echo "warmup for server"
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app 1 1 0
else
cd $CLIENT_DIR/img
$IMG_SH $app 1 1 0
fi
sleep 1
done
fi
# 3 the real experimnet
if [ $mon_flag -eq 1 ]
then
mon_num=4
for (( k=0; k<${mon_num}; k++ ))
do
$MON_DIR/$MON_BIN $RESULT_DIR 0 $k-log.txt &
mon_pids[${k}]=$!
done
sleep 2
fi
for (( h=0; h<${apps_num}; h++ ))
do
app=${APPS[${h}]}
if [ $app == 'ner' -o $app == 'pos' -o $app == 'chk' ]
then
cd $CLIENT_DIR/nlp
$NLP_SH $app $NREQ $batch $mean &
else
cd $CLIENT_DIR/img
$IMG_SH $app $NREQ $batch $mean &
fi
pids[${h}]=$!
done
for pid in ${pids[*]}; do
wait $pid
done # pid
sleep 60
if [ $mon_flag -eq 1 ]
then
for mon_pid in ${mon_pids[*]}; do
kill -SIGINT $mon_pid
done #mon_pid
fi
# 4 stop server and clean up data
pkill djinn
mv $SERVER_DIR/log.txt $RESULT_DIR/gpu.csv
fi
done #means
| true |
554e11ebe2c89ad644a647342485968f1010bbfc
|
Shell
|
123srinivas/srinivas
|
/ansible/postOS.sh
|
UTF-8
| 2,549 | 3.5625 | 4 |
[] |
no_license
|
#!/bin/bash
DIR=/apps/priv/sa-priv/webex-config
#check if anyone is running the ansible
if [ -f lockfile ]
then
cat lockfile
exit
fi
echo Please enter the hostname:
read hostname
echo Please enter yourid:
read userid
#export hostname
# print some output
echo please wait, doing authentication setup
# add fingerprint to Ansible Master
ssh -q sjbste219v "ssh-keyscan $hostname >> ~/.ssh/known_hosts"
# Create trust from Ansible Master
keystatus=`ssh -q $hostname 'grep sjbste219v /root/.ssh/authorized_keys; echo $?'|tail -n 1`
if [ $keystatus -ne 0 ]
then
scp -q $DIR/files/ssh-key.file $hostname:/tmp
ssh -q $hostname "cd /root/.ssh; cp -p authorized_keys authorized_keys.orig; cat /tmp/ssh-key.file >> /root/.ssh/authorized_keys; rm /tmp/ssh-key.file"
fi
# Add the host to Ansible Master
echo $hostname > hostname.file
echo $userid is working on $hostname > lockfile
scp -q hostname.file sjbste219v:/etc/ansible/hosts-history
ssh -q sjbste219v 'cd /etc/ansible/hosts-history; cp hosts.orig hosts; cat hostname.file >> hosts; date >> hosts-config-history; cat hostname.file >> hosts-config-history'
###update cfg-eth0 from DHCP to static IP
echo Do you want to update cfg-eth0 from DHCP to static IP? yes or no? it is case sensitive
read cfgeth0update
if [ $cfgeth0update = 'yes' ]
then
$DIR/scripts/eth0-config.sh
fi
###group and account creation
echo Do you want to create new group and account? yes or no? it is case sensitive
read accountcreation
if [ $accountcreation = 'yes' ]
then
$DIR/scripts/group_account_create.sh
fi
#if [ $accountcreation = 'no' ]
#then
#echo ok
#fi
###vintela installation
echo Do you want to install vintela and join domain? yes or no? it is case sensitive
read installvintela
if [ $installvintela = 'yes' ]
then
$DIR/scripts/vintela.sh
fi
### update /etc/resolv.conf
echo Do you want to update /etc/resolv.conf for webex? yes or no? it is case sensitive
read resolvconf
if [ $resolvconf = 'yes' ]
then
$DIR/scripts/resolvconf_webex.sh
fi
### setup cron to update time
echo Do you want to setup cron for time sync? yes or no? it is case sensitive
read timesync
if [ $timesync = 'yes' ]
then
$DIR/scripts/sync_ntp_cron.sh
fi
# Remove trust from Ansible Master and save the history
ssh -q $hostname "cd /root/.ssh; cp -p authorized_keys.orig authorized_keys"
# Remove the /etc/ansible/hosts-history/hosts file in master
ssh -q sjbste219v 'rm /etc/ansible/hosts-history/hosts; rm /etc/ansible/hosts-history/hostname.file'
# Remove the hostname.file and lockfile
rm hostname.file
rm lockfile
| true |
a566042afd59fcc72b63278fe26093efa44f4f8c
|
Shell
|
MyMirelHub/macos-setup
|
/config-files/.zshrc
|
UTF-8
| 1,965 | 2.9375 | 3 |
[] |
no_license
|
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes for others
ZSH_THEME="agnoster"
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
# User configuration
source $ZSH/oh-my-zsh.sh
#Setting gogole cloud SDK in path and enabling autocomplete
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'
# Setting Shell default user text
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)Megalawls"
fi
}
# ssh
export SSH_KEY_PATH="~/.ssh/rsa_id"
#Aliases
#Git aliases
alias 'branch'="git branch -avv --color"
#Docker aliases
alias kilall='docker rm $(docker ps -a -q)'
alias removeall='docker rmi -f $(docker images -q)'
alias nukeall='docker rm $(docker ps -a -q) && docker rmi -f $(docker images -q) || docker rmi -f $(docker images -q)'
#Always misspelling this shit
alias dicker='docker'
#Filesystem Aliases
alias ll="ls -lhaG"
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
#Kubernetes Aliases
alias k="kubectl"
alias po="kubectl get po"
alias pods="kubectl get po -w"
alias svc="kubectl get svc"
alias services="kubectl get svc -w"
alias contexts="kubectl config get-contexts"
alias ccontext="kubectl config use-context"
#Misc aliases
alias python="python3"
# Setting Shell default user text
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)Megalawls"
fi
}
| true |
37d0a81e2257fe64b5d0b6c6629eabdd218b1542
|
Shell
|
nkk0508/shell_script
|
/make_sequence/make_file.sh
|
UTF-8
| 1,828 | 3.484375 | 3 |
[] |
no_license
|
#!/usr/local/bin/bash
#while read lineをする対象のファイルは、最終行に空白行を入れないと、目的の最終行を読み込まない
#TARGET_FILE=`grep "AMAZON" ./tabledef/webshop11DB_create_ora_table.sql`
fileNumber=1
#while read line
#do
# echo V001_000_00${count}__$line.sql
# count=`expr ${count} + 1`
#
#done < ./tabledef/hitoketa
#while read line
#do
# touch V001_000_0${count}__$line.sql
# cat ./tabledef/$line.SQL >./V001_000_0${count}__$line.sql
# count=`expr ${count} + 1`
#done < ./tabledef/hutaketa
files="./specific_sequence/*"
fileary=()
dirary=()
count=377
for filepath in $files; do
if [ -f $filepath ] ; then
fileary+=("$filepath")
elif [ -d $filepath ] ; then
dirary+=("$filepath")
fi
done
#echo "ファイル一覧"
for i in ${fileary[@]}; do
paddingNumber=`printf %03d ${count}`
# fileName=`echo ${i} | cut -f 3 -d "/"`
cut_file_name=`echo ${i,,} | cut -f 3 -d "/"`
# echo ${i}
output_file_name=V001_002_${paddingNumber}__${cut_file_name}
# echo ${output_file_name}
# echo ${output_file_name,,}
# ora2pg -i $i -o ./init_output/V001_010_${paddingNumber}__${output_file_name,,} -t QUERY
cat ./specific_sequence/${cut_file_name} > ./${output_file_name}
count=$(expr $count + 1)
done
#echo "ディレクトリ一覧"
#for i in ${dirary[@]}; do
# echo $i
#done
#while read line
#do
# paddingNumber=`printf %03d ${fileNumber}`
## echo V001_006_${paddingNumber}__$line.sql
# touch V001_002_${paddingNumber}__$line.sql
# cat ./StoredProcedure/$line.SQL >./V001_006_${paddingNumber}__$line.sql
# fileNumber=`expr ${fileNumber} + 1`
#done < ./StoredProcedure/webshop11DB_create_procedure.sql
#cat ./tabledef/webshop11DB_create_ora_table.sql | sed -n '5,379p' | awk '$0 = substr($0, 3)'
#echo $TARGET_FILE
#cd $CURRENT_DIR/../../../
#./gradlew
| true |
3de98ca57fd23da6471df0c2defb45e74a5df349
|
Shell
|
barba99/barbs
|
/ferramentascodes
|
UTF-8
| 30,210 | 3.15625 | 3 |
[] |
no_license
|
#!bin/bash
fun_bar () {
comando="$1"
_=$(
$comando > /dev/null 2>&1
) & > /dev/null
pid=$!
while [[ -d /proc/$pid ]]; do
echo -ne " \033[1;33m["
for((i=0; i<10; i++)); do
echo -ne "\033[1;31m##"
sleep 0.2
done
echo -ne "\033[1;33m]"
sleep 1s
echo
tput cuu1
tput dl1
done
echo -e " \033[1;33m[\033[1;31m####################\033[1;33m] - \033[1;32m100%\033[0m"
sleep 1s
}
auto_add_user () {
#$1 = usuário
#$2 = senha
#$3 = limite
#$4 = data
if [ "$1" = "" ]; then
echo -e "${cor[4]} Usuario no restaurado"
var_exit="1"
fi
if [ "$2" = "" ]; then
echo -e "${cor[4]} Usuario no restaurado"
var_exit="1"
fi
if [ "$3" = "" ]; then
echo -e "${cor[4]} Usuario no restaurado"
var_exit="1"
fi
if [ "$4" = "" ]; then
echo -e "${cor[4]} Usuario no restaurado"
var_exit="1"
fi
if [ "$var_exit" = "1" ]; then
sleep 0.5s
unset var_exit
else
if [ "$OPENVPN" = "on" ]; then
open_1 $1 $2 30 $3 s
return
fi
useradd -M -s /bin/false $1 -e $4
(echo $2; echo $2) | passwd $1 2>/dev/null
echo -e "${cor[5]} $1 Creado Con Exito!"
echo -e "Usuario: $1"
echo -e "Senha: $2"
echo -e "Loguins: $3"
echo -e "Data: $4"
if [ -e $dir_user/$1 ]; then
rm $dir_user/$1
fi
touch $dir_user/$1
echo "senha: $senha" >> $dir_user/$1
echo "limite: $limite" >> $dir_user/$1
echo "data: $data" >> $dir_user/$1
fi
}
function_1 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} INICIANDO BACKUP"
echo -e "${cor[1]} =================================== ${cor[0]}"
for user in `awk -F : '$3 > 900 { print $1 }' /etc/passwd | grep -v "nobody" |grep -vi polkitd |grep -vi systemd-[a-z] |grep -vi systemd-[0-9]`; do
echo -e "${cor[5]} Copia de seguridad de usuarios"
echo -e "\033[1;31m $user"
if [ -e $dir_user/$user ]; then
pass=$(cat $dir_user/$user | grep "senha" | awk '{print $2}')
data=$(cat $dir_user/$user | grep "data" | awk '{print $2}')
limit=$(cat $dir_user/$user | grep "limite" | awk '{print $2}')
if [ "$pass" = "" ]; then
pass="ultimate"
fi
if [ "$data" = "" ]; then
data=$(date '+%C%y-%m-%d' -d "+30 days")
fi
if [ "$limit" = "" ]; then
limit="30"
fi
if [ ! -e "$HOME/adm-backup" ]; then
echo "$user $pass $limit $data" > /root/adm-backup
echo -e "${cor[4]} $user\n $pass\n $limit\n $data"
else
echo "$user $pass $limit $data" >> /root/adm-backup
echo -e "${cor[4]} $user\n $pass\n $limit\n $data"
fi
else
echo -e "${cor[5]} suario no registrado en Vps-Barba "
echo -e "${cor[5]} Introduzca la información del usuario"
read -p "©$user Contraseña actual: " pass
read -p "©$user Días De Duración: " datas2
number_var $datas2
if [ "$var_number" = "" ]; then
if [ -e $HOME/adm-backup ]; then
rm $HOME/adm-backup
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
return
else
datas="$var_number"
fi
data=$(date '+%C%y-%m-%d' -d "+$datas days")
read -p " ©$user Límite de conexión:" limit2
number_var $limit2
if [ "$var_number" = "" ]; then
if [ -e $HOME/adm-backup ]; then
rm $HOME/adm-backup
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
return
else
limit="$var_number"
fi
if [ ! -e "$HOME/adm-backup" ]; then
echo "$user $pass $limit $data" > /root/adm-backup
echo -e "${cor[4]} $user\n $pass\n $limit\n $data"
else
echo "$user $pass $limit $data" >> /root/adm-backup
echo -e "${cor[4]} $user\n $pass\n $limit\n $data"
fi
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
done
echo "admpro" >> $HOME/adm-backup
echo -e "${cor[5]} Copia de seguridad completa"
echo -e "${cor[5]} Back UDP disponible en la carpeta \033[1;36m$HOME/adm-backup! ${cor[0]}"
echo -e "${cor[1]} =================================== ${cor[0]}"
}
function_2 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} Ingresar el directorio de la copia de seguridad \nArchivo o enlace"
echo -e "${cor[1]} =================================== ${cor[0]}"
_ba="/root/adm-backup"
read -p "Archivo o enlace: " -e -i $_ba arq
[[ ! -e "$arq" ]] && {
cd $HOME
wget -O backup-adm $arq -o /dev/null
[[ ! -e "$HOME/backup-adm" ]] && echo -e "${cor[5]} ${txt[111]}" && return 1
[[ ! $(cat $HOME/backup-adm | egrep -o "admpro") ]] && echo -e "${cor[5]} Copia de seguridad incompatible con Vps-Barba" && return 1
arq_bkp="$HOME/backup-adm"
} || {
[[ ! $(cat $arq | egrep -o "admpro") ]] && echo -e "${cor[5]} Copia de seguridad incompatible con Vps-Barba" && return 1
arq_bkp="$arq"
}
echo -e "\033[1;37m Restauración ..."
cd /etc/adm-lite
while read backup_adm; do
[[ $(echo "$backup_adm" | egrep -o "admpro") ]] && break
usuario=$(echo "$backup_adm" | awk '{print $1}')
senha=$(echo "$backup_adm" | awk '{print $2}')
limite=$(echo "$backup_adm" | awk '{print $3}')
data=$(echo "$backup_adm" | awk '{print $4}')
echo -e "${cor[1]} =================================== ${cor[0]}"
auto_add_user "$usuario" "$senha" "$limite" "$data"
done < $arq_bkp
echo -e "${cor[1]} =================================== ${cor[0]}"
cd /etc/adm-lite
}
function_3 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} Esta Herramienta va a Limpiar Caches \n y eliminar los archivos temporales"
echo -e "${cor[1]} =================================== ${cor[0]}"
echo 3 > /proc/sys/vm/drop_caches
sysctl -w vm.drop_caches=3 > /dev/null 2>&1
rm -rf /tmp/*
echo -e "${cor[5]} Esta Herramienta va a Limpiar Caches\nProcedimiento completado"
echo -e "${cor[1]} =================================== ${cor[0]}"
}
function_4 () {
pid_badvpn=$(ps x | grep badvpn | grep -v grep | awk '{print $1}')
if [ "$pid_badvpn" = "" ]; then
echo -e "${cor[4]}Liberando Badvpn"
if [[ ! -e /bin/badvpn-udpgw ]]; then
wget -O /bin/badvpn-udpgw https://www.dropbox.com/s/nxf5s1lffmbikwq/badvpn-udpgw &>/dev/null
chmod 777 /bin/badvpn-udpgw
fi
screen -dmS screen /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 10
[[ "$(ps x | grep badvpn | grep -v grep | awk '{print $1}')" ]] && echo -e "BADVPN iniciado con éxito" || echo -e "Arquitectura no soportada"
else
echo -e "${cor[4]}Parando Badvpn"
msg -bar
kill -9 $(ps x | grep badvpn | grep -v grep | awk '{print $1'}) > /dev/null 2>&1
killall badvpn-udpgw > /dev/null 2>&1
[[ ! "$(ps x | grep badvpn | grep -v grep | awk '{print $1}')" ]] && echo -e "${cor[4]} BADVPN detenido con éxito"
unset pid_badvpn
fi
unset pid_badvpn
}
function_5 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} Este Script fue proyectado"
echo -e "${cor[4]} Para Mejorar La Latencia"
echo -e "${cor[4]} Y velocidad del servidor!"
echo -e "${cor[1]} =================================== ${cor[0]}"
sleep 1s
if [[ `grep -c "^#ADM" /etc/sysctl.conf` -eq 0 ]]; then
#INSTALA
echo -e "${cor[5]} Este es un script experimental"
echo -e "${cor[1]} =================================== ${cor[0]}"
read -p "Continuar con la instalación? [s/n]: " -e -i s resp_osta
if [[ "$resp_osta" = 's' ]]; then
unset resp_osta
echo "#ADM" >> /etc/sysctl.conf
echo "net.ipv4.tcp_window_scaling = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.ipv4.tcp_low_latency = 1
net.ipv4.tcp_slow_start_after_idle = 0" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf > /dev/null 2>&1
echo -e "${cor[5]} Configuración de red TCP"
echo -e "${cor[5]} se han agregado con éxito"
echo -e "${cor[1]} =================================== ${cor[0]}"
return
else
echo -e "${cor[1]} =================================== ${cor[0]}"
return
fi
else
#REMOVE
echo -e "${cor[5]} Configuración de red TCP"
echo -e "${cor[5]} Ya se han agregado en el sistema!"
echo -e "${cor[1]} =================================== ${cor[0]}"
read -p "Desea quitar la configuración TCP? [s/n]: " -e -i n res_posta
if [[ "$res_posta" = 's' ]]; then
unset res_posta
grep -v "^#ADM
net.ipv4.tcp_window_scaling = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.ipv4.tcp_low_latency = 1
net.ipv4.tcp_slow_start_after_idle = 0" /etc/sysctl.conf > /tmp/syscl && mv -f /tmp/syscl /etc/sysctl.conf
sysctl -p /etc/sysctl.conf > /dev/null 2>&1
echo -e "${cor[5]} Configuración de red TCP"
echo -e "${cor[5]} se han eliminado con éxito"
echo -e "${cor[1]} =================================== ${cor[0]}"
return
else
echo -e "${cor[1]} =================================== ${cor[0]}"
return
fi
fi
}
function_6 () {
source fai2ban
}
function_7 () {
echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} Caché de Squid no es más Que\n Un historial de navegación en Squid\n Que ahorrará datos al abrir sitios\n Alojados en su caché\n ¡El script hará una breve comprobación!"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
sleep 2s
if [ -e /etc/squid/squid.conf ]; then
squid_var="/etc/squid/squid.conf"
elif [ -e /etc/squid3/squid.conf ]; then
squid_var="/etc/squid3/squid.conf"
else
echo -e "${cor[5]} No se ha identificado Squid!"
return 1
fi
teste_cache="#CACHE DO SQUID"
if [[ `grep -c "^$teste_cache" $squid_var` -gt 0 ]]; then
[[ -e ${squid_var}.bakk ]] && {
echo -e "${cor[5]} Desactivando SquidCache !!\n esperar!"
mv -f ${squid_var}.bakk $squid_var
echo -e "${cor[5]} Reiniciando Servicios Espera!"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
service squid restart > /dev/null 2>&1
service squid3 restart > /dev/null 2>&1
return 0
}
fi
echo -e "${cor[5]} Squid esta Activo en tu sistema!\n ${cor[5]} No hay servicio de caché en el Squid!\n Activando el servicio SquidCache!"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
_tmp="#CACHE DO SQUID\ncache_mem 200 MB\nmaximum_object_size_in_memory 32 KB\nmaximum_object_size 1024 MB\nminimum_object_size 0 KB\ncache_swap_low 90\ncache_swap_high 95"
[[ "$squid_var" = "/etc/squid/squid.conf" ]] && _tmp+="\ncache_dir ufs /var/spool/squid 100 16 256\naccess_log /var/log/squid/access.log squid" || _tmp+="\ncache_dir ufs /var/spool/squid3 100 16 256\naccess_log /var/log/squid3/access.log squid"
while read s_squid; do
[[ "$s_squid" != "cache deny all" ]] && _tmp+="\n${s_squid}"
done < $squid_var
cp ${squid_var} ${squid_var}.bakk
echo -e "${_tmp}" > $squid_var
echo -e "${cor[5]} Reiniciando Servicios Espera!\n esperar!"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
service squid restart > /dev/null 2>&1
service squid3 restart > /dev/null 2>&1
}
fun_ip () {
MEU_IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
[[ "$MEU_IP" != "$MEU_IP2" ]] && echo "$MEU_IP2" || echo "$MEU_IP"
}
fun_trans () {
declare -A texto
[[ ! -e /etc/texto-adm ]] && touch /etc/texto-adm
source /etc/texto-adm
if [[ -z $(echo ${texto[$2]}) ]]; then
retorno="$(source trans -b pt:$1 "$2"|sed -e 's/[^a-z -]//ig')"
echo "texto[$2]='$retorno'" >> /etc/texto-adm
echo "$retorno"
else
echo "${texto[$2]}"
fi
}
function_8 () {
IP="$(fun_ip)"
echo -e "${cor[4]} [1] >${cor[3]} Colocar Arquivo Online"
echo -e "${cor[4]} [2] >${cor[3]} Remover Arquivo Online"
echo -e "${cor[4]} [3] >${cor[3]} Ver Links dos Arquivos Online"
echo -e "${cor[1]} =================================== ${cor[0]}"
while [[ ${arquivoonlineadm} != @([1-3]) ]]; do
read -p "[1-3]: " arquivoonlineadm
tput cuu1 && tput dl1
done
case ${arquivoonlineadm} in
3)
[[ -z $(ls /var/www/html) ]] && echo -e "$barra" || {
for my_arqs in `ls /var/www/html`; do
[[ "$my_arqs" = "index.html" ]] && continue
[[ "$my_arqs" = "index.php" ]] && continue
[[ -d "$my_arqs" ]] && continue
echo -e "\033[1;31m[$my_arqs] \033[1;36mhttp://$IP:81/$my_arqs\033[0m"
done
echo -e "${cor[1]} =================================== ${cor[0]}"
}
;;
2)
i=1
[[ -z $(ls /var/www/html) ]] && echo -e "$barra" || {
for my_arqs in `ls /var/www/html`; do
[[ "$my_arqs" = "index.html" ]] && continue
[[ "$my_arqs" = "index.php" ]] && continue
[[ -d "$my_arqs" ]] && continue
select_arc[$i]="$my_arqs"
echo -e "${cor[2]}[$i] > ${cor[3]}$my_arqs - \033[1;36mhttp://$IP:81/$my_arqs\033[0m"
let i++
done
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} Selecione o Arquivo a Ser Apagado"
echo -e "${cor[1]} =================================== ${cor[0]}"
while [[ -z ${select_arc[$slct]} ]]; do
read -p " [1-$i]: " slct
tput cuu1 && tput dl1
done
arquivo_move="${select_arc[$slct]}"
[[ -d /var/www/html ]] && [[ -e /var/www/html/$arquivo_move ]] && rm -rf /var/www/html/$arquivo_move > /dev/null 2>&1
[[ -e /var/www/$arquivo_move ]] && rm -rf /var/www/$arquivo_move > /dev/null 2>&1
echo -e "${cor[5]}Sucesso!"
echo -e "${cor[1]} =================================== ${cor[0]}"
}
;;
1)
i="1"
[[ -z $(ls $HOME) ]] && echo -e "$barra" || {
for my_arqs in `ls $HOME`; do
[[ -d "$my_arqs" ]] && continue
select_arc[$i]="$my_arqs"
echo -e "${cor[2]} [$i] > ${cor[3]}$my_arqs"
let i++
done
i=$(($i - 1))
echo -e "${cor[5]} seleccione el archivo"
echo -e "${cor[1]} =================================== ${cor[0]}"
while [[ -z ${select_arc[$slct]} ]]; do
read -p " [1-$i]: " slct
tput cuu1 && tput dl1
done
arquivo_move="${select_arc[$slct]}"
[ ! -d /var ] && mkdir /var
[ ! -d /var/www ] && mkdir /var/www
[ ! -d /var/www/html ] && mkdir /var/www/html
[ ! -e /var/www/html/index.html ] && touch /var/www/html/index.html
[ ! -e /var/www/index.html ] && touch /var/www/index.html
chmod -R 755 /var/www
cp $HOME/$arquivo_move /var/www/$arquivo_move
cp $HOME/$arquivo_move /var/www/html/$arquivo_move
echo -e "\033[1;36m http://$IP:81/$arquivo_move\033[0m"
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} Exito!"
echo -e "${cor[1]} =================================== ${cor[0]}"
}
;;
esac
}
function_9 () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} Inicio de pruebas, espere "
echo -e "${cor[1]} =================================== ${cor[0]}"
ping=$(ping -c1 google.com |awk '{print $8 $9}' |grep -v loss |cut -d = -f2 |sed ':a;N;s/\n//g;ta')
starts_test=$(python ./speedtest.py)
down_load=$(echo "$starts_test" | grep "Download" | awk '{print $2,$3}')
up_load=$(echo "$starts_test" | grep "Upload" | awk '{print $2,$3}')
echo -e "${cor[5]} Tiempo de respuesta Ping: $ping"
echo -e "${cor[5]} Velocidad de carga: $up_load"
echo -e "${cor[5]} Velocidad de carga: $down_load"
echo -e "${cor[1]} =================================== ${cor[0]}"
}
function_10 () {
null="\033[1;31m"
echo -e "${cor[1]} ============================================================================ ${cor[0]}"
if [ ! /proc/cpuinfo ]; then
echo -e "${cor[4]} Error al procesar información"
echo -e "${cor[1]} ============================================================================ ${cor[0]}"
return
fi
if [ ! /etc/issue.net ]; then
echo -e "${cor[4]} Error al procesar información"
echo -e "${cor[1]} ============================================================================ ${cor[0]}"
return
fi
if [ ! /proc/meminfo ]; then
echo -e "${cor[4]} Error al procesar información"
echo -e "${cor[1]} ============================================================================ ${cor[0]}"
return
fi
totalram=$(free | grep Mem | awk '{print $2}')
usedram=$(free | grep Mem | awk '{print $3}')
freeram=$(free | grep Mem | awk '{print $4}')
swapram=$(cat /proc/meminfo | grep SwapTotal | awk '{print $2}')
system=$(cat /etc/issue.net)
clock=$(lscpu | grep "CPU MHz" | awk '{print $3}')
based=$(cat /etc/*release | grep ID_LIKE | awk -F "=" '{print $2}')
processor=$(cat /proc/cpuinfo | grep "model name" | uniq | awk -F ":" '{print $2}')
cpus=$(cat /proc/cpuinfo | grep processor | wc -l)
if [ "$system" ]; then
echo -e "${cor[5]} Su Sistema: ${null}$system"
else
echo -e "${cor[5]} Su Sistema: ${null}???"
fi
if [ "$based" ]; then
echo -e "${cor[5]} basado: ${null}$based"
else
echo -e "${cor[5]} basado: ${null}???"
fi
if [ "$processor" ]; then
echo -e "${cor[5]} Procesador Físico ${null}$processor x$cpus"
else
echo -e "${cor[5]} Procesador Físico ${null}???"
fi
if [ "$clock" ]; then
echo -e "${cor[5]} Frecuencia de funcionamiento ${null}$clock MHz"
else
echo -e "${cor[5]} Frecuencia de funcionamiento ${null}???"
fi
echo -e "${cor[5]} Uso del procesador ${null}$(ps aux | awk 'BEGIN { sum = 0 } { sum += sprintf("%f",$3) }; END { printf " " "%.2f" "%%", sum}')"
echo -e "${cor[5]} Memoria Virtual Total ${null}$(($totalram / 1024))"
echo -e "${cor[5]} Memoria Virtual En uso ${null}$(($usedram /1024))"
echo -e "${cor[5]} Memoria Virtual Libre ${null}$(($freeram /1024))"
echo -e "${cor[5]} Memoria Virtual Swap ${null}$(($swapram /1024))MB"
echo -e "${cor[5]} Tiempo en línea ${null}$(uptime)"
echo -e "${cor[5]} Nombre de la máquina ${null}$(hostname)"
echo -e "${cor[5]} Dirección De la Maquina:${null}$(ip addr | grep inet | grep -v inet6 | grep -v "host lo" | awk '{print $2}' | awk -F "/" '{print $1}')"
echo -e "${cor[5]} Versiones del kernel ${null}$(uname -r)"
echo -e "${cor[5]} Arquitectura ${null}$(uname -m)"
echo -e "${cor[1]} ============================================================================ ${cor[0]}"
return
}
function_11 () {
payload="/etc/payloads"
if [ ! -f "$payload" ]; then
echo -e "${cor[5]} $payload ${txt[213]}"
echo -e "${cor[5]} ${txt[214]}"
return
fi
echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[2]} |1| >${cor[3]} Añadir Host a Squid"
echo -e "${cor[2]} |2| >${cor[3]} Quitar el host de Squid"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
read -p " | 1 - 2 |: " var_pay
number_var $var_pay
if [ "$var_number" = "" ]; then
echo -e "\033[1;31m Opción Invalida"
return
else
var_payload="$var_number"
fi
if [ "$var_payload" -gt "2" ]; then
echo -e "\033[1;31m Opción Invalida"
return
fi
if [ "$var_payload" = "1" ]; then
echo -e "${cor[4]} Añadir Host a Squid"
echo -e "${cor[5]} Dominios actuales en el archivo $payload:"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e " Escriba el Host-Squid que desea agregar"
echo -e "
read -p " Host: " hos
if [[ $hos != \.* ]]; then
echo -e "${cor[5]} Iniciando como el ejemplo: bughost.com"
return
fi
host="$hos/"
if [[ -z $host ]]; then
echo -e "${cor[5]} ${txt[221]}"
return
fi
if [[ `grep -c "^$host" $payload` -eq 1 ]]; then
echo -e "${cor[5]} ${txt[222]}"
return
fi
echo "$host" >> $payload && grep -v "^$" $payload > /tmp/a && mv /tmp/a $payload
echo -e "${cor[5]} ¡Éxito, Archivo Actualizado!"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
echo -e "${cor[1]} ====================================================== ${cor[0]}"
if [ ! -f "/etc/init.d/squid" ]; then
service squid3 reload > /dev/null 2>&1
service squid3 restart > /dev/null 2>&1
else
/etc/init.d/squid reload
service squid restart > /dev/null 2>&1
fi
return
fi
if [ "$var_payload" = "2" ]; then
echo -e "${cor[4]} Quitar el host de Squid"
echo -e "${cor[5]} Dominios actuales en el archivo $payload:"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
echo -e "${cor[1]} ====================================================== ${cor[0]}"
read -p " Escriba el dominio que desea quitar Iniciando con un ejemplo: .bughost.com": " hos
if [[ $hos != \.* ]]; then
echo -e "${cor[5]} Iniciando como este ejemplo bughost.com"
return
fi
host="$hos/"
if [[ -z $host ]]; then
echo -e "${cor[5]} ¡Esta vacío, no ha escrito nada!"
return
fi
if [[ `grep -c "^$host" $payload` -ne 1 ]]; then
echo -e "${cor[5]} dominio no encontrado"
return
fi
grep -v "^$host" $payload > /tmp/a && mv /tmp/a $payload
echo -e "${cor[5]} Éxito, Archivo Actualizado!"
echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
echo -e "${cor[1]} ====================================================== ${cor[0]}"
if [ ! -f "/etc/init.d/squid" ]; then
service squid3 reload > /dev/null 2>&1
service squid3 restart > /dev/null 2>&1
else
/etc/init.d/squid reload
service squid restart > /dev/null 2>&1
fi
return
fi
}
criar_pay () {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ESCRIBA UN HOST PARA CREAR"
echo -e "${cor[5]} PAYLOADS GENERAL"
echo -e "${cor[5]} CREADOR DE PAYLOADS"
echo -e "${cor[5]} ESCRIBA EL HOST"
echo -e "${cor[1]} =================================== ${cor[3]}"
read -p " => " valor1
if [ "$valor1" = "" ]; then
echo -e "${cor[5]} No escribio nada"
return
fi
meu_ip
valor2="$IP"
if [ "$valor2" = "" ]; then
valor2="127.0.0.1"
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ELEGIR CABECERA ${cor[3]}"
echo -e " 1-GET"
echo -e " 2-CONNECT"
echo -e " 3-PUT"
echo -e " 4-OPTIONS"
echo -e " 5-DELETE"
echo -e " 6-HEAD"
echo -e " 7-TRACE"
echo -e " 8-PROPATCH"
echo -e " 9-PATCH"
echo -e "${cor[1]} =================================== ${cor[3]}"
read -p " => " valor3
case $valor3 in
1)
req="GET"
;;
2)
req="CONNECT"
;;
3)
req="PUT"
;;
4)
req="OPTIONS"
;;
5)
req="DELETE"
;;
6)
req="HEAD"
;;
7)
req="TRACE"
;;
8)
req="PROPATCH"
;;
9)
req="PATCH"
;;
*)
req="GET"
;;
esac
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} Y POR ULTIMO"
echo -e "${cor[5]} METODO DE INYECCIÓN! ${cor[3]}"
echo -e " 1-realData"
echo -e " 2-netData"
echo -e " 3-raw"
echo -e "${cor[1]} =================================== ${cor[0]}"
read -p " => " valor4
case $valor4 in
1)
in="realData"
;;
2)
in="netData"
;;
3)
in="raw"
;;
*)
in="netData"
;;
esac
echo -e "${cor[1]} =================================== ${cor[0]}"
name=$(echo $valor1 | awk -F "/" '{print $2'})
if [ "$name" = "" ]; then
name=$(echo $valor1 | awk -F "/" '{print $1'})
fi
esquelet="/etc/adm-lite/payloads"
sed -s "s;realData;abc;g" $esquelet > $HOME/$name.txt
sed -i "s;netData;abc;g" $HOME/$name.txt
sed -i "s;raw;abc;g" $HOME/$name.txt
sed -i "s;abc;$in;g" $HOME/$name.txt
sed -i "s;get;$req;g" $HOME/$name.txt
sed -i "s;mhost;$valor1;g" $HOME/$name.txt
sed -i "s;mip;$valor2;g" $HOME/$name.txt
if [ "$(cat $HOME/$name.txt | egrep -o "$valor1")" = "" ]; then
echo -e ""
echo -e "${cor[3]} ALGO ESTA \033[1;36mMAL!"
rm $HOME/$name.txt
return
fi
echo -e "${cor[3]} EXITO!, PAYLOADS GENERADAS"
echo -e "${cor[3]} DIRECTORIO: \033[1;31m$HOME/$name.txt"
return
}
fun_bar () {
comando="$1"
(
[[ -e $HOME/fim ]] && rm $HOME/fim
$comando -y > /dev/null 2>&1
touch $HOME/fim
) & > /dev/null
echo -ne "\033[1;33m ["
while true; do
for((i=0; i<=10; i++)); do
echo -ne "\033[1;31m#"
sleep 0.3s
done
[[ -e $HOME/fim ]] && {
rm $HOME/fim
break
}
echo
echo -ne "\033[1;33m ["
done
echo -e "\033[1;33m]\033[1;31m -\033[1;32m 100%\033[1;37m"
}
vnc_fun () {
echo -e "${cor[1]} =================================== ${cor[0]}"
if [ -d /root/.vnc/ ];then
vnc=$(ls /root/.vnc/ | grep :1.pid)
else
vnc=""
fi
meu_ip
if [[ $vnc = "" ]]; then
echo -ne " ${txt[312]} [S/N]: "; read x
[[ $x = @(n|N) ]] && echo -e "${cor[1]} =================================== ${cor[0]}" && return
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " \033[1;36mInstalling VNC:"
fun_bar 'apt-get install xfce4 xfce4-goodies gnome-icon-theme tightvncserver'
echo -e " \033[1;36mInstalling DEPENDENCE:"
fun_bar 'apt-get install iceweasel'
echo -e " \033[1;36mInstalling FIREFOX:"
fun_bar 'apt-get install firefox'
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "\033[1;33m ${txt[308]}\033[1;32m"
echo -e "${cor[1]} =================================== ${cor[0]}"
vncserver
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " ${txt[309]} 5901"
echo -e " Ex: $IP:5901\033[1;32m"
echo -e " ${txt[310]} "
echo -e " ${txt[311]} VNC VIWER"
elif [[ $vnc != "" ]]; then
echo -e " ${txt[312]} [S/N]: "; read x
[[ $x = @(n|N) ]] && echo -e "${cor[1]} =================================== ${cor[0]}" && return
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " \033[1;36mremoving VNC:"
fun_bar 'apt-get purge xfce4 xfce4-goodies gnome-icon-theme tightvncserver'
echo -e "\033[1;36m removing DEPENDENCES:"
fun_bar 'apt-get purge iceweasel'
echo -e "\033[1;36m removing FIREFOX:"
fun_bar 'apt-get purge firefox'
vncserver -kill :1 > /dev/null
vncserver -kill :2 > /dev/null
vncserver -kill :3 > /dev/null
fi
echo -e "${cor[1]} =================================== ${cor[0]}"
}
block_torrent () {
mportas () {
unset portas
portas_var=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
while read port; do
var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
[[ "$(echo -e $portas|grep "$var1 $var2")" ]] || portas+="$var1 $var2\n"
done <<< "$portas_var"
i=1
echo -e "$portas"
}
fun_ip () {
MEU_IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
[[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" || IP="$MEU_IP"
}
barra="${cor[1]} =================================== ${cor[0]}"
[[ -e /etc/adm-lite/idioma_menuinst ]] && id="$(cat /etc/adm-lite/idioma_menuinst)" || id=pt
[[ $(iptables -h|wc -l) -lt 5 ]] && apt-get install iptables -y > /dev/null 2>-1
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
echo -e "$barra\n Essas configuracoes so Devem ser adicionadas"
echo -e "apos a vps estar totalmente configurada!\n$barra"
echo -e " Deseja Prosseguir?"
read -p " [S/N]: " -e -i n PROS
[[ $PROS = @(s|S|y|Y) ]] || return 1
fun_ip #Pega IP e armazena em uma variavel
#Inicia Procedimentos
#Parametros iniciais
echo 'iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACC/EPT
iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT' > ./torrent-adm
chmod +x ./torrent-adm
#libera DNS
echo 'iptables -A OUTPUT -p tcp --dport 53 -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -m state --state NEW -j ACCEPT' >> ./torrent-adm
#Liberar DHCP
echo 'iptables -A OUTPUT -p tcp --dport 67 -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p udp --dport 67 -m state --state NEW -j ACCEPT' >> ./torrent-adm
#Liberando Serviços Ativos
list_ips=$(mportas|awk '{print $2}')
while read PORT; do
echo "iptables -A INPUT -p tcp --dport $PORT -j ACCEPT
iptables -A INPUT -p udp --dport $PORT -j ACCEPT
iptables -A OUTPUT -p tcp --dport $PORT -j ACCEPT
iptables -A OUTPUT -p udp --dport $PORT -j ACCEPT
iptables -A FORWARD -p tcp --dport $PORT -j ACCEPT
iptables -A FORWARD -p udp --dport $PORT -j ACCEPT
iptables -A OUTPUT -p tcp -d $IP --dport $PORT -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p udp -d $IP --dport $PORT -m state --state NEW -j ACCEPT" >> ./torrent-adm
done <<< "$list_ips"
#Bloqueando Ping
echo 'iptables -A INPUT -p icmp --icmp-type echo-request -j DROP' >> ./torrent-adm
#Liberar WEBMIN
echo 'iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 10000 -j ACCEPT' >> ./torrent-adm
#Bloqueando torrent
echo "iptables -t nat -A PREROUTING -i $NIC -p tcp --dport 6881:6889 -j DNAT --to-dest $IP
iptables -A FORWARD -p tcp -i $NIC --dport 6881:6889 -d $IP -j REJECT
iptables -A OUTPUT -p tcp --dport 6881:6889 -j DROP
iptables -A OUTPUT -p udp --dport 6881:6889 -j DROP" >> ./torrent-adm
echo 'iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP
iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
iptables -A FORWARD -m string --algo bm --string "torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce" -j DROP
iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP
iptables -A FORWARD -m string --string "get_peers" --algo bm -j DROP
iptables -A FORWARD -m string --string "announce_peer" --algo bm -j DROP
iptables -A FORWARD -m string --string "find_node" --algo bm -j DROP' >> ./torrent-adm
./torrent-adm
echo -e "$barra\n Aplicado!\n$barra"
}
paybrute () {
chmod +x ./paysnd.sh
./paysnd.sh
}
function_16 () {
echo -e "${cor[3]} Realmente desea Reiniciar la VPS?"
read -p " [S/N]: " -e -i n rebt
[[ "$rebt" = @(s|S|y|Y) ]] && {
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "\033[1;36m Preparando para reiniciar VPS"
sleep 3s
echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "\033[1;36m OK"
sleep 1s
sudo reboot
}
}
[[ "$1" = "1" ]] && function_1
[[ "$1" = "2" ]] && function_2
[[ "$1" = "3" ]] && function_3
[[ "$1" = "4" ]] && function_4
[[ "$1" = "5" ]] && function_5
[[ "$1" = "6" ]] && function_6
[[ "$1" = "7" ]] && function_7
[[ "$1" = "8" ]] && function_8
[[ "$1" = "9" ]] && function_9
[[ "$1" = "10" ]] && function_10
[[ "$1" = "11" ]] && function_11
[[ "$1" = "12" ]] && criar_pay
[[ "$1" = "13" ]] && vnc_fun
[[ "$1" = "14" ]] && paybrute
[[ "$1" = "15" ]] && block_torrent
[[ "$1" = "16" ]] && function_16
####_Eliminar_Tmps_####
[[ -e $_tmp ]] && rm $_tmp
[[ -e $_tmp2 ]] && rm $_tmp2
[[ -e $_tmp3 ]] && rm $_tmp3
[[ -e $_tmp4 ]] && rm $_tmp4
| true |
273d6868c6b36930d416b2619ff8e31dee4268d1
|
Shell
|
randomn4me/bin
|
/radio
|
UTF-8
| 790 | 3.828125 | 4 |
[
"ISC"
] |
permissive
|
#!/bin/sh
PID_FILE=/tmp/radio
RADIO_FILE=$XDG_CACHE_HOME/radio
usage() {
cat << EOF
Usage: $(basename $0) [-hl] <station>
stations: dfl nova kultur
EOF
exit
}
start() {
mpv --quiet $URL > /dev/null 2>&1 &
echo $! > $PID_FILE
echo $URL > $RADIO_FILE
}
off() {
kill `cat $PID_FILE`
rm $PID_FILE
}
CMD=`echo $1 | tr '[:upper:]' '[:lower:]'`
case $CMD in
dlf) URL='https://st01.sslstream.dlf.de/dlf/01/128/mp3/stream.mp3' ;;
kultur) URL='https://st02.sslstream.dlf.de/dlf/02/128/mp3/stream.mp3' ;;
nova) URL='https://st03.sslstream.dlf.de/dlf/03/128/mp3/stream.mp3' ;;
0) test -f $PID_FILE && off && exit 1;;
h) usage ;;
*) test ! -f $RADIO_FILE && echo 'no radio file' && exit
URL="`cat $RADIO_FILE`" ;;
esac
test -f $PID_FILE && off
start
| true |
2289a35af213b57a167c15ad652dd43aa8efd837
|
Shell
|
Caesar-github/rk-rootfs-build
|
/overlay-debug/rockchip-test/ethernet/eth_test.sh
|
UTF-8
| 771 | 3.453125 | 3 |
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
DIR_ETH=/rockchip-test/ethernet
info_view()
{
echo "*****************************************************"
echo "*** ***"
echo "*** Ethernet TEST ***"
echo "*** ***"
echo "*****************************************************"
}
info_view
echo "***********************************************************"
echo "Ethernet delayline test: 1"
echo "***********************************************************"
read -t 30 ETH_CHOICE
ethernet_delayline_test()
{
bash ${DIR_ETH}/test_ethernet_delayline.sh
}
case ${ETH_CHOICE} in
1)
ethernet_delayline_test
;;
*)
echo "not fount your input."
;;
esac
| true |
255101262484531b36e236b560485886675c3c39
|
Shell
|
syncwerk/syncwerk-misc
|
/syncwerk-find-and-move-duplicates.sh
|
UTF-8
| 1,983 | 3.890625 | 4 |
[] |
no_license
|
#!/bin/bash
# Uncomment for verbose logging
# set -x
touch syncwerk-find-and-move-duplicates.log
# Enter each directory recursivly. Check if it contains duplicate files by calculating and comparing the inlcuded files md5 checksums. Saving result to dups_tmp0.txt
find "$(pwd)" -type d ! -name "syncwerk-found-duplicates" | while read dir ; do
find "${dir}" -maxdepth 1 -type f ! -size 0 -exec md5sum '{}' + | sort | uniq --all-repeated=separate -w 33 > dups_tmp0.txt
# Retrieving uniq md5 checksum from dups_tmp0.txt. Grepping the corresponding files for each checksum. Saving result to dups_tmp1.txt
awk '{ print $1 }' dups_tmp0.txt | sort | uniq | sed '/^\s*$/d' | while read dups ; do grep ${dups} dups_tmp0.txt | cut -c 35- > dups_tmp1.txt
# Initialize dups_tmp2.txt. Needs to be empty...
echo -n > dups_tmp2.txt
# Iterate through dups_tmp1.txt and calculate path length of each file. Save result to dups_tmp2.txt.
cat dups_tmp1.txt | while read dupfile ; do
echo ${dupfile} | awk '{ print length, $0 }' >> dups_tmp2.txt
done
# Remove any empty lines from dups_tmp2.txt
sed -i '/^\s*$/d' dups_tmp2.txt
# Sort by numbers and save result to dups_tmp3.txt
sort -n dups_tmp2.txt > dups_tmp3.txt
# Log which file we are keeping. FYI: We are keeping the file with the shortes path/name
echo $(date) - Original - $(cat dups_tmp3.txt | head -n +1 | cut -c 5-) | tee -a syncwerk-find-and-move-duplicates.log
# Move duplicate files to subfolder "duplicates" within the found directory. Log actions...
cat dups_tmp3.txt | tail -n +2 | cut -c 5- | while read delfile ; do
echo $(date) - Duplicate - /${delfile} moved to ${dir}/syncwerk-found-duplicates/ ; mkdir -p "${dir}/syncwerk-found-duplicates" ; mv /"${delfile}" "${dir}/syncwerk-found-duplicates/" ; done | tee -a syncwerk-find-and-move-duplicates.log
done
# Cleanup: Delete temp files
rm dups*.txt
done
echo Check syncwerk-find-and-move-duplicates.log for applied changes
| true |
9527d71d060e3f08604b69e2a6f680552a44c1ab
|
Shell
|
VishnuPillai135/Shell-Project
|
/Basic Git written in Shell/test12.sh
|
UTF-8
| 196 | 2.546875 | 3 |
[] |
no_license
|
#if one file exists and the other doesn't, still return error message
#for legit-add
#echo "legit-add: error: can not open '"$var"'"
touch a
sh legit-init
sh legit-add a b
rm -rf .legit
rm -rf a
| true |
f0d1fe04888ce607d48e4a64cbf4218565519e93
|
Shell
|
dataart-telco/restcomm-perf-test
|
/collectd-server/scripts/render_cpu.sh
|
UTF-8
| 793 | 2.765625 | 3 |
[] |
no_license
|
#!/bin/bash
host=$1
prefix=$2
file=$3/${host}_cpu.png
rrdtool graph $file \
-e now \
-s 'end-15m' \
-S 15 \
--title "Cpu usage" \
--vertical-label "Percents" \
--imgformat PNG \
--slope-mode \
--lower-limit 0 \
--upper-limit 100 \
--rigid \
-E \
-i \
--color SHADEA#FFFFFF \
--color SHADEB#FFFFFF \
--color BACK#CCCCCC \
-w 600 \
-h 150 \
--interlaced \
--font DEFAULT:8:/usr/local/share/rrdtool/fonts/ARIAL8.TTF \
DEF:system=/var/lib/collectd/rrd/$host/cpu/${prefix}-system.rrd:value:MAX \
DEF:user=/var/lib/collectd/rrd/$host/cpu/${prefix}-user.rrd:value:MAX \
DEF:wait=/var/lib/collectd/rrd/$host/cpu/${prefix}-wait.rrd:value:MAX \
AREA:wait#F44336:"Wait max":STACK \
AREA:system#4CAF50:"Sys max":STACK \
AREA:user#03A9F4:"User max":STACK
echo "File: $file"
| true |
66efd4a862c89865236d46d571605d9f6f8d8c64
|
Shell
|
fsamuel-bs/stencil
|
/4.stencil/3.big-domains/1.non-tiled/submit.sh
|
UTF-8
| 1,131 | 2.734375 | 3 |
[] |
no_license
|
#!/bin/bash
#$ -q xeonphi
#$ -l phi=1
#$ -pe mpi 8
#$ -o out
#$ -e err
source /hpc/modulos/bash/intel-cluster_studio_xe_2016.sh
export SINK_LD_LIBRARY_PATH=/hpc/intel/cluster_studio_xe/compilers_and_libraries/linux/mpi/intel64/lib/:/hpc/intel/cluster_studio_xe_2016/compilers_and_libraries_2016/linux/mpi/mic/lib/:/hpc/intel/cluster_studio_xe_2016/compilers_and_libraries_2016/linux/lib/mic/
OUTPUT_DIR=./output
mkdir -p ./code
mkdir -p ./bin
mkdir -p $OUTPUT_DIR
WIDTH=$((16*120*100))
HEIGHT=8
DEPTH=7
TILE_WIDTH=$WIDTH
TILE_HEIGHT=$HEIGHT
TILE_DEPTH=$DEPTH
TEST_CASE=domain_${WIDTH}x${HEIGHT}x${DEPTH}_tile_${TILE_WIDTH}x${TILE_HEIGHT}x${TILE_DEPTH}
echo "Compiling"
sed -e s/\{1\}/$WIDTH/g \
-e s/\{2\}/$HEIGHT/g \
-e s/\{3\}/$DEPTH/g \
-e s/\{4\}/$TILE_WIDTH/g \
-e s/\{5\}/$TILE_HEIGHT/g \
-e s/\{6\}/$TILE_DEPTH/g \
non_tiled.c > ./code/non_tiled_${TEST_CASE}.c
mpiicc -openmp -mmic -O3 ./code/non_tiled_${TEST_CASE}.c -o ./bin/non_tiled_${TEST_CASE}.o
echo "Running"
/opt/intel/mic/bin/micnativeloadex ./bin/non_tiled_${TEST_CASE}.o \
> ${OUTPUT_DIR}/resultados_non_tiled_${TEST_CASE}
| true |
eca900e7e90d30b7d27ffbe13ea3d1059f2cf4aa
|
Shell
|
gtfour/automate
|
/automate.sh
|
UTF-8
| 10,690 | 3.640625 | 4 |
[] |
no_license
|
#!/bin/bash
#
# Run remote bash commands through sudo or not via ssh and printing color report
# author: sendmailwith@gmail.com
#
##
## Setting variables
##
SERVER_LST_FILE=""
COMMAND_FILE=""
SCRIPT_FILE=""
CRED_LINE=""
##
##
##
RUNNING_EXAMPLE_1=" \e[0;34mExample 1 : \n\t \e[1;36mautomate.sh -l server_list.txt -c commands.txt\e[00m\n\t\e[1;36m server_list.txt\e[00m \e[0;34m- Should contain servers hostnames \e[00m\n\t \e[1;36mcommands.txt\e[00m \e[0;34m- simple command list without '#!/bin/bash' at the top\e[00m\e[00m"
RUNNING_EXAMPLE_2=" \e[0;34mExample 2 : \n\t \e[1;36mautomate.sh -l server_list.txt -s script.sh\e[00m\n\t\e[1;36m server_list.txt\e[00m \e[0;34m- Should contain servers hostnames \e[00m\n\t \e[1;36mscript.sh\e[00m \e[0;34m- path to script with single-line commands . \e[0;31m!!! set bash as shell for remote user on remote mashine !!! \e[00m \e[00m\e[00m"
##
## Check keys of command
##
FIRST_KEY=$1
SECOND_KEY=$3
NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE=""
KEY_WARNING_MESSAGE1="\n\e[0;34mPlease specify correct key . Following keys is avilable :\e[00m \n\e[1;36m-s\e[00m\t\e[0;34m#Then provide path to script\e[00m\n\e[1;36m-c\e[00m\t\e[0;34m#Then provide path to command file\e[00m\n\e[1;36m-l\e[00m\t\e[0;34m#Then provide path to server list\n \e[00m\n"$RUNNING_EXAMPLE_1"\n"$RUNNING_EXAMPLE_2
KEY_WARNING_MESSAGE2="\e[33mError. Server list key not specified .\e[00m"
KEY_WARNING_MESSAGE3="\e[33mError. Command file key OR Script key not specified .\e[00m"
case $FIRST_KEY in
-l) SERVER_LST_FILE=$2 ;;
-s) SCRIPT_FILE=$2 ; NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE=$SCRIPT_FILE ;;
-c) COMMAND_FILE=$2 ; NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE=$COMMAND_FILE ;;
*) echo -e $KEY_WARNING_MESSAGE1 ; exit 1 ;; esac ;
case $SECOND_KEY in
-l) SERVER_LST_FILE=$4 ;;
-s) SCRIPT_FILE=$4 ; NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE=$SCRIPT_FILE ;;
-c) COMMAND_FILE=$4 ; NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE=$COMMAND_FILE ;;
*) echo -e $KEY_WARNING_MESSAGE1 ; exit 1 ;; esac ;
case $FIRST_KEY$SECOND_KEY in
-s-c) echo -e $KEY_WARNING_MESSAGE2 $KEY_WARNING_MESSAGE1 ; exit 1 ;;
-c-s) echo -e $KEY_WARNING_MESSAGE2 $KEY_WARNING_MESSAGE1 ; exit 1 ;;
-l) echo -e $KEY_WARNING_MESSAGE3 $KEY_WARNING_MESSAGE1 ; exit 1 ;; esac ;
##
##Check server names file
##
if [ -z "$SERVER_LST_FILE" ] ;
then
echo -e "\n\e[33mServer list is not specified . Please provide servers list \e[00m\n\t" $RUNNING_EXAMPLE_1"\n\n\t"$RUNNING_EXAMPLE_2;
exit 0;
else if [ ! -f $SERVER_LST_FILE ];
then
echo -e "\n\e[33mServer list file not found !\e[00m\n\t" $RUNNING_EXAMPLE_1"\n\n\t"$RUNNING_EXAMPLE_2;
exit 0;
fi
fi
##
##
##
##
## Check command file
##
if [ -z "$NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE" ] ;
then
echo -e "\n\e[33mCommands file or Script file is not specified . Please provide path to command file or script\e[00m\n\t" $RUNNING_EXAMPLE_1 "\n\n\t"$RUNNING_EXAMPLE_2;
exit 0;
else if [ ! -f $NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE ];
then
echo -e "\n\e[33mCommands file or Script file not found !\e[00m\n\t" $RUNNING_EXAMPLE_1"\n\n\t"$RUNNING_EXAMPLE_2;
exit 0;
fi
fi
##
##
##
##
## Looking for errors in command file
##
CHECKING_ERRORS=$(bash -n $NAME_OF_COMMAND_FILE_OR_SCRIPT_FILE 2>&1 )
if [ -n "$CHECKING_ERRORS" ] ;
then
echo -e "\n\e[33mFollowing mistakes were found in input commands file : \n \e[00m";
echo "$CHECKING_ERRORS"
exit 1 ;
fi
##
##
##
##
## Getting credentials
##
function get_credential {
echo -n "enter user name:"
read USER
echo -n "enter password:"
stty -echo
read PW ; echo
stty echo
#echo "user name is " $USER
if [ -z $USER ] ; then
CRED_LINE="";
else
CRED_LINE=$USER"@"
#####echo $CRED_LINE
fi;
}
get_credential
##
##
##
##
## Checking that expect is installed
##
echo -n "Checking that expect is installed : "
if [ "$(which expect 2>/dev/null 1>/dev/null ; echo $? )" == '1' ] ;
then
echo -e "\e[0;31m[NO]\e[00m";
echo " Please install expect first ";
exit ;
else
echo -e "\e[0;32m[YES]\e[00m";
fi
##
##
##
##
## Adding additional headers to each command from COMMAND_FILE . Are you ready for devilry ?
##
if [ ! -z "$COMMAND_FILE" ] ;
then
COMMANDS=$( export CNT=0 ; grep . $COMMAND_FILE | sed "s/[\]/\\\\\\\\\\\\\\\/g" | sed "s/'/\\\\\\\\\\\'/g" | sed 's/"/\\\\\\\"/g' | sed 's/`/\\\\\\\`/g' | sed 's/[$]/\\\\\\\$/g' | sed "s/[[]/\\\\\\\\\\\[/g"| sed "s/[]]/\\\\\\\\\\\]/g" | sed 's/[?]/\\\\\\\?/g' | while read command ; do ((CNT+=1)) ; echo -e ' exec 124>&1 ; exec > /tmp/au_comout_'$CNT' 2>&1 ; \\\$(exit \\\$PREVIOUS_STATUS) ; '$command' ; PREVIOUS_STATUS=\\\$? ; echo \\\$PREVIOUS_STATUS > /tmp/au_result_'$CNT' ; exec 1>&124 2>&124 124>&- ; ' ; done)
COMMANDS_CLEAR_OLD_REPORT=`echo " rm -rf /tmp/au_result_* ; rm -rf /tmp/au_comout_* "`
##
##
##
echo $COMMANDS
fi ;
##
##
##
for server_name in `cat $SERVER_LST_FILE` ; do
echo
echo "### Hostname ###"
echo
echo $server_name
echo
SSH_EXIT_STATUS=""
function script_run {
SCP=$(echo -e 'spawn scp '$SCRIPT_FILE' '$CRED_LINE$server_name':/tmp/au_'$SCRIPT_FILE' ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n { \n send_user "Login complete" \n } \n } ' | expect)
#
SSH_EXIT_STATUS=$(echo "$SCP" | grep -i "Permission denied" 1>/dev/null 2>/dev/null ; echo $?)
SSH=$(echo -e 'spawn ssh -tt '$CRED_LINE$server_name' "chmod +x /tmp/au_'$SCRIPT_FILE' ; exec 124>&1 ; exec > /tmp/au_comout_script 2>&1 ; /tmp/au_'$SCRIPT_FILE' ; echo \$?> /tmp/au_result_script ; rm -f /tmp/au_'$SCRIPT_FILE' ; exec 1>&124 2>&124 124>&- " ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n { \n send_user "Login complete" ; exp_continue \n } \n "assword for '$USER':" { \n send "'$PW'\\r" ; exp_continue \n } \n } ' | expect )
LOG_DIR=`pwd`/$server_name
rm -rf $LOG_DIR
mkdir $LOG_DIR
SCP=$(echo -e 'spawn scp '$CRED_LINE$server_name':/tmp/au_*_script '$LOG_DIR'/ ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n { \n send_user "Login complete" \n } \n } ' | expect)
if [ "$(ls -A $LOG_DIR)" ]; then
COMMANDS_CLEAR_OLD_REPORT_SCRIPT=`echo " rm -rf /tmp/au_*_script ; rm -rf /tmp/au_*_result "`
SSH_CLEAR_OLD_REPORT=$(echo -e 'spawn ssh -tt '$CRED_LINE$server_name' "'$COMMANDS_CLEAR_OLD_REPORT_SCRIPT'" ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n{\nsend_user "Login complete" \n } \n } ' | expect )
STATUS='[ \e[0;31mUnsuspected error\e[00m ]'
case `cat $LOG_DIR/au_result_script` in 1) STATUS='[ \e[0;31mFailed\e[00m ]' ;; 0) STATUS='[ \e[0;32mOK\e[00m ]' ;; 127) STATUS='[ \e[0;31mCommand not found\e[00m ]' ;; esac ;
echo "#------------------------------------------------------------------------------------------"
echo -e "#\t"$SCRIPT_FILE"\t"$STATUS
echo "#------------------------------------------------------------------------------------------"
cat $LOG_DIR/au_comout_script
fi ;
}
function command_run {
SSH=$(echo -e 'spawn ssh -tt '$CRED_LINE$server_name' "'$COMMANDS'" ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n { \n send_user "Login complete" ; exp_continue \n } \n "assword for '$USER':" { \n send "'$PW'\\r" ; exp_continue \n } \n } ' | expect )
SSH_EXIT_STATUS=$(echo "$SSH" | grep -i "Permission denied" 1>/dev/null 2>/dev/null ; echo $?)
LOG_DIR=`pwd`/$server_name
rm -rf $LOG_DIR
mkdir $LOG_DIR
SCP=$(echo -e 'spawn scp '$CRED_LINE$server_name':/tmp/au_*_* '$LOG_DIR'/ ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n { \n send_user "Login complete" \n } \n } ' | expect)
SEEK_VAR=1
if [ "$(ls -A $LOG_DIR)" ]; then
for i in `ls -1 $LOG_DIR/*result*` ; do
COMMAND_NAME=$(cat $COMMAND_FILE | head -$SEEK_VAR | tail -1)
((SEEK_VAR+=1))
STATUS='[ \e[0;31mUnsuspected error\e[00m ]'
case `cat $i` in 1) STATUS='[ \e[0;31mFailed\e[00m ]' ;; 0) STATUS='[ \e[0;32mOK\e[00m ]' ;; 127) STATUS='[ \e[0;31mCommand not found\e[00m ]' ;; esac ;
echo "#------------------------------------------------------------------------------------------"
echo -e "#\t"$COMMAND_NAME"\t"$STATUS
echo "#------------------------------------------------------------------------------------------"
cat $LOG_DIR/au_comout*$(echo $i | rev | cut -f 1 -d "_")
done ;
fi ;
SSH_CLEAR_OLD_REPORT=$(echo -e 'spawn ssh -tt '$CRED_LINE$server_name' "'$COMMANDS_CLEAR_OLD_REPORT'" ; \n expect { \n"(yes/no)? " {\nsend "yes\\n" ; exp_continue \n}\n"assword:" { \n send "'$PW'\\r" ; exp_continue \n } \n -re {[#>$]} \n{\nsend_user "Login complete" \n } \n } ' | expect )
echo $server_name;
}
#
#
#
#
#
GET_KEY=$(echo "$FIRST_KEY$SECOND_KEY" | grep "s" 1>/dev/null 2>/dev/null ; echo $?)
if [ $GET_KEY -ne 0 ] ; then
command_run
while [ $SSH_EXIT_STATUS -ne 1 ] ; do echo -e "\e[33m---\n Connection to "$server_name" failed \n Permission denied \n Please try again \n---\e[00m" ; get_credential ; command_run ; done ;
else
script_run
while [ $SSH_EXIT_STATUS -ne 1 ] ; do echo -e "\e[33m---\n Connection to "$server_name" failed \n Permission denied \n Please try again \n---\e[00m" ; get_credential ; script_run ; done ;
fi ;
#
#
#
#
done
### clear log file
for server_name in `cat $SERVER_LST_FILE` ; do
LOG_DIR=`pwd`/$server_name ;
rm -rf $LOG_DIR ;
done
| true |
272ec99e99a567eed99529df13a5bc8b74fea6c2
|
Shell
|
luanxiangming/performance
|
/go.sh
|
UTF-8
| 473 | 3.359375 | 3 |
[] |
no_license
|
#!/bin/bash
IMAGE_NAME=xiangming/java8:node6;
echo "Pulling latest code...";
git pull --all
if ! docker ps | grep "performance" | grep -v grep; then
echo "Running docker image...";
docker run \
--tty \
--interactive \
--volume=$(pwd):/root/Developer/performance \
--workdir=/root/Developer/performance \
--rm \
--name performance \
$IMAGE_NAME /bin/sh \
-c "./start_test.sh"
else
echo "'performance' has already been running.";
fi
| true |
5b3d9ea16c428c14c91bd74d22f64115f44c8ec9
|
Shell
|
BR0kEN-/clib
|
/help.sh
|
UTF-8
| 1,176 | 3.4375 | 3 |
[] |
no_license
|
#!/usr/bin/env bash
_clib_green()
{
coloredMessage "${1}" 2
}
_clib_yellow()
{
coloredMessage "${1}" 3
}
_clib_blue()
{
coloredMessage "${1}" 4
}
_clib_command()
{
local arguments=""
for ((i = 4; i <= $#; i++)); do
arguments+=" `_clib_green "<${!i}>"`"
done
echo "`_clib_yellow "Command:"`
`_clib_blue "${1}"`${arguments}
`_clib_yellow "Description:"`${2}
`_clib_yellow "Examples:"`${3}"
}
_clib_help_clone()
{
_clib_command clone "
Clone Git repository. All `_clib_green "git clone"` arguments are available.
" "
clone drupal drupal --branch=7.x
clone ffw sla/unga test
clone gh br0ken-/tqextension --quiet
clone bb br0ken/gta --bare
" "host" "project" "git clone parameters"
}
_clib_help_jira()
{
_clib_command jira "
Open JIRA project or task in default browser. Project key is insensitive.
" "
jira pva
jira pva-177
" "project"
}
_clib_help_g()
{
_clib_command g "
Perform search using Google. All search syntax available.
" "
g rammstein
g latin site: wikipedia.org
" "query"
}
_clib_help_so()
{
_clib_command so "
Perform search on StackOverflow.
" "
so how to install php
" "query"
}
| true |
1aa5ceed3140959d42f2b3098086560e1e175033
|
Shell
|
phonedotcom/mason-laravel
|
/hooks/pre-commit
|
UTF-8
| 2,464 | 3.71875 | 4 |
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#!/bin/bash
echo "[$(basename $0) hook START]"
ORIG_DIR="$(pwd)"
PROJECT="$(git rev-parse --show-toplevel)"
cd "$PROJECT"
STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php | grep -v _ide_helper\\\\.php`
# Determine if a file list is passed
if [ "$#" -eq 1 ]; then
oIFS=$IFS
IFS='
'
SFILES="$1"
IFS=$oIFS
fi
SFILES=${SFILES:-$STAGED_FILES_CMD}
for FILE in $SFILES; do
if [[ "${FILE: -4}" == ".php" ]]; then
CLASSES="$CLASSES $FILE"
fi
done
###############################################################################
# LINT CHECK
###############################################################################
if [[ "$CLASSES" != "" ]]; then
echo "Running PHP lint checking"
for FILE in $CLASSES; do
php -l $FILE 2>/dev/null | grep -v 'No syntax errors detected' | grep -v 'Errors parsing'
if [ ${PIPESTATUS[0]} != 0 ]; then
exit 1
fi
done
fi
###############################################################################
# Coding Standards
###############################################################################
if [[ "$CLASSES" != "" ]]; then
PHPCS="./vendor/bin/phpcs"
PHPCBF="./vendor/bin/phpcbf"
# NOTE: Add the "-s" flag to include the names of any failing sniffs
PHPCS_COMMON="--encoding=utf-8 --colors -p --report-width=120"
ERRORS=1
while [[ $ERRORS -ne 0 ]]; do
echo "Checking PSR-2 compliance"
$PHPCS $PHPCS_COMMON $CLASSES --standard="hooks/phpcs.xml"
ERRORS=${PIPESTATUS[0]}
if [ $ERRORS -ne 0 ]; then
exec < /dev/tty
export COLUMNS=30
echo "Found one or more PSR-2 coding standards issues. Please select an option."
select CHOICE in "Auto-fix wherever possible" "Ignore this warning" "Cancel this commit"; do
case $CHOICE in
Auto-fix*)
echo "Auto-formatting..."
$PHPCBF $PHPCS_COMMON $CLASSES --standard="hooks/phpcs.xml"
git add $CLASSES
break;;
Ignore*)
ERRORS=0
break;;
Cancel*)
exit 1
esac
done
else
echo "Done checking PSR-2 compliance"
fi
done
fi
cd "$ORIG_DIR"
echo "[$(basename $0) hook END]"
| true |
fd7e58799ca6cbb3358cdc1baf8358ef0d88e72e
|
Shell
|
PasaLab/tachyon
|
/deploy/vagrant/provision/roles/zookeeper/files/download_release.sh
|
UTF-8
| 337 | 3.0625 | 3 |
[
"Unlicense",
"Apache-2.0",
"EPL-1.0",
"MIT",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown",
"BSD-3-Clause",
"CC-PDDC",
"LicenseRef-scancode-public-domain"
] |
permissive
|
#!/usr/bin/env bash
mkdir -p /vagrant/shared
DIST="/vagrant/shared/zookeeper-${ZOOKEEPER_VERSION}.tar.gz"
if [[ ! -f "${DIST}" ]]; then
wget -q "http://archive.apache.org/dist/zookeeper/zookeeper-${ZOOKEEPER_VERSION}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz" -P /vagrant/shared
fi
tar xzf "${DIST}" -C /zookeeper --strip-components 1
| true |
8b977cc491bffd52b0c4d84c71192b0ee678c8be
|
Shell
|
Fadarrizz/dotfiles
|
/git/.git_template/hooks/ctags
|
UTF-8
| 201 | 2.609375 | 3 |
[] |
no_license
|
#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
trap 'rm -f "$$.tags"' EXIT
git ls-files | \
ctags --tag-relative -L - -f"$$.tags" --fields=+aimlS --languages=php --PHP-kinds=+cf-va
mv "$$.tags" "tags"
| true |
228ce2e831eb39b77fa9ef65dddf8c3de8d831ee
|
Shell
|
unofficial-inteno-public-mirror/uci-diff
|
/uci-diff.sh
|
UTF-8
| 2,245 | 4.0625 | 4 |
[] |
no_license
|
#!/bin/sh
#Author: Reidar Cederqvist
####### includes ######################
#. /usr/share/libubox/jshn.sh
####### end of includes ###############
####### helper functions ##############
print_usage() {
echo -e "usage: $0 <action>\n"
echo -e "actions:\n"
echo -e "\t-d|--diff diff-file orig-file out-file //create a JSON diff between file1 and file2 and print the result in out-file"
echo -e "\t-a|--apply file //apply a diff file"
echo -e "\t-e|--extract <config/all> out-file //create a JSON file for the specified (or all) config(s)"
echo -e "\t-h|--help //print usage\n"
}
apply_diff(){
echo $1
}
extract_config(){
if [ "$1" == "all" ]; then
echo -e '{' > $2
for file in $(ls /etc/config); do
echo -en "\rparsing $file "
res="$(ubus call uci get "{\"config\":\"$file\"}" 2>/dev/null)"
if [ "$res" != "" ]; then
echo -e "$(echo -e "$res" | sed "s/\"values\":/\"$file\":/g" | sed 's/^\t}$/\t},/g' | sed '/^[{}]$/d')" >>$2
else
echo "\n\nERROR: Couldn't parse config: $file\n\n"
fi
done
sed -i '$ d' $2
echo -e '\t}\n}' >>$2
echo -e "\nFinished\n"
else
echo -e "$(ubus call uci get "{\"config\":\"$1\"}" | sed "s/\"values\":/\"$1\":/g")" >$2
fi
}
can_write(){
[ -e "$1" ] || touch "$1"
[ -f "$1" -a -w "$1" ] && return 0 || return 1
}
can_read(){
[ -f "$1" -a -r "$1" ] && return 0 || return 1
}
####### end of helper functions ##############
case $1 in
-d|--diff)
[ $# -ne 4 ] && print_usage && exit 1
[ "$2" == "$3" ] && print_usage && exit 1
can_read $2 || (echo -e "Can't read file: $2" && exit 1)
can_read $3 || (echo -e "Can't read file: $3" && exit 1)
can_write $4 || (echo -e "Can't write to file: $4" && exit 1)
create_diff "$2" "$3" "$4"
;;
-a|--apply)
[ $# -ne 2 ] && print_usage && exit 1
can_read $2 || (echo -e "Can't read file: $2" && exit 1)
apply_diff $2
;;
-e|--extract)
[ $# -ne 3 ] && print_usage && exit 1
[ "$2" == "all" -o "$(ls /etc/config 2>/dev/null| grep "$2")" ] || (echo -e "$2 is not a config" && exit 1)
can_write "$3" || (echo -e "Can't write to file: $3" && exit 1)
extract_config $2 $3
;;
-h|--help)
print_usage
exit 0
;;
*)
print_usage
exit 1
;;
esac
| true |
218917ce5d2f9e07e28242aec7b9234987dde895
|
Shell
|
kellyjf/presentations
|
/network/defs.sh
|
UTF-8
| 2,240 | 3.84375 | 4 |
[] |
no_license
|
#!/bin/bash -eu
# Helper function to reliably create a new namespace
function newns {
nsname=$1
ip netns del $nsname &> /dev/null || true
ip netns add $nsname
ip netns exec $nsname ip link set lo up
}
# Create a new link between namespaces
function newlink {
wanname=${1:-}
lanname=${2:-}
subnet=${3:-192.168.1}
wanhost=${4:-1}
lanhost=${5:-2}
vid=${6:-}
# Usage line if required args are missing
if [[ -z $wanname || -z $lanname ]] ; then
echo "Usage newlink wan-ns [lan-ns subnet wanhost lanhost vid]"
return
fi
# Ensure namespaces exist
for ns in $wanname $lanname; do
if ! ip netns ls | grep $ns &> /dev/null ; then
newns $ns
fi
done
# Compute temp interaces names, and ensure they are pre-removed
# in the main namespace
if [[ ! $vid ]]; then
vid=${subnet##*.}
fi
ip link del wan-${vid} &> /dev/null || true
ip link del lan-${vid} &> /dev/null || true
# Implement two approaches to creating virtual links
# If NONET is unset, create a VLAN on the base pair,
# if set, use a separate veth pair for the link
if [[ ${NONET:-} ]] ; then
ip link add wan-${vid} type veth peer name lan-${vid}
else
# Ensure a wan/lan pair exist in the main namespace
if ! [[ -e /sys/class/net/wan ]] ; then
ip link del wan &> /dev/null || true
ip link del lan &> /dev/null || true
ip link add wan type veth peer name lan
ip link set wan up
ip link set lan up
fi
ip link add link wan name wan-${vid} type vlan id $vid
ip link add link lan name lan-${vid} type vlan id $vid
fi
# Push enpoint pairs into namespaces and rename for
# the destination namespace
ip link set wan-${vid} netns $wanname name $lanname
ip link set lan-${vid} netns $lanname name $wanname
ip netns exec $wanname ip link set $lanname up
ip netns exec $lanname ip link set $wanname up
# Configure link addresses
# set default route of lan side to wan as gateway
wanaddr="${subnet}.${wanhost}"
lanaddr="${subnet}.${lanhost}"
if [[ ${wanhost} != 0 ]]; then
ip netns exec $wanname ip addr add dev ${lanname} ${wanaddr}/24
fi
if [[ ${lanhost} != 0 ]]; then
ip netns exec $lanname ip addr add dev $wanname ${lanaddr}/24
ip netns exec $lanname ip route replace default via ${subnet}.1
fi
}
| true |
b679d41d588052e327a94a400a1d742e51053503
|
Shell
|
grawity/code
|
/bin/misc/pkg
|
UTF-8
| 3,378 | 3.96875 | 4 |
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
. lib.bash || exit
. libks.bash || exit
# create file list from directory
list_create() {
local dir="$1"
find "$dir" -printf '%Y %m ./%P\n'
}
# remove files according to list
list_remove() {
local list="$1"
local ftype mode path
tac "$list" | while read -r ftype mode path; do
path="$PREFIX/${path#./}"
case $ftype in
d) test -d "$path" && rmdir --ignore-fail-on-non-empty "$path";;
?) rm -f "$path";;
esac
done
}
# display statistics of file list
list_stats() {
local list="$1"
local ndirs=0 nfiles=0
local ftype mode path
while read -r ftype mode path; do
case $ftype in
d) (( ++ndirs ));;
?) (( ++nfiles ));;
esac
done < "$list"
echo "$ndirs directories, $nfiles files"
}
dist_configure() {
if test -e configure.ac; then
if test ! -e configure || test configure.ac -nt configure; then
notice "'configure' is older than 'configure.ac'"
if test -x autogen.sh; then
lib:log "Updating configure through ./autogen.sh"
NOCONFIGURE=1 ./autogen.sh
else
lib:log "Updating configure through autoreconf"
autoreconf -i -f
fi
fi
fi
lib:log "Configuring for $PREFIX"
./configure --prefix="$PREFIX" "$@"
}
dist_install() {
local dest="${1%/}/" args=("${@:2}")
rm -rf "$dest"
mkdir -p "$dest"
make DESTDIR="$dest" "${args[@]}" install
}
dir_copy() {
(cd "$1" && find | bsdcpio --quiet -o) |
pv -c -b -p |
(cd "$2" && bsdcpio --quiet -i)
rm -rf "$1"
}
for tool in bsdcpio find make pv tac; do
have $tool || err "'$tool' not installed"
done
(( !errors )) || exit
if ! [[ $PREFIX ]]; then
warn "\$PREFIX not set, assuming ~/.local"
PREFIX="$HOME/.local"
fi
DBDIR="$path_data/pkg"
CACHEDIR="$path_cache/pkg"
mkdir -p "$DBDIR"
mkdir -p "$CACHEDIR/install"
while getopts ":P:" OPT; do
case $OPT in
P) pkgname=$OPTARG;;
esac
done; shift $((OPTIND-1))
if [[ ! $pkgname ]]; then
pkgname=$(basename "$PWD")
fi
export pkgname
cmd=$1; shift
case $cmd in
configure)
dist_configure "$@"
;;
install)
filelist="$DBDIR/$pkgname.files"
tempdest="$CACHEDIR/install/$pkgname"
dist_install "$tempdest" "$@"
if test -e "$filelist"; then
lib:log "Uninstalling old version"
pkg remove
fi
lib:log "Installing to file system"
list_create "$tempdest/$PREFIX" > "$filelist"
dir_copy "$tempdest/$PREFIX" "$PREFIX"
list_stats "$filelist"
;;
uninstall|remove)
filelist="$DBDIR/$pkgname.files"
if ! test -e "$filelist"; then
die "filelist $filelist not found"
fi
list_stats "$filelist"
list_remove "$filelist"
mv "$filelist" "$filelist-old"
;;
ls)
if (( $# )); then
for pkgname; do
filelist="$DBDIR/$pkgname.files"
if ! test -e "$filelist"; then
err "filelist $filelist not found"
continue
fi
cat "$filelist"
done
else
for f in "$DBDIR"/*.files; do
basename "$f" .files
done
fi
;;
files)
(( $# )) || set -- "$pkgname"
for pkgname; do
filelist="$DBDIR/$pkgname.files"
if ! test -e "$filelist"; then
die "filelist $filelist not found"
fi
cat "$filelist"
done
;;
stats)
(( $# )) || set -- "$pkgname"
for pkgname; do
filelist="$DBDIR/$pkgname.files"
if ! test -e "$filelist"; then
die "filelist $filelist not found"
fi
list_stats "$filelist"
done
;;
eval)
eval "${@:2}"
;;
'')
die "missing command"
;;
*)
die "unknown command '$cmd'"
;;
esac
(( !errors ))
| true |
f3e0da1e18c00c594fe047c95e9ee36babae23e5
|
Shell
|
TheGhostHuCodes/21CC
|
/Ch03_PackagingYourProject/iftest/iftest.sh
|
UTF-8
| 147 | 3.09375 | 3 |
[] |
no_license
|
#!/bin/bash
if test ! -e a_test_file; then
echo test file had not existed
touch a_test_file
else
echo test file existed
rm a_test_file
fi
| true |
22ee68faed423c3b11a4d66a80273aabc23eef7d
|
Shell
|
talosiot/vera
|
/bin/get_github_deploykey
|
UTF-8
| 240 | 3.125 | 3 |
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
remote_name=$(git remote get-url origin)
#aws secret names cant have colon
secret_name=$(echo "$remote_name" | sed 's/:/\//g')
which get_secret || { echo "Must add vera to path"; exit 1; }
get_secret -n $secret_name
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.