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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5355d9d5689ea02ef0b12c5af02657155ef1cf1b
|
Shell
|
ChrisBlanks/OpenNintendoProCon
|
/install.sh
|
UTF-8
| 999
| 3.65625
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Author: ChrisB
# Purpose: Installs application files to '.local' folders.
# Note: Probably won't work on systems that don't use .local for storing application data
#
APP_NAME="openprocon"
LOCAL_BIN=".local/bin"
LOCAL_SHARE=".local/share"
EXEC_NAME="openprocon"
EXEC_PARENT_DIR="build"
EXEC_ORIG_PATH=$EXEC_PARENT_DIR/$EXEC_NAME
EXEC_INSTALL_DIR=$HOME/$LOCAL_BIN
RESOURCE_FILE_EXTENSION=".def"
RESOURCE_PARENT_DIR="build"
RESOURCE_PATH_GLOB=$RESOURCE_PARENT_DIR/*$RESOURCE_FILE_EXTENSION
RESOURCE_INSTALL_FOLDER=$HOME/$LOCAL_SHARE/$APP_NAME
#echo $EXEC_ORIG_PATH
#echo $RESOURCE_PATH_GLOB
#echo $EXEC_INSTALL_DIR
#echo $RESOURCE_INSTALL_FOLDER
echo "Installing openprocon..."
if test -e $RESOURCE_INSTALL_FOLDER; then
echo "Resource installation directory already exists."
else
mkdir $RESOURCE_INSTALL_FOLDER
fi
#install files in the proper directories
cp $EXEC_ORIG_PATH $EXEC_INSTALL_DIR
cp $RESOURCE_PATH_GLOB $RESOURCE_INSTALL_FOLDER
echo "Installation complete."
| true
|
6ebba67657731e1f8738a1decb0d00879a0ba922
|
Shell
|
PreteGeekers/KrustyKrabPizza
|
/Linux/immutableChk
|
UTF-8
| 948
| 4
| 4
|
[] |
no_license
|
#!/bin/bash
######################################
# This script searches the entire system for immutable files,
# then asks if you would like to remove the immutable flag.
# usage: sudo /immutableChk
# should be ran as root to avoid permission denied errors
######################################
#Command this script is based around
#lsattr -a -R / 2>/dev/null | grep -- "-i-" | grep -v -- "-------------"
lsattr -a -R / 2>/dev/null | grep -- "-i-" | grep -v -- "-------------" | grep -v "supported" > imck.tmp
echo ""
while read -r line; do
name=$line
echo "$name"
done < "./imck.tmp"
echo ""
if [ -s './imck.tmp' ] ; then
echo "Would you like to remove the immutable flag from these files? (Y/n)"
read YESNO
if [ $YESNO == "Y" ] ; then
while read -r line; do
name=$(echo $line | cut -d" " -f2)
echo "Removing flag from" $name
chattr -i $name
done < "./imck.tmp"
fi
else
echo "No immutable flags found"
fi
rm ./imck.tmp
| true
|
869dc2900213e8c47d35cea02de9cac77070a337
|
Shell
|
kirtandudhatra/shellscripts
|
/3_arithmatic
|
UTF-8
| 888
| 4.09375
| 4
|
[] |
no_license
|
#!/bin/bash
# This script takes two input numbers from user at runtime and display arithmetic operation on that numbers, finds out max, & min number from them, finds weather that numbers negative or positive.
read -p "Enter first number:" num1
read -p "Enter second number:" num2
echo "Arithmetic Operations:"
echo -n "$num1 + $num2 = "
echo $((num1 + $num2))
echo -n "$num1 - $num2 = "
echo $((num1 - $num2))
echo -n "$num1 * $num2 = "
echo $((num1 * $num2))
echo -n "$num1 / $num2 = "
echo $((num1 / $num2))
if [ $num1 -ge $num2 ];then
echo -n "Max Number: "
echo $num1
echo -n "Min Number: "
echo $num2
else
echo -n "Max Number: "
echo $num2
echo -n "Min Number: "
echo $num1
fi
if [ $num1 -lt 0 ];then
echo "$num1 is Negative."
else
echo "$num1 is Positive."
fi
if [ $num2 -lt 0 ];then
echo "$num2 is Negative."
else
echo "$num2 is Positive."
fi
| true
|
69185e169fc74de311447375fe34b8701e6aabe8
|
Shell
|
khandelwalankit/Hybrid-Programming
|
/StarPU/CholeskyFactorization/compilecholesky.sh
|
UTF-8
| 4,792
| 2.703125
| 3
|
[] |
no_license
|
#!/bin/bash
echo "Setting environment variables"
PKG_CONFIG_PATH=/home/amkhande/lib/pkgconfig
export PKG_CONFIG_PATH
LD_LIBRARY_PATH=/home/amkhande/lib:/home/amkhande/tbbSource/lib/intel64/gcc4.4
export LD_LIBRARY_PATH
PATH=/home/amkhande/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.4:/usr/games/bin:/opt/cuda/bin:/opt/cuda/libnvvp:/home/amkhande/tbbSource/bin
export PATH
echo "Setting Work Stealing Scheduling"
STARPU_SCHED=ws
export STARPU_SCHED
echo "Setting PATH for include file in C"
CPLUS_INCLUDE_PATH=/home/amkhande/tbbSource/include:/home/amkhande/include
export CPLUS_INCLUDE_PATH
C_INCLUDE_PATH=/home/amkhande/include
export C_INCLUDE_PATH
echo "removing earlier test file"
rm -i testresult_cholesky_block.txt
echo "Compiling Cholesky"
g++ -O3 `pkg-config starpu-1.1 --cflags` -std=c++0x cholesky_block.c `pkg-config starpu-1.1 --libs` -o cholesky_block
echo "Computation Started for cholesky_block" >> testresult_cholesky_block.txt
max=8
for i in `seq 1 $max`
do
echo "Executing test :$i times"
echo "Executing test :$i times" >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 1024X1024 and dividing in block of 512X512" >> testresult_cholesky_block.txt
./cholesky_block 512 512 1024 1024 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 1024X1024 and dividing in block of 256X256" >> testresult_cholesky_block.txt
./cholesky_block 256 256 1024 1024 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 1024X1024 and dividing in block of 128X128" >> testresult_cholesky_block.txt
./cholesky_block 128 128 1024 1024 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 1024X1024 and dividing in block of 64X64" >> testresult_cholesky_block.txt
./cholesky_block 64 64 1024 1024 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 1024X1024 and dividing in block of 32X32" >> testresult_cholesky_block.txt
./cholesky_block 32 32 1024 1024 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 1024X1024 and dividing in block of 16X16" >> testresult_cholesky_block.txt
./cholesky_block 16 16 1024 1024 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 2048X2048 and dividing in block of 512X512" >> testresult_cholesky_block.txt
./cholesky_block 512 512 2048 2048 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 2048X2048 and dividing in block of 256X256" >> testresult_cholesky_block.txt
./cholesky_block 256 256 2048 2048 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 2048X2048 and dividing in block of 128X128" >> testresult_cholesky_block.txt
./cholesky_block 128 128 2048 2048 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 2048X2048 and dividing in block of 64X64" >> testresult_cholesky_block.txt
./cholesky_block 64 64 2048 2048 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 2048X2048 and dividing in block of 32X32" >> testresult_cholesky_block.txt
./cholesky_block 32 32 2048 2048 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 2048X2048 and dividing in block of 16X16" >> testresult_cholesky_block.txt
./cholesky_block 16 16 2048 2048 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 4096X4096 and dividing in block of 512X512" >> testresult_cholesky_block.txt
./cholesky_block 512 512 4096 4096 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 4096X4096 and dividing in block of 256X256" >> testresult_cholesky_block.txt
./cholesky_block 256 256 4096 4096 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 4096X4096 and dividing in block of 128X128" >> testresult_cholesky_block.txt
./cholesky_block 128 128 4096 4096 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 4096X4096 and dividing in block of 64X64" >> testresult_cholesky_block.txt
./cholesky_block 64 64 4096 4096 >> testresult_cholesky_block.txt
echo "Running cholesky_block factorization for 4096X4096 and dividing in block of 32X32" >> testresult_cholesky_block.txt
./cholesky_block 32 32 4096 4096 >> testresult_cholesky_block.txt
<<COMMENT echo "Running cholesky_block factorization for 4096X4096 and dividing in block of 16X16" >> testresult_cholesky_block.txt
./cholesky_block 16 16 4096 4096 >> testresult_cholesky_block.txt
COMMENT
done
echo "Computation Completed for cholesky_block" >> testresult_cholesky_block.txt
| true
|
e118a657e8a2e07af5724ab5148edddde339da36
|
Shell
|
ahmedelbasosy/Kubernetes
|
/Scripts/k8-v1.21-controller-debian.sh
|
UTF-8
| 2,834
| 2.953125
| 3
|
[] |
no_license
|
###### Kubernetes Controller Version 1.21 ######
## Environment: Debian
## Creatiion Date: 09-Jun-2021
## Author: Ahmed El Basosy
################################################
###### Letting iptables see bridged traffic ######
echo "###### Letting iptables see bridged traffic ######"
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo sysctl --system
sleep 2
clear
##########################################################
###### Installing Container Runtime ######
###### Containerd ######
echo "###### installing Container Runtime: CONTAINERd ######"
# Uninstall old versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Set up the repository
sudo apt-get update
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release \
nfs-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Installing Containerd Package
sudo apt-get update
sudo apt-get install containerd.io
# Starting & Enabling Containerd
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
# Setup required sysctl params, these persist across reboots.
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
# Apply sysctl params without reboot
sudo sysctl --system
sudo systemctl enable --now containerd
sudo mkdir -p /etc/containerd
containerd config default | sudo tee /etc/containerd/config.toml
sudo systemctl restart containerd
sleep 2
clear
##########################################################
###### Installing kubeadm, kubelet and kubectl ######
echo "###### Installing kubeadm, kubelet and kubectl ######"
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
sudo apt-get install -y bash-completion
##########################################################
| true
|
258eb2113424cbcc2a1a4f6c749867ed903e64bf
|
Shell
|
snowflakedb/libsnowflakeclient
|
/deps/util-linux-2.39.0/tests/ts/libmount/loop
|
UTF-8
| 5,171
| 3.34375
| 3
|
[
"Apache-2.0",
"BSD-4-Clause-UC",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"GPL-3.0-or-later",
"BSD-2-Clause",
"GPL-2.0-or-later",
"LGPL-2.1-or-later",
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash
#
# Copyright (C) 2016 Stanislav Brabec <sbrabec@suse.cz>
#
# This file is part of util-linux.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
TS_TOPDIR="${0%/*}/../.."
TS_DESC="losetup-loop"
. "$TS_TOPDIR"/functions.sh
ts_init "$*"
ts_check_test_command "$TS_CMD_MOUNT"
ts_check_test_command "$TS_CMD_UMOUNT"
ts_check_test_command "$TS_CMD_FINDMNT"
ts_check_test_command "$TS_CMD_LOSETUP"
ts_skip_nonroot
ts_check_losetup
ts_check_prog "mkfs.ext2"
function verify_mount_dev {
local dev=$1
local mp=$2
local dev_mounted=$($TS_CMD_FINDMNT -no SOURCE --mountpoint "$mp")
if test "$dev" != "$dev_mounted" ; then
echo "Mounted incorrect device: have '$dev_mounted', want '$dev'" >&2
return 1
fi
}
#
# file-* tests: Backing file is a regular file
#
BACKFILE=$(ts_image_init 10)
mkfs.ext2 -F $BACKFILE &> /dev/null || ts_die "Cannot make ext2 on $BACKFILE"
# All tests are separated by "udevadm settle" because loop device exists some time after
# "losetup -d". This device confuses some tests. And find-race-condition, tests,
# whether re-use of this device works.
udevadm settle
ts_init_subtest "file"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "file-o-loop"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -oloop "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "dev-loop"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
LODEV=$( $TS_CMD_LOSETUP --find --nooverlap --show $BACKFILE 2>> $TS_OUTPUT )
$TS_CMD_MOUNT $LODEV "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
verify_mount_dev "$LODEV" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "o-loop-val"
if [ "$TS_PARALLEL" = "yes" ]; then
# There is a race in $LODEV is usage
ts_skip_subtest "no-reentrant"
else
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
LODEV=$( $TS_CMD_LOSETUP --find 2>> $TS_OUTPUT )
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
verify_mount_dev "$LODEV" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
fi
ts_init_subtest "reuse"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
LODEV=$( $TS_CMD_LOSETUP --find --nooverlap --show "$BACKFILE" 2>> $TS_OUTPUT )
$TS_CMD_MOUNT "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
verify_mount_dev "$LODEV" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "conflict"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
LODEV=$( $TS_CMD_LOSETUP --find --nooverlap --show --offset=1000 "$BACKFILE" 2>> $TS_OUTPUT )
$TS_CMD_MOUNT "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "o-loop-val-initialized"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
LODEV=$( $TS_CMD_LOSETUP --show -f "$BACKFILE" 2>>$TS_OUTPUT)
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "o-loop-val-conflict"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
cp "$BACKFILE" "$BACKFILE"-2
LODEV=$( $TS_CMD_LOSETUP --show -f "$BACKFILE"-2 2>> $TS_OUTPUT)
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>> $TS_ERRLOG
rm "$BACKFILE"-2
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_init_subtest "explicit-rw"
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
$TS_CMD_MOUNT -o rw "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_FINDMNT -no FS-OPTIONS --mountpoint "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>> $TS_ERRLOG
udevadm settle
ts_log "Success"
ts_finalize_subtest
ts_log "Success"
ts_finalize
| true
|
bde00934166e3031fcea514c3aaf71f68d79768d
|
Shell
|
albertyw/dotfiles
|
/scripts/link.sh
|
UTF-8
| 792
| 3.328125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
cd "$HOME/.dotfiles"
dotfiles=$HOME/.dotfiles/files/
move () {
# shellcheck disable=SC2086
if [ -z ${2+x} ] ; then
dest=$1
else
dest=$2
fi
echo "$1"
if [ -L "$HOME/.$dest" ] ; then
return 0
fi
if [ -f "$HOME/.$dest" ] || [ -d "$HOME/.$dest" ] ; then
mv "$HOME/.$dest" "$HOME/.$dest~"
fi
ln -s "$dotfiles/$1" "$HOME/.$dest"
}
git submodule init
git submodule update --recursive
move bash_profile
move bashrc
move config
move direnvrc
move gitconfig
move gitignore
move irbrc
move selected_editor
move sudo_as_admin_successful
move vim
move vimrc
if [[ $(hostname) == *"uber"* ]] ; then
move gitconfig_uber gitconfig_local
move bashrc_uber bashrc_local
fi
exec bash
| true
|
35926fc5066ff0f85ce340553a5b3160af4537ee
|
Shell
|
hackman/linux-sysadmin-course
|
/additional/bash/re.sh
|
UTF-8
| 97
| 2.9375
| 3
|
[] |
no_license
|
#!/bin/bash
if [[ ! $1 =~ ^\/[a-z]+\/$ ]]; then
echo "Not matched \$1"
else
echo "Matched"
fi
| true
|
29e9a9b03961c69a8cdfc669a13f343c5b848367
|
Shell
|
ivan-yankov/bash
|
/devices/audio/set-default-audio-output.sh
|
UTF-8
| 211
| 2.78125
| 3
|
[] |
no_license
|
# dsc:Set default audio output device.
# env:$DEFAULT_AUDIO_OUTPUT device name
function set-default-audio-output {
is-defined $DEFAULT_AUDIO_OUTPUT || return 1
pacmd set-default-sink $DEFAULT_AUDIO_OUTPUT
}
| true
|
4795082f8424403fb6b6ecd35e090c1e19d99c6f
|
Shell
|
kfcampbell/dotfiles
|
/.bashrc
|
UTF-8
| 2,300
| 3.734375
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
# functions
function ccd() {
local default_repo="$HOME/github/dev/"
local rootdir=$(git rev-parse --show-toplevel 2> /dev/null || echo "$default_repo")
cd "$rootdir" || echo "ccd command from ~/.bashrc failed"
}
kcontext() {
kubectl config view --minify
}
ghgo() {
~/go/src/github.com/github
}
gdv() {
~/github/dev
}
switchgo() {
version=$1
if [ -z "$version" ]; then
echo "Usage: switchgo [version]"
return
fi
if ! command -v "go$version" > /dev/null 2>&1; then
echo "version does not exist, downloading with commands: "
echo " go get golang.org/dl/go${version}"
echo " go${version} download"
echo ""
go get "golang.org/dl/go${version}"
go"${version}" download
fi
go_bin_path=$(command -v "go$version")
ln -sf "$go_bin_path" "$GOBIN/go"
echo "Switched to ${go_bin_path}"
}
# show and switch to branches interactively
function b() {
local branches branch
branches=$(git --no-pager branch -vv) &&
branch=$(echo "$branches" | fzf +m --layout=reverse) &&
git checkout "$(echo "$branch" | awk '{print $1}' | sed "s/.* //")"
}
# clean docker containers
function docker-containers-clean() {
docker rm -vf "$(docker ps -a -q)"
}
# clean docker images
function docker-images-clean() {
docker rmi -f "$(docker images -a -q)"
}
# clean both containers and images
function docker-force-clean() {
docker-containers-clean
docker-images-clean
}
# better bash history stuff
shopt -s histappend
HISTFILESIZE=1000000
HISTSIZE=1000000
HISTCONTROL=ignoreboth
HISTIGNORE='ls:bg:fg:history'
HISTTIMEFORMAT='%F %T '
PROMPT_COMMAND='history -a'
##################################################
# START: only add absolute "cd" paths to history #
##################################################
# skip adding "cd" commands to history
function zshaddhistory() {
if [[ $1 = cd\ * ]]; then
return 1
fi
}
# add a "cd <absolute path>" to history whenever the working directory changes
function chpwd() {
escaped_dir=$(printf %q "$(pwd)") # escape spaces in directory names
print -rs "cd $escaped_dir"
}
##################################################
# END: only add absolute "cd" paths to history #
##################################################
SLACK_DEVELOPER_MENU=true
| true
|
26549f008f8a7b9e1864b51ca6c0bc6cc0f0f169
|
Shell
|
tokopedia/teleport
|
/examples/aws/terraform/proxy-user-data.tpl
|
UTF-8
| 8,947
| 3.578125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
set -x
# Install uuid used for token generation
apt-get install -y uuid
# Set some curl options so that temporary failures get retried
# More info: https://ec.haxx.se/usingcurl-timeouts.html
CURL_OPTS="-L --retry 100 --retry-delay 0 --connect-timeout 10 --max-time 300"
# Install telegraf to collect stats from influx
curl $CURL_OPTS -o /tmp/telegraf.deb https://dl.influxdata.com/telegraf/releases/telegraf_${telegraf_version}_amd64.deb
dpkg -i /tmp/telegraf.deb
rm -f /tmp/telegraf.deb
# Create teleport user. It is helpful to share the same UID
# to have the same permissions on shared NFS volumes across auth servers and for consistency.
useradd -r teleport -u ${teleport_uid}
adduser teleport adm
# Setup teleport run dir for pid files
mkdir -p /var/run/teleport/
chown -R teleport:adm /var/run/teleport
# Setup teleport data dir used for transient storage
mkdir -p /var/lib/teleport/
chown -R teleport:adm /var/lib/teleport
# Download and install teleport
pushd /tmp
curl $${CURL_OPTS} -o teleport.tar.gz https://get.gravitational.com/teleport/${teleport_version}/teleport-ent-v${teleport_version}-linux-amd64-bin.tar.gz
tar -xzf /tmp/teleport.tar.gz
cp teleport-ent/tctl teleport-ent/tsh teleport-ent/teleport /usr/local/bin
rm -rf /tmp/teleport.tar.gz /tmp/teleport-ent
popd
# Install python to get access to SSM to fetch proxy join token
curl $${CURL_OPTS} -O https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py
pip install awscli
PROXY_TOKEN="`aws ssm get-parameter --with-decryption --name /teleport/${cluster_name}/tokens/proxy --region ${region} --query 'Parameter.Value' --output text`"
chown -R teleport:adm /var/lib/teleport/license.pem
# Setup teleport proxy server config file
CLUSTER_NAME="${cluster_name}"
LOCAL_IP=`curl http://169.254.169.254/latest/meta-data/local-ipv4`
LOCAL_HOSTNAME=`curl http://169.254.169.254/latest/meta-data/local-hostname`
# Install a service that fetches SSM token from parameter store
# Note that in this scenario token is written to the file.
# Script does not attempt to fetch token during boot, because the tokens are published after
# Auth servers are started.
cat >/usr/local/bin/teleport-ssm-get-token <<EOF
#!/bin/bash
set -e
set -o pipefail
# Fetch token published by Auth server to SSM parameter store to join the cluster
aws ssm get-parameter --with-decryption --name /teleport/${cluster_name}/tokens/proxy --region ${region} --query Parameter.Value --output text > /var/lib/teleport/token
# Fetch Auth server CA certificate to validate the identity of the auth server
aws ssm get-parameter --name /teleport/${cluster_name}/ca --region=${region} --query=Parameter.Value --output text > /var/lib/teleport/ca.cert
EOF
chmod 755 /usr/local/bin/teleport-ssm-get-token
cat >/etc/teleport.yaml <<EOF
teleport:
auth_token: /var/lib/teleport/token
nodename: $${LOCAL_HOSTNAME}
advertise_ip: $${LOCAL_IP}
log:
output: stderr
severity: DEBUG
data_dir: /var/lib/teleport
auth_servers:
- ${auth_server_addr}
auth_service:
enabled: no
ssh_service:
enabled: no
proxy_service:
enabled: yes
listen_addr: 0.0.0.0:3023
tunnel_listen_addr: 0.0.0.0:3080
web_listen_addr: 0.0.0.0:3080
public_addr: ${domain_name}:443
https_cert_file: /var/lib/teleport/fullchain.pem
https_key_file: /var/lib/teleport/privkey.pem
EOF
# Install and start teleport systemd unit
cat >/etc/systemd/system/teleport.service <<EOF
[Unit]
Description=Teleport SSH Service
After=network.target
[Service]
User=teleport
Group=adm
Type=simple
Restart=always
RestartSec=5
ExecStartPre=/usr/local/bin/teleport-ssm-get-token
ExecStartPre=/usr/local/bin/aws s3 sync s3://${s3_bucket}/live/${domain_name} /var/lib/teleport
ExecStart=/usr/local/bin/teleport start --config=/etc/teleport.yaml --diag-addr=127.0.0.1:3434 --pid-file=/var/run/teleport/teleport.pid
PIDFile=/var/run/teleport/teleport.pid
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
systemctl enable teleport
systemctl start teleport
# Install teleport telegraf configuration
# Telegraf will collect prometheus metrics and send to influxdb collector
cat >/etc/telegraf/telegraf.conf <<EOF
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will send metrics to outputs in batches of at
## most metric_batch_size metrics.
metric_batch_size = 1000
## For failed writes, telegraf will cache metric_buffer_limit metrics for each
## output, and will flush this buffer on a successful write. Oldest metrics
## are dropped first when this buffer fills.
metric_buffer_limit = 10000
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. You shouldn't set this below
## interval. Maximum flush_interval will be flush_interval + flush_jitter
flush_interval = "10s"
## Jitter the flush interval by a random amount. This is primarily to avoid
## large write spikes for users running a large number of telegraf instances.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
## By default, precision will be set to the same timestamp order as the
## collection interval, with the maximum being 1s.
## Precision will NOT be used for service inputs, such as logparser and statsd.
precision = ""
## Run telegraf in debug mode
debug = false
## Run telegraf in quiet mode
quiet = false
## Override default hostname, if empty use os.Hostname()
hostname = ""
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
###############################################################################
# INPUT PLUGINS #
###############################################################################
[[inputs.procstat]]
exe = "teleport"
prefix = "teleport"
[[inputs.prometheus]]
# An array of urls to scrape metrics from.
urls = ["http://127.0.0.1:3434/metrics"]
# Add a metric name prefix
name_prefix = "teleport_"
# Add tags to be able to make beautiful dashboards
[inputs.prometheus.tags]
teleservice = "teleport"
# Read metrics about cpu usage
[[inputs.cpu]]
## Whether to report per-cpu stats or not
percpu = true
## Whether to report total system cpu stats or not
totalcpu = true
## If true, collect raw CPU time metrics.
collect_cpu_time = false
## If true, compute and report the sum of all non-idle CPU states.
report_active = false
# Read metrics about disk usage by mount point
[[inputs.disk]]
## By default, telegraf gather stats for all mountpoints.
## Setting mountpoints will restrict the stats to the specified mountpoints.
# mount_points = ["/"]
## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
## present on /run, /var/run, /dev/shm or /dev).
ignore_fs = ["tmpfs", "devtmpfs", "devfs"]
# Read metrics about disk IO by device
[[inputs.diskio]]
# Get kernel statistics from /proc/stat
[[inputs.kernel]]
# no configuration
# Read metrics about memory usage
[[inputs.mem]]
# no configuration
# Get the number of processes and group them by status
[[inputs.processes]]
# no configuration
# Read metrics about swap memory usage
[[inputs.swap]]
# no configuration
# Read metrics about system load & uptime
[[inputs.system]]
# no configuration
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
## The full HTTP or UDP endpoint URL for your InfluxDB instance.
## Multiple urls can be specified as part of the same cluster,
## this means that only ONE of the urls will be written to each interval.
urls = ["${influxdb_addr}"] # required
## The target database for metrics (telegraf will create it if not exists).
database = "telegraf" # required
## Retention policy to write to. Empty string writes to the default rp.
retention_policy = ""
## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
write_consistency = "any"
## Write timeout (for the InfluxDB client), formatted as a string.
## If not provided, will default to 5s. 0s means no timeout (not recommended).
timeout = "5s"
EOF
systemctl enable telegraf.service
systemctl restart telegraf.service
| true
|
3fa9694322d9b2c73906fda5988cb61dcfd79370
|
Shell
|
xuyinhao/lgpbenchmark
|
/loongoopBench/api/bin/tail/functions
|
UTF-8
| 653
| 3.328125
| 3
|
[] |
no_license
|
#!/bin/bash
function checkOk(){
flag=1
if [ 0 -eq $1 ]; then
str=$2
len=`echo $str|wc -L`
if [ 1023 -le $len ]; then
str=$3
len=`echo $str|wc -L`
st=`echo $str|grep "中文"`
if [ "" != "$st" ]; then
len=`expr $len + 2`
fi
#echo "len:$len"
st=`echo $2|grep $str`
if [ 1023 -ne $len ] || [ "" == $st ]; then
flag=0
fi
else
if [ "$2" != "$3" ]; then
flag=0
fi
fi
#echo "tailStr:$str"
#echo "ret:$3"
else
flag=0
fi
echo $flag
}
function checkError(){
flag=1
if [ 0 -eq $1 ]; then
flag=0
else
str=`echo "$2" | grep "$3"`
if [ "$str" == "" ]; then
flag=0
fi
fi
echo $flag
}
| true
|
d8a19538b4d32199b567ad91d401fb271f3ff3bd
|
Shell
|
JordanSlater/jshen
|
/main.bash
|
UTF-8
| 196
| 2.9375
| 3
|
[] |
no_license
|
#!/bin/bash
JSHEN_DIR="$HOME/jshen/src"
for f in $(find $JSHEN_DIR -maxdepth 1 -name '*.bash' && find $JSHEN_DIR -mindepth 2 -name '*.bash'); do
source $f;
echo -n '.'
done
echo " Done."
| true
|
6e745d0f404ec1ee9d44e90d246d19a5eb2c65ea
|
Shell
|
barentsen/uvex-qc
|
/data/casu-dqc/3b-concatenate.list.sh
|
UTF-8
| 367
| 3.59375
| 4
|
[] |
no_license
|
#!/bin/bash
# This script will run through the UVEX files and concatenate all
# the summary.list files into a single "list.concatenated" file
OUTPUT="tmp/concatenated-summary-list.txt"
# Now copy the contents of all summary.sum8 files, except the header line
for FILE in `find downloaded/ -name "summary.list"`; do
echo "Adding $FILE"
cat $FILE >> $OUTPUT
done
| true
|
7c8d4d57bb50bd7ceaef7f3858c46bc7dec2817a
|
Shell
|
kowaalczyk/spark-clustering
|
/cluster.sh
|
UTF-8
| 4,017
| 3.515625
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
DO_PROJECT_ID="abb6ec4f-4c12-47ec-9ad6-53a9bb9722aa"
DO_REGION="ams3"
DO_SSH_KEY_ID="25709162"
DO_IMAGE_DISTRIBUTION_ID="53893572" # ubuntu 18.04 LTS
DO_DROPLET_SIZE_SLUG="c-8" # if you change this, also change yarn rm settings in deploy/variables.yml
DO_MASTER_DROPLET_SIZE_SLUG="c-4" # master instance does not use as much resources as slaves
DO_DROPLET_TAG="big-data"
DO_EXTRA_CREATE_OPTS="--enable-monitoring"
N_SLAVES=2
function status() {
doctl compute droplet ls --tag-name "$DO_DROPLET_TAG" \
--format "ID,Name,PublicIPv4,Image,Memory,VCPUs,Disk"
}
function up() {
echo "Using droplet image:"
doctl compute image get "$DO_IMAGE_DISTRIBUTION_ID"
echo "Using droplet size: $DO_DROPLET_SIZE_SLUG"
echo "Script will create $((N_SLAVES+1)) droplets"
echo ""
echo "Creating droplets:"
# master
doctl compute droplet create \
"ubuntu-master" \
--region "$DO_REGION" \
--ssh-keys "$DO_SSH_KEY_ID" \
--image "$DO_IMAGE_DISTRIBUTION_ID" \
--size "$DO_MASTER_DROPLET_SIZE_SLUG" \
--tag-name "$DO_DROPLET_TAG" \
--format "ID,Name,Image,Memory,VCPUs,Disk" \
$DO_EXTRA_CREATE_OPTS
# slaves
for i in $(seq -f "%02g" 1 $N_SLAVES); do
doctl compute droplet create \
"ubuntu-slave-${i}" \
--region "$DO_REGION" \
--ssh-keys "$DO_SSH_KEY_ID" \
--image "$DO_IMAGE_DISTRIBUTION_ID" \
--size "$DO_DROPLET_SIZE_SLUG" \
--tag-name "$DO_DROPLET_TAG" \
--format "ID,Name,Image,Memory,VCPUs,Disk" \
--no-header \
$DO_EXTRA_CREATE_OPTS
done
# assign to project
droplets=$(doctl compute droplet ls --format ID --no-header --tag-name "$DO_DROPLET_TAG")
for droplet in $droplets; do
doctl projects resources assign "$DO_PROJECT_ID" --resource "do:droplet:$droplet"
done
# wait for IPs
echo ""
echo "Waiting for IP assignment..."
n_droplets=$(echo "$droplets" | wc -w | tr -d ' ')
n_ready_droplets=$(doctl compute droplet ls \
--tag-name "$DO_DROPLET_TAG" \
--format "PublicIPv4" \
--no-header | wc -w | tr -d '\blank')
while [[ "$n_ready_droplets" -lt "$n_droplets" ]]; do
echo "$n_ready_droplets out of $n_droplets..."
sleep 3
n_ready_droplets=$(doctl compute droplet ls \
--tag-name "$DO_DROPLET_TAG" \
--format "PublicIPv4" \
--no-header | wc -w | tr -d '\blank')
done
# display status with IPs
echo ""
status
}
function down() {
droplets=$(doctl compute droplet ls --format ID --no-header --tag-name "$DO_DROPLET_TAG")
doctl compute droplet rm $droplets -f
}
function rebuild() {
# rebuild all project droplets
droplets=$(doctl compute droplet ls --format ID --no-header --tag-name "$DO_DROPLET_TAG")
for droplet in $droplets; do
doctl compute droplet-action rebuild "$droplet" --image "$DO_IMAGE_DISTRIBUTION_ID"
done
# wait for IPs
echo ""
echo "Waiting for IP assignment..."
n_droplets=$(echo "$droplets" | wc -w | tr -d ' ')
n_ready_droplets=$(doctl compute droplet ls \
--tag-name "$DO_DROPLET_TAG" \
--format "PublicIPv4" \
--no-header | wc -w | tr -d '\blank')
while [[ "$n_ready_droplets" -lt "$n_droplets" ]]; do
echo "$n_ready_droplets out of $n_droplets..."
sleep 3
n_ready_droplets=$(doctl compute droplet ls \
--tag-name "$DO_DROPLET_TAG" \
--format "PublicIPv4" \
--no-header | wc -w | tr -d '\blank')
done
# display status with IPs
echo ""
status
}
if [[ "$#" -ne 1 ]]; then
echo "Usage: $0 [up|down|status|rebuild]"
exit 2
fi
case "$1" in
up)
up
;;
status)
status
;;
down)
down
;;
rebuild)
rebuild
;;
*)
echo "Usage: $0 [up|down|status|rebuild]"
exit 2
;;
esac
| true
|
a40e7be48a37834ef0392752c41e66b00aeafb29
|
Shell
|
abhishekamralkar/robo-env
|
/daemons/setup-alacritty.sh
|
UTF-8
| 1,865
| 3.59375
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
# Author: Abhishek Anand Amralkar
# This script setsup Alacritty.
CONFIG_DIR=${CONFIG_DIR:-"/home/aaa/.config/alacritty"}
RUSTC_PATH=${RUSTC_PATH:-"/home/aaa/.cargo/bin/rustc"}
ALACRITTY_PATH=${ALACRITTY_PATH:-"/usr/local/bin/alacritty"}
sudo apt-get install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev python3 -y
# install rust
get_rust () {
if [ ! -e "$RUSTC_PATH" ]; then
curl https://sh.rustup.rs -sSf | sh
rustup override set stable
rustup update stable
else
echo "Rust Installed"
fi
}
get_alacritty () {
if [ ! -e "$ALACRITTY_PATH" ];
then
rm -rf /tmp/alacritty \
cd /tmp/ \
&& git clone https://github.com/alacritty/alacritty.git \
&& cd /tmp/alacritty \
&& cargo build --release \
&& infocmp alacritty \
&& sudo tic -xe alacritty,alacritty-direct extra/alacritty.info \
&& sudo cp target/release/alacritty /usr/local/bin \
&& sudo cp extra/logo/alacritty-term.svg /usr/share/pixmaps/Alacritty.svg \
&& sudo desktop-file-install extra/linux/Alacritty.desktop \
&& sudo update-desktop-database \
&& sudo mkdir -p /usr/local/share/man/man1 \
&& sudo gzip -c extra/alacritty.man | sudo tee /usr/local/share/man/man1/alacritty.1.gz > /dev/null \
&& mkdir -p ${ZDOTDIR:-~}/.zsh_functions \
&& echo 'fpath+=${ZDOTDIR:-~}/.zsh_functions' >> ${ZDOTDIR:-~}/.zshrc \
&& cp extra/completions/_alacritty ${ZDOTDIR:-~}/.zsh_functions/_alacritty
else
echo "Alacritty Installed"
fi
}
config_alacritty () {
if [ ! -e "$CONFIG_DIR" ]; then
mkdir -p ${CONFIG_DIR}
cd ${CONFIG_DIR} && wget https://raw.githubusercontent.com/abhishekamralkar/configs/master/alacritty/alacritty.yml
fi
}
main () {
get_rust
get_alacritty
config_alacritty
}
main
| true
|
1f46f450950605f015ed2c35a76f4097ccc52de5
|
Shell
|
VPH-Share/VPHOP_NMSLoads
|
/manage/provision.sh
|
UTF-8
| 1,086
| 2.734375
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -o nounset
set -o errexit
shopt -s expand_aliases
#######################################
# Source helper utilities
source manage/utils.sh
log "Updating OS packages"
pkgupdate
log "Setting GB locale"
setlocales
#######################################
log "Installing SOAPlib Commandline Wrapper dependencies"
pkginstall python-pip
pkginstall python-dev python-lxml
pkginstall octave
sudo pip install -r $REPO_DIR/manage/requirements.txt
#######################################
log "Configure SOAPLib to autostart"
sudo cat $REPO_DIR/manage/initd.vphop_nmsloads > /etc/init.d/vphop_nmsloads
sudo chmod +x /etc/init.d/vphop_nmsloads
sudo update-rc.d vphop_nmsloads defaults
#######################################
log "Starting application"
sudo service vphop_nmsloads start
#######################################
log "Deconfigure Github Deployinator to autostart"
sudo update-rc.d githubdeploy disable
sudo rm /etc/init.d/githubdeploy
#######################################
log "Cleaning up..."
pkgclean
pkgautoremove
history -c
#######################################
| true
|
8e4c1240108a4cd8bf01d1be7aed527600ab7692
|
Shell
|
vcatafesta/jhalfs
|
/common/common-functions
|
UTF-8
| 3,223
| 4.125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# $Id$
set -e
no_empty_builddir() {
'clear'
cat <<- -EOF-
${DD_BORDER}
${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
Looks like the \$BUILDDIR directory contains subdirectories
from a previous build.
Please format the partition mounted on \$BUILDDIR or set
a different build directory before running jhalfs.
${OFF}
${DD_BORDER}
-EOF-
exit
}
#----------------------------#
run_make() { #
#----------------------------#
# Test if make must be run.
if [ "$RUNMAKE" = "y" ] ; then
# Test to make sure we're not running the build as root
if [ "$UID" = "0" ] ; then
echo "You must not be logged in as root to build the system."
exit 1
fi
# Build the system
if [ -e "$MKFILE" ] ; then
echo -ne "Building the system...\n"
if { echo try tty; tty; }; then
cd "$JHALFSDIR" && make
echo -ne "done\n"
else echo there is no terminal!!; fi
fi
fi
}
#----------------------------#
clean_builddir() { #
#----------------------------#
# Test if the clean must be done.
if [ "${CLEAN}" = "y" ]; then
# If empty (i.e. could contain lost+found), do not do anything
if ls -d $BUILDDIR/* > /dev/null 2>&1 &&
[ "$(ls $BUILDDIR)" != "lost+found" ]; then
# Test to make sure that the build directory was populated by jhalfs
if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
echo "Looks like $BUILDDIR was not populated by a previous jhalfs run."
exit 1
# Test that dev filesystems are not mounted in $BUILDDIR
elif mount | grep $BUILDDIR/dev > /dev/null ; then
echo "Looks like kernel filesystems are still mounted on $BUILDDIR."
exit 1
else
if [ $JHALFSDIR/*gcc-pass1 != $JHALFSDIR/'*gcc-pass1' ]; then
echo -n "$BUILDDIR contains already built packages. Clean anyway? yes/no (yes): "
read ANSWER
if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
echo "${nl_}Rerun and change the option in the menu.${nl_}"
exit 1
fi
fi
# Clean the build directory
echo -n "Cleaning $BUILDDIR ..."
# First delete proc and sys directories, if they exist.
# Both should be empty. If not, we exit, and the rmdir command
# has generated an error message
if [ -d $BUILDDIR/proc ] ; then
sudo rmdir $BUILDDIR/proc || exit 1
fi
if [ -d $BUILDDIR/sys ] ; then
sudo rmdir $BUILDDIR/sys || exit 1
fi
sudo rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib{,64,32,x32},media,mnt,run}
sudo rm -rf $BUILDDIR/{opt,root,sbin,srv,tmp,tools,cross-tools,usr,var}
echo "done"
if [[ "${BLFS_TOOL}" = "y" ]] ; then
echo -n "Cleaning $BUILDDIR/$BLFS_ROOT ..."
sudo rm -rf $BUILDDIR/$BLFS_ROOT
echo "done"
fi
echo -n "Cleaning $JHALFSDIR ..."
sudo rm -rf $JHALFSDIR
echo "done"
echo -n "Cleaning remaining extracted sources in $BUILDDIR/sources ..."
sudo rm -rf `find $BUILDDIR/sources -maxdepth 1 -mindepth 1 -type d`
echo "done"
echo -n "Removing dangling symlinks in / ..."
sudo rm -f /tools /cross-tools
echo "done"
fi
fi
fi
}
| true
|
14e99936956cfe09c5bcf4c328b841ffb28a8e94
|
Shell
|
AndyQiao/config_etc
|
/bashrc
|
UTF-8
| 977
| 2.65625
| 3
|
[] |
no_license
|
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# ----- alias -------
# 以文件名查找文件
alias nfind="find . -type f -name"
# 查找当前目录下所有文件中是否包含特定字符串
alias sfind="find . -type f -name '*'|xargs grep"
# 查找当前目录下所有.h文件是否包含特定字符串
alias hfind="find . -type f -iname '*.h'|xargs grep"
# 查找当前目录下所有.c .cpp文件是否包含特定字符串
alias cfind="find . -type f -iname '*.c*' |xargs grep"
alias sfind="find . -name '*'|xargs grep"
alias ll="ls -l"
alias cmk="make clean;make"
alias gitst="git status"
alias gitlog="git log --name-status"
alias gitck="git checkout"
alias gitsl="git stash list"
alias gitsp="git stash pop"
alias gitbr="git branch"
export PYTHONPATH=:/usr/local/python3/lib/python3.6/site-packages$PYTHONPATH
| true
|
318a29657e8a326d6edb35b2ab67ac15dece2e45
|
Shell
|
jez/dotfiles
|
/osx-setup.sh
|
UTF-8
| 9,177
| 3.234375
| 3
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#!/usr/bin/env bash
# =========================================================================== #
# #
# osx-setup.sh #
# #
# Author: Jake Zimmerman #
# Email: jake@zimmerman.io #
# #
# This is a script designed to be run on a fresh OS X installation. #
# It has yet to be tested, though it is an accurate transcription of #
# I just ran when setting up my OS X installation after a clean re-install. #
# #
# You may want to run the individual commands manually, instead of as a #
# script. In fact, in it's current state, it calls `exit` halfway through #
# and doesn't finish. #
# #
# TODO: #
# - Utilize Homebrew Cask to install actual apps. #
# #
# =========================================================================== #
# Install Xcode tools
xcode-select --install
# Note: MacVim (and possibly smlnj I'm not quite sure) require a full-blown
# Xcode installation to work
# Install and set up Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
# Set up PATH until we clone our dotfiles
# Not necessary on OS X 10.10 (Yosemite)
export PATH="/usr/local/bin:$PATH"
# Install iTerm2
brew cask install iterm2
# Install and setup git
brew install git
# Install Hub for convenience before we start doing Git commands
brew install hub
# Install newest bash and zsh and make zsh the login shell
brew install bash
brew install bash-completion
echo "$(brew --prefix)/bin/bash" | sudo tee -a /etc/shells
# (you do actually want to still do this btw)
brew install zsh
echo "$(brew --prefix)/bin/zsh" | sudo tee -a /etc/shells
chsh -s "$(brew --prefix)/bin/zsh"
# Install gnu coreutils
brew install coreutils
# Note: my bash_profile allows these commands to be run without prefixes
# Install newest vim
brew install vim
# Set up dotfiles
brew tap thoughtbot/formulae
brew install rcm
# TODO(jez) Document how to set up all the ssh keys you need
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
# On Stripe machines:
vim ~/.ssh/config
# comment out the `Host *` section
# If you are not Jake Zimmerman, you will want to fork this repo first
hub clone --recursive jez/dotfiles ~/.dotfiles
cd ~/.dotfiles
# Make sure we use correct rcrc, as there will be no ~/.rcrc yet
RCRC="./rcrc" rcup
# or for Stripe laptops:
RCRC="./rcrc" rcup -B st-jez1 -d ~/stripe/dotfiles
cd -
# Set up host-specific (git, sh, zsh, etc.)
# The best way to do this is to look at MacBook Air, Dropbox, & Stripe manually
# Files you'll almost certainly need in some form:
# gitignore, gitconfig, host.sh, host.zsh
# You may also want to look at:
# ssh/config
# Now that dotfiles have been installed, exit and re-open iTerm2
exit
# Set up iTerm2
#
# Load preferences from folder (choose: ~/.dotfiles)
# Install Iosevka Fixed
# https://github.com/be5invis/Iosevka/blob/master/doc/PACKAGE-LIST.md#packaging-formats
# Install Menlo for Powerline (from ~/.dotfiles/fonts/)
# Download and import iTerm colors
git clone https://github.com/mbadolato/iTerm2-Color-Schemes ~/Desktop/iTerm2-Color-Schemes
open ~/Desktop/iTerm2-Color-Schemes/schemes/
# Import whichever you'd like by selecting and pressing Cmd + O
# Use iTerm2 settings file by going to preferences and selecting to load
# preferences from a folder: ~/.dotfiles
# Install neovim for the lulz
brew tap neovim/neovim
brew install neovim
ln -s ~/.vim ~/.config/nvim
# Install fzf
brew install fzf fd
/usr/local/opt/fzf/install
mkrc -o ~/.fzf.zsh
rm ~/.fzf.bash
# Install ruby
brew install rbenv
brew install ruby-build
echo "rbenv is installed."
echo "You'll still have to install ruby 1.9.3 for Octopress."
cat << EOF
(within Octopress project root directory)
$ rbenv install 1.9.3-p0
$ rbenv local 1.9.3-p0
$ rbenv rehash
EOF
echo "http://octopress.org/docs/setup/rbenv/"
# Other utilities
brew cask install alfred
brew cask alfred
brew cask install google-chrome
brew cask install google-drive
brew cask install dropbox
brew cask install spotify
brew cask install amethyst
brew cask install inskape
brew cask install calibre
brew cask install fitbit-connect
brew cask install rcdefaultapp
brew cask install karabiner
brew cask install flux
# Install python
brew install python
brew install python3
# Install node
brew install node
# Helper utilities
brew install tree
brew install wget
brew install ack
brew install tmux
brew install htop
brew install ctags
brew install gist
brew install heroku-toolbelt
brew install imagemagick
brew install watch
brew install rlwrap
brew install icdiff
# After installing Xcode
# TODO install Xcode using script
sudo xcodebuild -license
# Install MacVim
brew install macvim
brew linkapps
# You may want to install RCDefaultApps to deal with using MacVim for opening
# text files
# Install smlnj
brew install smlnj
# After installing python
# Install virtualenvwrapper
pip install virtualenvwrapper
# Note: requires relaunching the terminal to work
# Helper utilities
pip install grip
# After installing node
npm install -g jade
# GUI Settings
# TODO: Automate this
# System Preferences
# - General
# - Use dark menubar and doc
# - Desktop & Screen Saver
# - Desktop
# - Source: Pokemon
# - Change picture: when logging in
# - Screen Saver
# - Classic
# - Source: Pokemon
# - Shuffle slide order
# - Hot Corners...
# - Bottom left: Start Screen Saver
# - Dock
# - Automatically hide and show the dock
# - Mission Control
# - no Automatically rearrange spaces based on recent use
# - Dashboard: As Space
# - if on MacBook Pro:
# - Display
# - Display
# - Looks like 1680 x 1050
# - Trackpad
# - Point & Click
# - Tap to click
# - Date & Time
# - Clock
# - Show date
# - Accessibility
# - Zoom
# - Use scroll gesture with modifier keys to zoom
# - Unckeck "Smooth images"
# - Trackpad Options...
# - Enable dragging
# - Display
# - Unckeck "Shake mouse pointer to locate"
# - Sound
# - Sound Effects
# - Play feedback when volume is changed
# - Keyboard
# - Keyboard
# - Key repeat
# - Fast
# - Delay until repeat
# - Short
# - Touch Bar shows: Expanded Control Strip
# - Modifier Keys...
# - Swap Caps to Ctrl
# - Show keyboard and emoji viewers in menu bar
# - Shortcuts
# - Mission Control
# - Mission Control
# - Move left a space: Option + Shift + [
# - Move right a space: Option + Shift + ]
# - Spotlight
# - Show Spotlight search: Ctrl + Space
# - Don't forget to install alfred and change to Command + Space
# - Accessibility
# - Invert colors
# - App Shortcuts
# - Google Chrome.app
# - Add
# - "Select Next Tab"
# - Cmd + Option + ]
# - "Select Previous Tab"
# - Cmd + Option + [
# - Sketch.app
# - Add
# - "ArtboardZoom - Zoom to selected Artboard"
# - Ctrl + Space
# - "Show Smart Guides"
# - Cmd + R
# Alfred
# - General
# - Alfred Hotkey
# - Command + Space
# - Appearance
# - Theme
# - OS X Yosemite Dark
# - Options
# - Hide hat on Alfred window
# Desktop
# - Sort By
# - Snap to Grid
# Menu Bar
# - Battery Icon
# - Show Percentage
# Spotify
# - View
# - Uncheck "Right sidebar"
# Finder
# - General
# - New Finder windows show
# - $HOME
# - Advanced
# - Show all filename extensions
# - no Show warning before changing an extension
# - Favorites
# - Desktop
# - Documents
# - Dropbox
# - Screenshots
# - Applications
# - Home
# - Sort By:
# - View > [hold Option] Sort by ... > Name
# Downloads
# - Remove Downloads, symlink to Desktop
# Chrome
#
# - Setting up personal laptop?
# - Sign into personal Chrome. Done.
# - Setting up work laptop?
# - Copy these from personal account:
# - chrome://settings
# - chrome://extensions
# - Enable keyboard shortcuts for Inbox
# - Vimium settings
# - Stylebot settings
# Messages
#
# - Add iCloud account
# - Be sure to sync contacts from Google account (not iCloud)
# - Google when you need help
| true
|
0c9e74600a322a9727356a7f31bd3b2b29065d89
|
Shell
|
uhulinux/ub-ubk4
|
/lua51/install
|
UTF-8
| 712
| 2.9375
| 3
|
[] |
no_license
|
#!/bin/sh -eux
make \
TO_BIN='lua5.1 luac5.1' \
TO_LIB="liblua5.1.a liblua5.1.so liblua5.1.so.5.1 liblua5.1.so.$UB_VERSION" \
INSTALL_DATA='cp -d' \
INSTALL_TOP="$UB_INSTALLDIR"/usr \
INSTALL_INC="$UB_INSTALLDIR"/usr/include/lua5.1 \
INSTALL_MAN="$UB_INSTALLDIR"/usr/share/man/man1 \
install
mkdir -p "$UB_INSTALLDIR"/usr/lib/pkgconfig
cp etc/lua.pc "$UB_INSTALLDIR"/usr/lib/pkgconfig/lua51.pc
ln -sf lua51.pc "$UB_INSTALLDIR"/usr/lib/pkgconfig/lua5.1.pc
ln -sf lua51.pc "$UB_INSTALLDIR"/usr/lib/pkgconfig/lua-5.1.pc
cd "$UB_INSTALLDIR"/usr/share/man/man1
mv lua.1 lua5.1.1
mv luac.1 luac5.1.1
ln -sf lua5.1 "$UB_INSTALLDIR"/usr/bin/lua
ln -sf luac5.1 "$UB_INSTALLDIR"/usr/bin/luac
| true
|
f0c1087d024780a2483c9ca57d60b8f0f101379b
|
Shell
|
adrg/.dotfiles
|
/bash/bash_aliases
|
UTF-8
| 2,270
| 3.0625
| 3
|
[] |
no_license
|
# ====================================================
# = Author: Adrian-George Bostan <adrg@epistack.com> =
# = Version: 1.0 =
# ====================================================
# Enable color support for some commands
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto --group-directories-first'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# ls
alias ll='ls -AlF'
alias la='ls -A'
alias l='ls -CF'
# cd
alias ..='cd ..'
alias ...='cd ../..'
alias cdr='cd $(git rev-parse --show-toplevel)'
# apt-get
alias apt-update='sudo apt-get update'
alias apt-upgrade='sudo apt-get upgrade'
alias apt-dist-upgrade='sudo apt-get dist-upgrade'
alias apt-install='sudo apt-get install'
alias apt-clean='sudo apt-get autoremove --purge'
alias apt-search='sudo apt-cache search'
# vim
alias v='vim'
alias vp='vim -p'
# git
alias g='git'
alias gi='git init'
alias gs='git status'
alias gsi='git status --ignored'
alias gl='git log'
alias gd='git diff'
alias gdc='git diff --cached'
alias ga='git add'
alias gb='git branch'
alias gc='git checkout'
alias gcb='git checkout -b'
alias gp='git pull'
alias gm='git merge'
alias gco='git commit'
alias gps='git push'
alias gra='git remote add'
alias grr='git remote rm'
# Add completion to git aliases
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
__git_complete g _git_main
__git_complete gi _git_init
__git_complete gl _git_log
__git_complete gd _git_diff
__git_complete gdc _git_diff
__git_complete ga _git_add
__git_complete gb _git_branch
__git_complete gc _git_checkout
__git_complete gcb _git_checkout
__git_complete gp _git_pull
__git_complete gm _git_merge
__git_complete gco _git_commit
__git_complete gps _git_push
__git_complete gra _git_remote
__git_complete grr _git_remote
fi
# Go
alias govetall='go vet ./...; GOOS=windows go vet ./...; GOOS=darwin go vet ./...; GOOS=plan9 go vet ./...'
alias golintall='golint ./...; GOOS=windows golint ./...; GOOS=darwin golint ./...; GOOS=plan9 golint ./...'
# Misc
alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
| true
|
c2c1e6982e7d683148dd01dcb73171bc1583441f
|
Shell
|
tmasiff/android_tool_aot
|
/tools/zipalign-script
|
UTF-8
| 1,631
| 3.5
| 4
|
[] |
no_license
|
#!/bin/bash
# Findlee (c) 2013
# thefindlee@gmail.com
app_zipalign () {
apk=`find app | grep -c ".apk"`
if [[ "$apk" != "0" ]]
then
cd app
apklist=`find *.apk`
setterm -bold
tput setaf 1
echo "Zipaligning in app folder"
tput sgr0
echo "-----------"
for zipaligning in ${apklist[@]}
do
../tools/zipalign 4 $zipaligning $zipaligning-zipaligned
rm $zipaligning
mv $zipaligning-zipaligned $zipaligning
echo $zipaligning zipaligned
done
cd ..
echo "Zipaligning in app folder finished"
else
echo "Apk files in app folder not found"
fi
}
framework_zipalign () {
apkfr=`find framework | grep -c ".apk"`
jarfr=`find framework | grep -c ".jar"`
if [[ "$apkfr" != "0" ]] && [[ "$jarfr" != "0" ]]
then
cd framework
apkfrlist=`find *.apk`
setterm -bold
tput setaf 1
echo "Zipaligning in framework folder"
tput sgr0
echo "-----------"
for zipaligningfrapk in ${apkfrlist[@]}
do
../tools/zipalign 4 $zipaligningfrapk $zipaligningfrapk-zipaligned
rm $zipaligningfrapk
mv $zipaligningfrapk-zipaligned $zipaligningfrapk
echo "$zipaligningfrapk" zipaligned
done
cd ..
echo "Zipaligning in framework folder finished"
else
echo "Apk files in framework folder not found"
fi
}
while true
do
setterm -bold
tput setaf 1
clear
echo "============================================================="
echo "APK Zipalign Tool by Findlee v.1.0"
echo "============================================================="
tput sgr0
echo "
1)Zipaling app and framework
2)Zipaling only app
3)Zipalign only framework
4)Main Menu
"
read -p "Option: " opt
case $opt in
1)
app_zipalign
framework_zipalign
;;
2)
app_zipalign
;;
3)
framework_zipalign
;;
4)./aot
;;
esac
done
| true
|
fd5eec9c200005d2e57e180f414c675242b3a59b
|
Shell
|
juliangiuca/ubuntu-packer-images
|
/scripts/install-nodejs.sh
|
UTF-8
| 362
| 3
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
set -euf -o pipefail
NODEJS_VERSION=11
# Set up the latest Node.js repository and add official GPG key
curl -sL "https://deb.nodesource.com/setup_$NODEJS_VERSION.x" | bash -
# Install Node.js and Yarn
apt-get update -qq && apt-get install -y nodejs
# Upgrade to the latest of NPM
npm i -g npm
# Install PM2 process manager
npm i -g pm2
| true
|
49f7a8f6bbf664df518b240cb86290612a1d708f
|
Shell
|
placid-void/cloudpush
|
/roles/docker-delugevpn/files/init.sh
|
UTF-8
| 14,665
| 3.609375
| 4
|
[] |
no_license
|
#!/bin/bash
# exit script if return code != 0
set -e
# redirect new file descriptors and then tee stdout & stderr to supervisor log and console (captures output from this script)
exec 3>&1 4>&2 &> >(tee -a /config/supervisord.log)
cat << "EOF"
Created by...
___. .__ .__
\_ |__ |__| ____ | |__ ____ ___ ___
| __ \| |/ \| | \_/ __ \\ \/ /
| \_\ \ | | \ Y \ ___/ > <
|___ /__|___| /___| /\___ >__/\_ \
\/ \/ \/ \/ \/
https://hub.docker.com/u/binhex/
EOF
if [[ "${HOST_OS}" == "unRAID" ]]; then
echo "[info] Host is running unRAID" | ts '%Y-%m-%d %H:%M:%.S'
fi
echo "[info] System information $(uname -a)" | ts '%Y-%m-%d %H:%M:%.S'
export OS_ARCH=$(cat /etc/os-release | grep -P -o -m 1 "(?=^ID\=).*" | grep -P -o -m 1 "[a-z]+$")
if [[ ! -z "${OS_ARCH}" ]]; then
if [[ "${OS_ARCH}" == "arch" ]]; then
OS_ARCH="x86-64"
else
OS_ARCH="aarch64"
fi
echo "[info] OS_ARCH defined as '${OS_ARCH}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] Unable to identify OS_ARCH, defaulting to 'x86-64'" | ts '%Y-%m-%d %H:%M:%.S'
export OS_ARCH="x86-64"
fi
export PUID=$(echo "${PUID}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${PUID}" ]]; then
echo "[info] PUID defined as '${PUID}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] PUID not defined (via -e PUID), defaulting to '99'" | ts '%Y-%m-%d %H:%M:%.S'
export PUID="99"
fi
# set user nobody to specified user id (non unique)
usermod -o -u "${PUID}" nobody &>/dev/null
export PGID=$(echo "${PGID}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${PGID}" ]]; then
echo "[info] PGID defined as '${PGID}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] PGID not defined (via -e PGID), defaulting to '100'" | ts '%Y-%m-%d %H:%M:%.S'
export PGID="100"
fi
# set group users to specified group id (non unique)
groupmod -o -g "${PGID}" users &>/dev/null
# set umask to specified value if defined
if [[ ! -z "${UMASK}" ]]; then
echo "[info] UMASK defined as '${UMASK}'" | ts '%Y-%m-%d %H:%M:%.S'
sed -i -e "s~umask.*~umask = ${UMASK}~g" /etc/supervisor/conf.d/*.conf
else
echo "[warn] UMASK not defined (via -e UMASK), defaulting to '000'" | ts '%Y-%m-%d %H:%M:%.S'
sed -i -e "s~umask.*~umask = 000~g" /etc/supervisor/conf.d/*.conf
fi
# check for presence of perms file, if it exists then skip setting
# permissions, otherwise recursively set on volume mappings for host
# if [[ ! -f "/config/perms.txt" ]]; then
# echo "[info] Setting permissions recursively on volume mappings..." | ts '%Y-%m-%d %H:%M:%.S'
# if [[ -d "{{ directories.data_dir }}" ]]; then
# volumes=( "/config" "{{ directories.data_dir }}" )
# else
# volumes=( "/config" )
# fi
# set +e
# chown -R "${PUID}":"${PGID}" "${volumes[@]}"
# exit_code_chown=$?
# chmod -R 775 "${volumes[@]}"
# exit_code_chmod=$?
# set -e
# if (( ${exit_code_chown} != 0 || ${exit_code_chmod} != 0 )); then
# echo "[warn] Unable to chown/chmod ${volumes}, assuming SMB mountpoint"
# fi
# echo "This file prevents permissions from being applied/re-applied to /config, if you want to reset permissions then please delete this file and restart the container." > /config/perms.txt
# else
# echo "[info] Permissions already set for volume mappings" | ts '%Y-%m-%d %H:%M:%.S'
# fi
# check for presence of network interface docker0
check_network=$(ifconfig | grep docker0 || true)
# if network interface docker0 is present then we are running in host mode and thus must exit
if [[ ! -z "${check_network}" ]]; then
echo "[crit] Network type detected as 'Host', this will cause major issues, please stop the container and switch back to 'Bridge' mode" | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
export DELUGE_DAEMON_LOG_LEVEL=$(echo "${DELUGE_DAEMON_LOG_LEVEL}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${DELUGE_DAEMON_LOG_LEVEL}" ]]; then
echo "[info] DELUGE_DAEMON_LOG_LEVEL defined as '${DELUGE_DAEMON_LOG_LEVEL}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[info] DELUGE_DAEMON_LOG_LEVEL not defined,(via -e DELUGE_DAEMON_LOG_LEVEL), defaulting to 'info'" | ts '%Y-%m-%d %H:%M:%.S'
export DELUGE_DAEMON_LOG_LEVEL="info"
fi
export DELUGE_WEB_LOG_LEVEL=$(echo "${DELUGE_WEB_LOG_LEVEL}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${DELUGE_WEB_LOG_LEVEL}" ]]; then
echo "[info] DELUGE_WEB_LOG_LEVEL defined as '${DELUGE_WEB_LOG_LEVEL}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[info] DELUGE_WEB_LOG_LEVEL not defined,(via -e DELUGE_WEB_LOG_LEVEL), defaulting to 'info'" | ts '%Y-%m-%d %H:%M:%.S'
export DELUGE_WEB_LOG_LEVEL="info"
fi
export VPN_ENABLED=$(echo "${VPN_ENABLED}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_ENABLED}" ]]; then
if [ "${VPN_ENABLED}" != "no" ] && [ "${VPN_ENABLED}" != "No" ] && [ "${VPN_ENABLED}" != "NO" ]; then
export VPN_ENABLED="yes"
echo "[info] VPN_ENABLED defined as '${VPN_ENABLED}'" | ts '%Y-%m-%d %H:%M:%.S'
else
export VPN_ENABLED="no"
echo "[info] VPN_ENABLED defined as '${VPN_ENABLED}'" | ts '%Y-%m-%d %H:%M:%.S'
echo "[warn] !!IMPORTANT!! VPN IS SET TO DISABLED', YOU WILL NOT BE SECURE" | ts '%Y-%m-%d %H:%M:%.S'
fi
else
echo "[warn] VPN_ENABLED not defined,(via -e VPN_ENABLED), defaulting to 'yes'" | ts '%Y-%m-%d %H:%M:%.S'
export VPN_ENABLED="yes"
fi
if [[ $VPN_ENABLED == "yes" ]]; then
# create directory to store openvpn config files
mkdir -p /config/openvpn
# set perms and owner for files in /config/openvpn directory
set +e
chown -R "${PUID}":"${PGID}" "/config/openvpn" &> /dev/null
exit_code_chown=$?
chmod -R 775 "/config/openvpn" &> /dev/null
exit_code_chmod=$?
set -e
if (( ${exit_code_chown} != 0 || ${exit_code_chmod} != 0 )); then
echo "[warn] Unable to chown/chmod /config/openvpn/, assuming SMB mountpoint" | ts '%Y-%m-%d %H:%M:%.S'
fi
# force removal of mac os resource fork files in ovpn folder
rm -rf /config/openvpn/._*.ovpn
# wildcard search for openvpn config files (match on first result)
export VPN_CONFIG=$(find /config/openvpn -maxdepth 1 -name "*.ovpn" -print -quit)
# if ovpn file not found in /config/openvpn then exit
if [[ -z "${VPN_CONFIG}" ]]; then
echo "[crit] No OpenVPN config file located in /config/openvpn/ (ovpn extension), please download from your VPN provider and then restart this container, exiting..." | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
echo "[info] OpenVPN config file (ovpn extension) is located at ${VPN_CONFIG}" | ts '%Y-%m-%d %H:%M:%.S'
# convert CRLF (windows) to LF (unix) for ovpn
/usr/local/bin/dos2unix.sh "${VPN_CONFIG}"
# get first matching 'remote' line in ovpn
vpn_remote_line=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '^(\s+)?remote\s.*' || true)
if [ -n "${vpn_remote_line}" ]; then
# remove all remote lines as we cannot cope with multi remote lines
sed -i -E '/^(\s+)?remote\s.*/d' "${VPN_CONFIG}"
# if remote line contains comments then remove
vpn_remote_line=$(echo "${vpn_remote_line}" | sed -r 's~\s?+#.*$~~g')
# if remote line contains old format 'tcp' then replace with newer 'tcp-client' format
vpn_remote_line=$(echo "${vpn_remote_line}" | sed "s/tcp$/tcp-client/g")
# write the single remote line back to the ovpn file on line 1
sed -i -e "1i${vpn_remote_line}" "${VPN_CONFIG}"
echo "[info] VPN remote line defined as '${vpn_remote_line}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[crit] VPN configuration file ${VPN_CONFIG} does not contain 'remote' line, showing contents of file before exit..." | ts '%Y-%m-%d %H:%M:%.S'
cat "${VPN_CONFIG}" && exit 1
fi
export VPN_REMOTE=$(echo "${vpn_remote_line}" | grep -P -o -m 1 '(?<=remote\s)[^\s]+' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_REMOTE}" ]]; then
echo "[info] VPN_REMOTE defined as '${VPN_REMOTE}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[crit] VPN_REMOTE not found in ${VPN_CONFIG}, exiting..." | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
export VPN_PORT=$(echo "${vpn_remote_line}" | grep -P -o -m 1 '\d{2,5}(\s?)+(tcp|udp|tcp-client)?$' | grep -P -o -m 1 '\d+' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PORT}" ]]; then
echo "[info] VPN_PORT defined as '${VPN_PORT}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[crit] VPN_PORT not found in ${VPN_CONFIG}, exiting..." | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
# if 'proto' is old format 'tcp' then replace with newer 'tcp-client' format
sed -i "s/^proto\stcp$/proto tcp-client/g" "${VPN_CONFIG}"
export VPN_PROTOCOL=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '(?<=^proto\s)[^\r\n]+' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PROTOCOL}" ]]; then
echo "[info] VPN_PROTOCOL defined as '${VPN_PROTOCOL}'" | ts '%Y-%m-%d %H:%M:%.S'
else
export VPN_PROTOCOL=$(echo "${vpn_remote_line}" | grep -P -o -m 1 'udp|tcp-client|tcp$' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PROTOCOL}" ]]; then
echo "[info] VPN_PROTOCOL defined as '${VPN_PROTOCOL}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] VPN_PROTOCOL not found in ${VPN_CONFIG}, assuming udp" | ts '%Y-%m-%d %H:%M:%.S'
export VPN_PROTOCOL="udp"
fi
fi
VPN_DEVICE_TYPE=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '(?<=^dev\s)[^\r\n\d]+' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_DEVICE_TYPE}" ]]; then
export VPN_DEVICE_TYPE="${VPN_DEVICE_TYPE}0"
echo "[info] VPN_DEVICE_TYPE defined as '${VPN_DEVICE_TYPE}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[crit] VPN_DEVICE_TYPE not found in ${VPN_CONFIG}, exiting..." | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
# get values from env vars as defined by user
export VPN_PROV=$(echo "${VPN_PROV}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PROV}" ]]; then
echo "[info] VPN_PROV defined as '${VPN_PROV}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[crit] VPN_PROV not defined,(via -e VPN_PROV), exiting..." | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
export LAN_NETWORK=$(echo "${LAN_NETWORK}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${LAN_NETWORK}" ]]; then
echo "[info] LAN_NETWORK defined as '${LAN_NETWORK}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[crit] LAN_NETWORK not defined (via -e LAN_NETWORK), exiting..." | ts '%Y-%m-%d %H:%M:%.S' && exit 1
fi
export NAME_SERVERS=$(echo "${NAME_SERVERS}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${NAME_SERVERS}" ]]; then
echo "[info] NAME_SERVERS defined as '${NAME_SERVERS}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] NAME_SERVERS not defined (via -e NAME_SERVERS), defaulting to name servers defined in readme.md" | ts '%Y-%m-%d %H:%M:%.S'
export NAME_SERVERS="209.222.18.222,84.200.69.80,37.235.1.174,1.1.1.1,209.222.18.218,37.235.1.177,84.200.70.40,1.0.0.1"
fi
if [[ $VPN_PROV != "airvpn" ]]; then
export VPN_USER=$(echo "${VPN_USER}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_USER}" ]]; then
echo "[info] VPN_USER defined as '${VPN_USER}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] VPN_USER not defined (via -e VPN_USER), assuming authentication via other method" | ts '%Y-%m-%d %H:%M:%.S'
fi
export VPN_PASS=$(echo "${VPN_PASS}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_PASS}" ]]; then
echo "[info] VPN_PASS defined as '${VPN_PASS}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] VPN_PASS not defined (via -e VPN_PASS), assuming authentication via other method" | ts '%Y-%m-%d %H:%M:%.S'
fi
fi
export VPN_OPTIONS=$(echo "${VPN_OPTIONS}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${VPN_OPTIONS}" ]]; then
echo "[info] VPN_OPTIONS defined as '${VPN_OPTIONS}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[info] VPN_OPTIONS not defined (via -e VPN_OPTIONS)" | ts '%Y-%m-%d %H:%M:%.S'
export VPN_OPTIONS=""
fi
if [[ $VPN_PROV == "pia" ]]; then
export STRICT_PORT_FORWARD=$(echo "${STRICT_PORT_FORWARD}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${STRICT_PORT_FORWARD}" ]]; then
echo "[info] STRICT_PORT_FORWARD defined as '${STRICT_PORT_FORWARD}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] STRICT_PORT_FORWARD not defined (via -e STRICT_PORT_FORWARD), defaulting to 'yes'" | ts '%Y-%m-%d %H:%M:%.S'
export STRICT_PORT_FORWARD="yes"
fi
fi
export ENABLE_PRIVOXY=$(echo "${ENABLE_PRIVOXY}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${ENABLE_PRIVOXY}" ]]; then
echo "[info] ENABLE_PRIVOXY defined as '${ENABLE_PRIVOXY}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] ENABLE_PRIVOXY not defined (via -e ENABLE_PRIVOXY), defaulting to 'no'" | ts '%Y-%m-%d %H:%M:%.S'
export ENABLE_PRIVOXY="no"
fi
export ADDITIONAL_PORTS=$(echo "${ADDITIONAL_PORTS}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${ADDITIONAL_PORTS}" ]]; then
echo "[info] ADDITIONAL_PORTS defined as '${ADDITIONAL_PORTS}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[info] ADDITIONAL_PORTS not defined (via -e ADDITIONAL_PORTS), skipping allow for custom incoming ports" | ts '%Y-%m-%d %H:%M:%.S'
fi
export APPLICATION="deluge"
fi
# get previous puid/pgid (if first run then will be empty string)
previous_puid=$(cat "/root/puid" 2>/dev/null || true)
previous_pgid=$(cat "/root/pgid" 2>/dev/null || true)
# if first run (no puid or pgid files in /tmp) or the PUID or PGID env vars are different
# from the previous run then re-apply chown with current PUID and PGID values.
if [[ ! -f "/root/puid" || ! -f "/root/pgid" || "${previous_puid}" != "${PUID}" || "${previous_pgid}" != "${PGID}" ]]; then
# set permissions inside container - Do NOT double quote variable for install_paths otherwise this will wrap space separated paths as a single string
chown -R "${PUID}":"${PGID}" /etc/privoxy /home/nobody
fi
# write out current PUID and PGID to files in /root (used to compare on next run)
echo "${PUID}" > /root/puid
echo "${PGID}" > /root/pgid
# CONFIG_PLACEHOLDER
# calculate disk usage for /tmp in bytes
disk_usage_tmp=$(du -s /tmp | awk '{print $1}')
# if disk usage of /tmp exceeds 1GB then do not clear down (could possibly be volume mount to media)
if [ "${disk_usage_tmp}" -gt 1073741824 ]; then
echo "[warn] /tmp directory contains 1GB+ of data, skipping clear down as this maybe mounted media" | ts '%Y-%m-%d %H:%M:%.S'
echo "[info] Showing contents of /tmp..." | ts '%Y-%m-%d %H:%M:%.S'
ls -al /tmp
else
echo "[info] Deleting files in /tmp (non recursive)..." | ts '%Y-%m-%d %H:%M:%.S'
rm -f /tmp/* > /dev/null 2>&1 || true
rm -rf /tmp/tmux*
fi
# set stack size from unlimited to prevent pgrep allocation memory bug
# see here for details on the bug (open) https://gitlab.com/procps-ng/procps/issues/152
ulimit -s 8192
echo "[info] Starting Supervisor..." | ts '%Y-%m-%d %H:%M:%.S'
# restore file descriptors to prevent duplicate stdout & stderr to supervisord.log
exec 1>&3 2>&4
exec /usr/bin/supervisord -c /etc/supervisor.conf -n
| true
|
32ba7293fb396963ea6c8276cb0e526936c75580
|
Shell
|
vennelask/my_project
|
/install_haproxy.sh
|
UTF-8
| 1,241
| 2.90625
| 3
|
[] |
no_license
|
#!/bin/bash
yum install haproxy -y
#!/bin/bash
mkdir -p /data
cd /data
wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz
tar -zxvf apache-tomcat-8.5.30.tar.gz
mv apache-tomcat-8.5.30 apache-tomcat2
cd apache-tomcat2/conf
sed -i '69s/8080/8008/' server.xml
sed -i '116s/8010/8011/' server.xml
sed -i '22s/8015/8016/' server.xml
rm /data/apache-tomcat-8.5.30.tar.gz
echo -e "\nTomcat2 installation is complete."
echo -e "\n\e[32mEdit below configuration in /etc/haproxy/haproxy.cfg\e[0m
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main *:80
mode http
acl url_static path_beg -i /static /images /javascript /stylesheets
acl url_static path_end -i .jpg .gif .js
use_backend static if url_static
default_backend myproject
Add below configuration in /etc/haproxy/haproxy.cfg
backend myproject
balance roundrobin
server web1 127.0.0.1:8001 check
server web2 127.0.0.1:8008 check
\n\e[32mRestart HAProxy service 'systemctl restart haproxy'\e[0m\n"
| true
|
8e422393c86c689cb2c6f7e6d08f348255c08909
|
Shell
|
asr-ros/asr_lib_ism
|
/libism/ISM/soci/bin/ci/script_oracle.sh
|
UTF-8
| 641
| 2.734375
| 3
|
[
"BSL-1.0",
"BSD-3-Clause"
] |
permissive
|
#!/bin/bash -e
# Builds and tests SOCI backend Oracle at travis-ci.org
#
# Copyright (c) 2013 Mateusz Loskot <mateusz@loskot.net>
#
source ${TRAVIS_BUILD_DIR}/bin/ci/common.sh
if [ "${CXX}" == "g++" ]
then
ORACLE_USER="soci_tester"
else
ORACLE_USER="soci_tester1"
fi
cmake \
-DSOCI_TESTS=ON \
-DSOCI_STATIC=OFF \
-DSOCI_DB2=OFF \
-DSOCI_EMPTY=OFF \
-DSOCI_FIREBIRD=OFF \
-DSOCI_MYSQL=OFF \
-DSOCI_ODBC=OFF \
-DSOCI_ORACLE=ON \
-DSOCI_POSTGRESQL=OFF \
-DSOCI_SQLITE3=OFF \
-DSOCI_ORACLE_TEST_CONNSTR:STRING="service=brzuchol.loskot.net user=${ORACLE_USER} password=soci_secret" \
..
run_make
run_test
| true
|
adb416b0e555f01ed5ab7075d8f2717cb751a66c
|
Shell
|
tekestmy/ehcache-tools
|
/scripts/ehcachecli.sh
|
UTF-8
| 1,336
| 3.625
| 4
|
[] |
no_license
|
#!/bin/sh
#
# All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
#
case "$1" in
"--help"|"-h"|"-?")
echo "Syntax: $0 [cacheKeyValuePrint|cacheKeysPrint|cacheSize] [arguments.....]"
echo "cacheKeyValuePrint - Prints the Keys and values (only string or list/string) for a given cache."
echo "cacheKeysPrint - Prints the Keys in a cache or all caches."
echo "cacheSize - Prints the total number of cache entries in each cache in a continous loop."
echo "tcPing - Health Check of the cluster"
exit
;;
esac
BASE_DIR=`dirname "$0"`/..
echo $BASE_DIR
# OS specific support. $var _must_ be set to either true or false.
cygwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
esac
if test \! -d "${JAVA_HOME}"; then
echo "$0: the JAVA_HOME environment variable is not defined correctly"
exit 2
fi
# For Cygwin, convert paths to Windows before invoking java
if $cygwin; then
[ -n "$BASE_DIR" ] && BASE_DIR=`cygpath -d "$BASE_DIR"`
fi
PERF_CLASSPATH=$(echo ${BASE_DIR}/lib/*.jar | tr ' ' ':')
PERF_CLASSPATH=$PERF_CLASSPATH:${BASE_DIR}/config/
JAVA_OPTS="${JAVA_OPTS} -Xms128m -Xmx512m -XX:MaxDirectMemorySize=10G -Dcom.tc.productkey.path=${BASE_DIR}/config/terracotta-license.key"
${JAVA_HOME}/bin/java ${JAVA_OPTS} -cp ${PERF_CLASSPATH} com.terracotta.tools.$@
| true
|
d0781587d31d836b43d28f19c1b4782baa90407c
|
Shell
|
ehyland/ubuntu-scripts
|
/rm-docker-containers-and-volumes.sh
|
UTF-8
| 701
| 3.734375
| 4
|
[] |
no_license
|
#!/bin/bash
function remove_containers {
docker kill $(docker ps -q)
docker rm $(docker ps -aq)
}
function remove_data_volumes {
docker volume rm $(docker volume ls -q)
}
while true; do
read -p "Do you wish to remove docker containers?" yn
case $yn in
[Yy]* ) echo "Removing containers"; remove_containers; break;;
[Nn]* ) echo "You said no"; break;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Do you wish to remove docker named volumes?" yn
case $yn in
[Yy]* ) echo "Removing volumes"; remove_data_volumes; break;;
[Nn]* ) echo "you said no"; break;;
* ) echo "Please answer yes or no.";;
esac
done
echo "Done!"
| true
|
54ef0a1a46192ec5b38370de542dcc1bd8ee0515
|
Shell
|
hetianzhang/GreenSDN
|
/pi-simulation/scriptsSSH_pi/pingall
|
UTF-8
| 190
| 3.625
| 4
|
[] |
no_license
|
#!/bin/bash
die() {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "Ping to multiple hosts. Usage: $0 <host_list>"
for ip in $(cat $1 | sed 's/.*@//g'); do
ping "$ip" -c 3
done
| true
|
0033bd5459790a53556fb721643051675d148ba7
|
Shell
|
aissarmurad/my-personal-linux-settings
|
/scripts/aws/get-metadata
|
UTF-8
| 174
| 2.796875
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
# Autor: Aissar Murad
#
# Usage:
# get-metadata meta-data/instance-id
#
# exit on error
set -e
PARAMETER=$1
curl "http://169.254.169.254/latest/$PARAMETER/"
| true
|
a7c9338ac4b1afc8e509467f156ada00ca06774c
|
Shell
|
Programie/DockerImages
|
/images/hugo-obsidian/build.sh
|
UTF-8
| 249
| 2.515625
| 3
|
[] |
no_license
|
#! /bin/bash
clone_url="$1"
if [[ ${clone_url} ]]; then
rm -rf /workspace/content
git clone "${clone_url}" /workspace/content
fi
hugo-obsidian -input=content -output=assets/indices -index -root=.
rm -rf /workspace/public/*
hugo --minify
| true
|
56c8c373416aa67bca75b71679975b4b94cdbd3a
|
Shell
|
tiagoengel/scripts
|
/twister/games.sh
|
UTF-8
| 6,616
| 3.484375
| 3
|
[] |
no_license
|
#!/bin/bash
#includes #{{{
. config.sh
#}}}
#check if the user is or not root, and set the $USERNAME to $SUDO_USER
check_user
LOOP=1
while [ "$LOOP" -ne 0 ]
do
print_title "GAMES - https://wiki.archlinux.org/index.php/Games"
echo "[1] Action/Adventure"
echo "[2] Arcade/Platformer"
echo "[3] Dungeon"
echo "[4] FPS"
echo "[5] MMO"
echo "[6] Puzzle"
echo "[7] Simulation"
echo "[8] Strategy"
echo "[9] Racing"
echo "[10] RPG"
echo "[11] Emulators"
echo ""
echo "[q] QUIT"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "ACTION AND ADVENTURE"
echo "[1] Astromenace"
echo "[2] OpenTyrian"
echo "[3] M.A.R.S."
echo "[4] Yo Frankie!"
echo "[5] Counter-Strike 2D"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm astromenace"
;;
2)
su -l $USERNAME --command="yaourt -S --noconfirm opentyrian-hg"
;;
3)
su -l $USERNAME --command="yaourt -S --noconfirm mars-shooter"
;;
4)
su -l $USERNAME --command="yaourt -S --noconfirm yofrankie"
;;
5)
su -l $USERNAME --command="yaourt -S --noconfirm counter-strike-2d"
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
2)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "ARCADE AND PLATFORMER"
echo "[1] Opensonic"
echo "[2] Frogatto"
echo "[3] Bomberclone"
echo "[4] Goonies"
echo "[5] Neverball"
echo "[6] Super Mario Chronicles"
echo "[7] X-Moto"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm opensonic"
;;
2)
pacman -S --noconfirm frogatto
;;
3)
pacman -S --noconfirm bomberclone
;;
4)
su -l $USERNAME --command="yaourt -S --noconfirm goonies"
;;
5)
pacman -S --noconfirm neverball
;;
6)
pacman -S --noconfirm smc
;;
7)
pacman -S --noconfirm xmoto
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
3)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "DUNGEON"
echo "[1] Tales of Maj'Eyal"
echo "[2] Lost Labyrinth"
echo "[3] S.C.O.U.R.G.E."
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm tome4"
;;
2)
su -l $USERNAME --command="yaourt -S --noconfirm lostlabyrinth"
;;
3)
su -l $USERNAME --command="yaourt -S --noconfirm scourge"
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
4)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "FPS"
echo "[1] World of Padman"
echo "[2] Warsow"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm worldofpadman"
;;
2)
pacman -S --noconfirm warsow
;;
3)
pacman -S --noconfirm alienarena
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
5)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "MMO"
echo "[1] Heroes of Newerth"
echo "[2] Spiral Knights"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm hon"
;;
2)
su -l $USERNAME --command="yaourt -S --noconfirm spiral-knights"
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
6)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "PUZZLE"
echo "[1] Numptyphysics"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm numptyphysics-svn"
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
7)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "SIMULATION"
echo "[1] Simultrans"
echo "[2] Theme Hospital"
echo "[3] OpenTTD"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm simutrans"
;;
2)
su -l $USERNAME --command="yaourt -S --noconfirm corsix-th"
;;
3)
pacman -S --noconfirm openttd
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
8)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "STRATEGY"
echo "[1] Wesnoth"
echo "[3] 0ad"
echo "[4] Hedgewars"
echo "[5] Warzone 2100"
echo "[6] MegaGlest"
echo "[7] Zod"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
question_for_answer "Install Devel Version"
case "$OPTION" in
"y")
su -l $USERNAME --command="yaourt -S --noconfirm wesnoth-devel"
;;
*)
pacman -S --noconfirm wesnoth
;;
esac
;;
3)
su -l $USERNAME --command="yaourt -S --noconfirm 0ad"
;;
4)
pacman -S --noconfirm hedgewars
;;
5)
pacman -S --noconfirm warzone2100
;;
6)
pacman -S --noconfirm megaglest
;;
7)
su -l $USERNAME --command="yaourt -S --noconfirm commander-zod"
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
9)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "RACING"
echo "[1] Maniadrive"
echo "[2] Death Rally"
echo "[3] SupertuxKart"
echo "[4] Speed Dreams"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm maniadrive"
;;
2)
su -l $USERNAME --command="yaourt -S --noconfirm death-rally"
;;
3)
pacman -S --noconfirm supertuxkart
;;
4)
pacman -S --noconfirm speed-dreams
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
10)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "RPG"
echo "[1] Ardentryst"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
su -l $USERNAME --command="yaourt -S --noconfirm ardentryst"
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
11)
#{{{
while [ "$LOOP" -ne 0 ]
do
print_title "RPG"
echo "[1] ZSNES"
echo ""
echo "[b] BACK"
echo ""
read -p "Option: " OPTION
case "$OPTION" in
1)
pacman -S --noconfirm zsnes
;;
*)
LOOP=0
;;
esac
done
LOOP=1
;;
#}}}
*)
LOOP=0
;;
esac
done
finish_function
| true
|
fbf20c3becf4e2235b42400d436d113ad62e05f3
|
Shell
|
LewisPeacockLab/EmoDiF
|
/Analysis/Preprocessing/emodif_normal_smooth.sh
|
UTF-8
| 5,665
| 3.09375
| 3
|
[] |
no_license
|
#!/bin/bash
# MODIFIED BY T.WANG twang.work@gmail.com 10.16.18 to normalise and smoothin in FSL # Usage: >./emodif 'imdif_study_epi_17'
#
# subject number
# SUBNO=101
#MIDRUN = name of the middle run (include localizer, preview and study together)
#read in middle run (reference run) from the second argument in the script
#SUBNO=$1
SUBNO=$1
S_kernal='2.5' #translates to about 6mm FWHM
# base directory where experiments are located on SCRATCH
BASEDIR='/Users/tw24955/emodif_data'
SOFTWAREDIR='/Users/tw24955/EmoDiF'
#makes functional average directory for coregistrations.
# name of the experiment
STUDYNAME='emodif'
STUDY_DATA='EmoDiF'
# code used for subjects when scanning
SUBCODE=${STUDYNAME}_${SUBNO}
# CHANGING STUDYNAME BECAUSE OF PERMISSION ERROR
STUDYNAME=${STUDYNAME}
#SCRIPTDIR=${BASEDIR}/${STUDY_DATA}/batch/scripts
#mkdir -p ${SCRIPTDIR}
SUBDIR=${BASEDIR}/${SUBCODE}
# /scratch/03032/twang04/imdif/imdif_1506191/
#cd ${SUBDIR}
ST_MASK_DIR=${BASEDIR}/std_masks
MASK_DIR=${SUBDIR}/mask
FUNC_DIR=${SUBDIR}/BOLD
ANAT_DIR=${SUBDIR}/anatomical
# NOT YET FIELDMAP_DIR= ${SUBDIR}/fieldmaps
FUNC_AVG_DIR=${FUNC_DIR}/avg_func_ref
mkdir ${FUNC_AVG_DIR}
##### VARIABLES THAT CAN CHANGE!!!!####
ST_TEMPLATE=${ST_MASK_DIR}/MNI152_T1_1mm_brain.nii
ST_TEMPLATE_HEAD=${ST_MASK_DIR}/MNI152_T1_1mm.nii
ST_TEMPLATE_MASK=${ST_MASK_DIR}/MNI152_T1_1mm_brain_mask_dil.nii
###########################################
#Create Middle Run Mean = this is your functional reference image fRI
midrun_bold=${FUNC_DIR}/DF_encoding_1_ref_mcf
pre_fRI=${FUNC_DIR}/DF_encoding_1_avg_mcf
fRI_head=${FUNC_AVG_DIR}/DF_encoding_1_avg_mcf
fRI=${FUNC_AVG_DIR}/DF_encoding_1_avg_mcf_brain
aRI=${ANAT_DIR}/T1_hires_brain
aRI_head=${ANAT_DIR}/T1_hires
func_STD=${ST_MASK_DIR}/MNI152_T1_2mm_brain.nii
#compute inverse transform (standard to MPRAGE)
MNI2T1=${FUNC_AVG_DIR}/MNI2T1 #set the fRI to MPRAGE mat file
fRI2T1=${FUNC_AVG_DIR}/bold_co_avg_mcf_brain.mat
fRI2STD=${FUNC_AVG_DIR}/fRI2STD
T12fRI=${FUNC_AVG_DIR}/T12fRI
T12MNI=${FUNC_AVG_DIR}/T12MNI
cd ${FUNC_DIR}
# normalises all functions to MNI then smooths
echo 'normalizing Preview'
flirt -in Preview1_corr_mcf_brain.nii -ref ${func_STD} -out Preview1_corr_mcf_brain_mni.nii -omat Preview1_corr_mcf_brain_mni.mat -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear
applyxfm4d Preview1_corr_mcf_brain.nii Preview1_corr_mcf_brain_mni.nii Preview1_corr_mcf_brain_mni_4D Preview1_corr_mcf_brain_mni.mat -singlematrix
flirt -in Preview2_corr_mcf_brain.nii -ref ${func_STD} -out Preview2_corr_mcf_brain_mni.nii -omat Preview2_corr_mcf_brain_mni.mat -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear
applyxfm4d Preview2_corr_mcf_brain.nii Preview2_corr_mcf_brain_mni.nii Preview2_corr_mcf_brain_mni_4D Preview2_corr_mcf_brain_mni.mat -singlematrix
echo 'normalizing DFencode'
flirt -in DF_encoding_1_corr_mcf_brain.nii -ref ${func_STD} -out DF_encoding_1_corr_mcf_brain_mni.nii -omat DF_encoding_1_corr_mcf_brain_mni.mat -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear
applyxfm4d DF_encoding_1_corr_mcf_brain.nii DF_encoding_1_corr_mcf_brain_mni.nii DF_encoding_1_corr_mcf_brain_mni_4D DF_encoding_1_corr_mcf_brain_mni.mat -singlematrix
flirt -in DF_encoding_2_corr_mcf_brain.nii -ref ${func_STD} -out DF_encoding_2_corr_mcf_brain_mni.nii -omat DF_encoding_2_corr_mcf_brain_mni.mat -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear
applyxfm4d DF_encoding_2_corr_mcf_brain.nii DF_encoding_2_corr_mcf_brain_mni.nii DF_encoding_2_corr_mcf_brain_mni_4D DF_encoding_2_corr_mcf_brain_mni.mat -singlematrix
echo 'normalizing localizer'
flirt -in MVPA_training_1_corr_mcf_brain.nii -ref ${func_STD} -out MVPA_training_1_corr_mcf_brain_mni.nii -omat MVPA_training_1_corr_mcf_brain_mni.mat -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear
applyxfm4d MVPA_training_1_corr_mcf_brain.nii MVPA_training_1_corr_mcf_brain_mni.nii MVPA_training_1_corr_mcf_brain_mni_4D MVPA_training_1_corr_mcf_brain_mni.mat -singlematrix
flirt -in MVPA_training_2_corr_mcf_brain.nii -ref ${func_STD} -out MVPA_training_2_corr_mcf_brain_mni.nii -omat MVPA_training_2_corr_mcf_brain_mni.mat -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear
applyxfm4d MVPA_training_2_corr_mcf_brain.nii MVPA_training_2_corr_mcf_brain_mni.nii MVPA_training_2_corr_mcf_brain_mni_4D MVPA_training_2_corr_mcf_brain_mni.mat -singlematrix
echo 'smoothing Preview'
fslmaths Preview1_corr_mcf_brain_mni_4D -s ${S_kernal} Preview1_corr_mcf_brain_mni_4D_s6.nii
gunzip Preview1_corr_mcf_brain_mni_4D_s6.nii
fslmaths Preview2_corr_mcf_brain_mni_4D -s ${S_kernal} Preview2_corr_mcf_brain_mni_4D_s6.nii
gunzip Preview2_corr_mcf_brain_mni_4D_s6.nii
echo 'smoothing DF_encoding'
fslmaths DF_encoding_1_corr_mcf_brain_mni_4D -s ${S_kernal} DF_encoding_1_corr_mcf_brain_mni_4D_s6.nii
gunzip DF_encoding_1_corr_mcf_brain_mni_4D_s6.nii
fslmaths DF_encoding_2_corr_mcf_brain_mni_4D -s ${S_kernal} DF_encoding_2_corr_mcf_brain_mni_4D_s6.nii
gunzip DF_encoding_2_corr_mcf_brain_mni_4D_s6.nii
echo 'smoothing localizer'
fslmaths MVPA_training_1_corr_mcf_brain_mni_4D -s ${S_kernal} MVPA_training_1_corr_mcf_brain_mni_4D_s6.nii
gunzip MVPA_training_1_corr_mcf_brain_mni_4D_s6.nii
fslmaths MVPA_training_2_corr_mcf_brain_mni_4D -s ${S_kernal} MVPA_training_2_corr_mcf_brain_mni_4D_s6.nii
gunzip MVPA_training_2_corr_mcf_brain_mni_4D_s6.nii
#return to launch
cd ${SCRIPTDIR}
| true
|
64a56d00c29a0f763bdb4e5718927a375e132338
|
Shell
|
ubuntupunk/Scripts
|
/convertwma-ogg.sh
|
UTF-8
| 504
| 3.71875
| 4
|
[] |
no_license
|
#!/bin/sh
# Convert a .wma to an .ogg using ‘mplayer’ and ‘oggenc’.
#
# Public Domain
set -e
IN=$1
shift
if [ -z "${IN}" ]; then
IN=-
WAV=audio.wav
else
WAV=$(basename ${IN} .wma).wav
fi
mplayer -vc dummy -vo null -ao pcm:waveheader:file=${WAV} ${IN}
FILEDAT=$(file ${WAV})
BITS=$(echo ${FILEDAT} | sed -e ‘s/.*\(8\|16\|32\) bit.*/\1/’)
if echo ${FILEDAT} | grep -q mono; then
CHANS=1
else
CHANS=2
fi
oggenc -R 44100 -B ${BITS} -C ${CHANS} ${WAV} >/dev/null
rm -f ${WAV}
| true
|
1a821fccebd5fa63ec11a2de85e92ae64d551656
|
Shell
|
kamperh/recipe_vision_speech_flickr
|
/kaldi_features/local/cmvn_dd.sh
|
UTF-8
| 743
| 3.171875
| 3
|
[] |
no_license
|
#!/bin/bash
# Herman Kamper, kamperh@gmail.com, 2015.
# Based loosely an parts of train_mono.sh.
nj=4
cmd=run.pl
if [ -f path.sh ]; then . ./path.sh; fi
. parse_options.sh || exit 1;
if [ $# != 3 ]; then
echo "usage: ${0} data_dir exp_dir feat_dir"
exit 1;
fi
data=$1
dir=$2
mfccdir=$3
name=`basename $data`
mkdir -p $dir/log
echo $nj > $dir/num_jobs
sdata=$data/split$nj;
[[ -d $sdata && $data/feats.scp -ot $sdata ]] || split_data.sh $data $nj || exit 1;
feats="apply-cmvn --norm-vars=true --utt2spk=ark:$sdata/JOB/utt2spk scp:$sdata/JOB/cmvn.scp scp:$sdata/JOB/feats.scp ark:- | add-deltas ark:- ark,scp:$mfccdir/mfcc_cmnv_dd_$name.JOB.ark,$mfccdir/mfcc_cmnv_dd_$name.JOB.scp"
$train_cmd JOB=1:$nj $dir/log/cmvn_dd.JOB.log $feats || exit 1;
| true
|
c84db2f4f53cefca36f92d8c7cb690f5b5ba710f
|
Shell
|
Andersgee/my_bashcommands
|
/vlc-twitch
|
UTF-8
| 1,447
| 4
| 4
|
[] |
no_license
|
#!/bin/bash
function echo_usage()
{
echo "Usage: $(basename "$0") name [quality] | dota2"
echo "Opens a twitch stream in vlc with livestreamer which must"
echo "be installed (pip install livestreamer)."
echo " "
echo " name: what you would put in www.twitch.tv/name"
echo " quality: default order is best,high,720p60,540p60,720p30,540p30,worst"
echo " the available ones are displayed when opening a stream."
echo " dota2: prints the 10 most popular dota2 streams at the moment."
exit 64
}
if [ $# -lt 1 ]; then
echo_usage
fi
function write_to_streamlist()
{
response=$(curl -s -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: 84kxo56li6b9k9oh0dqg6nvemx1acc' \
-X GET 'https://api.twitch.tv/kraken/streams?game=Dota%202&limit=10')
IFS=, read -a ARRAY <<< "$response"
for i in "${ARRAY[@]}"
do
if [[ ${#i} -gt 10 && ${i:1:7} = "viewers" ]]; then
streamlist+=" ${i:10} viewers on "
fi
if [[ ${#i} -gt 16 && ${i:1:12} = "display_name" ]]; then
streamlist+="${i:16:-1}"
streamlist+=$'\n'
fi
done
}
if [ $1 = "dota2" ]
then
echo "Popular Dota 2 streams right now:"
streamlist=""
write_to_streamlist
echo "$streamlist "
else
if [ $# -lt 2 ]
then
quality="best,high,720p60,540p60,720p30,540p30,worst"
else
quality="$2"
fi
livestreamer --http-header Client-ID=84kxo56li6b9k9oh0dqg6nvemx1acc twitch.tv/"$1" "$quality"
fi
| true
|
f2945ecf48b1c69b9aae1931ff0a35f7a390fb80
|
Shell
|
earlye/ace
|
/install.sh
|
UTF-8
| 227
| 2.984375
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -e
set -x
if [[ ! -d /usr/local/bin ]]; then
mkdir -p /usr/local/bin
fi
if [[ ! -f /usr/local/bin/ace ]]; then
ln -s $(pwd)/ace /usr/local/bin/ace
fi
# ACE IS INSTALLED HERE
ls -l /usr/local/bin/ace
| true
|
742e5d7a257cf8cc678a3d1dc98d5d89ae4ffc8a
|
Shell
|
AntonioCarmonaLopez/SH
|
/proxy.sh
|
UTF-8
| 4,323
| 4.0625
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
FICHERO="servers"
function Menu
{
echo "_____________MENU_____________"
echo ""
echo " 1. Introducir Servidor Proxy"
echo " 2. Buscar Servidor Proxy"
echo " 3. Establecer Servidor Proxy"
echo " 4. Hacer Ping"
echo " 5. Ver Proxy Sistema"
echo " 6. Resetear Proxy"
echo " 7. Salir"
}
function Introducir
{
if [ -e "servers" ]; then # Si el fichero existe...
echo "Introduzca url del servidor: "
read -p "url:" URL
echo "Introduzca el puerto del servidor: "
read -p "puerto:" PUERTO
echo "Introduzca el usuario del servidor: "
read -p "usuario:" USER
echo "Introduzca la contrasenya del servidor: "
read -p "contrasenya:" PASS
# Redireccionamos los datos introducidos al fichero
echo "Introduzca tipo de servidor(http/https): "
read -p "tipo:" TIPO
if [ $TIPO == "http" ]; then
if [ -z "$USER" ];then
echo "http://$URL:$PUERTO" >> $FICHERO
else
echo "http://$USER:$PASS'@'$URL:$PUERTO" >> $FICHERO
fi
elif [ $TIPO == "https" ]; then
if [ -z "$USER" ];then
echo "https://$URL:$PUERTO" >> $FICHERO
else
echo "https://$USER:$PASS'@'$URL:$PUERTO" >> $FICHERO
fi
else
echo "formato erroneo"
fi
else
# Si no existe el fichero, damos el mensaje de error...
echo "No se ha podido acceder al archivo de listado de servidores!"
fi
}
function Buscar
{
if [ -s $FICHERO ]; then
echo "Introduzca url del servidor a buscar: "
read -p "url: " URL
DATOS="$URL" # Metemos en DATOS nuestra busqueda
SALIDA=$(grep "$DATOS" $FICHERO) # Con grep asigna a salida el contenido de la linea
echo -e "${SALIDA//:/\n}" # Cambiamos el caracter ":" por saltos de linea "\n"
else
echo "El fichero no existe o esta vacio"
fi
}
function Listar
{
if [ -s $FICHERO ]; then # Si existe el fichero y contiene datos
for linea in $(cat $FICHERO) # Recorremos cada linea del fichero
do
echo "__________________"
echo -e "${linea//:/:}" # Sacamos la linea con formato
echo "__________________"
echo ""
done
else
echo "El fichero no existe o esta vacio"
fi
}
function Set
{
if [ $(whoami) != "root" ]; then
echo "Debes ser root para correr este script."
echo "Para entrar como root, escribe \"sudo su\" sin las comillas."
exit 1
fi
Listar
echo "Introduzca posicion(numero) del servidor: "
read -p "posicion:" POSICION
proxy=`cat lista | sed -n '$POSICION p'`
echo "Introduzca tipo de servidor(http/https): "
read -p "tipo:" TIPO
if [ $TIPO == "http" ]; then
export http_proxy=$PROXY >> /etc/environment
elif [ $TIPO == "https" ]; then
export https_proxy=$PROXY >> /etc/environment
fi
}
function Ping
{
echo "Introduzca url del servidor a alcanzar: "
read -p "url:" URL2
ping $URL2
}
function Ver
{
echo "Introduzca tipo de servidor(http/https): "
read -p "tipo:" TIPO
if [ $TIPO == "http" ]; then
echo $http_proxy
elif [ $TIPO == "https" ]; then
echo $https_proxy
fi
}
function Reset
{
echo "Introduzca tipo de servidor(http/https): "
read -p "tipo:" TIPO
if [ $TIPO = "http" ]; then
unset http_proxy
exit 0
elif [ $TIPO = "https" ]; then
unset https_proxy
exit 0
else
echo "formato erroneo"
exit 1
fi
}
function Salir
{
exit 0
}
opc=0
salir=8
while [ $opc -ne $salir ]; # Mientras el valor de $opt es distinto del valor de $salir...
do
clear
Menu # Dibujamos el menu en pantalla
read -p "Opcion:..." opc # Escogemos la opcion deseada
if [ $opc -ge 1 ] && [ $opc -le 7 ]; then # No se por que no funciona el rango...!!!!!!!!!!!!!!!!!!!!!!
clear
case $opc in # Acciones para las diferentes opciones del menu
1)Introducir
;;
2)Buscar
;;
3)Set
;;
4)Ping
;;
5)Ver
;;
6)Reset
;;
7)Salir
;;
esac
else
echo "No ha introducido una opcion correcta!!"
fi
echo "Pulse una tecla..."
read
done
| true
|
a9bc20d9be199c319de8f6c5c9aacb8d8dae56f3
|
Shell
|
pie-org/J.A.R.V.I.S.
|
/MiniJARVIS.sh
|
UTF-8
| 3,278
| 3.6875
| 4
|
[
"MIT"
] |
permissive
|
Menu(){
echo ---------------------------------------------------------------------
echo "[1] Do you want to update your system, sir? "
echo "[2] Sir, are you connected? "
echo "[3] Do you want to see your memory usage? "
echo "[4] Reboot, sir? (need root) "
echo "[5] In what version am I? "
echo "[6] Install or remove an app for you? "
echo "[7] Date? "
echo "[8] Do you want me to clean the terminal for you? "
echo "[9] check commands?"
echo "[10] Shutdown J.A.R.V.I.S.? "
echo ---------------------------------------------------------------------
read choice
case $choice in
1) Update ;;
2) Connection ;;
3) Memory ;;
4) Reboot ;;
5) Version ;;
6) App ;;
7) Date ;;
8) Clean ;;
9) Help ;;
10) exit ;;
11) Ipshow ;;
12) Say ;;
13) Shutdownpc ;;
14) Schedule ;;
15) Diet ;;
esac
}
Update(){
sudo apt-get update
echo "UPDATE FINISHED!"
sudo apt-get upgrade
echo "UPGRADE FINISHED!"
Menu
}
Connection(){
echo "I'm going to see if you're connected..."
ping google.com
Menu
}
Memory(){
echo "Let me check your memory."
free
Menu
}
Reboot(){
echo "I am going to reboot the system. See you later. "
reboot -f
Menu
}
Version(){
echo "I am in the Mini version. "
Menu
}
App(){
echo "Do you want to remove or install? 1 to install 2 to remove"
read choiceapp
if [ $choiceapp == 1 ]
then
echo "What is the name of the app that you want to install: "
read appname
sudo apt-get install $appname
elif [ $choiceapp == 2 ]
then
echo "What is the name of the app that you want to remove: "
read AppName
sudo apt-get remove $AppName
else
echo "You did not select 1 or 2. "
fi
Menu
}
Date(){
echo "You are in:"
date
Menu
}
Clean(){
echo "Why it is always me. "
clear
Menu
}
Ipshow(){
echo "This is your ip, protect it. "
ifconfig
Menu
}
Help(){
echo "NEED TO UPGRADE"
Menu
}
Update(){
sudo apt-get update
echo "UPDATE FINISHED!"
sudo apt-get upgrade
echo "UPGRADE FINISHED!"
Menu
}
Connection(){
echo "I'm going to see if you're connected..."
ping google.com
Menu
}
Memory(){
echo "Let me check your memory."
free
Menu
}
Reboot(){
echo "I am going to reboot the system. See you later. "
reboot -f
Menu
}
Version(){
echo "I am in the Mini version. "
Menu
}
Date(){
echo "You are in:"
date
Menu
}
Clean(){
echo "Why it is always me. "
clear
Menu
}
Ipshow(){
echo "This is your ip, protect it. "
ifconfig
Menu
}
Help(){
echo "[1] Update"
echo "[2] Connection"
echo "[3] Memory usage"
echo "[4] Reboot"
echo "[5] J.A.R.V.I.S. version"
echo "[6] Install or remove app"
echo "[7] Date"
echo "[8] Clean the terminal "
echo "[9] Help"
echo "[10] Shutdown J.A.R.V.I.S. "
echo "[11] Show ip and internet configuration"
echo "[12] Make J.A.R.V.I.S. say something"
echo "[13] Shutdown computer"
echo "[14] See your Schedule"
echo "[15] See your diet"
}
Say(){
echo "I will say what you want me to: "
read phrase
echo $phrase
Menu
}
Shutdownpc(){
echo "So you are going to leave? Ok sir. "
echo "In how many minutes do you want to shut it down? "
read Minutes
shutdown -h $Minutes
echo "ALERT, sir going off in $Minutes minutes. "
}
Schedule(){
#edit or show (put the if)
echo "Searching in: "
dir
echo "found it! here's your schedule "
cat Schedule
Menu
}
Diet(){
echo "That's your diet sir: "
cat Diet
Menu
}
Menu
| true
|
ec3e2b2cddad05d8f097ee6b2c4e53a7aad30870
|
Shell
|
aerogear/offix
|
/scripts/validateRelease.sh
|
UTF-8
| 1,581
| 4.09375
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# explicit declaration that this script needs a $TAG variable passed in e.g TAG=1.2.3 ./script.sh
TAG=$TAG
TAG_SYNTAX='^[0-9]+\.[0-9]+\.[0-9]+(-.+)*$'
# get version found in lerna.json. This is the source of truth
PACKAGE_VERSION=$(cat lerna.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')
# get names of packages being managed by lerna
PACKAGES=$(lerna --loglevel=silent ls | awk -F ' ' '{print $1}')
# validate tag has format x.y.z
if [[ "$(echo $TAG | grep -E $TAG_SYNTAX)" == "" ]]; then
echo "tag $TAG is invalid. Must be in the format x.y.z or x.y.z-SOME_TEXT"
exit 1
fi
# validate that TAG == version found in lerna.json
if [[ $TAG != $PACKAGE_VERSION ]]; then
echo "tag $TAG is not the same as package version found in lerna.json $PACKAGE_VERSION"
exit 1
fi
# validate that all packages have the same version found in lerna.json
for package in $PACKAGES; do
version=$(lerna --loglevel=silent ls -l | grep $package | awk -F ' ' '{print $2}' | cut -c2-)
if [[ $version =~ $PACKAGE_VERSION ]]; then
echo "package $package has version $version"
else
echo "package $package has version $version but expected $PACKAGE_VERSION"
exit 1
fi
done
package_dirs=$(lerna --loglevel=silent ls -l | awk -F ' ' '{print $3}')
for package in $package_dirs; do
package_dist="$package/dist"
if [ -d "$package_dist" ]; then
echo "dist dir $package_dist present"
else
echo "dist dir $package_dist not present, possible compilation error"
exit 1
fi
done
echo "Ready for release"
| true
|
3ea434addffc51f0ad30016d880a72ffe6af3f6a
|
Shell
|
TheoChevalier/typolib
|
/app/scripts/bash_variables.sh
|
UTF-8
| 1,555
| 3.3125
| 3
|
[] |
no_license
|
#! /usr/bin/env bash
# Set variables used by bash scripts
# List of folders setup.sh needs to check and eventually create
folders=( $libraries )
path_sources=${config}/sources
# PRODUCT repos and list of locales
release_l10n=${local_hg}/RELEASE_L10N
beta_l10n=${local_hg}/BETA_L10N
aurora_l10n=${local_hg}/AURORA_L10N
trunk_l10n=${local_hg}/TRUNK_L10N
release_source=${local_hg}/RELEASE_EN-US
beta_source=${local_hg}/BETA_EN-US
aurora_source=${local_hg}/AURORA_EN-US
trunk_source=${local_hg}/TRUNK_EN-US
trunk_locales=${path_sources}/central.txt
aurora_locales=${path_sources}/aurora.txt
beta_locales=${path_sources}/beta.txt
release_locales=${path_sources}/release.txt
folders+=( $release_l10n $beta_l10n $aurora_l10n $trunk_l10n \
$release_source $beta_source $aurora_source $trunk_source )
# GAIA repos and list of locales
gaia_versions=${path_sources}/gaia_versions.txt
for gaia_version in $(cat ${gaia_versions})
do
if [ "$gaia_version" == "gaia" ]
then
gaia=${local_hg}/GAIA
gaia_locales=${path_sources}/gaia.txt
folders+=( $gaia )
else
declare gaia_${gaia_version}=${local_hg}/GAIA_${gaia_version}
declare gaia_locales_${gaia_version}=${path_sources}/gaia_${gaia_version}.txt
var_name=gaia_${gaia_version}
folders+=( ${!var_name} )
fi
done
# Location of Dotlang-based repos
mozilla_org=$local_svn/mozilla_org/
folders+=( $mozilla_org )
# l20n test repo
l20n_test=$local_git/L20N_TEST
l20n_test_locales=${path_sources}/l20n_test.txt
folders+=( $l20n_test )
| true
|
549441aaea7cc9413ac6d10087d6e6f4583e9f75
|
Shell
|
yolial22/SI-T6acteva
|
/ej2.sh
|
UTF-8
| 209
| 3.203125
| 3
|
[] |
no_license
|
#!/bin/bash
read -p "Introduce un mes: " mes;
resultado= grep $mes usuarios.txt | awk '{ print $2 }';
if [[ $resultado -eq '0' ]];
then
echo $resultado;
else
echo "este mes no se ha logeado nadie";
fi
| true
|
2955576b37871f1baf119ac2b02867f7d3fc8b68
|
Shell
|
cmccandless/ExercismSolutions-bash
|
/isogram/isogram.sh
|
UTF-8
| 362
| 4.0625
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
set -o errexit
set -o nounset
str_to_chars()
{
for (( i=0; i<${#1}; i++ )); do echo "${1:$i:1}"; done
}
main() {
input="${1:-}"
input="$(tr -dc '[:alpha:]' <<< "${input,,}")"
unique_letters="$(str_to_chars "$input" | sort | uniq | tr -d "\n")"
[ "${#unique_letters}" -eq "${#input}" ] && echo 'true' || echo 'false'
}
main "$@"
| true
|
a499194268c048b35c133e36aae5d7c4b8148d12
|
Shell
|
mnlevy1981/CVMix-testing
|
/bash_utils/environ.sh
|
UTF-8
| 329
| 2.90625
| 3
|
[] |
no_license
|
#!/bin/bash
DATE=`date +%y%m%d-%H%M%S`
LOGDIR=logs/$MACHINE/$DATE
ROOTDIR=`pwd -P`
SUMMARY_FILE="$ROOTDIR/$LOGDIR/summary"
ERR_CNT=0
TESTDIR=checkouts/$DATE
if [ "$LOCAL" == "TRUE" ]; then
REPO=$HOME/codes/CVMix/.git
else
REPO=git@github.com:CVMix/CVMix-src.git
fi
RUNCOMPILERS=()
if [ ! -e $LOGDIR ]; then
mkdir -p $LOGDIR
fi
| true
|
f718aaccac3d57149d5532a05cedf4beb17c8133
|
Shell
|
mvgeorgescu/bash-lib
|
/t3.sh
|
UTF-8
| 635
| 2.75
| 3
|
[
"MIT"
] |
permissive
|
#/bin/sh
# Copyright 2006-2014, Alan K. Stebbens <aks@stebbens.org>
#
# Test module for list-utils.sh
#
export PATH=.:$HOME/lib:$PATH
source list-utils.sh
source test-utils.sh
test_10_print_list() {
start_test
words=(
apple banana cherry dog elephant fox giraffe hawk indigo manzana milk november
october december january february march april may june july august
)
print_list words
echo ''
print_list words i=1
echo ''
print_list words i=2 c=5
echo ''
print_list words i=3 c=4
echo ''
print_list words c=3 i=4
echo ''
print_list words c=2 i=5
echo ''
end_test
}
init_tests "$@"
run_tests
summarize_tests
exit
| true
|
507be8bf5d29db0319d9da02e913c0f58c3778ef
|
Shell
|
enazarova/cmssw
|
/HeavyIonsAnalysis/JetAnalysis/python/jets/makeJetSequences.sh
|
UTF-8
| 2,880
| 2.5625
| 3
|
[] |
no_license
|
#!/bin/sh
echo "import FWCore.ParameterSet.Config as cms" > HiGenJetsCleaned_cff.py
echo "from PhysicsTools.PatAlgos.patHeavyIonSequences_cff import *" >> HiGenJetsCleaned_cff.py
for system in PbPb pp pPb
do
for sample in mc data
do
for algo in ak
do
for sub in Vs Pu NONE
do
for radius in 2 3 4 5 6 7
do
matchobject="Calo"
for object in PF Calo
do
subt=$sub
if [ $sub == "NONE" ]; then
subt=""
fi
ismc="False"
corrlabel="_hiIterativeTracks"
domatch="True"
genjets="HiGenJetsCleaned"
genparticles="hiGenParticles"
tracks="hiGeneralTracks"
pflow="particleFlowTmp"
match=${algo}${subt}${radius}${matchobject}
echo "" > $algo$subt$radius${object}JetSequence_${system}_${sample}_cff.py
if [ $system != "PbPb" ]; then
corrlabel="_generalTracks"
tracks="generalTracks"
genparticles="genParticles"
fi
if [ $object == "Calo" ]; then
corrlabel="_HI"
domatch="False"
fi
if [ $sample == "mc" ]; then
ismc="True"
fi
if [ $system == "pp" ]; then
genjets="HiGenJets"
fi
corrname=`echo ${algo} | sed 's/\(.*\)/\U\1/'`${radius}${object}${corrlabel}
if [ $system == "PbPb" ] && [ $sample == "mc" ] && [ $object == "PF" ] && [ $sub == "Vs" ]; then
cat templateClean_cff.py.txt \
| sed "s/ALGO_/$algo/g" \
| sed "s/SUB_/$subt/g" \
| sed "s/RADIUS_/$radius/g" \
| sed "s/OBJECT_/$object/g" \
| sed "s/SAMPLE_/$sample/g" \
| sed "s/CORRNAME_/$corrname/g" \
| sed "s/MATCHED_/$match/g" \
| sed "s/ISMC/$ismc/g" \
| sed "s/GENJETS/$genjets/g" \
| sed "s/GENPARTICLES/$genparticles/g" \
| sed "s/TRACKS/$tracks/g" \
| sed "s/PARTICLEFLOW/$pflow/g" \
| sed "s/DOMATCH/$domatch/g" \
>> HiGenJetsCleaned_cff.py
fi
cat templateSequence_cff.py.txt \
| sed "s/ALGO_/$algo/g" \
| sed "s/SUB_/$subt/g" \
| sed "s/RADIUS_/$radius/g" \
| sed "s/OBJECT_/$object/g" \
| sed "s/SAMPLE_/$sample/g" \
| sed "s/CORRNAME_/$corrname/g" \
| sed "s/MATCHED_/$match/g" \
| sed "s/ISMC/$ismc/g" \
| sed "s/GENJETS/$genjets/g" \
| sed "s/GENPARTICLES/$genparticles/g" \
| sed "s/TRACKS/$tracks/g" \
| sed "s/PARTICLEFLOW/$pflow/g" \
| sed "s/DOMATCH/$domatch/g" \
>> $algo$subt$radius${object}JetSequence_${system}_${sample}_cff.py
done
done
done
done
done
done
echo "" >> HiGenJetsCleaned_cff.py
echo "hiGenJetsCleaned = cms.Sequence(" >> HiGenJetsCleaned_cff.py
for algo in ak
do
for radius in 2 3 4 5 6 7
do
echo "$algo${radius}HiGenJetsCleaned" >> HiGenJetsCleaned_cff.py
if [ $radius -ne 7 ]; then
echo "+" >> HiGenJetsCleaned_cff.py
else
echo ")" >> HiGenJetsCleaned_cff.py
fi
done
done
| true
|
eb9afbf29607d6b40407b00f2588ccc6e302aed9
|
Shell
|
sencer/dotfiles_v0
|
/autoload/vi
|
UTF-8
| 354
| 3.328125
| 3
|
[] |
no_license
|
local arg="$*"
while (( $# ));do
if [[ -f "$1" ]]; then
local server=${(U)1:t:gs/./}
break
fi
shift
done
if [[ -z $server ]]; then
eval "gvim $arg"
else
if vim --serverlist|grep -w $server &>/dev/null;then
eval "gvim --servername $server --remote-silent $arg"
else
eval "gvim --servername $server $arg"
fi
fi
# vim: ft=zsh
| true
|
396f87d562e0e970a91284a1c0a6b7b3d564ac6d
|
Shell
|
turquoise-hexagon/dots
|
/wm/.local/bin/state
|
UTF-8
| 290
| 3.453125
| 3
|
[
"0BSD"
] |
permissive
|
#!/bin/sh
#
# state - change window state
die() {
printf '%s\n' \
"${1:-usage : ${0##*/} <floating|tiled|fullscreen>}" >&2
exit 1
}
case $* in
floating|tiled|fullscreen)
bspc node -t "~$*" &&
cursor
;;
*) die
esac
: # fit exit status
| true
|
988ef9256bc2e677e83df77de551f4d4c4e81bc4
|
Shell
|
vugarrahim/vugarrahim.github.io
|
/vagrant_setup/scripts/celery.sh
|
UTF-8
| 993
| 3.359375
| 3
|
[] |
no_license
|
#!/bin/bash
. /vagrant/vagrant_setup/config.txt
echo "----- RabbitMQ: Installing..."
sudo apt-get install -y rabbitmq-server
# Install Gunicorn to app's vortual envoirenment
echo "----- Celery: Installing within your virtualenv..."
sudo -u $APP_USER bash << EOF
# -------[script begins]-------
cd $APP_PATH
source bin/activate
pip install celery django-celery
# -------[script ends]-------
EOF
printf "\n\n--- Celery Ready: Now
1) Create the 'celery.py' file in the '$DJANGO_PATH/$APP_NAME' directory next to 'settings.py';
2) Add the 'djcelery' to Django settings.INSTALLED_APPS;
3) Then run the command below from within your virtualenv (you should be using virtual environments!); \n
(your_app):$ celery -A $APP_NAME worker -B -l info \n
"
# Create celery.py example for the app from template
sed 's|#{APP_NAME}|'$APP_NAME'|g' $VAGRANT_TMP_PATH/celery.py > $VAGRANT_TMP_PATH/celery.py.bak
sudo mv -i -n $VAGRANT_TMP_PATH/celery.py.bak $DJANGO_PATH/$APP_NAME/celery.py
| true
|
7cc376cbcf7893220e9a90c5804174686e81bc57
|
Shell
|
0leksandr/bin
|
/git-reset
|
UTF-8
| 244
| 3.0625
| 3
|
[] |
no_license
|
#!/bin/sh
set -e
if [ "$1" = "" ]; then
git clean --dry-run
git clean --force
git checkout -- .
git add .
#git rm --cached -r -f .
git reset --hard
else
git clean --force -d -x "$@"
git checkout HEAD -- "$@"
fi
| true
|
2437a06d7e23345682e052f98dffc7a110331684
|
Shell
|
gphalkes/tilde
|
/testsuite/rerecordtest.sh
|
UTF-8
| 1,360
| 3.75
| 4
|
[] |
no_license
|
#!/bin/bash
DIR="`dirname \"$0\"`"
. "$DIR"/_common.sh
confirm() {
unset CONFIRM
while [[ -z $CONFIRM ]] ; do
read CONFIRM
done
}
echo "!! There is more work to do on this script" >&2
if [ $# -ne 1 ] ; then
fail "Usage: runtest.sh <dir with test>"
fi
setup_TEST "$1"
setup_vars
[ -d "$TEST.new" ] && rm -rf "$TEST.new"
cd_workdir
rm -rf *
cp -r "$TEST"/* . || fail "Could not copy test"
cd context || fail "Could not cd into context dir"
#FIXME: use correct terminal (which is not currently recorded!)
#FIXME: display the old one with view to compare with the new one. Ask user
# afterwards if it was correct
tdrerecord -o ../recording.new $REPLAYOPTS ../recording || fail "!! Could not rerecord test"
fixup_test ../recording.new
cd .. || fail "Could not change back to work dir"
tdcompare -v recording recording.new || echo "WARNING: visual differences"
rm context/libt3widgetlog.txt context/log.txt
diff -Nurq context after || fail "!! Resulting files are different" >&2
cp -r "$TEST" "$TEST.new"
mv recording.new "$TEST.new"/recording
dwdiff -Pc -C0 "$TEST"/recording "$TEST.new"/recording
echo "Do you want to save the changes? "
confirm
if [[ $CONFIRM = y ]] ; then
rm -rf "$TEST"
mv "$TEST.new" "$TEST"
else
echo "Do you want to delete the new files? "
confirm
if [[ $CONFIRM = y ]] ; then
rm -rf "$TEST.new"
fi
fi
exit 0
| true
|
3fa4ba222431495c8b238bb96c00dde8705954fd
|
Shell
|
github-clonner/docker-swarm
|
/remove-aws.sh
|
UTF-8
| 563
| 3.046875
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
source ./init-variables.sh
source ./box.sh
for node in $(seq 1 $workers);
do
eval "$(docker-machine env worker$node)"
docker swarm leave
done
for node in $(seq 1 $leaders);
do
eval "$(docker-machine env leader$node)"
docker swarm leave --force
done
for node in $(seq 1 $workers);
do
docker-machine rm worker$node --force
done
for node in $(seq 1 $leaders);
do
docker-machine rm leader$node --force
done
box "Waiting for the SUN during $t sec..." "blue" "red"
sleep $t
aws ec2 delete-security-group --group-name ${group_name}
| true
|
19da5e2bfd8775f431dc90daa9ae37f41b904540
|
Shell
|
chadwickboggs/personal-bin-scripts
|
/rename
|
UTF-8
| 215
| 3.140625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
#
# A smarter command doing similar to this one may be the "mmv" command.
#
if [[ $# != 2 ]]; then
echo 'Two arguments expected'
exit 1
fi
mv -v "$1" "$(dirname $1)/$(basename $2)"
exit $?
| true
|
3bdb554de06c76ccd6ff4756fb5bd3e06b4f4050
|
Shell
|
ninekilobytyes/course-managing-docker-linux-servers
|
/installing/cli-only/ensure.guest.has.ansible.sh
|
UTF-8
| 2,178
| 3.25
| 3
|
[] |
no_license
|
#!/bin/bash
sudo apt-get update
# 2 primary routes to install ansible
# A. APT
# (not ppa:ansible/ansible which doesn't yet have focal builds)
# right now ubuntu ansible package for focal is 2.9
sudo apt-get install -qy ansible
# OR
# B. PIP (currently makes it possible to get ansible 2.10)
# First install pip if you don't have it already
# sudo apt-get install -y python3-pip
# install `python3-pip` that compliments pre-installed `python3` to provide `pip3`
# B.1 install with pip globally
# sudo pip3 install ansible
# as root `--system` is implied
# if not as root, then `pip3 install --system ansible`
# B.2 install with pip into user directory
# debian/ubuntu defaults to --user (when not root, or not in virtual env)
# pip3 install ansible
# add --user's .local/bin to path if desired or path to it as needed
## Why this script exists
# FYI this script is to install ansible onto the guest via my magic, not vagrant's
# - because ubuntu focal isn't supported by ppa:ansible/ansible
# - ppa:ansible/ansible is what vagrant uses to install ansible on the guest
# - vagrant's code for installing ansible onto guests (this is a directory, multiple files are involved):
# - https://github.com/hashicorp/vagrant/tree/main/plugins/provisioners/ansible/cap/guest
# - each guest "type" (distro/os) will have a separate impl of installing ansible, ie ubuntu:
# - https://github.com/hashicorp/vagrant/tree/main/plugins/provisioners/ansible/cap/guest/ubuntu/ansible_install.rb
# - one of many issues describing the problem and linking to upstream issues
# - https://github.com/hashicorp/vagrant/issues/11544
# - eventually this script won't be necessary with vagrant + focal
# - but, keep it around to add tools to the guest with shell provisioners!
# - demystify part of vagrant! (learning tool)
# - add CM tools that can then take over!
## Relevant Ansible docs
# - https://docs.ansible.com/ansible/latest/scenario_guides/guide_vagrant.html
# - https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
# ansible_local means the guest is the controller (self configures)
| true
|
b05027b151f2eeb8ee0faf9ac193c52870acf1f4
|
Shell
|
ddgoin/scripts
|
/bin/tmuxgo2.sh
|
UTF-8
| 1,184
| 3.296875
| 3
|
[] |
no_license
|
#!/bin/bash
PROJECTS=$HOME/Projects
WORK=$PROJECTS/Work
TAB1_TITLE="NWYC Backend"
TAB1_SESSION="nwyc"
TAB1_WINDOWS=( $WORK/NWYC-Backend )
TAB2_TITLE="Hillday Backend"
TAB2_SESSION="hillday"
TAB2_WINDOWS=( $WORK/Hillday-Backend )
TAB3_TITLE="Constituent Voice 2"
TAB3_SESSION="cv2"
TAB3_WINDOWS=( $WORK/ConstituentVoice2-Deprecated )
TAB4_TITLE="Notes"
TAB4_SESSION="notes"
TAB4_WINDOWS=( $PROJECTS/Notes )
if [ $# -eq 0 ]; then
com_args=" --geometry=243x68+30"
for t in `seq 1 4`; do
com_args=$com_args" --tab -e 'bash -ic \"$0 $t\"'"
done
eval gnome-terminal $com_args
else
# set the tab title in the terminal
TITLEATTR="TAB"$1"_TITLE"
TITLE=("${!TITLEATTR}")
echo -en "\033]0;$TITLE\a"
SESSIONATTR="TAB"$1"_SESSION"
SESSION=("${!SESSIONATTR}")
tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
echo "Session $SESSION already exists. Attaching."
tmux attach -t $SESSION
exit 0;
fi
tmux new-session -d -s $SESSION
W_COUNTER=0
WINDOWATTR="TAB$1""_WINDOWS""[@]"
for WINDOW in "${!WINDOWATTR}"; do
let W_COUNTER=$W_COUNTER+1
tmux new-window -t $SESSION:$W_COUNTER -k -c ${WINDOW[0]}
done
tmux select-window -t $SESSION:1
tmux attach -t $SESSION
fi
| true
|
92b389632319d13bd69a7335f9b9fc48a5bf3fa3
|
Shell
|
BriefHistory/shell
|
/random_wallpaper.sh
|
UTF-8
| 525
| 3.515625
| 4
|
[] |
no_license
|
#!/bin/sh
WALLPAPER_DIR="/home/monk/images"
WALLPAPER_LINK="/home/monk/.wallpaper"
WALLPAPER_FILE=`readlink -f "$WALLPAPER_LINK"`
IMG_COUNT=`ls $WALLPAPER_DIR/*.{jpg,png}|wc -l`
while true; do
RAND=$((RANDOM % IMG_COUNT + 1))
IMG=`ls $WALLPAPER_DIR/*.{jpg,png}|sed -n ${RAND}p`
# echo "$IMG" >> ~/log.txt
# echo ${RAND}/${IMG_COUNT} >> ~/log.txt
if [[ "$IMG" == "$WALLPAPER_FILE" ]]; then
continue
fi
ln -sf "$IMG" "$WALLPAPER_LINK"
feh --bg-scale "$WALLPAPER_LINK"
break
done
| true
|
3ba7d2b027289fb3403b30c7615f66f150415c0d
|
Shell
|
npnet/x3568-linux
|
/app/qsetting/S80wifireconnect
|
UTF-8
| 628
| 3.4375
| 3
|
[] |
no_license
|
#!/bin/sh
#
# Reconnect Wifi...
#
case "$1" in
start)
echo "Trying to reconnect Wifi"
if [ -e /userdata/cfg/wpa_supplicant.conf ];then
if [ -n `grep "ssid=" /userdata/cfg/wpa_supplicant.conf` ];then
if [ -z `grep "SSID" /userdata/cfg/wpa_supplicant.conf` ];then
if [ -n `grep "psk=" /userdata/cfg/wpa_supplicant.conf` ];then
if [ -z `grep "PASSWORD" /userdata/cfg/wpa_supplicant.conf` ];then
wpa_supplicant -B -i wlan0 -c /userdata/cfg/wpa_supplicant.conf
fi
fi
fi
fi
fi
;;
stop)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0
| true
|
582d992fe6e486fa8a0f8f5f801bacbaf95731ad
|
Shell
|
alioshag/cp1
|
/cp1.sh
|
UTF-8
| 2,661
| 4.3125
| 4
|
[] |
no_license
|
#!/bin/bash
#filename : cp1.sh reviewed 2
#description: copy the file "start.txt" to another the file "mine.txt".
# If the string "start" is found inside "start.txt"
# replace it for "XXXX" in the process.
# if an input arg is provided, the source file name will
# be the input argument instead of "start.txt"
#************************************************************
#test arguments
VERSION=1.0
if [[ $# -gt 1 ]] #more than one argument
then
echo $0: Too many arguments. Program abort!
exit 1
fi
if [[ $# -eq 1 ]] #one argument
then
case "$1" in
--help)
echo
echo $0: Copy the file \"start.txt\" to \"mine.txt\"
echo $0: replacing any character sequence "start" to "XXXX" in destination
echo $0: A source file can be provided as first argument. ex cp1.sh [filename.ext]
exit
;;
-v)
echo $0: version number $VERSION
exit
;;
*)
sourcefile=$1
;;
esac
else
sourcefile="./start.txt"
fi
#**********************************************************
#test for source file existance and r permission
#use of && AND. execute command2 only if command1 is True
[ ! -f $sourcefile ] && { echo $0: File does not exist in the current directory. Program Abort!; exit 1; }
#test for read access
[[ ! -r $sourcefile ]] && { echo $0: File does not allow read access. Program Abort!; exit 1; }
#**********************************************************
#test for write access to the target directory (current)
dirname=`pwd`
if [[ ! -w $dirname ]]
then
echo $0: you must have w permission in the directory $dirname
exit 1
fi
#**********************************************************
#test if destination file exist
newfile=$dirname/"mine.txt"
if [[ -e $newfile ]]
then
echo $0: $newfile already exist and I will not harm it.
exit 1
fi
#**********************************************************
#test existance of the sed program
#use of || OR. execute command2 only if command1 is FALSE
command -v sed &> /dev/null || { echo $0: Sed program not found. Program Abort!; exit 1; }
#**********************************************************
#replace string "start" with "XXXX" and copy results on a new file mine.txt
if ! sed 's/start/XXXX/g' $sourcefile > $newfile
then
echo $0: The sed command exit status was $?
exit 1
fi
#*********************************************************
#test chmod to enable read permision of the new file
if ! chmod 444 $newfile
then
echo $0: the chmod exit status was $?
exit 1
fi
| true
|
7261797b8e08b2cfa6d1670fdcf977e545f81182
|
Shell
|
yxtj/Daiger
|
/run-script/cal_delta_gen_ratio.sh
|
UTF-8
| 278
| 3.046875
| 3
|
[
"MIT"
] |
permissive
|
#! /bin/sh
if [ $# -lt 2 ]; then
return 1
fi
#local gr=$1
gr=$1
#local ew=$2
ew=$2
add_r=$(echo " $ew*$gr" | bc -l)
rmv_r=$(echo "$ew*(1-$gr)" | bc -l)
inc_r=$(echo "(1 - $ew)*(1-$gr)" | bc -l)
dec_r=$(echo "(1-$ew)*$gr" | bc -l)
echo "$add_r $rmv_r $inc_r $dec_r"
return 0
| true
|
716b8bf2fa4050901cceae869ed37cce80632d7a
|
Shell
|
jiangchengbin/lfs
|
/build-scripts/build-all.sh
|
UTF-8
| 2,959
| 3.578125
| 4
|
[] |
no_license
|
#!/bin/bash
#################################################################
# #
# Author: Joe Jiang #
# Lable: build-all.sh #
# Information: buildLFM #
# CreateDate: 2011-09-16 #
# ModifyDate: 2011-12-02 #
# Version: v1.13 #
# #
#################################################################
src='../sources'
build='../build'
export src build
# make -j2
export MAKEFLAGS='-j 4'
mkdir -p log
log="log/build"
sh='runscript'
# 计算时间
p_time (){
TZ=GMT-8 date +%H:%M:%S > .time
now_time=`cat .time`
echo $now_time
}
seconds="date +%s"
echo "start time:" `p_time` > $log
echo "==================" >> $log
start_seconds=`$seconds`
tmp_s=""
tmp_m=""
step="0"
err="0"
# 执行脚本函数
runscript (){
cmd="sh $1 $2"
start_s="`$seconds`"
echo "$cmd" > .state
step=`expr $step + 1`
echo "start step $step :" `p_time` "$cmd" >> $log
$cmd || err=$?
[ "$err" != "0" ] && \
echo "$cmd fail errcode=$err step=$step" && \
exit $step
# 计算时间
end_s="`$seconds`"
echo "End time:" `p_time` >> $log
tmp_s="`expr $end_s - $start_s`"
echo "Spend time:" $tmp_s "seconds" >> $log
tmp_m=`echo scale=2 \; $tmp_s / 60 | bc | sed -e 's@^\.@0.@'`
echo "Spend $tmp_m Minute" >> $log
echo "" >> $log
}
# start
# 开始编译流程
# 编译Binuitils ,gcc,内核头文件和glibc
$sh build-binutils-pass1.sh
$sh build-gcc-pass1.sh
$sh build-linux-API-Headers.sh
$sh build-glibc.sh
# 调整工具链
if [ "$1" == "" ] ;then
SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
$LFS_TGT-gcc -dumpspecs | sed \
-e 's@/lib\(64\)\?/ld@/tools&@g' \
-e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
echo "New spec file is:$SPECS"
unset SPECS
fi
# 开始第二轮编译
$sh build-binutils-pass2.sh
$sh build-gcc-pass2.sh
$sh build-tcl.sh
$sh build-expect.sh
$sh build-dejagnu.sh
$sh build-ncurses.sh
$sh build-bash.sh
$sh build-bzip2.sh
$sh build-coreutils.sh
$sh build-diffutils.sh
$sh build-file.sh
$sh build-findutils.sh
$sh build-gawk.sh
$sh build-gettext.sh
$sh build-grep.sh
$sh build-gzip.sh
$sh build-m4.sh
$sh build-make.sh
$sh build-patch.sh
$sh build-perl.sh
$sh build-sed.sh
$sh build-tar.sh
$sh build-texinfo.sh
$sh build-xz.sh
$sh stripping-and-changing-ownership.sh
# 计算总时间
echo "=================" >> $log
echo "End time:" `p_time` >> $log
tmp_s="`$seconds`"
total_s="`expr $tmp_s - $start_seconds`"
echo "Total Spend time:" $total_s "seconds" >> $log
tmp_m=`echo scale=2 \; $total_s / 60 | bc `
echo "Total Spend $tmp_m Minutes" >> $log
# 编译完成
echo "Sucess!!"
echo "Please input exit"
| true
|
283463853e452fe893edccb7f4d3ba5de9d88d5a
|
Shell
|
acidghost/uberfuzz2
|
/cloc-report.sh
|
UTF-8
| 456
| 2.515625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
cloc --out=cloc.driver.txt --exclude-lang=make driver r2.sh
cloc --out=cloc.master.txt --exclude-dir=bin master/src
cloc --out=cloc.analysis.txt master/src/bin uberenv.sh work/*.{sh,plt}
cloc --sum-reports --out=uberfuzz cloc.{master,driver}.txt
cloc --sum-reports --out=uberfuzz.all cloc.*.txt
for t in "file" "lang" "all.file" "all.lang"; do
mv "uberfuzz.$t" "uberfuzz.$t.txt"
echo Moved "uberfuzz.$t" to "uberfuzz.$t.txt"
done
| true
|
d30a3467b1b7ff6440d57af6869bd996f5b5a333
|
Shell
|
click2cloud-akshaylothe/Azure-Migrate
|
/installer-scripts/tailwind-traders/tailwind_db_script.sh
|
UTF-8
| 4,637
| 3.625
| 4
|
[] |
no_license
|
#!/bin/bash
# Use the following variables to control your install:
# Password for the SA user (required)
MSSQL_SA_PASSWORD='ROOT#123'
# Product ID of the version of SQL server you're installing
# Must be evaluation, developer, express, web, standard, enterprise, or your 25 digit product key
# Defaults to developer
MSSQL_PID='evaluation'
# Install SQL Server Agent (recommended)
SQL_INSTALL_AGENT='y'
# Install SQL Server Full Text Search (optional)
# SQL_INSTALL_FULLTEXT='y'
# Create an additional user with sysadmin privileges (optional)
# SQL_INSTALL_USER='<Username>'
# SQL_INSTALL_USER_PASSWORD='<YourStrong!Passw0rd>'
if [ -z $MSSQL_SA_PASSWORD ]
then
echo Environment variable MSSQL_SA_PASSWORD must be set for unattended install
exit 1
fi
echo Adding Microsoft repositories...
echo $MSSQL_SA_PASSWORD
(wget -qO- https://packages.microsoft.com/keys/microsoft.asc; echo "CLICK2CLOUD#123") | sudo apt-key add -
echo $MSSQL_SA_PASSWORD
add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"
echo Running apt-get update -y...
apt-get update -y
echo Installing SQL Server...
apt-get install -y mssql-server
echo Running mssql-conf setup...
MSSQL_SA_PASSWORD=$MSSQL_SA_PASSWORD \
MSSQL_PID=$MSSQL_PID \
/opt/mssql/bin/mssql-conf -n setup accept-eula
echo Installing mssql-tools and unixODBC developer...
ACCEPT_EULA=Y apt-get install -y mssql-tools unixodbc-dev
# Add SQL Server tools to the path by default:
echo Adding SQL Server tools to your path...
echo PATH="$PATH:/opt/mssql-tools/bin" >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
# Optional SQL Server Agent installation:
if [ ! -z $SQL_INSTALL_AGENT ]
then
echo Installing SQL Server Agent...
apt-get install -y mssql-server-agent
fi
# Optional SQL Server Full Text Search installation:
if [ ! -z $SQL_INSTALL_FULLTEXT ]
then
echo Installing SQL Server Full-Text Search...
apt-get install -y mssql-server-fts
fi
# Configure firewall to allow TCP port 1433:
echo Configuring UFW to allow traffic on port 1433...
# ufw allow 1433/tcp
# ufw reload
apt install firewalld -y
firewall-cmd --permanent --zone=public --add-port=1433/tcp
systemctl restart firewalld
# Optional example of post-installation configuration.
# Trace flags 1204 and 1222 are for deadlock tracing.
# echo Setting trace flags...
# /opt/mssql/bin/mssql-conf traceflag 1204 1222 on
# Restart SQL Server after installing:
echo Restarting SQL Server...
systemctl restart mssql-server
# Connect to server and get the version:
counter=1
errstatus=1
while [ $counter -le 5 ] && [ $errstatus = 1 ]
do
echo Waiting for SQL Server to start...
sleep 3s
/opt/mssql-tools/bin/sqlcmd \
-S localhost \
-U SA \
-P $MSSQL_SA_PASSWORD \
-Q "SELECT @@VERSION" 2>/dev/null
errstatus=$?
((counter++))
done
# Display error if connection failed:
if [ $errstatus = 1 ]
then
echo Cannot connect to SQL Server, installation aborted
exit $errstatus
fi
# Optional new user creation:
# if [ ! -z $SQL_INSTALL_USER ] && [ ! -z $SQL_INSTALL_USER_PASSWORD ]
# then
# echo Creating user $SQL_INSTALL_USER
# /opt/mssql-tools/bin/sqlcmd \
# -S localhost \
# -U SA \
# -P $MSSQL_SA_PASSWORD \
# -Q "CREATE LOGIN [$SQL_INSTALL_USER] WITH PASSWORD=N'$SQL_INSTALL_USER_PASSWORD', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=ON, CHECK_POLICY=ON; ALTER SERVER ROLE [sysadmin] ADD MEMBER [$SQL_INSTALL_USER]"
# fi
echo SQL installation Done!
echo Installing MongoDB community edition...
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
echo Running apt-get update -y...
apt-get update -y
echo Installing MongoDB...
sudo apt-get install -y mongodb-org=4.2.7 mongodb-org-server=4.2.7 mongodb-org-shell=4.2.7 mongodb-org-mongos=4.2.7 mongodb-org-tools=4.2.7
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections
echo Starting MongoDB...
sudo systemctl start mongod
# Configure firewall to allow TCP port 1433:
echo Configuring UFW to allow traffic on port 27017...
# ufw allow 1433/tcp
# ufw reload
apt install firewalld -y
firewall-cmd --permanent --zone=public --add-port=27017/tcp
systemctl restart firewalld
echo MongoDB installation Done!
| true
|
b6a92bb409658675bf1c38df4cd317713317a1ec
|
Shell
|
CPT10000/scripting
|
/signal_dl.sh
|
UTF-8
| 2,098
| 4.15625
| 4
|
[] |
no_license
|
#!/bin/bash
# Mike Young
# 2021-07-29
# Recieves signal messages and downloads videos to a folder
# Signal messages admin on error
# Won't run if running flag exists.
#Variable declaration
log_fldr=/home/mike/signal_log
output=/home/mike/ytdl
#Server's signal account
signal_phone_no="+1"
#User phone number
auth_phone_no="+1"
function logfile(){
day=$(date +%F)
time=$(date +%T)
echo "$$-$time-$1" >> $log_fldr/signal_$day.log
}
function msg_admin(){
signal-cli -u $signal_phone_no send -m "$1" $auth_phone_no
}
#quit if this is already running
if [ -f $log_fldr/running.flg ]; then
logfile "CANCEL - $log_fldr/running.flg exists"
exit
else
touch $log_fldr/running.flg
fi
#Recieve signal messages
envelopes=$(signal-cli --output=json -u $signal_phone_no receive)
#Parse messages and load into array
for envelope in $envelopes; do
if [ "null" == "$(echo $envelope | jq -r .envelope.dataMessage)" ]; then
continue
fi
msg_source=$(echo $envelope | jq -r .envelope.source 2>&1)
msg_text=$(echo $envelope | jq -r .envelope.dataMessage.message 2>&1)
if [[ $msg_source == *"parse error:"* ]] || [[ $msg_text == *"parse error:"* ]]; then
logfile "BAD ENVELOPE!"
msg_admin "Bad envelope recieved!"
continue
elif [[ -z $msg_source ]] || [[ -z $msg_text ]]; then
continue
fi
if [ "$msg_source" == "$auth_phone_no" ]; then
if echo "$msg_text" | grep -E "^https:\/\/www\.youtube\.com\/watch\?[0-9,.a-z,A-Z,_,=]+" || \
echo "$msg_text" | grep -E "^https:\/\/youtu\.be\/[0-9,.a-z,A-Z,_]+"; then
logfile "YT URL FROM $msg_source, $msg_text"
result=$(youtube-dl --extract-audio --audio-format mp3 -o "$output/%(title)s.%(ext)s" $msg_text 2>&1)
if echo "$result" | grep -i "error"; then
logfile "YTERR: $result"
msg_admin "YTERR while DLing $msg_text"
else
msg_admin "YTDL Complete $(echo "$result" | grep "ffmpeg")"
fi
else
msg_admin "Error, message is not valid youtube URL: $msg_text"
fi
else
logfile "RECV, $msg_source, $msg_text"
continue
fi
done
if [ -f $log_fldr/running.flg ]; then
rm $log_fldr/running.flg
fi
| true
|
42ec5e446b7603cfed4ef742a24805732397d8b8
|
Shell
|
Surveily/Images
|
/script/wg0.sh
|
UTF-8
| 896
| 3.140625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/sh
# Run: curl -s https://raw.githubusercontent.com/Surveily/Images/master/script/wg0.sh | sudo sh
set -e
if [ `whoami` != root ]; then
echo "Please run this script with sudo:"
echo "sudo $0 $*"
exit 1
fi
# Setup wg0
chmod 600 /etc/wireguard/wg0.conf
systemctl enable wg-quick@wg0.service
systemctl daemon-reload
#systemctl start wg-quick@wg0
#systemctl status wg-quick@wg0
# Setup DNS reresolver
wget https://raw.githubusercontent.com/Surveily/Images/master/script/wg0/wireguard_reresolve-dns.service
wget https://raw.githubusercontent.com/Surveily/Images/master/script/wg0/wireguard_reresolve-dns.timer
mv wireguard_reresolve-dns.service /etc/systemd/system/wireguard_reresolve-dns.service
mv wireguard_reresolve-dns.timer /etc/systemd/system/wireguard_reresolve-dns.timer
systemctl enable wireguard_reresolve-dns.timer
systemctl start wireguard_reresolve-dns.timer
| true
|
977e9b064ea36bcb6fddbb2fffddbc2d50bf76a1
|
Shell
|
gabrielcossette/pydio-docker
|
/root/etc/my_init.d/00_startup.sh
|
UTF-8
| 3,834
| 3.859375
| 4
|
[] |
no_license
|
#!/bin/bash
set +e
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env 'PYDIO_DB_PASSWORD'
file_env 'PYDIO_PASSWORD'
# permissions
PUID=${PUID:-911}
PGID=${PGID:-911}
TERM=dumb php -- <<'EOPHP'
<?php
// database might not exist, so let's try creating it (just to be safe)
$stderr = fopen('php://stderr', 'w');
// https://codex.wordpress.org/Editing_wp-config.php#MySQL_Alternate_Port
// "hostname:port"
// https://codex.wordpress.org/Editing_wp-config.php#MySQL_Sockets_or_Pipes
// "hostname:unix-socket-path"
list($host, $socket) = explode(':', getenv('PYDIO_DB_HOST'), 2);
$port = 0;
if (is_numeric($socket)) {
$port = (int) $socket;
$socket = null;
}
$user = getenv('PYDIO_DB_USER');
$pass = getenv('PYDIO_DB_PASSWORD');
$maxTries = 10;
do {
$mysql = new mysqli($host, $user, $pass, '', $port, $socket);
if ($mysql->connect_error) {
fwrite($stderr, "\n" . 'MySQL Connection Error: (' . $mysql->connect_errno . ') ' . $mysql->connect_error . "\n");
--$maxTries;
if ($maxTries <= 0) {
exit(1);
}
sleep(3);
}
} while ($mysql->connect_error);
$mysql->close();
EOPHP
if [ ! -f /var/www/pydio/data/cache/first_run_passed ]; then
php /var/www/data/generate_pydio_hash.php $PYDIO_PASSWORD
[ -d /tmp/sess ] || mkdir /tmp/sess/
[ -d /data/pydio/cache ] || mkdir -p /data/pydio/cache
[ -d /data/pydio/logs ] || mkdir -p /data/pydio/logs
[ -d /data/pydio/personal ] || mkdir -p /data/pydio/personal
[ -d /data/pydio/public ] || mkdir -p /data/pydio/public
[ -d /data/pydio/files ] || mkdir -p /data/pydio/files
[ -d /data/pydio/tmp ] || mkdir -p /data/pydio/tmp
[ -d /data/booster ] || mkdir -p /data/booster
[ -f /data/booster/pydiocaddy.conf ] || cp /etc/pydiocaddy.conf /data/booster/pydiocaddy.conf
[ -f /data/booster/pydioconf.conf ] || cp /etc/pydioconf.conf /data/booster/pydioconf.conf
array=(/var/www/pydio/data/cache/admin_counted /var/www/pydio/data/cache/diag_result.php /var/www/pydio/data/cache/first_run_passed)
for file in ${array[@]}
do
if [ -e $file ]; then
echo "$file exist"
else
echo "$file not exist, try to create it..."
touch $file
fi
done
sed -i -e "s/MYSQL_USER/$PYDIO_DB_USER/g" /var/www/pydio/data/plugins/boot.conf/bootstrap.json
sed -i -e "s/MYSQL_HOST/$PYDIO_DB_HOST/g" /var/www/pydio/data/plugins/boot.conf/bootstrap.json
sed -i -e "s/MYSQL_PASSWORD/$PYDIO_DB_PASSWORD/g" /var/www/pydio/data/plugins/boot.conf/bootstrap.json
sed -i -e "s/MYSQL_DATABASE/$PYDIO_DB_NAME/g" /var/www/pydio/data/plugins/boot.conf/bootstrap.json
echo "table $TABLENAME does not exist, try to create table..."
mysql -u $PYDIO_DB_USER -p"$PYDIO_DB_PASSWORD" -h $PYDIO_DB_HOST < /var/www/data/pydio.sql
mkdir /wp/recycle_bin
mkdir /wp2/recycle_bin
mkdir /wp3/recycle_bin
mkdir /wp4/recycle_bin
mkdir /wp5/recycle_bin
else
php /var/www/data/update_pydio_hash.php $PYDIO_PASSWORD
echo "Updating DB password"
mysql -u $PYDIO_DB_USER -p"$PYDIO_DB_PASSWORD" -h $PYDIO_DB_HOST < /var/www/data/user.sql
fi
/usr/sbin/groupmod -g $PGID abc
/usr/sbin/usermod -u $PUID -g $PGID abc
chown -Rf abc:abc /data
chown -Rf abc:abc /tmp/sess
chown -Rf abc:abc /var/www/pydio
chmod -R 770 /tmp/sess
chmod -R 700 /data/pydio
chown -R abc:abc /wp*
echo " Starting User uid: $(id -u abc), User gid: $(id -g abc)"
set -e
| true
|
b7055289c46c11c5b6b72b5286f63f8c89afdc3e
|
Shell
|
gresham-computing/openid-connect-server
|
/.circleci/run_release_workflow.sh
|
UTF-8
| 884
| 3.53125
| 4
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
#!/bin/bash
if [[ -z "${CIRCLE_TOKEN}" ]]; then
echo Cannot trigger release workflow. CircleCI user token not found.
exit 1
fi
BRANCH=1.3.x
echo -e "\nTriggering release workflow on branch: ${BRANCH}.\n"
status_code=$(curl --request POST \
--url https://circleci.com/api/v2/project/github/gresham-computing/openid-connect-server/pipeline \
--header 'Circle-Token: '${CIRCLE_TOKEN}'' \
--header 'content-type: application/json' \
--data '{"branch":"'${BRANCH}'","parameters":{"release": true}}' \
-o response.json \
-w "%{http_code}")
if [ "${status_code}" -ge "200" ] && [ "${status_code}" -lt "300" ]; then
echo -e "\nAPI call succeeded [${status_code}]. Response:\n"
cat response.json
rm response.json
else
echo -e "\nAPI call failed [${status_code}]. Response:\n"
cat response.json
rm response.json
exit 1
fi
| true
|
bce9bad6758b65dcca5c41ca6c8cb60a7be356f6
|
Shell
|
montjoie/lab-tools
|
/amaz.sh
|
UTF-8
| 1,363
| 3.90625
| 4
|
[] |
no_license
|
#!/bin/sh
print_help() {
echo "USAGE: $0 [-h][-b USBPATH][-p PORT][-a off/on/reset]"
}
CFG=""
B_HUB=""
while [ $# -ge 1 ];do
case $1 in
-f)
shift
CFG=$1
shift
;;
-p)
shift
VPORT=$1
shift
;;
-a)
shift
ACTION=$1
shift
case $ACTION in
on)
;;
off)
;;
reset)
;;
switch_on)
ACTION=on
;;
switch_off)
ACTION=off
;;
*)
echo "ERROR: unknown action $ACTION"
exit 1
;;
esac
;;
-b)
shift
B_HUB="$1"
shift
;;
*)
echo "ERROR: unknown arg $1"
exit 1
;;
esac
done
if [ -z "$B_HUB" ];then
for devi in $(ls /sys/bus/usb/devices/*/manufacturer)
do
grep -q VIA $devi
if [ $? -eq 0 ];then
B_HUB=$(echo $devi | cut -d'/' -f6 | sed 's,.4$,g,')
fi
done
fi
if [ -z "$B_HUB" ];then
echo "ERROR: No compatible HUB found"
exit 1
fi
echo "INFO: found compatible HUB at $B_HUB"
if [ -z "$VPORT" ];then
echo "ERROR: No port given"
exit 1
fi
case $VPORT in
1)
B=$B_HUB
PORT=3
;;
2)
B=$B_HUB
PORT=2
;;
3)
B=$B_HUB
PORT=1
;;
4)
B=$B_HUB.4
PORT=3
;;
5)
B=$B_HUB.4
PORT=2
;;
6)
B=$B_HUB.4
PORT=1
;;
7)
B=$B_HUB.4.4
PORT=3
;;
8)
B=$B_HUB.4.4
PORT=2
;;
9)
B=$B_HUB.4.4
PORT=1
;;
10)
B=$B_HUB.4.4
PORT=4
;;
esac
echo "PORT $VPORT is on $B port $PORT"
if [ -z "$ACTION" ];then
exit 0
fi
case $ACTION
in
off)
uhubctl -l $B -p $PORT -a 0
;;
on)
uhubctl -l $B -p $PORT -a 1
;;
reset)
uhubctl -l $B -p $PORT -a 2
;;
esac
| true
|
676f7125954da8c4fe0afd4f55fb08387b9acf6e
|
Shell
|
jec429/cmssw-usercode
|
/WR_Analyzer/test/moveROOT.sh
|
UTF-8
| 123
| 3.0625
| 3
|
[] |
no_license
|
#! /bin/bash
for x in $(ls *.root); do
a=$(date "+%M_%H_%m_%d_%y_")
echo $a$x
mv $x plots/rootfiles/$a$x
done
| true
|
6747f389a395e93268ed19349898378aae00fb3b
|
Shell
|
balioune/opnfv
|
/vmspace/vmspace/openstack/src/trusty-kilo/06-First-VM-Instanciation/05-test-ping-and-ssh.sh
|
UTF-8
| 345
| 2.8125
| 3
|
[] |
no_license
|
#!/bin/bash
echo \* Getting an public IP for Inst1 ...
IP=$(nova floating-ip-create ext-net | grep ext-net | awk '{print $2}')
echo Got $IP
echo \* Associating with inst1 ...
nova floating-ip-associate inst1 $IP
echo \* Let\'s ping 4 times ...
ping -c 4 $IP
echo \* Attempting SSH \(Password is \'cubswin:\)\'\)
ssh cirros@$IP
echo Done
| true
|
f2d3eb729853110fe7a20746f69b3a4825260bdd
|
Shell
|
alvarouc/BROCCOLI
|
/code/Bash_Wrapper/update_compiled_bashwrappers_mac.sh
|
UTF-8
| 2,518
| 2.546875
| 3
|
[] |
no_license
|
#!/bin/bash
BROCCOLI_GIT_DIRECTORY=`git rev-parse --show-toplevel`
cd $BROCCOLI_GIT_DIRECTORY/code/BROCCOLI_LIB
# Change release to debug for library
sed -i '' 's/COMPILATION=$RELEASE/COMPILATION=$DEBUG/g' $BROCCOLI_GIT_DIRECTORY/code/BROCCOLI_LIB/compile_broccoli_library_mac.sh
# Compile library
./compile_broccoli_library_mac.sh
cd $BROCCOLI_GIT_DIRECTORY/code/Bash_Wrapper
# Change release to debug for wrappers
sed -i '' 's/COMPILATION=$RELEASE/COMPILATION=$DEBUG/g' $BROCCOLI_GIT_DIRECTORY/code/Bash_Wrapper/compile_wrappers_mac.sh
# Compile wrappers
./compile_wrappers_mac.sh
# Add compiled debug files
git add $BROCCOLI_GIT_DIRECTORY/compiled/BROCCOLI_LIB/Mac/Debug/libBROCCOLI_LIB.a
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/FirstLevelAnalysis
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/MotionCorrection
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/RegisterTwoVolumes
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/RandomiseGroupLevel
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/SliceTimingCorrection
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/TransformVolume
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/GetOpenCLInfo
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Debug/Smoothing
cd $BROCCOLI_GIT_DIRECTORY/code/BROCCOLI_LIB
# Change debug to release
sed -i '' 's/COMPILATION=$DEBUG/COMPILATION=$RELEASE/g' $BROCCOLI_GIT_DIRECTORY/code/BROCCOLI_LIB/compile_broccoli_library_mac.sh
# Compile library
./compile_broccoli_library_mac.sh
cd $BROCCOLI_GIT_DIRECTORY/code/Bash_Wrapper
# Change debug to release for wrappers
sed -i '' 's/COMPILATION=$DEBUG/COMPILATION=$RELEASE/g' $BROCCOLI_GIT_DIRECTORY/code/Bash_Wrapper/compile_wrappers_mac.sh
# Compile wrappers
./compile_wrappers_mac.sh
# Add compiled release files
git add $BROCCOLI_GIT_DIRECTORY/compiled/BROCCOLI_LIB/Mac/Release/libBROCCOLI_LIB.a
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/FirstLevelAnalysis
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/MotionCorrection
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/RegisterTwoVolumes
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/RandomiseGroupLevel
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/SliceTimingCorrection
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/TransformVolume
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/GetOpenCLInfo
git add $BROCCOLI_GIT_DIRECTORY/compiled/Bash/Mac/Release/Smoothing
| true
|
1323978304c5bfcd301d93869ecda0798b12be82
|
Shell
|
r4xjs/dotfiles
|
/scripts/pwn/nn_nmap.sh
|
UTF-8
| 1,059
| 3.09375
| 3
|
[] |
no_license
|
#!bin/zsh
nn_nmap_tcp_all_ports(){
print -z 'sudo nmap --nsock-engine epoll --defeat-rst-ratelimit -n -vvv -sS -d -T4 -oA all_tcp_ports -p- '
}
nn_nmap_tcp_sCV(){
print -z 'while read -r t; do host=${t%%:*};ports=${t##*: }; sudo nmap -sCV -p "$ports" -oA "${host}_sCV" -vvv -d "$host" ; done <<(/home/user/.scr/pwn/gnmap_open_ports < **/*.gnmap)'
}
nn_nmap_smb_scan(){
print -z 'nmap --script smb2-security-mode,smb2-capabilities,"smb-enum-*","smb-vuln-*",smb-ls,smb-server-stats,smb-system-info,smb-protocols,smb-print-text,smb-mbenum,smb2-vuln-uptime,smb-security-mode -p445 -oA smb_scrpits '
}
nn_nmap_heartbleed(){
print -z 'while read -r t; do $(echo $t | awk "BEGIN{FS=\":\"} {printf \"nmap -p %s --script ssl-heartbleed %s\\n\",$2,$1}"); done < ~/w1/ip_colon_port.lst >> heartbleed.log'
}
nmap_ip_list(){
nmap -sL -n -iL "$1" | cut -d' ' -f5 | grep -P '^\d' --color=never | sort -u
}
nn_nmap_list_scripts(){
script_path=/usr/share/nmap/scripts/
vim "${script_path}$(find $script_path -type f -printf '%f\n' | fzf)"
}
| true
|
1865b99523a47570ab63bc7c7f82c290443bb211
|
Shell
|
GreenCyberNinja/holberton-system_engineering-devops
|
/0x04-loops_conditions_and_parsing/9-to_file_or_not_to_file
|
UTF-8
| 467
| 3.328125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
#checks if file exist
if [ -e "holbertonschool" ]
then
echo "holbertonschool file exists"
if [ -s "holbertonschool" ]
then
echo "holbertonschool file is not empty"
if [ ! -d "holbertonschool" ]
then
echo "holbertonschool is a regular file"
fi
else
echo "holbertonschool file is empty"
if [ ! -d "holbertonschool" ]
then
echo "holbertonschool is a regular file"
fi
fi
else
echo "holbertonschool file does not exist"
fi
| true
|
5ac6ccf10340bb0f9507152bd5ce3982f6115229
|
Shell
|
actualeyes/configs
|
/.xinitrc
|
UTF-8
| 1,844
| 2.6875
| 3
|
[] |
no_license
|
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
# Start a D-Bus session
# source /etc/X11/xinit/xinitrc.d/30-dbus
# Xmonad Related Commands and Variables
if [ -x /usr/bin/xsetroot ] ; then
xsetroot -cursor_name left_ptr &
fi
if [ -x /usr/bin/xrdb ] ; then
xrdb -merge ~/.Xresources
fi
#export XMODIFIERS=@im=uim
#export GTK_IM_MODULE="uim"
trayer --edge top --align right --SetDockType true --SetPartialStrut true \
--expand true --width 14 --transparent true --tint black --height 18 &
# if [ -x /usr/bin/uim-xim ] ; then
# uim-xim &
# fi
if [ -x /usr/bin/uim-toolbar-gtk-systray ] ; then
uim-toolbar-gtk-systray &
fi
# Launch Commands
# Org
if [ -x /usr/bin/emacs ] ; then
emacs -f org-agenda-list -T Org &
fi
if [ -x /usr/bin/emacs ] ; then
emacs -f erc-initiate-connections -T IM &
fi
# Conky
if [ -x /usr/bin/conky ] ; then
conky &
fi
# Power Manager
if [ -x /usr/bin/xfce4-power-manager ] ; then
xfce4-power-manager &
fi
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
# Input Method Switcher
if [ -x /usr/bin/ibus-daemon ] ; then
ibus-daemon --xim &
fi
# Volume ControlXS
if [ -x /usr/bin/volumeicon ] ; then
volumeicon &
fi
if [ -x /usr/bin/emacs ] ; then
emacs -T EmacsConsole &
fi
if [ -x /usr/bin/xscreensaver ] ; then
xscreensaver &
fi
if [ -x /usr/bin/keepassx ] ; then
keepassx &
fi
if [ -x /usr/bin/w3m ] ; then
emacs -f w3m -T EmacsWeb &
fi
if [ -x /usr/bin/xterm ] ; then
/usr/bin/env LANG=en_US.UTF-8 xterm -name WebConsole &
/usr/bin/env LANG=en_US.UTF-8 xterm -name EmacsConsole &
fi
if [ -x /usr/bin/wicd-client ] ; then
wicd-client --tray &
fi
| true
|
3e89c252fa67910445770399df05bea9c0086aa8
|
Shell
|
teocci/GlassfishServer
|
/scripts/glassfish
|
UTF-8
| 448
| 3.3125
| 3
|
[
"MIT"
] |
permissive
|
#! /bin/sh
#to prevent some possible problems
export AS_JAVA=/usr/local/jdk1.8.0
GLASSFISHPATH=/home/glassfish/bin
case "$1" in
start)
echo "starting glassfish from $GLASSFISHPATH"
sudo -u gladmin $GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo "stopping glassfish from $GLASSFISHPATH"
sudo -u gladmin $GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo $"usage: $0 {start|stop|restart}"
exit 3
;;
esac
:
| true
|
a798ae6815cf008a9adf28d3722177e51526dd2b
|
Shell
|
csathler/Masters-Data-Science
|
/Management-Access-Use-of-Big-Data/Project A/TwitterProjectCode/templates/import_mongodb.sh
|
UTF-8
| 246
| 3
| 3
|
[] |
no_license
|
#!/bin/bash
function usage
{
echo "Usage: import_mangodb.sh <db name> <collection name> <import file type> <import file>"
}
if [ "$4" = "" ];
then
usage;
exit 1
fi
mongoimport --db $1 --collection $2 --type $3 --headerline --file $4
| true
|
6e0e8e71699876de04a30b563e800aef3aeec4a1
|
Shell
|
huawei-noah/bolt
|
/inference/examples/c_api/compile.sh
|
UTF-8
| 2,376
| 3.515625
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
script_dir=$(cd `dirname $0` && pwd)
BOLT_ROOT=${script_dir}/../../..
target=$1
use_openmp=$2
unset OpenCL_ROOT
if [[ ${target} == "" || ! -f ${BOLT_ROOT}/third_party/${target}.sh ]]; then
echo "[ERROR] target parameter(${target}) is invalid. Please use command: ./compile.sh [target]"
exit 1
fi
source ${BOLT_ROOT}/third_party/${target}.sh || exit 1
source ${BOLT_ROOT}/scripts/setup_compiler.sh || exit 1
if [[ ${use_openmp} == "off" || ${use_openmp} == "OFF" ]]; then
openmp=""
else
openmp="-fopenmp"
fi
if [[ ${OpenCL_ROOT} != "" && -d "${OpenCL_ROOT}/lib" ]]; then
opencl_lib="-L${OpenCL_ROOT}/lib -lOpenCL"
fi
pthread=""
if [[ ${target} =~ "android" ]]; then
android_lib="-llog"
cxx_lib_static="-lc++_static -lc++abi"
elif [[ ${target} =~ "windows" ]]; then
cxx_lib_shared="-lstdc++ -lssp"
cxx_lib_static=${cxx_lib_shared}
pthread="-pthread"
else
cxx_lib_shared="-lstdc++"
cxx_lib_static=${cxx_lib_shared}
fi
CFLAGS="${CFLAGS} -O3 -fPIC -fPIE -fstack-protector-all -fstack-protector-strong -I${BOLT_ROOT}/inference/engine/include ${openmp} ${pthread}"
${CC} ${CFLAGS} -c ${BOLT_ROOT}/inference/examples/c_api/c_test.c -o c_test.o || exit 1
${CC} ${CFLAGS} -c ${BOLT_ROOT}/inference/examples/c_api/c_image_classification.c -o c_image_classification.o || exit 1
${CC} ${CFLAGS} -c ${BOLT_ROOT}/inference/examples/c_api/c_input_method.c -o c_input_method.o || exit 1
# link dynamic library
LDFLAGS="-L${BOLT_ROOT}/install_${target}/lib -lbolt -lm ${android_lib} ${cxx_lib_shared} ${opencl_lib} ${openmp} ${pthread}"
${CC} c_test.o c_image_classification.o -o c_image_classification_share ${LDFLAGS} || exit 1
${CC} c_test.o c_input_method.o -o c_input_method_share ${LDFLAGS} || exit 1
# link static library
LDFLAGS="${BOLT_ROOT}/install_${target}/lib/libbolt.a -lm ${android_lib} ${cxx_lib_static} ${opencl_lib} ${openmp} ${pthread}"
${CC} c_test.o c_image_classification.o -o c_image_classification_static ${LDFLAGS} || exit 1
${CC} c_test.o c_input_method.o -o c_input_method_static ${LDFLAGS} || exit 1
if [[ `file ./c_input_method_static` =~ "ELF" ]]; then
check_cxx_shared=`${READELF} -d ./c_input_method_static | grep "libc++_shared"`
if [[ ${check_cxx_shared} != "" ]]; then
echo "[ERROR] not package libc++_shared.so into bolt."
exit 1
fi
fi
rm *.o c_input_method_*
| true
|
7130f4c0932667500bdb3541003f0afce70e7725
|
Shell
|
sanketb412/assignments
|
/Day6/forloop/factorial.sh
|
UTF-8
| 128
| 3.46875
| 3
|
[] |
no_license
|
#!/bin/bash -x
read -p "Enter a Number to find its Factorial:- " x
y=1
for (( i=1; i<=$x; i++ ))
do
y=$((y*i))
done
echo $y
| true
|
26abda6531ee08c6f50adb3d5c462f2eebb31423
|
Shell
|
sarandi/dotfiles
|
/bin/utils/emailCSV.sh
|
UTF-8
| 800
| 4.03125
| 4
|
[
"MIT"
] |
permissive
|
#/usr/bin/env bash
# Read in a csv file,
# strip empty lines
# convert to lowercase
# replace endings with \r\n
for f in "$@"
do
input=$f;
file="$(basename "${input}")";
dir="$(dirname "${input}")";
output=$dir/modified_$file;
temp="$dir/temp.csv";
touch "$temp";
# remove empty lines
awk -F, 'length>NF+1' "$input" > "$temp"; # This was originally && the following line;
mv "$temp" "$output";
/usr/local/bin/unix2dos "$output";
# to lowercase
tr A-Z a-z < "$output" > "$temp"; # same re: &&
mv "$temp" "$output";
done
# remove \r only
#tr -d '\r' < $1 > temp.csv && mv temp.csv $1
# replace endings with \r\n
#sed 's/$/^M/' "$1" > temp.csv && mv temp.csv "$1";
# Resources
# 0. https://www.unix.com/shell-programming-and-scripting/152047-how-remove-blank-rows-csv-file.html
| true
|
8508b826cc29cf051474c2451de2bd05392fa980
|
Shell
|
BrianHicks/dotfiles
|
/dotfiles/bin/notmuchalert
|
UTF-8
| 140
| 2.671875
| 3
|
[] |
no_license
|
#!/bin/bash
NEW=`/usr/local/bin/notmuch new`
if [ "$NEW" != 'No new mail.' ]; then
echo $NEW | growlnotify 'Mail Changed';
fi
echo $NEW
| true
|
f4b06a0abab967db1299e43451397d7aa88ae1c8
|
Shell
|
cchriste/dot
|
/.profile
|
UTF-8
| 1,058
| 2.953125
| 3
|
[] |
no_license
|
#
# .profile
#
# Author: Cameron Christensen
# Created: August 9, 2007
#
# .profile for terminal OSX sessions.
#
#set -x
#echo "************* .profile *************"
# EDITOR (Emacs takes too long to startup to be used as EDITOR)
export EDITOR=vim
if [ `hostname | cut -f1 -d "."` = gunship ]; then
#echo ""
xinput set-prop 8 "Evdev Scrolling Distance" -1 1 1
fi
# gunship-specific additions
if [ `hostname | cut -f1 -d "."` = gunship ]; then
#start synergy keyboard/mouse sharing
#synergys --enable-crypto --config /home/cam/synergy.conf
synergys --daemon --debug INFO --name gunship -c /home/cam/synergy.conf --address :24800
#(23.08.2017 - commented since it looks like synergy is actually run by window manager)
#2018.10.19 - uncommented since synergy had some issues letting osx think it was asleep even while I was using it, so I downgraded and am using an older version of the command line as well, but still pretty much the same conf file.
fi
#source .bashrc if being run (interactively) from bash
if [ "$BASH" ]; then
. ~/.bashrc
fi
| true
|
a4a20fdd60bf66bf475b6b252861aa53e1c5a4d7
|
Shell
|
hmarcelino/dev-utils
|
/share/utils/print.sh
|
UTF-8
| 663
| 3.203125
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
INFO="\033[34m"
GREEN="\033[32m"
YELLOW="\033[33m"
RED="\033[31m"
NOCOLOR="\033[0m"
function print_info {
printf "${INFO}%s${NOCOLOR}" "$1"
}
function print_success {
printf "${GREEN}%s${NOCOLOR}" "$1"
}
function print_warning {
printf "${YELLOW}%s${NOCOLOR}" "$1"
}
function print_error {
printf "${RED}%s${NOCOLOR}" "$1"
}
function println {
echo -e "$1$2${NOCOLOR}"
}
function println_info {
echo -e "${INFO}$1${NOCOLOR}"
}
function println_success {
echo -e "${GREEN}$1${NOCOLOR}"
}
function println_warning {
echo -e "${YELLOW}$1${NOCOLOR}"
}
function println_error {
echo -e "${RED}$1${NOCOLOR}"
}
| true
|
d998400cc90ec7570b4a3670c820660a41c1e2fe
|
Shell
|
craSH/https-everywhere
|
/pending-rules/trivial-validate
|
UTF-8
| 1,492
| 3.875
| 4
|
[] |
no_license
|
#!/bin/sh
# THIS IS NOT A RULE, but a shell script that looks for common problems
# and typos in rules.
echo "-- Rules not anchored to beginning of a line:"
grep from= *.xml | cut -d\" -f2 | grep '^[^^]' || echo "(None.)"
echo
echo "-- Rules with unescaped dots:"
grep from= *.xml | cut -d\" -f2 | grep '[^\]\.[^*]' || echo "(None.)"
echo
echo "-- Rules not containing trailing slash in from pattern:"
grep from= *.xml | cut -d\" -f2 | grep -v '//.*/' || echo "(None.)"
echo
echo "-- Rules not containing trailing slash in to pattern:"
grep 'to="' *xml | sed 's/^.*to="//' | sed 's/\".*$//' | grep -v '//.*/' || echo "(None.)"
echo
echo "-- Rules with missing closing slash in rule XML tag:"
grep to= *xml | grep '[^/]>' || echo "(None.)"
echo
echo "-- Rules redirecting to http in to pattern:"
grep 'to="' *xml | sed 's/^.*to="//' | sed 's/\".*$//' | grep '^http:' || echo "(None.)"
echo
if [ $(which xmllint) ]
then
echo "-- Rules with syntatically invalid XML:"
none=true
for rule in *.xml
do
xmllint "$rule" >/dev/null 2>&1 || { echo $rule; none=false; }
done
$none && echo "(None.)"
else
echo "-- Could not check XML validity because xmllint not found."
fi
echo
echo "-- Rules containing non-ASCII characters (possible homoglyph attacks):"
none=true
for i in *.xml
do
if egrep '(from|to)=' "$i" | tr -d '[:print:]' | tr -d '[:space:]' | grep . >/dev/null
then
echo "$i contains non-ASCII character(s)."
none=false
fi
done
$none && echo "(None.)"
| true
|
c3b60e3a81e83c444dedccc29c8267947796de35
|
Shell
|
Zlatov/sql
|
/src/fun/init.sh
|
UTF-8
| 10,728
| 3.859375
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# Список функций:
# init — входная функция
# createConfig — создание конфигурационного файла пользователя
# createDefaultFolders — создание необходимых папок
# checkGitignore — проверка и зоздания .gitignore
# checkTableVersionExist — провверка существования таблицы версий в бд
# createTableVersion — создание таблицы версий
# echoVersion — вывод версии базы данных и миграций
# getDbVersion — получение версии базы данных
# echoDbName — имя БД из конфига
# echoDbUser — имя пользователя БД из конфига
# echoDbConf — вывод Конйигурационного файла
# reset — удалить и создать базу данных
function init {
if [ ! -f ./config.sh ]
then
echo -en $COLOR_RED
echo "Конифигурационный файл config.sh не найден."
echo -en $STYLE_DEFAULT
echo -en $COLOR_GREEN
yN "Создать конифигурационный файл? [yes/NO]"
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_RED
echo "Найден конфигурационный файл"
echo -en $STYLE_DEFAULT
yN "Перезаписать конифигурационный файл? [yes/NO]"
fi
if [[ $YN -eq 1 ]]
then
createConfig
fi
createDefaultFolders
checkGitignore
if [[ $(checkTableVersionExist) -eq 0 ]]
then
echo -en $COLOR_RED
echo "Таблица версий не найдена."
echo -en $STYLE_DEFAULT
yN "Создать таблицу версий? [yes/NO]"
if [[ $YN -eq 1 ]]; then
createTableVersion
fi
fi
}
function createConfig {
echo -n "Хост (localhost): "
read DBHOST
if [[ $DBHOST == '' ]]
then
DBHOST="localhost"
fi
echo -n "Имя БД: "
read DBNAME
echo -n "Имя пользователя БД (root): "
read DBUSER
if [[ $DBUSER == '' ]]
then
DBUSER="root"
fi
echo -n "Пароль: "
read -s DBPASS
echo
echo -n "Адрес удаленного сервера (user@server) или алиас (myserver): "
read REMOTE_NAME
echo -n "Абсолютный путь к корню проекта (/home/user/projectname): "
read REMOTE_PATH
echo "#!/bin/bash
TEXT_BOLD='\033[1m'
COLOR_RED='\033[31m'
COLOR_GREEN='\033[32m'
STYLE_DEFAULT='\033[0m'
DBHOST=\"$DBHOST\"
DBNAME=\"$DBNAME\"
DBUSER=\"$DBUSER\"
DBPASS=\"$DBPASS\"
REMOTE_NAME=\"$REMOTE_NAME\"
REMOTE_PATH=\"$REMOTE_PATH\"
SQL_DEBUG=0
if [[ \$SQL_DEBUG -eq 1 ]]
then
echo -en \$COLOR_GREEN
echo -e \"Включён локальный конфигурационный файл: \$STYLE_DEFAULT\$BASH_ARGV.\"
echo -en \$STYLE_DEFAULT
fi
" > config.sh
if [ ! -f ./config.sh ]
then
echo -en $COLOR_RED
echo "Конфигурационный файл НЕ создан!"
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_GREEN
echo "Конфигурационный файл успешно создан."
echo -en $STYLE_DEFAULT
fi
}
function createDefaultFolders {
if [ ! -d ./dump ]; then
# mkdir -p dump
mkdir dump
if [ -d ./dump ]; then
echo -en $COLOR_GREEN
echo "Создана папка размещения дампов (dump/)"
echo -en $STYLE_DEFAULT
fi
fi
if [ ! -d ./migration ]; then
mkdir migration
if [ -d ./migration ]; then
echo -en $COLOR_GREEN
echo "Создана папка хранения миграций (migration/)"
echo -en $STYLE_DEFAULT
fi
fi
if [ ! -d ./procedures ]; then
mkdir procedures
if [ -d ./procedures ]; then
echo -en $COLOR_GREEN
echo "Создана папка хранения процедур (procedures/)"
echo -en $STYLE_DEFAULT
fi
fi
if [ ! -d ./triggers ]; then
mkdir triggers
if [ -d ./triggers ]; then
echo -en $COLOR_GREEN
echo "Создана папка хранения триггеров (triggers/)"
echo -en $STYLE_DEFAULT
fi
fi
if [ ! -d ./data ]; then
mkdir data
if [ -d ./data ]; then
echo -en $COLOR_GREEN
echo "Создана папка хранения тестовых или обязательных данных (data/)"
echo -en $STYLE_DEFAULT
fi
fi
}
function checkGitignore {
if [ ! -f ./.gitignore ]
then
echo "
dump/*.sql
dump/*.tar.gz
config.sh
sql
" > .gitignore
if [ -f ./.gitignore ]
then
echo -en $COLOR_GREEN
echo "Файл .gitignore успешно создан."
echo -en $STYLE_DEFAULT
fi
fi
}
function checkTableVersionExist {
export MYSQL_PWD="$DBPASS"
SQL="
SELECT TABLE_NAME
FROM information_schema.tables
WHERE table_schema = '$DBNAME'
AND table_name = 'sqlversion';
"
if [[ $SQL_DEBUG -eq 1 ]]
then
echo -en $COLOR_YELLOW
echo "$SQL"
echo -en $STYLE_DEFAULT
fi
TEMP=`mysql --host=$DBHOST --port=3306 --user="$DBUSER" --database="$DBNAME" --execute="$SQL"`
if echo $TEMP | grep -q 'sqlversion'
then
echo 1
else
echo 0
fi
}
function createTableVersion {
`mysql --host=$DBHOST --port=3306 --user="$DBUSER" --database="$DBNAME" --execute="
CREATE TABLE \\\`sqlversion\\\` (
\\\`name\\\` varchar(45) NOT NULL,
\\\`value\\\` varchar(45) NOT NULL,
PRIMARY KEY (\\\`name\\\`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO sqlversion VALUES ('version', '0.0.0');
"`
if [[ $? -eq 1 ]]
then
echo -en $COLOR_RED
echo -e "Ошибка создания таблицы версий."
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_GREEN
echo -e "Таблица версий успешно создана."
echo -en $STYLE_DEFAULT
fi
}
function echoVersion {
if [[ `checkTableVersionExist` -eq 0 ]]
then
echo -en $COLOR_RED
echo -e "Таблица версий БД не создана."
echo -en $STYLE_DEFAULT
yN "Создать таблицу версий? [yes/NO]"
if [[ $YN -eq 1 ]]
then
createTableVersion
fi
fi
if [[ `checkTableVersionExist` -eq 1 ]]
then
# TEMP=$(mysql --host=$DBHOST --port=3306 --user="$DBUSER" -s --execute="
# -- SELECT concat(\`1\`, '.', \`2\`, '.', \`3\`) as version FROM sqlversion LIMIT 1;
# SELECT \`value\` as version FROM \`sqlversion\` WHERE name = 'version';
# ")
TEMP=$(getDbVersion)
if [[ $TEMP == '' ]]; then
TEMP="Нет версии"
fi
echo -en $COLOR_GREEN
echo -e "Версия БД: $STYLE_DEFAULT$TEMP"
echo -en $STYLE_DEFAULT
fi
MVERSION=`LANG=C ls migration | grep '.sql' | sed -r 's/\.sql//' | tail -1`
if [[ $MVERSION == '' ]]; then
echo "Нет миграций"
fi
echo -en $COLOR_GREEN
echo -e "Версия последней миграции: $STYLE_DEFAULT$MVERSION"
echo -en $STYLE_DEFAULT
}
function getDbVersion {
echo $(mysql --host=$DBHOST --port=3306 --user="$DBUSER" --database="$DBNAME" -s --execute="
SELECT \`value\` as version FROM \`sqlversion\` WHERE name = 'version';
")
}
function echoDbName {
if [ ! -f ./config.sh ]
then
echo -en $COLOR_RED
echo "Конифигурационный файл config.sh не найден."
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_GREEN
echo "Работа с базой данных: $DBNAME"
echo -en $STYLE_DEFAULT
fi
}
function echoDbUser {
if [ ! -f ./config.sh ]
then
echo -en $COLOR_RED
echo "Конифигурационный файл config.sh не найден."
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_GREEN
echo "Работа с базой данных от пользователя: $DBUSER"
echo -en $STYLE_DEFAULT
fi
}
function echoDbConf {
if [ ! -f ./config.sh ]
then
echo -en $COLOR_RED
echo "Конифигурационный файл config.sh не найден."
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_GREEN
echo -e "Работа с базой данных: $STYLE_DEFAULT$DBNAME"
echo -en $COLOR_GREEN
echo -e "на: $STYLE_DEFAULT$DBHOST"
echo -en $COLOR_GREEN
echo -e "От пользователя: $STYLE_DEFAULT$DBUSER"
echo -en $STYLE_DEFAULT
fi
}
function reset {
`mysql --host=$DBHOST --port=3306 --user="$DBUSER" -e"DROP DATABASE $DBNAME;"` >/dev/null
MYSQL_STATUS=$?
if [[ $MYSQL_STATUS -eq 0 ]]
then
echo -en $COLOR_GREEN
echo "БД $DBNAME удалена успешно."
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_RED
echo -e "Ошибка удаления."
echo -en $STYLE_DEFAULT
fi
`mysql --host=$DBHOST --port=3306 --user="$DBUSER" -e"CREATE SCHEMA $DBNAME DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"` >/dev/null
MYSQL_STATUS=$?
if [[ $MYSQL_STATUS -eq 0 ]]
then
echo -en $COLOR_GREEN
echo "БД $DBNAME создана успешно."
echo -en $STYLE_DEFAULT
else
echo -en $COLOR_RED
echo -e "Ошибка создания."
echo -en $STYLE_DEFAULT
fi
}
| true
|
43b0d8a77ecfbbb93bc6a8f848e340c2cba2b13c
|
Shell
|
fagan2888/my-bash-scripts
|
/bashrc
|
UTF-8
| 521
| 2.65625
| 3
|
[] |
no_license
|
# Add `source ~/bin/bashrc` to ~/.bashrc.
# "activate" alias to activate a Python virtualenv
# in the usual place I put it
alias activate="source .env/bin/activate"
# https://github.com/magicmonty/bash-git-prompt
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_FETCH_REMOTE_STATUS=0
GIT_PROMPT_SHOW_UNTRACKED_FILES=no
GIT_PROMPT_START="\[\033[01;32m\]\w\[\033[00m\] ${debian_chroot:+($debian_chroot)}\[\033[01;34m\]\u@$HOSTNAME\[\033[00m\]"
GIT_PROMPT_END="\n\[\033[01;32m\]\$\[\033[00m\] "
source ~/.bash-git-prompt/gitprompt.sh
| true
|
2cf277351037ea896cf432143c8dd2e731de8d9b
|
Shell
|
Mykol71/posos
|
/bin/install.dunno
|
UTF-8
| 3,608
| 3.40625
| 3
|
[] |
no_license
|
#!/usr/bin/bash
# verify root
ID=$(/usr/bin/id -u)
[ $ID -ne 0 ] && echo "You must be root to run $0." && exit 1
#get environment name
[ ! -f ../.envtype ] && echo -n "Env Name: " && read ENVTYPE && echo "$ENVTYPE" >../.envtype && cp -f ../.envtype ../../.
#switch from enforcing to permissive selinux
# Add tfsupport to sudoers, if not there.
[ "`ls /home | grep tfsupport`" == "" ] && useradd tfsupport
[ "`grep tfsupport /etc/sudoers`" == "" ] && echo "tfsupport ALL=(ALL) NOPASSWD: ALL">>/etc/sudoers
# add tfsupport usr and generate keys folder, if not there.
[ ! -d /home/tfsupport ] && useradd tfsupport
[ ! -d /home/tfsupport/keys ] && mkdir /home/tfsupport/keys && chown tfsupport:tfsupport /home/tfsupport/keys
# add pos system users, packages ostools, and copy ostools archive into place.
[ ! -d /home/daisy ] && useradd daisy
[ ! -d /home/rti ] && useradd rti
cp -f ../../ostools/ostools-1.15-latest.tar.gz /home/daisy
cp -f ../../ostools/ostools-1.15-latest.tar.gz /home/rti
# add POS media to POS users home folders
cp -f ../isos/*daisy* /home/daisy
cp -f ../isos/*rti* /home/rti
#switch from enforcing to permissive selinux
sed -i 's/enforcing/permissive/' /etc/selinux/config
setenforce 0
#make sure password auth is on
#sed -i 's/PasswordAuthentication\ no/PasswordAuthentication\ yes/' /etc/ssh/sshd_config
#install required base packages
yum clean all
yum -y install net-tools yum-langpacks gtk3 ksh wget firewalld tigervnc-server-minimal mailx nmap time bridge-utils docker device-mapper-libs device-mapper-event-libs ntp lorax anaconda-tui unzip expect httpd mod_ssl libtool
# sync time
ntpdate pool.ntp.org
# set timezone
timedatectl set-timezone America/Chicago
#install epel software
#yum -y install epel-release
#yum -y install shellinabox
#ip port forwarding
[ "`grep net.ipv4.ip_forward /etc/sysctl.conf`" == "" ] && echo "net.ipv4.ip_forward = 1">>/etc/sysctl.conf && sysctl -p /etc/sysctl.conf && systemctl restart network.service
#disable consistant network naming
rpm -qa | grep -e '^systemd-[0-9]\+\|^udev-[0-9]\+'
sed -i '/^GRUB\_CMDLINE\_LINUX/s/\"$/\ net\.ifnames\=0\"/' /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
#copy in port forwrd config for docker
cp -f ./99-docker.conf /usr/lib/sysctl.d/99-docker.conf
systemctl restart docker 2>/dev/null
systemctl enable docker
# add custom cloud backup server scripts to /usr/local/bin
find . -name "*monthname.sh" -exec cp -f {} /usr/local/bin/. \;
find . -name "*recon.sh" -exec cp -f {} /usr/local/bin/. \;
# Add Admin Menu to current user and tfsupports .bash_profile to be exec on login
[ "`grep posos /home/${SUDO_USER}/.bash_profile`" == "" ] && echo "cd posos" >> /home/${SUDO_USER}/.bash_profile && echo "sudo ./MENU" >>/home/${SUDO_USER}/.bash_profile
[ "`grep posos /home/tfsupport/.bash_profile`" == "" ] && echo "cd posos" >> /home/tfsupport/.bash_profile && echo "sudo ./MENU" >>/home/tfsupport/.bash_profile
# make backups folder if its not there.
[ ! -d /backups ] && mkdir /backups
# configure and start shellinabox (browser based ssh)
#echo "USER=shellinabox">/etc/sysconfig/shellinaboxd
#echo "GROUP=shellinabox">>/etc/sysconfig/shellinaboxd
#echo "CERTDIR=/var/lib/shellinabox">>/etc/sysconfig/shellinaboxd
#echo "PORT=443">>/etc/sysconfig/shellinaboxd
#echo "OPTS="-s /:SSH --user-css Reverse:-black-on-white.css,Normal:+green-on-black.css"">>/etc/sysconfig/shellinaboxd
#systemctl start shellinaboxd
#systemctl enable shellinaboxd
# lastly, update everything
yum -y update
echo "Done. If this was the first install on this machine, please reboot."
exit 0
| true
|
cccc7954c675f96702bec2afdc113472d91d1a0d
|
Shell
|
milvus-io/milvus
|
/tests/python_client/chaos/scripts/install_milvus.sh
|
UTF-8
| 592
| 2.796875
| 3
|
[
"Apache-2.0"
] |
permissive
|
release=${1:-"milvs-chaos"}
milvus_mode=${2:-"cluster"}
ns=${3:-"chaos-testing"}
bash uninstall_milvus.sh ${release} ${ns}|| true
helm repo add milvus https://milvus-io.github.io/milvus-helm/
helm repo update
if [[ ${milvus_mode} == "cluster" ]];
then
helm install --wait --timeout 360s ${release} milvus/milvus -f ../cluster-values.yaml --set metrics.serviceMonitor.enabled=true -n=${ns}
fi
if [[ ${milvus_mode} == "standalone" ]];
then
helm install --wait --timeout 360s ${release} milvus/milvus -f ../standalone-values.yaml --set metrics.serviceMonitor.enabled=true -n=${ns}
fi
| true
|
01150b6f1c20121ee0879c347cb4131e45df0d55
|
Shell
|
eilx2/algoj
|
/docker/run_sol.sh
|
UTF-8
| 205
| 3
| 3
|
[] |
no_license
|
#!/bin/bash
IFS=
input=`cat`
echo "$1" > sol.py
echo "$input" > input.txt
timeout -s SIGKILL $2 python3 sol.py < input.txt > out.txt
echo $?
if [ $? -eq 0 ]
then
cat out.txt
else
exit $?
fi
exit
| true
|
63885b2fb48107109aaf56a71dbf02b613964e5b
|
Shell
|
dywisor/fischstaebchen
|
/shellfunc/src/base/03-die.sh
|
UTF-8
| 886
| 3.515625
| 4
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
## Copyright (c) 2014-2015 André Erdmann <dywi@mailerd.de>
##
## Distributed under the terms of the MIT license.
## (See LICENSE.MIT or http://opensource.org/licenses/MIT)
##
<% if ABDUCT_DIE= %>
<% define _DIEFUNC __die %>
<% else %>
<% define _DIEFUNC die %>
<% endif %>
## @noreturn die ( message=, exit_code:=@@EX_DIE@@ )
##
@@_DIEFUNC@@() {
<%%locals die_word=died %>
if [ -n "${1-}" ]; then
die_word="${die_word}:"
else
die_word="${die_word}."
fi
if [ "${HAVE_MESSAGE_FUNCTIONS:-X}" = "y" ]; then
eerror "${1-}" "${die_word}"
else
printf "%s\n" "${die_word}${1-}" 1>&2
fi
if [ -n "${DIE_DBGFILE-}" ]; then
printf "%s\n" "${1:-%unknown%}" >> "${DIE_DBGFILE}" || @@NOP@@
fi
exit ${2:-@@EX_DIE@@}
}
<% if ABDUCT_DIE= %>
die() {
${DIE_FUNCTION:-@@_DIEFUNC@@} "${@}"
}
<% endif %>
die_usage() { die "${1-}" "${2:-@@EX_USAGE@@}"; }
| true
|
5643d8ebb5942e809ad2bb6ba5c5716ecf043664
|
Shell
|
GNULinuxACMTeam/installing_software_on_linux
|
/installation_odysseaskr.sh
|
UTF-8
| 3,386
| 2.953125
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Script to setup necessary programs and tools
# Edited to work on LXDE (tested on Lubuntu 14.04.1 LTS x86_64)
echo "Start"
# Add needed repositories
add-apt-repository -y ppa:ubuntu-mozilla-daily/firefox-aurora
add-apt-repository -y ppa:webupd8team/sublime-text-2
apt-get -y update
# Prepare the Application folder
mkdir ~/Applications
# Get gdebi to install .deb
apt-get -y install gdebi
#=======================================================================
# Text Editors
apt-get -y install vim
apt-get -y install sublime-text
# Set Sublime Text as default text editor
sed -i 's/sublime/gedit/' /usr/share/applications/defaults.list
sed -i 's/sublime/leafpad/' /usr/share/applications/defaults.list
#=======================================================================
# Multimedia
apt-get -y install vlc
apt-get -y install gimp
#=======================================================================
# Browsers
apt-get -y install chromium-browser
apt-get -y install firefox
#=======================================================================
# Compilers
apt-get -y install ruby
apt-get -y install openjdk-7-jdk
apt-get -y install g++
#=======================================================================
# Other programming tools
apt-get -y install git
# pip
wget "https://bootstrap.pypa.io/get-pip.py"
python get-pip.py
pip install -U pip
rm -rf get-pip.py
#=======================================================================
# IDEs
apt-get -y install codeblocks
apt-get -y install octave
#PyCharm
wget http://download.jetbrains.com/python/pycharm-community-4.0.2.tar.gz -O pycharm.tar.gz
tar -xzf pycharm.tar.gz
cp -rf pycharm-community-4.0.2 ~/Applications
rm -rf pycharm-community-4.0.2
rm -rf pycharm.tar.gz
ln -s ~/Applications/pycharm-community-*/bin/pycharm.sh /usr/bin/pycharm
#Brackets
wget https://github.com/adobe/brackets/releases/download/release-1.0%2Beb4/Brackets.1.0.Extract.64-bit.deb -O brackets.deb
gdebi brackets.deb
rm -rf brackets.deb
# IntelliJ
wget http://download.jetbrains.com/idea/ideaIC-14.0.2.tar.gz -O intelliJ.tar.gz
tar -xzf intelliJ.tar.gz
cp -rf idea-IC-139.659.2 ~/Applications
rm -rf idea-IC-139.659.2
rm -rf intelliJ.tar.gz
ln -s ~/Applications/idea-IC-*/bin/idea.sh /usr/bin/intellij
#=======================================================================
# Mail client
apt-get -y install thunderbird
#=======================================================================
# File storage
apt-get -y install filezilla
# Dropbox
wget https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_1.6.2_amd64.deb -O dropbox.deb
gdebi dropbox.deb
rm -rf dropbox.deb
#=======================================================================
# Office
apt-get -y install libreoffice
#=======================================================================
# Security
apt-get -y install wireshark
apt-get -y install aircrack-ng
apt-get -y install hydra
apt-get -y install nmap
apt-get -y install iptables
cd ~/Applications
wget http://portswigger.net/burp/burpsuite_free_v1.6.jar
#=======================================================================
# LAMP
apt-get -y install lamp-server^
#=======================================================================
# Remove unwanted Lubuntu programs
apt-get -y remove leafpad
apt-get -y remove abiword
apt-get -y remove gnumeric
echo "Done"
| true
|
0b29c96736980842e3e6cbff736e6bd5747a43a6
|
Shell
|
westscz/.dotfiles
|
/system/alias
|
UTF-8
| 4,529
| 2.9375
| 3
|
[
"Unlicense",
"LicenseRef-scancode-public-domain"
] |
permissive
|
#! /bin/sh
#█▓▒░ COMMON
alias sudo='sudo ' # Enable aliases to be sudo’ed
alias '?=man'
alias h="history"
#█▓▒░ SYSTEM
alias afk="xflock4" # Lock the screen (when going AFK)
alias restart='sudo shutdown -r'
#█▓▒░ CD
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias home='cd ~'
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias dev="cd ~/dev"
alias config="cd $DOTFILES"
#█▓▒░ LS
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias l="ls -la" # List in long format, include dotfiles
alias ld="ls -ld */" # List in long format, only directories
alias ll='ls -alF'
alias la='ls -A'
#█▓▒░ LISTS
#List declared aliases, functions, paths
alias aliases="alias | sed 's/=.*//'" # List declared aliases
alias functions="declare -f | grep '^[a-z].* ()' | sed 's/{$//'" # List declared functions
alias paths='echo -e ${PATH//:/\\n}' # List declared paths
#█▓▒░ APT
alias apt-upd='echo "Updating cache..." && sudo apt-get update > /dev/null'
alias apt-upg='sudo apt-get upgrade'
alias upt='sudo apt update && sudo apt upgrade && sudo apt dist-upgrade && sudo apt autoremove && sudo apt clean'
#█▓▒░ PYTHON ENV
alias venv='virtualenv -p /usr/local/bin/python3 .venv'
alias vac='source .venv/bin/activate'
#█▓▒░ DOTFILES
alias df_update="source ~/.bashrc"
alias crontab_update="crontab $DOTFILES_DIR/system/crontab"
alias df_config="$EDITOR $DOTFILES &>/dev/null & disown"
alias df_dir="o $DOTFILES"
#█▓▒░ NETWORK
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias ipl="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'"
alias speedtest="wget -O /dev/null http://speed.transip.nl/100mb.bin"
alias rpi="sshpass -p 'raspberrypi' ssh pi@192.168.1.102" #connect to rPI
alias 8888="ping 8.8.8.8" # ping google-dns server to check if you have a connection outwards
#█▓▒░ APP PARTIALS
alias webpng='find ./ -name "*.webp" -exec dwebp {} -o {}.png \;' #webp to png converter
alias youtube-mp3='youtube-dl --extract-audio --audio-format mp3' #download youtube as mp3
alias ccat="pygmentize -g"
alias ffind="fzf --preview='pygmentize -g {}'"
alias code="$EDITOR"
alias wifi='nmtui'
alias sl='ranger'
#█▓▒░ PRESENTATION
alias rdp='remmina'
alias camera_test='cheese'
alias timer='termdown'
alias przerwa='timer 5m'
alias pomodoro='timer 25m'
#█▓▒░ MISCELLANEOUS
alias hdmi="xrandr --output HDMI-1 --auto --right-of LVDS-1" #connect via HDMI
alias vga="xrandr --output VGA-1 --auto --right-of LVDS-1" #connect via VGA
alias notebook="cd ~/Notebook && $EDITOR . &>/dev/null & disown"
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # Add an "alert" alias for long running commands. Use like so: sleep 10; alert
# searches the history for a command
# it is handy in combination with !<history-number> ;)
alias hg="history | grep" #<search term>
# executes the last command as sudo
alias please='sudo $(fc -ln -1)'
# shows a nice in-terminal forecast for Wroclaw
alias weather="curl wttr.in/wroclaw"
alias weather-mini="curl -s wttr.in | head -n7"
# replaces all spaces in the filenames of the cwd with underscores
alias underscore="rename 'y/ /_/' *" # replaces all spaces in filenames in the cwd with underscores
# commit with a random message
# don't use this at work ;)
alias rancommit="git commit -m \"\$(curl -s http://whatthecommit.com/index.txt)\"" # commits with a random commit message
alias code="$EDITOR"
alias restart='sudo shutdown -r'
#█▓▒░ Apps shortcuts
alias wifi='nmtui'
alias audio='pavucontrol &'
alias sl='ranger'
#█▓▒░ Presentation
alias rdp='remmina'
alias timer='termdown'
alias przerwa='timer 5m'
alias zadanie='timer 15m'
alias obiad='timer 13:00'
# ---------------------------------
# Reference:
# ---------------------------------
# http://cb.vu/unixtoolbox.xhtml
# ---------------------------------
# Don't make edits below this
[ -f ".alias.local" ] && source ".alias.local"
| true
|
c02c1845288673dbad5555edb622e764e2824c85
|
Shell
|
evs-broadcast/nmos-joint-ri
|
/vagrant/provision_node.sh
|
UTF-8
| 2,823
| 2.875
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
# Copyright 2017 British Broadcasting Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
COMMON_BRANCH=$1
MDNS_BRIDGE_BRANCH=$2
REVERSE_PROXY_BRANCH=$3
NODE_BRANCH=$4
CONNECTION_BRANCH=$7
export DEBIAN_FRONTEND=noninteractive
APT_TOOL='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
# All service are run as an ipstudio user
useradd ipstudio
mkdir /home/ipstudio
chown -R ipstudio /home/ipstudio
sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
apt-get update
apt-get install python-pip python-mock devscripts debhelper equivs python3-setuptools python-stdeb python3 python3-pip tox -y
pip install setuptools
apt-get install libavahi-compat-libdnssd1 -y
cd /home/vagrant
git clone https://github.com/bbc/nmos-common.git
git clone https://github.com/bbc/nmos-reverse-proxy.git
git clone https://github.com/bbc/nmos-node.git
git clone https://github.com/bbc/nmos-mdns-bridge.git
git clone https://github.com/bbc/nmos-device-connection-management-ri.git
cd /home/vagrant/nmos-common
git checkout $COMMON_BRANCH
pip install -e . --process-dependency-links
install -m 666 /dev/null /var/log/nmos.log
cd /home/vagrant/nmos-reverse-proxy
git checkout $REVERSE_PROXY_BRANCH
mk-build-deps --install debian/control --tool "$APT_TOOL"
make deb
dpkg -i ../ips-reverseproxy-common_*_all.deb
sudo apt-get -f -y install
cd /home/vagrant/nmos-mdns-bridge
git checkout $MDNS_BRIDGE_BRANCH
make dsc
mk-build-deps --install deb_dist/mdnsbridge_*.dsc --tool "$APT_TOOL"
make deb
dpkg -i dist/python-mdnsbridge_*_all.deb
sudo apt-get -f -y install
cd /home/vagrant/nmos-node
git checkout $NODE_BRANCH
make dsc
mk-build-deps --install deb_dist/nodefacade_*.dsc --tool "$APT_TOOL"
make deb
dpkg -i dist/python-nodefacade_*_all.deb
sudo apt-get -f -y install
cd /home/vagrant/nmos-device-connection-management-ri
git checkout $CONNECTION_BRANCH
mk-build-deps --install debian/control --tool "$APT_TOOL"
make deb
dpkg -i ../python-connectionmanagement_*_all.deb
sudo apt-get -f -y install
cp -r bin/connectionmanagement /usr/bin
cp -r share/ipp-connectionmanagement /usr/share
cp -r var/www/connectionManagementDriver /var/www
cp -r var/www/connectionManagementUI /var/www
chmod +x /usr/bin/connectionmanagement
service apache2 restart
a2ensite nmos-ui.conf
service apache2 reload
| true
|
d7edbe35db5e4f414e86bdbe612900b7ab243bf4
|
Shell
|
salizzar/dotfiles
|
/.bash_profile
|
UTF-8
| 1,954
| 2.734375
| 3
|
[] |
no_license
|
# personal
source ~/.dotfiles/setup
#
# homebrew
#
[[ -s "/opt/homebrew/bin/brew shellenveval" ]] && eval "$(/opt/homebrew/bin/brew shellenv)"
[[ -s "/usr/local/bin/brew shellenv" ]] && eval "$(/usr/local/bin/brew shellenv)" # legacy setup
#
# gvm
#
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
#
# rvm
#
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
#
# nvm
#
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#
# pyenv
#
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
#
# rustup (rust version manager)
#
[[ -s "$HOME/.rsvm/current/cargo/env" ]] && source "$HOME/.rsvm/current/cargo/env"
#
# cargo
#
[[ -s "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
#
# sdkman
#
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
# hacks
export ICLOUD_PATH='~/Library/Mobile\ Documents/com~apple~CloudDocs/'
export ISE_LIBRARY="/opt/homebrew/Cellar/eiffelstudio/19.05.10.3187/" # Eiffel library path
export ISE_LIBRARY_PROJECTS="${HOME}/.eiffel/" # Eiffel projects
#
# gcloud
#
# The next line updates PATH for the Google Cloud SDK.
if [ -f '~/.gcloud/google-cloud-cli-421.0.0-darwin-arm/google-cloud-sdk/path.bash.inc' ]; then . '~/.gcloud/google-cloud-cli-421.0.0-darwin-arm/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '~/.gcloud/google-cloud-cli-421.0.0-darwin-arm/google-cloud-sdk/completion.bash.inc' ]; then . '~/.gcloud/google-cloud-cli-421.0.0-darwin-arm/google-cloud-sdk/completion.bash.inc'; fi
#
# Android builds
#
export ANDROID_HOME="~/Library/Android/sdk"
export ANDROID_SDK_ROOT=${ANDROID_HOME}
| true
|
d35a57233da3772a467607e188ab72cf8fbda3a4
|
Shell
|
mshicom/pycppad
|
/boost_py/simple.sh
|
UTF-8
| 1,881
| 3.5
| 4
|
[
"BSD-3-Clause"
] |
permissive
|
# /bin/bash
set -e
# Modified version of
# http://wiki.python.org/moin/boost.python/SimpleExample
# ----------------------------------------------------------------------
python_version=`ls /usr/include | grep python | sed -e 's/python//'`
system=`uname | sed -e 's/\(......\).*/\1/'`
if [ "$system" == "CYGWIN" ]
then
extra_compile="-Wl,--enable-auto-image-base"
library_extension=".dll"
else
extra_compile=""
library_extension=".so"
fi
# ----------------------------------------------------------------------
echo "cat << EOF > simple.cpp"
cat << EOF > simple.cpp
# include <string>
namespace { // Avoid cluttering the global namespace.
int square(int number) { return number * number; }
}
# include <boost/python.hpp>
BOOST_PYTHON_MODULE(simple)
{
// Add regular function to the module.
boost::python::def("square", square);
}
EOF
#
echo "gcc -I/usr/include/python$python_version -g -c simple.cpp"
gcc -I/usr/include/python$python_version -g -c simple.cpp
#
echo "g++ -shared $extra_compile \\"
echo " -g \\"
echo " simple.o \\"
echo " -L/usr/lib -L/usr/lib/python$python_version/config \\"
echo " -lboost_python-mt -lpython$python_version \\"
echo " -o simple$library_extension"
g++ -shared $extra_compile \
-g \
simple.o \
-L/usr/lib -L/usr/lib/python$python_version/config \
-lboost_python-mt -lpython$python_version \
-o simple$library_extension
#
echo "cat << EOF > simple.py"
cat << EOF > simple.py
import simple
number = 11
ok = number * number == simple.square(number)
#
# use sys to get exit function
import sys
if ok :
# ok case so return non error flag
sys.exit(0)
else :
# error case so return with error flag set
sys.exit(1)
EOF
#
if python simple.py
then
flag=0
echo "simple.sh: OK"
for ext in .cpp .o $library_extension .py
do
echo "rm simple$ext"
rm simple$ext
done
else
echo "simple.sh: Error"
flag=1
fi
exit $flag
| true
|
e2cf8426651ba2007ac516952fd1fbd319e0bbde
|
Shell
|
ECS-GDP2-1516/ml-data
|
/find-and-format-abs.sh
|
UTF-8
| 974
| 3.84375
| 4
|
[] |
no_license
|
#!/bin/bash
NUMBEROFARGS=2;
if [ $# -lt $NUMBEROFARGS ]
then
>&2 echo -e "Usage is:\n find-and-format.sh (line file) (sample count)"
exit 1;
else
LINEFILE=$1; shift;
SAMPLECOUNT=$1; shift;
fi
CLASSES=`cat "$LINEFILE" | cut -f 3 | sort | uniq | paste -sd "," - `
echo -e "% Data generated on `date`
% by find-and-format
% produced by Daniel Playle (dan@dan.re)
%
@RELATION gdp
"
for i in $(seq 1 $SAMPLECOUNT);
do
echo -e "@ATTRIBUTE abs$i NUMERIC"
done
echo -e "@ATTRIBUTE class {$CLASSES}
@DATA"
if [ $((SAMPLECOUNT%2)) -eq 0 ]
then # even
BEFORE=$((SAMPLECOUNT/2));
AFTER=$((BEFORE-1));
else # odd
BEFORE=$(((SAMPLECOUNT-1)/2));
AFTER=$BEFORE;
fi
cat "$LINEFILE" | while read line
do
FILE=`echo "$line" | cut -f 1`
TIME=`echo "$line" | cut -f 2`
CLASS=`echo "$line" | cut -f 3`
grep -B "$BEFORE" -A "$AFTER" "^$TIME" "$FILE" | head -n "$SAMPLECOUNT" | cut -f 2- -d',' | tr ',' ' ' | awk '{print sqrt($1*$1 + $2*$2 + $3*$3)}' | tr '\n' ','
echo "$CLASS";
done
| true
|
1ea853d1eb212080f11e836b208754f74a028774
|
Shell
|
xianlimei/BugRepoter_0x727
|
/docker/run_docker.sh
|
UTF-8
| 921
| 3.109375
| 3
|
[] |
no_license
|
#!/bin/bash
sed -i "s|127.0.0.1|192.168.5.103|" ../config/system.php
docker_compose="/usr/local/bin/docker-compose"
if grep -Eqii "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
yum install wget yum-utils device-mapper-persistent-data lvm2 -y
if [ ! -f "$docker_compose" ]; then
curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
fi
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce-17.12.0.ce -y
systemctl start docker
docker-compose up --build -d && rm -rf ../html
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
apt-get install docker && docker-compose up --build -d && rm -rf ../html
fi
| true
|
f8401dffe68200b46c4a7aee1f9a9042dcaa9b1a
|
Shell
|
norambah1/habitat
|
/components/studio/build-docker-image.sh
|
UTF-8
| 3,300
| 4.125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
#
# # Usage
#
# ```sh
# $ build-docker-image.sh [ARTIFACT_OR_PKG_IDENT ...]
# ```
#
# # Synopsis
#
# This program will build a `habitat/studio` Docker image using one or more
# local Habitat artifacts and/or package identifiers as arguments. Two
# packages must be installed or the program will terminate early:
#
# * `core/hab`
# * `core/hab-studio`
#
# A default usage installs both of the above packages from Builder:
#
# ```sh
# ./build-docker-image.sh
# ```
#
# However, offline/local Habitat artifact files can be used instead, for
# example:
#
# ```sh
# ./build-docker-image.sh core/hab core/hab-studio
# ./build-docker-image.sh ./results/core-hab-{static,studio}-*.hart
# ```
# Fail if there are any unset variables and whenever a command returns a
# non-zero exit code.
set -eu
# If the variable `$DEBUG` is set, then print the shell commands as we execute.
if [ -n "${DEBUG:-}" ]; then
set -x
export DEBUG
fi
info() {
case "${TERM:-}" in
*term | xterm-* | rxvt | screen | screen-*)
printf -- " \033[1;36m$(basename $0): \033[1;37m${1:-}\033[0m\n"
;;
*)
printf -- " $(basename $0): ${1:-}\n"
;;
esac
return 0
}
if ! command -v hab >/dev/null; then
>&2 echo " $(basename $0): WARN 'hab' command must be present on PATH, aborting"
exit 9
fi
IMAGE_NAME=habitat-docker-registry.bintray.io/studio
start_dir="$(pwd)"
tmp_root="$(mktemp -d -t "$(basename $0)-XXXX")"
trap 'rm -rf $tmp_root; exit $?' INT TERM EXIT
export FS_ROOT="$tmp_root/rootfs"
# Ensure that no existing `HAB_BINLINK_DIR` environment variable is present,
# like it would if executed in a Studio instance.
unset HAB_BINLINK_DIR
info "Installing and extracting initial Habitat packages"
default_pkgs="core/hab core/hab-studio"
hab pkg install ${*:-$default_pkgs}
if ! hab pkg path core/hab >/dev/null 2>&1; then
>&2 echo " $(basename $0): WARN core/hab must be installed, aborting"
exit 1
fi
if ! hab pkg path core/hab-studio >/dev/null 2>&1; then
>&2 echo " $(basename $0): WARN core/hab-studio must be installed, aborting"
exit 2
fi
info "Putting \`hab' in container PATH"
hab pkg binlink core/hab hab
info "Purging container hab cache"
rm -rf $FS_ROOT/hab/cache
ident="$(hab pkg path core/hab-studio | rev | cut -d '/' -f 1-4 | rev)"
short_version=$(echo $ident | awk -F/ '{print $3}')
version=$(echo $ident | awk -F/ '{print $3 "-" $4}')
cat <<EOF > $tmp_root/Dockerfile
FROM busybox:latest
MAINTAINER The Habitat Maintainers <humans@habitat.sh>
ADD rootfs /
WORKDIR /src
RUN env NO_MOUNT=true HAB_BLDR_CHANNEL=$HAB_BLDR_CHANNEL hab studio new \
&& rm -rf /hab/studios/src/hab/cache/artifacts
ENTRYPOINT ["/bin/hab", "studio"]
EOF
cd $tmp_root
info "Building Docker image \`${IMAGE_NAME}:$version'"
docker build --no-cache -t ${IMAGE_NAME}:$version .
info "Tagging latest image to ${IMAGE_NAME}:$version"
docker tag ${IMAGE_NAME}:$version ${IMAGE_NAME}:latest
info "Tagging latest image to ${IMAGE_NAME}:$short_version"
docker tag ${IMAGE_NAME}:$version ${IMAGE_NAME}:$short_version
cat <<-EOF > "$start_dir/results/last_image.env"
docker_image=$IMAGE_NAME
docker_image_version=$version
docker_image_short_version=$short_version
EOF
info
info "Docker Image: ${IMAGE_NAME}:$version"
info "Build Report: $start_dir/results/last_image.env"
info
| true
|
a72d3e397f2ff750714ea33a6ca89c9a8f024413
|
Shell
|
ethlu/ColdADC
|
/scripts_cjslin/stability_study_test.sh
|
UTF-8
| 12,215
| 2.8125
| 3
|
[] |
no_license
|
#!/bin/bash
# WARNING:
# THIS SCRIPT IS NOW CONFIGURED FOR READING ONE CHANNEL FULL CHAIN
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.34
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> Frozen SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0x13
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# SE -> Free SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# Full chain configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x62
./writeCtrlReg.py 1 0
./writeCtrlReg.py 4 0x33
./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_FullChain-ADC1_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_FullChain-ADC1_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.345
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> Frozen SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0x13
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# SE -> Free SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# Full chain configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x62
./writeCtrlReg.py 1 0
./writeCtrlReg.py 4 0x33
./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_ADC0_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_FullChain-ADC0_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_FullChain-ADC0_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.35
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> Frozen SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0x13
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# SE -> Free SHA configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x63
./writeCtrlReg.py 1 0
./writeCtrlReg.py 4 0x3b
./writeCtrlReg.py 9 0b1000
# Full chain configuration
# cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x62
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x33
#./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_SE-SHA-ADC1_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_SE-SHA-ADC1_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.38
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> Frozen SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0x13
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# SE -> Free SHA configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x63
./writeCtrlReg.py 1 0
./writeCtrlReg.py 4 0x3b
./writeCtrlReg.py 9 0b1000
# Full chain configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x62
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x33
#./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_ADC0_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_SE-SHA-ADC0_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_SE-SHA-ADC0_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.35
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> Frozen SHA configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x63
./writeCtrlReg.py 1 0x13
./writeCtrlReg.py 4 0x3b
./writeCtrlReg.py 9 0b1000
# SE -> Free SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# Full chain configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x62
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x33
#./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_SE-FrozenSHA-ADC1_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_SE-FrozenSHA-ADC1_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.35
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> Frozen SHA configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x63
./writeCtrlReg.py 1 0x13
./writeCtrlReg.py 4 0x3b
./writeCtrlReg.py 9 0b1000
# SE -> Free SHA configuration
#cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x63
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x3b
#./writeCtrlReg.py 9 0b1000
# Full chain configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
#./writeCtrlReg.py 0 0x62
#./writeCtrlReg.py 1 0
#./writeCtrlReg.py 4 0x33
#./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_ADC0_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_SE-FrozenSHA-ADC0_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_SE-FrozenSHA-ADC0_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.35
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> SDC -> Frozen SHA configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x62
./writeCtrlReg.py 1 0x13
./writeCtrlReg.py 4 0x33
./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_SE-SDC-FrozenSHA-ADC1_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_SE-SDC-FrozenSHA-ADC1_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
for j in 1p20; do
#################################
cd /home/dayabay/ColdADC/scripts/
#./coldADC_resetADC.py
#./coldADC_resetFPGA.py
cd /home/dayabay/ColdADC/USB-RS232
./setAmplitudeVolt.py 1.35
#################################
#### Looping over VCMO index j
#cd /home/dayabay/ColdADC/scripts_cjslin/enableCMOS/
#./coldADC_enableCMOS_Ref_100mV_CMO${j}_LN2.sh
#./coldADC_enableCMOS_NomRef_CMO${j}.sh
# SE -> SDC -> Frozen SHA configuration
cd /home/dayabay/ColdADC/scripts_cjslin/
./writeCtrlReg.py 0 0x62
./writeCtrlReg.py 1 0x13
./writeCtrlReg.py 4 0x33
./writeCtrlReg.py 9 0b1000
for i in `seq 1 1`; do
echo "Iteration #${i}"
cd /home/dayabay/ColdADC/scripts_cjslin
#../USB-RS232/turnFuncOFF.py
#./writeCtrlReg.py 9 0
#sleep 1s
#echo "Iteration #${i} calibration"
#./manualCalib.py
#../USB-RS232/turnFuncON.py
#./manualCalib_plots.py
sleep 1s
echo "Iteration #${i} DNL/INL data"
./plotRamp_ADC0_2MSamples.py
python3 calc_linearity_sine.py
mv temp_2M.txt Sinusoid_147KHz_SE-SDC-FrozenSHA-ADC0_VREFPN-50mV_2M_v${i}.txt
mv temp.png Sinusoid_147KHz_SE-SDC-FrozenSHA-ADC0_VREFPN-50mV_v${i}.png
echo "Iteration #${i} completed"
done
done
| true
|
6bed1365a7172418afced19173e1aca6283f39f4
|
Shell
|
sofa-framework/ci
|
/scripts/configure.sh
|
UTF-8
| 20,326
| 3.71875
| 4
|
[] |
no_license
|
#!/bin/bash
set -o errexit # Exit on error
# Here we pick what gets to be compiled. The role of this script is to
# call cmake with the appropriate options. After this, the build
# directory should be ready to run 'make'.
## Significant environnement variables:
# - CI_JOB (e.g. ubuntu_gcc-4.8_options)
# - CI_OPTIONS if contains "options" then activate plugins
# - CI_CMAKE_OPTIONS (additional arguments to pass to cmake)
# - ARCHITECTURE = x86 | amd64 (for Windows builds)
# - BUILD_TYPE Debug|Release
# - CC and CXX
# - COMPILER # important for Visual Studio paths (vs-2012, vs-2013 or vs-2015)
## Checks
usage() {
echo "Usage: configure.sh <build-dir> <src-dir> <config> <build-type> <build-options>"
}
if [ "$#" -ge 4 ]; then
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "$SCRIPT_DIR"/utils.sh
BUILD_DIR="$(cd "$1" && pwd)"
SRC_DIR="$(cd "$2" && pwd)"
CONFIG="$3"
PLATFORM="$(get-platform-from-config "$CONFIG")"
COMPILER="$(get-compiler-from-config "$CONFIG")"
ARCHITECTURE="$(get-architecture-from-config "$CONFIG")"
BUILD_TYPE="$4"
BUILD_TYPE_CMAKE="$(get-build-type-cmake "$BUILD_TYPE")"
BUILD_OPTIONS="${*:5}"
if [ -z "$BUILD_OPTIONS" ]; then
BUILD_OPTIONS="$(get-build-options)" # use env vars (Jenkins)
fi
else
usage; exit 1
fi
if [[ ! -d "$SRC_DIR/applications/plugins" ]]; then
echo "Error: '$SRC_DIR' does not look like a SOFA source tree."
usage; exit 1
fi
echo "--------------- configure.sh vars ---------------"
echo "BUILD_DIR = $BUILD_DIR"
echo "SRC_DIR = $SRC_DIR"
echo "CONFIG = $CONFIG"
echo "PLATFORM = $PLATFORM"
echo "COMPILER = $COMPILER"
echo "ARCHITECTURE = $ARCHITECTURE"
echo "BUILD_TYPE = $BUILD_TYPE"
echo "BUILD_TYPE_CMAKE = $BUILD_TYPE_CMAKE"
echo "BUILD_OPTIONS = $BUILD_OPTIONS"
echo "-------------------------------------------------"
########
# Init #
########
# Get Windows dependency pack
if vm-is-windows && [ ! -d "$SRC_DIR/lib" ]; then
(
cd "$SRC_DIR"
echo "Copying dependency pack in the source tree."
curl -L "https://github.com/guparan/ci/raw/tmp_windeppack/setup/WinDepPack.zip" --output dependencies_tmp.zip
unzip dependencies_tmp.zip -d dependencies_tmp > /dev/null
cp -rf dependencies_tmp/*/* "$SRC_DIR"
rm -rf dependencies_tmp*
)
fi
cmake_options=""
add-cmake-option() {
cmake_options="$cmake_options $*"
}
#####################
# CMake env options #
#####################
add-cmake-option "-DCMAKE_BUILD_TYPE=$BUILD_TYPE_CMAKE"
# Compiler and cache
if vm-is-windows; then
# Compiler
# see comntools usage in call-cmake() for compiler selection on Windows
# Cache
if [ -e "$(command -v clcache)" ]; then
export CLCACHE_DIR="J:/clcache"
if [ -n "$EXECUTOR_LINK_WINDOWS_BUILD" ]; then
export CLCACHE_BASEDIR="$EXECUTOR_LINK_WINDOWS_BUILD"
else
export CLCACHE_BASEDIR="$BUILD_DIR"
fi
#export CLCACHE_HARDLINK=1 # this may cause cache corruption. see https://github.com/frerich/clcache/issues/282
export CLCACHE_OBJECT_CACHE_TIMEOUT_MS=3600000
clcache -M 17179869184 # Set cache size to 1024*1024*1024*16 = 16 GB
add-cmake-option "-DCMAKE_C_COMPILER=clcache"
add-cmake-option "-DCMAKE_CXX_COMPILER=clcache"
fi
else
# Compiler
case "$COMPILER" in
gcc*)
c_compiler="gcc"
cxx_compiler="g++"
;;
clang*)
c_compiler="clang"
cxx_compiler="clang++"
;;
*) # other
echo "Unknown compiler: $COMPILER"
echo "Try a lucky guess..."
c_compiler="$COMPILER"
cxx_compiler="${COMPILER}++"
;;
esac
add-cmake-option "-DCMAKE_C_COMPILER=$c_compiler"
add-cmake-option "-DCMAKE_CXX_COMPILER=$cxx_compiler"
# Cache
if [ -e "$(command -v ccache)" ]; then
if [ -n "$WORKSPACE" ]; then
# Useful for docker builds, set CCACHE_DIR at root of mounted volume
# WARNING: this is dirty, it relies on "docker run" mount parameter "-v" in Jenkins job configuration
workspace_root="$(echo "$WORKSPACE" | sed 's#/workspace/.*#/workspace#g')"
export CCACHE_DIR="$workspace_root/.ccache"
fi
export CCACHE_BASEDIR="$(cd "$BUILD_DIR" && pwd)"
export CCACHE_MAXSIZE="12G"
if [ -n "$VM_CCACHE_MAXSIZE" ]; then
export CCACHE_MAXSIZE="$VM_CCACHE_MAXSIZE"
fi
# export PATH="/usr/lib/ccache:$PATH" # /usr/lib/ccache contains symlinks for every compiler
# export CC="ccache $c_compiler -Qunused-arguments -Wno-deprecated-declarations"
# export CXX="ccache $cxx_compiler -Qunused-arguments -Wno-deprecated-declarations"
add-cmake-option "-DCMAKE_C_COMPILER_LAUNCHER=ccache"
add-cmake-option "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
echo "----- ccache enabled -----"
echo "CCACHE_DIR = $CCACHE_DIR"
echo "CCACHE_BASEDIR = $CCACHE_BASEDIR"
echo "CCACHE_MAXSIZE = $CCACHE_MAXSIZE"
echo "--------------------------"
fi
fi
# Set CMAKE_OSX_ARCHITECTURES
if vm-is-macos; then
if [[ "$(uname -m)" == "arm64" ]]; then
add-cmake-option "-DCMAKE_OSX_ARCHITECTURES=arm64"
else
add-cmake-option "-DCMAKE_OSX_ARCHITECTURES=x86_64"
fi
fi
# Handle custom lib dirs
if vm-is-windows; then
msvc_year="$(get-msvc-year $COMPILER)"
qt_compiler="msvc${msvc_year}"
else
qt_compiler="${COMPILER%-*}" # gcc-4.8 -> gcc
fi
if [[ "$ARCHITECTURE" != "x86" ]]; then
qt_compiler="${qt_compiler}_64"
fi
if [[ "$VM_HAS_REQUIRED_LIBS" != "true" ]]; then
echo "ERROR: VM_HAS_REQUIRED_LIBS is not true. Please make sure to have all required libs installed."
exit 1
fi
if [ -d "$VM_QT_PATH" ]; then
if [ -d "$VM_QT_PATH/${qt_compiler}" ]; then
add-cmake-option "-DCMAKE_PREFIX_PATH=$VM_QT_PATH/${qt_compiler}"
elif find $VM_QT_PATH/*/include/QtCore -type f -name "QtCore" > /dev/null; then
# Trying to find a qt compiler directory
qt_path_and_compiler="$(ls -d $VM_QT_PATH/*_64 | head -n 1)"
add-cmake-option "-DCMAKE_PREFIX_PATH=$qt_path_and_compiler"
else
add-cmake-option "-DCMAKE_PREFIX_PATH=$VM_QT_PATH"
fi
fi
if vm-is-windows; then # Finding libs on Windows
if [ -d "$VM_BOOST_PATH" ]; then
add-cmake-option "-DBOOST_ROOT=$VM_BOOST_PATH"
fi
if [ -d "$VM_EIGEN3_PATH" ]; then
export EIGEN3_ROOT_DIR="$VM_EIGEN3_PATH"
# add-cmake-option "-DEIGEN3_ROOT=$VM_EIGEN3_PATH"
fi
if [ -e "$VM_PYTHON_EXECUTABLE" ]; then
python2_path="$(dirname "$VM_PYTHON_EXECUTABLE")"
if [[ "$ARCHITECTURE" == "x86" ]]; then
python2_path="${python2_path}_x86"
fi
python2_exec="$python2_path/python.exe"
python2_lib="$(ls $python2_path/libs/python[0-9][0-9]*.lib | head -n 1)"
python2_include="$python2_path/include"
fi
if [ -e "$VM_PYTHON3_EXECUTABLE" ]; then
python3_path="$(dirname "$VM_PYTHON3_EXECUTABLE")"
if [[ "$ARCHITECTURE" == "x86" ]]; then
python3_path="${python3_path}_x86"
fi
python3_exec="$python3_path/python.exe"
python3_lib="$(ls $python3_path/libs/python[0-9][0-9]*.lib | head -n 1)"
python3_include="$python3_path/include"
fi
else
if [[ -e "$VM_PYTHON_EXECUTABLE" ]] && [[ -e "${VM_PYTHON_EXECUTABLE}-config" ]]; then
python2_name="$(basename $VM_PYTHON_EXECUTABLE)"
python2_config="${VM_PYTHON_EXECUTABLE}-config"
python2_exec="$VM_PYTHON_EXECUTABLE"
python2_lib=""
python2_include=""
for libdir in `$python2_config --ldflags | tr " " "\n" | grep -o "/.*"`; do
lib="$( find $libdir -maxdepth 1 -type l \( -name lib${python2_name}*.so -o -name lib${python2_name}*.dylib \) | head -n 1 )"
if [ -e "$lib" ]; then
python2_lib="$lib"
break
fi
done
for includedir in `$python2_config --includes | tr " " "\n" | grep -o "/.*"`; do
if [ -e "$includedir/Python.h" ]; then
python2_include="$includedir"
break
fi
done
fi
if [[ -e "$VM_PYTHON3_EXECUTABLE" ]] && [[ -e "${VM_PYTHON3_EXECUTABLE}-config" ]]; then
python3_name="$(basename $VM_PYTHON3_EXECUTABLE)"
python3_config="${VM_PYTHON3_EXECUTABLE}-config"
python3_exec="$VM_PYTHON3_EXECUTABLE"
python3_lib=""
python3_include=""
for libdir in `$python3_config --ldflags | tr " " "\n" | grep -o "/.*"`; do
lib="$( find $libdir -maxdepth 1 -type l \( -name lib${python3_name}*.so -o -name lib${python3_name}*.dylib \) | head -n 1 )"
if [ -e "$lib" ]; then
python3_lib="$lib"
break
fi
done
for includedir in `$python3_config --includes | tr " " "\n" | grep -o "/.*"`; do
if [ -e "$includedir/Python.h" ]; then
python3_include="$includedir"
break
fi
done
fi
fi
echo "---------------"
echo "python3_exec = $python3_exec"
echo "python3_lib = $python3_lib"
echo "python3_include = $python3_include"
echo "---------------"
if [ -e "$python2_exec" ] && [ -e "$python2_lib" ] && [ -e "$python2_include" ]; then
add-cmake-option "-DPYTHON_EXECUTABLE=$python2_exec"
add-cmake-option "-DPYTHON_LIBRARY=$python2_lib"
add-cmake-option "-DPYTHON_INCLUDE_DIR=$python2_include"
add-cmake-option "-DPython2_EXECUTABLE=$python2_exec"
add-cmake-option "-DPython2_LIBRARY=$python2_lib"
add-cmake-option "-DPython2_INCLUDE_DIR=$python2_include"
fi
if [ -e "$python3_exec" ] && [ -e "$python3_lib" ] && [ -e "$python3_include" ]; then
add-cmake-option "-DPython_EXECUTABLE=$python3_exec"
add-cmake-option "-DPython_LIBRARY=$python3_lib"
add-cmake-option "-DPython_INCLUDE_DIR=$python3_include"
add-cmake-option "-DPython3_EXECUTABLE=$python3_exec"
add-cmake-option "-DPython3_LIBRARY=$python3_lib"
add-cmake-option "-DPython3_INCLUDE_DIR=$python3_include"
fi
if [ -n "$VM_PYBIND11_CONFIG_EXECUTABLE" ]; then
pybind11_cmakedir="$($VM_PYBIND11_CONFIG_EXECUTABLE --cmakedir)"
if vm-is-windows; then
pybind11_cmakedir="$(cd "$pybind11_cmakedir" && pwd -W)"
fi
add-cmake-option "-Dpybind11_ROOT=$pybind11_cmakedir"
add-cmake-option "-Dpybind11_DIR=$pybind11_cmakedir"
fi
if [ -n "$VM_ASSIMP_PATH" ]; then
add-cmake-option "-DASSIMP_ROOT_DIR=$VM_ASSIMP_PATH"
fi
if [ -d "$VM_BULLET_PATH" ]; then
add-cmake-option "-DBULLET_ROOT=$VM_BULLET_PATH"
fi
if [ -d "$VM_CGAL_PATH" ]; then
if vm-is-centos; then
# Disable CGAL build test (see FindCGAL.cmake)
add-cmake-option "-DCGAL_TEST_RUNS=TRUE"
fi
add-cmake-option "-DCGAL_DIR=$VM_CGAL_PATH"
fi
if [ -n "$VM_OPENCASCADE_PATH" ]; then
add-cmake-option "-DSOFA_OPENCASCADE_ROOT=$VM_OPENCASCADE_PATH" # Needed by MeshSTEPLoader/FindOpenCascade.cmake
fi
if [ -n "$VM_CUDA_ARCH" ]; then
add-cmake-option "-DSOFACUDA_ARCH=$VM_CUDA_ARCH"
fi
if [ -n "$VM_CUDA_HOST_COMPILER" ]; then
add-cmake-option "-DCMAKE_CUDA_HOST_COMPILER=$VM_CUDA_HOST_COMPILER"
add-cmake-option "-DCUDA_HOST_COMPILER=$VM_CUDA_HOST_COMPILER"
fi
######################
# CMake SOFA options #
######################
# Options common to all configurations
add-cmake-option "-DAPPLICATION_GETDEPRECATEDCOMPONENTS=ON"
add-cmake-option "-DSOFA_BUILD_APP_BUNDLE=OFF" # MacOS
add-cmake-option "-DSOFA_WITH_DEPRECATED_COMPONENTS=ON"
add-cmake-option "-DSOFAGUIQT_ENABLE_QDOCBROWSER=OFF"
add-cmake-option "-DSOFAGUIQT_ENABLE_NODEGRAPH=OFF"
add-cmake-option "-DPLUGIN_EXTERNALBEHAVIORMODEL=OFF"
# Build regression tests?
if in-array "run-regression-tests" "$BUILD_OPTIONS"; then
add-cmake-option "-DAPPLICATION_REGRESSION_TEST=ON" "-DSOFA_FETCH_REGRESSION=ON"
else
# clean eventual cached value
add-cmake-option "-DAPPLICATION_REGRESSION_TEST=OFF" "-DSOFA_FETCH_REGRESSION=OFF"
fi
# Build with as few plugins/modules as possible (scope = minimal)
if in-array "build-scope-minimal" "$BUILD_OPTIONS"; then
echo "Configuring with as few plugins/modules as possible (scope = minimal)"
# Settings
add-cmake-option "-DAPPLICATION_SOFAPHYSICSAPI=OFF"
add-cmake-option "-DSOFA_BUILD_SCENECREATOR=OFF"
add-cmake-option "-DSOFA_BUILD_TESTS=OFF"
add-cmake-option "-DSOFA_FLOATING_POINT_TYPE=double"
# Plugins (sofa/applications/plugins)
add-cmake-option "-DPLUGIN_CIMGPLUGIN=OFF"
add-cmake-option "-DPLUGIN_SOFAMATRIX=OFF"
# Pluginized modules (sofa/modules)
add-cmake-option "-DPLUGIN_SOFADENSESOLVER=OFF"
add-cmake-option "-DPLUGIN_SOFAEXPORTER=OFF"
add-cmake-option "-DPLUGIN_SOFAHAPTICS=OFF"
add-cmake-option "-DPLUGIN_SOFAOPENGLVISUAL=OFF"
add-cmake-option "-DPLUGIN_SOFAPRECONDITIONER=OFF"
add-cmake-option "-DPLUGIN_SOFAVALIDATION=OFF"
# GUI
add-cmake-option "-DSOFAGUI_QGLVIEWER=OFF"
add-cmake-option "-DSOFAGUI_QT=OFF"
add-cmake-option "-DSOFAGUI_QTVIEWER=OFF"
add-cmake-option "-DSOFA_NO_OPENGL=ON"
add-cmake-option "-DSOFA_WITH_OPENGL=OFF"
# Build with the default plugins/modules (scope = standard)
elif in-array "build-scope-standard" "$BUILD_OPTIONS"; then
echo "Configuring with the default plugins/modules (scope = standard)"
add-cmake-option "-DAPPLICATION_SOFAPHYSICSAPI=ON"
add-cmake-option "-DSOFA_BUILD_TUTORIALS=ON"
add-cmake-option "-DSOFA_BUILD_TESTS=ON"
add-cmake-option "-DSOFA_DUMP_VISITOR_INFO=ON"
add-cmake-option "-DPLUGIN_SOFAPYTHON3=ON" "-DSOFA_FETCH_SOFAPYTHON3=ON"
# Build with as much plugins/modules as possible (scope = full)
elif in-array "build-scope-full" "$BUILD_OPTIONS"; then
echo "Configuring with as much plugins/modules as possible (scope = full)"
add-cmake-option "-DAPPLICATION_SOFAPHYSICSAPI=ON"
add-cmake-option "-DSOFA_BUILD_TUTORIALS=ON"
add-cmake-option "-DSOFA_BUILD_TESTS=ON"
add-cmake-option "-DSOFA_DUMP_VISITOR_INFO=ON"
add-cmake-option "-DPLUGIN_SOFAPYTHON3=ON" "-DSOFA_FETCH_SOFAPYTHON3=ON"
# HeadlessRecorder (Linux only)
if [[ "$(uname)" == "Linux" ]]; then
id="$(cat /etc/*-release | grep "ID")"
if [[ "$id" == *"centos"* ]]; then
add-cmake-option "-DSOFAGUI_HEADLESS_RECORDER=OFF"
else
add-cmake-option "-DSOFAGUI_HEADLESS_RECORDER=ON"
fi
fi
# NodeGraph
if [ -n "$VM_NODEEDITOR_PATH" ]; then
add-cmake-option "-DNodeEditor_ROOT=$VM_NODEEDITOR_PATH"
add-cmake-option "-DNodeEditor_DIR=$VM_NODEEDITOR_PATH/lib/cmake/NodeEditor"
add-cmake-option "-DSOFAGUIQT_ENABLE_NODEGRAPH=ON"
fi
# Plugins
add-cmake-option "-DPLUGIN_BEAMADAPTER=ON -DSOFA_FETCH_BEAMADAPTER=ON"
add-cmake-option "-DPLUGIN_STLIB=ON -DSOFA_FETCH_STLIB=ON"
add-cmake-option "-DPLUGIN_SOFTROBOTS=ON -DSOFA_FETCH_SOFTROBOTS=ON"
add-cmake-option "-DPLUGIN_SHAPEMATCHINGPLUGIN=ON -DSOFA_FETCH_SHAPEMATCHINGPLUGIN=ON"
if [[ "$VM_HAS_BULLET" == "true" ]]; then
add-cmake-option "-DPLUGIN_BULLETCOLLISIONDETECTION=ON"
else
add-cmake-option "-DPLUGIN_BULLETCOLLISIONDETECTION=OFF"
fi
if [[ "$VM_HAS_CGAL" == "true" ]]; then
add-cmake-option "-DPLUGIN_CGALPLUGIN=OFF -DSOFA_FETCH_CGALPLUGIN=OFF"
else
add-cmake-option "-DPLUGIN_CGALPLUGIN=OFF -DSOFA_FETCH_CGALPLUGIN=OFF"
fi
if [[ "$VM_HAS_ASSIMP" == "true" ]]; then
# INFO: ColladaSceneLoader contains assimp for Windows
add-cmake-option "-DPLUGIN_COLLADASCENELOADER=ON"
add-cmake-option "-DPLUGIN_SOFAASSIMP=ON"
else
add-cmake-option "-DPLUGIN_COLLADASCENELOADER=OFF"
add-cmake-option "-DPLUGIN_SOFAASSIMP=OFF"
fi
add-cmake-option "-DPLUGIN_DIFFUSIONSOLVER=ON"
add-cmake-option "-DPLUGIN_GEOMAGIC=ON"
add-cmake-option "-DPLUGIN_IMAGE=ON"
add-cmake-option "-DPLUGIN_INVERTIBLEFVM=ON -DSOFA_FETCH_INVERTIBLEFVM=ON"
add-cmake-option "-DPLUGIN_MANIFOLDTOPOLOGIES=ON -DSOFA_FETCH_MANIFOLDTOPOLOGIES=ON"
add-cmake-option "-DPLUGIN_MANUALMAPPING=ON"
if [[ "$VM_HAS_OPENCASCADE" == "true" ]]; then
add-cmake-option "-DPLUGIN_MESHSTEPLOADER=ON"
else
add-cmake-option "-DPLUGIN_MESHSTEPLOADER=OFF"
fi
add-cmake-option "-DPLUGIN_MULTITHREADING=ON"
add-cmake-option "-DPLUGIN_PLUGINEXAMPLE=ON -DSOFA_FETCH_PLUGINEXAMPLE=ON"
add-cmake-option "-DPLUGIN_REGISTRATION=ON -DSOFA_FETCH_REGISTRATION=ON"
add-cmake-option "-DPLUGIN_SENSABLEEMULATION=ON"
add-cmake-option "-DPLUGIN_SOFACARVING=ON"
if [[ "$VM_HAS_CUDA" == "true" ]]; then
add-cmake-option "-DPLUGIN_SOFACUDA=ON -DSOFA_FETCH_SOFACUDA=ON"
else
add-cmake-option "-DPLUGIN_SOFACUDA=OFF -DSOFA_FETCH_SOFACUDA=OFF"
fi
add-cmake-option "-DPLUGIN_SOFADISTANCEGRID=ON"
add-cmake-option "-DPLUGIN_SOFAEULERIANFLUID=ON"
add-cmake-option "-DPLUGIN_SOFAGLFW=ON" "-DPLUGIN_SOFAIMGUI=OFF" "-DAPPLICATION_RUNSOFAGLFW=ON" "-DSOFA_FETCH_SOFAGLFW=ON"
add-cmake-option "-DPLUGIN_SOFAIMPLICITFIELD=ON"
add-cmake-option "-DPLUGIN_SOFASIMPLEGUI=ON" # Not sure if worth maintaining
add-cmake-option "-DPLUGIN_SOFASPHFLUID=ON"
add-cmake-option "-DPLUGIN_COLLISIONOBBCAPSULE=ON"
add-cmake-option "-DPLUGIN_THMPGSPATIALHASHING=OFF -DSOFA_FETCH_THMPGSPATIALHASHING=ON"
fi
# Generate binaries?
if in-array "build-release-package" "$BUILD_OPTIONS"; then
add-cmake-option "-DSOFA_BUILD_RELEASE_PACKAGE=ON"
if [[ "$BUILD_TYPE_CMAKE" == "Release" ]]; then
add-cmake-option "-DCMAKE_BUILD_TYPE=MinSizeRel"
fi
if [ -z "$QTIFWDIR" ]; then
qt_root="$VM_QT_PATH"
if [ ! -d "$qt_root" ] && [ -d "$QTDIR" ] && [ -d "$( dirname "$(dirname "$QTDIR")" )" ]; then
qt_root="$( dirname "$(dirname "$QTDIR")" )"
fi
for dir in "$qt_root/Tools/QtInstallerFramework/"*; do
if [ -d "$dir" ]; then
export QTIFWDIR="$dir" # take the first one
break
fi
done
fi
add-cmake-option \
"-DCPACK_BINARY_IFW=OFF" "-DCPACK_BINARY_NSIS=OFF" "-DCPACK_BINARY_ZIP=OFF" \
"-DCPACK_BINARY_BUNDLE=OFF" "-DCPACK_BINARY_DEB=OFF" "-DCPACK_BINARY_DRAGNDROP=OFF" \
"-DCPACK_BINARY_FREEBSD=OFF" "-DCPACK_BINARY_OSXX11=OFF" "-DCPACK_BINARY_PACKAGEMAKER=OFF" \
"-DCPACK_BINARY_PRODUCTBUILD=OFF" "-DCPACK_BINARY_RPM=OFF" "-DCPACK_BINARY_STGZ=OFF" \
"-DCPACK_BINARY_TBZ2=OFF" "-DCPACK_BINARY_TGZ=OFF" "-DCPACK_BINARY_TXZ=OFF" \
"-DCPACK_SOURCE_RPM=OFF" "-DCPACK_SOURCE_TBZ2=OFF" "-DCPACK_SOURCE_TGZ=OFF" \
"-DCPACK_SOURCE_TXZ=OFF" "-DCPACK_SOURCE_TZ=OFF"
if vm-is-windows; then
add-cmake-option "-DCPACK_GENERATOR=ZIP;NSIS"
add-cmake-option "-DCPACK_BINARY_ZIP=ON"
add-cmake-option "-DCPACK_BINARY_NSIS=ON"
elif [ -n "$QTIFWDIR" ]; then
add-cmake-option "-DCPACK_GENERATOR=ZIP;IFW"
add-cmake-option "-DCPACK_BINARY_ZIP=ON"
add-cmake-option "-DCPACK_BINARY_IFW=ON"
else
# ZIP only
add-cmake-option "-DCPACK_GENERATOR=ZIP"
add-cmake-option "-DCPACK_BINARY_ZIP=ON"
fi
fi
# Options passed via the environnement
if [ -n "$CI_CMAKE_OPTIONS" ]; then
add-cmake-option "$CI_CMAKE_OPTIONS"
fi
#############
# Configure #
#############
echo "Calling cmake with the following options:"
echo "$cmake_options" | tr -s " " "\n" | grep -v "MODULE_" | grep -v "PLUGIN_" | sort
echo "Enabled modules and plugins:"
echo "$cmake_options" | tr -s " " "\n" | grep "MODULE_" | grep "=ON" | sort
echo "$cmake_options" | tr -s " " "\n" | grep "PLUGIN_" | grep "=ON" | sort
echo "Disabled modules and plugins:"
echo "$cmake_options" | tr -s " " "\n" | grep "MODULE_" | grep "=OFF" | sort
echo "$cmake_options" | tr -s " " "\n" | grep "PLUGIN_" | grep "=OFF" | sort
if [ -n "$full_build" ]; then
relative_src="$(realpath --relative-to="$BUILD_DIR" "$SRC_DIR")"
call-cmake "$BUILD_DIR" -G"$(generator)" $cmake_options "$relative_src"
else
call-cmake "$BUILD_DIR" -G"$(generator)" $cmake_options .
fi
| true
|
851bde3b59b2d72a2901342d9b2361edbedc8446
|
Shell
|
aloop/dotfiles
|
/shell/profile.d/20-xdg-base-directories.dist.sh
|
UTF-8
| 565
| 3.203125
| 3
|
[
"MIT"
] |
permissive
|
# shellcheck shell=bash
# Setup defaults for XDG
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"${HOME}/.config"}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-"${HOME}/.cache"}"
export XDG_STATE_HOME="${XDG_STATE_HOME:-"${HOME}/.local/state"}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-"${HOME}/.run"}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-"${HOME}/.local/share"}"
# Add snapd dir to XDG_DATA_DIRS
if [ "${XDG_DATA_DIRS#*/snapd/desktop}" = "${XDG_DATA_DIRS}" ]; then
export XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share:/usr/share}:/var/lib/snapd/desktop"
fi
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.