Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Disable upload for cron runs. | #!/bin/bash
source .travis/common.sh
set -e
# Close the after_success fold travis has created already.
travis_fold end after_success
start_section "package.contents" "${GREEN}Package contents...${NC}"
tar -jtf $CONDA_OUT | sort
end_section "package.contents"
if [ x$TRAVIS_BRANCH = x"master" ]; then
$SPACER
start_section "package.upload" "${GREEN}Package uploading...${NC}"
anaconda -t $ANACONDA_TOKEN upload --user $ANACONDA_USER $CONDA_OUT
end_section "package.upload"
fi
| #!/bin/bash
source .travis/common.sh
set -e
# Close the after_success fold travis has created already.
travis_fold end after_success
start_section "package.contents" "${GREEN}Package contents...${NC}"
tar -jtf $CONDA_OUT | sort
end_section "package.contents"
if [ x$TRAVIS_BRANCH = x"master" -a x$TRAVIS_EVENT_TYPE != x"cron" ]; then
$SPACER
start_section "package.upload" "${GREEN}Package uploading...${NC}"
anaconda -t $ANACONDA_TOKEN upload --user $ANACONDA_USER $CONDA_OUT
end_section "package.upload"
fi
|
Remove old jks before creating new one | #! /bin/bash
#
# Script to convert the Let's "Encrypt" output to a Java Keystore
#
# Usage: ./letsencrypt2jks.sh [DOMAIN] [JKS_PASSWORD]
#
hash openssl 2>/dev/null || { echo >&2 "I require openssl but it's not installed. Aborting."; exit 1; }
if [ "$#" -ne 2 ]; then
"Usage: target/letsencrypt2jks.sh [DOMAIN] [PASSWORD]"
fi
sudo openssl pkcs12 -export \
-in "/etc/letsencrypt/live/$1/fullchain.pem" \
-inkey "/etc/letsencrypt/live/$1/privkey.pem" \
-out "/tmp/jiiify_cert_and_key.p12" \
-name "jiiify" \
-caname "root" \
-password "pass:$2"
sudo keytool -importkeystore \
-deststorepass "$2" \
-destkeypass "$2" \
-destkeystore "le_jiiify.jks" \
-srckeystore "/tmp/jiiify_cert_and_key.p12" \
-srcstoretype "PKCS12" \
-srcstorepass "$2" \
-alias "jiiify"
| #! /bin/bash
#
# Script to convert the Let's "Encrypt" output to a Java Keystore
#
# Usage: ./letsencrypt2jks.sh [DOMAIN] [JKS_PASSWORD]
#
hash openssl 2>/dev/null || { echo >&2 "I require openssl but it's not installed. Aborting."; exit 1; }
if [ "$#" -ne 2 ]; then
"Usage: target/letsencrypt2jks.sh [DOMAIN] [PASSWORD]"
fi
# Delete the JKS from our previous run (if it's still around)
sudo rm -f le_jiiify.jks
sudo openssl pkcs12 -export \
-in "/etc/letsencrypt/live/$1/fullchain.pem" \
-inkey "/etc/letsencrypt/live/$1/privkey.pem" \
-out "/tmp/jiiify_cert_and_key.p12" \
-name "jiiify" \
-caname "root" \
-password "pass:$2"
sudo keytool -importkeystore \
-deststorepass "$2" \
-destkeypass "$2" \
-destkeystore "le_jiiify.jks" \
-srckeystore "/tmp/jiiify_cert_and_key.p12" \
-srcstoretype "PKCS12" \
-srcstorepass "$2" \
-alias "jiiify"
|
Make deploy bash script safer | #!/bin/bash
if [ -z "$TRAVIS" ]; then
echo "this script is intended to be run only on travis" >&2;
exit 1
fi
function goreleaser() {
curl -sL https://git.io/goreleaser | bash
}
if [ ! -z "$TRAVIS_TAG" ]; then
if [ "$(make version)" != "$TRAVIS_TAG" ]; then
echo "hcli version does not match tagged version!" >&2
echo "hcli version is $(make version)" >&2
echo "tag is $TRAVIS_TAG" >&2
exit 1
fi
goreleaser
fi
| #!/bin/bash
set -euxo pipefail
if [ -z "$TRAVIS" ]; then
echo "this script is intended to be run only on travis" >&2;
exit 1
fi
function goreleaser() {
curl -sL https://git.io/goreleaser | bash
}
if [ ! -z "$TRAVIS_TAG" ]; then
if [ "$(make version)" != "$TRAVIS_TAG" ]; then
echo "hcli version does not match tagged version!" >&2
echo "hcli version is $(make version)" >&2
echo "tag is $TRAVIS_TAG" >&2
exit 1
fi
goreleaser
fi
|
Fix error and return value in let's encrypt script | #!/usr/bin/env bash
# This script will generate a let's encrypt ssl certificate if possible.
# It's a simple wrapper script for the official certbot client, because
# we maybe need the webserver feature to receive a validation.
# Defaults
CN=$(hostname)
EMAIL=$(mdata-get mail_adminaddr 2>/dev/null)
# Help function
function help() {
echo "${0} [-c common name] [-m mail address]"
exit 1
}
# Option parameters
while getopts "c:m:" opt; do
case "${opt}" in
c) CN=${OPTARG} ;;
m) EMAIL=${OPTARG} ;;
*) help ;;
esac
done
# Setup account email address to mail_adminaddr if exists
if [[ ! -z ${EMAIL} ]]; then
EMAIL="--email ${EMAIL}"
else
EMAIL='--register-unsafely-without-email'
fi
# Run initial certbot command to create account and certificate
certbot certonly \
--standalone \
--agree-tos \
--quiet \
--text \
--non-interactive \
${EMAIL} \
--domains ${CN}
# Create cronjob to automatically check or renew the certificate two
# times a day
CRON='0 0,12 * * * /opt/local/bin/certbot renew --text --non-interactive --quiet'
(crontab -l 2>/dev/null || true; echo "$CRON" ) | sort | uniq | crontab
| #!/usr/bin/env bash
# This script will generate a let's encrypt ssl certificate if possible.
# It's a simple wrapper script for the official certbot client, because
# we maybe need the webserver feature to receive a validation.
# Defaults
CN=$(hostname)
EMAIL=$(mdata-get mail_adminaddr 2>/dev/null)
# Ignore python warnings by default in this script
export PYTHONWARNINGS="ignore"
# Help function
function help() {
echo "${0} [-c common name] [-m mail address]"
exit 1
}
# Option parameters
while getopts ":c:m:" opt; do
case "${opt}" in
c) CN=${OPTARG} ;;
m) EMAIL=${OPTARG} ;;
*) help ;;
esac
done
# Setup account email address to mail_adminaddr if exists
if [[ ! -z ${EMAIL} ]]; then
EMAIL="--email ${EMAIL}"
else
EMAIL='--register-unsafely-without-email'
fi
# Run initial certbot command to create account and certificate
if ! certbot certonly \
--standalone \
--agree-tos \
--quiet \
--text \
--non-interactive \
${EMAIL} \
--domains ${CN}; then
# Exit on error and ignore crons
exit 1
fi
# Create cronjob to automatically check or renew the certificate two
# times a day
CRON='0 0,12 * * * /opt/local/bin/certbot renew --text --non-interactive --quiet'
(crontab -l 2>/dev/null || true; echo "$CRON" ) | sort | uniq | crontab
|
Add logging to download script | #! /bin/bash
FILE_NAME=arm_web_deploy.tar.gz
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/dmweis/DynamixelServo/releases/latest)
# The releases are returned in the format {"id":3622206,"tag_name":"hello-1.0.0.11",...}, we have to extract the tag_name.
LATEST_VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
ARTIFACT_URL="https://github.com/dmweis/DynamixelServo/releases/download/$LATEST_VERSION/$FILE_NAME"
echo Downloading...
wget $ARTIFACT_URL -q --show-progress
tar -xzf $FILE_NAME
rm $FILE_NAME
chmod +x run_linux.sh
echo script run_linux.sh will run the program
| #! /bin/bash
FILE_NAME=arm_web_deploy.tar.gz
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/dmweis/DynamixelServo/releases/latest)
# The releases are returned in the format {"id":3622206,"tag_name":"hello-1.0.0.11",...}, we have to extract the tag_name.
LATEST_VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
ARTIFACT_URL="https://github.com/dmweis/DynamixelServo/releases/download/$LATEST_VERSION/$FILE_NAME"
echo Downloading...
wget $ARTIFACT_URL -q --show-progress
echo unpacking...
tar -xzf $FILE_NAME
echo removing archive
rm $FILE_NAME
chmod +x run_linux.sh
echo script run_linux.sh will run the program
|
Remove `--inplace` from conda recipe | #!/bin/bash
if [[ "$(uname -s)" == *"Linux"* ]] && [[ "$(uname -p)" == *"86"* ]]; then
EXTRA_BUILD_EXT_FLAGS="--werror --wall"
else
EXTRA_BUILD_EXT_FLAGS=""
fi
MACOSX_DEPLOYMENT_TARGET=10.10 $PYTHON setup.py build_ext --inplace $EXTRA_BUILD_EXT_FLAGS build install --single-version-externally-managed --record=record.txt
| #!/bin/bash
if [[ "$(uname -s)" == *"Linux"* ]] && [[ "$(uname -p)" == *"86"* ]]; then
EXTRA_BUILD_EXT_FLAGS="--werror --wall"
else
EXTRA_BUILD_EXT_FLAGS=""
fi
MACOSX_DEPLOYMENT_TARGET=10.10 $PYTHON setup.py build_ext $EXTRA_BUILD_EXT_FLAGS build install --single-version-externally-managed --record=record.txt
|
Add check if script is executed with root privileges | #!/bin/bash
function broadcast.info {
echo $1 >&1
}
function broadcast.error {
echo $1 >&2
}
function check_retval {
if [ $1 -ne 0 ]; then
broadcast.error "Command exited with status $1: exiting"
exit $1
fi
}
TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
ROOTDEV="/dev/system/root"
SUBVOL="@"
if [ $# -gt 0 ] && [ -n "$1" ]
then
SUBVOL="$1"
fi
broadcast.info "Creating temporary directory $tmpmnt"
tmpmnt=$(mktemp -d)
check_retval $?
broadcast.info "Mounting top-level subvolume"
mount $ROOTDEV $tmpmnt/
check_retval $?
broadcast.info "Creating snapshot of subvolume $SUBVOL"
btrfs sub snap -r $tmpmnt/$SUBVOL $tmpmnt/@$SUBVOL-$TIMESTAMP
check_retval $?
broadcast.info "Unmounting top-level subvolume"
umount $tmpmnt/
check_retval $?
broadcast.info "Removing temporary directory $tmpmnt"
rmdir $tmpmnt
check_retval $?
| #!/bin/bash
function broadcast.info {
echo $1 >&1
}
function broadcast.error {
echo $1 >&2
}
function check_retval {
if [ $1 -ne 0 ]; then
broadcast.error "Command exited with status $1: exiting"
exit $1
fi
}
TIMESTAMP=$(date +"%Y%m%d-%H%M%S")
ROOTDEV="/dev/system/root"
SUBVOL="@"
if [ $EUID -ne 0 ]
then
broadcast.error "Error: $0 must be executed as root"
exit 1
fi
if [ $# -gt 0 ] && [ -n "$1" ]
then
SUBVOL="$1"
fi
broadcast.info "Creating temporary directory $tmpmnt"
tmpmnt=$(mktemp -d)
check_retval $?
broadcast.info "Mounting top-level subvolume"
mount $ROOTDEV $tmpmnt/
check_retval $?
broadcast.info "Creating snapshot of subvolume $SUBVOL"
btrfs sub snap -r $tmpmnt/$SUBVOL $tmpmnt/@$SUBVOL-$TIMESTAMP
check_retval $?
broadcast.info "Unmounting top-level subvolume"
umount $tmpmnt/
check_retval $?
broadcast.info "Removing temporary directory $tmpmnt"
rmdir $tmpmnt
check_retval $?
|
Upgrade Java 17 version in CI | #!/bin/bash
set -e
case "$1" in
java8)
echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u332b09.tar.gz"
;;
java11)
echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz"
;;
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz"
;;
*)
echo $"Unknown java version"
exit 1
esac
| #!/bin/bash
set -e
case "$1" in
java8)
echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u332b09.tar.gz"
;;
java11)
echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz"
;;
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.3%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.3_7.tar.gz"
;;
*)
echo $"Unknown java version"
exit 1
esac
|
Test the new gpg configuration | openssl aes-256-cbc -K $encrypted_3210c925a91b_key \
-iv $encrypted_3210c925a91b_iv \
-in .travis.pubring.enc -out .travis.pubring -d
openssl aes-256-cbc -K $encrypted_3210c925a91b_key \
-iv $encrypted_3210c925a91b_iv \
-in .travis.secring.enc -out .travis.secring -d
gpg2 --keyring=$TRAVIS_BUILD_DIR/pubring.gpg \
--no-default-keyring \
--import .travis.pubring
gpg2 --allow-secret-key-import --keyring=$TRAVIS_BUILD_DIR/secring.gpg \
--no-default-keyring \
--import .travis.secring
mvn clean deploy -P release -DskipTests \
--settings .travis.settings.xml \
-Dgpg.executable=gpg2 \
-Dgpg.passphrase=$PASSPHRASE \
-Dgpg.publicKeyring=$TRAVIS_BUILD_DIR/pubring.gpg \
-Dgpg.secretKeyring=$TRAVIS_BUILD_DIR/secring.gpg
| openssl aes-256-cbc -K $encrypted_3210c925a91b_key \
-iv $encrypted_3210c925a91b_iv \
-in .travis.pubring.enc -out .travis.pubring -d
openssl aes-256-cbc -K $encrypted_3210c925a91b_key \
-iv $encrypted_3210c925a91b_iv \
-in .travis.secring.enc -out .travis.secring -d
#gpg --keyring=$TRAVIS_BUILD_DIR/pubring.gpg \
# --no-default-keyring \
# --import .travis.pubring
gpg2 --import .travis.pubring
#gpg --allow-secret-key-import --keyring=$TRAVIS_BUILD_DIR/secring.gpg \
# --no-default-keyring \
# --import .travis.secring
gpg2 --allow-secret-key-import --import .travis.secring
#mvn clean deploy -P release -DskipTests \
# --settings .travis.settings.xml \
# -Dgpg.executable=gpg2 \
# -Dgpg.passphrase=$PASSPHRASE \
# -Dgpg.publicKeyring=$TRAVIS_BUILD_DIR/pubring.gpg \
# -Dgpg.secretKeyring=$TRAVIS_BUILD_DIR/secring.gpg
mvn package org.apache.maven.plugins:maven-gpg-plugin:1.6:sign -DskipTests \
-Dgpg.executable=gpg2 \
-Dgpg.passphrase=$PASSPHRASE
|
Add cd step after untar | #!/bin/bash
cd `mktemp -d`
curl "https://aur.archlinux.org/packages/`expr substr $1 1 2`/$1/$1.tar.gz" | tar xz
makepkg -si
| #!/bin/bash
cd `mktemp -d`
curl "https://aur.archlinux.org/packages/`expr substr $1 1 2`/$1/$1.tar.gz" | tar xz
cd $1
makepkg -si
|
Update the _gh-pages target dir during build. | #!/bin/zsh
# Should be run from the docs directory: (cd docs && ./build-github.zsh)
REPO=$(dirname $(pwd))
GH=_gh-pages
# Update our local gh-pages branch
git checkout gh-pages && git pull && git checkout -
# Checkout the gh-pages branch, if necessary.
if [[ ! -d $GH ]]; then
git clone $REPO $GH
cd $GH
git checkout -b gh-pages origin/gh-pages
cd ..
fi
# Make a clean build.
make clean dirhtml
# Move the fresh build over.
cp -r _build/dirhtml/* $GH
cd $GH
# Commit.
git add .
git commit -am "gh-pages build on $(date)"
git push origin gh-pages
| #!/bin/zsh
# Should be run from the docs directory: (cd docs && ./build-github.zsh)
REPO=$(dirname $(pwd))
GH=_gh-pages
# Update our local gh-pages branch
git checkout gh-pages && git pull && git checkout -
# Checkout the gh-pages branch, if necessary.
if [[ ! -d $GH ]]; then
git clone $REPO $GH
cd $GH
git checkout -b gh-pages origin/gh-pages
cd ..
fi
# Update the _gh-pages target dir.
cd $GH && git pull && cd ..
# Make a clean build.
make clean dirhtml
# Move the fresh build over.
cp -r _build/dirhtml/* $GH
cd $GH
# Commit.
git add .
git commit -am "gh-pages build on $(date)"
git push origin gh-pages
|
Use FST_FILES to get .md and .html names. | #!/bin/bash
# Script to run fsdoc on certain dirs in the FStar repo.
# Currently, gets called by the VSTF "FStar, Docs, Linux, CI" build.
set -x
echo Running fsdoc in `pwd`
# SI: we assume F* has been built and is in the path.
# make the output dir
FSDOC_ODIR=fsdoc_odir
mkdir -p "$FSDOC_ODIR"
# fsdoc ulib/*.fst*
pushd ulib
# Get fst, fsti files (files are sorted by default).
FST_FILES=(*.fst *.fsti)
../bin/fstar-any.sh --odir "../$FSDOC_ODIR" --doc ${FST_FILES[*]}
popd
# pandoc : md -> html
pushd $FSDOC_ODIR
for f in "${FST_FILES[@]}"
do
newf=`basename -s ".md" $f`
pandoc $f -f markdown -t html -o $newf.html
done
popd
# push fstarlang.github.io with latest html
git clone https://github.com/FStarLang/fstarlang.github.io
pushd fstarlang.github.io
pushd docs
mv "../../$FSDOC_ODIR"/*.html .
git commit -am "Automated doc refresh"
git push
popd
popd
rm -rf fstarlang
# SI: could cleanup FSDOC_ODIR too.
| #!/bin/bash
# Script to run fsdoc on certain dirs in the FStar repo.
# Currently, gets called by the VSTF "FStar, Docs, Linux, CI" build.
set -x
echo Running fsdoc in `pwd`
# SI: we assume F* has been built and is in the path.
# make the output dir
FSDOC_ODIR=fsdoc_odir
mkdir -p "$FSDOC_ODIR"
# fsdoc ulib/*.fst*
pushd ulib
# Get fst, fsti files (files are sorted by default).
FST_FILES=(*.fst *.fsti)
../bin/fstar-any.sh --odir "../$FSDOC_ODIR" --doc ${FST_FILES[*]}
popd
# pandoc : md -> html
pushd $FSDOC_ODIR
for f in "${FST_FILES[@]}"
do
fe=`basename $f`
f="${fe%.*}"
md="${f}.md"
html="${f}.html"
pandoc $md -f markdown -t html -o $html
done
popd
# push fstarlang.github.io with latest html
git clone https://github.com/FStarLang/fstarlang.github.io
pushd fstarlang.github.io
pushd docs
mv "../../$FSDOC_ODIR"/*.html .
git commit -am "Automated doc refresh"
git push
popd
popd
rm -rf fstarlang
# SI: could cleanup FSDOC_ODIR too.
|
Remove api key env variable, set elsewhere | #!/bin/sh -ex
export PATH="$PATH:/Applications/Unity/Unity.app/Contents/MacOS"
pushd "${0%/*}"
pushd ../..
package_path=`pwd`
popd
pushd ../fixtures
git clean -xdf .
project_path="$(pwd)/unity_project"
Unity -nographics -quit -batchmode -logFile unity.log -createProject $project_path
Unity -nographics -quit -batchmode -logFile unity.log -projectpath $project_path -importPackage "$package_path/Bugsnag.unitypackage"
cp Main.cs unity_project/Assets/Main.cs
BUGSNAG_APIKEY=a35a2a72bd230ac0aa0f52715bbdc6aa Unity -nographics -quit -batchmode -logFile unity.log -projectpath $project_path -executeMethod "Main.CreateScene"
Unity -nographics -quit -batchmode -logFile unity.log -projectpath $project_path -buildOSXUniversalPlayer "$package_path/features/fixtures/Mazerunner.app"
popd
popd
| #!/bin/sh -ex
export PATH="$PATH:/Applications/Unity/Unity.app/Contents/MacOS"
pushd "${0%/*}"
pushd ../..
package_path=`pwd`
popd
pushd ../fixtures
git clean -xdf .
project_path="$(pwd)/unity_project"
Unity -nographics -quit -batchmode -logFile unity.log -createProject $project_path
Unity -nographics -quit -batchmode -logFile unity.log -projectpath $project_path -importPackage "$package_path/Bugsnag.unitypackage"
cp Main.cs unity_project/Assets/Main.cs
Unity -nographics -quit -batchmode -logFile unity.log -projectpath $project_path -executeMethod "Main.CreateScene"
Unity -nographics -quit -batchmode -logFile unity.log -projectpath $project_path -buildOSXUniversalPlayer "$package_path/features/fixtures/Mazerunner.app"
popd
popd
|
Allow up to 10 tests to fail before stopping | #!/bin/bash
#
# Run project tests
#
# NOTE: This script expects to be run from the project root with
# ./scripts/run_tests.sh
# Use default environment vars for localhost if not already set
set -o pipefail
source environment_test.sh
function display_result {
RESULT=$1
EXIT_STATUS=$2
TEST=$3
if [ $RESULT -ne 0 ]; then
echo -e "\033[31m$TEST failed\033[0m"
exit $EXIT_STATUS
else
echo -e "\033[32m$TEST passed\033[0m"
fi
}
if [[ -z "$VIRTUAL_ENV" ]] && [[ -d venv ]]; then
source ./venv/bin/activate
fi
flake8 .
display_result $? 1 "Code style check"
# run with four concurrent threads
py.test --cov=app --cov-report=term-missing tests/ --junitxml=test_results.xml -n4 -v -x
display_result $? 2 "Unit tests"
| #!/bin/bash
#
# Run project tests
#
# NOTE: This script expects to be run from the project root with
# ./scripts/run_tests.sh
# Use default environment vars for localhost if not already set
set -o pipefail
source environment_test.sh
function display_result {
RESULT=$1
EXIT_STATUS=$2
TEST=$3
if [ $RESULT -ne 0 ]; then
echo -e "\033[31m$TEST failed\033[0m"
exit $EXIT_STATUS
else
echo -e "\033[32m$TEST passed\033[0m"
fi
}
if [[ -z "$VIRTUAL_ENV" ]] && [[ -d venv ]]; then
source ./venv/bin/activate
fi
flake8 .
display_result $? 1 "Code style check"
# run with four concurrent threads
py.test --cov=app --cov-report=term-missing tests/ --junitxml=test_results.xml -n4 -v --maxfail=10
display_result $? 2 "Unit tests"
|
Fix the titan download test. | #!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
set -x
set -e
# Set up the host
source $SCRIPT_DIR/steps/hostsetup.sh
source $SCRIPT_DIR/steps/hostinfo.sh
# Output git information
ls -l
cd github
ls -l
cd *_vtr-verilog-to-routing
source $SCRIPT_DIR/steps/git.sh
if [ $VTR_TEST == "vtr_strong" ]; then
source $SCRIPT_DIR/steps/vtr-min-setup.sh
else
source $SCRIPT_DIR/steps/vtr-full-setup.sh
fi
# Build VtR
source $SCRIPT_DIR/steps/vtr-build.sh
# Run the reg test.
source $SCRIPT_DIR/steps/vtr-test.sh
| #!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
set -x
set -e
# Set up the host
source $SCRIPT_DIR/steps/hostsetup.sh
source $SCRIPT_DIR/steps/hostinfo.sh
# Output git information
ls -l
cd github
ls -l
cd *_vtr-verilog-to-routing
source $SCRIPT_DIR/steps/git.sh
if [ $VTR_TEST == "vtr_reg_strong" ]; then
source $SCRIPT_DIR/steps/vtr-min-setup.sh
else
source $SCRIPT_DIR/steps/vtr-full-setup.sh
fi
# Build VtR
source $SCRIPT_DIR/steps/vtr-build.sh
# Run the reg test.
source $SCRIPT_DIR/steps/vtr-test.sh
|
Add FreeBSD 9.1 build to the VirtualBox build-all script. | #!/bin/bash
#Debian 7.2
cd ./debian-7.2-amd64
packer build --only=virtualbox template.json
#CentOS 6.4
cd ../centos-6.4-amd64
packer build --only=virtualbox template.json
#Ubuntu 12.04: this template is for an older version of Ubuntu, but 12.04 is the most recent LTS release
#so we still want to have fresh builds of it
cd ../ubuntu-12.04-server-amd64
packer build --only=virtualbox template.json
#Ubuntu 13.10
cd ../ubuntu-13.10-server-amd64
packer build --only=virtualbox template.json | #!/bin/bash
#Debian 7.2
cd ./debian-7.2-amd64
packer build --only=virtualbox template.json
#CentOS 6.4
cd ../centos-6.4-amd64
packer build --only=virtualbox template.json
#Ubuntu 12.04: this template is for an older version of Ubuntu, but 12.04 is the most recent LTS release
#so we still want to have fresh builds of it
cd ../ubuntu-12.04-server-amd64
packer build --only=virtualbox template.json
#Ubuntu 13.10
cd ../ubuntu-13.10-server-amd64
packer build --only=virtualbox template.json
#FreeBSD 9.1
cd ../freebsd-9.1-amd64
packer build --only=virtualbox template.json
|
Remove hard reference to my homedir | #!/bin/sh
(cd /home/chaos/.minecraft && /usr/bin/java -jar minecraft.jar)
| #!/bin/sh
(cd $HOME/.minecraft && /usr/bin/java -jar minecraft.jar)
|
Replace a non-portable usage of rm (!) with dub clean | #!/usr/bin/env bash
. $(dirname "${BASH_SOURCE[0]}")/common.sh
cd ${CURR_DIR}/issue990-download-optional-selected
rm -rf b/.dub
${DUB} remove gitcompatibledubpackage -n --version=* 2>/dev/null || true
${DUB} run
| #!/usr/bin/env bash
. $(dirname "${BASH_SOURCE[0]}")/common.sh
cd ${CURR_DIR}/issue990-download-optional-selected
${DUB} clean
${DUB} remove gitcompatibledubpackage -n --version=* 2>/dev/null || true
${DUB} run
|
Use of {} brackets around variables | #!/bin/sh
# Check if URL is set
if [ -z "$URL" ]; then
exit 1
fi
# Check if INTERVAL_TIME is set
if [ -z "$INTERVAL_TIME" ]; then
INTERVAL_TIME=300
fi
# Infinite loop
while :
do
curl $CURL_PARAM $URL
sleep $INTERVAL_TIME
done
| #!/bin/sh
# Check if URL is set
if [ -z "${URL}" ]; then
exit 1
fi
# Check if INTERVAL_TIME is set
if [ -z "${INTERVAL_TIME}" ]; then
INTERVAL_TIME=300
fi
# Infinite loop
while :
do
curl ${CURL_PARAM} ${URL}
sleep ${INTERVAL_TIME}
done
|
Add gitmessage file to files array | #!/usr/bin/env bash
################################################################################
# install
#
# This script symlinks the dotfiles into place in the home directory.
################################################################################
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
set -e # Terminate script if anything exits with a non-zero value
set -u # Prevent unset variables
files="gemrc gitconfig gitignore_global hushlogin npmrc pryrc tmux.conf vimrc zshrc"
DOTFILES_DIR=$HOME/dotfiles
fancy_echo "Installing dotfiles..."
for file in $files; do
if [ -f $HOME/.$file ]; then
fancy_echo ".$file already present. Backing up..."
cp $HOME/.$file "$HOME/.${file}_backup"
rm -f $HOME/.$file
fi
fancy_echo "-> Linking $DOTFILES_DIR/$file to $HOME/.$file..."
ln -nfs "$DOTFILES_DIR/$file" "$HOME/.$file"
done
fancy_echo "Dotfiles installation complete!"
| #!/usr/bin/env bash
################################################################################
# install
#
# This script symlinks the dotfiles into place in the home directory.
################################################################################
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
set -e # Terminate script if anything exits with a non-zero value
set -u # Prevent unset variables
files="gemrc gitconfig gitignore_global gitmessage hushlogin npmrc pryrc tmux.conf vimrc zshrc"
DOTFILES_DIR=$HOME/dotfiles
fancy_echo "Installing dotfiles..."
for file in $files; do
if [ -f $HOME/.$file ]; then
fancy_echo ".$file already present. Backing up..."
cp $HOME/.$file "$HOME/.${file}_backup"
rm -f $HOME/.$file
fi
fancy_echo "-> Linking $DOTFILES_DIR/$file to $HOME/.$file..."
ln -nfs "$DOTFILES_DIR/$file" "$HOME/.$file"
done
fancy_echo "Dotfiles installation complete!"
|
Revert "test: sleep an extra second in track --no-modify-attrs" | #!/usr/bin/env bash
. "test/testlib.sh"
ensure_git_version_isnt $VERSION_LOWER "1.9.0"
begin_test "track (--no-modify-attrs)"
(
set -e
reponame="track-no-modify-attrs"
git init "$reponame"
cd "$reponame"
echo "contents" > a.dat
git add a.dat
# Git assumes that identical results from `stat(1)` between the index and
# working copy are stat dirty. To prevent this, wait at least two seconds to
# yield different `stat(1)` results.
sleep 2
git commit -m "add a.dat"
echo "*.dat filter=lfs diff=lfs merge=lfs -text" > .gitattributes
git add .gitattributes
git commit -m "asdf"
[ -z "$(git status --porcelain)" ]
git lfs track --no-modify-attrs "*.dat"
[ " M a.dat" = "$(git status --porcelain)" ]
)
end_test
| #!/usr/bin/env bash
. "test/testlib.sh"
ensure_git_version_isnt $VERSION_LOWER "1.9.0"
begin_test "track (--no-modify-attrs)"
(
set -e
reponame="track-no-modify-attrs"
git init "$reponame"
cd "$reponame"
echo "contents" > a.dat
git add a.dat
# Git assumes that identical results from `stat(1)` between the index and
# working copy are stat dirty. To prevent this, wait at least one second to
# yield different `stat(1)` results.
sleep 1
git commit -m "add a.dat"
echo "*.dat filter=lfs diff=lfs merge=lfs -text" > .gitattributes
git add .gitattributes
git commit -m "asdf"
[ -z "$(git status --porcelain)" ]
git lfs track --no-modify-attrs "*.dat"
[ " M a.dat" = "$(git status --porcelain)" ]
)
end_test
|
Use "start" instead of "restart" | #!/bin/sh
# This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | bash'
# Courtesy of Jeff Lindsay <progrium@gmail.com>
echo "Ensuring dependencies are installed..."
apt-get --yes install lxc wget bsdtar 2>&1 > /dev/null
echo "Downloading docker binary and uncompressing into /usr/local/bin..."
curl -s http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz |
tar -C /usr/local/bin --strip-components=1 -zxf- \
docker-master/docker docker-master/dockerd
if [[ -f /etc/init/dockerd.conf ]]
then
echo "Upstart script already exists."
else
echo "Creating /etc/init/dockerd.conf..."
echo "exec /usr/local/bin/dockerd" > /etc/init/dockerd.conf
fi
echo "Restarting dockerd..."
restart dockerd > /dev/null
echo "Finished!"
echo
| #!/bin/sh
# This script is meant for quick & easy install via 'curl URL-OF-SCRIPT | bash'
# Courtesy of Jeff Lindsay <progrium@gmail.com>
echo "Ensuring dependencies are installed..."
apt-get --yes install lxc wget bsdtar 2>&1 > /dev/null
echo "Downloading docker binary and uncompressing into /usr/local/bin..."
curl -s http://get.docker.io/builds/$(uname -s)/$(uname -m)/docker-master.tgz |
tar -C /usr/local/bin --strip-components=1 -zxf- \
docker-master/docker docker-master/dockerd
if [[ -f /etc/init/dockerd.conf ]]
then
echo "Upstart script already exists."
else
echo "Creating /etc/init/dockerd.conf..."
echo "exec /usr/local/bin/dockerd" > /etc/init/dockerd.conf
fi
echo "Starting dockerd..."
start dockerd > /dev/null
echo "Finished!"
echo
|
Support for docker XDG_DATA_HOME on OS X | DOCKER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ `uname` == 'Linux' ]; then
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
DOCKER_DATA_HOME=$XDG_DATA_HOME/dockerhq
else
DOCKER_DATA_HOME=/data
fi
mkdir -p $DOCKER_DATA_HOME
XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
PROJECT_NAME="commcarehq"
function web_runner() {
if [ `uname` == 'Linux' ]; then
sudo \
env DOCKER_DATA_HOME=$DOCKER_DATA_HOME XDG_CACHE_HOME=$XDG_CACHE_HOME \
docker-compose -f $DOCKER_DIR/compose/docker-compose-hq.yml -p $PROJECT_NAME $@
else
env DOCKER_DATA_HOME=$DOCKER_DATA_HOME XDG_CACHE_HOME=$XDG_CACHE_HOME \
docker-compose -f $DOCKER_DIR/compose/docker-compose-hq.yml -p $PROJECT_NAME $@
fi
}
| DOCKER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ `uname` == 'Linux' -o `uname` == 'Darwin' ]; then
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
DOCKER_DATA_HOME=$XDG_DATA_HOME/dockerhq
else
DOCKER_DATA_HOME=/data
fi
mkdir -p $DOCKER_DATA_HOME
XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
PROJECT_NAME="commcarehq"
function web_runner() {
if [ `uname` == 'Linux' ]; then
sudo \
env DOCKER_DATA_HOME=$DOCKER_DATA_HOME XDG_CACHE_HOME=$XDG_CACHE_HOME \
docker-compose -f $DOCKER_DIR/compose/docker-compose-hq.yml -p $PROJECT_NAME $@
else
env DOCKER_DATA_HOME=$DOCKER_DATA_HOME XDG_CACHE_HOME=$XDG_CACHE_HOME \
docker-compose -f $DOCKER_DIR/compose/docker-compose-hq.yml -p $PROJECT_NAME $@
fi
}
|
Deploy all provided war files automatically | #!/bin/bash
erb templates/httpd.conf.tmpl >./apache/conf/httpd.conf
echo "=== APACHE ==="
/app/apache/bin/httpd -k start
echo "=== TOMCAT ==="
export CATALINA_HOME=/app/tomcat
export JRE_HOME=/app/jdk/jre
${CATALINA_HOME}/bin/startup.sh &
sleep 5
tail -f apache/logs/error_log &
while pgrep -f /app/apache/bin/httpd >/dev/null; do
echo "Apache running..."
sleep 60
done
exit 1
| #!/bin/bash
erb templates/httpd.conf.tmpl >./apache/conf/httpd.conf
echo "=== APACHE ==="
/app/apache/bin/httpd -k start
echo "=== TOMCAT ==="
export CATALINA_HOME=/app/tomcat
export JRE_HOME=/app/jdk/jre
${CATALINA_HOME}/bin/startup.sh &
sleep 5
tail -f apache/logs/error_log &
# Deploy all war files
WEBAPPDIR=/app/tomcat/webapps
for WAR in *.war; do
echo "Deploying $WAR"
cp "$WAR" "$WEBAPPDIR"
done
while pgrep -f /app/apache/bin/httpd >/dev/null; do
echo "Apache running..."
sleep 60
done
exit 1
|
Update deploy script for new environment | #!/bin/bash
if [ -z "${SOURCE_DIRECTORY}" ]; then
SOURCE_DIRECTORY="$(git rev-parse --show-toplevel)"
fi
if [ -z "${TARGET_DIRECTORY}" ]; then
TARGET_DIRECTORY="/home/nginx/carlbennett-api"
fi
DEPLOY_TARGET="$1"
if [ -z "${DEPLOY_TARGET}" ]; then
DEPLOY_TARGET="$(cat ${SOURCE_DIRECTORY}/etc/.rsync-target 2>/dev/null)"
fi
if [ -z "${DEPLOY_TARGET}" ]; then
read -p "Enter the server to deploy to: " DEPLOY_TARGET
fi
if [ -z "${DEPLOY_TARGET}" ]; then
printf "Deploy target not provided, aborting...\n" 1>&2
exit 1
fi
echo "${DEPLOY_TARGET}" > ${SOURCE_DIRECTORY}/etc/.rsync-target
set -e
printf "[1/4] Getting version identifier of this deploy...\n"
DEPLOY_VERSION="$(git describe --always --tags)"
printf "[2/4] Building version information into this deploy...\n"
printf "${DEPLOY_VERSION}" > ${SOURCE_DIRECTORY}/etc/.rsync-version
printf "[3/4] Syncing to deploy target...\n"
rsync -avzc --delete --delete-excluded --delete-after --progress \
--exclude-from="${SOURCE_DIRECTORY}/etc/rsync-exclude.txt" \
--chown=nginx:www-data --rsync-path="sudo rsync" \
"${SOURCE_DIRECTORY}/" \
${DEPLOY_TARGET}:"${TARGET_DIRECTORY}"
printf "[4/4] Post-deploy clean up...\n"
rm ${SOURCE_DIRECTORY}/etc/.rsync-version
printf "Operation complete!\n"
| #!/bin/bash
if [ -z "${SOURCE_DIRECTORY}" ]; then
SOURCE_DIRECTORY="$(git rev-parse --show-toplevel)"
fi
if [ -z "${TARGET_DIRECTORY}" ]; then
TARGET_DIRECTORY="/var/www/api.carlbennett.me"
fi
set -e
printf "[1/4] Getting version identifier of this deploy...\n"
DEPLOY_VERSION="$(git describe --always --tags)"
printf "[2/4] Building version information into this deploy...\n"
printf "${DEPLOY_VERSION}" > ${SOURCE_DIRECTORY}/etc/.rsync-version
printf "[3/4] Syncing...\n"
rsync -avzc --delete --delete-excluded --delete-after --progress \
--exclude-from="${SOURCE_DIRECTORY}/etc/rsync-exclude.txt" \
--chown=nginx:nginx --rsync-path="sudo rsync" \
"${SOURCE_DIRECTORY}/" "${TARGET_DIRECTORY}"
printf "[4/4] Post-deploy clean up...\n"
rm ${SOURCE_DIRECTORY}/etc/.rsync-version
printf "Operation complete!\n"
|
Write changes before setting permissions | #!/bin/bash
sudo mkdir /emergence/services/sencha
sudo git clone --bare https://github.com/JarvusInnovations/extjs.git /emergence/services/sencha/frameworks-repo.git
sudo chown root:www-data -R /emergence/services/sencha/frameworks-repo.git
sudo chmod ug=Xrw,o=Xr -R /emergence/services/sencha/frameworks-repo.git
sudo git init --bare /emergence/services/sencha/builds-repo.git
sudo chown root:www-data -R /emergence/services/sencha/builds-repo.git
sudo chmod ug=Xrw,o=Xr -R /emergence/services/sencha/builds-repo.git
echo "/emergence/services/sencha/frameworks-repo.git/objects" > /emergence/services/sencha/builds-repo.git/objects/info/alternates | #!/bin/bash
sudo mkdir /emergence/services/sencha
sudo git clone --bare https://github.com/JarvusInnovations/extjs.git /emergence/services/sencha/frameworks-repo.git
sudo chown root:www-data -R /emergence/services/sencha/frameworks-repo.git
sudo chmod ug=Xrw,o=Xr -R /emergence/services/sencha/frameworks-repo.git
sudo git init --bare /emergence/services/sencha/builds-repo.git
echo "/emergence/services/sencha/frameworks-repo.git/objects" > /emergence/services/sencha/builds-repo.git/objects/info/alternates
sudo chown root:www-data -R /emergence/services/sencha/builds-repo.git
sudo chmod ug=Xrw,o=Xr -R /emergence/services/sencha/builds-repo.git |
Update release script for elastic | #!/bin/bash
set -e
BRANCH_NAME='production'
set +e
git branch -D ${BRANCH_NAME}
set -e
rm -rf lib
rm -rf node_modules
npm version patch
git branch ${BRANCH_NAME}
git checkout ${BRANCH_NAME}
npm install
grunt build
rm -rf node_modules
npm install --production
git add -f lib/
git add -f node_modules/
git commit -m "Add generated code and runtime dependencies for elastic.io environment."
git push --force origin ${BRANCH_NAME}
git checkout master
VERSION=$(cat package.json | jq --raw-output .version)
git push origin "v${VERSION}"
npm version patch
npm install
| #!/bin/bash
set -e
VERSION=$(cat package.json | jq --raw-output .version)
PKG_NAME=$(cat package.json | jq --raw-output .name)
BRANCH_NAME='production'
echo "About to release ${PKG_NAME} - v${VERSION} to ${BRANCH_NAME} branch!"
cleanup() {
set +e
echo "Cleaning up"
rm -rf package
rm "${PKG_NAME}"-*
set -e
}
# cleanup
cleanup
set +e
git branch -D ${BRANCH_NAME}
set -e
# install all deps
echo "Installing all deps"
npm install &>/dev/null
echo "Building sources"
grunt build &>/dev/null
# package npm and extract it
echo "Packaging locally"
npm pack
tar -xzf "${PKG_NAME}-${VERSION}.tgz"
cd package
# install production deps (no devDeps)
echo "Installing only production deps"
npm install --production &>/dev/null
# push everything inside package to selected branch
git init
git remote add origin git@github.com:sphereio/${PKG_NAME}.git
git add -A &>/dev/null
git commit -m "Release packaged version ${VERSION} to ${BRANCH_NAME} branch" &>/dev/null
echo "About to push to ${BRANCH_NAME} branch"
git push --force origin master:${BRANCH_NAME}
cd -
# cleanup
cleanup
echo "Congratulations, the package has been successfully released to branch ${BRANCH_NAME}"
|
Use our own nodejs 'hello world' source | #!/usr/bin/env bash
# enable fail detection...
set -e
source /initialize.sh
initialize
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
HOSTIP=$(vagrant ssh-config | awk '/HostName/ {print $2}')
echo -e "\nSETTING up Dokku SSH key.\n"
cat /.ssh/id_rsa.pub | vagrant ssh -c "docker exec -i dokku sshcommand acl-add dokku root"
echo -e "\nCLONING repo\n"
git clone https://github.com/heroku/node-js-sample.git
cd node-js-sample/
git config user.email "platform@protonet.info"
git config user.name "Protonet Integration Test node.js"
# http://progrium.viewdocs.io/dokku/checks-examples.md
echo -e "WAIT=10\nATTEMPTS=20\n/ Hello" > CHECKS
git add .
git commit -a -m "Initial Commit"
echo -e "\nRUNNING git push to ${HOSTIP}\n"
git remote add dokku ssh://dokku@${HOSTIP}:8022/node-js-app
# destroy in case it's already deployed
ssh -t -p 8022 dokku@${HOSTIP} apps:destroy node-js-app force || true
# ssh -t -p 8022 dokku@${HOSTIP} trace on
git push dokku master
wget -O - http://${HOSTIP}/node-js-app
| #!/usr/bin/env bash
# enable fail detection...
set -e
source /initialize.sh
initialize
echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
HOSTIP=$(vagrant ssh-config | awk '/HostName/ {print $2}')
echo -e "\nSETTING up Dokku SSH key.\n"
cat /.ssh/id_rsa.pub | vagrant ssh -c "docker exec -i dokku sshcommand acl-add dokku root"
echo -e "\nCLONING repo\n"
git clone https://github.com/experimental-platform/nodejs-hello-world.git
cd nodejs-hello-world/
git config user.email "platform@protonet.info"
git config user.name "Protonet Integration Test node.js"
# http://progrium.viewdocs.io/dokku/checks-examples.md
echo -e "WAIT=10\nATTEMPTS=20\n/ Hello" > CHECKS
git add .
git commit -a -m "Initial Commit"
echo -e "\nRUNNING git push to ${HOSTIP}\n"
git remote add dokku ssh://dokku@${HOSTIP}:8022/node-js-app
# destroy in case it's already deployed
ssh -t -p 8022 dokku@${HOSTIP} apps:destroy node-js-app force || true
# ssh -t -p 8022 dokku@${HOSTIP} trace on
git push dokku master
wget -O - http://${HOSTIP}/node-js-app
|
Fix l10n update script to actually update l10n. | #!/bin/bash
source /data/venvs/mrburns/bin/activate
source /home/mrburns/mrburns_env
#svn up locale
SUBJECT="[Glow2014-${DJANGO_SERVER_ENV}] l10n update error"
REV_FILE=".locale_revision"
test ! -e $REV_FILE && touch $REV_FILE
locale_revision=$(cat $REV_FILE)
new_revision=$(svnversion -cn locale | cut -d ':' -f 2)
function report_error() {
if [ -n "$L10N_ERROR_EMAILS" ]; then
printf "$1" | mail -s "$SUBJECT" "$L10N_ERROR_EMAILS"
else
printf "$1"
fi
}
if [ "$locale_revision" != "$new_revision" ]; then
echo $new_revision > $REV_FILE
errors=$(dennis-cmd lint locale)
if [ $? -eq 0 ]; then
errors=$(python manage.py compilemessages 2>&1 > /dev/null)
if [ $? -eq 0 ]; then
sudo supervisorctl restart mrburns
else
report_error "Some .po files failed to compile in r${new_revision}.\n\n$errors"
fi
else
report_error "Dennis found a problem with the .po files in r${new_revision}.\n\n$errors"
fi
fi
| #!/bin/bash
source /data/venvs/mrburns/bin/activate
source /home/mrburns/mrburns_env
svn up locale
SUBJECT="[Glow2014-${DJANGO_SERVER_ENV}] l10n update error"
REV_FILE=".locale_revision"
test ! -e $REV_FILE && touch $REV_FILE
locale_revision=$(cat $REV_FILE)
new_revision=$(svnversion -cn locale | cut -d ':' -f 2)
report_error() {
if [ -n "$L10N_ERROR_EMAILS" ]; then
echo -e "$1" | mail -s "$SUBJECT" "$L10N_ERROR_EMAILS"
else
echo -e "$1"
fi
}
echoerr() {
# echo to stderr
echo -e "$@" 1>&2
}
if [ "$locale_revision" != "$new_revision" ]; then
echoerr "got new revision: $new_revision"
echo $new_revision > $REV_FILE
errors=$(dennis-cmd lint locale)
if [ $? -eq 0 ]; then
echoerr dennis succeeded
errors=$(python manage.py compilemessages 2>&1 > /dev/null)
if [ $? -eq 0 ]; then
echoerr compilemessages succeeded
sudo supervisorctl restart mrburns
else
echoerr compilemessages FAILED
report_error "Some .po files failed to compile in r${new_revision}.\n\n$errors"
fi
else
echoerr dennis FAILED
report_error "Dennis found a problem with the .po files in r${new_revision}.\n\n$errors"
fi
else
echoerr no new revision
fi
|
Fix Travis CI zsh bug regarding $0 | #!/usr/bin/env bash
# Copyright (c) 2015 Eivind Arvesen. All Rights Reserved.
# Make prm as normally run available
prm() {
source ./prm.sh "$@"
}
# BEFORE ALL TESTS:
oneTimeSetUp() {
prm > /dev/null 2>&1
# everything in prm is now available in tests
}
# AFTER ALL TESTS:
#oneTimeTearDown()
# BEFORE EACH TEST:
# setUp()
# AFTER EACH TEST:
# tearDown()
testGlobalVariables() {
assertNotNull "${COPY}"
assertNotNull "${VERSION}"
assertNotNull "${SOURCE}"
}
testReturnError() {
`return_error 1`
assertEquals "return_error does not return 1" \
1 "$?"
`return_error 1 'test'`
assertEquals "return_error does not return 1 when given message" \
1 "$?"
assertEquals "return_error does not return correct message" \
'test' "`return_error 1 'test'`"
}
# for zsh compatibility
if [[ $(basename "$SHELL") == zsh ]]; then
SHUNIT_PARENT=$0
fi
if [ "$CI" = true -a "$TRAVIS" = true ];then
. shunit2-2.1.6/src/shunit2
else
#printf "Not on Travis CI\n\n"
if [ ! "$(basename "${0//-/}")" = "shunit2" ]; then
#echo "Run test locally via 'shunit2 test_prm.sh'"
shunit2 "$0"
fi
fi
| #!/usr/bin/env bash
# Copyright (c) 2015 Eivind Arvesen. All Rights Reserved.
# for zsh compatibility
SHUNIT_PARENT=$0
# Make prm as normally run available
prm() {
source ./prm.sh "$@"
}
# BEFORE ALL TESTS:
oneTimeSetUp() {
prm > /dev/null 2>&1
# everything in prm is now available in tests
}
# AFTER ALL TESTS:
#oneTimeTearDown()
# BEFORE EACH TEST:
# setUp()
# AFTER EACH TEST:
# tearDown()
testGlobalVariables() {
assertNotNull "${COPY}"
assertNotNull "${VERSION}"
assertNotNull "${SOURCE}"
}
testReturnError() {
`return_error 1`
assertEquals "return_error does not return 1" \
1 "$?"
`return_error 1 'test'`
assertEquals "return_error does not return 1 when given message" \
1 "$?"
assertEquals "return_error does not return correct message" \
'test' "`return_error 1 'test'`"
}
if [ "$CI" = true -a "$TRAVIS" = true ];then
. shunit2-2.1.6/src/shunit2
else
#printf "Not on Travis CI\n\n"
if [ ! "$(basename "${0//-/}")" = "shunit2" ]; then
#echo "Run test locally via 'shunit2 test_prm.sh'"
shunit2 "$0"
fi
fi
|
Use gcloud preview app instead of appcfg | #!/bin/bash
# fail on errors
set -e
CLOUDSDK_URL=https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
SDK_DIR=google-cloud-sdk
# deploy only master builds
if [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Skip deploy."
exit 0
fi
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
export CLOUDSDK_PYTHON_SITEPACKAGES=1
if [ ! -d $SDK_DIR ]; then
mkdir -p $SDK_DIR
curl -o /tmp/gcloud.tar.gz $CLOUDSDK_URL
tar xzf /tmp/gcloud.tar.gz --strip 1 -C $SDK_DIR
$SDK_DIR/install.sh
fi
openssl aes-256-cbc -d -k $KEY_PASSPHRASE \
-in tools/web-central-44673aab0806.json.enc \
-out tools/web-central-44673aab0806.json
$SDK_DIR/bin/gcloud components update gae-python -q
$SDK_DIR/bin/gcloud auth activate-service-account $SERVICE_ACCOUNT \
--key-file tools/web-central-44673aab0806.json \
--quiet
$SDK_DIR/bin/appcfg.py -A web-central -V master update ./appengine
| #!/bin/bash
# fail on errors
set -e
CLOUDSDK_URL=https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz
SDK_DIR=google-cloud-sdk
# deploy only master builds
if [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Skip deploy."
exit 0
fi
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
export CLOUDSDK_PYTHON_SITEPACKAGES=1
if [ ! -d $SDK_DIR ]; then
mkdir -p $SDK_DIR
curl -o /tmp/gcloud.tar.gz $CLOUDSDK_URL
tar xzf /tmp/gcloud.tar.gz --strip 1 -C $SDK_DIR
$SDK_DIR/install.sh
fi
openssl aes-256-cbc -d -k $KEY_PASSPHRASE \
-in tools/web-central-44673aab0806.json.enc \
-out tools/web-central-44673aab0806.json
$SDK_DIR/bin/gcloud components update app -q
$SDK_DIR/bin/gcloud auth activate-service-account $SERVICE_ACCOUNT \
--key-file tools/web-central-44673aab0806.json \
--quiet
$SDK_DIR/bin/gcloud config set project web-central
$SDK_DIR/bin/gcloud --verbosity info preview app deploy --version master ./appengine/app.yaml
|
Fix Travis OSX test command | pwd
git submodule update --init --recursive
brew install sfml
git clone https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install
cd ../..
mkdir build
cd build
cmake .. -DCMAKE_MODULE_PATH=/usr/local/opt/sfml/share/SFML/cmake/Modules
make
./bin/WangscapeTest
| pwd
git submodule update --init --recursive
brew install sfml
git clone https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install
cd ../..
mkdir build
cd build
cmake .. -DCMAKE_MODULE_PATH=/usr/local/opt/sfml/share/SFML/cmake/Modules
make
./bin/WangscapeTest ../doc
|
Fix working directory for tests | #!/bin/bash -e
CURRDIR=$PWD
BASEDIR=$(cd "$(dirname "$0")"; pwd)
cd "$BASEDIR/.."
mkdir build
cd build
cmake ..
make
./sarg_test_c
| #!/bin/bash -e
CURRDIR=$PWD
BASEDIR=$(cd "$(dirname "$0")"; pwd)
cd "$BASEDIR/.."
mkdir build
cd build
cmake ..
make
cd ..
./build/sarg_test_c
|
Check and report status of various required packages | #!/bin/sh
python3 --version
echo "Please make sure you are using python 3.6.x"
solc --version
echo "Please make sure you are using solc 0.4.21"
rm -rf ./tests/testdata/outputs_current/
mkdir -p ./tests/testdata/outputs_current/
mkdir -p /tmp/test-reports
pytest --junitxml=/tmp/test-reports/junit.xml
| #!/bin/sh
echo -n "Checking Python version... "
python -c 'import sys
print(sys.version)
assert sys.version_info[0:2] >= (3,6), \
"""Please make sure you are using Python 3.6.x.
You ran with {}""".format(sys.version)' || exit $?
echo "Checking solc version..."
out=$(solc --version) || {
echo 2>&1 "Please make sure you have solc installed, version 0.4.21 or greater"
}
case $out in
*Version:\ 0.4.2[1-9]* )
echo $out
break ;;
* )
echo $out
echo "Please make sure your solc version is at least 0.4.21"
exit 1
;;
esac
echo "Checking that truffle is installed..."
if ! which truffle ; then
echo "Please make sure you have etherum truffle installed (npm install -g truffle)"
exit 2
fi
rm -rf ./tests/testdata/outputs_current/
mkdir -p ./tests/testdata/outputs_current/
mkdir -p /tmp/test-reports
pytest --junitxml=/tmp/test-reports/junit.xml
|
Correct ownership of amcat's home-directory | PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $PWD/defaults.cfg
echo "Installing basic features."
apt-get install -y curl software-properties-common python-software-properties git python-pip
echo "Checking whether user $AMCAT_USER exists"
getent passwd $AMCAT_USER > /dev/null
if [ $? -eq 2 ]; then
echo "Creating user..."
set -e
useradd -Ms/bin/bash $AMCAT_USER
fi
set -e
echo "Create folder $AMCAT_ROOT if needed"
mkdir -p $AMCAT_ROOT
chown amcat:amcat $AMCAT_ROOT
set +e
| PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $PWD/defaults.cfg
echo "Installing basic features."
apt-get install -y curl software-properties-common python-software-properties git python-pip
echo "Checking whether user $AMCAT_USER exists"
# The directory that contains $AMCAT_ROOT will be the user's home directory
getent passwd $AMCAT_USER > /dev/null
if [ $? -eq 2 ]; then
echo "Creating user..."
set -e
USER_HOME=`dirname $AMCAT_ROOT`
useradd -Ms/bin/bash --home "$USER_HOME" $AMCAT_USER
mkdir -p $USER_HOME
chown amcat:amcat $USER_HOME
fi
set -e
echo "Create folder $AMCAT_ROOT if needed"
mkdir -p $AMCAT_ROOT
chown amcat:amcat $AMCAT_ROOT
set +e
|
Upgrade Java 18 version in CI image | #!/bin/bash
set -e
case "$1" in
java8)
echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz"
;;
java11)
echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz"
;;
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz"
;;
java18)
echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk18-2022-03-17-09-00-beta/OpenJDK18-jdk_x64_linux_hotspot_2022-03-17-09-00.tar.gz"
;;
*)
echo $"Unknown java version"
exit 1
esac
| #!/bin/bash
set -e
case "$1" in
java8)
echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz"
;;
java11)
echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz"
;;
java17)
echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz"
;;
java18)
echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-18%2B36/OpenJDK18U-jdk_x64_linux_hotspot_18_36.tar.gz"
;;
*)
echo $"Unknown java version"
exit 1
esac
|
Add cd workspace to build images. | #! /bin/bash
cd admin-portal-ui/server; mvn clean package -Pdocker docker:build; cd -;
cd discovery-server/discovery-server; mvn clean package docker:build; cd -;
cd dss-api/dss; mvn clean package docker:build; cd -;
cd edge-server/edge-server; mvn clean package docker:build; cd -;
cd patient-portal-ui/server; mvn clean package -Pdocker docker:build; cd -;
cd patient-user-api/patient-user; mvn clean package docker:build; cd -;
cd pcm-api/pcm; mvn clean package docker:build; cd -;
cd phr-api/phr; mvn clean package docker:build; cd -;
cd pls-api/pls/web; mvn clean package docker:build; cd -;
cd registration-api/registration; mvn clean package docker:build; cd -;
cd try-policy-api/tryPolicy; mvn clean package docker:build; cd -;
cd iexhub/iexhub; mvn clean package docker:build; cd -;
cd uaa; ./gradlew clean install; cp uaa/build/libs/*.war docker/uaa.war; cd docker; docker build -t uaa .; rm uaa.war;
| #! /bin/bash
cd ..;
cd admin-portal-ui/server; mvn clean package -Pdocker docker:build; cd -;
cd discovery-server/discovery-server; mvn clean package docker:build; cd -;
cd dss-api/dss; mvn clean package docker:build; cd -;
cd edge-server/edge-server; mvn clean package docker:build; cd -;
cd patient-portal-ui/server; mvn clean package -Pdocker docker:build; cd -;
cd patient-user-api/patient-user; mvn clean package docker:build; cd -;
cd pcm-api/pcm; mvn clean package docker:build; cd -;
cd phr-api/phr; mvn clean package docker:build; cd -;
cd pls-api/pls/web; mvn clean package docker:build; cd -;
cd registration-api/registration; mvn clean package docker:build; cd -;
cd try-policy-api/tryPolicy; mvn clean package docker:build; cd -;
cd iexhub/iexhub; mvn clean package docker:build; cd -;
cd uaa; ./gradlew clean install; cp uaa/build/libs/*.war docker/uaa.war; cd docker; docker build -t uaa .; rm uaa.war;
|
Update to release branch of 1.10 | #!/usr/bin/env bash
set +e
VERSION="release-branch.go1.9"
export CGO_ENABLED=0
ROOT=$HOME/go
mkdir -p $ROOT
cd $ROOT
# Versions later than go 1.4 need go 1.4 to build successfully.
if [[ ! -d go1.4 ]]; then
git clone --branch release-branch.go1.4 --depth=1 git@github.com:golang/go.git go1.4
cd go1.4/src
./make.bash
cd ../..
fi
# Make sure we build the new version from scratch
if [[ -d "$VERSION" ]]; then
rm -rf $ROOT/$VERSION
fi
git clone --branch $VERSION --depth=1 git@github.com:golang/go.git $VERSION
cd $VERSION/src
GOROOT_BOOTSTRAP=$ROOT/go1.4 ./make.bash
cd ../..
[[ -d src ]] && rm src bin pkg
ln -s $VERSION/src src
ln -s $VERSION/bin bin
ln -s $VERSION/pkg pkg
| #!/usr/bin/env bash
set +e
VERSION="release-branch.go1.10"
export CGO_ENABLED=0
ROOT=$HOME/go
mkdir -p $ROOT
cd $ROOT
# Versions later than go 1.4 need go 1.4 to build successfully.
if [[ ! -d go1.4 ]]; then
git clone --branch release-branch.go1.4 --depth=1 git@github.com:golang/go.git go1.4
cd go1.4/src
./make.bash
cd ../..
fi
# Make sure we build the new version from scratch
if [[ -d "$VERSION" ]]; then
rm -rf $ROOT/$VERSION
fi
git clone --branch $VERSION --depth=1 git@github.com:golang/go.git $VERSION
cd $VERSION/src
GOROOT_BOOTSTRAP=$ROOT/go1.4 ./make.bash
cd ../..
[[ -d src ]] && rm src bin pkg
ln -s $VERSION/src src
ln -s $VERSION/bin bin
ln -s $VERSION/pkg pkg
|
Update script for Symfony 3 | #!/bin/bash
php app/console doctrine:database:drop --force && php app/console doctrine:database:create && php app/console doctrine:schema:create && echo "Y"|php app/console doctrine:fixtures:load
| #!/bin/bash
php bin/console doctrine:database:drop --force && php bin/console doctrine:database:create && php bin/console doctrine:schema:create && echo "Y"|php bin/console doctrine:fixtures:load
|
Modify fetch script to call other two | #! /usr/bin/env bash
#
# Fetch the most recent MySQL and MongoDB database dumps from production.
#
DIR="backups/$(date +%Y-%m-%d)"
usage()
{
cat << EOF
Usage: $0 [options]
Fetch the most recent database dump files from production.
OPTIONS:
-h Show this message
-F file Use a custom SSH configuration file
-d dir Store the backups in a different directory
-u user SSH user to log in as (overrides SSH config)
EOF
}
while getopts "hF:d:u:" OPTION
do
case $OPTION in
h )
usage
exit 1
;;
F )
# Load a custom SSH config file if given
SSH_CONFIG=$OPTARG
;;
d )
# Put the backups into a custom directory
DIR=$OPTARG
;;
u )
# override the SSH user
SSH_USER=$OPTARG
;;
esac
done
shift $(($OPTIND-1))
MYSQL_SRC="mysql-slave-1.backend.preview:/var/lib/automysqlbackup/latest.tbz2"
MYSQL_DIR="$DIR/mysql"
MONGO_SRC="mongo.backend.preview:/var/lib/automongodbbackup/latest/*.tgz"
MONGO_DIR="$DIR/mongo"
mkdir -p $MYSQL_DIR $MONGO_DIR
if [[ -n $SSH_CONFIG ]]; then
SCP_OPTIONS="-F $SSH_CONFIG"
fi
if [[ -n $SSH_USER ]]; then
SSH_USER="$SSH_USER@"
fi
rsync -P -e "ssh $SCP_OPTIONS" $SSH_USER$MYSQL_SRC $MYSQL_DIR
rsync -P -e "ssh $SCP_OPTIONS" $SSH_USER$MONGO_SRC $MONGO_DIR
| #! /usr/bin/env bash
#
# Fetch the most recent MySQL and MongoDB database dumps from production.
#
DIR="backups/$(date +%Y-%m-%d)"
usage()
{
cat << EOF
Usage: $0 [options]
Fetch the most recent database dump files from production.
OPTIONS:
-h Show this message
-F file Use a custom SSH configuration file
-d dir Store the backups in a different directory
-u user SSH user to log in as (overrides SSH config)
EOF
}
while getopts "hF:d:u:" OPTION
do
case $OPTION in
h )
usage
exit 1
;;
esac
done
shift $(($OPTIND-1))
./fetch-recent-mongodb-backups.sh "$@"
./fetch-recent-mysql-backups.sh "$@"
|
Update script to use includes.chroot to be compat with live-build 3.x | #!/bin/sh
set -e
# Get's latest sdc-vmtools from git, then runs a complete build:
# lb clean; lb config; lb build
if [ ! -d sdc-vmtools ] ; then
echo "sdc-vmtools git repo not found, cloning..."
git clone git@git.joyent.com:sdc-vmtools.git
fi
echo "Updating sdc-vmtools git repo"
cd sdc-vmtools
git pull
cd ..
includes=config/chroot_local-includes/
sdcvmtools=sdc-vmtools/src/linux
echo "Syncing etc, lib, and usr directories to ${includes}..."
# Using rsync to ensure deleted files from sdc-vmtools repo are removed
rsync -aq --delete --exclude=install-tools.sh ./${sdcvmtools}/ ${includes}/
echo "Starting full build..."
echo ""
lb clean; lb config; lb build
| #!/bin/sh
set -e
# Get's latest sdc-vmtools from git, then runs a complete build:
# lb clean; lb config; lb build
if [ ! -d sdc-vmtools ] ; then
echo "sdc-vmtools git repo not found, cloning..."
git clone git@git.joyent.com:sdc-vmtools.git
fi
echo "Updating sdc-vmtools git repo"
cd sdc-vmtools
git pull
cd ..
includes=config/includes.chroot
sdcvmtools=sdc-vmtools/src/linux
echo "Syncing etc, lib, and usr directories to ${includes}..."
# Using rsync to ensure deleted files from sdc-vmtools repo are removed
rsync -aq --delete --exclude=install-tools.sh ./${sdcvmtools}/ ${includes}/
echo "Starting full build..."
echo ""
lb clean; lb config; lb build
|
Fix templates because bash args sucks | #!/usr/bin/env bash
render_template() {
local template="${@: -2: 1}" # get the parameter before last
# | |___________________ 1 parameter
# |______________________ In the second position counting
# from the tail
local dest="${@: -1}" # get the last parameter
# |__________________________ 1 parameter in the first position
# from the tail
local substitutions="${@: 1: ${#}-2}" # get all the rest
# | | |__________ counting 2 position
# | |_____________ from the array length
# |__________________ take all the elements from the
# first position
local context=() # initialize context
# create context
# context variables comes in the form VARIABLENAME=value
for subst in "${substitutions}";do
if [[ "${subst}" =~ ^.*=.*$ ]]; then
IFS='=' read -a ctxvar <<< $subst; # string splitting, this is cool
# | | | |________ we feed the function with the args and
# | | |___________________ we store in this variable the values
# | |____________________________ we read here
# |_______________________________ IFS is the Internal Field Separator
tplstr="${ctxvar[0]}"; valstr="${ctxvar[1]}"
context+=('-e '"s/\{\{${tplstr}\}\}/$valstr/g")
fi
done
#execute the substitutions
sed -E "${context[@]} ${template} > ${dest}"
}
| #!/usr/bin/env bash
render_template() {
local template="${@: -2: 1}" # get the parameter before last
# | |___________________ 1 parameter
# |______________________ In the second position counting
# from the tail
local dest="${@: -1}" # get the last parameter
# |__________________________ 1 parameter in the first position
# from the tail
local context=() # initialize context
# create context
# context variables comes in the form VARIABLENAME=value
for subst in "${@}";do
if [[ "${subst}" =~ ^.*=.*$ ]]; then
IFS='=' read -a ctxvar <<< $subst; tplstr="${ctxvar[0]}"; valstr="${ctxvar[1]}"
context+=('-e '"s/\{\{${tplstr}\}\}/$valstr/g")
info:sm "Setting ${tplstr} to ${valstr}"
fi
done
#execute the substitutions
sed -E "${context[@]}" $template > $dest
}
|
Fix export syntax of $GREP_OPTIONS | #
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
# avoid VCS folders
GREP_OPTIONS=
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+="--exclude-dir=$PATTERN "
done
export GREP_OPTIONS+='--color=auto '
export GREP_COLOR='1;32'
| #
# Color grep results
# Examples: http://rubyurl.com/ZXv
#
# avoid VCS folders
GREP_OPTIONS=
for PATTERN in .cvs .git .hg .svn; do
GREP_OPTIONS+="--exclude-dir=$PATTERN "
done
GREP_OPTIONS+="--color=auto"
export GREP_OPTIONS="$GREP_OPTIONS"
export GREP_COLOR='1;32'
|
Fix linking dot directory; Install i2cssh; | #!/usr/bin/env bash
# Install XCode tools
xcode-select --install
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
cat brew_list | xargs brew install
cat brew_tap | xargs brew tap
brew update && brew outdated
brew upgrade && brew cleanup
cat brew_cask_list | xargs brew cask install
brew cask outdated --quiet | xargs brew cask reinstall
# Setup Oh-My-ZSH
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Install dotfiles
ls -p | grep -v / | grep dot- | cut -d '-' -f 2 | xargs -n 1 -I {} ln -s -f `pwd`/dot-{} ~/.{}
ls -p | grep / | grep dot- | cut -d '-' -f 2 | xargs -n 1 -I {} sh -c '[ ! -e ~/.{} ] && ln -s -f `pwd`/dot-{} ~/.{}'
git submodule init
git submodule update
ln -s `pwd`/tmux/.tmux.conf ~/.tmux.conf
# Setup git
git config --global url."git@github.com:".insteadOf "https://github.com/"
git config --global core.excludesfile ~/.gitignore_global
# Install fzf
yes | /usr/local/opt/fzf/install
| #!/usr/bin/env bash
# Install XCode tools
xcode-select --install
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
cat brew_list | grep -v ^# | xargs brew install
cat brew_tap | grep -v ^# | xargs brew tap
brew update && brew outdated
brew upgrade && brew cleanup
cat brew_cask_list | grep -v ^# | xargs brew cask install
brew cask outdated --quiet | xargs brew cask reinstall
# Setup Oh-My-ZSH
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Install dotfiles
ls -p | grep -v / | grep dot- | cut -d '-' -f 2 | xargs -n 1 -I {} ln -s -f `pwd`/dot-{} ~/.{}
ls -p | grep / | grep dot- | cut -d '-' -f 2 | cut -d '/' -f 1 | xargs -n 1 -I {} sh -c '[ ! -e ~/.{} ] && ln -s -f `pwd`/dot-{} ~/.{}'
git submodule init
git submodule update
ln -s `pwd`/tmux/.tmux.conf ~/.tmux.conf
# Setup git
git config --global url."git@github.com:".insteadOf "https://github.com/"
git config --global core.excludesfile ~/.gitignore_global
# Install fzf
yes | /usr/local/opt/fzf/install
# Install i2cssh
gem install i2cssh
|
Revert "Revert "Revert "git push and run""" | #!/bin/sh
if [ $TRAVIS_PULL_REQUEST != "false" ]; then
echo "Testing pull request"
gulp buildAndTest
elif [ $TRAVIS_BRANCH = "master" ]; then
echo "Testing and deploying to production"
# Add deploy ssh key
eval "$(ssh-agent -s)" #start the ssh agent
ssh-add .travis/id_rsa
gulp cd:pushAndRun
elif [ $TRAVIS_BRANCH = "staging" ]; then
echo "Deploying to staging and testing"
# Add deploy ssh key
eval "$(ssh-agent -s)" #start the ssh agent
ssh-add .travis/id_rsa
gulp cd:pushAndRun
else
echo "Testing branch $TRAVIS_BRANCH"
gulp buildAndTest
fi
| #!/bin/sh
if [ $TRAVIS_PULL_REQUEST != "false" ]; then
echo "Testing pull request"
gulp buildAndTest
elif [ $TRAVIS_BRANCH = "master" ]; then
echo "Testing and deploying to production"
# Add deploy ssh key
eval "$(ssh-agent -s)" #start the ssh agent
ssh-add .travis/id_rsa
gulp cd
elif [ $TRAVIS_BRANCH = "staging" ]; then
echo "Deploying to staging and testing"
# Add deploy ssh key
eval "$(ssh-agent -s)" #start the ssh agent
ssh-add .travis/id_rsa
gulp cd:pushAndRun
else
echo "Testing branch $TRAVIS_BRANCH"
gulp buildAndTest
fi
|
Update entry point plugin setup | #!/bin/bash
set -e
if [[ -n "$JENKINS_RESTORE_FROM" ]]
then
echo "Restoring from ${JENKINS_RESTORE_FROM}..."
curl $JENKINS_RESTORE_FROM | tar xvf -C $JENKINS_HOME
fi
echo "Copying plugins..."
mkdir -p ${JENKINS_HOME}/plugins
rm -rf ${JENKINS_HOME}/plugins/*
cp ${JENKINS_PLUGINS_HOME}/* ${JENKINS_HOME}/plugins || :
exec "$@"
| #!/bin/bash
set -e
if [[ -n "$JENKINS_RESTORE_FROM" ]]
then
echo "Restoring from ${JENKINS_RESTORE_FROM}..."
curl $JENKINS_RESTORE_FROM | tar xvf -C $JENKINS_HOME
fi
echo "Copying plugins..."
rm -rf ${JENKINS_HOME}/plugins
mkdir -p ${JENKINS_HOME}/plugins
cp ${JENKINS_PLUGINS_HOME}/* ${JENKINS_HOME}/plugins || :
exec "$@"
|
Add alias for "composer dump-autoload" | # ------------------------------------------------------------------------------
# FILE: composer.plugin.zsh
# DESCRIPTION: oh-my-zsh composer plugin file.
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
# Composer basic command completion
_composer_get_command_list () {
composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_composer () {
if [ -f composer.json ]; then
compadd `_composer_get_command_list`
else
compadd create-project init search selfupdate show
fi
}
compdef _composer composer
# Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
alias ci='composer install'
alias ccp='composer create-project'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
| # ------------------------------------------------------------------------------
# FILE: composer.plugin.zsh
# DESCRIPTION: oh-my-zsh composer plugin file.
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
# Composer basic command completion
_composer_get_command_list () {
composer --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
}
_composer () {
if [ -f composer.json ]; then
compadd `_composer_get_command_list`
else
compadd create-project init search selfupdate show
fi
}
compdef _composer composer
# Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
alias ci='composer install'
alias ccp='composer create-project'
alias cdu='composer dump-autoload'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
|
Clear localhost entries from flood table before tests. | #!/bin/bash
# ==============================================================================
# BEFORE TESTS
# Tasks to run before functional testing.
# ==============================================================================
| #!/bin/bash
# ==============================================================================
# BEFORE TESTS
# Tasks to run before functional testing.
# ==============================================================================
cd /var/www/vagrant/html
# Clear out localhost from flood table (prevents "more than 5 failed login attempts" error)
drush sql-query "DELETE FROM flood WHERE identifier LIKE '%127.0.0.1';"
|
Check for RPMs before building Docker image | #!/bin/sh
set -evx
SCRIPT_NAME=$(basename "$0")
TAG="$1"
if [ -z "$TAG" ]; then
echo "Usage: ${SCRIPT_NAME} TAG" >&2
exit 1
fi
rm -rf tmp/docker
mkdir -p tmp/docker/rpms
cp dist/onearth-*.el7.*.rpm tmp/docker/rpms/
cp docker/el7/run-onearth.sh tmp/docker/run-onearth.sh
echo "FROM $(cat docker/el7/gibs-gdal-image.txt)" > tmp/docker/Dockerfile
grep -Ev '^FROM' docker/el7/Dockerfile >> tmp/docker/Dockerfile
(
set -evx
cd tmp/docker
docker build -t "$TAG" .
)
rm -rf tmp/docker
| #!/bin/sh
set -e
if ! ls dist/gibs-gdal-*.el7.*.rpm >/dev/null 2>&1; then
echo "No RPMs found in ./dist/" >&2
exit 1
fi
SCRIPT_NAME=$(basename "$0")
TAG="$1"
if [ -z "$TAG" ]; then
echo "Usage: ${SCRIPT_NAME} TAG" >&2
exit 1
fi
rm -rf tmp/docker
mkdir -p tmp/docker/rpms
cp dist/onearth-*.el7.*.rpm tmp/docker/rpms/
cp docker/el7/run-onearth.sh tmp/docker/run-onearth.sh
echo "FROM $(cat docker/el7/gibs-gdal-image.txt)" > tmp/docker/Dockerfile
grep -Ev '^FROM' docker/el7/Dockerfile >> tmp/docker/Dockerfile
(
set -e
cd tmp/docker
docker build -t "$TAG" .)
rm -rf tmp/docker
|
Use forked ffs until changes make it upstream | #!/usr/bin/env bash
set -e
set -x
shopt -s dotglob
readonly name="ffs"
readonly ownership="ffs Upstream <robot@adios2>"
readonly subtree="thirdparty/ffs/ffs"
readonly repo="https://github.com/GTkorvo/ffs.git"
readonly tag="master"
readonly shortlog="true"
readonly paths="
"
extract_source () {
git_archive
}
. "${BASH_SOURCE%/*}/../update-common.sh"
| #!/usr/bin/env bash
set -e
set -x
shopt -s dotglob
readonly name="ffs"
readonly ownership="ffs Upstream <robot@adios2>"
readonly subtree="thirdparty/ffs/ffs"
#readonly repo="https://github.com/GTkorvo/ffs.git"
#readonly tag="master"
readonly repo="https://github.com/chuckatkins/ffs.git"
readonly tag="misc-cmake-updates"
readonly shortlog="true"
readonly paths="
"
extract_source () {
git_archive
}
. "${BASH_SOURCE%/*}/../update-common.sh"
|
Add command to init and update git submodules | #!/bin/bash
mkdir tmp
galaxy_dir="lib/galaxy/"
# Prepare environment
./src/install_libraries.sh $galaxy_dir #> tmp/install_libraries
#if grep "Error" tmp/install_libraries > /dev/null ; then
# echo "Error with install_libraries.sh"
# exit
#fi
# Prepare galaxy
./src/prepare_galaxy.sh $galaxy_dir #> tmp/prepare_galaxy
#if grep "Error" tmp/prepare_galaxy > /dev/null ; then
# echo "Error with prepare_galaxy.sh"
# exit
#fi
rm -rf tmp
# Launch galaxy
cd $galaxy_dir
sh run.sh | #!/bin/bash
git submodule init
git submodule update
mkdir tmp
galaxy_dir="lib/galaxy/"
# Prepare environment
./src/install_libraries.sh $galaxy_dir #> tmp/install_libraries
#if grep "Error" tmp/install_libraries > /dev/null ; then
# echo "Error with install_libraries.sh"
# exit
#fi
# Prepare galaxy
./src/prepare_galaxy.sh $galaxy_dir #> tmp/prepare_galaxy
#if grep "Error" tmp/prepare_galaxy > /dev/null ; then
# echo "Error with prepare_galaxy.sh"
# exit
#fi
rm -rf tmp
# Launch galaxy
cd $galaxy_dir
sh run.sh |
Add option for create gh-pages branch. | #!/usr/bin/env bash
#
# after_success
# deploy gh-pages
#
setup_git() {
git config --global user.email "zhangt@frib.msu.edu"
git config --global user.name "Travis CI"
}
add_files() {
cp -arv docs/build/html/* . \
| awk -F'->' '{print $2}' \
| sed "s/[\'\’\ \‘]//g" > /tmp/filelist
for ifile in `cat /tmp/filelist`
do
git add ${ifile}
done
! [ -e .nojekyll ] && touch .nojekyll && git add .nojekyll
}
commit_files() {
git stash
git checkout --orphan gh-pages
git rm -rf .
add_files
git commit -m "Update docs by Travis build: $TRAVIS_BUILD_NUMBER"
}
push_files() {
git remote add pages https://${GITHUB_TOKEN}@github.com/archman/phantasy.git
git push --quiet --set-upstream pages gh-pages
}
setup_git
commit_files
push_files
| #!/usr/bin/env bash
#
# after_success
# deploy gh-pages
#
setup_git() {
git config --global user.email "zhangt@frib.msu.edu"
git config --global user.name "Travis CI"
}
add_files() {
cp -arv docs/build/html/* . \
| awk -F'->' '{print $2}' \
| sed "s/[\'\’\ \‘]//g" > /tmp/filelist
for ifile in `cat /tmp/filelist`
do
git add ${ifile}
done
! [ -e .nojekyll ] && touch .nojekyll && git add .nojekyll
}
commit_files() {
git stash
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch
git ls-remote | grep -i "refs/heads/gh-pages"
if [ $? -ne 0 ]; then
git checkout --orphan gh-pages
git rm -rf .
else
git checkout -b gh-pages origin/gh-pages
fi
add_files
git commit -m "Update docs by Travis build: $TRAVIS_BUILD_NUMBER"
}
push_files() {
git remote add pages https://${GITHUB_TOKEN}@github.com/archman/phantasy.git
git push --quiet --set-upstream pages gh-pages
}
setup_git
commit_files
push_files
|
Update integration test to use gradlew | #!/bin/bash
set -x
set -e
set -o pipefail
echo $ANDROID_SERIAL
cleanup() {
rm -rf ~/.m2 ~/.gradle/caches
rm -rf */build/
rm -rf examples/one/build/
}
cleanup
./gradlew :plugin:install
./gradlew :core:install
cd examples/app-example
gradle connectedAndroidTest
gradle screenshotTests
cleanup
| #!/bin/bash
set -x
set -e
set -o pipefail
echo $ANDROID_SERIAL
cleanup() {
rm -rf ~/.m2 ~/.gradle/caches
rm -rf */build/
rm -rf examples/one/build/
}
cleanup
./gradlew :plugin:install
./gradlew :core:install
cd examples/app-example
./gradlew connectedAndroidTest
./gradlew screenshotTests
cleanup
|
Switch conda to https following JHP's fix | # This script was taken from https://github.com/pandegroup/mdtraj/tree/master/devtools
sudo apt-get update
### Install Miniconda
MINICONDA=Miniconda-latest-Linux-x86_64.sh
MINICONDA_MD5=$(curl -s http://repo.continuum.io/miniconda/ | grep -A3 $MINICONDA | sed -n '4p' | sed -n 's/ *<td>\(.*\)<\/td> */\1/p')
wget http://repo.continuum.io/miniconda/$MINICONDA
if [[ $MINICONDA_MD5 != $(md5sum $MINICONDA | cut -d ' ' -f 1) ]]; then
echo "Miniconda MD5 mismatch"
exit 1
fi
bash $MINICONDA -b
## Install conda pacakages
# This might make the --yes obsolete
# conda config --set always_yes yes --set changeps1 no
export PATH=$HOME/miniconda/bin:$PATH
conda config --add channels http://conda.binstar.org/omnia
conda create --yes -n ${python} python=${python} --file devtools/ci/requirements-conda-${python}.txt
conda update --yes conda
source activate $python
# Useful for debugging any issues with conda
# conda info -a
# install python pip packages
PIP_ARGS="-U"
$HOME/miniconda/envs/${python}/bin/pip install $PIP_ARGS -r devtools/ci/requirements-${python}.txt
| # This script was taken from https://github.com/pandegroup/mdtraj/tree/master/devtools
sudo apt-get update
### Install Miniconda
MINICONDA=Miniconda-latest-Linux-x86_64.sh
MINICONDA_MD5=$(curl -s https://repo.continuum.io/miniconda/ | grep -A3 $MINICONDA | sed -n '4p' | sed -n 's/ *<td>\(.*\)<\/td> */\1/p')
wget https://repo.continuum.io/miniconda/$MINICONDA
if [[ $MINICONDA_MD5 != $(md5sum $MINICONDA | cut -d ' ' -f 1) ]]; then
echo "Miniconda MD5 mismatch"
exit 1
fi
bash $MINICONDA -b
## Install conda pacakages
# This might make the --yes obsolete
# conda config --set always_yes yes --set changeps1 no
export PATH=$HOME/miniconda/bin:$PATH
conda config --add channels http://conda.binstar.org/omnia
conda create --yes -n ${python} python=${python} --file devtools/ci/requirements-conda-${python}.txt
conda update --yes conda
source activate $python
# Useful for debugging any issues with conda
# conda info -a
# install python pip packages
PIP_ARGS="-U"
$HOME/miniconda/envs/${python}/bin/pip install $PIP_ARGS -r devtools/ci/requirements-${python}.txt
|
Fix adding fonts to Info.plist | #!/bin/bash
RESOURCE_REPO_PATH="../font-image-service"
FONTS_PATH="TextContour/Fonts"
IMAGES_PATH="TextContour/Images"
PLIST_PATH="TextContour/Info.plist"
PLISTBUDDY="/usr/libexec/PlistBuddy"
# Copy phase
echo "Coping Fonts..."
cp -r "${RESOURCE_REPO_PATH}/fonts/" "$FONTS_PATH"
echo "Coping Fonts... Done."
echo "Coping Images..."
cp -r "${RESOURCE_REPO_PATH}/images/" "$IMAGES_PATH"
echo "Coping Images... Done."
# Add resources phase
ruby "scripts/add-resources.rb"
# Add to Info.plist phase
echo "Add fonts to Info.plist..."
${PLISTBUDDY} -c "Print UIAppFonts" "${PLIST_PATH}" > /dev/null 2>&1
[[ "$?" = 0 ]] && ${PLISTBUDDY} -c "Delete UIAppFonts" "${PLIST_PATH}"
${PLISTBUDDY} -c "Add UIAppFonts array" "${PLIST_PATH}"
index=0
for filename in $(ls $FONTS_PATH) ; do
${PLISTBUDDY} -c "Add UIAppFonts:${index} string ${filename}" "${PLIST_PATH}"
index=$(( index + 1))
done
echo "Add fonts to Info.plist... Done."
| #!/bin/bash
RESOURCE_REPO_PATH="../font-image-service"
FONTS_PATH="TextContour/Fonts"
IMAGES_PATH="TextContour/Images"
PLIST_PATH="TextContour/Info.plist"
PLISTBUDDY="/usr/libexec/PlistBuddy"
git checkout TextContour.xcodeproj/project.pbxproj TextContour/Info.plist
# Copy phase
echo "Coping Fonts..."
cp -r "${RESOURCE_REPO_PATH}/fonts/" "$FONTS_PATH"
echo "Coping Fonts... Done."
echo "Coping Images..."
cp -r "${RESOURCE_REPO_PATH}/images/" "$IMAGES_PATH"
echo "Coping Images... Done."
# Add resources phase
ruby "scripts/add-resources.rb"
# Add to Info.plist phase
echo "Add fonts to Info.plist..."
${PLISTBUDDY} -c "Print UIAppFonts" "${PLIST_PATH}" > /dev/null 2>&1
[[ "$?" = 0 ]] && ${PLISTBUDDY} -c "Delete UIAppFonts" "${PLIST_PATH}"
${PLISTBUDDY} -c "Add UIAppFonts array" "${PLIST_PATH}"
index=0
ls ${FONTS_PATH} | while read filename ; do
command="${PLISTBUDDY} -c \"Add UIAppFonts:${index} string Fonts/${filename}\" \"${PLIST_PATH}\""
eval $command
index=$(( index + 1))
done
echo "Add fonts to Info.plist... Done."
|
Add logging of HTTP Status | #!/usr/bin/env bash
curl -H "Content-Type: application/json" -s -o /dev/null -w "%{http_code}" -X POST -d '{"alias":"Bob","uuid":"1ab9f8ta452bg2eq2"}' http://leanbean-proxy/leanbean/v1/devices/
: <<'END'
if [ -z "$1" ]
then
echo "No ip for leanbean-proxy provided. On OS X, run ./test.sh $(docker-machine ip leanbean)"
exit 127
fi
CMD="curl -H \"Content-Type: application/json\" -s -o /dev/null -w \"%{http_code}\" -X POST -d '{\"alias\":\"Bob\",\"uuid\":\"1ab9f8ta452bg2eq2\"}' http://$1/leanbean/v1/devices/"
echo "Running $CMD"
HTTP_STATUS=$(eval $CMD)
echo "HTTP Status ${HTTP_STATUS}"
if [ $HTTP_STATUS -eq 201 ]
then
echo "Test run successful"
exit 0;
else
echo "Test failures"
exit 1;
fi
END
| #!/usr/bin/env bash
HTTP_STATUS=$(curl -H "Content-Type: application/json" -s -o /dev/null -w "%{http_code}" -X POST -d '{"alias":"Bob","uuid":"1ab9f8ta452bg2eq2"}' http://leanbean-proxy/leanbean/v1/devices/)
echo "HTTP_STATUS is $HTTP_STATUS"
: <<'END'
if [ -z "$1" ]
then
echo "No ip for leanbean-proxy provided. On OS X, run ./test.sh $(docker-machine ip leanbean)"
exit 127
fi
CMD="curl -H \"Content-Type: application/json\" -s -o /dev/null -w \"%{http_code}\" -X POST -d '{\"alias\":\"Bob\",\"uuid\":\"1ab9f8ta452bg2eq2\"}' http://$1/leanbean/v1/devices/"
echo "Running $CMD"
HTTP_STATUS=$(eval $CMD)
echo "HTTP Status ${HTTP_STATUS}"
if [ $HTTP_STATUS -eq 201 ]
then
echo "Test run successful"
exit 0;
else
echo "Test failures"
exit 1;
fi
END
|
Adjust sleep time and add `wait` to intel_mp test | #!/usr/bin/env bash
SNABB_SEND_BLAST=true ./testsend.snabb $SNABB_PCI_INTEL1 0 source.pcap &
BLAST=$!
SNABB_RECV_SPINUP=2 SNABB_RECV_DURATION=5 ./testrecv.snabb $SNABB_PCI_INTEL0 0 > results.0 &
sleep 1
export SNABB_RECV_DURATION=1
for i in {1..7}; do ./testrecv.snabb $SNABB_PCI_INTEL0 1; done > results.1
sleep 1
kill -9 $BLAST
test `cat results.* | grep "^RXDGPC" | awk '{print $2}'` -gt 10000
exit $?
| #!/usr/bin/env bash
SNABB_SEND_BLAST=true ./testsend.snabb $SNABB_PCI_INTEL1 0 source.pcap &
BLAST=$!
SNABB_RECV_SPINUP=2 SNABB_RECV_DURATION=10 ./testrecv.snabb $SNABB_PCI_INTEL0 0 > results.0 &
RECV=$!
sleep 1
export SNABB_RECV_DURATION=1
for i in {1..7}; do ./testrecv.snabb $SNABB_PCI_INTEL0 1; done > results.1
sleep 1
kill -9 $BLAST
wait $RECV
test `cat results.* | grep "^RXDGPC" | awk '{print $2}'` -gt 10000
exit $?
|
Add --no-cache flag, since it's usually what you want. | #!/bin/bash
# Copyright 2017 The Bazel Authors. 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.
set -euo pipefail
usage() {
echo "Usage: $0 [--nodocker]" 1>&2
exit 1
}
if [ "$#" -eq 0 ] ; then
docker build -f tools/update_tools/Dockerfile --tag rules_python:update_tools .
docker run -v"$PWD":/opt/rules_python_source rules_python:update_tools
elif [ "$#" -eq 1 -a "$1" == "--nodocker" ] ; then
bazel build //rules_python:piptool.par //rules_python:whltool.par
cp bazel-bin/rules_python/piptool.par tools/piptool.par
cp bazel-bin/rules_python/whltool.par tools/whltool.par
else
usage
fi
| #!/bin/bash
# Copyright 2017 The Bazel Authors. 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.
set -euo pipefail
usage() {
echo "Usage: $0 [--nodocker]" 1>&2
exit 1
}
if [ "$#" -eq 0 ] ; then
docker build --no-cache -f tools/update_tools/Dockerfile --tag rules_python:update_tools .
docker run -v"$PWD":/opt/rules_python_source rules_python:update_tools
elif [ "$#" -eq 1 -a "$1" == "--nodocker" ] ; then
bazel build //rules_python:piptool.par //rules_python:whltool.par
cp bazel-bin/rules_python/piptool.par tools/piptool.par
cp bazel-bin/rules_python/whltool.par tools/whltool.par
else
usage
fi
|
Deploy only kernel + kernel headers deb packages | #!/bin/bash -e
echo "$CIRCLE_TAG"
if [ "$CIRCLE_TAG" != "" ]; then
gem install package_cloud
package_cloud push Hypriot/rpi/debian/jessie output/*/*.deb
else
echo "No release tag detected. Skip deployment."
fi
| #!/bin/bash -e
echo "$CIRCLE_TAG"
if [ "$CIRCLE_TAG" != "" ]; then
gem install package_cloud
package_cloud push Hypriot/rpi/debian/stretch output/*/raspberrypi-kernel*.deb
else
echo "No release tag detected. Skip deployment."
fi
|
Update dependencies for pbf_parser in travis configuration | sudo apt-get install -qq libgeos++-dev libproj-dev build-essential liblzo2-dev liblzma-dev zlib1g-dev libprotobuf-c0-dev postgresql-contrib-9.3 postgresql-9.3-postgis-2.1-scripts protobuf-c zlib
# Se placer dans le dossier /tmp
cd /tmp
# Installer kyotocabinet
wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
tar xzf kyotocabinet-1.2.76.tar.gz
cd kyotocabinet-1.2.76
./configure –enable-zlib –enable-lzo –enable-lzma --prefix=/usr && make
sudo make install
# Installer les bindings ruby pour kyotocabinet
cd /tmp
wget http://fallabs.com/kyotocabinet/rubypkg/kyotocabinet-ruby-1.32.tar.gz
tar xzf kyotocabinet-ruby-1.32.tar.gz
cd kyotocabinet-ruby-1.32
ruby extconf.rb
make
sudo make install
| sudo apt-get install -qq libgeos++-dev libproj-dev build-essential liblzo2-dev liblzma-dev zlib1g-dev libprotobuf-c0-dev postgresql-contrib-9.3 postgresql-9.3-postgis-2.1-scripts libprotobuf-c0 zlib1g
# Se placer dans le dossier /tmp
cd /tmp
# Installer kyotocabinet
wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
tar xzf kyotocabinet-1.2.76.tar.gz
cd kyotocabinet-1.2.76
./configure –enable-zlib –enable-lzo –enable-lzma --prefix=/usr && make
sudo make install
# Installer les bindings ruby pour kyotocabinet
cd /tmp
wget http://fallabs.com/kyotocabinet/rubypkg/kyotocabinet-ruby-1.32.tar.gz
tar xzf kyotocabinet-ruby-1.32.tar.gz
cd kyotocabinet-ruby-1.32
ruby extconf.rb
make
sudo make install
|
Update all build types to debug | #!/bin/bash
# This script will build the project.
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
./gradlew --stacktrace --debug build
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew --stacktrace --info -Prelease.travisci=true snapshot
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
case "$TRAVIS_TAG" in
*-rc\.*)
./gradlew --stacktrace --info -Prelease.travisci=true -Prelease.useLastTag=true candidate
;;
*)
./gradlew --stacktrace --info -Prelease.travisci=true -Prelease.useLastTag=true final publishPlugins
;;
esac
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew --stacktrace --info build
fi
| #!/bin/bash
# This script will build the project.
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Build Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
./gradlew --stacktrace --debug build
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew --stacktrace --debug -Prelease.travisci=true snapshot
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
case "$TRAVIS_TAG" in
*-rc\.*)
./gradlew --stacktrace --debug -Prelease.travisci=true -Prelease.useLastTag=true candidate
;;
*)
./gradlew --stacktrace --debug -Prelease.travisci=true -Prelease.useLastTag=true final publishPlugins
;;
esac
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew --stacktrace --debug build
fi
|
Address directory issues for code sniffer build. | #!/bin/bash
#
# The default FriendsOfCake/travis before_script.sh doesn't exclude
# the Plugin/$PLUGIN_NAME/vendor directory when it write out its
# phpunit.xml file. This script overwrites it.
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<phpunit>
<filter>
<whitelist>
<directory suffix=\".php\">Plugin/$PLUGIN_NAME</directory>
<exclude>
<directory suffix=\".php\">Plugin/$PLUGIN_NAME/Test</directory>
<directory suffix=\".php\">Plugin/$PLUGIN_NAME/vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>" > ../cakephp/app/phpunit.xml
| #!/bin/bash
#
# The default FriendsOfCake/travis before_script.sh doesn't exclude
# the Plugin/$PLUGIN_NAME/vendor directory when it write out its
# phpunit.xml file. This script overwrites it.
# Do nothing on code sniff builds.
if [ "$PHPCS" == 1 ]; then
exit 0
fi
# Write a phpunit.xml file to use.
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<phpunit>
<filter>
<whitelist>
<directory suffix=\".php\">Plugin/$PLUGIN_NAME</directory>
<exclude>
<directory suffix=\".php\">Plugin/$PLUGIN_NAME/Test</directory>
<directory suffix=\".php\">Plugin/$PLUGIN_NAME/vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>" > ../cakephp/app/phpunit.xml
|
Add google CSE env vars | #!/bin/sh
. ./env.cfg
docker run \
-e HUBOT_GROUPME_BOT_ID=${HUBOT_GROUPME_BOT_ID} \
-e HUBOT_GROUPME_TOKEN=${HUBOT_GROUPME_TOKEN} \
-e HUBOT_MUMBLE_URL=${HUBOT_MUMBLE_URL} \
-e HUBOT_MUMBLE_PASSWORD=${HUBOT_MUMBLE_PASSWORD} \
-e HUBOT_WOW_API_KEY=${HUBOT_WOW_API_KEY} \
-e HUBOT_FORECAST_API_KEY=${HUBOT_FORECAST_API_KEY} \
-d \
-p 8080:8080 \
donkeybot
| #!/bin/sh
. ./env.cfg
docker run \
-e HUBOT_GROUPME_BOT_ID=${HUBOT_GROUPME_BOT_ID} \
-e HUBOT_GROUPME_TOKEN=${HUBOT_GROUPME_TOKEN} \
-e HUBOT_MUMBLE_URL=${HUBOT_MUMBLE_URL} \
-e HUBOT_MUMBLE_PASSWORD=${HUBOT_MUMBLE_PASSWORD} \
-e HUBOT_WOW_API_KEY=${HUBOT_WOW_API_KEY} \
-e HUBOT_FORECAST_API_KEY=${HUBOT_FORECAST_API_KEY} \
-e HUBOT_GOOGLE_CSE_KEY=${HUBOT_GOOGLE_CSE_KEY} \
-e HUBOT_GOOGLE_CSE_ID=${HUBOT_GOOGLE_CSE_ID} \
-d \
-p 8080:8080 \
donkeybot
|
Remove unpermitted characters from session name | ts() {
[ -z "$1" ] && return
local session_path=""
case "$1" in
.)
session_path=$(pwd)
;;
*)
session_path="${1}"
esac
local session_name="${session_path##*/}"
if tmux has-session -t="${session_name}" 2> /dev/null; then
tmux attach -t "${session_name}"
return
fi
pushd "${session_path}" > /dev/null
tmux new-session -d -s "${session_name}"
tmux send-keys -t="${session_name}":1 'vim ' C-m
sleep 0.5
tmux split-window -t="${session_name}":1 -v
tmux resize-pane -t="${session_name}":1 -D 15
tmux select-pane -t="${session_name}":1.1
tmux new-window -t="${session_name}":2 -n 'log'
tmux new-window -t="${session_name}":3 -n 'misc'
tmux select-window -t="${session_name}":1
[ -n "$TMUX" ] && tmux switch -t="${session_name}" || tmux attach -t="${session_name}"
popd > /dev/null
}
| ts() {
[ -z "$1" ] && return
local session_path=""
case "$1" in
.)
session_path=$(pwd)
;;
*)
session_path="${1}"
esac
local raw_session_name="${session_path##*/}"
local session_name="${raw_session_name//[.]/-}"
if tmux has-session -t="${session_name}" 2> /dev/null; then
tmux attach -t "${session_name}"
return
fi
pushd "${session_path}" > /dev/null
tmux new-session -d -s "${session_name}"
tmux send-keys -t="${session_name}":1 'vim ' C-m
sleep 0.5
tmux split-window -t="${session_name}":1 -v
tmux resize-pane -t="${session_name}":1 -D 15
tmux select-pane -t="${session_name}":1.1
tmux new-window -t="${session_name}":2 -n 'log'
tmux new-window -t="${session_name}":3 -n 'misc'
tmux select-window -t="${session_name}":1
[ -n "$TMUX" ] && tmux switch -t="${session_name}" || tmux attach -t="${session_name}"
popd > /dev/null
}
|
Test changes to the Jython script. | #!/bin/bash
# This script runs the tests using Jython
if [ "$JYTHON" == "true" ]; then
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
pyenv install jython-2.7.0
mkdir ~/jython_test
cd ~/jython_test
pyenv local jython-2.7.0
python --version
pip install tox
tox -e jython
fi
| #!/bin/bash
# This script runs the tests using Jython
if [ "$JYTHON" == "true" ]; then
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
pyenv install pypy-2.5.0
mkdir ~/jython_test
cd ~/jython_test
pyenv global pypy-2.5.0
eval "$(pyenv init -)"
python --version
pip install tox
tox -e jython
fi
|
Change to correct check for MASTER_BUILD | set -x
# set environment variables
export COVERALLS_TOKEN=token
# start Postgres
service postgresql start
# create Postgres db and user
su -c "createuser test -d -s" -s /bin/sh postgres
su -c "createdb test" -s /bin/sh postgres
# start Cassandra and sleep to wait for it to start
service cassandra start
sleep 20
# create Cassandra keyspace
cqlsh -e "create keyspace test with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };"
# start Neo4j
service neo4j start
cd /tmp/ground/
# set Postgres and Cassandra schemas
cd ground-core/scripts/postgres && python2.7 postgres_setup.py test test && cd ../../..
cd ground-core/scripts/cassandra && python2.7 cassandra_setup.py test && cd ../../..
# run tests
mvn clean test
# generate the test coverage report and send it to Coveralls only if we're
# building on the master branch
if [ -z "$MASTER_BUILD" ]
then
mvn clean test jacoco:report coveralls:report -DrepoToken=$COVERALLS_TOKEN
fi
| # set environment variables
export COVERALLS_TOKEN=token
export MASTER_BUILD="false"
# start Postgres
service postgresql start
# create Postgres db and user
su -c "createuser test -d -s" -s /bin/sh postgres
su -c "createdb test" -s /bin/sh postgres
# start Cassandra and sleep to wait for it to start
service cassandra start
sleep 20
# create Cassandra keyspace
cqlsh -e "create keyspace test with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };"
# start Neo4j
service neo4j start
cd /tmp/ground/
# set Postgres and Cassandra schemas
cd ground-core/scripts/postgres && python2.7 postgres_setup.py test test && cd ../../..
cd ground-core/scripts/cassandra && python2.7 cassandra_setup.py test && cd ../../..
# run tests
mvn clean test
# generate the test coverage report and send it to Coveralls only if we're
# building on the master branch
if [[ $MASTER_BUILD = "true" ]]
then
mvn clean test jacoco:report coveralls:report -DrepoToken=$COVERALLS_TOKEN
fi
|
Format logs to integrate with Stackdriver Logging | #!/bin/bash
# Copyright 2018 Google Cloud Platform Proxy Authors
# 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
#
# https://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.
set -o errexit
set -o nounset
echo "Starting Proxy......"
CONFIGMANAGER=${CONFIGMANAGER:-apiproxy/configmanager}
ENVOY=${ENVOY:-apiproxy/envoy}
# Optional args for Envoy. Example, to set the logging level:
# docker run -e 'ENVOY_ARGS="-l debug"' ...
ENVOY_ARGS=${ENVOY_ARGS:-""}
${CONFIGMANAGER} $@ &
${ENVOY} -c ${BOOTSTRAP_FILE} --disable-hot-restart ${ENVOY_ARGS}
| #!/bin/bash
# Copyright 2018 Google Cloud Platform Proxy Authors
# 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
#
# https://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.
set -o errexit
set -o nounset
echo "Starting Proxy......"
CONFIGMANAGER=${CONFIGMANAGER:-apiproxy/configmanager}
ENVOY=${ENVOY:-apiproxy/envoy}
# Optional args for Envoy. Example, to set the logging level:
# docker run -e 'ENVOY_ARGS="-l debug"' ...
ENVOY_ARGS=${ENVOY_ARGS:-""}
${CONFIGMANAGER} $@ &
${ENVOY} -c ${BOOTSTRAP_FILE} --disable-hot-restart --log-format '%L%m%d %T.%e %t envoy] [%t][%n]%v' ${ENVOY_ARGS}
|
Use --raw-output to avoid extra quotes | #!/usr/bin/env bash
set -e
set -x
pip install -U pip setuptools
pip install -U tox
if [ $TOXENV = "h2spec" ]; then
# We want to get the latest release of h2spec. We do that by asking the
# Github API for it, and then parsing the JSON for the appropriate kind of
# binary. Happily, the binary is always called "h2spec" so we don't need
# even more shenanigans to get this to work.
TARBALL=$(curl -s https://api.github.com/repos/summerwind/h2spec/releases/latest | jq '.assets[] | .browser_download_url | select(endswith("linux_amd64.tar.gz"))')
curl -LO "$TARBALL"
tar xvf $TARBALL
mv h2spec /usr/local/bin
fi
| #!/usr/bin/env bash
set -e
set -x
pip install -U pip setuptools
pip install -U tox
if [ $TOXENV = "h2spec" ]; then
# We want to get the latest release of h2spec. We do that by asking the
# Github API for it, and then parsing the JSON for the appropriate kind of
# binary. Happily, the binary is always called "h2spec" so we don't need
# even more shenanigans to get this to work.
TARBALL=$(curl -s https://api.github.com/repos/summerwind/h2spec/releases/latest | jq --raw-output '.assets[] | .browser_download_url | select(endswith("linux_amd64.tar.gz"))')
curl -LO "$TARBALL"
tar xvf $TARBALL
mv h2spec /usr/local/bin
fi
|
Add zsh function to read formated text | clock() {
TIME="sed 's/\w\w:\w\w:\w\w:/\n/g'"
DRAW="figlet -Wcf new_asci -w $(tput cols)"
watch -tn 1 "detri $* | $TIME | $DRAW"
}
md() {
mkdir -p "$@" && cd "$@"
}
c() {
echo $(( $* ))
}
alias c="noglob c"
| clock() {
TIME="sed 's/\w\w:\w\w:\w\w:/\n/g'"
DRAW="figlet -Wcf new_asci -w $(tput cols)"
watch -tn 1 "detri $* | $TIME | $DRAW"
}
md() {
mkdir -p "$@" && cd "$@"
}
txt() {
fmt $1 | less
}
c() {
echo $(( $* ))
}
alias c="noglob c"
|
Add terraform-modules repo to mirror list | #!/bin/sh
repos="vim_cf3 cfbot nustuff delta_reporting evolve_cfengine_freelib"
for next_repo in $repos
do
echo ./gitmirror.py -g2b neilhwatson/$next_repo neilhwatson/$next_repo
./gitmirror.py -g2b neilhwatson/$next_repo neilhwatson/$next_repo
done
| #!/bin/sh
repos="vim_cf3 cfbot nustuff delta_reporting evolve_cfengine_freelib terraform-modules"
for next_repo in $repos
do
echo ./gitmirror.py -g2b neilhwatson/$next_repo neilhwatson/$next_repo
./gitmirror.py -g2b neilhwatson/$next_repo neilhwatson/$next_repo
done
|
Use index instead of variable | include command.validator.CommandValidator
include string.util.StringUtil
TestExecutor(){
executeTest(){
local classPath=${1}
local testClassArray=($(StringUtil split classPath [.]))
for (( i=0; i < ${#testClassArray[@]}; i++ )); do
testClassArray[${i}]=$(StringUtil capitalize ${testClassArray[i]})
done
local testClass=$(StringUtil join testClassArray)
local _tests=(
$(CommandValidator getValidFunctions bash-toolbox/$(StringUtil
replace classPath [.] /)/${testClass}.sh)
)
for _test in ${_tests[@]}; do
if [[ ${_test} != $(StringUtil
join testClass) && ${_test} != run ]]; then
if [[ $(${testClass} ${_test}) == FAIL ]]; then
echo ${testClass}\#${_test}
fi
fi
done
}
$@
} | include command.validator.CommandValidator
include string.util.StringUtil
TestExecutor(){
executeTest(){
local classPath=${1}
local testClassArray=($(StringUtil split classPath [.]))
for (( i=0; i < ${#testClassArray[@]}; i++ )); do
testClassArray[i]=$(StringUtil capitalize ${testClassArray[i]})
done
local testClass=$(StringUtil join testClassArray)
local _tests=(
$(CommandValidator getValidFunctions bash-toolbox/$(StringUtil
replace classPath [.] /)/${testClass}.sh)
)
for _test in ${_tests[@]}; do
if [[ ${_test} != $(StringUtil
join testClass) && ${_test} != run ]]; then
if [[ $(${testClass} ${_test}) == FAIL ]]; then
echo ${testClass}\#${_test}
fi
fi
done
}
$@
} |
Change to forever to recover from crashes automatically | #!/bin/sh
# This script launches the site on boot
# Change to node directory
cd /home/luke/api.lukemil.es/
# Start nodemon on 3000 (iptables corrects route to port 80)
NODE_ENV=production PORT=3000 nodemon
| #!/bin/sh
# This script launches the site on boot
# Change to node directory
cd /home/luke/api.lukemil.es/
# Start nodemon on 3000 (iptables corrects route to port 80)
NODE_ENV=production PORT=3000 forever bin/www -c |
Load another file for the ABC encoder (r+self) | # Translate .abc to .asm
#
# You must first build a tamarin executable and store it under the
# name "shell" (or "shell.exe") in the directory $DIR.
#
# usage:
# abcencode.sh <filename>
#
# abcencode.sh must be run from $DIR, or you must change the value of
# $DIR to be the absolute path of the bin directory (that has the
# shell and the abc files for ESC).
DIR=../bin
$DIR/shell \
$DIR/debug.es.abc \
$DIR/util.es.abc \
$DIR/bytes-tamarin.es.abc \
$DIR/util-tamarin.es.abc \
$DIR/asm.es.abc \
$DIR/abc.es.abc \
$DIR/abc-encode.es.abc \
$DIR/abc-parse.es.abc \
$DIR/abcenc.es.abc \
-- $@
| # Translate .abc to .asm
#
# You must first build a tamarin executable and store it under the
# name "shell" (or "shell.exe") in the directory $DIR.
#
# usage:
# abcencode.sh <filename>
#
# abcencode.sh must be run from $DIR, or you must change the value of
# $DIR to be the absolute path of the bin directory (that has the
# shell and the abc files for ESC).
DIR=../bin
$DIR/shell \
$DIR/debug.es.abc \
$DIR/util.es.abc \
$DIR/bytes-tamarin.es.abc \
$DIR/util-tamarin.es.abc \
$DIR/lex-token.es.abc \
$DIR/asm.es.abc \
$DIR/abc.es.abc \
$DIR/abc-encode.es.abc \
$DIR/abc-parse.es.abc \
$DIR/abcenc.es.abc \
-- $@
|
Save space by removing more npm install artifacts. | set -o errexit
set -o pipefail
if [[ $NODE_ENV == 'production' ]]; then
# Remove the c files we no longer need (the sqlite3 node module has a massive ~5M c file)
find . -name '*.c' -delete
# And the tar files (sqlite3 module again)
find . -name '*.tar.*' -delete
# Who needs tests and docs? Pffft! - Ignoring errors because find isn't a fan of us deleting directories whilst it's trying to search within them.
find . -type d -name 'test' -exec rm -rf '{}' \; 2> /dev/null || true
find . -type d -name 'doc' -exec rm -rf '{}' \; 2> /dev/null || true
find . -type d -name 'man' -exec rm -rf '{}' \; 2> /dev/null || true
# And any benchmark results (ttyjs->socket.io->socket.io-client->active-x-obfuscator->zeparser has an 8MB benchmark.html)
find . -type d -name 'benchmark*' -exec rm -rf '{}' \; 2> /dev/null || true
find . -name 'benchmark*' -delete
fi
| set -o errexit
set -o pipefail
if [[ $NODE_ENV == 'production' ]]; then
# Remove node-gyp cache
rm -rf ~/.node-gyp/
# Remove cached git deps
rm -rf /tmp/*
# Remove the c files we no longer need (the sqlite3 node module has a massive ~5M c file)
find . -name '*.c' -delete
# And the tar files (sqlite3 module again)
find . -name '*.tar.*' -delete
# Who needs tests and docs? Pffft! - Ignoring errors because find isn't a fan of us deleting directories whilst it's trying to search within them.
find . -type d -name 'test' -exec rm -rf '{}' \; 2> /dev/null || true
find . -type d -name 'doc' -exec rm -rf '{}' \; 2> /dev/null || true
find . -type d -name 'man' -exec rm -rf '{}' \; 2> /dev/null || true
# And any benchmark results (ttyjs->socket.io->socket.io-client->active-x-obfuscator->zeparser has an 8MB benchmark.html)
find . -type d -name 'benchmark*' -exec rm -rf '{}' \; 2> /dev/null || true
find . -name 'benchmark*' -delete
fi
|
Set correct docker hub user name | #/bin/bash
ttmp32gmeStorage=/var/lib/ttmp32gme
mkdir -p ${ttmp32gmeStorage}
docker run -d \
--publish 8080:8080 \
--volume ${ttmp32gmeStorage}:/var/lib/ttmp32gme \
--device /dev/disk/by-label/tiptoi:/dev/disk/by-label/tiptoi \
--security-opt apparmor:unconfined --cap-add SYS_ADMIN \
--name ttmp32gme \
fabian/ttmp32gme:latest | #/bin/bash
ttmp32gmeStorage=/var/lib/ttmp32gme
mkdir -p ${ttmp32gmeStorage}
docker run -d \
--publish 8080:8080 \
--volume ${ttmp32gmeStorage}:/var/lib/ttmp32gme \
--device /dev/disk/by-label/tiptoi:/dev/disk/by-label/tiptoi \
--security-opt apparmor:unconfined --cap-add SYS_ADMIN \
--name ttmp32gme \
fabmay/ttmp32gme:latest |
Revert "Change path to use STAR 2.4.1a" | #!/bin/bash
#
#SBATCH --job-name=GGR_RNA-seq
#SBATCH --output=ggr-rna-seq.out
#SBATCH --mail-user=dan.leehr@duke.edu
#SBATCH --mail-type=FAIL
source ~/env-cwl/bin/activate
export PATH="/data/reddylab/software/FastQC:/home/dcl9/bin:/usr/local/bin:/data/reddylab/software/STAR-STAR_2.4.1a/bin/Linux_x86_64_static:$PATH"
srun cwltool --debug --preserve-environment PATH --outdir ~/ggr-cwl-data --no-container ~/ggr-cwl/ggr-rna-seq.cwl ~/ggr-cwl/rna-seq-hardac.json
| #!/bin/bash
#
#SBATCH --job-name=GGR_RNA-seq
#SBATCH --output=ggr-rna-seq.out
#SBATCH --mail-user=dan.leehr@duke.edu
#SBATCH --mail-type=FAIL
source ~/env-cwl/bin/activate
export PATH="/data/reddylab/software/FastQC:/home/dcl9/bin:/usr/local/bin:/data/reddylab/software/STAR_2.4.2a/STAR-STAR_2.4.2a/bin/Linux_x86_64_static:$PATH"
srun cwltool --debug --preserve-environment PATH --outdir ~/ggr-cwl-data --no-container ~/ggr-cwl/ggr-rna-seq.cwl ~/ggr-cwl/rna-seq-hardac.json
|
Fix typo to test Travis | #!/usr/bin/env bash
set -e
npm install
npm run build
# start db server
--dbpath /usr/local/var/mongodb/
# migrate dbs
mongo birdAPI ./migration/mongo.provision.js
| #!/usr/bin/env bash
set -e
npm install
npm run build
# start db server
mongod --dbpath /usr/local/var/mongodb/
# migrate dbs
mongo birdAPI ./migration/mongo.provision.js
|
Add travis test for generation into addon | #!/bin/sh
# Prerequisites:
# - ember-cli
set -ev
# Create temp directory for new ember app.
ADDON_DIR="$PWD"
META_DIR="$PWD/vendor/flexberry/dummy-metadata"
TMP_DIR='/tmp/embertest'
mkdir -p "$TMP_DIR"
rm -rf "$TMP_DIR/*"
pushd "$TMP_DIR"
# Initialize new ember app and install addon from the build.
# EmberCLI asks whether it needs to overwrite existing files,
# so we need to remove them for non-interactive build.
ember init
cp app/index.html .
rm -r app/*
mv index.html app
ember install "${ADDON_DIR}"
#npm install dexie@1.3.6
rm -f ./ember-cli-build.js
cp "${ADDON_DIR}/vendor/flexberry/ember-cli-build.js" .
rm -f ./.jscsrc
# Generate components using Dummy metamodel and test them.
ember generate flexberry-application app --metadata-dir=${META_DIR}
#ember build
ember test
# Cleanup.
popd
rm -rf "$TMP_DIR"
| #!/bin/sh
# Prerequisites:
# - ember-cli
set -ev
# Create temp directory for new ember app.
ADDON_DIR="$PWD"
META_DIR="$PWD/vendor/flexberry/dummy-metadata"
TMP_DIR='/tmp/embertest'
mkdir -p "$TMP_DIR"
rm -rf "$TMP_DIR/*"
pushd "$TMP_DIR"
# Initialize new ember app and install addon from the build.
# EmberCLI asks whether it needs to overwrite existing files,
# so we need to remove them for non-interactive build.
ember init
cp app/index.html .
rm -r app/*
mv index.html app
ember install "${ADDON_DIR}"
#npm install dexie@1.3.6
rm -f ./ember-cli-build.js
cp "${ADDON_DIR}/vendor/flexberry/ember-cli-build.js" .
rm -f ./.jscsrc
# Generate components using Dummy metamodel and test them.
ember generate flexberry-application app --metadata-dir=${META_DIR}
#ember build
ember test
# Cleanup.
popd
rm -rf "$TMP_DIR"
# Initialize new ember addon and install ember-flexberry.
mkdir -p "$TMP_DIR"
rm -rf "$TMP_DIR/*"
pushd "$TMP_DIR"
ember addon new-addon-for-tests
pushd new-addon-for-tests
ember install "${ADDON_DIR}"
rm -f ./ember-cli-build.js
cp "${ADDON_DIR}/vendor/flexberry/ember-cli-build.js" .
rm -f ./.jscsrc
# Generate components using Dummy metamodel and test them.
ember generate flexberry-application app --metadata-dir=${META_DIR}
ember test
# Cleanup.
popd
popd
rm -rf "$TMP_DIR"
|
Switch back to the notebook master | #!/bin/bash
set -ex
npm install
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
conda install pip pyzmq
# Install the latest version of the notebook
pip install --pre notebook
# Create jupyter base dir (needed for config retrieval).
mkdir ~/.jupyter
| #!/bin/bash
set -ex
npm install
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
conda install pip pyzmq
# Install the development version of the notebook
git clone https://github.com/jupyter/notebook
cd notebook
pip install --pre -e .
# Create jupyter base dir (needed for config retrieval).
mkdir ~/.jupyter
|
Destroy vagrant VMs before starting | #!/usr/bin/env bash
__usage() { echo "Usage: ${0}:"; echo " ${0} <all|project [project] ...>"; exit 1; };
if [[ ${LOOM_BUILD_PROJECTS} ]]; then
echo "Building ${LOOM_BUILD_PROJECTS}"
elif [[ ${#} -eq 1 ]] && [[ ${1} == 'all' ]]; then
echo "Building all"
elif [[ ${#} -ge 1 ]]; then
echo "Building ${*}"
LOOM_BUILD_PROJECTS=${*}
else
__usage
fi
exec vagrant up
| #!/usr/bin/env bash
__usage() { echo "Usage: ${0}:"; echo " ${0} <all|project [project] ...>"; exit 1; };
vagrant destroy -f
if [[ ${LOOM_BUILD_PROJECTS} ]]; then
echo "Building ${LOOM_BUILD_PROJECTS}"
elif [[ ${#} -eq 1 ]] && [[ ${1} == 'all' ]]; then
echo "Building all"
elif [[ ${#} -ge 1 ]]; then
echo "Building ${*}"
LOOM_BUILD_PROJECTS=${*}
else
__usage
fi
exec vagrant up
|
Remove code, not comment it out | # Get a random quote fron the site http://www.quotationspage.com/random.php3
# Created by Eduardo San Martin Morote aka Posva
# http://posva.github.io
# Sun Jun 09 10:59:36 CEST 2013
# Don't remove this header, thank you
# Usage: quote
WHO_COLOR="\e[0;33m"
TEXT_COLOR="\e[0;35m"
COLON_COLOR="\e[0;35m"
END_COLOR="\e[m"
if [[ -x `which curl` ]]; then
function quote()
{
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
if [ "$W" -a "$TXT" ]; then
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}"
# else
# quote
fi
}
#quote
else
echo "rand-quote plugin needs curl to work" >&2
fi
| # Get a random quote fron the site http://www.quotationspage.com/random.php3
# Created by Eduardo San Martin Morote aka Posva
# http://posva.github.io
# Sun Jun 09 10:59:36 CEST 2013
# Don't remove this header, thank you
# Usage: quote
WHO_COLOR="\e[0;33m"
TEXT_COLOR="\e[0;35m"
COLON_COLOR="\e[0;35m"
END_COLOR="\e[m"
if [[ -x `which curl` ]]; then
function quote()
{
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
if [ "$W" -a "$TXT" ]; then
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}“${TXT}”${END_COLOR}"
fi
}
#quote
else
echo "rand-quote plugin needs curl to work" >&2
fi
|
Increase max heap size for Maven | #!/bin/bash
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
set -e
SOURCE_DIR=/source
NUM_THREADS=4
cd "${SOURCE_DIR}"
export MAVEN_OPTS="-Xms128m -Xmx512m"
source /etc/profile.d/devtoolset-6.sh || true
sh ./bootstrap.sh java
mvn install -nsu -B -T ${NUM_THREADS} -V # Should ideally split out test phase, but some unit tests fails on 'mvn test'
| #!/bin/bash
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
set -e
SOURCE_DIR=/source
NUM_THREADS=4
cd "${SOURCE_DIR}"
export MAVEN_OPTS="-Xms128m -Xmx1g"
source /etc/profile.d/devtoolset-6.sh || true
sh ./bootstrap.sh java
mvn install -nsu -B -T ${NUM_THREADS} -V # Should ideally split out test phase, but some unit tests fails on 'mvn test'
|
Add a sql statement for create player table | mysql -uroot -p <<END
create database gdydb;
use gdydb;
create table player(id int, name text, nickname text);
END
| mysql -uroot -p <<END
/*create database gdydb;*/
use gdydb;
create table player(
id int,
name text,
nickname text,
description text,
sex text,
money int,
lastLoginTime datetime,
lastLogoutTime datetime,
loginTimes int,
level int,
blocked int
);
END
|
Add function to backup file | function brew_install() {
quiet=false
while getopts ":q" opt
do
case $opt in
q)
quiet=true
;;
? )
echo "Unrecognized argument"
echo "Usage: brew_install -q package_name"
return 1
;;
esac
done
shift "$((OPTIND-1))"
if [ -z "$1" ]; then
echo "Usage: brew_install [-q] package_name"
fi
if [[ ! -e /usr/local/bin/$1 ]]; then
if [ "$quiet" = false ]; then
echo "Installing $1"
fi
brew install $1
else
if [ "$quiet" = false ]; then
echo "You have installed $1"
fi
fi
}
| function brew_install() {
quiet=false
while getopts ":q" opt
do
case $opt in
q)
quiet=true
;;
? )
echo "Unrecognized argument"
echo "Usage: brew_install -q package_name"
return 1
;;
esac
done
shift "$((OPTIND-1))"
if [ -z "$1" ]; then
echo "Usage: brew_install [-q] package_name"
fi
if [[ ! -e /usr/local/bin/$1 ]]; then
if [ "$quiet" = false ]; then
echo "Installing $1"
fi
brew install $1
else
if [ "$quiet" = false ]; then
echo "You have installed $1"
fi
fi
}
# Usage: mv $1 to $1_backup
function backup_file() {
if [ $# != 1 ]; then
echo "Usage: backup_file pat_to_file"
fi
if [[ -e $1 ]]; then
mv $1 $1"_backup"
fi
}
|
Correct file names for compression | #!/bin/sh
OUT_DIR=$1
DEBUG=$2
# Change into script's own dir
cd $(dirname $0)
DT_SRC=$(dirname $(dirname $(pwd)))
DT_BUILT="${DT_SRC}/built/DataTables"
. $DT_SRC/build/include.sh
# Copy CSS
rsync -r css $OUT_DIR
css_compress $OUT_DIR/css/dataTables.fixedColumns.css
# Copy JS
rsync -r js $OUT_DIR
js_compress $OUT_DIR/js/dataTables.fixedColumns.js
# Copy and build examples
rsync -r examples $OUT_DIR
examples_process $OUT_DIR
| #!/bin/sh
OUT_DIR=$1
DEBUG=$2
# Change into script's own dir
cd $(dirname $0)
DT_SRC=$(dirname $(dirname $(pwd)))
DT_BUILT="${DT_SRC}/built/DataTables"
. $DT_SRC/build/include.sh
# Copy CSS
rsync -r css $OUT_DIR
css_compress $OUT_DIR/css/dataTables.fixedHeader.css
# Copy JS
rsync -r js $OUT_DIR
js_compress $OUT_DIR/js/dataTables.fixedHeader.js
# Copy and build examples
rsync -r examples $OUT_DIR
examples_process $OUT_DIR
|
Use correct dylib extension for local os | cargo build || exit 1
cd examples/
RUSTC="rustc -Zcodegen-backend=$(pwd)/../target/debug/librustc_codegen_cranelift.so -L crate=. --crate-type lib"
$RUSTC mini_core.rs --crate-name mini_core &&
$RUSTC example.rs &&
$RUSTC mini_core_hello_world.rs &&
$RUSTC ../target/libcore/src/libcore/lib.rs &&
rm *.rlib
| cargo build || exit 1
cd examples/
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
dylib_ext='so'
elif [[ "$unamestr" == 'Darwin' ]]; then
dylib_ext='dylib'
else
echo "Unsupported os"
exit 1
fi
RUSTC="rustc -Zcodegen-backend=$(pwd)/../target/debug/librustc_codegen_cranelift.$dylib_ext -L crate=. --crate-type lib"
$RUSTC mini_core.rs --crate-name mini_core &&
$RUSTC example.rs &&
$RUSTC mini_core_hello_world.rs &&
$RUSTC ../target/libcore/src/libcore/lib.rs &&
rm *.rlib
|
Set HTTPS param correctly behind proxies | #!/bin/bash -ex
# Create user for Nginx & PHP with uid 1000 to make life easier for volume mounting
addgroup -g 1000 -S edge
adduser -u 1000 -DS -h /var/www -s /sbin/nologin -g edge -G edge edge
# Replace sendmail with msmtp
ln -sf /usr/bin/msmtp /usr/sbin/sendmail
# Use host as SERVER_NAME
sed -i "s/server_name/host/" /etc/nginx/fastcgi_params
sed -i "s/server_name/host/" /etc/nginx/fastcgi.conf
apk add --no-cache --virtual .build-deps \
py-pip \
php7-dev
# Install shinto-cli
pip install --no-cache-dir shinto-cli
# Download ioncube loaders
SV=(${PHP_VERSION//./ })
IONCUBE_VERSION="${SV[0]}.${SV[1]}"
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O - | tar -zxf - -C /tmp
cp /tmp/ioncube/ioncube_loader_lin_$IONCUBE_VERSION.so $(php-config --extension-dir)/ioncube.so
# Cleanup
apk del .build-deps
rm -rf /tmp/* | #!/bin/bash -ex
# Create user for Nginx & PHP with uid 1000 to make life easier for volume mounting
addgroup -g 1000 -S edge
adduser -u 1000 -DS -h /var/www -s /sbin/nologin -g edge -G edge edge
# Replace sendmail with msmtp
ln -sf /usr/bin/msmtp /usr/sbin/sendmail
# Use host as SERVER_NAME
sed -i "s/server_name/host/" /etc/nginx/fastcgi_params
sed -i "s/server_name/host/" /etc/nginx/fastcgi.conf
# Set HTTPS according to forwarded protocol
sed -i "s/https/fe_https/" /etc/nginx/fastcgi_params
sed -i "s/https/fe_https/" /etc/nginx/fastcgi.conf
apk add --no-cache --virtual .build-deps \
py-pip \
php7-dev
# Install shinto-cli
pip install --no-cache-dir shinto-cli
# Download ioncube loaders
SV=(${PHP_VERSION//./ })
IONCUBE_VERSION="${SV[0]}.${SV[1]}"
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz -O - | tar -zxf - -C /tmp
cp /tmp/ioncube/ioncube_loader_lin_$IONCUBE_VERSION.so $(php-config --extension-dir)/ioncube.so
# Cleanup
apk del .build-deps
rm -rf /tmp/*
|
Add cozy/echo to forbidden packages | #!/usr/bin/env bash
go build
./cozy-stack serve &
sleep 5
./cozy-stack instances add --dev --passphrase cozytest localhost:8080
export CLIENT_ID=$(./cozy-stack instances client-oauth localhost:8080 http://localhost/ test github.com/cozy/cozy-stack/integration)
export TEST_TOKEN=$(./cozy-stack instances token-oauth localhost:8080 $CLIENT_ID io.cozy.pouchtestobject)
cd tests/pouchdb-integration
npm install && npm run test
testresult=$?
cd ../..
./scripts/build.sh assets
assetsresult=$?
pidstack=$(jobs -pr)
[ -n "$pidstack" ] && kill -9 "$pidstack"
if git grep -l -e 'github.com/labstack/gommon/log' -e 'github.com/dgrijalva/jwt-go' -- '*.go'; then
echo "Forbidden packages"
exit 1
fi
if [ $testresult -gt 0 ]; then
echo "Bad tests"
exit $testresult
fi
if [ $assetsresult -gt 0 ]; then
echo "Bad assets"
exit $assetsresult
fi
| #!/usr/bin/env bash
go build
./cozy-stack serve &
sleep 5
./cozy-stack instances add --dev --passphrase cozytest localhost:8080
export CLIENT_ID=$(./cozy-stack instances client-oauth localhost:8080 http://localhost/ test github.com/cozy/cozy-stack/integration)
export TEST_TOKEN=$(./cozy-stack instances token-oauth localhost:8080 $CLIENT_ID io.cozy.pouchtestobject)
cd tests/pouchdb-integration
npm install && npm run test
testresult=$?
cd ../..
./scripts/build.sh assets
assetsresult=$?
pidstack=$(jobs -pr)
[ -n "$pidstack" ] && kill -9 "$pidstack"
if git grep -l \
-e 'github.com/labstack/gommon/log' \
-e 'github.com/dgrijalva/jwt-go' \
-e 'github.com/cozy/echo' \
-- '*.go'; then
echo "Forbidden packages"
exit 1
fi
if [ $testresult -gt 0 ]; then
echo "Bad tests"
exit $testresult
fi
if [ $assetsresult -gt 0 ]; then
echo "Bad assets"
exit $assetsresult
fi
|
Update the value for the Running image to the same used in other images | #!/bin/sh
# Openshift BPMS Smart Router launch script
if [ "${SCRIPT_DEBUG}" = "true" ] ; then
set -x
echo "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed"
fi
CONFIGURE_SCRIPTS=(
/opt/${JBOSS_PRODUCT}/launch/bpmsuite-smartrouter.sh
)
source /opt/${JBOSS_PRODUCT}/launch/configure.sh
echo "Running $JBOSS_PRODUCT image, version $PRODUCT_VERSION"
if [ -n "$CLI_GRACEFUL_SHUTDOWN" ] ; then
trap "" TERM
echo "Using CLI Graceful Shutdown instead of TERM signal"
fi
exec ${JAVA_HOME}/bin/java ${JBOSS_BPMSUITE_ARGS} -jar /opt/${JBOSS_PRODUCT}/${KIE_ROUTER_DISTRIBUTION_JAR}
| #!/bin/sh
# Openshift BPMS Smart Router launch script
if [ "${SCRIPT_DEBUG}" = "true" ] ; then
set -x
echo "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed"
fi
CONFIGURE_SCRIPTS=(
/opt/${JBOSS_PRODUCT}/launch/bpmsuite-smartrouter.sh
)
source /opt/${JBOSS_PRODUCT}/launch/configure.sh
echo "Running $JBOSS_IMAGE_NAME image, version $PRODUCT_VERSION"
if [ -n "$CLI_GRACEFUL_SHUTDOWN" ] ; then
trap "" TERM
echo "Using CLI Graceful Shutdown instead of TERM signal"
fi
exec ${JAVA_HOME}/bin/java ${JBOSS_BPMSUITE_ARGS} -jar /opt/${JBOSS_PRODUCT}/${KIE_ROUTER_DISTRIBUTION_JAR}
|
Increase the Zsh history size significantly | # The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 2
zstyle ':completion:*' prompt '# of errors: %e'
zstyle ':completion:*' substitute 1
zstyle :compinstall filename '/Users/franklinyu/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.cache/zsh/history
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory
bindkey -e
# End of lines configured by zsh-newuser-install
source ~/.config/zsh/config.zsh
| # The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 2
zstyle ':completion:*' prompt '# of errors: %e'
zstyle ':completion:*' substitute 1
zstyle :compinstall filename '/Users/franklinyu/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.cache/zsh/history
HISTSIZE=10000
SAVEHIST=1000000
setopt appendhistory
bindkey -e
# End of lines configured by zsh-newuser-install
# NOTE: don't edit this file manually; instead, use
#
# autoload -Uz zsh-newuser-install && zsh-newuser-install -f
source ~/.config/zsh/config.zsh
|
Revert "travis: try to run only sharding tests" | #!/bin/sh
set -e
prefix=/tmp/local
case "${BUILD_TOOL}" in
autotools)
test/unit/run-test.sh
test/command/run-test.sh test/command/suite/sharding
if [ "${ENABLE_MRUBY}" = "yes" ]; then
test/query_optimizer/run-test.rb
fi
test/command/run-test.sh --interface http
mkdir -p ${prefix}/var/log/groonga/httpd
test/command/run-test.sh --testee groonga-httpd
;;
cmake)
test/command/run-test.sh
;;
esac
| #!/bin/sh
set -e
prefix=/tmp/local
case "${BUILD_TOOL}" in
autotools)
test/unit/run-test.sh
test/command/run-test.sh
if [ "${ENABLE_MRUBY}" = "yes" ]; then
test/query_optimizer/run-test.rb
fi
test/command/run-test.sh --interface http
mkdir -p ${prefix}/var/log/groonga/httpd
test/command/run-test.sh --testee groonga-httpd
;;
cmake)
test/command/run-test.sh
;;
esac
|
Fix start up script to get correctly added to rc.local | #!/usr/bin/env bash
### setup.sh - Common setup.
# Current Working Directory.
readonly CWD=$(cd $(dirname $0); pwd)
# OS Upgrade
sudo apt-get update && sudo apt-get upgrade -y
# Install the packages that we may need:
apt-get update && \
apt-get --yes install wget unzip mc ntpdate binutils chromium-browser unclutter ttf-mscorefonts-installer festival festvox-kallpc16k
# Update Pi
rpi-update
# Update time, to prevent update problems
ntpdate -u pool.ntp.org
# Let's setup speech using festival, just for fun!
sed -i 's/printf "My IP address is %s\n" "$_IP"/printf "My IP address is %s\n" "$_IP" | festival --tts' /etc/rc.local
# Setup Startup script.
grep "$CWD/startup.sh" /etc/rc.local || sed -i -e '$i \sh $CWD/startup.sh &\n' /etc/rc.local
chmod +x $0
#EOF | #!/usr/bin/env bash
### setup.sh - Common setup.
# Current Working Directory.
readonly CWD=$(cd $(dirname $0); pwd)
# OS Upgrade
sudo apt-get update && sudo apt-get upgrade -y
# Install the packages that we may need:
apt-get update && \
apt-get --yes install wget unzip mc ntpdate binutils chromium-browser unclutter ttf-mscorefonts-installer festival festvox-kallpc16k
# Update Pi
rpi-update
# Update time, to prevent update problems
ntpdate -u pool.ntp.org
# Let's setup speech using festival, just for fun!
grep 'festival' /etc/rc.local || sed -i 's/printf "My IP address is %s\n" "$_IP"/printf "My IP address is %s\n" "$_IP" | festival --tts' /etc/rc.local
# Setup Startup script.
grep "$CWD/startup.sh" /etc/rc.local || sudo sed -i -e '$i \sh '$CWD'/startup.sh &\n' /etc/rc.local
chmod +x "$CWD/startup.sh"
#EOF |
Fix bug where we would access $1 when it doesn't exist | # include this file in your .bashrc/.zshrc with source "emacs-pipe.sh"
# The emacs or emacsclient to use
function _emacsfun
{
# Replace with `emacs` to not run as server/client
emacsclient -c -n $@
}
# An emacs 'alias' with the ability to read from stdin
function e
{
# If the argument is - then write stdin to a tempfile and open the
# tempfile.
if [[ $1 == - ]]; then
tempfile=$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)
cat - > $tempfile
_emacsfun -e "(progn (find-file \"$tempfile\")
(set-visited-file-name nil)
(rename-buffer \"*stdin*\" t))
" 2>&1 > /dev/null
else
_emacsfun "$@"
fi
}
| # include this file in your .bashrc/.zshrc with source "emacs-pipe.sh"
# The emacs or emacsclient to use
function _emacsfun
{
# Replace with `emacs` to not run as server/client
emacsclient -c -n $@
}
# An emacs 'alias' with the ability to read from stdin
function e
{
# If the argument is - then write stdin to a tempfile and open the
# tempfile.
if [[ $# -ge 1 ]] && [[ $1 == - ]]; then
tempfile=$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)
cat - > $tempfile
_emacsfun -e "(progn (find-file \"$tempfile\")
(set-visited-file-name nil)
(rename-buffer \"*stdin*\" t))
" 2>&1 > /dev/null
else
_emacsfun "$@"
fi
}
|
Update cahce pruning script with new binary | #!/bin/bash
set -e
echo "Initial cache size:"
du -hs target/debug
crate_name="cargo-registry"
test_name="all"
bin_names="delete-crate delete-version populate render-readmes server test-pagerduty transfer-crates update-downloads background-worker monitor"
normalized_crate_name=${crate_name//-/_}
rm -v target/debug/$normalized_crate_name-*
rm -v target/debug/deps/$normalized_crate_name-*
rm -v target/debug/deps/lib$normalized_crate_name-*
normalized_test_name=${test_name//-/_}
rm -v target/debug/$normalized_test_name-*
rm -v target/debug/deps/$normalized_test_name-*
for name in $bin_names; do
rm -v target/debug/$name
normalized=${name//-/_}
rm -v target/debug/$normalized-*
rm -v target/debug/deps/$normalized-*
done
echo "Final cache size:"
du -hs target/debug
| #!/bin/bash
set -e
echo "Initial cache size:"
du -hs target/debug
crate_name="cargo-registry"
test_name="all"
bin_names="background-worker delete-crate delete-version enqueue-job monitor populate render-readmes server test-pagerduty transfer-crates"
normalized_crate_name=${crate_name//-/_}
rm -v target/debug/$normalized_crate_name-*
rm -v target/debug/deps/$normalized_crate_name-*
rm -v target/debug/deps/lib$normalized_crate_name-*
normalized_test_name=${test_name//-/_}
rm -v target/debug/$normalized_test_name-*
rm -v target/debug/deps/$normalized_test_name-*
for name in $bin_names; do
rm -v target/debug/$name
normalized=${name//-/_}
rm -v target/debug/$normalized-*
rm -v target/debug/deps/$normalized-*
done
echo "Final cache size:"
du -hs target/debug
|
Revert "this breaks ssh logins" | #!/usr/bin/env bash
true
| #!/usr/bin/env bash
if ! grep -s /etc/network/interfaces.d /etc/network/interfaces; then
{
echo
echo 'source-directory /etc/network/interfaces.d'
} | tee -a /etc/network/interfaces
fi
|
Change MinGW build to use lrint. | #!/bin/sh
python c:/utah/opt/Python27/Scripts/scons.py custom=custom-mingw.py buildLuaWrapper=1 buildPythonWrapper=1 usePortMIDI=1 useJack=0 buildCsoundVST=1 buildvst4cs=1 buildInterfaces=1 buildCsoundAC=1 buildJavaWrapper=1 useOSC=1 buildPythonOpcodes=1 buildLuaOpcodes=1 buildLoris=0 buildStkOpcodes=1 buildWinsound=1 noFLTKThreads=0 buildPDClass=1 buildVirtual=1 buildTclcsound=1 tclversion=85 buildLua=1 useDouble=1 dynamicCsoundLibrary=1 buildCSEditor=1 gcc4opt=core2 buildRelease=1 bufferoverflowu=0 noDebug=0 useOpenMP=1 buildMultiCore=1 install=1 $1 $2 $3 $4
# doxygen
| #!/bin/sh
python c:/utah/opt/Python27/Scripts/scons.py custom=custom-mingw.py useLrint=1 buildLuaWrapper=1 buildPythonWrapper=1 usePortMIDI=1 useJack=0 buildCsoundVST=1 buildvst4cs=1 buildInterfaces=1 buildCsoundAC=1 buildJavaWrapper=1 useOSC=1 buildPythonOpcodes=1 buildLuaOpcodes=1 buildLoris=0 buildStkOpcodes=1 buildWinsound=1 noFLTKThreads=0 buildPDClass=1 buildVirtual=1 buildTclcsound=1 tclversion=85 buildLua=1 useDouble=1 dynamicCsoundLibrary=1 buildCSEditor=1 gcc4opt=core2 buildRelease=1 bufferoverflowu=0 noDebug=0 useOpenMP=1 buildMultiCore=1 install=1 $1 $2 $3 $4
# doxygen
|
Disable caching in the http server | #!/bin/bash
port=60923
scriptDir=`pwd`"/"`dirname $0`
rootDir="${scriptDir}/../viz_templates/"
process=`ps | grep http-server | grep -v grep | cut -d ' ' -f 1`
if [ -z $process ]; then
echo "Web server is not started starting it with rootDir: ${rootDir}"
node node_modules/http-server/bin/http-server ${rootDir} -p $port &
else
echo "Web server is already started pid:${process}, Using the same web server."
fi | #!/bin/bash
port=60923
scriptDir=`pwd`"/"`dirname $0`
rootDir="${scriptDir}/../viz_templates/"
process=`ps | grep http-server | grep -v grep | cut -d ' ' -f 1`
if [ -z $process ]; then
echo "Web server is not started starting it with rootDir: ${rootDir}"
node node_modules/http-server/bin/http-server ${rootDir} -p $port -c-1 &
else
echo "Web server is already started pid:${process}, Using the same web server."
fi |
Improve the script to generate documentation using Sphinx | #!/bin/sh
#
# Create sphinx api docs.
# lazily slapped together, will come back to improve
rm -rf build
sphinx-apidoc -f -o . ../hypatia
sphinx-build . build
firefox build/index.html
| #!/bin/sh
#
# Create API documentation using Sphinx:
#
# http://sphinx-doc.org/
#
# If the $BROWSER environment variable is set then the script will use
# that to open the documentation locally. If the variable does not
# exist then the script falls back to using Firefox.
#
######################################################################
BROWSER="${BROWSER:=firefox}"
# Delete existing documentation. First, however, we change to the
# `docs/` directory. Ninety-nine percent of the time we will already
# be in that directory when running this script. But there are two
# `build/` directories: on at the top level and one as a sub-directory
# of `docs/`, thus we change directories to be sure we delete the
# correct `build/` directory.
cd "$(git rev-parse --show-toplevel)/docs"
if [ -d "./build" ]; then
rm ./build -rf
fi
# Build the documentation.
sphinx-apidoc -f -o . ../hypatia
sphinx-build . build
# Open locally if the build worked. We give a full `file://` URI to
# our browser because some browsers will incorrectly interpret it as a
# URL such as `http://build/index.html`, which can also happen (less
# likely) depending on local DNS settings. Using a `file://` URI
# avoids both of these problems.
if [ -e "./build/index.html" ]; then
"$BROWSER" "file://$(git rev-parse --show-toplevel)/build/index.html"
fi
|
Update to build-tools-23.0.2 in Travis | #!/bin/bash
set -x
export ANDROID_TOOL=${ANDROID_HOME}/tools/android
# Because we cache ANDROID_HOME in Travis, we cannot test for the existence of
# the directory; it always gets created before we run. Instead, check for the
# tool we care about, and if it doesn't exist, download the SDK.
if [ ! -x ${ANDROID_TOOL} ]; then
wget http://dl.google.com/android/android-sdk_r23-linux.tgz
tar -zxf android-sdk_r23-linux.tgz
rm android-sdk_r23-linux.tgz
rm -rf ${ANDROID_HOME}
mv android-sdk-linux ${ANDROID_HOME}
fi
# We always update the SDK, even if it is cached, in case we change the
# versions of things we care about.
# Values from `android list sdk --extended --all`
(while :
do
echo y
sleep 2
done) | ${ANDROID_TOOL} update sdk \
--force \
--no-ui \
--all \
--filter \
tools,\
platform-tools,\
build-tools-23.0.1,\
android-23,\
addon-google_apis-google-23,\
android-21,\
addon-google_apis-google-21,\
extra-android-support
| #!/bin/bash
set -x
export ANDROID_TOOL=${ANDROID_HOME}/tools/android
# Because we cache ANDROID_HOME in Travis, we cannot test for the existence of
# the directory; it always gets created before we run. Instead, check for the
# tool we care about, and if it doesn't exist, download the SDK.
if [ ! -x ${ANDROID_TOOL} ]; then
wget http://dl.google.com/android/android-sdk_r23-linux.tgz
tar -zxf android-sdk_r23-linux.tgz
rm android-sdk_r23-linux.tgz
rm -rf ${ANDROID_HOME}
mv android-sdk-linux ${ANDROID_HOME}
fi
# We always update the SDK, even if it is cached, in case we change the
# versions of things we care about.
# Values from `android list sdk --extended --all`
(while :
do
echo y
sleep 2
done) | ${ANDROID_TOOL} update sdk \
--force \
--no-ui \
--all \
--filter \
tools,\
platform-tools,\
build-tools-23.0.2,\
android-23,\
addon-google_apis-google-23,\
android-21,\
addon-google_apis-google-21,\
extra-android-support
|
Make sure Puppeteer looks for the installed Chromium | #!/bin/sh
# Disable access control for the current user
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager
export _JAVA_AWT_WM_NONREPARENTING=1
# Start authentication daemons
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpg-connect-agent /bye
# Make Flatpak apps visible to launcher
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
# Start Xfce's settings manager
xfsettingsd &
# Start Shepherd to manage user daemons
shepherd
# Enable screen compositing
compton &
# Turn off the system bell
xset -b
# Load system tray apps
nm-applet &
QSyncthingTray &
# Enable screen locking on suspend
xss-lock -- slock &
# We're in Emacs, yo
export VISUAL=emacsclient
export EDITOR="$VISUAL"
# Fire it up
exec dbus-launch --exit-with-session emacs -mm --use-exwm
| #!/bin/sh
# Disable access control for the current user
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager
export _JAVA_AWT_WM_NONREPARENTING=1
# Start authentication daemons
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpg-connect-agent /bye
# Make Flatpak apps visible to launcher
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
# Start Xfce's settings manager
xfsettingsd &
# Start Shepherd to manage user daemons
shepherd
# Enable screen compositing
compton &
# Turn off the system bell
xset -b
# Load system tray apps
nm-applet &
QSyncthingTray &
# Enable screen locking on suspend
xss-lock -- slock &
# Development related environment vars
export PUPPETEER_EXECUTABLE_PATH=$(which chromium)
# We're in Emacs, yo
export VISUAL=emacsclient
export EDITOR="$VISUAL"
# Fire it up
exec dbus-launch --exit-with-session emacs -mm --use-exwm
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.