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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40ca5b7a87b3c39c6b651cac561aa65431a85a6e
|
Shell
|
shock/lehman
|
/mkzip
|
UTF-8
| 147
| 2.53125
| 3
|
[] |
no_license
|
#!/bin/bash
datestamp=`date +%W%w%H%M`
zipfile="/mnt/D/Studio/Scoring/lehman/notations_$datestamp.zip"
echo "Creating $zipfile"
zip $zipfile *.pdf
| true
|
c7939d7d36781e8d2881f150954970d7a95e094d
|
Shell
|
ReDetection/github-clone
|
/github.sh
|
UTF-8
| 1,089
| 4.125
| 4
|
[] |
no_license
|
#!/bin/bash
USAGE=". github clone [-t {github|self|work|...}] {url} [path]"
GITHUBROOT="$HOME/src/" #todo: .config
TYPE="github" #todo: auto type
POSITIONAL=()
DEBUG="NO"
while [[ $# -gt 0 ]]
do
key="$1"
function terminate_script {
[[ "${BASH_SOURCE[0]}" == "${0}" ]] && exit 0 || return 0;
}
case $key in
-t|--type)
TYPE="$2"
shift # past argument
shift # past value
;;
--debug)
DEBUG="YES"
shift # past argument
;;
-h|--help)
echo "$USAGE"
terminate_script
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
SOURCE="$2"
PROJECT_NAME=$(basename -s .git "$SOURCE")
TARGET_NAME="${3:-$PROJECT_NAME}"
TARGET_PATH="$GITHUBROOT$TYPE/$TARGET_NAME"
if [ $DEBUG == "YES" ]; then
echo "SOURCE = ${SOURCE}"
echo "TARGET = ${TARGET_PATH}"
terminate_script
fi
if [ -d "$TARGET_PATH" ]; then
cd $TARGET_PATH
git fetch
else
git clone $SOURCE $TARGET_PATH
cd $TARGET_PATH
fi
| true
|
3f95bf373d397f84fb93667b736abf46657ff22f
|
Shell
|
mauriciojost/dotfiles
|
/modules/shell/aliases/keep.sh
|
UTF-8
| 241
| 2.71875
| 3
|
[
"MIT"
] |
permissive
|
function qkeep-find() {
local exp="$1"
$DOTFILES/modules/keep/keep-cli/keep find --query "$exp"
}
function qkeep-new() {
local title="$1"
local text="$2"
$DOTFILES/modules/keep/keep-cli/keep add --title "$title" --text "$text"
}
| true
|
1d526eefa6f543bf776e8942a8441c39ff57a8e4
|
Shell
|
jadilet/peer_manage
|
/destroy_peer.sh
|
UTF-8
| 1,100
| 4.0625
| 4
|
[] |
no_license
|
#!/bin/bash
show_help()
{
cat << ENDHELP
usage: destroy_peer [options]
Options:
--provider=<PROVIDER>
Choose provider. Supported providers are: libvirt, vmware_desktop, virtualbox, parallels and hyperv. Default: libvirt
--peer_dir=<PEER_DIR>
Set the peer path. Default: ~/peer
--help
Display help
ENDHELP
}
PROVIDER=libvirt
PEER_DIR=~/peer
while [ $# -ge 1 ]; do
case "$1" in
--provider=*)
PROVIDER="`echo ${1} | awk '{print substr($0,12)}'`" ;;
--peer_dir=*)
PEER_DIR="`echo ${1} | awk '{print substr($0,12)}'`" ;;
--help)
show_help
exit 0
;;
*)
echo "ERROR: Unknown argument: $1"
show_help
exit 1
;;
esac
shift
done
if [ -d "$PEER_DIR/$PROVIDER" ]; then
cd $PEER_DIR/$PROVIDER
# First do unregister peer from Bazaar
vagrant subutai deregister
vagrant destroy -f
if [ "$?" -ne 0 ]; then
rm -rf .vagrant
rm -rf $PEER_DIR/$PROVIDER
fi
else
echo "Peer not found in $PEER_DIR/$PROVIDER"
fi
| true
|
8751f4b198c8b2e33678393172f35ba8f7d5a475
|
Shell
|
KdeOs/main
|
/graphite/PKGBUILD
|
UTF-8
| 1,324
| 2.65625
| 3
|
[] |
no_license
|
pkgname=graphite
pkgver=1.2.3
pkgrel=1
arch=('x86_64')
url="http://graphite.sil.org/"
pkgdesc='reimplementation of the SIL Graphite text processing engine'
license=('custom_SIL Dual license')
depends=('gcc-libs')
makedepends=('cmake' 'freetype2' 'python2')
replaces=('libgraphite' 'pango-graphite')
options=('!libtool' '!emptydirs')
source=("http://downloads.sourceforge.net/project/silgraphite/graphite2/graphite2-${pkgver}.tgz"
'cmakepath.patch')
md5sums=('7042305e4208af4c2d5249d814ccce58'
'00353b67941dbc30b76a43253760769e')
build() {
cd "${srcdir}"
# patch taken from FC/Slackware
pushd graphite2-${pkgver}
patch -p1 -i ${srcdir}/cmakepath.patch
popd
mkdir build
sed -i "s:\/usr\/bin\/python:\/usr\/bin\/python2:" graphite2-${pkgver}/tests/{jsoncmp,fuzztest,defuzz,corrupt.py}
cd build
cmake -G "Unix Makefiles" ../graphite2-${pkgver} \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DGRAPHITE2_COMPARE_RENDERER=OFF
make
}
check() {
cd "${srcdir}"/build
sed -i "s:python:python2:g" tests/CTestTestfile.cmake
ctest
}
package() {
cd "${srcdir}"/build
make DESTDIR="$pkgdir/" install
mkdir -p "${pkgdir}"/usr/share/licenses/${pkgname}
install -m644 "${srcdir}"/graphite2-${pkgver}/COPYING "${pkgdir}"/usr/share/licenses/${pkgname}/
}
| true
|
6dd240725b6d747a6670cc0e1ec8a5acb6f1b791
|
Shell
|
justin-robinson/dotfiles
|
/zsh/oh_my_zsh_custom/git_prompt_info.zsh
|
UTF-8
| 2,514
| 4.03125
| 4
|
[] |
no_license
|
function git_prompt_info () {
set_git_vars
# only run this if we are in a git branch
if [[ -n ${GIT_BRANCH} ]]; then
# our output will be enclosed in a square bracket
local PROMPT_OUTPUT="${ZSH_THEME_GIT_PROMPT_PREFIX}${GIT_BRANCH}"
if [[ -n ${GIT_REMOTE_BRANCH} ]]; then
# number of commits ahead and behind remote
local GIT_AHEAD="`git rev-list --left-right --count ${GIT_BRANCH}...${GIT_REMOTE_BRANCH} | cut -f1`"
local GIT_BEHIND="`git rev-list --left-right --count ${GIT_BRANCH}...${GIT_REMOTE_BRANCH} | cut -f2`"
if [[ ${GIT_AHEAD} -gt 0 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_AHEAD}${GIT_AHEAD}"
fi
if [[ ${GIT_BEHIND} -gt 0 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_BEHIND}${GIT_BEHIND}"
fi
fi
# flag for determining if the git branch is in a clean state
local GIT_IS_CLEAN=1
# find number of files staged for commit
local GIT_ADDED=`git diff --cached --numstat | wc -l | xargs`
if [[ ${GIT_ADDED} -gt 0 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_ADDED}${GIT_ADDED}"
GIT_IS_CLEAN=0
fi
# number of modified files
local GIT_MODIFIED=`git diff --name-status --diff-filter=M | wc -l | xargs`
if [[ ${GIT_MODIFIED} -gt 0 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_MODIFIED}${GIT_MODIFIED}"
GIT_IS_CLEAN=0
fi
# number of files untracked by git
local GIT_UNTRACKED=`git ls-files --exclude-standard --others | wc -l | xargs`
if [[ ${GIT_UNTRACKED} -gt 0 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_UNTRACKED}${GIT_UNTRACKED}"
GIT_IS_CLEAN=0
fi
# number of files in a conflicting state
local GIT_CONFLICTS=`git diff --name-only --diff-filter=U | wc -l | xargs`
if [[ ${GIT_CONFLICTS} -gt 0 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_CONFLICTS}${GIT_CONFLICTS}"
GIT_IS_CLEAN=0
fi
# if there are no staged, modified, untracked, or conflicting files, we mark the repo as clean
if [[ ${GIT_IS_CLEAN} -eq 1 ]]; then
PROMPT_OUTPUT="${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_CLEAN}"
fi
echo "${PROMPT_OUTPUT}${ZSH_THEME_GIT_PROMPT_SUFFIX}"
fi
}
| true
|
8918e10d70ae47d76c2e32d8d4b28f47beef4929
|
Shell
|
jwmatthews/ec2_scripts
|
/scripts/install_spacewalk.sh
|
UTF-8
| 2,286
| 2.84375
| 3
|
[] |
no_license
|
#!/bin/sh
source ./functions.sh
export ANSWER_FILE="/tmp/spacewalk.answers"
# Set hostname of instance to EC2 public hostname
HOSTNAME=`curl -s http://169.254.169.254/latest/meta-data/public-hostname`
hostname ${HOSTNAME}
sed -i "s/^HOSTNAME.*/HOSTNAME=${HOSTNAME}/" /etc/sysconfig/network
# Install Spacewalk
rpm -q spacewalk-repo &> /dev/null
if [ $? -eq 1 ]; then
rpm -Uvh http://yum.spacewalkproject.org/1.8/RHEL/6/x86_64/spacewalk-repo-1.8-4.el6.noarch.rpm || {
echo "Unable to install Spacewalk RPM"
exit 1;
}
fi
# Install EPEL
rpm -q epel-release &> /dev/null
if [ $? -eq 1 ]; then
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm || {
echo "Unable to install EPEL"
exit 1;
}
fi
if [ ! -f /etc/yum/repos.d/jpackage-generic.repo ]; then
cat > /etc/yum.repos.d/jpackage-generic.repo << EOF
[jpackage-generic]
name=JPackage generic
#baseurl=http://mirrors.dotsrc.org/pub/jpackage/5.0/generic/free/
mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0
enabled=1
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
EOF
fi
if [ ! -f /etc/yum/repos.d/spacewalk-splice-dev.repo ]; then
cat > /etc/yum.repos.d/spacewalk-splice-dev.repo << EOF
[spacewalk-splice-dev]
name=spacewalk-splice-dev
baseurl=http://ec2-23-22-86-129.compute-1.amazonaws.com/pub/spacewalk-dev/
enabled=1
gpgcheck=0
EOF
fi
# needed to grab newer hibernate
if [ ! -f /etc/yum/repos.d/splice-candlepin.repo ]; then
cat > /etc/yum.repos.d/splice-candlepin.repo << EOF
[splice-candlepin]
name=Splice Candlepin
baseurl=http://ec2-23-22-86-129.compute-1.amazonaws.com/pub/candlepin
enabled=1
gpgcheck=0
EOF
fi
yum install -y spacewalk-setup-embedded-postgresql
yum install -y spacewalk-postgresql
# FIXME: a dep that is not picked up for some reason
yum install -y asm
# FIXME: hack, needs to be fixed in spacewalk build.xml
ln -s /usr/share/java/slf4j-api.jar /var/lib/tomcat6/webapps/rhn/WEB-INF/lib/slf4j-api.jar
ln -s /usr/share/java/javassist.jar /var/lib/tomcat6/webapps/rhn/WEB-INF/lib/javassist.jar
ln -s /usr/share/java-signed/slf4j-log4j12.jar /var/lib/tomcat6/webapps/rhn/WEB-INF/lib/slf4j-log4j12.jar
spacewalk-setup --disconnected --answer-file="${ANSWER_FILE}"
| true
|
bb137bc542b5a8d11b4bd3c526e58a3b433bd552
|
Shell
|
decibelcooper/eicio
|
/go-eicio/genExtraMsgFuncs.sh
|
UTF-8
| 861
| 3.25
| 3
|
[] |
no_license
|
#!/bin/bash
protoFile=$1
outFile=$2
collections=$(grep "^message.*Collection\>" $protoFile | sed "s/^.*\<\(\S*Collection\)\>.*/\1/")
messages=$(grep "^message.*Collection\>" $protoFile | sed "s/^.*\<\(\S*\)Collection\>.*/\1/")
printf "\n\n// Extra generated functions for compliance with Message and Collection interfaces\n\n" >> $outFile
for coll in $collections; do
printf "func (c *$coll) SetId(id uint32) {\n\
c.Id = id\n\
}\n\n" >> $outFile
printf "func (c *$coll) GetNEntries() uint32 {\n\
return uint32(len(c.Entries))\n\
}\n\n" >> $outFile
printf "func (c *$coll) GetEntry(i uint32) proto.Message {\n\
if i < uint32(len(c.Entries)) {\n\
return c.Entries[i]\n\
}
return nil
}\n\n" >> $outFile
done
for msg in $messages; do
printf "func (m *$msg) SetId(id uint32) {\n\
m.Id = id\n\
}\n\n" >> $outFile
done
gofmt -w $outFile
| true
|
2e90a59b36c09f0bd31091d98df719a40ac7c5b4
|
Shell
|
ShrutiZarbade/tic-tac-toe-game
|
/tic_tac_toe.sh
|
UTF-8
| 3,396
| 3.390625
| 3
|
[] |
no_license
|
#!/bin/bash -x
echo "Welcome to Tic-Tac-Toe Game"
declare -a board
TOTAL_CELL=9
cell=0
flag=0
function resetBoard()
{
for((i=1;i<=9;i++))
do
board[i]=$i
done
}
function displayBoard()
{
echo "| ${board[1]} | ${board[2]} | ${board[3]} |"
echo "| ${board[4]} | ${board[5]} | ${board[6]} |"
echo "| ${board[7]} | ${board[8]} | ${board[9]} |"
}
function whoPlayFirst()
{
if (( $((RANDOM%2))==1 ))
then
player="User"
userLetter="X"
computerLetter="O"
userTurn
else
player="Computer"
userLetter="O"
computerLetter="X"
computerTurn
fi
}
function switchTurn()
{
while (( cell<TOTAL_CELL ))
do
if [ $player == "User" ]
then
player="Computer"
computerTurn
else
player="User"
userTurn
fi
done
if (( cell == TOTAL_CELL ))
then
echo "Game Tie"
exit
fi
}
function userTurn()
{
echo "$player"
read -p "Enter Cell Number: " cellNumber
checkEmptyCell $cellNumber
if (( flag==1 ))
then
userTurn
fi
}
function computerTurn()
{
echo "$player"
checkSelfWin $computerLetter
checkSelfWin $userLetter
checkForCorner
cellNumber=$((RANDOM%9+1))
echo "random position entered by computer is : $cellNumber"
checkEmptyCell $cellNumber
if (( flag==1 ))
then
computerTurn
fi
}
function checkForCorner()
{
for((i=1;i<=9;i=i+2))
do
if (( i!=5 ))
then
checkEmptyCell $i
fi
done
}
function checkForCentre()
{
checkEmptycell $((TOTAL_CELL/2 + 1))
}
function checkForSides()
{
for(( i=2;i<=8;i=i+2))
do
checkEmptyCell $i
done
}
function checkSelfWin()
{
j=0
for((i=1;i<=3;i++))
do
if [[ ${board[i+j]} == $1 && ${board[i+j+1]} == $1 ]]
then
checkEmptyCell $((i+j+2))
elif [[ ${board[i+j]} == $1 && ${board[i+j+2]} == $1 ]]
then
checkEmptyCell $((i+j+1))
elif [[ ${board[i+j+1]} == $1 && ${board[i+j+2]} == $1 ]]
then
checkEmptyCell $((i+j))
fi
if [[ ${board[i]} == $1 && ${board[i+3]} == $1 ]]
then
checkEmptyCell $((i+6))
elif [[ ${board[i]} == $1 && ${board[i+6]} == $1 ]]
then
checkEmptyCell $((i+3))
elif [[ ${board[i+3]} == $1 && ${board[i+6]} == $1 ]]
then
checkEmptyCell $i
fi
j=$((j+2))
done
checkSelfWinDiagonal $1
}
function checkSelfWinDiagonal()
{
if [[ ${board[1]} == $1 && ${board[5]} == $1 ]]
then
checkEmptyCell 9
elif [[ ${board[3]} == $1 && ${board[5]} == $1 ]]
then
checkEmptyCell 7
elif [[ ${board[1]} == $1 && ${board[9]} == $1 ]]
then
checkEmptyCell 5
fi
if [[ ${board[3]} == $1 && ${board[7]} == $1 ]]
then
checkEmptyCell 5
elif [[ ${board[5]} == $1 && ${board[9]} == $1 ]]
then
checkEmptyCell 1
elif [[ ${board[7]} == $1 && ${board[5]} == $1 ]]
then
checkEmptyCell 3
fi
}
function checkEmptyCell()
{
cellNumber=$1
if [[ ${board[cellNumber]} -ne $cellNumber ]]
then
flag=1
else
flag=0
if [ $player == "User" ]
then
board[cellNumber]=$userLetter
else
board[cellNumber]=$computerLetter
fi
displayBoard
((cell++))
checkForWin
switchTurn
fi
}
function checkForWin()
{
j=0
for((i=1;i<=3;i++))
do
if [[ ( ${board[i+j]} == ${board[i+j+1]} && ${board[i+j+1]} == ${board[i+j+2]} ) ||
( ${board[i]} == ${board[i+3]} && ${board[i+3]} == ${board[i+6]} ) ||
( ${board[1]} == ${board[5]} && ${board[5]} == ${board[9]} ) ||
( ${board[3]} == ${board[5]} && ${board[5]} == ${board[7]} ) ]]
then
echo "$player Won"
exit
fi
j=$((j+2))
done
}
resetBoard
displayBoard
whoPlayFirst
| true
|
80c92287e9eca6f0d6a0a14b367ac3e404758af0
|
Shell
|
reify-ryan-heimbuch/dotfiles
|
/zsh/widgets/widget-insert-datestamp
|
UTF-8
| 185
| 2.859375
| 3
|
[] |
no_license
|
#!/bin/zsh
# Press "ctrl-e d" to insert the actual date in the form yyyy-mm-dd.
function widget-insert-datestamp () {
LBUFFER+=${(%):-'%D{%Y-%m-%d}'};
}
widget-insert-datestamp "$@"
| true
|
0eab7880b35d407e74f37be416c802ab16124889
|
Shell
|
cornell-ssw/totient_spack_configs
|
/node_compile_intel_dirty.pbs
|
UTF-8
| 1,231
| 3.203125
| 3
|
[] |
no_license
|
#!/bin/bash
#PBS -l nodes=1:ppn=24
#PBS -N spack_node_intel_dirty_install
#PBS -j oe
#PBS -M $USER@cornell.edu
# I assume you already checked spack spec -I
# Launch with:
#
# qsub -v spec='python+tk' /share/apps/spack/totient_spack_configs/node_compile.pbs
#
# NOTE: Make sure you are underneath *YOUR* home directory, when running from
# underneath /share/apps/spack it couldn't copy the .oXXXX output file back
# due to insufficient permissions.
#
# NOTE: Better yet, just put the `spack_node_install` function in your ~/.bashrc and
# launch
#
# spack_node_install 'python+tk'
#
# from anywhere you please ;) Read the docs:
#
# https://cornell-ssw.github.io/cluster_administration.html#admin-shell-configurations
#
# I HATE INTEL AND EVERYTHING ABOUT HOW THEY DO WHAT THEY DO
SPEC="${spec:-}"
echo '---> Loading intel specific module for a dirty environment'
module load intel/15.0.3
echo '---> About to run: /share/apps/spack/spack_all/bin/spack --color=always install --dirty '"$SPEC"
echo ' To view colors, use `less -R <output_file>`'
# /share/apps/spack/spack_all/bin/spack --color=always install $SPEC
/share/apps/spack/spack_all/bin/spack -d --color=always install --dirty $SPEC
| true
|
be9de7ebab168433d196677e935d3acc401ab154
|
Shell
|
kkoralsky/docker-openssh-client
|
/entrypoint.sh
|
UTF-8
| 442
| 3.4375
| 3
|
[] |
no_license
|
#!/bin/sh
[ "$SSH_TRUSTED_HOSTS" ] && ssh-keyscan $SSH_TRUSTED_HOSTS >> .ssh/known_hosts
echo "$SSH_KNOWN_HOSTS" >> .ssh/known_hosts
chmod 0600 .ssh/known_hosts
SSH_PRIVATE_KEY=${SSH_PRIVATE_KEY:-$DEPLOY_KEY}
[ "$SSH_PRIVATE_KEY" ] && echo "$SSH_PRIVATE_KEY" > .ssh/id_rsa && chmod 0600 .ssh/id_rsa
input="${@#sh -c}"
if [ "$SSH_CONNECTION_STRING" ]; then
exec ssh -t $SSH_CONNECTION_STRING "$input"
else
exec sh -c "$input"
fi
| true
|
36f6ab67b01bdbb07577f8bec1f83921df6cdbf6
|
Shell
|
ruabmbua/navi
|
/scripts/make
|
UTF-8
| 549
| 3.78125
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
set -euo pipefail
##? make install
##? make uninstall
export NAVI_HOME="$(cd "$(dirname "$0")/.." && pwd)"
source "${NAVI_HOME}/scripts/install"
install() {
"${NAVI_HOME}/scripts/action" release
ln -s "${NAVI_HOME}/target/tar/navi" /usr/bin/navi \
|| ln -s "${NAVI_HOME}/target/tar/navi" /usr/local/bin/navi
}
uninstall() {
rm -rf "${NAVI_HOME}/target"
rm /usr/local/bin/navi || rm /usr/bin/navi
}
cmd="$1"
shift
case "$cmd" in
"install") install "$@" ;;
"uninstall") uninstall "$@" ;;
esac
| true
|
707377d34a2efc115161a9c70b80e51b08c343b4
|
Shell
|
crbates/radsrc
|
/macosx/run_radsrc.command
|
UTF-8
| 790
| 3.859375
| 4
|
[] |
no_license
|
#!/bin/sh
#
# Shell script that provides "double-click" functionality equivalent to
# MacOSX application.
#
# Doug Wright
#....move to directory in which this command resides
cd `dirname $0` >/dev/null 2>&1
#....prompt for possible input file
echo
echo -n "Enter input file name [or hit return for interactive mode] "
read file
echo
#....if the user specified a file, cat it to the program
#
# I use a pipe instead of <file, because the user can
# choose to enter 'filename -', this will cat the file
# and let the user continue to type via standard input.
# Note that if the user does use this feature (-) an
# extra carriage return is expected at the end of
#
#[ "$file" ] && file="cat $file |"
#....execute actual binary
#eval $file bin/radsrc
eval bin/radsrc $file
| true
|
7c1c08d3f82704213a5027d7683ec80b34a3affb
|
Shell
|
chankongching/kylindeploy
|
/cookbooks/kap/templates/default/aws_10_check_create_keypair.sh
|
UTF-8
| 541
| 3.3125
| 3
|
[
"GPL-3.0-only",
"GPL-2.0-only",
"Apache-2.0"
] |
permissive
|
#!/bin/bash
VAR=$1
AZ1=`echo $VAR|cut -d ',' -f1`
AZ2=`echo $VAR|cut -d ',' -f2`
REGION=`echo $VAR|cut -d ',' -f3`
ID=`echo $VAR|cut -d ',' -f4`
# Run checking command
aws ec2 describe-key-pairs --key-name kylin --region $REGION > /dev/null
if [ $? -ne 0 ]
then
echo "Kylin key doesnt exists, uploading..."
aws ec2 import-key-pair --key-name kylin --public-key-material --region $REGION file://./ec2key/kylin.pub
if [ $? -ne 0 ];then
echo "Upload of EC2 key pair failed, Please contact system admin"
exit
fi
fi
| true
|
c61965963861c20f4affedc8bce4024b947d6607
|
Shell
|
wotmof/Public.Code
|
/dbcmgt
|
UTF-8
| 7,574
| 3.546875
| 4
|
[] |
no_license
|
#!/bin/bash
#
#
#
# Name dbcmgt
# Path /usr/bin
# Description Database inside linux Containers Management
#
#
#
#
#+------------------------------------------------------------+
#| wotmof was here |
#| wotmof@yahoo.com - fabrizio.bordacchini@simplyhealth.co.uk |
#| ver 0.0.1 - JUN 2015 [UK] >|< |
#| apples give health |
#+------------------------------------------------------------+
#
#==================================================================
trap 'clear; echo Bye.; echo; exit 0' 2 3
#==================================================================
function log2()
{
printf "%10s %8s %-80s\n" "$(date +%d/%m/%Y)" "$(date +%H:%M:%S)" "$msg" >> $___logfile
}
function header()
{
#clear whyyyyy? wheeennnn? whaaaaat? really? i should, should i. Do you think?
clear
title=" $(hostname -s) Linux Containers Management "; title_=${#title}
for((i=1;i<=$((_cols/2-title_/2));i++)); do printf "="; done
printf "$title"
for((i=1;i<=$((_cols/2-title_/2));i++)); do printf "="; done; echo
}
function lxc_db_status()
{
inst_bg=$(lxc-attach -n $container -- ps -ef | grep ora_smo | grep $inst_name | wc -l | awk '{print $1}')
if [ $inst_bg -eq 1 ];
then
_cmd="lxc-attach -n $container -- su - oracle -c '$_oramgt $inst_name status'"
data=$(eval $_cmd)
inst_status=$(echo $data | awk '{print $1}')
lsnr_status=$(echo $data | awk '{print $2}')
standby_status=$(echo $data | awk '{print $3}')
else
inst_status="CLOSED"
lsnr_status=$(lxc-attach -n $container -- ps -ef | grep tnslsnr | grep -v grep | wc -l | awk '{print $1}')
standby_status="UNKNOWN"
if [ $lsnr_status -eq 1 ]; then lsnr_status="ONLINE"; else lsnr_status="OFFLINE"; fi
fi
}
function plot_status()
{
case $inst_status in
OPEN) printf "\e[38;05;255;42m[ OPEN ]\e[0m " ;;
MOUNTED) printf "\e[38;05;0;43m[ MOUNTED ]\e[0m " ;;
CLOSED) printf "\e[38;05;255;41m[ CLOSED ]\e[0m " ;;
*) printf "\e[38;05;0;107m[ UNKNOWN ]\e[0m " ;;
esac
case $lsnr_status in
ONLINE) printf "\e[38;05;255;42m[ ONLINE ]\e[0m " ;;
OFFLINE) printf "\e[38;05;255;41m[ OFFLINE ]\e[0m " ;;
*) printf "\e[38;05;0;107m[ UNKNOWN ]\e[0m " ;;
esac
case $standby_status in
PHYSICAL) printf "\e[38;05;0;43m[ PHYSICAL STANDBY ]\e[0m\n" ;;
SNAPSHOT) printf "\e[38;05;0;41m[ SNAPSHOT STANDBY ]\e[0m\n" ;;
PRIMARY) printf "\e[38;05;255;42m[ PRIMARY DATABASE ]\e[0m\n" ;;
*) printf "\e[38;05;0;107m[ UNKNOWN ]\e[0m\n" ;;
esac
}
function btrfs_status()
{
btrfs=($(/sbin/btrfs fi show | grep devid | awk '{print $4" "$6}'))
used_space=$(echo ${btrfs[1]} | sed 's/\..*//g'); tot_space=$(echo ${btrfs[0]} | sed 's/\..*//g')
pct_used=$((used_space*100/tot_space))
if [ $pct_used -ge $warn_pct ];
then
if [ $pct_used -ge $crit_pct ];
then
printf "\e[38;05;255;41mBTRFS used space at %2s%% ${used_space}/${tot_space} GB\e[0m \e[38;05;0;41m EXTEND BTRFS NOW!! ADD disk,volume,physical volume,cat or dog! Do something!\e[0m\n" "$pct_used"
else
printf "\e[38;05;255;43mBTRFS used space at %2s%% ${used_space}/${tot_space} GB\e[0m \e[38;05;0;43m YOU SHOULD PLAN A file system EXTENSION \e[0m\n" "$pct_used"
fi
else
printf "\e[38;05;255;42mBTRFS used space at %2s%% ${used_space}/${tot_space} GB\e[0m\n" "$pct_used"
fi
}
function dbs_status()
{
run=1
while [ $run -eq 1 ];
do
header
if [ "$target" = "ALL" ];
then
while read container inst_name startup_mode;
do
printf "%-25s %-12s %12s " $container $inst_name $startup_mode
lxc_db_status; plot_status
done < $___cfg
else
grep $target $___cfg | awk '{print $1" "$2" "$3}' | while read container inst_name startup_mode;
do
printf "%-25s %-12s %12s " $container $inst_name $startup_mode
lxc_db_status; plot_status
done
fi
for((i=1;i<=$_cols;i++)); do printf "="; done; echo
btrfs_status
for((i=1;i<=$_cols;i++)); do printf "="; done; echo
if [ $refresh -eq 0 ];
then
run=0
else
for ((aa=1;aa<=$refresh;aa++)); do printf "."; sleep 1; done
fi
done
}
function dbs_startup()
{
if [ "$target" = "ALL" ];
then
while read container inst_name startup_mode;
do
lxc_db_status
if [ "$inst_status" = "CLOSED" ];
then
msg="Starting up Database [$inst_name]"; log2
_cmd="lxc-attach -n $container -- su - oracle -c '$_oramgt $inst_name start $startup_mode'"
eval $_cmd >/dev/null
sleep 3
lxc_db_status; msg="Database [${inst_name}] on [${container}] is $inst_status";log2
else
msg="Database [${inst_name}] on [${container}] already $inst_status"; log2
fi
done < $___cfg
else
grep $target $___cfg | awk '{print $1" "$2" "$3}' | while read container inst_name startup_mode;
do
lxc_db_status
if [ "$inst_status" = "CLOSED" ];
then
msg="Starting up Database [$inst_name]"; log2
_cmd="lxc-attach -n $container -- su - oracle -c '$_oramgt $inst_name start $startup_mode'"
eval $_cmd >/dev/null
sleep 3
lxc_db_status; msg="Database [${inst_name}] on [${container}] is $inst_status";log2
else
msg="Database [${inst_name}] on [${container}] already $inst_status"; log2
fi
done
fi
}
function dbs_shutdown()
{
echo; printf "Are you sure you want to shutdown $target database(s)? (y/n): "; read GOON</dev/tty
if [[ ("$GOON" = "n" || "$GOON" = "N") ]];
then
clear; echo; Bye.; exit 0
else
if [ "$target" = "ALL" ];
then
while read container inst_name startup_mode;
do
lxc_db_status
if [ "$inst_name" = "CLOSED" ];
then
echo "Database [${inst_name}] on [${container}] is CLOSED"
else
msg="Shutting down Database [$inst_name] on [${container}]"; log2
_cmd="lxc-attach -n $container -- su - oracle -c '$_oramgt $inst_name shutdown immediate'"
eval $_cmd >/dev/null; sleep 3
lxc_db_status; msg="Database [${inst_name}] on [${container}] is $inst_status";log2
fi
done < $___cfg
else
grep $target $___cfg | awk '{print $1" "$2" "$3}' | while read container inst_name startup_mode;
do
lxc_db_status
if [ "$inst_name" = "CLOSED" ];
then
echo "Database [${inst_name}] on [${container}] is CLOSED"
else
msg="Shutting down Database [$inst_name] on [${target}]"; log2
_cmd="lxc-attach -n $container -- su - oracle -c '$_oramgt $inst_name shutdown immediate'"
eval $_cmd >/dev/null; sleep 3
lxc_db_status; msg="Database [${inst_name}] on [${container}] is $inst_status";log2
fi
done
fi
fi
}
#==================================================================
_exec="dbcmgt"
base_dir="/etc"
___cfg="${base_dir}/${_exec}.conf"
___logfile="/var/log/lxc/dbcmgt.log"
_oramgt="/home/oracle/oramgt"
_cols=$(tput cols)
warn_pct=85; crit_pct=92
#==================================================================
if [ ! -f $___cfg ];
then
clear; echo
echo "ERROR: Unable to locate utility config file \"$___cfg\""
echo; exit 0
fi
if [ ! "$USER" = "root" ];
then
clear; echo
echo "WARNING: You should run this script as \"root\""
echo; exit 0
fi
if [ $# -lt 1 ];
then
clear; echo
echo "Manage Oracle Databases running inside LXC (Linux Containers)"; echo; echo
echo "Usage: \$ $_exec <status|start|shutdown> { ALL | <container> }"
echo; exit 1
else
action=$1
target=$2; [ -z $target ] && target="ALL"
fi
case $action in
status) if [ -z $3 ]; then refresh=0; else refresh=$3; fi; dbs_status ;;
start) dbs_startup ;;
shutdown) dbs_shutdown ;;
*) clear; echo; echo "ERROR: option not available"; echo; exit 1 ;;
esac
echo
exit 0
| true
|
b448b89d0ae2b119f7f5b0c13489d3022b991412
|
Shell
|
HaloGenius/hiveos-custom-miner
|
/custom/energiminer/h-stats.sh
|
UTF-8
| 2,433
| 3.5
| 4
|
[] |
no_license
|
#!/bin/bash
. $MINER_DIR/$CUSTOM_MINER/h-manifest.conf
if [[ -z $CUSTOM_LOG_BASENAME ]]; then
LOG="energiminer.log"
else
LOG="$CUSTOM_LOG_BASENAME.log"
fi
local stats_raw=`cat ${LOG} | tail -n 100 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | grep -w "energiminer" | tail -n 1 | grep "^ m "`
#Calculate miner log freshness
local maxDelay=120
local time_now=`date +%T | awk -F: '{ print ($1 * 3600) + $2*60 + $3 }'`
local time_rep=`echo $stats_raw | sed 's/^.*\<Time\>: //' | awk -F: '{ print ($1 * 3600) + $2*60}'`
local diffTime=`echo $((time_now-time_rep)) | tr -d '-'`
if [ "$diffTime" -lt "$maxDelay" ]; then
# Total reported hashrate MHs
local total_hashrate=$((grep "Speed" | awk '{ print $5 }') <<< $stats_raw)
# Hashrate, temp, fans per card
local cards=`echo "$stats_raw" | sed 's/^.*Mh\/s[[:space:]]*//' | sed 's/GPU\//#/g' | cut -f1 -d '[' | cut -c 2- | tr '#' '\n'`
local hashrate='[]'
local temp='[]'
local fan='[]'
while read -s line; do
local gpu_h=`echo $line | awk '{ print $2 }'`
local gpu_t=`echo $line | awk '{ print $3 }' | cut -c -2`
local gpu_f=`echo $line | awk '{ print $4 }' | cut -c -2`
local hashrate=`jq --null-input --argjson hashrate "$hashrate" --argjson gpu_h "$gpu_h" '$hashrate + [$gpu_h]'`
local temp=`jq --null-input --argjson temp "$temp" --argjson gpu_t "$gpu_t" '$temp + [$gpu_t]'`
local fan=`jq --null-input --argjson fan "$fan" --argjson gpu_f "$gpu_f" '$fan + [$gpu_f]'`
done <<< "$cards"
# Miner uptime
local uptime=`echo "$stats_raw" | sed -e 's/^.*\<Time\>\://g' | awk -F: '{ print ($1 * 3600) + $2*60 }'`
# A/R
eval `echo "$stats_raw" | cut -f 2 -d '[' | cut -f 1 -d ']' | tr -d ',' | sed 's/^A/acc=/g' | sed 's/R/rej=/g' | tr ':' ' '`
[[ -z $acc ]] && acc=0
[[ -z $rej ]] && rej=0
[[ -z $CUSTOM_VERSION ]] && CUSTOM_VERSION="2.2.1"
stats=$(jq -nc \
--argjson hs "$hashrate" \
--argjson temp "$temp" \
--argjson fan "$fan" \
--arg uptime "`echo $uptime`" \
--arg acc "$acc" \
--arg rej "$rej" \
--arg ver "$CUSTOM_VERSION" \
'{ hs: $hs, hs_units: "mhs", temp: $temp, fan: $fan, uptime: $uptime, ar: [$acc, $rej], algo: "energihash", ver: $ver }')
# total hashrate: miner reports in mhs, so convert to khs
khs=`echo $total_hashrate | awk '{ printf($1*1000) }'`
else
khs=0
stats="null"
fi
[[ -z $khs ]] && khs=0
[[ -z $stats ]] && stats="null"
# DEBUG output
#echo $stats | jq -c -M '.'
#echo $khs
| true
|
1821c2a96876bcae1540a8dcb64d5a9cf846b6cc
|
Shell
|
fialakarel/my-ubuntu-install-steps
|
/install/shotcut.sh
|
UTF-8
| 412
| 3.140625
| 3
|
[] |
no_license
|
#!/bin/bash
set -v
# Create dir for bin files
mkdir $HOME/bin
version="$(curl https://github.com/mltframework/shotcut/releases/latest | cut -d'"' -f2 | egrep -o "[0-9]+\.[0-9]+\.[0-9]+$")"
# Get Shotcut
wget https://github.com/mltframework/shotcut/releases/download/v${version}/shotcut-linux-x86_64-${version//./}.AppImage -O $HOME/bin/shotcut.AppImage
# Set permissions
chmod +x $HOME/bin/shotcut.AppImage
| true
|
6a00a3e8d1f7d5a0c5350ba90fdeca3e7bd809b2
|
Shell
|
kwaugh/.dotfiles
|
/zsh/.zshrc
|
UTF-8
| 3,276
| 2.6875
| 3
|
[] |
no_license
|
export TERM="xterm-256color"
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
bindkey -v
export LC_ALL=en_US.UTF-8
export DEFAULT_USER=keivaun
if [[ $unamestr == 'Darwin' ]]; then
export HOME="/Users/$DEFAULT_USER"
elif [[ $unamestr == 'Linux' ]]; then
export HOME="/home/$DEFAULT_USER"
fi
# The following lines were added by compinstall
zstyle :compinstall filename "$HOME/.zshrc"
# Filename suffixes to ignore during completion (except after rm command)
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o'
# the same for old style completion
fignore=(.o .c~ .old .pro)
autoload -Uz compinit
compinit
# End of lines added by compinstall
setopt PROMPT_SUBST
PROMPT='%{$(pwd|grep --color=always /)%${#PWD}G%} %(!.%F{red}.%F{cyan})%n%f@%F{yellow}%m%f%(!.%F{red}.)%#%f '
# oh-my-zsh settings
export LANG=en_US.utf8
if [ -f /usr/local/opt/powerlevel9k/powerlevel9k.zsh-theme ]; then
POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs ssh anaconda)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs command_execution_time)
ZSH_THEME="powerlevel9k/powerlevel9k"
plugins=(git)
source /usr/local/opt/powerlevel9k/powerlevel9k.zsh-theme
fi
export ERLHOME=/usr/local/lib/erlang
export EDITOR=nvim
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbi:$PATH"
unamestr=$(uname)
alias baus='ssh kwaugh@70.114.199.247'
alias bausy='ssh -Y kwaugh@70.114.199.247'
alias bauslocal='ssh kwaugh@192.168.1.105'
alias bauslocaly='ssh -Y kwaugh@192.168.1.105'
alias monster='ssh -p 3000 kwaugh@70.114.199.247'
alias monsterlocal='ssh kwaugh@192.168.1.121'
alias raspberry='ssh keivaun@70.114.236.177'
alias raspberrylocal='ssh keivaun@192.168.0.26'
alias gitspa='git stash; git pull; git stash apply'
alias sl='ls'
alias l='ls -al'
if [[ $unamestr == 'Darwin' ]]; then
alias vim='mvim -v'
alias fixdigitalocean='sudo ifconfig en0 down;sudo route -n flush;sudo ifconfig en0 up'
alias ls='ls -G'
alias ll='ls -G -l -a'
alias mountbaus='sudo sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa kwaugh@70.114.210.103:/media/kwaugh/RAID/ ~/RAID/'
alias unmountbaus='sudo umount ~/RAID'
export DROPBOX_LOC="~/Dropbox"
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
elif [[ $unamestr == 'Linux' ]]; then
[ -d ~/.fonts ] && source ~/.fonts/*.sh
alias open='xdg-open'
alias ls='ls --color'
alias ll='ls -l --color -a'
export DROPBOX_LOC="/mnt/RAIDUbuntu/Dropbox"
export LESSOPEN="| $(which source-highlight) %s"
export LESS=' -R '
fi
# Use vi keybindings in zsh
set -o vi
# Use fzf reverse search if it's installed
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -f /usr/share/doc/fzf/examples/key-bindings.zsh ] && \
source /usr/share/doc/fzf/examples/key-bindings.zsh
encrypt() {
openssl enc -aes-256-cbc -e -in $1 -out $2
}
decrypt() {
openssl enc -aes-256-cbc -d -in $1 -out $2
}
dgrep() {
grep -rinH --exclude="*.{out,output,o}" --exclude="tags" --exclude-dir="node_modules" $1 $2
}
space() {
du -sk ~/* ~/.??* | sort -n
}
| true
|
d5de32fcbd811c7898e85b85f9b19c7c4e443553
|
Shell
|
jlhcrawford/he-toolkit
|
/docker/welcome_msg.sh
|
UTF-8
| 1,704
| 3.15625
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
cat << EOF
In the current directory, you will find 3 scripts:
1. run_sample_kernels_[palisade|seal].sh: This will run several HE sample kernels including
Matrix Multiplication and Logistic Regression. The script will display Wall time,
CPU time, and the number of iterations that were run.
2. run_micro_kernels_[palisade|seal].sh: This will run many HE micro kernels that span a
wide range of schemes, and display different parts of the HE pipeline from encoding
to encryption and beyond.
3. run_tests.sh: This will run several unit tests to confirm the validity of the above
sample kernels by comparing against the same operation in the non-HE space.
4. run_query_example.sh: This will run a "Secure Query" example allowing users
to query on a database of the 50 U.S. States while controlling (optionally) the
crypto-parameters used. When prompted, enter a State and, if present, the
corresponding City will be decoded and printed.
5. run_lr_example.sh: This will run a "Logistic Regression" (LR) example allowing users
to see a faster and more scalable method for LR in HE. Unlike the LR code available
before in the sample-kernels, this version takes extra steps to utilize as many slots
as possible in the ciphertexts.
The scripts are run as would be expected (e.g. ./run_sample_kernels_[palisade|seal].sh). When
done testing, feel free to terminate the docker with the "exit" command or temporarily leave
the docker Ctrl+p -> Ctrl+q, then re-enter using docker exec (see "Docker Controls" in
the User Guide for more information).
EOF
| true
|
b4434bb3783ce579865016a5feaa0bda85ccb3f5
|
Shell
|
johslarsen/dotfiles
|
/bashrc.d/10-system-wide
|
UTF-8
| 81
| 2.703125
| 3
|
[
"Unlicense"
] |
permissive
|
#!/bin/bash -
for f in /etc/{bashrc,bash.bashrc}; do
[ -f "$f" ] && . "$f"
done
| true
|
86b109fcd79a2ff66e23ca6af0141eb582f407e0
|
Shell
|
SliTaz-official/wok-stable
|
/slitaz-fbsplash/stuff/tazfbsplash
|
UTF-8
| 4,667
| 3.875
| 4
|
[] |
no_license
|
#!/bin/sh
#
# Tazfbsplash - Tool to manage and configure Busybox fbsplash on SliTaz
# (C) 2011 SliTaz - GNU General Public License.
#
# TODO:
# box - on/off with curent status
# box - change/install/remove themes
# check GRUB settings: quiet vga=*
#
. /etc/rcS.conf
# Functions
. /usr/lib/slitaz/libtaz
source_lib commons
usage() {
echo -e "\nSliTaz graphical boot configuration tool\n
\033[1mUsage:\033[0m `basename $0` [command] [theme]
\033[1mCommands: \033[0m
on Enable graphical boot.
off Disable graphical boot.
list-themes List all installed themes.
change-theme Change current theme.
pack-theme Pack a system theme in a tar archive.
install-theme Install a fbsplash-theme-* archive.
test Test a theme configuration (Must be run in text mode).
box Graphical configuration box.\n"
}
separator() {
echo "================================================================================"
}
change_theme()
{
sed -i s~FBSPLASH_THEME=.*~FBSPLASH_THEME=\"$new_theme\"~ /etc/rcS.conf
}
# GUI box (not yet ready :-)
box() {
export MAIN_DIALOG='
<window title="Tazfbsplash Box" icon-name="preferences-desktop-wallpaper">
<vbox>
<text use-markup="true">
<label>"
<b>SliTaz Fbsplash Box</b>"</label>
</text>
<text wrap="true" width-chars="50" use-markup="true">
<label>"SliTaz graphical boot manager
"</label>
</text>
<hbox>
<text use-markup="true">
<label>"<b>Theme:</b>"</label>
</text>
<entry>
<default>'$FBSPLASH_THEME'</default>
<variable>NEW_THEME</variable>
</entry>
<button>
<input file icon="text-editor"></input>
<action>editor /etc/fbsplash/$NEW_THEME/fbsplash.cfg</action>
</button>
<button>
<input file icon="forward"></input>
<action>tazfbsplash -ct $NEW_THEME</action>
</button>
</hbox>
<tree>
<width>320</width><height>120</height>
<variable>EDIT_THEME</variable>
<label>Themes list (double-click to edit config)</label>
<input>tazfbsplash -lt --box</input>
<action>editor /etc/fbsplash/$EDIT_THEME/fbsplash.cfg</action>
</tree>
<hbox>
<button>
<input file icon="exit"></input>
<action type="exit">exit</action>
</button>
</hbox>
</vbox>
</window>'
gtkdialog --center --program=MAIN_DIALOG
}
# Commands
case "$1" in
on)
# Enable graphical boot.
echo -en "\nEnabling SliTaz graphical boot..."
if [ ! `grep "rcS > /dev/null" /etc/inittab` ]; then
sed -i s'/rcS/rcS > \/dev\/null/' /etc/inittab
fi
sed -i s'/FBSPLASH="no"/FBSPLASH="yes"/' /etc/rcS.conf
status && echo "" ;;
off)
# Disable graphical boot.
echo -en "\nDisabling SliTaz graphical boot..."
sed -i s'/rcS > \/dev\/null/rcS/' /etc/inittab
sed -i s'/FBSPLASH="yes"/FBSPLASH="no"/' /etc/rcS.conf
status && echo "" ;;
list-themes|-lt)
# List all themes
if [ "$2" != "--box" ]; then
echo -en "\n\033[1mBoot splash themes\033[0m"
separator
fi
cd /etc/fbsplash
for i in *
do
[ -f "/etc/fbsplash/$i/fbsplash.cfg" ] && echo $i
done
[ "$2" != "--box" ] && echo "" ;;
change-theme|-ct)
new_theme="$2"
[ -z "$new_theme" ] && exit 0
[ ! -d "/etc/fbsplash/$new_theme" ] && exit 0
echo -n "Activing fbsplash theme: $new_theme"
change_theme && status ;;
pack-theme|-pt)
# Pack a theme into .tar.gz
theme="$2"
tmp=slitaz-fbsplash-$theme
if [ ! -d "/etc/fbsplash/$theme" ]; then
echo -e "\nNo theme found in: /etc/fbsplash/$theme\n"
exit 0
fi
echo -n "Creating fbsplash theme archive for: $theme"
mkdir -p $tmp
cp -r /etc/fbsplash/$theme $tmp
cat > $tmp/README << EOT
SliTaz graphical boot theme
================================================================================
This is a Busybox fbsplash theme created on and for SliTaz GNU/Linux. To use it
you can copy files manually to /etc/fbsplash or use 'tazfbsplash install-theme'
EOT
busybox tar czf slitaz-fbsplash-$theme.tar.gz $tmp
rm -rf $tmp && status ;;
install-theme|-it)
check_root
file=$2
if [ ! -f "$file" ]; then
echo -e "\nNo theme archive: $file\n"
exit 0
fi
echo -n "Installing fbsplash theme..."
tar xzf $file -C /tmp
rm /tmp/slitaz-fbsplash-*/README
cp -r /tmp/slitaz-fbsplash-*/* /etc/fbsplash
status ;;
test|-t)
# Test suite for fbsplash on SliTaz (must be run in text mode).
fbsplash -c \
-s /etc/fbsplash/$FBSPLASH_THEME/fbsplash.ppm \
-i /etc/fbsplash/$FBSPLASH_THEME/fbsplash.cfg \
-f /etc/fbsplash/fifo &
for p in 0 10 20 30 40 50 60 70 80 90 100
do
echo "$p" > /etc/fbsplash/fifo && sleep 1
done > /dev/null
echo "exit" > /etc/fbsplash/fifo ;;
box|-b)
box ;;
*)
usage ;;
esac
exit 0
| true
|
a7474b7722ae77358c7f2a1cd643dfe17a766c61
|
Shell
|
Vman45/pdf2cbx
|
/utils.sh
|
UTF-8
| 1,346
| 3.59375
| 4
|
[
"Unlicense"
] |
permissive
|
checkinstall () {
_test=sudo dpkg-query -l | grep $1 | wc -l &> /dev/null
ctxt purple def def "Installation de $1 ....................................."
if [ "$_test" == "0" ]; then
ctxt def def def "Installation de $1"
echo $2 | sudo -S -y -qq apt-get install $1
else
ctxt red def def "$1" n
ctxt yellow def def "est déja installé ..."
fi
}
checkDir () {
if [ -d "$1" ]
then
ctxt yellow def def "Le répertoire $1 existe déja"
else
sudo mkdir $1
ctxt yellow def def "Le répertoire $1 à été crée"
fi
}
checkFile () {
if [ -f "$1" ]
then
ctxt yellow def def "Le fichier $1 existe déja"
else
sudo mkdir $1
ctxt yellow def def "Le fichier $1 à été crée"
fi
}
config () {
ctxt red def def "Entrez votre mot de passe et pressez" n
ctxt yellow def def "ENTREE" n
ctxt def def hdn ""
read -s password #l'option -s est utilisée pour cacher le read
checkinstall pv $password
checkinstall zip $password
checkinstall rar $password
checkinstall p7zip $password
checkinstall tar $password
sleep 1
checkDir pdf2cbx
cd /home/$USER/pdf2cbx
checkDir input
checkDir output
echo $password | sudo -S chmod -R 777 /home/$USER/pdf2cbx
sleep 1
ctxt red def def "Opérations de configuration terminées"
sleep 2
clear ; displayMenu
}
pdf2jgp () {
cd $inputPath
}
| true
|
b43ba627a555ec71eed375812995778a6b57a031
|
Shell
|
eriksf/jenkins-backup-script
|
/jenkins-backup.sh
|
UTF-8
| 4,260
| 3.71875
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash -xe
##################################################################################
function usage(){
echo "usage: $(basename $0) /path/to/jenkins_home archive.tar.gz"
}
##################################################################################
readonly JENKINS_HOME=$1
readonly DEST_FILE=$2
readonly CUR_DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd)
readonly TMP_DIR="$CUR_DIR/tmp"
readonly ARC_NAME="jenkins-backup"
readonly ARC_DIR="$TMP_DIR/$ARC_NAME"
readonly TMP_TAR_NAME="$TMP_DIR/archive.tar.gz"
readonly JOB_CONFIG_ONLY="$CUR_DIR/jobs-config-only.txt"
declare -a BACKUP_DIRS=(".agave"
".aws"
"bin"
"config-history"
"credentials_cache"
".docker"
"fingerprints"
"init.groovy.d"
".java"
"jobs"
"nodes"
"plugins"
"sd2e-cloud-cli"
"secrets"
".ssh"
".subversion"
"userContent"
"users"
"workflow-libs"
)
if [ -z "$JENKINS_HOME" -o -z "$DEST_FILE" ] ; then
usage >&2
exit 1
fi
# read in jobs-config-only file (this only works in bash 4.x)
readarray -t jobs_config_only < $JOB_CONFIG_ONLY
rm -rf "$ARC_DIR" "$TMP_TAR_NAME"
mkdir -p "$ARC_DIR"
for i in "${BACKUP_DIRS[@]}";do
if [[ $i == "plugins" || $i == "jobs" ]]; then
mkdir -p "$ARC_DIR"/$i
else
[ -d "$JENKINS_HOME/$i" ] && cp -R "$JENKINS_HOME/$i" "$ARC_DIR"/
fi
done
cp "$JENKINS_HOME/"*.xml "$ARC_DIR"/
cp "$JENKINS_HOME/"secret.key* "$ARC_DIR"/
cp "$JENKINS_HOME/".gitconfig "$ARC_DIR"/ || true
cp "$JENKINS_HOME/"identity.key* "$ARC_DIR"/
cp "$JENKINS_HOME/"jenkins.install.* "$ARC_DIR"/ || true
cp "$JENKINS_HOME/plugins/"*.[hj]pi "$ARC_DIR/plugins"
hpi_pinned_count=$(find $JENKINS_HOME/plugins/ -name *.hpi.pinned | wc -l)
jpi_pinned_count=$(find $JENKINS_HOME/plugins/ -name *.jpi.pinned | wc -l)
if [ $hpi_pinned_count -ne 0 -o $jpi_pinned_count -ne 0 ]; then
cp "$JENKINS_HOME/plugins/"*.[hj]pi.pinned "$ARC_DIR/plugins"
fi
function backup_jobs {
local run_in_path=$1
local rel_depth=${run_in_path#$JENKINS_HOME/jobs/}
if [ -d "$run_in_path" ]; then
cd "$run_in_path"
find . -maxdepth 1 -type d | while read full_job_name ; do
[ "$full_job_name" = "." ] && continue
[ "$full_job_name" = ".." ] && continue
job_name=${full_job_name##./}
if [ -d "$JENKINS_HOME/jobs/$rel_depth/$job_name" ] &&
[ -f "$JENKINS_HOME/jobs/$rel_depth/$job_name/config.xml" ] &&
[ "$(grep -c "com.cloudbees.hudson.plugins.folder.Folder" "$JENKINS_HOME/jobs/$rel_depth/$job_name/config.xml")" -ge 1 ] ; then
echo "Folder! $JENKINS_HOME/jobs/$rel_depth/$job_name/jobs"
# create folder and copy *.xml config files
mkdir -p "$ARC_DIR/jobs/$rel_depth/$job_name/jobs"
find "$JENKINS_HOME/jobs/$rel_depth/$job_name/" -maxdepth 1 -name "*.xml" -print0 | xargs -0 -I {} cp {} "$ARC_DIR/jobs/$rel_depth/$job_name/"
# since this is a Folder, backup its jobs folder
backup_jobs "$JENKINS_HOME/jobs/$rel_depth/$job_name/jobs"
else
# regular job folder, check if copy config only
if [[ " ${jobs_config_only[*]} " == *"$job_name"* ]] ; then
echo "Only copying job configs, not builds"
[ -d "$JENKINS_HOME/jobs/$rel_depth/$job_name" ] && mkdir -p "$ARC_DIR/jobs/$rel_depth/$job_name/"
find "$JENKINS_HOME/jobs/$rel_depth/$job_name/" -maxdepth 1 -name "*.xml" -print0 | xargs -0 -I {} cp {} "$ARC_DIR/jobs/$rel_depth/$job_name/"
else
echo "Copying whole job folder"
cp -R "$JENKINS_HOME/jobs/$rel_depth/$job_name" "$ARC_DIR/jobs/$rel_depth"
fi
true
echo "Job! $JENKINS_HOME/jobs/$rel_depth/$job_name"
fi
done
echo "Done in $(pwd)"
cd -
fi
}
if [ "$(ls -A $JENKINS_HOME/jobs/)" ] ; then
backup_jobs "$JENKINS_HOME/jobs/"
# backup job build history as well
# cp -R "$JENKINS_HOME/jobs/". "$ARC_DIR/jobs"
fi
cd "$TMP_DIR"
tar -czvf "$TMP_TAR_NAME" "$ARC_NAME/"
cd -
mv -f "$TMP_TAR_NAME" "$DEST_FILE"
rm -rf "$ARC_DIR"
exit 0
| true
|
77339c508fdcc6cd74cc84b5edcd0ab3c6027dff
|
Shell
|
crissotto/Scripts-Linux
|
/MANUAL CENTRO DE COMPUTOS/ABM/altausuario.sh
|
UTF-8
| 3,809
| 3.546875
| 4
|
[] |
no_license
|
clear
echo -e "ALTA DE USUARIOS"
echo ""
echo ""
setContrasenia() {
pass=$(date | md5sum | cut -c 1-8)
echo "$altausuario:$pass" | chpasswd
if [ $? -eq 0 ]
then
echo "La contrasenia de $altausuario es: " $pass
echo "$altausuario $pass $group" >> /home/admin/BACKUP/contraseniapordefecto.txt
else
echo "No se pudo asignar la contrasenia al usuario."
fi
}
menu() {
clear
echo "|---------------------------------------|"
echo "|---------BIENVENIDO AL MENU------------|"
echo "|---------------------------------------|"
echo "1) Agregar un usuario y asignarle un grupo"
echo "0) Salir"
echo -e "Seleccione una opcion: \c"
read opc
if [ "$opc" == "" ]
then
clear
echo -e "\n \n La opcion no puede estar vacio"
sleep 2s
clear
menu
fi
case $opc in
1)echo "Recuerde que no debe contener numeros ni simbolos"
echo -e "Ingrese nombre del usuario: \c"
read nombre
echo -e "Ingrese apellido del usuario: \c"
read apellido
echo -e "Ingrese nombre de usuario a crear: \c"
read altausuario
if [ "$altausuario" == "" ]
then
clear
echo -e "\n \n El nombre de usuario no puede estar vacio"
sleep 2
clear
menu
fi
EXISTE=$(cat /etc/passwd | cut -d: -f1 | grep -c "$altausuario")
if [ $EXISTE -eq 1 ]
then
echo -e "El usuario ya existe"
sleep 3s
clear
menu
else
#echo "Ingrese el directorio home (por defecto /home/$altausuario): "
#read home
#if [ "$home" == "" ] ; then
#home="/home/$altausuario"
#else
#$home
#fi
echo "Ingrese el shell a utilizar (por defecto /bin/bash): "
read shell
if [ "$shell" == "" ] ; then
shell="/bin/bash"
fi
clear
#awk -F: '$3 > 1000 && $3 < 65534 {print $3 ")",$1}' /etc/group
echo "|----------------------------------------------|"
echo "|---------------GRUPOS DISPONIBLES-------------|"
echo "|----------------------------------------------|"
echo ""
awk -F: '$3 > 1000 && $3 < 65534 {print $1}' /etc/group
echo ""
echo "Recuerde que no debe contener numeros ni simbolos"
echo "El grupo debe ingresarse en MAYUSCULAS!"
echo -e "Ingrese el nombre del grupo al que quiere agregar al usuario: \c"
read group
if [ "$group" == "" ]
then
clear
echo -e "\n \n El nombre de grupo no puede estar vacio"
sleep 2s
clear
menu
fi
#EXISTEGRUPO=$(cat /etc/group | cut -d: -f1 | grep -c "$group")
EXISTEGRUPO=$(awk -F: '$3 > 500 && $3 < 65534 {print $1}' /etc/group | grep ^"$group")
echo "$EXISTEGRUPO"
if [ "$EXISTEGRUPO" != "$group" ]
then
echo "Grupo no existe"
sleep 3s
menu
else
sudo useradd -d /home/$altausuario -c "$nombre $apellido $group" -g $group -m -s $shell $altausuario
#useradd -d /home/$altausuario -m -g $group $altausuario
#useradd -d /home/$altausuario -g $group -m -s $altausuario
setContrasenia
echo "Creando..."
sleep 3
echo -e "El usuario $altausuario ha sido creado"
INGRESA=$(echo "insert into usuarios (usuario, nombre, apellido, contrasena, eliminado, estado_usuario, rol_usuario, conectado, ultima_conexion)
VALUES ('$altausuario', '$nombre', '$apellido', '$passwd', 0, 'ACTIVO','$group', 0, null) " | dbaccess technosoft_db2)
echo "$INGRESA"
echo "$(echo "grant CONNECT to $altausuario" | dbaccess technosoft_db2)"
chmod +x $group.sh
./$group.sh $altausuario
chmod 000 $group.sh
echo -e "Espere 5 segundos para volver al menu principal"
sleep 5s
clear
menu
fi
fi
;;
0)echo -e "Espere 5 segundos para volver al menu principal"
sleep 5s
clear
./menuabm.sh
;;
*) echo -e "Opcion incorrecta, vuelva a elegir."
sleep 3s
clear
menu
esac
}
menu
| true
|
d7568d9b1e111b12be568355d024f41453b2589d
|
Shell
|
larryhallgoldman/Workshop-2.0
|
/pipelines/tasks/create-workshop-env/task.sh
|
UTF-8
| 736
| 2.90625
| 3
|
[] |
no_license
|
#!/bin/bash
set -e
pushd Workshops-2.0
# ./gradlew -PversionNumber=$VERSION clean assemble
cf api $cf_target_url --skip-ssl-validation
# Get admin password after successful install using OpsMgr.
cf login -u $cf_username -p $cf_password -o $cf_org -s $cf_space
cf create-quota workshop -m 20G -s 1000 -a -1 -r 50 -i 4G --allow-paid-service-plans
echo $users | jq -c '.[]' | while read i; do
# do stuff with $i
USER=$(echo $i | jq -r '.user')
PASS=$(echo $i | jq -r '.password')
cf create-user $USER $PASS
cf create-org $USER
cf create-space development -o $USER
cf set-org-role $USER $USER OrgManager
cf set-space-role $USER $USER development SpaceDeveloper
cf set-quota $USER workshop
done
popd
| true
|
e490fc806c8650c1560d5da88e804a51aeadea24
|
Shell
|
VadymDenysenko/FairShip
|
/vm/_common.sh
|
UTF-8
| 188
| 2.546875
| 3
|
[] |
no_license
|
SCRIPT_NAME=$0
[[ -z "SCRIPT_NAME" || "$SCRIPT_NAME" == "bash" ]] && SCRIPT_NAME=$BASH_SOURCE
VM_DIR=`dirname "$SCRIPT_NAME"`
source $VM_DIR/_functions.sh
IMAGE="anaderi/fairroot:latest"
| true
|
23154c469d4f2ff01b117caed43789edea3080bf
|
Shell
|
UMainedynamics/SeidarT
|
/noconda_install.sh
|
UTF-8
| 2,063
| 3.015625
| 3
|
[] |
no_license
|
#!/bin/bash
# Install script for SEIDART toolbox
# Anaconda has issues.
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
f2pypath=`which f2py3`
else
f2pypath=`which pythonw3`
fi
f2pypath=`dirname $f2pypath`
# Make sure we have a folder to put everything in
if [ ! -d "bin" ]; then
mkdir bin
fi
# Compile the fortran code
#2D
cd fdtd
$f2pypath/f2py3 -c --fcompiler=gnu95 -m emfdtd2d emFDTD2D.f95
$f2pypath/f2py3 -c --fcompiler=gnu95 -m seismicfdtd2d seismicFDTD2D.f95
$f2pypath/f2py3 -c --fcompiler=gnu95 -m emfdtd25d emFDTD25D.f95
$f2pypath/f2py3 -c --fcompiler=gnu95 -m seismicfdtd25d seismicFDTD25D.f95
mv *.so ../bin
cd ..
# Synthetic microstructure
cd materials
$f2pypath/f2py3 -c --fcompiler=gnu95 -m orientsynth orientsynth.f95
mv *.so ../bin
cd ..
# --------------------------- Create the executables --------------------------
# Start with the python scripts
cp exe/prjbuild.py bin/prjbuild
cp exe/prjrun.py bin/prjrun
cp exe/sourcefunction.py bin/sourcefunction
cp materials/orientation_tensor.py bin/orientation_tensor
# cp materials/class_definitions.py bin/class_definitions
# Move the visualization tools
cp vis/arrayplot.py bin/arrayplot
cp vis/rcxdisplay.py bin/rcxdisplay
cp vis/im2anim.py bin/im2anim
cp vis/vtkbuild.py bin/vtkbuild
# move the conversion scripts
cp io/array2segy.py bin/array2segy
# Change them to executables
chmod +x bin/prjbuild \
bin/prjrun \
bin/sourcefunction \
bin/arrayplot \
bin/rcxdisplay \
bin/im2anim \
bin/orientation_tensor \
bin/array2segy \
bin/vtkbuild
# Now do the bash scripts
cp survey_wrappers/wide_angle bin/wide_angle
cp survey_wrappers/common_offset bin/common_offset
cp survey_wrappers/common_midpoint bin/common_midpoint
cp io/array2sac bin/array2sac
chmod +x bin/wide_angle bin/common_offset bin/common_midpoint bin/array2sac
# ---------------- Move all other required files to bin folder ----------------
cp materials/material_functions.py bin/material_functions.py
cp materials/class_definitions.py bin/class_definitions.py
| true
|
a3bbc51b850df56359b67ea2a83321238142d81f
|
Shell
|
matteary/advanced_autoscaling_workbook
|
/workers/_help
|
UTF-8
| 464
| 3.609375
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
function f_print_help(){
echo -e "\n\tUsage: ./`basename \"$0\"` [ --deploy | --cleanup | --increase-traffic | --help ]\n"
echo -e "\t\t--deploy\t\tDeploys the Advanced Autocaling Workbook environment"
echo -e "\t\t--cleanup\t\tTears down the Advance Autoscaling Workbook environment"
echo -e "\t\t--increase-Load\t\tRuns processes in autoscaled instances to spike CPUUtilization"
echo -e "\t\t--help\t\t\tDisplays this message\n"
}
| true
|
6123abfe613c4f923d2ff5841460bae4aa445f69
|
Shell
|
calbach/dsub
|
/examples/custom_scripts/submit_list.sh
|
UTF-8
| 1,792
| 3.75
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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.
# submit_list.sh
#
# Usage:
# submit_list.sh PROJECT-ID BUCKET SCRIPT
#
# Wrapper script to decompress a list of VCF files and copy each to a
# Cloud Storage bucket. Each VCF is decompressed as a separate task.
#
# Edit the submit_list.tsv file to replace MY-BUCKET with your bucket.
set -o errexit
set -o nounset
readonly SCRIPT_DIR="$(dirname "${0}")"
if [[ $# -ne 3 ]]; then
2>&1 echo "Usage: ${0} project-id bucket script"
2>&1 echo
2>&1 echo " script is either of:"
2>&1 echo " ${SCRIPT_DIR}/get_vcf_sample_ids.sh"
2>&1 echo " ${SCRIPT_DIR}/get_vcf_sample_ids.py"
exit 1
fi
readonly MY_PROJECT=${1}
readonly MY_BUCKET_PATH=${2}
readonly SCRIPT=${3}
declare IMAGE="ubuntu:14.04"
if [[ ${SCRIPT} == *.py ]]; then
IMAGE="python:2.7"
fi
readonly IMAGE
readonly OUTPUT_ROOT="gs://${MY_BUCKET_PATH}/get_vcf_sample_ids"
readonly LOGGING="${OUTPUT_ROOT}/logging"
echo "Logging will be written to:"
echo " ${LOGGING}"
echo
# Launch the task
dsub \
--project "${MY_PROJECT}" \
--zones "us-central1-*" \
--logging "${LOGGING}" \
--disk-size 200 \
--image "${IMAGE}" \
--script "${SCRIPT}" \
--tasks "${SCRIPT_DIR}"/submit_list.tsv \
--wait
| true
|
dadbfbcbedbfeaed4a4f9c2c95188e0c3bbde574
|
Shell
|
identinetics/d-sigver
|
/conf.sh.default
|
UTF-8
| 1,178
| 3.296875
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
main() {
SCRIPTDIR=$(cd $(dirname $BASH_SOURCE[0]) && pwd)
source $SCRIPTDIR/dscripts/conf_lib.sh $@ # load library functions
configlib_version=2 # compatible version of conf_lib.sh
check_version $configlib_version
init_sudo
_set_image_and_container_name
_set_buildargs
_set_run_args
}
_set_image_and_container_name() {
PROJSHORT='xmldsigver'
export IMAGENAME="rhoerbe/$PROJSHORT"
export CONTAINERNAME="$PROJSHORT"
}
_set_buildargs() {
export BUILDARGS=""
}
_set_run_args() {
export ENVSETTINGS="
-e SIGNED_XMLFILE=$SIGNED_XMLFILE
-e CERTFILE=$CERTFILE
-e MDSIGN_CERT=/etc/pki/sign/certs/metadata_crt.pem
-e MDSIGN_KEY=/etc/pki/sign/private/metadata_key.pem
-e MD_AGGREGATE=/var/md_feed/metadata.xml
"
export STARTCMD=''
}
create_intercontainer_network() {
export NETWORKSETTINGS=""
}
setup_vol_mapping() {
VOLLIST=''
VOLMAPPING="-v $PWD/work:/work:Z"
if [[ ! -d $PWD/work ]]; then
echo 'Error: missing directory ./work'
exit 1
fi
chmod 777 $PWD/work # container user reuqires write access
}
main $@
| true
|
15984219b7e361ce3c20b3e9b7a62d4efabd2986
|
Shell
|
TIBCOSoftware/dovetail-contrib
|
/hyperledger-fabric/operation/namespace/k8s-namespace.sh
|
UTF-8
| 4,459
| 4.21875
| 4
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
#!/bin/bash
# Copyright © 2018. TIBCO Software Inc.
#
# This file is subject to the license terms contained
# in the license file that is distributed with this file.
# create k8s namespace for a specified org,
# if the optional target env is az, create the storage account secret based on config file in $HOME/.azure/store-secret
# usage: k8s-namespace.sh <cmd> [-p <property file>] [-t <env type>]
# where property file is specified in ../config/org_name.env, e.g.
# k8s-namespace.sh create -p netop1 -t az
# use config parameters specified in ../config/netop1.env
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; echo "$(pwd)")"
function printK8sNamespace {
echo "
apiVersion: v1
kind: Namespace
metadata:
name: ${ORG}
labels:
use: hyperledger"
}
# create azure-secret yaml
function printAzureSecretYaml {
user=$(echo -n "${STORAGE_ACCT}" | base64 -w 0)
key=$(echo -n "${STORAGE_KEY}" | base64 -w 0)
echo "---
apiVersion: v1
kind: Secret
metadata:
name: azure-secret
namespace: ${ORG}
type: Opaque
data:
azurestorageaccountname: ${user}
azurestorageaccountkey: ${key}"
}
# set k8s default namespace
function setDefaultNamespace {
local curr=$(kubectl config current-context)
local c_namespace=$(kubectl config view -o=jsonpath="{.contexts[?(@.name=='${curr}')].context.namespace}")
if [ "${c_namespace}" != "${ORG}" ]; then
local c_user=$(kubectl config view -o=jsonpath="{.contexts[?(@.name=='${curr}')].context.user}")
local c_cluster=$(kubectl config view -o=jsonpath="{.contexts[?(@.name=='${curr}')].context.cluster}")
if [ ! -z "${c_cluster}" ]; then
echo "set default kube namespace ${ORG} for cluster ${c_cluster} and user ${c_user}"
kubectl config set-context ${ORG} --namespace=${ORG} --cluster=${c_cluster} --user=${c_user}
kubectl config use-context ${ORG}
else
echo "failed to set default context for namespace ${ORG}"
fi
else
echo "namespace ${ORG} is already set as default"
fi
}
function createNamespace {
${sumd} -p ${DATA_ROOT}/namespace/k8s
echo "check if namespace ${ORG} exists"
kubectl get namespace ${ORG}
if [ "$?" -ne 0 ]; then
echo "create k8s namespace ${ORG}"
printK8sNamespace | ${stee} ${DATA_ROOT}/namespace/k8s/namespace.yaml > /dev/null
kubectl create -f ${DATA_ROOT}/namespace/k8s/namespace.yaml
fi
if [ "${ENV_TYPE}" == "az" ]; then
# create secret for Azure File storage
echo "create Azure storage secret"
printAzureSecretYaml | ${stee} ${DATA_ROOT}/namespace/k8s/azure-secret.yaml > /dev/null
kubectl create -f ${DATA_ROOT}/namespace/k8s/azure-secret.yaml
fi
setDefaultNamespace
}
function deleteNamespace {
kubectl delete -f ${DATA_ROOT}/namespace/k8s/namespace.yaml
if [ "${ENV_TYPE}" == "az" ]; then
kubectl delete -f ${DATA_ROOT}/namespace/k8s/azure-secret.yaml
fi
}
# Print the usage message
function printHelp() {
echo "Usage: "
echo " k8s-namespace.sh <cmd> [-p <property file>] [-t <env type>]"
echo " <cmd> - one of 'create', or 'delete'"
echo " - 'create' - create k8s namespace for the organization defined in network spec; for Azure, also create storage secret"
echo " - 'delete' - delete k8s namespace, for Azure, also delete the storage secret"
echo " -p <property file> - the .env file in config folder that defines network properties, e.g., netop1 (default)"
echo " -t <env type> - deployment environment type: one of 'k8s' (default), 'aws', 'az', or 'gcp'"
echo " k8s-namespace.sh -h (print this message)"
}
ORG_ENV="netop1"
CMD=${1}
shift
while getopts "h?p:t:" opt; do
case "$opt" in
h | \?)
printHelp
exit 0
;;
p)
ORG_ENV=$OPTARG
;;
t)
ENV_TYPE=$OPTARG
;;
esac
done
source $(dirname "${SCRIPT_DIR}")/config/setup.sh ${ORG_ENV} ${ENV_TYPE}
if [ "${ENV_TYPE}" == "az" ]; then
# read secret key for Azure storage account
source ${HOME}/.azure/store-secret
if [ -z "${STORAGE_ACCT}" ] || [ -z "${STORAGE_KEY}" ]; then
echo "Error: 'STORAGE_ACCT' and 'STORAGE_KEY' must be set in ${HOME}/.azure/store-secret for Azure"
exit 1
fi
elif [ "${ENV_TYPE}" == "docker" ]; then
echo "No need to create namespace for docker"
exit 0
fi
case "${CMD}" in
create)
echo "create namespace ${ORG} for: ${ORG_ENV} ${ENV_TYPE}"
createNamespace
;;
delete)
echo "delete namespace ${ORG}: ${ORG_ENV} ${ENV_TYPE}"
deleteNamespace
;;
*)
printHelp
exit 1
esac
| true
|
bceb4475ae05b41f794a8c7a4233e2341f7c723e
|
Shell
|
Pey-crypto/Experiments
|
/cal.sh
|
UTF-8
| 890
| 4.03125
| 4
|
[] |
no_license
|
#!/bin/sh
echo "======================="
echo ""
echo "Hello there this script runs a menu driven calculator"
echo ""
echo "======================="
echo "Enter your First integer"
read n1
echo "Enter your Second integer"
read n2
echo "These are the values"
echo "First value $n1"
echo "Second value $n2"
i="y"
while [ $i = "y" ]
do
echo "The value $i"
echo "These are the available operations"
echo "Addition = (+) "
echo "Subtraction = (-)"
echo "Division = (\)"
echo "Modulus = (%)"
echo "Multiplication = (*)"
read n3
case $n3 in
+) n4=`expr $n1 + $n2`;;
-) n4=`expr $n1 - $n2`;;
/) n4=`expr $n1 / $n2`;;
%) n4=`expr $n1 % $n2`;;
*) n4=`expr $n1 \* $n2`;;
esac
echo ""
echo "The result is $n4"
echo ""
echo "Do you want the loop run again"
read i
echo "The value $i"
done
| true
|
24f9c355b83a8b17d6358a3fea0a7c13b6557e7b
|
Shell
|
petronny/aur3-mirror
|
/opengazer/PKGBUILD
|
UTF-8
| 1,068
| 2.59375
| 3
|
[] |
no_license
|
# Contributor: Muhammad Qadri <Muhammad dot A dot Qadri at gmail dot com>
pkgname=opengazer
pkgver=0.1.2
pkgrel=1
pkgdesc="Application that uses an ordinary webcam to estimate the direction of your gaze."
arch=('i686')
url="http://www.inference.phy.cam.ac.uk/opengazer/"
license=('GPL2')
depends=('vxl' 'opencv>=0.97' 'gtkmm>=2.8.0' 'cairomm>=1.6.0' 'boost>=1.32.0')
options=()
install=$pkgname.install
source=("http://www.inference.phy.cam.ac.uk/opengazer/$pkgname-$pkgver.tar.gz"
"opengazer.patch")
md5sums=('2c5d856850b20d030989893351374778'
'74c89e2b61d500b7c718fab518aec636')
build() {
cd "$srcdir/$pkgname-$pkgver"
msg "Applying patch"
patch -p1 -i ../opengazer.patch
msg 'Running make'
make || return 1
}
package() {
install -Dm755 $srcdir/$pkgname-$pkgver/opengazer $pkgdir/usr/bin/opengazer
install -Dm644 $srcdir/$pkgname-$pkgver/haarcascade_frontalface_alt.xml $pkgdir/usr/share/$pkgname/haarcascade_frontalface_alt.xml
install -Dm644 $srcdir/$pkgname-$pkgver/calpoints.txt $pkgdir/usr/share/$pkgname/calpoints.txt
}
# vim:set ts=2 sw=2 et:
| true
|
6419e1583295bf723cf308f2b11c735e1ade2f04
|
Shell
|
dkoenig-tutos/poc-kerberos-linux
|
/scripts/nfs_server_setup.sh
|
UTF-8
| 1,361
| 2.90625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
set -ex
echo '##########################################################################'
echo '##### Script de configuration du serveur NFS : nfs_server_setup.sh'
echo '##########################################################################'
# setsebool -P nfs_export_all_rw 1
# setsebool -P nfs_export_all_ro 1
# getsebool -a | grep nfs_export
# systemctl start firewalld
# systemctl enable firewalld
# firewall-cmd --permanent --add-service=nfs
# firewall-cmd --permanent --add-service=mountd
# firewall-cmd --permanent --add-service=rpc-bind
# systemctl restart firewalld
yum install -y nfs-utils
#mkdir -p /nfs/export_ro
mkdir -p /nfs/export_rw
chown nfsnobody:nobody /nfs/export_rw
chmod 775 /nfs/export_rw
# semanage fcontext -a -t public_content_rw_t "/nfs/export_rw(/.*)?"
# restorecon -Rv /nfs/export_rw
clienthostname=$(hostname -f)
kadmin <<EOF
MotDePasse
addprinc -randkey nfs/$clienthostname
ktadd nfs/$clienthostname
quit
EOF
# Faire 'man exports' pour voir des exemples de configurations
# echo '/nfs/export_ro *(sync)' > /etc/exports
echo '/nfs/export_rw *(rw,no_root_squash,sec=krb5)' >> /etc/exports
systemctl start nfs-server
systemctl enable nfs-server
# Il est possible de confirmer le bon fonctionnement avec les commandes suivantes :
# showmount -e localhost
# et :
# cat /var/lib/nfs/etab
exit 0
| true
|
be7a023b9a51352ca48a9cedf6aa9c11e442e9b2
|
Shell
|
networkgangster/Projectwork
|
/monitoring-instance-userdata.sh.tpl
|
UTF-8
| 11,717
| 2.703125
| 3
|
[] |
no_license
|
#!/bin/bash
# Stop if error occurs
set -e
# source: https://fh-cloud-computing.github.io/exercises/3-containers/
# Install docker
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
# Create shared directory for service discovery config
mkdir -p /srv/service-discovery/
chmod a+rwx /srv/service-discovery/
# Write Prometheus config
cat <<EOCF >/srv/prometheus.yml
global:
scrape_interval: 30s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'exoscale'
file_sd_configs:
- files:
- /srv/service-discovery/config.json
refresh_interval: 10s
EOCF
# write service discovery config
cat <<EOCF >/srv/service-discovery/config.json
[{"target":[],"labels":{}}]
EOCF
chmod a+rwx /srv/service-discovery/config.json
# Create shared directory for grafana datasources
mkdir -p /srv/grafana/provisioning/datasources/
chmod a+rwx /srv/grafana/provisioning/datasources/
# source: https://fh-cloud-computing.github.io/exercises/5-grafana/
# write data source config
cat <<EOCF >/srv/grafana/provisioning/datasources/prom.yml
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
version: 1
editable: false
EOCF
# Create shared directory for grafana notifiers
mkdir -p /srv/grafana/provisioning/notifiers/
chmod a+rwx /srv/grafana/provisioning/notifiers/
#source: https://fh-cloud-computing.github.io/exercises/5-grafana/
# write notifier config
cat <<EOCF >/srv/grafana/provisioning/notifiers/notifiers.yml
notifiers:
- name: Scale up
type: webhook
uid: FG1mrWBMk
org_id: 1
is_default: false
send_reminder: true
disable_resolve_message: true
frequency: "5m"
settings:
autoResolve: true
httpMethod: "POST"
severity: "critical"
uploadImage: false
url: "http://autoscaler:8090/up"
- name: Scale down
type: webhook
uid: cMhOCZBGz
org_id: 1
is_default: false
send_reminder: true
disable_resolve_message: true
frequency: "5m"
settings:
autoResolve: true
httpMethod: "POST"
severity: "critical"
uploadImage: false
url: "http://autoscaler:8090/down"
EOCF
# Create shared directory for grafana dashboard config
mkdir -p /srv/grafana/provisioning/dashboards/
chmod a+rwx /srv/grafana/provisioning/dashboards/
# source: https://fh-cloud-computing.github.io/exercises/5-grafana/
# write dashboard config
cat <<EOCF >/srv/grafana/provisioning/dashboards/dashboard.yml
apiVersion: 1
providers:
- name: 'Home'
orgId: 1
folder: ''
type: file
updateIntervalSeconds: 10
options:
path: /etc/grafana/dashboards
EOCF
# Create shared directory for grafana dashboard
mkdir -p /srv/grafana/dashboards/
chmod a+rwx /srv/grafana/dashboards/
# write dashboard json
cat <<EOCF >/srv/grafana/dashboards/dashboard.json
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 1,
"links": [],
"panels": [
{
"alert": {
"alertRuleTags": {},
"conditions": [
{
"evaluator": {
"params": [
0.8
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A",
"1m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "1m",
"frequency": "1m",
"handler": 1,
"name": "highCPU",
"noDataState": "no_data",
"notifications": [
{
"uid": "FG1mrWBMk"
}
]
},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "avg(\r\n sum by (instance) (rate(node_cpu_seconds_total{mode!=\"idle\"}[1m])) /\r\n sum by (instance) (rate(node_cpu_seconds_total[1m]))\r\n)",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 0.8
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Panel Title",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": 1,
"format": "short",
"label": null,
"logBase": 1,
"max": "1",
"min": "0",
"show": true
},
{
"decimals": 1,
"format": "short",
"label": null,
"logBase": 1,
"max": "1",
"min": "0",
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"alert": {
"alertRuleTags": {},
"conditions": [
{
"evaluator": {
"params": [
0.2
],
"type": "lt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A",
"1m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "1m",
"frequency": "1m",
"handler": 1,
"name": "lowCPU",
"noDataState": "no_data",
"notifications": [
{
"uid": "cMhOCZBGz"
}
]
},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 0
},
"hiddenSeries": false,
"id": 3,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.3.7",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "avg(\r\n sum by (instance) (rate(node_cpu_seconds_total{mode!=\"idle\"}[1m])) /\r\n sum by (instance) (rate(node_cpu_seconds_total[1m]))\r\n)",
"interval": "",
"legendFormat": "",
"queryType": "randomWalk",
"refId": "A"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "lt",
"value": 0.2
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Panel Title",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": 1,
"format": "short",
"label": null,
"logBase": 1,
"max": "1",
"min": "0",
"show": true
},
{
"decimals": 1,
"format": "short",
"label": null,
"logBase": 1,
"max": "1",
"min": "0",
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"schemaVersion": 26,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "sprint3",
"uid": "HzrJKGfMz",
"version": 2
}
EOCF
# Create the network
docker network create monitoring
# source: https://github.com/FH-Cloud-Computing/sprint-2/
# Run service discovery agent
docker run \
-d \
--name sd \
--network monitoring \
-v /srv/service-discovery:/var/run/prometheus-sd-exoscale-instance-pools \
quay.io/janoszen/prometheus-sd-exoscale-instance-pools:1.0.0 \
--exoscale-api-key ${exoscale_key} \
--exoscale-api-secret ${exoscale_secret} \
--exoscale-zone-id ${exoscale_zone_id} \
--instance-pool-id ${instance_pool_id}
# source: https://github.com/FH-Cloud-Computing/sprint-2/
# Run Prometheus
docker run -d \
-p 9090:9090 \
--name prometheus \
--network monitoring \
-v /srv/prometheus.yml:/etc/prometheus/prometheus.yml \
-v /srv/service-discovery/:/srv/service-discovery/ \
prom/prometheus
# Run Grafana
docker run -d \
-p 3000:3000 \
--name grafana \
--network monitoring \
-v /srv/grafana/provisioning/datasources/prom.yml:/etc/grafana/provisioning/datasources/prom.yml \
-v /srv/grafana/provisioning/notifiers/notifiers.yml:/etc/grafana/provisioning/notifiers/notifiers.yml \
-v /srv/grafana/provisioning/dashboards/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml \
-v /srv/grafana/dashboards/dashboard.json:/etc/grafana/dashboards/dashboard.json \
grafana/grafana
# source: https://github.com/janoszen/exoscale-grafana-autoscaler
# Run autoscaler
sudo docker run -d \
-p 8090:8090 \
--name autoscaler \
--network monitoring \
janoszen/exoscale-grafana-autoscaler:1.0.2 \
--exoscale-api-key ${exoscale_key} \
--exoscale-api-secret ${exoscale_secret} \
--exoscale-zone-id ${exoscale_zone_id} \
--instance-pool-id ${instance_pool_id}
| true
|
c684aa26aff1edd4af173de7f72fd7ca9593a8e0
|
Shell
|
lliurex/flash-java-insecure-perms
|
/usr/bin/flash-java-insecure-perms
|
UTF-8
| 6,948
| 3.375
| 3
|
[] |
no_license
|
#!/bin/bash
#0 = autosize
HEIGHT=0
WIDTH=0
LIST_HEIGHT=0
ICED=$(which itweb-settings)
KEYTOOL=$(which keytool)
IAM=$(id -u)
MYNAME=$(id -un)
if [ "${IAM}" = "0" ]; then
USERS=$(getent passwd |cut -d: -f4|sort -h|uniq|egrep ^[0-9]{4}|xargs -n1 getent passwd|cut -d: -f1)
if [ "x$1" = "xinstall" ]; then
OLDIFS=$IFS;
IFS=$'\n'
for x in ${USERS} ; do
#str+=( $(printf '%10.10s' $x) $(printf '%30.30s' " ") $(printf '%10.10s' "on"))
str+=( $x " " off )
done
DIALOG=$(whiptail --separate-output --title "Users selection" --checklist "Select users to modify flash/java settings" $HEIGHT $WIDTH $LIST_HEIGHT ${str[@]} 3>&1 1>&2 2>&3)
ret=$?
IFS=$OLDIFS;
if [ $ret != 0 ]; then
echo Canceled!
fi
fi
else
USERS=${MYNAME}
DIALOG=${MYNAME}
fi
CERTPATHS=".config/icedtea-web/security .java/deployment/security"
DONE=0
if [ "x$1" = "xinstall" ]; then
for user in ${DIALOG}; do
DATE=$(date '+%Y%m%d%H%M%S')
if [ ! -f "/home/$user/.config/unsec_settings_on" ]; then
# JAVA
if [ ! -z "${ICED}" ]; then
if [ "${IAM}" = "0" ];then
sudo su $user bash -c "${ICED} -headless set deployment.security.level ALLOW_UNSIGNED"
else
${ICED} -headless set deployment.security.level ALLOW_UNSIGNED
fi
fi
for cert in $(find /usr/share/flash-java-insecure-perms/ -name '*.cert');do
certname=$(basename ${cert%%.cert})
#echo Importing into trusted.certs ${certname}.cert
for certpath in ${CERTPATHS}; do
if [ ! -f "/home/$user/${certpath}/trusted.certs" ]; then
mkdir -p /home/$user/${certpath}
${KEYTOOL} -genkey -alias recursos -keyalg RSA -keystore /home/$user/${certpath}/trusted.certs -keypass changeit -storepass changeit -keysize 2048 -dname "CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown" > /dev/null 2> /dev/null
${KEYTOOL} -delete -alias recursos -keystore /home/$user/${certpath}/trusted.certs -storepass changeit > /dev/null 2> /dev/null
if [ "${IAM}" = "0" ]; then
chown -R ${user}:${user} /home/$user/${certpath}/
fi
fi
$KEYTOOL -importcert -trustcacerts -storepass "changeit" -keystore /home/$user/${certpath}/trusted.certs -file ${cert} -alias ${certname} -noprompt > /dev/null 2> /dev/null
done
done
#FLASH
if [ ! -d "/home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys" ]; then
mkdir -p /home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys
fi
if [ ! -d "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust" ]; then
mkdir -p "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust"
fi
if [ -f "/home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/settings.sol" ]; then
mv /home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/settings.sol /home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/settings-${DATE}.sol
fi
if [ -f "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust/recursos.cfg" ]; then
mv "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust/recursos.cfg" "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust/recursos-${DATE}.cfg"
fi
cp /usr/share/flash-java-insecure-perms/settings.sol /home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys
cp /usr/share/flash-java-insecure-perms/recursos.cfg "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust/recursos.cfg"
chown -R ${user}:${user} /home/$user/.macromedia
touch /home/$user/.config/unsec_settings_on
#FIREFOX
if [ ! -d "/home/$user/.mozilla" ]; then
mkdir -p /home/$user/.mozilla
if [ "${IAM}" = "0" ]; then
chown -R ${user}:${user} /home/$user/.mozilla
sudo su $user bash -c "firefox" &
else
firefox &
fi
sleep 2
fi
$(pkill -u $user --signal 9 firefox >/dev/null 2>/dev/null) >/dev/null 2>/dev/null
for pref in $(find /home/$user/.mozilla -name 'prefs.js'); do
sed -i -r 's%.*plugin\.state\.java.*%%' $pref
sed -i -r 's%.*plugin\.state\.flash.*%%' $pref
sed -i -r 's%.*plugins\.click_to_play.*%%' $pref
sed -i -r 's%.*plugins\.hide_infobar_for_outdated_plugin.*%%' $pref
sed -i -r 's%.*extensions\.blocklist\.enabled.*%%' $pref
# USE ECHO WHEN THERE ISN'T SOME SETTING INTO FILE
echo 'user_pref("plugin.state.java",2);' >> $pref
echo 'user_pref("plugin.state.flash",2);' >> $pref
echo 'user_pref("plugins.click_to_play",false);' >> $pref
echo 'user_pref("plugins.hide_infobar_for_outdated_plugin",true);' >> $pref
echo 'user_pref("extensions.blocklist.enabled",false);' >> $pref
done
else
echo Already configured!
fi
done
DONE=1
fi
if [ "x$1" = "xdeinstall" ]; then
for user in ${USERS}; do
if [ -f "/home/$user/.config/unsec_settings_on" ]; then
echo Deconfiguring $user!
#FLASH
file1=$(find /home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys -maxdepth 1 -name '*.sol'|grep 'settings-'|sort -h|uniq|head -1)
if [ ! -z "$file1" ]; then
mv $file1 /home/$user/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/settings.sol
fi
if [ -f "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust/recursos.cfg" ]; then
rm -f "/home/$user/.macromedia/Flash_Player/#Security/FlashPlayerTrust/recursos.cfg"
fi
#JAVA
if [ ! -z "${ICED}" ]; then
if [ "${IAM}" = "0" ];then
sudo su $user bash -c "${ICED} -headless reset deployment.security.level"
else
${ICED} -headless reset deployment.security.level
fi
fi
for cert in $(find /usr/share/flash-java-insecure-perms/ -name '*.cert');do
certname=$(basename ${cert%%.cert})
#echo Deleting ${certname}.cert from trusted.certs
for certpath in ${CERTPATHS}; do
if [ -f "/home/$user/${certpath}/trusted.certs" ]; then
$KEYTOOL -delete -storepass "changeit" -keystore /home/$user/${certpath}/trusted.certs -alias ${certname} > /dev/null 2> /dev/null
fi
done
done
rm /home/$user/.config/unsec_settings_on
$(pkill -u $user --signal 9 firefox >/dev/null 2>/dev/null) >/dev/null 2>/dev/null
for pref in $(find /home/$user/.mozilla -name 'prefs.js'); do
sed -i -r 's%.*plugin\.state\.java.*%user_pref("plugin.state.java",1);%' $pref
sed -i -r 's%.*plugin\.state\.flash.*%user_pref("plugin.state.flash",1);%' $pref
sed -i -r 's%.*plugins\.click_to_play.*%user_pref("plugins.click_to_play",true);%' $pref
sed -i -r 's%.*plugins\.hide_infobar_for_outdated_plugin.*%user_pref("plugins.hide_infobar_for_outdated_plugin",false);%' $pref
sed -i -r 's%.*extensions\.blocklist\.enabled.*%user_pref("extensions.blocklist.enabled",true);%' $pref
done
fi
done
DONE=1
fi
if [ ${DONE} -eq 0 ]; then
echo "$(basename $0) help"
echo "$(basename $0) [ install | deinstall ]"
echo "Changes permission to allow some educational resources with java/flash"
fi
| true
|
a30d7995afb2a1a9d2a80be5c57c3d771a9f3eab
|
Shell
|
evrimulgen/Oracle-DBA-Life
|
/INFO/Books Codes/Oracle9i UNIX Administration Handbook/check_filesystem_size.ksh
|
UTF-8
| 334
| 3.390625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/ksh
for i in `df -k|grep /u0|awk '{ print $4 }'`
do
# Convert the file size to a numeric value
filesize=`expr i`
# If any filesystem has less than 100k, issue an alert
if [ $filesize -lt 100 ]
then
mailx -s "Oracle filesystem $i has less than 100k free."\
don@burleson.cc\
lawrence_ellison@oracle.com
fi
done
| true
|
7ce5567bfe1dc9a226c2254bcf85dc296ffe05a4
|
Shell
|
borkabrak/binfiles
|
/git-diff-remote
|
UTF-8
| 457
| 3.09375
| 3
|
[] |
no_license
|
#!/usr/bin/env zscript
# vim: ft=zsh
#
# git-diff-remote - diff the current branch with its remote counterpart
#
#
# This display a side-by-side comparison of which commits are unique to each branch.
# Confirm dependencies
require pygmentize diff git
# Get the current branch name
branch=$(git rev-parse --abbrev-ref HEAD)
logcmd=(git log --oneline)
diff -y -W156 =($logcmd origin/$branch..$branch) =($logcmd $branch..origin/$branch) | pygmentize -g
| true
|
eb1c0c3b1cbf431a10bb4547ecc808c36de158c6
|
Shell
|
BubbleTeaAdventure/clash-premium-installer
|
/scripts/setup-tun.sh
|
UTF-8
| 1,570
| 2.609375
| 3
|
[] |
no_license
|
#!/bin/bash
PROXY_BYPASS_CGROUP="0x16200000"
PROXY_FWMARK="0x162"
PROXY_ROUTE_TABLE="0x162"
PROXY_TUN_DEVICE_NAME="utun"
/usr/local/lib/clash/clean-tun.sh
sleep 0.5
/usr/local/lib/clash/setup-cgroup.sh
ip route replace default dev "$PROXY_TUN_DEVICE_NAME" table "$PROXY_ROUTE_TABLE"
ip rule add fwmark "$PROXY_FWMARK" lookup "$PROXY_ROUTE_TABLE"
iptables -t mangle -N CLASH
iptables -t mangle -F CLASH
iptables -t mangle -A CLASH -m cgroup --cgroup "$PROXY_BYPASS_CGROUP" -j RETURN
iptables -t mangle -A CLASH -p tcp --dport 53 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A CLASH -p udp --dport 53 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A CLASH -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A CLASH -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A CLASH -d 192.168.0.0/16 -j RETURN
iptables -t mangle -A CLASH -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A CLASH -d 198.18.0.0/16 -j RETURN
iptables -t mangle -A CLASH -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -N CLASH_FORWARD
iptables -t mangle -F CLASH_FORWARD
iptables -t mangle -A CLASH_FORWARD -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A CLASH_FORWARD -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A CLASH_FORWARD -d 192.168.0.0/16 -j RETURN
iptables -t mangle -A CLASH_FORWARD -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A CLASH_FORWARD -d 198.18.0.0/16 -j RETURN
iptables -t mangle -A CLASH_FORWARD -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -I OUTPUT -j CLASH
iptables -t mangle -I PREROUTING -j CLASH_FORWARD
sysctl -w net/ipv4/ip_forward=1
exit 0
| true
|
2825d742ac6226af383b080694abc6f3b5e1b343
|
Shell
|
SampleUser0001/Use_dat_sh
|
/use.sh
|
UTF-8
| 221
| 3
| 3
|
[] |
no_license
|
#!/bin/bash
filename=./build.dat
while read data; do
first=`echo ${data} | cut -d , -f 1`
second=`echo ${data} | cut -d , -f 2`
echo $first
echo $second
echo "---"
done << END
`cat ${filename}`
END
| true
|
321db9041cb0e2c8f8b7ea85230abe521cd9f0b0
|
Shell
|
croepha/rpi
|
/gles2_drm/build.sh
|
UTF-8
| 1,813
| 3.125
| 3
|
[
"Unlicense"
] |
permissive
|
#!/bin/bash
set -eu
curl -Lf https://dri.freedesktop.org/libdrm/libdrm-2.4.94.tar.bz2 | tar -xj
curl -Lf https://mesa.freedesktop.org/archive/mesa-18.2.0-rc5.tar.xz | tar -xJ
cd libdrm-2.4.94
LDFLAGS="--sysroot=${SYSROOT} -Wl,-rpath=\\\$\$ORIGIN" \
./configure \
--host=${TARGET} --enable-vc4 \
--disable-intel --disable-radeon --disable-amdgpu \
--disable-nouveau --disable-vmwgfx --disable-freedreno \
--disable-libkms --disable-cairo-tests --disable-valgrind \
--disable-manpages
make -j`nproc`
make -j`nproc` install DESTDIR="${SYSROOT}"
cd ..
# mesa seems to want to always use inline ARM NEON code when compiling for
# any ARM target, but armv6 does not support NEON
# we want to disable inline ARM NEON code unless NEON is allowed (rpi2 & rpi3)
if [[ `cat ${CC}` = *"neon"* ]] || [[ `cat ${CC}` = *"armv8-a"* ]]; then
DISABLE_ASM=
else
DISABLE_ASM=--disable-asm
fi
cd mesa-18.2.0-rc5
CFLAGS="-O2 -fPIC -Wall -fno-math-errno -fno-trapping-math -ffast-math -DDEFAULT_DRIVER_DIR=\\\"\\\$\$ORIGIN\\\"" \
CXXFLAGS="${CFLAGS}" \
LDFLAGS="--sysroot=${SYSROOT} -Wl,-rpath=\\\$\$ORIGIN" \
./configure \
--host=${TARGET} ${DISABLE_ASM} \
--with-platforms=drm --with-gallium-drivers=vc4 --without-dri-drivers \
--enable-gbm --enable-egl --enable-gles2 --disable-gles1 --disable-glx \
--disable-osmesa --disable-libunwind --disable-dri3 --disable-llvm \
--disable-valgrind --disable-xa --disable-xvmc --disable-vdpau --disable-va
make -j`nproc`
make -j`nproc` install DESTDIR="${SYSROOT}"
cd ..
rm -rf libdrm-2.4.94 mesa-18.2.0-rc5
for f in libgbm.so libglapi.so libEGL.so libGLESv2.so dri/vc4_dri.so;
do
"${TOOLCHAIN}"/bin/llvm-objcopy -strip-unneeded `realpath "${SYSROOT}"/usr/local/lib/"${f}"`
chrpath -r '$ORIGIN' "${SYSROOT}"/usr/local/lib/"${f}"
done
| true
|
b1a7ba40fb4e5e319449b6dfff988922080bf5e1
|
Shell
|
mgijax/littriageload
|
/bin/findNLMrefresh.sh
|
UTF-8
| 2,316
| 3.734375
| 4
|
[] |
no_license
|
#!/bin/sh
#
#
# findNLMrefresh.sh
#
# The purpose of this script is to:
#
# 1. query the database for References that are
# . reference type = Peer Reviewed Article
# . have pubmed id
# . do not have doi id
# . creation date of MGD Reference is between today-7 and today
# . relevance != discard
#
# 2. find the PDF (by using MGI ID) of the Reference in the Lit Triage Master folder
#
# 3. copy the PDF into the New_New/littriage_NLM_refresh folder
# this will process the PDF and add the DOI id during the next run of the Lit Triage load
#
cd `dirname $0`
COMMON_CONFIG=../littriageload.config
#
# Make sure the common configuration file exists and source it.
#
if [ -f ${COMMON_CONFIG} ]
then
. ${COMMON_CONFIG}
else
echo "Missing configuration file: ${COMMON_CONFIG}"
exit 1
fi
LOG=${LOG_NLMREFRESHFIND}
PDF=${LOG_NLMREFRESHPDF}
rm -rf ${LOG} ${PDF}
>>${LOG}
date | tee -a ${LOG}
cat - <<EOSQL | ${PG_DBUTILS}/bin/doisql.csh $0 | tee -a ${LOG}
select count(c.*)
from bib_citation_cache c, bib_refs r, bib_workflow_relevance v
where c.referencetype = 'Peer Reviewed Article'
and c.pubmedID is not null
and c.doiID is null
and c._refs_key = r._refs_key
and r.creation_date between (now() + interval '-7 day') and now()
and c._refs_key = v._refs_key
and v.isCurrent = 1
and v._relevance_key not in (70594666)
;
select c.mgiID, c.pubmedID
from bib_citation_cache c, bib_refs r, bib_workflow_relevance v
where c.referencetype = 'Peer Reviewed Article'
and c.pubmedID is not null
and c.doiID is null
and c._refs_key = r._refs_key
and r.creation_date between (now() + interval '-7 day') and now()
and c._refs_key = v._refs_key
and v.isCurrent = 1
and v._relevance_key not in (70594666)
;
EOSQL
cut -f1 -d"|" ${LOG} | grep MGI | sed 's/MGI://' > ${PDF}
ls -l ${PDF}
echo 'will copy PDFs to master folder....' | tee -a ${LOG}
echo $LITTRIAGE_MASTER | tee -a ${LOG}
cat ${PDF} | while read line
do
if [ -f ${LITTRIAGE_MASTER}/*/$line.pdf -a ! -f ${LITTRIAGE_NEWNEW}/littriage_update_pdf/$line.pdf ]
then
echo 'coping to littriage master folder', $line | tee -a ${LOG}
ls ${LITTRIAGE_MASTER}/*/$line.pdf
cp -r ${LITTRIAGE_MASTER}/*/$line.pdf ${LITTRIAGE_NEWNEW}/littriage_NLM_refresh
else
echo 'not copied to littriage master folder', $line | tee -a ${LOG}
fi
done
date | tee -a ${LOG}
| true
|
a5b1f0924ce11e0a3d1683e3afd53d31d9f456a4
|
Shell
|
maheshdongare1983/bashscript
|
/forloopstring.sh
|
UTF-8
| 97
| 2.890625
| 3
|
[] |
no_license
|
for i in `grep -l $oldString $searchFiles`; do
sed -i "s/${oldString}/${newString}/g" $i;
done
| true
|
f4880496436c07bf16991abdb480e4cddf330513
|
Shell
|
montagist/dotfiles
|
/most-recent-dirs/install.sh
|
UTF-8
| 504
| 3.046875
| 3
|
[] |
no_license
|
sqlite_exists=`command -v sqlite3`
is_mac=`command -v sw_vers`
if [[ $sqlite_exists == "" ]]; then
echo "Command history needs Sqlite3 to be installed!!!"
if [[ $is_mac == "" ]]; then
wget http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
else
curl "http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz" -o "sqlite-autoconf-3070603.tar.gz"
fi
tar xvfz sqlite-autoconf-3070603.tar.gz
cd sqlite-autoconf-3070603
./configure
make
make install
cd ..
fi
cat cd.sh >> ~/.profile
| true
|
fcbb1cc07fcd5e3b9fa808a443e1341c94af62de
|
Shell
|
rodrigoramos/dotfiles
|
/archive/polybar/launch.sh
|
UTF-8
| 760
| 3.34375
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
# Terminate already running bar instances
killall -q polybar
# Extract Wallpaper main color
export WALLPAPER_MAIN_COLOR=$(convert /tmp/wallpaper-remoto.jpg +dither -colors 3 -define histogram:unique-colors=true -format "%c" histogram:info: \
| grep -o -E -m 2 "#[^\s]*" \
| tail -n 1)
echo "Wallpaper main color is $WALLPAPER_MAIN_COLOR"
echo "---" | tee -a /tmp/polybar-botttom.log
outputs=($(xrandr --listactivemonitors | awk ' { print $4" "$3 } '))
export output=""
for (( i=0; i<${#outputs[@]}; i += 2))
do
output=${outputs[i]} # Output name
polybar bottom --reload >>/tmp/polybar-bottom.log 2>&1 &
sleep 1s
done
echo "Bars launched..."
| true
|
15c2b98569231ac74cd07d69e4edb93e2a22c2a2
|
Shell
|
colinbdclark/gpii-infra
|
/dev/test/bin/terragrunt_wrapper
|
UTF-8
| 3,969
| 3.796875
| 4
|
[
"BSD-3-Clause"
] |
permissive
|
#!/bin/sh
#
# This wrapper (rather naively) translates vanilla terraform commands, as
# provided by kitchen-terraform, into terragrunt *-all commands.
#
# validate -> nothing -- terragrunt downloads modules into a tmp folder which
# is not easy to get a hold of. For now, wel'l skip this step.
#
# plan -> nothing -- plan doesn't work when modules communicate via
# remote_state, which only happens on apply.
#
# plan -destroy -> destroy-all -- Since we skip the plan phase anyway, we
# invoke destroy-all immediately. We also write a signal file so that we skip
# the next apply (designed to consume the output of `plan -destroy`, but in our
# case it would just create the environment all over again).
#
# get -> nothing -- get doesn't work with terragrunt module style.
#
# show -> nothing -- show doesn't work with terragrunt module style. This is
# used by `kitchen destroy`, whereas we just `destroy-all`.
#
# apply -> apply-all, removing path to terraform.tfplan file (since we skip the
# plan step) and '-state-out=/path' (since it confuses our remote state
# situation -- note that this removes the isolation kitchen provides by using
# its own state file; i.e. kitchen will work directly on the user's
# terraform-managed resources in this environment rather than spinning up a
# separate environment).
#
# output -> output-all.
#
# Other subcommands are passed through as-is. 'version' is the only subcommand
# called by kitchen that isn't described above.
#
# Other notes:
#
# * Be careful with debug statements: kitchen expects 'output' to emit json and
# will complain if that doesn't happen.
#
# * This script should be a unit-tested ruby script but I'm hacking up this
# quick shell script as a proof of concept.
args="$*"
DRY_RUN=""
if echo "$args" | grep -Eq -- "--dry-run\b" ; then
DRY_RUN=1
fi
SKIP_NEXT_APPLY_FILE="terragrunt_wrapper.skip_next_apply"
if echo "$args" | grep -Eq "\W-state(-out)*=" ; then
state_dir=$(echo "$args" | ruby -pe '$_.gsub! /.*\W-state(-out)*=(\S+).*/, "\\2"')
state_dir=$(dirname "$state_dir")
fi
if [ -n "$state_dir" ] && echo "$args" | grep -Eq "\W-destroy" ; then
if [ -n "$DRY_RUN" ] ; then
echo "Dry run! Would have created: $state_dir/$SKIP_NEXT_APPLY_FILE"
else
touch "$state_dir/$SKIP_NEXT_APPLY_FILE"
fi
args=$(echo "$args" \
| ruby -pe '$_.gsub! /(\b)plan(\b)/, "\\1destroy-all\\2"' \
| ruby -pe '$_.gsub! /(\s)-destroy/, "\\1"' \
| ruby -pe '$_.gsub! %r{(\s)/\S*}, "\\1"' \
)
fi
if echo "$args" | grep -Eq "\bapply\b" && [ -n "$state_dir" ] && [ -f "$state_dir/$SKIP_NEXT_APPLY_FILE" ] ; then
echo "terragrunt_wrapper: Skipping this apply because the previous run specified '-destroy'"
echo "(which caused $state_dir/$SKIP_NEXT_APPLY_FILE to be created)."
echo "I am removing this file now."
rm -f "$state_dir/$SKIP_NEXT_APPLY_FILE"
exit 0
fi
if echo "$args" | grep -Eq "\b(validate|plan|get|show)\b" ; then
echo "terragrunt_wrapper: Skipping subcommand: $args"
exit 0
fi
args=$(echo "$args" \
| ruby -pe '$_.gsub! /(\b)(apply)(\b)/, "\\1\\2-all\\3"' \
| ruby -pe '$_.gsub! /(\b)(output)(\b)/, "\\1\\2-all\\3"' \
| ruby -pe '$_.gsub! /\S*terraform.tfplan/, ""' \
| ruby -pe '$_.gsub! /-state=\S*/, ""' \
)
cmd="terragrunt $args --terragrunt-non-interactive --terragrunt-source-update"
if echo "$cmd" | grep -Eq "\boutput-all\b" ; then
cmd="$cmd --terragrunt-ignore-dependency-errors"
fi
# This must go (almost) last since it introduces a pipeline.
if echo "$cmd" | grep -Eq "\W-json\b" ; then
cmd="$cmd | jq -s 'add'"
fi
# Repeat this check because this trap for non-zero exit needs to be the very last thing.
if echo "$cmd" | grep -Eq "\boutput-all\b" ; then
cmd="$cmd || >&2 echo \"Command ($cmd) exited non-zero. I'm returning zero anyway to cover failures in output-all.\""
fi
if [ -n "$DRY_RUN" ] ; then
echo "Dry run! Would have run: $cmd"
else
eval $cmd
fi
| true
|
df56efe6cf01134bb8d89e0588af705fe1a6ae35
|
Shell
|
haanjack/benchmark
|
/tensorflow/exec_seq.sh
|
UTF-8
| 1,131
| 3.125
| 3
|
[] |
no_license
|
#!/bin/bash
# Tensorflow benchmark
# Author: Jack Han <jahan@nvidia.com>
#
# Compatible with Tensorflow @NGC
# This script works with provided dockerfile built image since it uses cloned benchmark code
#
output_dir="result"
summary_freq=100
dataset_dir="/raid/datasets/wmt16_en_dt"
benchmark_flag=1
function exec()
{
image=${1}
tag=${2}
num_gpu=${3}
batch_size=${4}
embed_size=${5}
log_file=${output_dir}/log_mnt_b${batch_size}_e${embed_size}_g${num_gpu}.txt
nvidia-docker run --rm -ti --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 \
--name tensorflow \
-u $(id -u):$(id -g) \
-e ${HOME}:${HOME} -e HOME=${HOME} \
-v ${dataset_dir}:/dataset \
${image}:${tag} \
/workspace/OpenSeq2Seq/try_gnmt_en2de.sh /dataset \
${num_gpu} ${batch_size} ${embed_size} ${summary_freq} /dataset ${benchmark_flag} \
|& tee ${log_file}
}
if [ ! -d ${output_dir} ]; then
mkdir ${output_dir}
fi
# Benchmark example
# exec {docker image} {tag} {model-name} {num_gpu} {batch_size} {embed_size}
exec jahan/tensorflow 18.02-py2 4 256 1024
| true
|
2d3abd5e9ea69bb9548a5eb683852557ff8fe451
|
Shell
|
luzbaza/holberton-system_engineering-devops
|
/0x04-loops_conditions_and_parsing/8-for_ls
|
UTF-8
| 232
| 3.390625
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
# script that displays:
#+ The content of the current directory
#+ In a list format
#+ Where only the part of the name after the first dash is displayed
LS="$(ls)"
for i in $LS
do
echo "$i" | cut -d - -f2
done
| true
|
09a02b44c8715da7dc5f5877ee4934c3746b7e05
|
Shell
|
erlerobot/snap_test_service
|
/script
|
UTF-8
| 407
| 3.1875
| 3
|
[] |
no_license
|
#!/bin/sh
set -e
platform=$(uname -i)
case $platform in
x86_64)
plat_abi=x86_64-linux-gnu
;;
armv7l)
plat_abi=arm-linux-gnueabihf
;;
*)
echo "unknown platform for snappy-magic: $platform. remember to file a bug or better yet: fix it :)"
;;
esac
mkdir -m1777 -p $SNAP_APP_TMPDIR
exec $SNAP_APP_PATH/bin/$plat_abi/test
# never reach this
exit 1
| true
|
5cb9ff823530d92b99b361e5cd2d14057bb17d2d
|
Shell
|
simonschuang/toolbox
|
/bin/nic-bonding.sh
|
UTF-8
| 807
| 3.734375
| 4
|
[] |
no_license
|
#!/bin/bash
NIC1="${1}"
NIC2="${2}"
IPCIDR="${3}"
if [ -z $NIC1 ] || [ -z $NIC2 ];then
echo "Usage: $0 <NIC1> <NIC2> [IP/prefix]"
fi
# Create bonding.conf for mounting bond module
cat<<EOF > /etc/modprobe.d/bonding.conf
# Prevent kernel from automatically creating bond0 when the module is loaded.
# This allows systemd-networkd to create and apply options to bond0.
options bonding max_bonds=0 miimon=100
EOF
# Create systemd network config files
cat<<EOF > /etc/systemd/network/10-bond-nics.network
[Match]
Name=${NIC1} ${NIC2}
[Network]
Bond=bond0
EOF
cat<<EOF > /etc/systemd/network/20-bond.netdev
[NetDev]
Name=bond0
Kind=bond
[Bond]
Mode=balance-alb
EOF
if [ ! -z ${IPCIDR} ]; then
cat<<EOF > /etc/systemd/network/30-bond-static.network
[Match]
Name=bond0
[Network]
Address=${IPCIDR}
EOF
fi
| true
|
84125956df5f8d80a198c9ba3e27e435cb0d6cb3
|
Shell
|
RJVB/macstrop
|
/bin/port-prune-patches
|
UTF-8
| 529
| 3.703125
| 4
|
[
"LicenseRef-scancode-public-domain"
] |
permissive
|
#!/bin/sh
if [ $# != 0 ] ;then
PATCHFILES="$1"
shift 1
if [ "$1" = "-y" ] ;then
DRYRUN=1
shift 1
else
DRYRUN=0
fi
while [ $# != 0 ] ;do
fgrep `basename "$1"` "${PATCHFILES}" 2>&1 > /dev/null
if [ $? != 0 ] ;then
if [ ${DRYRUN} ] ;then
echo "$1"
else
rm "$1"
fi
fi
shift
done
else
echo "Usage: `dirname $0` <patchfiles.txt> [-y] patchfile1 [patchfile2 [...]]"
exit 1
fi
| true
|
b6465b34ff0d936c0815f68a8bfee98d7a1984b6
|
Shell
|
brunoluiz/bbb-can-installer
|
/04-activate.sh
|
UTF-8
| 731
| 3.328125
| 3
|
[] |
no_license
|
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
bitrate=$1
if [ -z $bitrate ]; then
bitrate=1000000
fi
# If you use some kind of device which needs custom modules,
# don't forget to enable the module at the section below
modprobe can
modprobe can-dev
modprobe can-raw
# Setup and activate CAN
ifconfig can0 down
ip link set can0 up type can bitrate $bitrate triple-sampling on listen-only off loopback off restart-ms 10
ifconfig can0 up
# If it doesn't work with ifconfig and iproute above commands, try to use canconfig tool below:
# canconfig can0 stop
# canconfig can0 bitrate $bitrate ctrlmode triple-sampling on listen-only off loopback off restart-ms 10
# canconfig can0 start
| true
|
2052a17c76266d698bdc71d913fdb4e131529bd7
|
Shell
|
AkhtarZainab/BridgeLabz
|
/Loops/empwage6.sh
|
UTF-8
| 312
| 3.171875
| 3
|
[] |
no_license
|
#!/bin/bash -x
isparttime=1
isfulltime=2
totsal=0
emprate=20
numwrkdays=20
for (( day=1; day<=$numwrkdays; day++ ))
do
empcheck=$((RANDOM%3))
case $empcheck in
$isfulltime) emphrs=8;;
$isparttime) emphrs=4;;
*) emphrs=0;;
esac
sal=$(($emphrs*$emprate));
totalsal=$(($totalsal+$sal));
done
| true
|
553da9f9acc65abf5d9e2bf5c94428c41f8ee28b
|
Shell
|
danielsnider/object-tracking
|
/PT/ssh_to_pi.sh
|
UTF-8
| 370
| 3.78125
| 4
|
[] |
no_license
|
#!/bin/bash
if [ -z "$1" ]
then
echo "No argument supplied"
exit 1
fi
IP_ARG=$1
SIZE=${#IP_ARG}
if [ "$SIZE" -gt "3" ]; then
SEARCH_NET=$IP_ARG
else
SEARCH_NET="192.168.$IP_ARG.0/24"
fi
PI_IPS=$(sudo nmap -sP $SEARCH_NET | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}')
for IP in $PI_IPS; do
echo "Connecting to $IP..."
ssh ubuntu@$IP
done
| true
|
d5bc52c8995cc43b5241bf7c2d9e7afdbe69025e
|
Shell
|
Pausa90/BOLDProject
|
/jellyfishStarter.sh
|
UTF-8
| 857
| 3.453125
| 3
|
[] |
no_license
|
#!/bin/bash
#@author Andrea Iuliano & Valerio Cestarelli
input="multifasta/"
output="jellyfish/"
if [ -d "$output" ]; then
rm -R "$output"
fi
mkdir "$output"
for dir in "$input"*; do
dir_name=$(echo "$dir" | awk -v FS="/" '{print $NF}')
dir_output="$output$dir_name"
mkdir "$dir_output"
for file in "$input/$dir_name"/*.fas; do
name_file=$(echo "$file" | awk -v FS="/" '{print $NF}')
name_file="${name_file::(-4)}" #Con -4 si elimina ".fas"
gene_sequence_length=$(cat "$file" | grep '^[^>]' | awk -FS='\n' '{print $1}' | tr '\n' ' ' | wc -c)
specie_name=$(sed -n "1p" "$file" | awk -v FS="|" '{print $2}' | tr " " "_")
jellyfish count -m 4 -o tmp.bin -c 2 -s 10M -t 4 -C "$file"
jellyfish dump -c -o "$dir_output/""$name_file""[specie=$specie_name]""[length=$gene_sequence_length]""[k=4]"".occ" tmp.bin
rm tmp.bin
done
echo "$dir terminato"
done
| true
|
1637f1541ef763fbcd055f1d68717cf6fc9cef20
|
Shell
|
autyinjing/dev-env
|
/home/file/bash/.bashrc
|
UTF-8
| 3,024
| 2.59375
| 3
|
[] |
no_license
|
# 只有在交互式shell中才输出
function ECHO() {
[[ $- == *i* ]] && echo $1
}
if [ -f /etc/profile ];then
. /etc/profile
fi
# ***** 其他模块的配置文件
# git自动补全
source ~/.git-completion.bash
# go自动补全
complete -C $HOME/bin/gocomplete go
# ***** 环境变量
export EDITOR="vim"
export PATH=$HOME/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin:/usr/python/bin:/usr/local/go/bin:/root/v8/depot_tools
export GOPATH="/home/aut/yxs/GameJoyo/SourceCode/Golang"
export PS1="[^_^]\[\e[1;35m\]\u\[\e[m\]\[\e[1;31m\]@\[\e[m\]\h:\[\e[1;39m\]/\W\\[\e[m\]$ "
export LANG=zh_CN.UTF8
export HISTFILESIZE=2000
export HISTSIZE=2000
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S `whoami`: "
export LS_COLORS='no=00:fi=00:di=01:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32 :*.tar=01;31:*.tar.gz=00;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;3 1:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm =01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:'
export SYSFONT="latarcyrheb-sun16"
export GOPROXY=https://goproxy.cn,direct
# ***** 别名
# 其他
alias ll='ls -lh --color=tty'
alias ls='ls --color=tty'
alias rm="rm -i"
alias df="df -h"
alias grep="grep --color=auto"
alias cp="cp -i -rf "
alias conf_bash='vim ~/github/dev-env/home/file/bash/.bashrc'
alias conf_vim='vim ~/github/dev-env/home/file/vim/.vimrc'
alias ptar='tar -czvf'
alias utar='tar -xzvf'
alias c='clear'
alias lal='ls -alh'
alias psx='ps x | grep -v grep | grep -v "ps x"'
alias makec='make clean && make'
alias mcp='/usr/bin/cp -prR'
alias mpython='/usr/python/bin/python3'
alias cman='man -M /usr/local/zhman/share/man/zh_CN'
alias got='ps -eo pid,etime,cmd | grep -v grep | grep'
alias gdb='gdb -q'
alias rbash="cd $HOME/github/dev-env/home/ && bash install.sh && . ~/.bashrc"
# vim
alias vim='/usr/local/bin/vim'
alias vimdiff='/usr/local/bin/vimdiff'
alias v='vim'
alias vi='vim'
# cd
alias ..='cd ../'
alias ...='cd ../..'
alias ....='cd ../../../'
# svn
alias svup='svn update'
alias svst='svn status'
alias svci='svn ci -m ""'
alias svdi='svn di'
# git
alias gsts='git status'
alias gbr='git branch'
alias grl='git reflog'
alias grv='git remote -v'
alias grev='git checkout --'
alias gadd='git add'
alias gcmt='git commit -m'
alias gpush='git push'
alias gpull='git pull'
alias gchk='git checkout'
alias gdif='git difftool'
alias gpm='git pull && git merge origin/master'
alias gstash='git stash'
alias gfetch='git fetch'
alias gchkm='git checkout master'
alias gmg='git merge'
# go
alias gb='go build'
alias gr='go run'
# 导入项目相关的配置
for file in $(ls $HOME/.bash_project/.bashrc*)
do
. $file
ECHO "$file init success ."
done
# 加载自定义脚本
if [ -f "$HOME/.bashrc_self" ];then
. $HOME/.bashrc_self
fi
ECHO ""
ECHO "... Hello World ! ..."
ECHO ""
| true
|
bf269c874a2b4f3e05b438c4e3dedabe51849ccb
|
Shell
|
abuharis/accenture
|
/abuharis.sh
|
UTF-8
| 801
| 3.78125
| 4
|
[] |
no_license
|
#!/usr/bin/bash
#Exit Codes
case "$1" in
start)
echo "starting programme"
stop )
echo "stoping programmme"
restart )
echo "restarting programme"
*)
echo "nothing is happening"
esac
if [ $# -lt 1 ]
then
echo "Error:Atleast one argument required"
exit 1
else
echo "Hello world"
echo "Error: we have some problem" >&2
#Variable assign
FIRST=ABUHARIS
SURNAME=SALIH
echo "Hai $FIRST, Today is $(date)"
#Arithmetic
echo $[ ( 1 + 2 ) *3 ]
echo $[ (100 + 200) % (3 + 8) ]
#set -x
#COUNT=1
#for FILE in $(ls $HOME)
#do
echo $COUNT $FILE
COUNT=$[ COUNT + 1 ]
#set +x
#done
#Arguments
for ARG in "$*"
do
echo "Argumets: $ARG"
done
for ARG in $@
do
echo "Argumets: $ARG"
done
echo "There are $# arguments"
for ARG in "$*"
do
echo "Argumets: $ARG"
done
exit 0
fi
| true
|
b4abd732e28e1db8d5a55a791088a59957342e6a
|
Shell
|
schlowm0/dot-files
|
/setup_repositories.sh
|
UTF-8
| 730
| 2.640625
| 3
|
[] |
no_license
|
#!/bin/sh
ssh-keygen -t rsa -b 4096 -C "m.milde@westernsydney.edu.au"
cat ~/.ssh/id_rsa.pub | cop
read -p "SSH PUB ID has been copied to clip board. Please add it to Github and Gitlab and then press [Enter] key to continue..."
# Set up standard repositories
mkdir ~/Repositories
sudo chown -R schlowmo:schlowmo Repositories
cd ~/Repositories
git config --global user.name "Moritz Milde"
git config --global user.email "m.milde@westernsydney.edu.au"
cd /etc/udev/rules.d/
sudo wget https://github.com/inilabs/devices-bin/blob/master/drivers/linux/udev-rules/65-inilabs.rules
cd ~/Repositories
git clone git@code.ini.uzh.ch:ncs/teili.git
git clone git@code.ini.uzh.ch:mmilde/OCTA.git
git clone git@github.com:schlowm0/sense8.git
source activate teili
cd ~/Repositories/
pip install teili/
pip install OCTA/
| true
|
b009fa2fe1a314132279b2c2878f7d6a0c3c9bd9
|
Shell
|
Wayne-Inc/Wayne-OS
|
/usr/bin/smbproviderd-jailed
|
UTF-8
| 920
| 2.8125
| 3
|
[] |
no_license
|
#!/bin/sh
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Run smbprovider with minijail0.
# -i makes sure minijail0 exits right away.
# -p Enter a new PID namespace and run the process as init (pid=1).
# -I Runs program as init inside a new pid namespace.
# -l Enter a new IPC namespace.
# -v Enters new mount namespace, allows to change mounts inside jail.
# -r Remount /proc read-only.
# --uts Enters a new UTS namespace.
# -t Mounts tmpfs as /tmp.
# --mount-dev Creates a new /dev with a minimal set of nodes.
# -b Binds <src> to <dest> in chroot.
# -u Run as smbproviderd user.
# -g Run as smbproviderd group.
exec minijail0 \
-i \
-p -I \
-l \
-v -r \
--uts \
-t \
--mount-dev -b /dev/log,/dev/log \
-u smbproviderd -g smbproviderd \
/usr/sbin/smbproviderd
| true
|
3f92d9adbffe4a5f752f7ee3d768c4768c3e7d25
|
Shell
|
ypetya/bash_lib
|
/git/branch_new.sh
|
UTF-8
| 128
| 2.671875
| 3
|
[] |
no_license
|
function git.branch_new() {
local branch_name="${1?param missing : new branch name from HEAD}"
git checkout -b $branch_name
}
| true
|
13dd83953332afabf1df7e5f4f468a4c6547dd30
|
Shell
|
chao-master/bin
|
/purgebin
|
UTF-8
| 252
| 2.640625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
set -euo pipefail
#If packages or node_modules: stop (prune)
#Otherwise: If bin or obj: execute ynrfmf and stop (prune)
find -type d \( -name packages -o -name node_modules \) -prune -o \( -name bin -o -name obj \) -prune -exec ynrmf {} +
| true
|
8d63737815115a0c17e8500cbf111cd092b14412
|
Shell
|
b1f6c1c4/git-fancy-push
|
/git-fancy-push
|
UTF-8
| 7,815
| 3.78125
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
if [ -z "$VERBOSE" ]; then
VERBOSE=
else
VERBOSE=YES
fi
set -euo pipefail
if [ -r ~/.git-fancy-push ]; then
TOKEN="$(cat ~/.hub-sync)"
else
printf 'Error: \e[36mgit-fancy-push\e[0m needs a GitHub token to run!\n' >&2
printf 'Error: Please put your GitHub personal access token to \e[33m~/.git-fancy-push\e[0m\n' >&2
printf 'Error: You can get one from here: \e[35mhttps://github.com/settings/tokens\e[0m\n' >&2
exit 1
fi
peek() {
if [ -n "$VERBOSE" ]; then
tee /dev/stderr
else
cat -
fi
}
if [ "$#" -gt 0 ] && [ "$1" = "--update-ref" ]; then
shift
[ -n "$VERBOSE" ] && printf '%q --update-ref' "$0" >&2
[ -n "$VERBOSE" ] && printf ' %q' "$@" >&2
[ -n "$VERBOSE" ] && printf '\n' >&2
GH="$1"
URL="$2"
REF="$3"
SHA1="$4"
if [ "$GH" = "--" ]; then
printf 'Error: \e[31mWe are so sorry that we only support GitHub.\e[0m\n' >&2
printf 'Error: If you wish, you can open an issue on https://github.com/b1f6c1c4/git-fancy-push/issues.' >&2
printf 'Notice: \e[33mSkipped git fancy-push %s %s:%s\e[0m\n' "$URL" "$SHA1" "$REF" >&2
exit 0
fi
"$0" --upload-commit "$GH" "$URL" "$SHA1"
if jq -n '{ ref: $ref, sha: $sha }' \
--arg ref "$REF" \
--arg sha "$SHA1" \
| peek \
| curl -fs -d @- -X POST "https://api.github.com/repos/$GH/git/refs" -H "Authorization: token $TOKEN" \
| peek >/dev/null; then
printf 'Notice: \e[32mPush (creation) successful!\e[0m (to %s)\n' "$URL" >&2
printf 'Notice: %s is now at %s.\n' "$REF" "$SHA1" >&2
printf 'Notice: Please git fetch by yourself.\n' >&2
exit 0
fi
PREV="$(curl -fsS "https://api.github.com/repos/$GH/git/$REF" -H "Authorization: token $TOKEN" \
| peek \
| jq -r '.object.sha')"
if jq -n '{ force: false, sha: $sha }' \
--arg sha "$SHA1" \
| peek \
| curl -fs -d @- -X PATCH "https://api.github.com/repos/$GH/git/$REF" -H "Authorization: token $TOKEN" \
| peek >/dev/null; then
printf 'Notice: \e[32mPush successful!\e[0m (to %s)\n' "$URL" >&2
printf 'Notice: %s is now at %s.\n' "$REF" "$SHA1" >&2
printf 'Notice: %s was previously at %s.\n' "$REF" "$PREV" >&2
printf 'Notice: Please git fetch by yourself.\n' >&2
exit 0
fi
printf 'Warning: \e[33mDoing forced push on %s\e[0m\n' "$REF" >&2
if jq -n '{ force: true, sha: $sha }' \
--arg sha "$SHA1" \
| peek \
| curl -fs -d @- -X PATCH "https://api.github.com/repos/$GH/git/$REF" -H "Authorization: token $TOKEN" \
| peek >/dev/null; then
printf 'Notice: \e[32mForced push successful!\e[0m (to %s)\n' "$URL" >&2
printf 'Notice: %s is now at %s.\n' "$REF" "$SHA1" >&2
printf 'Notice: %s was previously at %s.\n' "$REF" "$PREV" >&2
printf 'Notice: Please git fetch by yourself.\n' >&2
exit 0
fi
exit 0
fi
if [ "$#" -gt 0 ] && [ "$1" = "--upload-commit" ]; then
shift
[ -n "$VERBOSE" ] && printf '%q --upload-commit' "$0" >&2
[ -n "$VERBOSE" ] && printf ' %q' "$@" >&2
[ -n "$VERBOSE" ] && printf '\n' >&2
GH="$1"
URL="$2"
SHA1="$3"
if curl -fs "https://api.github.com/repos/$GH/git/commits/$SHA1" -H "Authorization: token $TOKEN" \
| peek >/dev/null; then
printf 'Notice: \e[33mCommit %s is already on GitHub.\e[0m\n' "$SHA1" >&2
exit 0
fi
[ -n "$VERBOSE" ] && printf 'Info: Commit %s non-existant, will upload later.\n' "$SHA1" >&2
git show -s --format="%P" "$SHA1" \
| xargs -r -n 1 "$0" --upload-commit "$GH" "$URL"
TREE="$(git rev-parse "$SHA1^{tree}")"
if ! curl -fs -o /dev/null "https://api.github.com/repos/$GH/git/trees/$TREE" -H "Authorization: token $TOKEN"; then
[ -n "$VERBOSE" ] && printf 'Info: Uploading tree %s.\n' "$TREE" >&2
TC="$(GIT_AUTHOR_NAME=author \
GIT_AUTHOR_EMAIL=author@example.com \
GIT_AUTHOR_DATE='1970-01-01T00:00:00Z' \
GIT_COMMITTER_NAME=committer \
GIT_COMMITTER_EMAIL=committer@example.com \
GIT_COMMITTER_DATE='1970-01-01T00:00:00Z' \
git commit-tree "$SHA1^{tree}" -m 'tmp')"
git push --force "$URL" "$TC:refs/tags/git-fancy-push/tmp-$$"
git push --delete "$URL" "refs/tags/git-fancy-push/tmp-$$"
[ -n "$VERBOSE" ] && printf 'Info: Tree %s uploaded.\n' "$TREE" >&2
fi
[ -n "$VERBOSE" ] && printf 'Info: Uploading commit %s.\n' "$SHA1" >&2
git cat-file commit "$SHA1" | awk '
BEGIN { a=0; }
/^$/ { a=1; }
{ if (a >= 2) print $0; if (a) a++; }
' | jq -Rs '
{
message: .,
tree: $tree,
parents: $ARGS.positional,
author: { name: $an, email: $ae, date: $aI },
committer: { name: $cn, email: $ce, date: $cI },
signature: $gpgsig,
}
| if $gpgsig == "" then del(.signature) else . end
' \
--arg tree "$(git rev-parse "$SHA1^{tree}")" \
--arg an "$(git show -s --format="%an" "$SHA1")" \
--arg ae "$(git show -s --format="%ae" "$SHA1")" \
--arg aI "$(git show -s --format="%aI" "$SHA1")" \
--arg cn "$(git show -s --format="%cn" "$SHA1")" \
--arg ce "$(git show -s --format="%ce" "$SHA1")" \
--arg cI "$(git show -s --format="%cI" "$SHA1")" \
--arg gpgsig "$(git cat-file commit "$SHA1" | awk '
BEGIN { a=0; }
! /^ / { if (a) exit; }
/^gpgsig / { a=1; sub(/^gpgsig /, "", $0); print $0; }
{ if (a) print $0; }
')" \
--args $(git show -s --format="%P" "$SHA1") \
| peek \
| curl -fsS -d @- -X POST "https://api.github.com/repos/$GH/git/commits" -H "Authorization: token $TOKEN" \
| peek \
| jq -r '.sha' | (
read -r sh;
if ! [ "$SHA1" = "$sh" ]; then
printf 'Error: \e[31mCannot upload commit %s: SHA-1 mismatch.\e[0m\n' "$SHA1" >&2
printf 'Error: Usually it'\''s due to the mergetag header.\n' >&2
exit 1
fi
)
printf 'Notice: Commit %s uploaded successfully.\n' "$SHA1" >&2
exit 0
fi
look_for() {
T="$1"
shift
while [ "$#" -gt 0 ]; do
[ "$1" = "$T" ] && return 0
shift
done
return 1
}
(look_for "-v" "$@" || look_for "--verbose" "$@") && export VERBOSE=YES
# Run git push
TLOG="$(mktemp)"
finish_2() {
rm -f "$TLOG"
}
trap finish_2 EXIT
set +e
git push --porcelain "$@" | tee "$TLOG"
R="$?"
set -e
# Check if no shallow update
grep -q '\s\[remote rejected\] (shallow update not allowed)$' "$TLOG" || exit "$R"
printf 'Notice: \e[35mKeep Calm!\e[0m \e[36mgit-fancy-push\e[0m is working on it.\n' >&2
awk '
/^To / { gh="--"; u=$2; }
/^To github.com:/ {
gh=$2;
sub(/^github.com:/, "", gh);
sub(/.git$/, "", gh);
u="git@github.com:" gh ".git";
}
/^To https:\/\/github.com\// {
gh=$2;
sub(/https:\/\/github.com\//, "", gh);
sub(/.git$/, "", gh);
u="https://github.com/" gh ".git";
}
/^!\s\S+:\S+\s\[remote rejected\] \(shallow update not allowed\)$/ {
s=$2; sub(/:.*$/, "", s);
t=$2; sub(/^.*:/, "", t);
printf "%s %s %s ", gh, u, t;
if (system("git rev-parse " s) != 0) {
exit 1;
}
}
' "$TLOG" \
| peek \
| xargs -r -L 1 "$0" --update-ref
printf 'Notice: \e[35mAll shallow-update-not-allowed problem(s) has been fixed!\e[0m\n' >&2
printf 'Notice: Thanks for using \e[36mgit-fancy-push\e[0m.\n' >&2
| true
|
503fab926defae98cc7b222accc16541ed0c9fc8
|
Shell
|
fzhantw/how-I-setup-lemp-server
|
/script.sh
|
UTF-8
| 630
| 3.25
| 3
|
[] |
no_license
|
EXIT_SIGNAL="0";
while :
do
printf "Please Choose Some Action:\n"
printf "1. install oh my zsh \n"
printf "2. install vim\n"
printf "3. install web server\n"
printf "4. install composer\n"
printf "5. build a virtual host\n"
printf "6. install mysql(mariadb)\n"
printf "7. install php\n"
printf "put in q to leave\n"
read -p "Your choice:" choise
case $choise in
1) sh ./src/oh_my_zsh.sh;;
2) sh ./src/vim.sh;;
3) sh ./src/nginx.sh;;
4) sh ./src/composer.sh;;
5) sh ./src/build_site.sh;;
6) sh ./src/mysql_server.sh;;
7) sh ./src/php.sh;;
q) exit;;
*) printf "Invalid Choice, Please Insert Again\n";read null;;
esac
done
| true
|
9fddcb4b554d2ed7a241254ae3121b4f47a5af5e
|
Shell
|
hebra/bingground
|
/bing-image-of-the-day.sh
|
UTF-8
| 622
| 3.515625
| 4
|
[] |
no_license
|
#!/bin/bash
#
# This script retrieves the Microsoft Bing! picture of the day and sets it as background image.
#
# (C) 2016 Hendrik Brandt
#
# Released under term of Simplified BSD License
#
imgFolder=~/.local/share/bingground
mkdir -p $imgFolder
imgJSON=$(curl -s "http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-AU")
imgPath=$(echo "$imgJSON" | jq -r '.["images"][0].url')
imgFile=$(basename $imgPath)
imgURL="http://www.bing.com$imgPath"
curl -o $imgFolder/$imgFile -s $imgURL
command -v gsettings>/dev/null 2>&1 && gsettings set org.gnome.desktop.background picture-uri "file://$imgFolder/$imgFile"
| true
|
2b633dbf05fa674208c0670fd023b9d34533c4c7
|
Shell
|
shlomif/shlomif-computer-settings
|
/shlomif-settings/Bash/Themes/old-themes/perl/svn-lwi/source.bash
|
UTF-8
| 724
| 2.859375
| 3
|
[] |
no_license
|
load_common mymake
base="/home/shlomi/progs/perl/Subversion/light-web-interface"
trunk="$base/trunk"
this="$trunk"
rw_repos_url="svn+ssh://svn.berlios.de/svnroot/repos/web-cpan/svn-light-web/"
read_repos_url="svn://svn.berlios.de/web-cpan/svn-light-web"
# Make sure that gvim's filename completion ignores filenames that it should
# not edit.
__gvim_completion()
{
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -f -X '*~' -- "$cur" |
grep -v '/\.' | grep -v '^\.') )
}
complete -o filenames -F __gvim_completion gvim
__test_distribution()
{
(
cd "$this"
make disttest
rm -fr "$(cat Makefile | perl -lpE 'say if s/\ADISTVNAME = //')"
)
}
cd "$this"
| true
|
82debe524c3f46b1b4be7ce090707cc519cfd5a1
|
Shell
|
dkav/scripts
|
/multimedia/exiftool-photo-rn.sh
|
UTF-8
| 404
| 3.515625
| 4
|
[] |
no_license
|
#!/bin/zsh
#
# Add timestamp and suffix to photo.
#
# Usage: rn_photo file/folder <suffix>
#
# Options: -s Remove seconds from file name
fname="%Y%m%dT%H%M%S"
while getopts ":s" opt; do
case ${opt} in
s) fname="%Y%m%dT%H%M" ;;
\?) echo "Invalid option: -$OPTARG" >&2 ;;
esac
done
shift $((OPTIND - 1))
exiftool -ext+ HEIC --ext MOV '-FileName<DateTimeOriginal' -d $fname"%%-c$2.%%le" $1
| true
|
136788d6abbff0e103376f1bde2642946ccff3c0
|
Shell
|
praeclarum/Iril
|
/getstl.sh
|
UTF-8
| 559
| 2.515625
| 3
|
[
"MIT"
] |
permissive
|
set -e
set -x
if [ ! -f ${TMPDIR}stl.zip ]; then
wget -O ${TMPDIR}stl.zip https://github.com/llvm/llvm-project/archive/release/8.x.zip
fi
unzip -n ${TMPDIR}stl.zip -x /clang-tools-extra/* clang compiler-rt debuginfo-tests libclc libcxxabi libunwind polly llvm -d ${TMPDIR}stlwork
pushd ${TMPDIR}stlwork/llvm-project-release-8.x/libcxx/src
clang -g -O1 -S -emit-llvm -std=c++17 -frtti -fpic -D_LIBCPP_BUILDING_LIBRARY *.cpp
zip libcxx.zip *.ll
popd
mkdir -p ./Iril/Lib
cp ${TMPDIR}stlwork/llvm-project-release-8.x/libcxx/src/libcxx.zip ./Iril/Lib/
| true
|
0954c1208b3146e32505bfd47d2a71d5ef301786
|
Shell
|
as8175802986/Bridgelabz-shell
|
/power2.sh
|
UTF-8
| 108
| 2.890625
| 3
|
[] |
no_license
|
#!/bin/bash/ -x
read n
power=1
for (( i=1; i<=n; i++))
do
echo "2^" $i "=" $power
power=$((2*power))
done
| true
|
9e485c0e864007bebe640ed58fc0df68ed31ee67
|
Shell
|
tsingui/k3c_code
|
/ugw/feeds_thirdparty/quantenna/files/qtn_scripts/qtn_wlan_ap_start
|
UTF-8
| 25,391
| 3
| 3
|
[] |
no_license
|
#!/bin/sh
if [ ! "$ENVLOADED" ]; then
if [ -r /etc/rc.conf ]; then
. /etc/rc.conf 2> /dev/null
ENVLOADED="1"
fi
fi
if [ ! "$CONFIGLOADED" ]; then
if [ -r /etc/rc.d/config.sh ]; then
. /etc/rc.d/config.sh 2>/dev/null
CONFIGLOADED="1"
fi
fi
WLMN_INDEX=$1
WPS_INDEX="0"
WLAN_VENDOR_NAME=""
QTN_TARGET_IP="$CONFIG_PACKAGE_QUANTENNA_RGMII_TARGET_IP"
QTN_IF="0"
find_vendor_from_index() {
eval radioCpeId='$'wlmn_$1'_radioCpeId'
if [ "$radioCpeId" = "1" ]; then
radioPrefix=0
elif [ "$radioCpeId" = "2" ]; then
radioPrefix=1
fi
eval WLAN_VENDOR_NAME='$'wlss_$radioPrefix'_prefixScript'
echo "WLAN_VENDOR_NAME: $WLAN_VENDOR_NAME"
}
find_qtn_if_from_index() {
eval CPEID='$'wlmn_${1}'_cpeId'
qtn_dev=`/usr/sbin/status_oper GET "QTN_MAP" "$CPEID"`
QTN_IF=${qtn_dev:4}
echo "QTN_IF $QTN_IF "
}
echo "qtn_wlan_ap_start $@"
if [ "$CONFIG_FEATURE_WIRELESS" = "1" ]; then # [
find_qtn_if_from_index $1
eval cpeId='$'wlmn_${WLMN_INDEX}_cpeId
eval RADIOCPEID='$'wlmn_${WLMN_INDEX}_radioCpeId
if [ "$RADIOCPEID" = "1" ]; then
IFNUM=0
elif [ "$RADIOCPEID" = "2" ]; then
IFNUM=1
fi
eval COUNTRY='$'wlphy_${IFNUM}_country
eval ENVIRONMENT='$'wlphy_${IFNUM}_usageEnv
eval PRICHAN='$'wlphy_${IFNUM}_channelNo
eval AUTOCHAN='$'wlphy_${IFNUM}_autochanEna
eval BEACONINT='$'wlphy_${IFNUM}_beaconInt
eval BEACONTXENA='$'wlphy_${IFNUM}_beaconTxEna
eval DTIM_PERIOD='$'wlphy_${IFNUM}_dtimInt
eval RTS='$'wlphy_${IFNUM}_rts
eval FTS='$'wlphy_${IFNUM}_fts
eval AUTORATE='$'wlphy_${IFNUM}_autoRateFallbackEna
eval FIXRATE='$'wlphy_${IFNUM}_staticRate
eval MCSRATE='$'wlphy_${IFNUM}_nMCS
eval R_PREAMBLE='$'wlphy_${IFNUM}_preamble
eval R_BAND='$'wlphy_${IFNUM}_freqBand
eval R_SHORTGI='$'wlphy_${IFNUM}_nGuardIntvl
eval R_CHWIDTH='$'wlphy_${IFNUM}_nChanWidth
eval R_EXTOFFSET='$'wlphy_${IFNUM}_nExtChanPos
eval R_AMPDUENABLE='$'wlphy_${IFNUM}_nAMPDUena
eval R_AMPDUDIR='$'wlphy_${IFNUM}_nAMPDUdir
eval R_AMPDULIMIT='$'wlphy_${IFNUM}_nAMPDUlen
eval R_AMPDUFRAMES='$'wlphy_${IFNUM}_nAMPDUfrms
eval R_AMSDUENABLE='$'wlphy_${IFNUM}_nAMSDUena
eval R_AMSDUDIR='$'wlphy_${IFNUM}_nAMSDUdir
eval R_AMSDULIMIT='$'wlphy_${IFNUM}_nAMSDUlen
eval R_STANDARD='$'wlphy_${IFNUM}_standard
eval R_POWERLVL='$'wlphy_${IFNUM}_powerLvl
eval R_RADIOENA='$'wlphy_${IFNUM}_radioEnable
eval R_DIVENA='$'wlphy_${IFNUM}_nDivEna
eval R_DIVDIR='$'wlphy_${IFNUM}_nDivDir
eval R_DIVANTNUM='$'wlphy_${IFNUM}_nDivAntennaNum
eval R_STBCRX='$'wlphy_${IFNUM}_nSTBCrx
eval R_BAWSIZE='$'wlphy_${IFNUM}_nBAWsize
eval APENABLE='$'wlmn_${WLMN_INDEX}_apEnable
eval NAME='$'wlmn_${WLMN_INDEX}_apName
eval APTYPE='$'wlmn_${WLMN_INDEX}_apType
eval ESSID='$'wlmn_${WLMN_INDEX}_ssid
eval HIDENSSID='$'wlmn_${WLMN_INDEX}_ssidMode
eval BSSIDOVR='$'wlmn_${WLMN_INDEX}_bssidOverride
eval BSSID='$'wlmn_${WLMN_INDEX}_bssid
eval BASICDATERATE='$'wlmn_${WLMN_INDEX}_basicDataRate
eval OPERDATARATE='$'wlmn_${WLMN_INDEX}_operDataRate
eval MAXBITRATE='$'wlmn_${WLMN_INDEX}_maxBitRate
eval VLANID='$'wlmn_${WLMN_INDEX}_vlanId
eval APISOENA='$'wlmn_${WLMN_INDEX}_apIsolationEna
eval WMMENA='$'wlmn_${WLMN_INDEX}_wmmEna
eval UAPSDENA='$'wlmn_${WLMN_INDEX}_uapsdEna
eval WDSENA='$'wlmn_${WLMN_INDEX}_wdsEna
eval WPSENA='$'wlwps${cpeId}_${WPS_INDEX}_enable
eval APDEVNAME='$'wlwps${cpeId}_${WPS_INDEX}_apDevName
eval WPATYPE='$'wlsec_${WLMN_INDEX}_beaconType
eval AUTHTYPE='$'wlsec_${WLMN_INDEX}_authType
eval ENCRTYPE='$'wlsec_${WLMN_INDEX}_encrType
eval WEPENCRLVL='$'wlsec_${WLMN_INDEX}_wepEncrLvl
eval WEPKEYMODE='$'wlsec_${WLMN_INDEX}_wepKeyType
eval WEPKEYINDEX='$'wlsec_${WLMN_INDEX}_wepKeyIndx
eval MACACL='$'wlsec_${WLMN_INDEX}_macAddrCtrlType
eval IPADDR='$'lan_main_0_ipAddr
eval NETMASK='$'lan_main_0_netmask
eval BRIDGE='$'lan_main_0_interface
PUREG=0
PUREN=0
IS_11N=0
INDOOR="I"
OUTDOOR="O"
ALLENV=" "
# WIFI_DEV=$IFNUM
# VAPLIST=`iwconfig 2>&1 | grep ${APNAME} | cut -b 1-4`
# if [ "${IFNUM}" = "1" ]; then
# WIFIDEV=`ifconfig | grep wifi0 `
# if [ "${WIFIDEV}" = "" ]; then
# WIFI_DEV="0"
# else
# find_no_of_mounted_ath_cards
# if [ $ATH_CARDS_MOUNTED = "2" ]; then
# WIFI_DEV=$IFNUM
# else
# WIFI_DEV="0"
# fi
# fi
# fi
# if [ "${VAPLIST}" = "" ]; then
# if [ "${APTYPE}" = "0" -o "${APTYPE}" = "1" ]; then #VAP
# echo "Create $APNAME interface for device wifi${WIFI_DEV} "
# wlanconfig ${APNAME} create wlandev wifi${WIFI_DEV} wlanmode ap
# #wlanconfig ath create wlandev wifi${WIFI_DEV} wlanmode ap
# elif [ "${APTYPE}" = "2" ]; then #STA
# wlanconfig ath0 create wlandev wifi${IFNUM} wlanmode sta nosbeacon
# fi
# fi
######################################################
# AP Enable
######################################################
if [ "${APENABLE}" = "1" ]; then
echo "AP is up"
if [ "${QTN_IF}" = "0" ]; then
if [ "$CONFIG_PACKAGE_QUANTENNA_FIRMWARE_EMBEDDED" = "1" ]; then
# re-configure br0 ip address. It was configured to 1.1.1.1 for Quantenna firmware downloading
# remove Quantenna firmware from ramdisk
eval ip='$'lan_main_0_ipAddr
eval netmask='$'lan_main_0_netmask
/sbin/ifconfig br0 $ip netmask $netmask up
rm -f /ramdisk/tftp_upload/u-boot.bin
rm -f /ramdisk/tftp_upload/topaz-linux.lzma.img
fi
if [ "$CONFIG_PACKAGE_QUANTENNA_TYPE_TWO_RGMII" = "1" ]; then
# Configure link aggregation, port 0 and 5 are aggregated
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0x455 nData=0x5f
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0x454 nData=0x5f
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0x521 nData=0x8005
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0x52B nData=0x8000
switch_cli IFX_FLOW_REGISTER_SET nRegAddr=0x46b nData=0x0
switch_cli IFX_ETHSW_MAC_TABLE_CLEAR
fi
sleep 1
QTNMODE=`call_qcsapi_sockrpc --host ${QTN_TARGET_IP} get_mode wifi${QTN_IF}`
if [ "$QTNMODE" != "Access point" ]; then
echo "ERROR: Quantenna 802.11ac target is not detected!!"
`/usr/sbin/status_oper -u -f /flash/rc.conf SET "wlan_ss" "wlss_1_hwName" "UNKNOWN" `
`/usr/sbin/status_oper -u -f /flash/rc.conf SET "wlan_ss" "wlss_1_vendor" "UNKNOWN" `
`/usr/sbin/status_oper -u -f /flash/rc.conf SET "wlan_ss" "wlss_1_prefixScript" "UNKNOWN"`
exit
else
echo "Quantenna 802.11ac target is detected"
fi
else # QTN_IF > 0, Create VAP
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} wifi_create_bss wifi${QTN_IF}
fi
else
exit
fi
#####################################################
# Radio down/up
#####################################################
if [ "${R_RADIOENA}" = "0" ]; then
echo "Radio is not up"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} rfenable wifi${QTN_IF} 0
else
echo "Radio is up"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} rfenable wifi${QTN_IF} 1
fi
if [ "${QTN_IF}" = "0" ]; then
######################################################
# Country Setting
######################################################
CURRENT_CC=`call_qcsapi_sockrpc --host ${QTN_TARGET_IP} get_regulatory_region wifi${QTN_IF} | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
echo "QTN: Configure Country Code"
if [ "${CURRENT_CC}" != "${COUNTRY}" ]; then
NEW_CC=`echo ${COUNTRY} | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} overwrite_country_code wifi${QTN_IF} ${CURRENT_CC} ${NEW_CC}
echo "QTN: Country Code is changed to: $NEW_CC"
fi
###################################################
# Channel
###################################################
if [ "${AUTOCHAN}" = "1" ]; then #auto freq
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_channel wifi${QTN_IF} 0
echo "QTN: Auto Channel"
else
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_channel wifi${QTN_IF} $PRICHAN
echo "QTN: Channel: $PRICHAN"
fi
##################################################################
# 11n or 11ac. 20MHz, 40MHz or 80MHz
##################################################################
# if [ "${R_STANDARD}" = "0" ]; then #11bg, quantenna doesn't support it
# CH_MODE="0" # 11n, quantenna only supports n/ac
# elif [ "${R_STANDARD}" = "1" ]; then #11a
# CH_MODE="0" # 11n, quantenna only supports n/ac
# elif [ "${R_STANDARD}" = "2" ]; then #11b
# CH_MODE="0" # 11n, quantenna only supports n/ac
# elif [ "${R_STANDARD}" = "3" ]; then #11g
# CH_MODE="0" # 11n, quantenna only supports n/ac
# PUREG=1
# elif [ "${R_STANDARD}" = "4" -o "${R_STANDARD}" = "5" -o "${R_STANDARD}" = "6" -o "${R_STANDARD}" = "7" ]; then #11n
if [ "${R_STANDARD}" = "4" -o "${R_STANDARD}" = "5" -o "${R_STANDARD}" = "6" -o "${R_STANDARD}" = "7" ]; then #11n
IS_11N=1
#if [ "${R_STANDARD}" = "4" ]; then
# PUREN=1
#fi
if [ "${R_CHWIDTH}" = "0" ]; then # 11n, 20MHz
echo "QTN: 11n/20MHz"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_vht wifi${QTN_IF} 0
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_bw wifi${QTN_IF} 20
elif [ "${R_CHWIDTH}" = "1" ]; then # 11n, 40MHz
echo "QTN: 11n/40MHz"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_vht wifi${QTN_IF} 0
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_bw wifi${QTN_IF} 40
fi
elif [ "${R_STANDARD}" = "8" -o "${R_STANDARD}" = "9" -o "${R_STANDARD}" = "10" ]; then #11ac
IS_11AC=1
if [ "${R_CHWIDTH}" = "0" -a "${R_BAND}" = "1" ]; then # 20MHz
echo "QTN: 11ac/20MHz"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_vht wifi${QTN_IF} 1
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_bw wifi${QTN_IF} 20
elif [ "${R_CHWIDTH}" = "1" -a "${R_BAND}" = "1" ]; then # 40Mhz
echo "QTN: 11ac/40MHz"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_vht wifi${QTN_IF} 1
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_bw wifi${QTN_IF} 40
elif [ "${R_CHWIDTH}" = "3" -a "${R_BAND}" = "1" ]; then # 80MHz
echo "QTN: 11ac/80MHz"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_vht wifi${QTN_IF} 1
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_bw wifi${QTN_IF} 80
fi
fi
#####################################################
# Short GI
#####################################################
if [ "$R_SHORTGI" = "0" ]; then # Short GI
echo "QTN: Enable Short GI"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_option wifi${QTN_IF} shortGI 1
elif [ "$R_SHORTGI" = "1" ]; then
echo "QTN: Disabled Short GI"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_option wifi${QTN_IF} shortGI 0
fi
# MCS
# if [ "$MCSRATE" != "-1" ]; then
# if [ "$MCSRATE" = "0" ]; then
# MANRATE="0x80808080"
# elif [ "$MCSRATE" = "1" ]; then
# MANRATE="0x81818181"
# elif [ "$MCSRATE" = "2" ]; then
# MANRATE="0x82828282"
# elif [ "$MCSRATE" = "3" ]; then
# MANRATE="0x83838383"
# elif [ "$MCSRATE" = "4" ]; then
# MANRATE="0x84848484"
# elif [ "$MCSRATE" = "5" ]; then
# MANRATE="0x85858585"
# elif [ "$MCSRATE" = "6" ]; then
# MANRATE="0x86868686"
# elif [ "$MCSRATE" = "7" ]; then
# MANRATE="0x87878787"
# elif [ "$MCSRATE" = "8" ]; then
# MANRATE="0x88888888"
# elif [ "$MCSRATE" = "9" ]; then
# MANRATE="0x89898989"
# elif [ "$MCSRATE" = "10" ]; then
# MANRATE="0x8a8a8a8a"
# elif [ "$MCSRATE" = "11" ]; then
# MANRATE="0x8b8b8b8b"
# elif [ "$MCSRATE" = "12" ]; then
# MANRATE="0x8c8c8c8c"
# elif [ "$MCSRATE" = "13" ]; then
# MANRATE="0x8d8d8d8d"
# elif [ "$MCSRATE" = "14" ]; then
# MANRATE="0x8e8e8e8e"
# elif [ "$MCSRATE" = "15" ]; then
# MANRATE="0x8f8f8f8f"
# fi
# MANRETRIES="0x04040404"
#
# iwpriv ${APNAME} set11NRates $MANRATE
# iwpriv ${APNAME} set11NRetries $MANRETRIES
# elif [ "${AUTORATE}" = "0" -a "${FIXRATE}" != "0" ]; then
# if [ "$FIXRATE" = "1.0" ]; then
# MANRATE="0x1b1b1b1b"
# elif [ "$FIXRATE" = "2.0" ]; then
# MANRATE="0x1a1a1a1a"
# elif [ "$FIXRATE" = "5.5" ]; then
# MANRATE="0x19191919"
# elif [ "$FIXRATE" = "11.0" ]; then
# MANRATE="0x18181818"
# elif [ "$FIXRATE" = "6.0" ]; then
# MANRATE="0x0b0b0b0b"
# elif [ "$FIXRATE" = "9.0" ]; then
# MANRATE="0x0f0f0f0f"
# elif [ "$FIXRATE" = "12.0" ]; then
# MANRATE="0x0a0a0a0a"
# elif [ "$FIXRATE" = "18.0" ]; then
# MANRATE="0x0e0e0e0e"
# elif [ "$FIXRATE" = "24.0" ]; then
# MANRATE="0x09090909"
# elif [ "$FIXRATE" = "36.0" ]; then
# MANRATE="0x0d0d0d0d"
# elif [ "$FIXRATE" = "48.0" ]; then
# MANRATE="0x08080808"
# elif [ "$FIXRATE" = "54.0" ]; then
# MANRATE="0x0c0c0c0c"
# elif [ "$FIXRATE" = "81.0" ]; then
# MANRATE="0x8a8a8a8a"
# elif [ "$FIXRATE" = "108.0" ]; then
# MANRATE="0x8b8b8b8b"
# elif [ "$FIXRATE" = "162.0" ]; then
# MANRATE="0x8c8c8c8c"
# elif [ "$FIXRATE" = "216.0" ]; then
# MANRATE="0x8d8d8d8d"
# elif [ "$FIXRATE" = "243.0" ]; then
# MANRATE="0x8e8e8e8e"
# elif [ "$FIXRATE" = "270.0" ]; then
# MANRATE="0x8f8f8f8f"
# elif [ "$FIXRATE" = "300.0" ]; then
# MANRATE="0x8f8f8f8f"
# fi
# MANRETRIES="0x04040404"
# iwpriv ${APNAME} set11NRates $MANRATE
# iwpriv ${APNAME} set11NRetries $MANRETRIES
# else
# iwpriv ${APNAME} set11NRates 0x0
# fi
# TX chain, RX chain
# if [ "${R_TXCHAIN}" != "" -a "${R_TXCHAIN}" != "0" ]; then
# iwpriv wifi$WIFI_DEV txchainmask $R_TXCHAIN
# fi
#
# if [ "${R_RXCHAIN}" != "" -a "${R_RXCHAIN}" != "0" ]; then
# iwpriv wifi$WIFI_DEV rxchainmask $R_RXCHAIN
# fi
# iwconfig ${APNAME} essid "${ESSID}" ${APMODE} ${FREQ}
# if ["${R_PREAMBLE}" = "1" ]; then
# iwpriv ${APNAME} shpreamble 1
# else
# iwpriv ${APNAME} shpreamble 0
# fi
###############################################
# RTS Threshold
###############################################
#if [ "${RTS}" = "2347" ]; then
# iwconfig ${APNAME} rts 2346
#else
# iwconfig ${APNAME} rts $RTS
#fi
###############################################
# Beacon interval
###############################################
if [ "${BEACONINT}" != "" ]; then
echo "QTN: Configure Beacon Interval ${BEACONINT}"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_beacon_interval wifi${QTN_IF} ${BEACONINT}
fi
###############################################
# DTIM period
###############################################
if [ "${DTIM_PERIOD}" != "" ]; then
echo "QTN: Configure DTIM Period ${DTIM_PERIOD}"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_dtim wifi${QTN_IF} ${DTIM_PERIOD}
fi
###############################################
# TX Power
###############################################
# if [ "$R_POWERLVL" = "80" ]; then
# iwconfig ${APNAME} txpower 12dbm
# elif [ "$R_POWERLVL" = "60" ]; then
# iwconfig ${APNAME} txpower 9dbm
# elif [ "$R_POWERLVL" = "40" ]; then
# iwconfig ${APNAME} txpower 6dbm
# elif [ "$R_POWERLVL" = "20" ]; then
# iwconfig ${APNAME} txpower 3dbm
# fi
fi # QTN_IF = 0
i=0
eval MACCOUNT='$'wlan_mac_control_Count
if [ "$MACACL" = "2" ]; then #none
echo "QTN: MAC Filter none"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_macaddr_filter wifi${QTN_IF} 0
elif [ "$MACACL" = "0" ]; then #allow
echo "QTN: MAC Filter allow"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_macaddr_filter wifi${QTN_IF} 1
while [ $i -lt $MACCOUNT ]
do
#find_vendor_from_index $i
#if [ "$WLAN_VENDOR_NAME" = "qtn" ]; then
eval temp_pcpeId='$'wlmacctrl_${i}_pcpeId
eval temp_mac='$'wlmacctrl_${i}_macAddr
if [ "$temp_pcpeId" = "$pcpeId" ]; then
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} authorize_macaddr wifi${QTN_IF} $temp_pcpeId
fi
#fi
i=`expr $i + 1`
done
elif [ "$MACACL" = "1" ]; then #deny
echo "QTN: MAC Filter deny"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_macaddr_filter wifi${QTN_IF} 2
while [ $i -lt $MACCOUNT ]
do
#find_vendor_from_index $i
#if [ "$WLAN_VENDOR_NAME" = "qtn" ]; then
eval temp_pcpeId='$'wlmacctrl_${i}_pcpeId
eval temp_mac='$'wlmacctrl_${i}_macAddr
if [ "$temp_pcpeId" = "$pcpeId" ]; then
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} deny_macaddr wifi${QTN_IF} $temp_pcpeId
fi
#fi
i=`expr $i + 1`
done
fi
##############################################
# Hide SSID
##############################################
if [ "$HIDENSSID" = "1" ]; then
echo "QTN: Enable Hide SSID"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_option wifi${QTN_IF} SSID_broadcast 0
else
echo "QTN: Disable Hide SSID"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_option wifi${QTN_IF} SSID_broadcast 1
fi
##############################################
# AP ISO
##############################################
#if [ "$APISOENA" = "1" ]; then
# iwpriv ${APNAME} ap_bridge 0
#else
# iwpriv ${APNAME} ap_bridge 1
#fi
##############################################
# WDS
##############################################
#if [ "$WDSENA" = "1" ]; then
# iwpriv ${APNAME} wds 1
#else
# iwpriv ${APNAME} wds 0
#fi
##################################################
# WMM
##################################################
# if [ "$WMMENA" = "1" ]; then
# i=0
# eval pcpeId='$'wlmn_${WLMN_INDEX}_cpeId
# while [ $i -lt 4 ]
# do
# eval ap_ECWmin='$'wlawmm${pcpeId}_${i}_ECWmin
# if [ "$ap_ECWmin" != "" ]; then
# iwpriv ${APNAME} cwmin ${i} 0 $ap_ECWmin
# fi
# eval ap_ECWmax='$'wlawmm${pcpeId}_${i}_ECWmax
# if [ "$ap_ECWmax" != "" ]; then
# iwpriv ${APNAME} cwmax ${i} 0 $ap_ECWmax
# fi
# eval ap_AIFSN='$'wlawmm${pcpeId}_${i}_AIFSN
# if [ "$ap_AIFSN" != "" ]; then
# iwpriv ${APNAME} aifs ${i} 0 $ap_AIFSN
# fi
# eval ap_TXOP='$'wlawmm${pcpeId}_${i}_TXOP
# if [ "$ap_TXOP" != "" ]; then
# iwpriv ${APNAME} txoplimit ${i} 0 $ap_TXOP
# fi
# eval ap_AckPolicy='$'wlawmm${pcpeId}_${i}_AckPolicy
# if [ "$ap_AckPolicy" != "" ]; then
# iwpriv ${APNAME} noackpolicy ${i} 0 $ap_AckPolicy
# fi
# eval ap_AdmCntrl='$'wlawmm${pcpeId}_${i}_AdmCntrl
# if [ "$ap_AdmCntrl" != "" ]; then
# iwpriv ${APNAME} acm ${i} 1 $ap_AdmCntrl
# fi
# eval bss_ECWmin='$'wlswmm${pcpeId}_${i}_ECWmin
# if [ "$bss_ECWmin" != "" ]; then
# iwpriv ${APNAME} cwmin ${i} 1 $bss_ECWmin
# fi
# eval bss_ECWmax='$'wlswmm${pcpeId}_${i}_ECWmax
# if [ "$bss_ECWmax" != "" ]; then
# iwpriv ${APNAME} cwmax ${i} 1 $bss_ECWmax
# fi
# eval bss_AIFSN='$'wlswmm${pcpeId}_${i}_AIFSN
# if [ "$bss_AIFSN" != "" ]; then
# iwpriv ${APNAME} aifs ${i} 1 $bss_AIFSN
# fi
# eval bss_TXOP='$'wlswmm${pcpeId}_${i}_TXOP
# if [ "$bss_TXOP" != "" ]; then
# iwpriv ${APNAME} txoplimit ${i} 1 $bss_TXOP
# fi
# eval bss_AckPolicy='$'wlswmm${pcpeId}_${i}_AckPolicy
# if [ "$bss_AckPolicy" != "" ]; then
# iwpriv ${APNAME} noackpolicy ${i} 1 $bss_AckPolicy
# fi
#
# i=`expr $i + 1`
# done
#
# iwpriv ${APNAME} wmm 1
# else
# iwpriv ${APNAME} wmm 0
# fi
# if [ "$UAPSDENA" = "1" ]; then
# iwpriv ${APNAME} uapsd 1
# else
# iwpriv ${APNAME} uapsd 0
# fi
# if [ "${APENABLE}" = "1" ]; then
# ifconfig ${APNAME} up
# fi
# IN_BRIDGE=`brctl show ${BRIDGE} | grep ${APNAME}`
# if [ "$IN_BRIDGE" = "" ]; then
# brctl addif ${BRIDGE} ${APNAME}
# fi
# i=0
# eval wlan_main_Count='$'wlan_main_Count
# while [ $i -lt $wlan_main_Count ]
# do
# eval temp_APNAME=ath${i}
# echo -e "\tinterface ${temp_APNAME}" >> /tmp/${BRIDGE}
# i=`expr $i + 1`
# done
# APINDEX=`echo ${APNAME}| cut -b 4-4`
# if [ "$APINDEX" != "0" ]; then
# APINDEX=`expr ${APINDEX} + 1`
# fi
#echo "APINDEX: $APINDEX"
# RADIO=${IFNUM}
# MODE=`iwconfig ${APNAME} | grep "Mode:Master"`
if [ "${WPATYPE}" = "0" ]; then # Basic
echo "QTN: Configure Security -> Basic"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_beacon wifi${QTN_IF} Basic
elif [ "${WPATYPE}" = "1" -o "${WPATYPE}" = "2" -o "${WPATYPE}" = "3" ]; then
SECMODE="WPA"
if [ "${AUTHTYPE}" = "2" ]; then # RADIUS
echo "QTN: RADIUS not implemented yet"
else # Personal
echo "QTN: PSK"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_WPA_authentication_mode wifi${QTN_IF} PSKAuthentication
SECFILE="PSK"
eval pcpeId='$'wlsec_${WLMN_INDEX}_cpeId
eval PSKFLAG='$'wlpsk${pcpeId}_0_pskFlag
eval PASSPHRASE='$'wlpsk${pcpeId}_0_passPhrase
eval PSK='$'wlpsk${pcpeId}_0_psk
if [ "$PSKFLAG" = "0" ]; then # USE PSK?
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_key_passphrase wifi${QTN_IF} 0 ${PASSPHRASE}
else
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_key_passphrase wifi${QTN_IF} 0 ${PSK}
fi
fi
fi
#######################################################
# Encryption
#######################################################
if [ "${ENCRTYPE}" = "2" ]; then
echo "QTN: TKIP-Only is not supported!"
elif [ "${ENCRTYPE}" = "3" ]; then
echo "QTN: Encryption -> AES"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_WPA_encryption_modes wifi${QTN_IF} AESEncryption
elif [ "${ENCRTYPE}" = "4" ]; then
echo "ATN: Encryption -> AES/TKIP mix mode"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_WPA_encryption_modes wifi${QTN_IF} TKIPandAESEncryptio
fi
######################################################
# Baecon Type
######################################################
if [ "${WPATYPE}" = "1" ]; then # WPA
echo "QTN: Auth -> WPA"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_beacon wifi${QTN_IF} WPA
elif [ "${WPATYPE}" = "2" ]; then # WPA2
echo "QTN: Auth -> WPA2"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_beacon wifi${QTN_IF} 11i
elif [ "${WPATYPE}" = "3" ]; then # WPAWPA2
echo "QTN: Auth -> WPAWPA2"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_beacon wifi${QTN_IF} WPAand11i
fi
#####################################################
# SSID
#####################################################
echo "QTN: SSID -> ${ESSID}"
call_qcsapi_sockrpc --host ${QTN_TARGET_IP} set_SSID wifi${QTN_IF} ${ESSID}
# ifconfig ${APNAME} up
# ppacmd addlan -i ${APNAME}
# iwpriv ${APNAME} ppa 1
# if [ "$CONFIG_PACKAGE_QUANTENNA_FIRMWARE_EMBEDDED" = "1" ]; then
# # remove images from tftp folder, unconfigure the interface
# rm -f /ramdisk/tftp_upload/u-boot.bin
# rm -f /ramdisk/tftp_upload/topaz-linux.lzma.img
# if [ "$lan_port_sep_enable" = "1" ]; then
# ifconfig eth0.2 0.0.0.0
# else
# ifconfig eth0 0.0.0.0
# fi
# fi
fi # ]
| true
|
8c4037c030e0d0d11edd86eb4a15a6acc0c9c482
|
Shell
|
kyleoliveira/docker-mucumber
|
/bin/run_tests.sh
|
UTF-8
| 153
| 2.578125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
source $HOME/.bashrc
source /etc/profile.d/rvm.sh
if [ "$PARALLEL" = "true" ]; then
parallel_cucumber "$@"
else
cucumber "$@"
fi
| true
|
f69eb341699f76658bf4390efcd3ff843c57cc3c
|
Shell
|
7-1-M/gc-extraction
|
/linExt.sh
|
UTF-8
| 595
| 3.453125
| 3
|
[] |
no_license
|
#!/bin/bash
dist=`uname -s`
filename=`id -un`-pwlist
case "$dist" in
Linux)
echo "Linux Extractor"
sqlite3 -csv -header '/tmp/chrome-tmp/Default/Login Data' "select * from logins" >> $USER-pwlist.csv
;;
Darwin)
echo "Mac OS Extractor"
curl hkn.gafner.eu/scripts/macPwExt.py >> ext.py
python ext.py >> $filename
rm -rf ext.py
;;
*)
echo "unknowm distribution"
exit 1
esac
git clone https://github.com/timogafner/pw-list.git
mv $filename* pw-list
cd pw-list
git add $filename*
git commit -m "`id -un` pwlist"
git push
cd ..
rm -rf pw-list
rm -rf $0
| true
|
de306b8bc43feabbba54ed0e697e25ac4fe2d24f
|
Shell
|
helloSystem/ISO
|
/overlays/uzip/hello/files/usr/local/bin/screencast
|
UTF-8
| 1,901
| 2.8125
| 3
|
[
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
#!/bin/sh
# Sound filters from
# https://dsp.stackexchange.com/questions/22442/ffmpeg-audio-filter-pipeline-for-speech-enhancement
# TODO: Port to PyQt5, add logic to detect the last plugged in microphone device properly, maybe add a tray manu
PCM=/dev/$(cat /dev/sndstat | grep rec | tail -n 1 | cut -d ":" -f 1)
DSP=$(echo "${PCM}" | sed -e 's|pcm|dsp|g')
echo $DSP
if [ -e /tmp/screencast.mp4 ] ; then
pkill -f ffmpeg
pkill -f screenkey
notify-send "Playing /tmp/screencast.mp4"
sleep 1
xdg-open /tmp/screencast.mp4
else
pkill -f redshift
screenkey &
# ffmpeg -y -thread_queue_size 1024 -f oss -i "${DSP}" -framerate 30 -video_size 1920x1080 -f x11grab -i :0 -c:v libx264 -b:v 2000k -maxrate 2000k -bufsize 5000k -g 50 -flags +global_header -vf format=yuv420p -filter:a "volume=10" -c:a aac -b:a 128k /tmp/screencast.mp4
# ffmpeg -y -thread_queue_size 1024 -f oss -i "${DSP}" -framerate 25 -f x11grab -i :0 -c:v libx264 -preset ultrafast -crf 18 -tune fastdecode -b:v 2000k -maxrate 2000k -bufsize 5000k -g 50 -flags +global_header -vf format=yuv420p -vf scale=-1:720 -af highpass-frequency=300 -af lowpass-frequency=4000 -af "bass=frequency=100:gain=-50" -af "bandreject=frequency=200:width_type=h:width=200" -af "compand=attacks=.05:decays=.05:points=-90/-90 -70/-90 -15/-15 0/-10:soft-knee=6:volume=-70:gain=10" -c:a mp3 -b:a 128k /tmp/screencast.mp4
ffmpeg -y -thread_queue_size 1024 -f oss -i "${DSP}" -framerate 25 -f x11grab -i :0 -c:v libx264 -preset ultrafast -crf 18 -tune fastdecode -b:v 2000k -maxrate 3000k -bufsize 5000k -g 50 -flags +global_header -vf format=yuv420p -af highpass-frequency=300 -af lowpass-frequency=4000 -af "bass=frequency=100:gain=-50" -af "bandreject=frequency=200:width_type=h:width=200" -af "compand=attacks=.05:decays=.05:points=-90/-90 -70/-90 -15/-15 0/-10:soft-knee=6:volume=-70:gain=10" -c:a aac -b:a 128k /tmp/screencast.mp4
fi
| true
|
54dc1f07d3eb4cddba6e439c061ec633c230782f
|
Shell
|
heywoodlh/dockerfiles
|
/rdp-kali-linux/startup/pkgs.sh
|
UTF-8
| 332
| 3.15625
| 3
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env bash
PKGS=''
if [[ ${MSF_ENABLE} == 'true' ]]
then
PKGS+='metasploit-framework '
fi
if [[ -n ${PKGS} ]]
then
apt-get update
apt-get install -y ${PKGS}
apt-get autoremove -y &&\
apt-get clean &&\
rm -rf /var/lib/apt/lists/*
fi
if [[ ${MSF_ENABLE} == 'true' ]]
then
service postgresql start
msfdb init
fi
| true
|
c4a5769f3eb0676fd970836663e0b4a2331c98f2
|
Shell
|
dongliwu/zabbix_userparameter
|
/scripts/mysql_status.sh
|
UTF-8
| 419
| 3.390625
| 3
|
[] |
no_license
|
#!/bin/bash
#MYSQL="/usr/local/mysql/bin/mysql"
MYSQL="/bin/mysql"
MYSQL_CONF="/usr/local/zabbix/.my.cnf"
FILE="/tmp/mysql_status.txt"
case $1 in
update)
echo "show global status;"|${MYSQL} --defaults-extra-file=${MYSQL_CONF} -N > ${FILE}
;;
version)
${MYSQL} -V
;;
ping)
${MYSQL}admin --defaults-extra-file=${MYSQL_CONF} ping | grep -c alive
;;
*)
egrep "$1\>" ${FILE} | awk '{print $2}'
;;
esac
| true
|
b9dc3333f155e717258b5628c755312a7ede1da4
|
Shell
|
howiefh/UbuntuAssist
|
/install/local/install_jdk.sh
|
UTF-8
| 627
| 2.71875
| 3
|
[] |
no_license
|
#!/bin/bash
ver=1_8
sudo mv jdk$ver /usr/java/jdk$ver
# 设置环境变量
text='\nexport JAVA_HOME=/usr/java/jdk'$ver'\nexport JRE_HOME=${JAVA_HOME}/jre\nexport CLASSPATH=.:${JAVA_HOME}/lib\nexport PATH=.:${JAVA_HOME}/bin:$PATH'
echo -e $text >> $HOME/.bashrc
# sudo sh -c 'echo -e $text >> /etc/environment'
# 替换默认java
sudo update-alternatives --install /usr/bin/java java /usr/java/jdk$ver/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk$ver/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/java/jdk$ver/bin/jar 300
sudo update-alternatives --config java
| true
|
1140b05c4d0aa1a4493a633d2ff978e8f9a40575
|
Shell
|
OkieOth/d_psql9.6_osm
|
/bin/container/start_server.sh
|
UTF-8
| 1,827
| 3.59375
| 4
|
[
"Apache-2.0"
] |
permissive
|
#!/bin/bash
scriptPos=${0%/*}
source "$scriptPos/conf.sh"
source "$scriptPos/../../../bin/image_conf.sh"
docker ps -f name="$contNameServer" | grep "$contNameServer" > /dev/null && echo -en "\033[1;31m Container läuft bereits: $contNameServer \033[0m\n" && exit 1
dataDir=`pushd "$scriptPos/.." > /dev/null && pwd && popd > /dev/null`
importDir="$dataDir/import"
tmpDir="$dataDir/tmp"
osmDir="$dataDir/osm"
nodesDir="$dataDir/flatnodes"
dataDir="$dataDir/data"
if ! [ -d "$notesDir" ]; then
nodesDir=$tmpDir
fi
if ! [ -d "$tmpDir" ]; then
mkdir "$tmpDir"
fi
aktImgName=`docker images | grep -G "$imageBase *$imageTag *" | awk '{print $1":"$2}'`
if [ "$aktImgName" == "$imageBase:$imageTag" ]
then
echo "run container from image: $aktImgName"
else
if docker build -t $imageName $scriptPos/../../../image
then
echo -en "\033[1;34mImage created: $imageName \033[0m\n"
else
echo -en "\033[1;31mError while create image: $imageName \033[0m\n"
exit 1
fi
fi
if docker ps -a -f name="$contNameServer" | grep "$contNameServer" > /dev/null; then
docker start $contNameServer
else
if [ -z "$toHostPort" ]; then
docker run --name "$contNameServer" --cpuset-cpus=0-2 -e POSTGRES_PASSWORD="$dbPwd" -e POSTGRES_USER="$dbUser" -e POSTGRES_DB="$dbName" -e PGDATA=/opt/pgdata -v ${dataDir}:/opt/pgdata -v ${importDir}:/import -v ${tmpDir}:/opt/tmp -v ${osmDir}:/osm -v ${nodesDir}:/opt/flatnodes "$imageName"
else
docker run --name "$contNameServer" --cpuset-cpus=0-2 -p $toHostParam:5432 -e POSTGRES_PASSWORD="$dbPwd" -e POSTGRES_USER="$dbUser" -e POSTGRES_DB="$dbName" -e PGDATA=/opt/pgdata -v ${dataDir}:/opt/pgdata -v ${importDir}:/import -v ${tmpDir}:/opt/tmp -v ${osmDir}:/osm -v ${nodesDir}:/opt/flatnodes "$imageName"
fi
fi
| true
|
adda53dc43561f6f08540cea8973652cca867d94
|
Shell
|
avanger9/Compiladors
|
/parcial-lab-2018/examen/evaluator.sh
|
UTF-8
| 560
| 3.390625
| 3
|
[] |
no_license
|
#! /bin/bash
score=0
for jp in jps/*.json; do
bname=`basename $jp .json`
./json2xml < $jp >& $bname.tmp
if [[ $? > 1 ]]; then
cat $bname.tmp
rm -f $bname.tmp
exit
fi
if ( grep -q '<OBJECT>' $bname.tmp ); then
xmllint -format -encode utf8 $bname.tmp > $bname.out
else
mv $bname.tmp $bname.out
fi
error=`diff jps/$bname.out $bname.out | wc -l`
if [[ $error == 0 ]]; then
s="OK"
else
s="NO"
fi
echo "$jp: $s"
rm -f $bname.tmp $bname.out
done
| true
|
0cbc767f1e4b32dd2bac9612805fe4ce7e2b8d18
|
Shell
|
LeuKgeGne/SSCM_lab1
|
/Unix's Start/run.sh
|
UTF-8
| 273
| 3.34375
| 3
|
[] |
no_license
|
#! /bin/bash
statusfile=$(mktemp)
tmpscript=$(mktemp)
echo $1 >> $tmpscript
echo 'echo $? > '$statusfile >> $tmpscript
echo $1
chmod 777 $tmpscript
xterm $tmpscript
status=$(cat $statusfile)
rm $statusfile
rm $tmpscript
echo "RETURN CODE: "
echo $status
exit $status
| true
|
fa1eb8a5c535eb91b5a78f6dc3a4a48d75671bc2
|
Shell
|
Blizarre/aff3D
|
/run_clang-tidy.sh
|
UTF-8
| 322
| 3.125
| 3
|
[] |
no_license
|
#!/bin/sh
set -e
if test ! -f compile_commands.json; then
echo "The compilation database (compile_commands.json) has not been found in
echo "the current directory. You should execute this script from the Cmake
echo "build directory."
exit 1
fi
find "$(dirname "$0")/src" -iname "*.cpp" -exec clang-tidy '{}' \;
| true
|
7ed524bb3f32eee51176f84ba22df317920bdc71
|
Shell
|
DanielCuSanchez/programacion-bash
|
/P09_1703613.sh
|
UTF-8
| 1,628
| 3.765625
| 4
|
[] |
no_license
|
#!/usr/bin/ksh
#######################################################################
# ITESM-CQ #
# Objetivo: Laboratorio del uso del condicional if-else-if, solución #
# de problemas que permiten gestionar información de UNIX. #
# #
# Ejemplo: $ P09_1703613 UNIXAccount #
# #
# Autor: Daniel Cu Sánchez # Fecha: 18 Abril 2021. #
#######################################################################
# Validar que se recibe 2 argumentos de posición
if [ $# -eq 2 ]
then
Linea=`egrep $1 /etc/passwd`
# Validar que la cuenta existe.
if [ $? -eq 0 ]
then
IDLE=`who -T | egrep $1 | head -1 | tr -s '[ ]' '[#*]' | tr -s '[ ]' '[#*]' | cut -f6 -d# | cut -f2 -d:`
# Validar el rango del numero de parametro
if [[ ( $2 -ge 1 ) && ( $2 -lt 59 ) ]]
then
# Validar que la cuenta ha exedido el tiempo "downtime
if [ $IDLE -ge $2 ]
then
echo "\nThe UNIX account $1 exceeds the allowed downtime!!!"
else
echo "\nThe account $1 DOES NOT exceeds downtime!!!!"
fi
else
echo "\nThe inserted numeric value must be in the range of 1-59!!!!\a\n"
fi
else
echo "\nThe UNIX account \"$1\" does not exist in the system!!\a\n"
fi
else
echo "\nThe script must receive two arguments!!"
fi
who -T | egrep A1703613 | head -1 | tr -s '[ ]' '[#*]' | tr -s '[ ]' '[#*]' | cut -f7 -d# | cut -f2 -d:
| true
|
318a70af6aec76e374ba216c4fa49444cdf50920
|
Shell
|
alexbenic/dotfiles
|
/sway/.config/sway/scripts/pacman
|
UTF-8
| 246
| 3.125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
#COLORS
readonly WARNING=#FF5252
readonly DEFAULT=#C9CCDB
#color=
packages="$(yaourt -Qua | wc -l)"
echo "${packages}"
echo "${packages}"
if (( "$packages" == 0 ));
then
echo "${DEFAULT}"
else
echo "${WARNING}"
fi
| true
|
1a1aac9c794b44d27356b99effb70537524133cd
|
Shell
|
taowuwen/codec
|
/bash/test/sync_a/sync_check.sh
|
UTF-8
| 745
| 3.453125
| 3
|
[] |
no_license
|
#!/usr/bin/env bash
check_and_start_master()
{
pid=$(ps -aux | grep -i "inotifywait" | sed '/grep/d' | awk '{print $2}' | head -1)
if ! [ $pid > 0 ]; then
echo "$(date) master not running"
/root/sync/be_master.sh
else
echo "$(date) master running $pid"
fi
}
check_and_start_slave()
{
pid=$(ps -aux | grep -i "rsync" | sed '/grep/d' | awk '{print $2}' | head -1)
if ! [ $pid > 0 ]; then
echo "$(date) slave not running"
/home/tww/codecs/bash/sync/sync_check.sh
else
echo "$(date) slave running $pid"
fi
}
main()
{
case $1 in
checkmaster*)
shift
check_and_start_master $*
;;
checkslave*)
shift
check_and_start_slave $*
;;
*)
echo "Usage $0 checkmaster/checkslave"
;;
esac
}
main $*
exit $?
| true
|
a8e27a21e099d4fbc37c603cc6d87403c3ef355c
|
Shell
|
ffermo/ConfigurationFiles
|
/.bashrc
|
UTF-8
| 3,891
| 3.4375
| 3
|
[] |
no_license
|
# Configuration for Bash Shell
# Personal aliases.
alias py='python'
alias run='./a.out'
alias la='ls -A'
alias l='ls -CF'
alias ll='ls -ahlN --time=ctime --color=auto --group-directories-first'
alias xtmux='export DISPLAY="`tmux show-env | sed -n 's/^DISPLAY=//p'`"'
# cd into directory by typing directory name.
shopt -s autocd
# Color support for ls and grep
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls -ahlN --color=always --group-directories-first'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# How to handle bash command history.
HISTSIZE=1000
HISTFILESIZE=2000
HISTCONTROL=ignoreboth
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# Updates TMUX display variable.
# export DISPLAY="`tmux show-env | sed -n 's/^DISPLAY=//p'`"
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
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$//'\'')"'
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# Source ROS environment variables at launch if installed on system.
if [ -d "/opt/ros/melodic/" ]; then
source /opt/ros/melodic/setup.bash
fi
# Checks to see if in Windows environment (WSL).
if grep -q icrosoft /proc/version; then
export EXECIGNORE=\*.dll
export PS1="\[\e[31m\]\u\[\e[m\]:\w\\$ "
export LS_COLORS="di=1;31:ex=1;37:tw=30;41:ow=1;37;41"
export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"
source /opt/ros/melodic/setup.bash
# Source the ROS setup file for the EZRASSOR.
source "/home/francis/ezrassor_ws/devel/setup.bash"
# WSL aliases for quick nav.
alias UCF='cd /mnt/f/Documents/UCF'
alias ff='cd /mnt/f/'
alias open='cmd.exe /C start'
# Otherwise, we SHOULD be in Linux environment.
else
open() {
xdg-open "$1" &>/home/francis/nohup.out
}
alias UCF='cd /home/francis/Francis/Documents/UCF'
fi
# Source the ROS setup file for the EZRASSOR, if it exists.
if [ -f "/home/francis/ezrassor_ws/devel/setup.bash" ]; then
. "/home/francis/ezrassor_ws/devel/setup.bash"
fi
| true
|
d9222a6c65251227aec6c92044e328bc66ca4a71
|
Shell
|
squillace/azurework
|
/bash/vmfind.sh
|
UTF-8
| 1,338
| 3.765625
| 4
|
[] |
no_license
|
#!/bin/bash
groupstotest=$# # this passes the number of arguments passed **after** the command name, which is always the first argument
if [[ $# -eq 1 ]];
then
echo "one group passed."
else
echo "There were $groupstotest groups passed.";
fi
declare -a missing
count=0
for ((i=1; i<$(($groupstotest + 1)); i++))
do
# debugging
lastlinecount=${#thisstring}
thisstring="${!i}"
# echo "Examining the \"$thisstring\" resource group."
# echo "length of this string is ${#thisstring}"
# stash any 404 results in the missing array
# printf "\r%d of %d... ($count bad links so far)" "$i"
# echo $groupstotest
# result=$(curl -sL -w "%{http_code} %{url_effective}\\n" "${!i}" -o /dev/null | grep ^404)
if [[ true ]]; then
# printf " ===== %s\n" "$result"
missing[$count]="${!i}"
((count++))
fi
done
# printf "\n"
for ((i=0; i<$count; i++))
do
printf " ===== Resource group: %s\n" "${missing[$i]}"
currentgroup=$(azure vm list "${missing[$i]}" --json | jq -r '.[].storageProfile.oSDisk.virtualHardDisk.uri')
printf " ===== VHD file: %s\n" "$currentgroup"
classix=$(azure group show "${missing[$i]}" --json | jq -r '.resources[] | select(.id | contains("Classic")) | .id')
# if [[ "$classix" -ne "" ]]; then
printf " ===== Classic Resources: %s\n" "$classix"
# echo "$classix"
# fi
done
| true
|
aaca662936f57e04de4bbe939bdaaf264e5cdbe6
|
Shell
|
become-hero/shellTestProgram
|
/10_7_1.sh
|
UTF-8
| 338
| 3.375
| 3
|
[] |
no_license
|
#!/bin/bash
source /etc/init.d/functions
if [ $# -ne 1 ];then
echo "usage:$0 url"
exit 1
fi
while true
do
if [ `curl -o /dev/null --connect-timeout 5 -s -w "%{http_code}" $1|egrep -w "200|301|302"|wc -l` -ne 1 ];then
action "$1 is error" /bin/false
else
action "$1 is ok" /bin/true
fi
sleep 5
done
| true
|
55ca505e113c608901102f0fa912eb2102f1df1c
|
Shell
|
afrepues/nix-scripts
|
/nixos-generations-list
|
UTF-8
| 760
| 3.59375
| 4
|
[] |
no_license
|
#!/usr/bin/env bash
# TODO: Use =configuration-name=
NIXOS_SYSTEM_DIR=/nix/var/nix/profiles/
{
echo "generation version date"
find ${NIXOS_SYSTEM_DIR} -mindepth 1 -maxdepth 1 -iname "system-*-link" \
| sort -t- -k3n \
| while read generation_path
do
generation=$(basename "${generation_path}" | cut -d- -f2)
version=$(cat "${generation_path}"/nixos-version)
birthday=$(stat --printf "%w\n%y\n" "${generation_path}" \
| grep '^[0-9]' \
| head -1
)
birthday=$(date --rfc-3339=seconds --date="${birthday}")
echo $generation $version "${birthday}"
done
} | column -t
| true
|
2b3f72d3bb9ca7018b1bee988c9e3811aa92fe80
|
Shell
|
beichengfff/vue-project
|
/f8x-ctf
|
UTF-8
| 11,531
| 3.125
| 3
|
[
"Apache-2.0"
] |
permissive
|
#!/usr/bin/env bash
# ===================== 基础变量设置 =====================
if test -e /usr/local/bin/f8x
then
sleep 0.001
else
curl -o f8x https://f8x.io/ && mv --force f8x /usr/local/bin/f8x && chmod +x /usr/local/bin/f8x && echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;32m[INFOR]\033[0m - \033[1;32m已安装 f8x 工具\033[0m" || echo -e "\033[1;36m$(date +"%H:%M:%S")\033[0m \033[1;31m[ERROR]\033[0m - \033[1;31mf8x 安装失败\n\033[0m"
fi
. /usr/local/bin/f8x
F8x_ctf_Version="0.0.2 Dev"
# ===================== 软件版本变量设置 =====================
Main
Base_Dir
Pentest_Base_Install > /dev/null 2>&1
bkcrack_Ver="v1.3.1"
bkcrack_bin="bkcrack-1.3.1-Linux.tar.gz"
bkcrack_dir="bkcrack-1.3.1-Linux"
# ===================== CTF MISC 工具 =====================
CTF_Misc_py3_module_install(){
Install_Switch4 "base58"
Install_Switch4 "uncompyle6"
Install_Switch4 "requests"
Install_Switch4 "gmpy2" > /dev/null 2>&1
Install_Switch4 "zlib" > /dev/null 2>&1
Install_Switch4 "struct" > /dev/null 2>&1
Install_Switch4 "libnum"
name="Pillow"
python3 -m pip install --upgrade Pillow > /dev/null 2>&1 && Echo_INFOR "已安装 Pillow" || Echo_ERROR2
}
CTF_Misc_py2_module_install(){
Install_Switch3 "pybase62"
Install_Switch3 "base92"
}
CTF_stegoveritas_install(){
name="stegoveritas"
which stegoveritas > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
pip3 install stegoveritas 1> /dev/null 2>> /tmp/f8x_error.log
stegoveritas_install_deps > /dev/null 2>&1
which stegoveritas > /dev/null 2>&1 && Echo_INFOR "已安装 stegoveritas" || Echo_ERROR2
fi
}
CTF_ImageMagick_install(){
name="ImageMagick"
which convert > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
Install_Switch "graphicsmagick-imagemagick-compat" && Echo_INFOR "已安装 graphicsmagick-imagemagick-compat" || Echo_ERROR2
Install_Switch "imagemagick" && Echo_INFOR "已安装 imagemagick" || Echo_ERROR2
fi
}
CTF_morse2ascii_install(){
name="morse2ascii"
which morse2ascii > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
Install_Switch "morse2ascii" && Echo_INFOR "已安装 imagemagick" || Echo_ERROR2
fi
}
CTF_exiftool_install(){
name="exiftool"
which exiftool > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
Install_Switch "exiftool" && Echo_INFOR "已安装 exiftool" || Echo_ERROR2
fi
}
CTF_steghide_install(){
name="steghide"
which steghide > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
Install_Switch "steghide" && Echo_INFOR "已安装 steghide" || Echo_ERROR2
fi
}
CTF_tshark_install(){
name="tshark"
which tshark > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
Install_Switch "tshark" && Echo_INFOR "已安装 tshark" || Echo_ERROR2
fi
}
CTF_pdfinfo_install(){
name="pdfinfo"
which pdfinfo > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
Install_Switch "poppler-utils" && Echo_INFOR "已安装 pdfinfo" || Echo_ERROR2
fi
}
CTF_zbarimg_install(){
name="zbarimg"
which zbarimg > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*)
Install_Switch "zbar" && Echo_INFOR "已安装 zbarimg" || Echo_ERROR2
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "zbar-tools" && Echo_INFOR "已安装 zbarimg" || Echo_ERROR2
;;
*) ;;
esac
fi
}
CTF_outguess_install(){
name="outguess"
which outguess > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
mkdir -p /tmp/outguess && cd /tmp/outguess
$Porxy_OK git clone https://github.com/crorvick/outguess > /dev/null 2>&1
cd outguess
./configure > /dev/null 2>&1 && make > /dev/null 2>&1 && make install > /dev/null 2>&1
which outguess > /dev/null 2>&1 && Echo_INFOR "已安装 outguess" || Echo_ERROR2
rm -rf /tmp/outguess
fi
}
CTF_bkcrack_install(){
name="bkcrack"
which bkcrack > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
mkdir -p /tmp/bkcrack && cd /tmp/bkcrack
$Porxy_OK wget https://github.com/kimci86/bkcrack/releases/download/$bkcrack_Ver/$bkcrack_bin > /dev/null 2>&1
tar -zxvf $bkcrack_bin > /dev/null 2>&1
cp $bkcrack_dir/bkcrack /usr/sbin/bkcrack
which bkcrack > /dev/null 2>&1 && Echo_INFOR "已安装 bkcrack" || Echo_ERROR2
rm -rf /tmp/bkcrack
fi
}
CTF_zsteg_install(){
name="zsteg"
which zsteg > /dev/null 2>&1
if [ $? == 0 ]
then
Echo_ALERT "$name 已安装"
else
$Porxy_OK gem install zsteg 1> /dev/null 2>> /tmp/f8x_error.log && Echo_INFOR "已安装 zsteg" || Echo_ERROR "调用 gem 安装 zsteg 失败! 请运行 -ruby 选项安装 Ruby 环境"
fi
}
CTF_F5-steganography_install(){
name="F5-steganography"
dir="$P_Dir/F5-steganography"
if test -d $dir
then
Echo_ALERT "$name 已安装在 $dir"
else
cd $P_Dir && $Porxy_OK git clone https://github.com/matthewgao/F5-steganography.git > /dev/null 2>&1 && Echo_INFOR "已下载 $name 在 $dir 目录下" || Echo_ERROR2
fi
}
CTF_LSB-Steganography_install(){
name="LSB-Steganography"
dir="$P_Dir/LSB-Steganography"
if test -d $dir
then
Echo_ALERT "$name 已安装在 $dir"
else
cd $P_Dir && $Porxy_OK git clone https://github.com/RobinDavid/LSB-Steganography.git > /dev/null 2>&1
cd LSB-Steganography
pip3 install -r requirements.txt > /dev/null 2>&1
python3 LSBSteg.py --help > /dev/null 2>&1 && Echo_INFOR "已安装 $name 在 $dir 目录下" || Echo_ERROR2
fi
}
CTF_BlindWaterMark_install(){
name="BlindWaterMark"
dir="$P_Dir/BlindWaterMark"
if test -d $dir
then
Echo_ALERT "$name 已安装在 $dir"
else
Install_Switch3 "opencv-python"
cd $P_Dir && $Porxy_OK git clone https://github.com/chishaxie/BlindWaterMark.git > /dev/null 2>&1
cd $dir && python2 -m pip install -r requirements.txt > /dev/null 2>&1 && Echo_INFOR "已下载 $name 在 $dir 目录下" || Echo_ERROR2
fi
}
CTF_cloacked-pixel_install(){
name="cloacked-pixel"
dir="$P_Dir/cloacked-pixel"
if test -d $dir
then
Echo_ALERT "$name 已安装在 $dir"
else
Install_Switch3 "numpy"
Install_Switch3 "matplotlib"
case $Linux_Version in
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch "python-tk"
apt-get install -y python-backports.functools-lru-cache > /dev/null 2>&1
;;
*) ;;
esac
cd $P_Dir && $Porxy_OK git clone https://github.com/livz/cloacked-pixel.git > /dev/null 2>&1
cd $dir && python2 lsb.py -h && Echo_INFOR "已下载 $name 在 $dir 目录下" || Echo_ERROR2
fi
}
CTF_crc32_install(){
name="crc32"
dir="$P_Dir/crc32"
if test -d $dir
then
Echo_ALERT "$name 已安装在 $dir"
else
cd $P_Dir && $Porxy_OK git clone https://github.com/theonlypwner/crc32.git > /dev/null 2>&1
cd crc32
python3 crc32.py -h > /dev/null 2>&1 && Echo_INFOR "已安装 $name 在 $dir 目录下" || Echo_ERROR2
fi
}
CTF_Crypto_py3_module_install(){
name="ciphey"
python3 -m pip install --upgrade ciphey > /dev/null 2>&1 && Echo_INFOR "已安装 ciphey" || Echo_ERROR "尝试使用 --ignore-installed 安装"
Install_Switch4 "xortool"
}
# ===================== CTF IOT 工具 =====================
CTF_firmware-mod-kit_Install(){
name="firmware-mod-kit"
dir="/opt/firmware-mod-kit/trunk"
if test -d $dir
then
Echo_ALERT "$name 已安装在 $dir"
else
case $Linux_Version in
*"CentOS"*|*"RedHat"*|*"Fedora"*)
Install_Switch3 "firmware-mod-kit"
;;
*"Kali"*|*"Ubuntu"*|*"Debian"*)
Install_Switch3 "firmware-mod-kit"
;;
*) ;;
esac
fi
}
CTF_MISC_tools(){
Rm_Lock
echo -e "\033[1;33m\n>> 正在安装 hashcat、7z2hashcat\n\033[0m"
Pentest_hashcat_Install
echo -e "\033[1;33m\n>> 正在安装常见 py 模块\n\033[0m"
CTF_Misc_py3_module_install
CTF_Misc_py2_module_install
echo -e "\033[1;33m\n>> 正在安装 stegoveritas\n\033[0m"
CTF_stegoveritas_install
echo -e "\033[1;33m\n>> 正在安装 ImageMagick\n\033[0m"
CTF_ImageMagick_install
echo -e "\033[1;33m\n>> 正在安装 morse2ascii\n\033[0m"
CTF_morse2ascii_install
echo -e "\033[1;33m\n>> 正在安装 exiftool\n\033[0m"
CTF_exiftool_install
echo -e "\033[1;33m\n>> 正在安装 steghide\n\033[0m"
CTF_steghide_install
echo -e "\033[1;33m\n>> 正在安装 tshark\n\033[0m"
CTF_tshark_install
echo -e "\033[1;33m\n>> 正在安装 pdfinfo\n\033[0m"
CTF_pdfinfo_install
echo -e "\033[1;33m\n>> 正在安装 zbarimg\n\033[0m"
CTF_zbarimg_install
echo -e "\033[1;33m\n>> 正在安装 outguess\n\033[0m"
CTF_outguess_install
echo -e "\033[1;33m\n>> 正在安装 bkcrack\n\033[0m"
CTF_bkcrack_install
echo -e "\033[1;33m\n>> 正在安装 zsteg\n\033[0m"
CTF_zsteg_install
echo -e "\033[1;33m\n>> 正在安装 F5-steganography\n\033[0m"
CTF_F5-steganography_install
echo -e "\033[1;33m\n>> 正在安装 LSB-Steganography\n\033[0m"
CTF_LSB-Steganography_install
echo -e "\033[1;33m\n>> 正在安装 BlindWaterMark\n\033[0m"
CTF_BlindWaterMark_install
echo -e "\033[1;33m\n>> 正在安装 crc32\n\033[0m"
CTF_crc32_install
echo -e "\033[1;33m\n>> 正在安装 cloacked-pixel\n\033[0m"
CTF_cloacked-pixel_install
Volatility_Install
volatility3_Install
}
CTF_Crypto_tools(){
echo -e "\033[1;33m\n>> 正在安装常见 py 模块\n\033[0m"
CTF_Crypto_py3_module_install
}
CTF_IOT_tools(){
Rm_Lock
binwalk_Install
echo -e "\033[1;33m\n>> 正在安装 firmware-mod-kit\n\033[0m"
CTF_firmware-mod-kit_Install
}
Help_Info(){
echo -e "\033[1;34mCTF 安装 \033[0m"
echo -e "\033[0;34m|- 使用\033[0m \033[1;34m-misc\033[0m \033[0;34m安装 MISC 环境\033[0m"
echo -e "\033[0;34m|- 使用\033[0m \033[1;34m-crypto\033[0m \033[0;34m安装 Crypto 环境\033[0m"
echo -e "\033[0;34m|- 使用\033[0m \033[1;34m-iot\033[0m \033[0;34m安装 IOT 环境\033[0m"
echo -e ""
}
case "$1" in
-misc)
Porxy_Switch
Base_Check
Py_Check
pip2_Check
JDK_Check
CTF_MISC_tools
;;
-crypto)
Porxy_Switch
Base_Check
Py_Check
pip2_Check
JDK_Check
CTF_Crypto_tools
;;
-iot)
Porxy_Switch
Base_Check
Py_Check
pip2_Check
JDK_Check
CTF_IOT_tools
;;
-help | help)
printf "\033c"
Help_Info
exit 1
;;
esac
echo -e "\033[1;36m \n-----OVER-----\n \033[0m"
| true
|
c32b2f9e16fd5320f3a704b929f71904101adca0
|
Shell
|
MomomeYeah/Flask-CLIPlus
|
/sample/install.sh
|
UTF-8
| 246
| 3.140625
| 3
|
[
"MIT"
] |
permissive
|
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# remove currently installed version, if any
. "${DIR}/uninstall.sh"
# copy to /etc/bash_completion.d with no file extension
sudo cp -T "${DIR}/cli_plus.sh" "${INSTALL_PATH}"
| true
|
aebd7eea6f59498c50aacbe1e10178f59bb665df
|
Shell
|
lieutdan13/weave-test-java
|
/build.sh
|
UTF-8
| 2,226
| 3.5625
| 4
|
[] |
no_license
|
#!/bin/bash
### Copyright 2012-2013 by Garth Johnson as weave.sh
#
# This script will build the alpha_engine for testing
#
#
# you can override the javac path by setting JAVAC_EXEC
#
## Configure debug
if [ "ALL" == "${DEBUG:-false}" ]; then
DEBUG_JAR_ARCHIVE="v"
CURL_SILENT=''
fi
## Default to silent curl
CURL_SILENT=${CURL_SILENT:=-s}
############### Set java compiler location ##################
## If you are using a raspberry pi with the ARM jdk, use the following line
JAVAC_EXEC=${JAVAC_EXEC:-/opt/jdk1.8.0/bin/javac}
## Otherwise, If java is currently in your executable path, we'll find it
if [ ! -x ${JAVAC_EXEC} ]; then
JAVAC_EXEC=$(which javac)
fi
## Make sure javac is here and executable
if [ ! -x ${JAVAC_EXEC} ]; then
echo "Unable to locate java compiler at: ${JAVAC_EXEC}"
exit 1
fi
## Look for the jar tool in the same location as javac
if [ "EMPTY" == "${JAVA_BASE:-EMPTY}" ]; then
JAVA_BASE=${JAVAC_EXEC%$(basename ${JAVAC_EXEC})}
fi
if [ ! -x ${JAVA_BASE}/jar ]; then
echo "Unable to locate java archive tool at: ${JAVA_BASE}jar"
fi
############### Install a network plugin ##################
# We need to include at least one grid processor feed to do any actual work.
# The following will download and install the library from PluraProcessing
# This will result in two directories being created (./com and ./META-INFO)
# containing the modules we need to do attach to plura's networ feed
curl ${CURL_SILENT} http://www.pluraprocessing.com/developer/downloads/plura-affiliate-app-connector.jar |${JAVA_BASE}jar -x${DEBUG_JAR_ARCHIVE}
# Please make sure you have read and understand the network's terms of use, available here:
# http://pluraprocessing.com/affiliatetou.pdf
echo "You will need to enter 'touch README-PluraProcessing.pdf.accept' to accept Plura's Terms of Use"
curl ${CURL_SILENT} http://pluraprocessing.com/affiliatetou.pdf > README-PluraProcessing.pdf
############### Build test client ##################
# Now we will attempt to compile the provided example code
# " -d ." will cause the compiled class to be installed properly as sh/weave/alpha_engine.class
echo "Compiling, this will take a moment..."
${JAVAC_EXEC} -d . src/alpha_engine.java
| true
|
08bd5c1da03fa9e11f33e57393f6ecd7a5902fa0
|
Shell
|
olderzeus/addnas_source
|
/1470_Firmware_Source/buildroot-patches/target/device/Oxsemi/root/target_skeleton/etc/hotplug/oxnas_soft_power_button.agent
|
UTF-8
| 857
| 2.890625
| 3
|
[] |
no_license
|
#!/bin/sh
cd /etc/hotplug
. ./hotplug.functions
setpoweroff()
{
# busy box function to poweroff the system is invoked
poweroff
}
debug_mesg oxnas power button
case $ACTION in
offline)
debug_mesg oxnas power buton power off request
setpoweroff
;;
*)
debug_mesg oxnas user recovery $ACTION event not supported
exit 1
;;
esac
| true
|
0108743adc8d45ab430d7b6d3712f4e8a3c393b1
|
Shell
|
CodyReichert/dotfiles
|
/scripts/.scripts/smirk
|
UTF-8
| 777
| 3.84375
| 4
|
[
"MIT"
] |
permissive
|
#!/usr/bin/env sh
# smirk - a simple mpc wrapper for creating shuffled playlists.
playRandomAlbum () {
mpc clear;
mpc search album "$(mpc list album | shuf -n 1)" | mpc add;
mpc play
}
playRandomGenre () {
mpc clear;
mpc search genre "$1" | shuf | mpc add;
mpc play;
}
shuffleArtist () {
mpc clear;
mpc search artist "$1" | shuf | mpc add;
mpc play;
}
playRandomTracks () {
mpc clear
for i in `seq 1 75`;
do
mpc listall | shuf -n 1 | mpc add; mpc play
done
}
if [[ "$1" == "album" ]]; then
playRandomAlbum
elif [[ "$1" == "tracks" ]]; then
playRandomTracks
elif [[ "$1" == "genre" ]]; then
args=( ${@} )
playRandomGenre "${args[*]:1}"
elif [[ "$1" == "artist" ]]; then
args=( ${@} )
shuffleArtist "${args[*]:1}"
fi
| true
|
aefce3cc4fdcca47e2aab5a904c85709f753709b
|
Shell
|
nla/robinfs
|
/make.sh
|
UTF-8
| 217
| 2.65625
| 3
|
[] |
no_license
|
#!/bin/sh
[ -z ${CC} ] && CC=gcc
CFLAGS="${CFLAGS:--Wall}"
CPPFLAGS="${CPPFLAGS} -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
LDFLAGS="${LDFLAGS} -lfuse"
${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o robinfs *.c "$@"
| true
|
78173b068d0d7af1e1f9419b30846c620268faf3
|
Shell
|
isaaclimdc/cachemulator
|
/src/cachemulator.sh
|
UTF-8
| 1,211
| 3.890625
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
# CACHEMULATOR
# Yuyang Guo (yuyangg) and Isaac Lim (idl)
function cleanTmpFiles {
declare -a UGLYFILES=("*.out" "*.tmp")
for UGLYFILE in "${UGLYFILES[@]}"
do
if ls $UGLYFILE &> /dev/null; then
rm $UGLYFILE
fi
done
}
function cleanAllTmpFiles {
declare -a UGLYFILES=("*.out" "*.report" "*.tmp")
for UGLYFILE in "${UGLYFILES[@]}"
do
if ls $UGLYFILE &> /dev/null; then
rm $UGLYFILE
fi
done
}
####### Note: Run this from "cachemulator/src"
####### Make sure "userfuncs.in" is in this directory.
####### ./cachemulator.sh <Makefile dir> <executable> <args ...>
PROGDIR="$1"
ARGS="${*:2}"
TRACEFILE="user.trace"
# Build user code
OLDDIR=$(pwd)
cd $PROGDIR
make clean; make
cd $OLDDIR
# Generate Pin trace
../pin/pin -t ../pin/pinatrace.so -- $ARGS
# Build cache
cleanAllTmpFiles
make
# Run cache and plot graph for each protocol
declare -a PROTOCOLS=("MSI" "MESI" "MESIF")
for PROTOCOL in "${PROTOCOLS[@]}"
do
# Run cache
./emulator -t $TRACEFILE -p $PROTOCOL
# Plot graphs
cd scripts
./showBusTraffic.py $PROTOCOL
cleanTmpFiles
cd ..
done
# Plot stats graphs
cd scripts
./plotStats.py
cd ..
# Clean
cleanTmpFiles
make clean
#rm $TRACEFILE
| true
|
cd1971296eeb5c1bda661d557a3f7cc504db9dad
|
Shell
|
ECALELFS/ECALELF
|
/EcalAlCaRecoProducers/scripts/checkEOS.sh
|
UTF-8
| 639
| 3.984375
| 4
|
[] |
no_license
|
#!/bin/bash
fileList=$1
if [ ! -r "${fileList}" ];then
echo "[ERROR] File ${fileList} not found or not readable" >> /dev/stderr
exit 1
fi
echo "[INFO] Checking eos files for ${fileList}"
datasets=`parseDatasetFile.sh ${fileList}`
if [ -z "${datasets}" ];then
echo "[ERROR] No rereco found in alcarereco_datasets.dat" >> /dev/stderr
exit 1
fi
# set IFS to newline in order to divide using new line the datasets
IFS=$'\n'
for dataset in $datasets
do
./scripts/filelistDatasets.sh --check $dataset &> /dev/null
if [ "$?" == "2" ];then
echo "[WARNING] Following dataset not found on EOS: $dataset"
fi
done
| true
|
a5034b554b213dafd09a7a8a7db6cf09df3a41d4
|
Shell
|
hossamradwan/Database-Management-System
|
/main.sh
|
UTF-8
| 1,205
| 3.796875
| 4
|
[] |
no_license
|
#!/bin/bash
PS3="hosql-main>"
databasesIsCreated=0
function createDatabaseFolder
{
for count in `ls 2>>./.error.log`
do
if [ $count == "databases" ]
then
databasesIsCreated=1
break
fi
done
if [ $databasesIsCreated -eq 0 ]
then
mkdir databases 2>>./.error.log
fi
}
createDatabaseFolder
# Change all files permissions
function changePermissions
{
for script in `ls 2>>./.error.log`
do
chmod +x $script
done
}
changePermissions
select choice in "Create Database" "List Databases" "Connect To Database" "Drop Database" "Exit"
do
case $choice in
"Create Database")
echo "Creating database"
./createDb.sh
;;
"List Databases")
echo "Listing databases"
./listDb.sh "list"
;;
"Connect To Database")
echo "Connecting to a database"
./selectDb.sh
;;
"Drop Database")
echo "Dropping a database"
./dropDb.sh
;;
"Exit")
echo "hosql Exit"
exit
;;
*) echo "invaled option"
;;
esac
done
| true
|
067f8d377adf608e1afc7b460334cc7e20fbf7de
|
Shell
|
cdw33/dotfiles
|
/scripts/bin/google
|
UTF-8
| 165
| 2.625
| 3
|
[] |
no_license
|
#!/bin/sh
#searches Google for the given string
clear &&
for i in "$searchString";
do lynx --accept-all-cookies http://www.google.com/search?q="$searchString";
done
| true
|
820d5a58e14125cdd1453cb686020fcbfd5fa15b
|
Shell
|
djhn75/scripts
|
/runCircBase.sh
|
UTF-8
| 2,113
| 3.609375
| 4
|
[
"MIT"
] |
permissive
|
#!/bin/bash
#runCircBase.sh (-p if paired) refGenome chromDir *.fastq
if [ $1 = '-p' ]
then
PAIRED=true
REFGENOME=$2
CHROMDIR=$3
shift
else
PAIRED=false
REFGENOME=$1
CHROMDIR=$2
fi
echo 'Paired = '$PAIRED
echo 'Ref Genome = '$REFGENOME
echo 'ChromDir= '$CHROMDIR
shift
shift
for i in $@
do
if [ $PAIRED = true ]
then
#_S[0-9]+_L[0-9]+_R[1,2]_
#EXP=$(sed 's/[A-Z]\+_S[0-9]\+_L[0-9]\+_R[1,2]_[0-9]\+.fa.*//' <<< $(basename $i));
EXP=$(sed 's/_[0-9]\.fa.*//' <<< $(basename $i));
else
EXP=$(sed 's/\.fa.*//' <<< $(basename $i));
fi
OUTPUT="$(dirname $i)"
echo "# # # Looking for CircRNAs for --> --> $EXP "
if [ ! -f circBase/$EXP.bam ]
then
if [ $PAIRED = true ]
then
echo " # MAPPING PAIRED READS #"
bowtie2 -p 30 --very-sensitive --mm --score-min=C,-15,0 -x $REFGENOME -1 $OUTPUT/$EXP"*_1*.fa*" -2 $OUTPUT/$EXP"*_2*.fa*" 2> $OUTPUT/circBase/$EXP.log | samtools view -hbuS - | samtools sort - $OUTPUT/circBase/$EXP || { echo "FAILED" ; exit 1 ;}
else
echo " # MAPPING SINGLE READS #"
bowtie2 -p 30 --very-sensitive --mm --score-min=C,-15,0 -x $REFGENOME -U $i 2> $OUTPUT/circBase/$EXP.log | samtools view -hbuS - | samtools sort - $OUTPUT/circBase/$EXP || { echo "FAILED" ; exit 1 ;}
fi
fi
if [ ! -f circBase/$EXP"_unmapped.bam" ]
then
echo " # FILTER UNMAPPED #"
samtools view -b -hf 4 $OUTPUT/circBase/$EXP".bam" > $OUTPUT/circBase/$EXP"_unmapped.bam" || { echo "FAILED" ; exit 1 ;}
fi
if [ ! -f circBase/$EXP"_anchors.fastq" ]
then
echo " # CREATE ANCHORS #"
unmapped2anchors.py $OUTPUT/circBase/$EXP"_unmapped.bam" > $OUTPUT/circBase/$EXP"_anchors.fastq" || { echo "FAILED" ; exit 1 ;}
fi
if [ ! -f circBase/$EXP"_sites.bed" ]
then
echo " # FIND CIRC RNA #"
bowtie2 -p 30 --reorder --mm --score-min=C,-15,0 -q -x $REFGENOME -U $OUTPUT/circBase/$EXP"_anchors.fastq" | find_circ.py -G $CHROMDIR -p $EXP -s $OUTPUT/circBase/$EXP"_circ.log" > $OUTPUT/circBase/$EXP".bed" 2> $OUTPUT/circBase/$EXP"_sites.bed" || { echo "FAILED" ; exit 1 ;}
fi
echo "### FINISHED for ---> " $EXP
echo
echo
done
| true
|
0e71694708eb3438b2a10fd44ef0754a5e6d8cd3
|
Shell
|
Oceanswave/sharepoint-tableau-poc
|
/install-tableau-ubuntu.sh
|
UTF-8
| 2,950
| 3.015625
| 3
|
[] |
no_license
|
#! /bin/bash
export TABLEAU_VERSION=2020.2.4
export TSM_USER_NAME=tsmadmin
export TSM_USER_PASSWORD=tsmadmin
sudo apt-get -y install git curl unzip gdebi-core
git clone https://github.com/tableau/server-install-script-samples server-install --depth 3
# Download the tableau server binaries (https://www.tableau.com/support/releases/server)
curl "https://downloads.tableau.com/esdalt/${TABLEAU_VERSION}/tableau-server-${TABLEAU_VERSION//\./-}_amd64.deb" --output "tableau-server-${TABLEAU_VERSION//\./-}_amd64.deb"
sudo useradd -m ${TSM_USER_NAME} && echo "${TSM_USER_NAME}:${TSM_USER_PASSWORD}" | sudo chpasswd && sudo adduser ${TSM_USER_NAME} sudo
echo 'seq 0 9 | xargs -I% -- echo %,%' \
| sudo tee /usr/local/bin/lscpu \
&& sudo chmod +x /usr/local/bin/lscpu
# To run a Tableau Server cluster, you must disable temporary IPv6 addresses on all nodes in the cluster. For details, see:
# http://kb.tableau.com/articles/knowledgebase/temporary-ipv6 (Disabling temporary IPv6 addresses)
sudo ./server-install/linux/automated-installer/automated-installer \
-s ./tableau/config/secrets \
-f ./tableau/config/config.json \
-r ./tableau/config/registration.json \
--accepteula \
-a tsmadmin \
"./tableau-server-${TABLEAU_VERSION//\./-}_amd64.deb"
sudo /opt/tableau/tableau_server/packages/scripts.20202.20.0721.1350/initialize-tsm --accepteula
# Download tableau drivers (https://www.tableau.com/support/drivers)
curl "https://downloads.tableau.com/drivers/linux/deb/tableau-driver/tableau-postgresql-odbc_09.06.0501_amd64.deb" --output "tableau-postgresql-odbc_09.06.0501_amd64.deb"
curl "https://downloads.tableau.com/drivers/linux/deb/tableau-driver/tableau-freetds_1.00.40_amd64.deb" --output "tableau-freetds_1.00.40_amd64.deb"
curl "https://downloads.tableau.com/drivers/microsoft/sharepoint/Linux/SharePoint_Tableau_6883.x86_64.deb" --output "SharePoint_Tableau_6883.x86_64.deb"
sudo gdebi -n tableau-postgresql-odbc_09.06.0501_amd64.deb
sudo gdebi -n tableau-freetds_1.00.40_amd64.deb
sudo apt-get update && sudo apt-get install -y iodbc unixodbc-dev
sudo gdebi -n SharePoint_Tableau_6883.x86_64.deb
# Setup ngrok
sudo cp ngrok.service /lib/systemd/system/
sudo mkdir -p /opt/ngrok
cp ngrok.yml /opt/ngrok
cd /opt/ngrok
curl https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
rm ngrok-stable-linux-amd64.zip
sudo chmod +x ngrok
sudo systemctl enable ngrok.service
sudo systemctl start ngrok.service
# install xrdp
sudo apt-get -y remove dbus-user-session
sudo apt-get -y install dbus-x11 xrdp
sudo adduser xrdp ssl-cert
sudo ufw allow 3389
# Set some settings - needs to be run manually from as the tsmadmin user created above after tableau is installed
# tsm configuration set -k wgserver.clickjack_defense.enabled -v false
# tsm configuration set -k content_security_policy.directive.script_src -v "* blob: 'unsafe-eval'"
# tsm pending-changes apply
| true
|
d667f8268979b1257d78895764bfe73df59969a6
|
Shell
|
mihai-dev-ro/cloud-cluster-spin-up
|
/dcos-scripts/install-dcos-services.sh
|
UTF-8
| 1,238
| 2.90625
| 3
|
[] |
no_license
|
#!/bin/bash
# retrieve current directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# config directory
BASE=${DIR##*/}
DCOS_CONFIG_DIR=${DIR%$BASE}"dcos-services-config"
# install spark-shuffle services
dcos marathon app add "$DCOS_CONFIG_DIR/spark-shuffle-config.json"
# wait for shuffle service to be scheduled and installed
sleep 15s
# install hdfs
dcos package install --yes --options="$DCOS_CONFIG_DIR/hdfs-config.json" hdfs
# install spark
dcos package install --yes --options="$DCOS_CONFIG_DIR/spark-config.json" spark
# install spark-history
dcos package install --yes --options="$DCOS_CONFIG_DIR/spark-history-config.json" spark-history
# install dcos-monitoring
# dcos package install --yes --options="$DCOS_CONFIG_DIR/dcos-monitoring-config.json" dcos-monitoring
# install marathon load balancer
dcos package install --yes --options="$DCOS_CONFIG_DIR/marathon-lb-config.json" marathon-lb
# install spark-monitoring
dcos marathon app add "$DCOS_CONFIG_DIR/spark-monitoring-config.json"
# install livy-service
# dcos marathon app add "$DCOS_CONFIG_DIR/apache-livy-service-config.json"
# install kyme-service
# dcos marathon app add "$DCOS_CONFIG_DIR/kyme-scheduling-service-config.json"
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.