Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add ./ to execute local cf binary | #!/bin/bash -eu
tar -xvf cf-cli/*.tgz cf
chmod +x cf
echo Using $(cf-cli/cf --version)
cf api $PCF_API_URI --skip-ssl-validation
cf login -u $PCF_USERNAME -p $PCF_PASSWORD -o $PCF_ORG -s $PCF_SPACE
echo -n Creating buildpack ${BUILDPACK_NAME}...
cf create-buildpack $BUILDPACK_NAME buildpack/*.zip 11 --enable
echo done
| #!/bin/bash -eu
tar -xvf cf-cli/*.tgz cf
chmod +x cf
echo Using $(cf-cli/cf --version)
./cf api $PCF_API_URI --skip-ssl-validation
./cf login -u $PCF_USERNAME -p $PCF_PASSWORD -o $PCF_ORG -s $PCF_SPACE
echo -n Creating buildpack ${BUILDPACK_NAME}...
./cf create-buildpack $BUILDPACK_NAME buildpack/*.zip 11 --enable
echo done
|
Fix a classpath issue in the generation script. | #!/bin/bash
FILE="../../../../../../../app/src/com/google/android/stardroid/source/proto/source.proto"
# Reads the original source.proto file, strips out the PROTO_LITE
# option and then recompiles the proto as SourceFullProto. This
# allows us to use the ASCII parsing tools for protocol buffers with
# out messages.
sed -e "s/option optimize_for/\/\/option optimize_for/" $FILE \
| sed -e "s/\"SourceProto\"/\"SourceFullProto\"/" \
| sed -e "s/\/\/ optional string REMOVE/optional string REMOVE/" \
> source_full.proto
protoc --java_out="../../../../../" source_full.proto
CLASSPATH="\
../../../../../../bin:\
../../../../../../../app/bin:\
../../../../../../libs/protobuf-java-2.3.0.jar\
"
# Converts CSV and KML formats to ascii protocol buffers.
java -cp $CLASSPATH \
com.google.android.stardroid.data.StellarProtoWriter stardata_names.txt stars
java -cp $CLASSPATH \
com.google.android.stardroid.data.ConstellationProtoWriter constellation_names_and_lines.kml constellations
java -cp $CLASSPATH \
com.google.android.stardroid.data.MessierProtoWriter messier.csv messier
| #!/bin/bash
FILE="../../../../../../../app/src/com/google/android/stardroid/source/proto/source.proto"
# Reads the original source.proto file, strips out the PROTO_LITE
# option and then recompiles the proto as SourceFullProto. This
# allows us to use the ASCII parsing tools for protocol buffers with
# out messages.
sed -e "s/option optimize_for/\/\/option optimize_for/" $FILE \
| sed -e "s/\"SourceProto\"/\"SourceFullProto\"/" \
| sed -e "s/\/\/ optional string REMOVE/optional string REMOVE/" \
> source_full.proto
protoc --java_out="../../../../../" source_full.proto
CLASSPATH="\
../../../../../../bin:\
../../../../../../../app/bin/classes:\
../../../../../../libs/protobuf-java-2.3.0.jar\
"
# Converts CSV and KML formats to ascii protocol buffers.
java -cp $CLASSPATH \
com.google.android.stardroid.data.StellarProtoWriter stardata_names.txt stars
java -cp $CLASSPATH \
com.google.android.stardroid.data.ConstellationProtoWriter constellation_names_and_lines.kml constellations
java -cp $CLASSPATH \
com.google.android.stardroid.data.MessierProtoWriter messier.csv messier
|
Remove another PATH logging line | function app_dependencies() {
# ln -s ${elixir_path} /app/.platform_tools/elixir
PATH=$elixir_path/bin:$PATH
local git_dir_value=$GIT_DIR
# Enter build dir to perform app-related actions
cd $build_path
# Unset this var so that if the parent dir is a git repo, it isn't detected
# And all git operations are performed on the respective repos
unset GIT_DIR
output_section "Fetching app dependencies with mix"
MIX_ENV=prod mix deps.get || exit 1
output_section "Compiling app dependencies"
MIX_ENV=prod mix deps.compile || exit 1
export GIT_DIR=$git_dir_value
cd -
}
function compile_app() {
local git_dir_value=$GIT_DIR
unset GIT_DIR
cd $build_path
output_section "Compiling the app"
MIX_ENV=prod mix compile || exit 1
export GIT_DIR=$git_dir_value
cd -
}
function write_profile_d_script() {
output_section "Creating .profile.d with env vars"
mkdir $build_path/.profile.d
local export_line="export PATH=\$HOME/.platform_tools:\$HOME/.platform_tools/erlang/bin:\$HOME/.platform_tools/elixir/bin:\$PATH"
echo "Export statement:"
echo $export_line
echo $export_line >> $build_path/.profile.d/elixir_buildpack_paths.sh
}
| function app_dependencies() {
# ln -s ${elixir_path} /app/.platform_tools/elixir
PATH=$elixir_path/bin:$PATH
local git_dir_value=$GIT_DIR
# Enter build dir to perform app-related actions
cd $build_path
# Unset this var so that if the parent dir is a git repo, it isn't detected
# And all git operations are performed on the respective repos
unset GIT_DIR
output_section "Fetching app dependencies with mix"
MIX_ENV=prod mix deps.get || exit 1
output_section "Compiling app dependencies"
MIX_ENV=prod mix deps.compile || exit 1
export GIT_DIR=$git_dir_value
cd -
}
function compile_app() {
local git_dir_value=$GIT_DIR
unset GIT_DIR
cd $build_path
output_section "Compiling the app"
MIX_ENV=prod mix compile || exit 1
export GIT_DIR=$git_dir_value
cd -
}
function write_profile_d_script() {
output_section "Creating .profile.d with env vars"
mkdir $build_path/.profile.d
local export_line="export PATH=\$HOME/.platform_tools:\$HOME/.platform_tools/erlang/bin:\$HOME/.platform_tools/elixir/bin:\$PATH"
echo $export_line >> $build_path/.profile.d/elixir_buildpack_paths.sh
}
|
Fix scenario when cd fails before other commands | #!/bin/bash
source env/bin/activate
echo ""
echo "checking for linting errors"
flake8 --select E,W --max-line-length=140 --ignore E722,W503,W504,E128 jarviscli/ installer
echo "lint errors checked"
echo ""
cd jarviscli/
echo "checking for unit test"
python3 -m unittest discover
echo "unit tests checked"
echo ""
cd ..
| #!/bin/bash
source env/bin/activate
echo ""
echo "checking for linting errors"
flake8 --select E,W --max-line-length=140 --ignore E722,W503,W504,E128 jarviscli/ installer
echo "lint errors checked"
echo ""
(
cd jarviscli || exit
echo "checking for unit test"
python3 -m unittest discover
echo "unit tests checked"
echo ""
cd ..
)
|
Add a test for the double auth problem | test_remote() {
rm -f testconf || true
(echo y; sleep 3; echo foo) | lxc remote --config ./testconf add local 127.0.0.1:8443 --debug
lxc remote --config ./testconf list | grep 'local'
lxc remote --config ./testconf set-default local
[ "$(lxc remote --config ./testconf get-default)" = "local" ]
lxc remote --config ./testconf rename local foo
lxc remote --config ./testconf list | grep 'foo'
lxc remote --config ./testconf list | grep -v 'local'
[ "$(lxc remote --config ./testconf get-default)" = "foo" ]
lxc remote --config ./testconf rm foo
[ "$(lxc remote --config ./testconf get-default)" = "" ]
rm -f testconf || true
}
| test_remote() {
rm -f testconf || true
(echo y; sleep 3; echo foo) | lxc remote --config ./testconf add local 127.0.0.1:8443 --debug
lxc remote --config ./testconf list | grep 'local'
lxc remote --config ./testconf set-default local
[ "$(lxc remote --config ./testconf get-default)" = "local" ]
lxc remote --config ./testconf rename local foo
lxc remote --config ./testconf list | grep 'foo'
lxc remote --config ./testconf list | grep -v 'local'
[ "$(lxc remote --config ./testconf get-default)" = "foo" ]
lxc remote --config ./testconf rm foo
[ "$(lxc remote --config ./testconf get-default)" = "" ]
# This is a test for #91, we expect this to hang asking for a password if we
# tried to re-add our cert.
echo y | lxc remote --config ./testconf add local 127.0.0.1:8443 --debug
rm -f testconf || true
}
|
Add decoder trained with smaller style weight | cd models
# The VGG-19 network is obtained by:
# 1. converting vgg_normalised.caffemodel to .t7 using loadcaffe
# 2. inserting a convolutional module at the beginning to preprocess the image
# 3. replacing zero-padding with reflection-padding
# The original vgg_normalised.caffemodel can be obtained with:
# "wget -c --no-check-certificate https://bethgelab.org/media/uploads/deeptextures/vgg_normalised.caffemodel"
wget -c https://s3.amazonaws.com/xunhuang-public/adain/decoder.t7
wget -c https://s3.amazonaws.com/xunhuang-public/adain/vgg_normalised.t7
cd ..
| cd models
# The VGG-19 network is obtained by:
# 1. converting vgg_normalised.caffemodel to .t7 using loadcaffe
# 2. inserting a convolutional module at the beginning to preprocess the image
# 3. replacing zero-padding with reflection-padding
# The original vgg_normalised.caffemodel can be obtained with:
# "wget -c --no-check-certificate https://bethgelab.org/media/uploads/deeptextures/vgg_normalised.caffemodel"
wget -c https://s3.amazonaws.com/xunhuang-public/adain/decoder.t7
wget -c https://s3.amazonaws.com/xunhuang-public/adain/decoder-content-similar.t7
wget -c https://s3.amazonaws.com/xunhuang-public/adain/vgg_normalised.t7
cd ..
|
Create symbolic link for translation.conf | #! /bin/bash
#
# $VUFIND_HOME and $VUFIND_LOCAL_DIR have to be set!
#
# Links some configs.
#
set -o errexit -o nounset
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
show_help() {
cat << EOF
Links some configs.
USAGE: ${0##*/} CONFIGS_DIRECTORY
CONFIGS_DIRECTORY The directory, which holds the configs.
EOF
}
if [ "$#" -ne 1 ]; then
echo "ERROR: Illegal number of parameters!"
echo "Parameters: $*"
show_help
exit 1
fi
CONFIGS_DIRECTORY=$1
echo "ln --symbolic --force --no-target-directory" "$CONFIGS_DIRECTORY/cronjobs" "/var/lib/tuelib/cronjobs"
ln --symbolic --force --no-target-directory "$CONFIGS_DIRECTORY/cronjobs" "/var/lib/tuelib/cronjobs" | #! /bin/bash
#
# $VUFIND_HOME and $VUFIND_LOCAL_DIR have to be set!
#
# Links some configs.
#
set -o errexit -o nounset
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
show_help() {
cat << EOF
Links some configs.
USAGE: ${0##*/} CONFIGS_DIRECTORY
CONFIGS_DIRECTORY The directory, which holds the configs.
EOF
}
if [ "$#" -ne 1 ]; then
echo "ERROR: Illegal number of parameters!"
echo "Parameters: $*"
show_help
exit 1
fi
CONFIGS_DIRECTORY=$1
ln --symbolic --force --no-target-directory "$CONFIGS_DIRECTORY/cronjobs" "/var/lib/tuelib/cronjobs"
ln --symbolic --force --no-target-directory "$CONFIGS_DIRECTORY/translations.conf" "/var/lib/tuelib/translations.conf"
|
Improve keyword detecting mechanism of zsh completion | _googkit() {
local words completions
read -cA words
total_words=${#words}
if [[ $total_words -eq 2 ]]; then
completions=$'compile\nconfig\ndeps\ninit\nsetup\nupdate'
elif [[ $total_words -eq 3 ]]; then
if [[ $words[2] = 'config' ]]; then
completions='update'
elif [[ $words[2] = 'deps' ]]; then
completions='update'
fi
fi
reply=("${(ps:\n:)completions}")
}
compctl -K _googkit googkit
| _googkit() {
local words completions
read -cA words
total_words=${#words}
if [[ $total_words -eq 2 ]]; then
completions="$(googkit commands)"
else
completions="$(googkit commands ${words[2,-2]})"
fi
reply=("${(ps:\n:)completions}")
}
compctl -K _googkit googkit
|
Fix reference to webapp-django jenkins script. | #!/bin/bash
#
# This script installs all dependencies, compiles static assets,
# and syncs the database. After it is run, the app should be runnable
# by WSGI.
set -e
source ${VIRTUAL_ENV:-"../socorro-virtualenv"}/bin/activate
if [ ! -f crashstats/settings/local.py ]
then
cp crashstats/settings/local.py-dist crashstats/settings/local.py
fi
export PATH=$PATH:./node_modules/.bin/
if [ -n "$WORKSPACE" ]
then
# this means we're running jenkins
cp crashstats/settings/local.py-dist crashstats/settings/local.py
echo "# force jenkins.sh" >> crashstats/settings/local.py
echo "COMPRESS_OFFLINE = True" >> crashstats/settings/local.py
fi
./manage.py collectstatic --noinput
# even though COMPRESS_OFFLINE=True COMPRESS becomes (!DEBUG) which
# will become False so that's why we need to use --force here.
./manage.py compress --force --engine=jinja2
./manage.py syncdb --noinput
| #!/bin/bash
#
# This script installs all dependencies, compiles static assets,
# and syncs the database. After it is run, the app should be runnable
# by WSGI.
set -e
source ${VIRTUAL_ENV:-"../socorro-virtualenv"}/bin/activate
if [ ! -f crashstats/settings/local.py ]
then
cp crashstats/settings/local.py-dist crashstats/settings/local.py
fi
export PATH=$PATH:./node_modules/.bin/
if [ -n "$WORKSPACE" ]
then
# this means we're running jenkins
cp crashstats/settings/local.py-dist crashstats/settings/local.py
echo "# force compression for CI" >> crashstats/settings/local.py
echo "COMPRESS_OFFLINE = True" >> crashstats/settings/local.py
fi
./manage.py collectstatic --noinput
# even though COMPRESS_OFFLINE=True COMPRESS becomes (!DEBUG) which
# will become False so that's why we need to use --force here.
./manage.py compress --force --engine=jinja2
./manage.py syncdb --noinput
|
UPDATE new envirnoment variable SEMITKI_ENV which can be set to develepment ot production values, currently only launches newrelic agent in production | #!/bin/bash
cd /semitki
ENV/bin/pip install -r requirements.txt
cd /semitki/api
/semitki/ENV/bin/python /semitki/api/manage.py migrate --noinput
## uWSGI production app server
/semitki/ENV/bin/newrelic-admin run-program /semitki/ENV/bin/uwsgi --ini /semitki/config/emperor.ini
## Django development server
/semitki/ENV/bin/python /semitki/api/manage.py runserver 0.0.0.0:8000
| #!/bin/bash
cd /semitki
ENV/bin/pip install -r requirements.txt
cd /semitki/api
/semitki/ENV/bin/python /semitki/api/manage.py migrate --noinput
## uWSGI production app server
if [ "${SEMITKI_ENV}" = "production" ]; then
/semitki/ENV/bin/newrelic-admin run-program /semitki/ENV/bin/uwsgi --ini /semitki/config/emperor.ini
else
/semitki/ENV/bin/uwsgi --ini /semitki/config/emperor.ini
fi
## Django development server
/semitki/ENV/bin/python /semitki/api/manage.py runserver 0.0.0.0:8000
|
Remove debug and fix shebang | #!/bin/sh
cwd=$(pwd)
function install_bower {
dir=$1
cwd=$2
for folder in ${dir}; do
dirname="$cwd/$folder"
echo "$dirname\n"
if [[ ! -d "$dirname" ]]; then
continue
fi;
cd $dirname
echo $dirname
if [ -e bower.json ]; then
bower install
fi
done
cd $cwd
}
install_bower "module/*" $cwd
install_bower "vendor/*/*" $cwd
#root install
bower install
| #!/bin/bash
cwd=$(pwd)
function install_bower {
dir=$1
cwd=$2
for folder in ${dir}; do
dirname="$cwd/$folder"
if [[ ! -d "$dirname" ]]; then
continue
fi;
cd $dirname
if [ -e bower.json ]; then
bower install
fi
done
cd $cwd
}
install_bower "module/*" $cwd
install_bower "vendor/*/*" $cwd
#root install
bower install
|
Remove k command and use dnx instead | #!/bin/bash
if test `uname` = Darwin; then
cachedir=~/Library/Caches/KBuild
else
if [ -z $XDG_DATA_HOME ]; then
cachedir=$HOME/.local/share
else
cachedir=$XDG_DATA_HOME;
fi
fi
mkdir -p $cachedir
url=https://www.nuget.org/nuget.exe
if test ! -f $cachedir/nuget.exe; then
wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null
fi
if test ! -e .nuget; then
mkdir .nuget
cp $cachedir/nuget.exe .nuget/nuget.exe
fi
if test ! -d packages/KoreBuild; then
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion
fi
if ! type dnvm > /dev/null 2>&1; then
source packages/KoreBuild/build/dnvm.sh
fi
if ! type k > /dev/null 2>&1; then
dnvm upgrade
fi
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
| #!/bin/bash
if test `uname` = Darwin; then
cachedir=~/Library/Caches/KBuild
else
if [ -z $XDG_DATA_HOME ]; then
cachedir=$HOME/.local/share
else
cachedir=$XDG_DATA_HOME;
fi
fi
mkdir -p $cachedir
url=https://www.nuget.org/nuget.exe
if test ! -f $cachedir/nuget.exe; then
wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null
fi
if test ! -e .nuget; then
mkdir .nuget
cp $cachedir/nuget.exe .nuget/nuget.exe
fi
if test ! -d packages/KoreBuild; then
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion
fi
if ! type dnvm > /dev/null 2>&1; then
source packages/KoreBuild/build/dnvm.sh
fi
if ! type dnx > /dev/null 2>&1; then
dnvm upgrade
fi
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
|
Handle existing disco user/group better. | #!/bin/bash
cat << EOF
#!/bin/sh
set -e
case "\$1" in
configure)
adduser --system --quiet --group disco --disabled-password --shell /bin/bash --home ${RELSRV} --no-create-home
chown disco:disco ${RELSRV}
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument: \$1" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# for details, see http://www.debian.org/doc/debian-policy/
#DEBHELPER#
exit 0
EOF | #!/bin/bash
cat << EOF
#!/bin/sh
set -e
case "\$1" in
configure)
if ! getent group | grep -q "^disco:" ; then
addgroup --system \
--quiet \
disco 2>/dev/null
fi
if ! getent passwd | grep -q "^disco:" ; then
adduser --system \
--quiet \
--group \
--disabled-password \
--shell /bin/bash \
--home ${RELSRV} \
--no-create-home \
disco 2>/dev/null
fi
usermod -c "Disco" -d ${RELSRV} -g disco disco
chown disco:disco ${RELSRV}
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument: \$1" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# for details, see http://www.debian.org/doc/debian-policy/
#DEBHELPER#
exit 0
EOF |
Add License header to our shell script files. | #!/bin/bash
bazel build java/...
| #!/bin/bash
# Copyright 2019 Google Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
bazel build java/...
|
Disable appdomains for xunit on Mono | #!/bin/sh
BASEDIR=$(dirname $0)
mono -O=-gshared ${BASEDIR}/xunit.console.x86.exe $*
| #!/bin/sh
BASEDIR=$(dirname $0)
TESTDIR=$(dirname $1)
# we need to copy xunit to the test dir so AppDomain.CurrentDomain.BaseDirectory
# points to the test dir instead of the xunit dir when using -noappdomain
# as Nancy relies on this to locate views.
# -noappdomain works around https://bugzilla.xamarin.com/show_bug.cgi?id=39251
cp ${BASEDIR}/xunit.console.x86.exe ${TESTDIR}
mono -O=-gshared ${TESTDIR}/xunit.console.x86.exe $* -noappdomain
|
Clean up old files when auto-building | #!/bin/bash
# based on:
# - https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
# - http://www.steveklabnik.com/automatically_update_github_pages_with_travis_example/
set -o errexit -o nounset
REV=$(git rev-parse --short HEAD)
cd build
git init
git config user.name "CI"
git config user.email "webmaster@hacktun.es"
git remote add dest "https://${GH_TOKEN}@${GH_REF}" > /dev/null 2>&1
git fetch --depth=1 dest gh-pages > /dev/null 2>&1
git reset dest/gh-pages
git add .
git commit -m "Auto-build of ${REV}"
git push dest HEAD:gh-pages > /dev/null 2>&1
| #!/bin/bash
# based on:
# - https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
# - http://www.steveklabnik.com/automatically_update_github_pages_with_travis_example/
set -o errexit -o nounset
REV=$(git rev-parse --short HEAD)
cd build
git init
git config user.name "CI"
git config user.email "webmaster@hacktun.es"
git remote add dest "https://${GH_TOKEN}@${GH_REF}" > /dev/null 2>&1
git fetch --depth=1 dest gh-pages > /dev/null 2>&1
git reset dest/gh-pages
echo "hacktun.es" > CNAME
git add -A .
git commit -m "Auto-build of ${REV}"
git push dest HEAD:gh-pages > /dev/null 2>&1
|
Streamline installation of epel repo | #!/bin/bash
echo "==> Adding EPEL repo"
cat /etc/redhat-release
if grep -q -i "release 7" /etc/redhat-release ; then
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -Uvh epel-release-7*.rpm
echo "==> Installing docker"
yum install -y docker
elif grep -q -i "release 6" /etc/redhat-release ; then
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6*.rpm
echo "==> Installing docker"
yum install -y docker-io
fi
echo "==> Starting docker"
service docker start
echo "==> Enabling docker to start on reboot"
chkconfig docker on
| #!/bin/bash
echo "==> Adding EPEL repo"
yum install -y epel-release
cat /etc/resolv.conf
cat /etc/redhat-release
if grep -q -i "release 7" /etc/redhat-release ; then
echo "==> Installing docker"
yum install -y docker
elif grep -q -i "release 6" /etc/redhat-release ; then
echo "==> Installing docker"
yum install -y docker-io
fi
echo "==> Starting docker"
service docker start
echo "==> Enabling docker to start on reboot"
chkconfig docker on
|
Modify Javadocs script to copy directly to correct codemelon directory | #!/bin/bash
javadoc -d html -sourcepath src -subpackages com
| #!/bin/bash
javadoc -d ~/Documents/Programming/websites/codemelon2012/content/documentation/graph2012 -sourcepath src -subpackages com
|
Build against my terraform fork | #!/bin/bash
project=$1
version=$2
iteration=$3
go get ${project}
mkdir /dist && cd /dist
fpm -s dir -t deb --name ${project} \
--iteration ${iteration} --version ${version} \
/go/bin/${project}=/usr/bin/
| #!/bin/bash
project=$1
version=$2
iteration=$3
go get ${project}
pushd /go/src/github.com/hashicorp/terraform
git remote add bobtfish https://github.com/bobtfish/terraform.git
git fetch bobtfish
git fetch --tags bobtfish
git checkout 0.4.0-pre1
popd
pushd /go/bin
go build ../src/terraform-provider-yelpaws
popd
mkdir /dist && cd /dist
fpm -s dir -t deb --name ${project} \
--iteration ${iteration} --version ${version} \
/go/bin/${project}=/usr/bin/
|
Make setup hook work for cross | # libiconv must be listed in load flags on non-Glibc
# it doesn't hurt to have it in Glibc either though
iconvLdflags() {
export NIX_LDFLAGS="$NIX_LDFLAGS -liconv"
}
addEnvHooks "$hostOffset" iconvLdflags
| # libiconv must be listed in load flags on non-Glibc
# it doesn't hurt to have it in Glibc either though
iconvLdflags() {
# The `depHostOffset` describes how the host platform of the dependencies
# are slid relative to the depending package. It is brought into scope of
# the environment hook defined as the role of the dependency being applied.
case $depHostOffset in
-1) local role='BUILD_' ;;
0) local role='' ;;
1) local role='TARGET_' ;;
*) echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2;
return 1 ;;
esac
export NIX_${role}LDFLAGS+=" -liconv"
}
addEnvHooks "$hostOffset" iconvLdflags
|
Archive the repository instead of cloning it so that it works with CI shallow copy | #!/bin/bash
BASEDIR=$(dirname $0)
cd $BASEDIR
../../node_modules/.bin/http-server -p 8000 &
git clone ../../. can
git clone https://github.com/jupiterjs/funcunit.git
cd funcunit
git submodule update --init --recursive
cd ..
git clone https://github.com/jupiterjs/steal.git | #!/bin/bash
BASEDIR=$(dirname $0)
mkdir $BASEDIR/can
git archive HEAD | tar -x -C $BASEDIR/can
node_modules/.bin/http-server -p 8000 &
cd $BASEDIR
git clone https://github.com/jupiterjs/funcunit.git
cd funcunit
git submodule update --init --recursive
cd ..
git clone https://github.com/jupiterjs/steal.git |
Revert "Refactor away the cd in the start script" | #!/bin/bash
# Migrations
python manage.py migrate
# Collect static files
python manage.py collectstatic --noinput
# Run app
exec gunicorn emission_events.wsgi:application \
--workers 3 \
--bind 0.0.0.0:8000 \
"$@"
| #!/bin/bash
# Migrations
python manage.py migrate
# Collect static files
python manage.py collectstatic --noinput
# Run app
cd emission_events
exec gunicorn emission_events.wsgi:application \
--workers 3 \
--bind 0.0.0.0:8000 \
"$@"
|
Use /usr/bin/env to get the path to bash, as /usr/bin/env almost always exists, while bash is usually not in /bin on non-linux afaik. Better solution would be to avoid bashisms. | #!/bin/bash
function usage() {
echo
echo copybuild.sh \<source directory\> \<destination directory\>
echo
}
if [ -z $1 ] ; then
usage
exit
fi
if [ -z $2 ] ; then
usage
exit
fi
if [ $1 = $2 ] ; then
echo source and destination can\'t be the same
usage
exit
fi
src_dir=$1
dst_dir=$2
cp $src_dir/AUTHORS $dst_dir
cp $src_dir/autogen.sh $dst_dir
cp $src_dir/ChangeLog $dst_dir
cp $src_dir/configure.ac $dst_dir
cp $src_dir/COPYING $dst_dir
cp $src_dir/INSTALL $dst_dir
cp $src_dir/Makefile.am $dst_dir
cp $src_dir/NEWS $dst_dir
cp $src_dir/README $dst_dir
cp $src_dir/*.pc.in $dst_dir
| #!/usr/bin/env bash
function usage() {
echo
echo copybuild.sh \<source directory\> \<destination directory\>
echo
}
if [ -z $1 ] ; then
usage
exit
fi
if [ -z $2 ] ; then
usage
exit
fi
if [ $1 = $2 ] ; then
echo source and destination can\'t be the same
usage
exit
fi
src_dir=$1
dst_dir=$2
cp $src_dir/AUTHORS $dst_dir
cp $src_dir/autogen.sh $dst_dir
cp $src_dir/ChangeLog $dst_dir
cp $src_dir/configure.ac $dst_dir
cp $src_dir/COPYING $dst_dir
cp $src_dir/INSTALL $dst_dir
cp $src_dir/Makefile.am $dst_dir
cp $src_dir/NEWS $dst_dir
cp $src_dir/README $dst_dir
cp $src_dir/*.pc.in $dst_dir
|
Remove space character from filename | #!/bin/bash
if [[ `hostname` = 'bh1-autobuild' ]]; then
pfexec mkdir -p $PUBLISH_LOCATION
pfexec cp build/pkg/cabase.tar.gz "$PUBLISH_LOCATION/$CABASE_PKG"
pfexec cp build/pkg/cainstsvc.tar.gz "$PUBLISH_LOCATION/$CAINSTSVC_PKG "
else
echo "Not publishing because not on bh1-autobuild"
fi
| #!/bin/bash
if [[ `hostname` = 'bh1-autobuild' ]]; then
pfexec mkdir -p $PUBLISH_LOCATION
pfexec cp build/pkg/cabase.tar.gz "$PUBLISH_LOCATION/$CABASE_PKG"
pfexec cp build/pkg/cainstsvc.tar.gz "$PUBLISH_LOCATION/$CAINSTSVC_PKG"
else
echo "Not publishing because not on bh1-autobuild"
fi
|
Update ats.version file content after release | #!/bin/bash
mvn release:clean -DautoVersionSubmodules=true -Darguments="-DskipTests=true -Dgpg.skip=false"
mvn release:prepare -DautoVersionSubmodules=true -Darguments="-DskipTests=true -Dgpg.skip=false"
mvn release:perform -DautoVersionSubmodules=true -Darguments="-DskipTests=true -Dgpg.skip=false"
| #!/bin/bash
# save the version number that is about to be commited
FUTURE_VERSION=""
while read LINE
do
if [[ "$LINE" == *"<version>"* ]]; then
#echo "$LINE" # prints <version>the_version-SNAPSHOT</version>
FUTURE_VERSION=`echo $LINE | awk '{split($0,a,"-"); print a[1]}'` # returns <version>the_version
FUTURE_VERSION=`echo $FUTURE_VERSION | awk '{split($0,a,">"); print a[2]}'` # returns the_version
break
fi
done < pom.xml
mvn release:clean -DautoVersionSubmodules=true -Darguments="-DskipTests=true -Dgpg.skip=false"
mvn release:prepare -DautoVersionSubmodules=true -Darguments="-DskipTests=true -Dgpg.skip=false"
mvn release:perform -DautoVersionSubmodules=true -Darguments="-DskipTests=true -Dgpg.skip=false"
# delete the previous file
# Note that it is expected that the file (ats.version) contains only version=some_version
rm -rf corelibrary/src/main/resources/ats.version
echo version=$FUTURE_VERSION > corelibrary/src/main/resources/ats.version
# push new version
COMMIT_MSG="Change ats.version to "$FUTURE_VERSION""
git add corelibrary/src/main/resources/ats.version
git commit -m "$COMMIT_MSG"
git push
|
Remove installation files and folders | #!/bin/bash
# Install PyQt
pyqt_rel='5.11.3'
apt-get install -y checkinstall libreadline-gplv2-dev libncursesw5-dev \
libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev \
libbz2-dev swig liblapack-dev libdbus-1-3 libglu1-mesa-dev
cd ~/Downloads
wget "https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-$pyqt_rel/PyQt5_gpl-$pyqt_rel.tar.gz"
tar xzf "PyQt5_gpl-$pyqt_rel.tar.gz"
cd ~/Downloads
cd "PyQt5_gpl-$pyqt_rel"/
mkdir -p "/opt/Qt/$pyqt_rel/gcc_64/plugins/PyQt5"
python-sirius configure.py --"qmake=/opt/Qt/$pyqt_rel/gcc_64/bin/qmake" \
--sip-incdir=/usr/include/python3.6m \
--"designer-plugindir=/opt/Qt/$pyqt_rel/gcc_64/plugins/designer" \
--"qml-plugindir=/opt/Qt/$pyqt_rel/gcc_64/plugins/PyQt5" \
--confirm-license \
--assume-shared \
--verbose
make -j32
sudo make install
| #!/bin/bash
# Install PyQt
pyqt_rel='5.11.3'
apt-get install -y checkinstall libreadline-gplv2-dev libncursesw5-dev \
libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev \
libbz2-dev swig liblapack-dev libdbus-1-3 libglu1-mesa-dev
# cd ~/Downloads
wget "https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-$pyqt_rel/PyQt5_gpl-$pyqt_rel.tar.gz"
tar xzf "PyQt5_gpl-$pyqt_rel.tar.gz"
# cd ~/Downloads
cd "PyQt5_gpl-$pyqt_rel"/
mkdir -p "/opt/Qt/$pyqt_rel/gcc_64/plugins/PyQt5"
python-sirius configure.py --"qmake=/opt/Qt/$pyqt_rel/gcc_64/bin/qmake" \
--sip-incdir=/usr/include/python3.6m \
--"designer-plugindir=/opt/Qt/$pyqt_rel/gcc_64/plugins/designer" \
--"qml-plugindir=/opt/Qt/$pyqt_rel/gcc_64/plugins/PyQt5" \
--confirm-license \
--assume-shared \
--verbose
make -j32
sudo make install
cd ..
rm -rf "PyQt5_gpl-$pyqt_rel.tar.gz" "PyQt5_gpl-$pyqt_rel"
|
Change aur manager from yay to yay-bin | #!/usr/bin/env bash
sudo pacman -S --noconfirm --needed go htop the_silver_searcher mlocate unarchiver lesspipe sshpass xorg-xrandr pkgfile
if ! builtin command -v yay > /dev/null 2>&1; then
if [ ! -d /tmp/yay ]; then
(cd /tmp && git clone https://aur.archlinux.org/yay.git)
fi
sudo pacman -S --noconfirm --needed base-devel
(cd /tmp/yay && makepkg -si --noconfirm && yay -Syy)
fi
yay -S --noconfirm --needed i3-easyfocus-git wmfocus clipmenu light-git
if ! builtin command -v urxvt > /dev/null 2>&1; then
yay -S --noconfirm --needed urxvt-resize-font-git
fi
# sudo pacman -Rs --noconfirm neovim || true
# if [[ -L /usr/local/bin/nvim ]]; then
# sudo rm /usr/local/bin/nvim || true
# fi
# yay -S --noconfirm --needed neovim-nightly
| #!/usr/bin/env bash
sudo pacman -S --noconfirm --needed go htop the_silver_searcher mlocate unarchiver lesspipe sshpass xorg-xrandr pkgfile
if ! builtin command -v yay > /dev/null 2>&1; then
if [ ! -d /tmp/yay ]; then
(cd /tmp && git clone https://aur.archlinux.org/yay-bin.git)
fi
sudo pacman -S --noconfirm --needed base-devel
(cd /tmp/yay && makepkg -si --noconfirm && yay -Syy)
fi
yay -S --noconfirm --needed i3-easyfocus-git wmfocus clipmenu light-git
if ! builtin command -v urxvt > /dev/null 2>&1; then
yay -S --noconfirm --needed urxvt-resize-font-git
fi
# sudo pacman -Rs --noconfirm neovim || true
# if [[ -L /usr/local/bin/nvim ]]; then
# sudo rm /usr/local/bin/nvim || true
# fi
# yay -S --noconfirm --needed neovim-nightly
|
Fix issue with PATH in test environment | [ -n "$TEST_DEBUG" ] && set -x
resolve_link() {
$(type -p greadlink readlink | head -1) $1
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
# Set testroot variable.
testroot="$(abs_dirname "$BASH_SOURCE")"
# Set root variable.
root="$(abs_dirname "$testroot/../..")"
# Set TMUXIFIER environment variable
TMUXIFIER="$root"
# Unset TMUX environment variable, tests assume they're not running within
# Tmux.
unset TMUX
# Unset various Tmuxifier environment variables to prevent a local install of
# Tmuxifier interfering with tests.
unset TMUXIFIER_LAYOUT_PATH
unset TMUXIFIER_TMUX_OPTS
unset TMUXIFIER_NO_COMPLETE
# Include assert.sh and stub.sh libraries.
source "${testroot}/assert.sh"
source "${testroot}/stub.sh"
| [ -n "$TEST_DEBUG" ] && set -x
resolve_link() {
$(type -p greadlink readlink | head -1) $1
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
# Set testroot variable.
testroot="$(abs_dirname "$BASH_SOURCE")"
# Set root variable.
root="$(abs_dirname "$testroot/../..")"
# Set TMUXIFIER environment variable.
TMUXIFIER="$root"
# Setup PATH environment variable.
PATH="$root/bin:$root/libexec:$PATH"
# Unset TMUX environment variable, tests assume they're not running within
# Tmux.
unset TMUX
# Unset various Tmuxifier environment variables to prevent a local install of
# Tmuxifier interfering with tests.
unset TMUXIFIER_LAYOUT_PATH
unset TMUXIFIER_TMUX_OPTS
unset TMUXIFIER_NO_COMPLETE
# Include assert.sh and stub.sh libraries.
source "${testroot}/assert.sh"
source "${testroot}/stub.sh"
|
Revert "Attempt to run grunt bin directly" | #!/bin/bash
set -e
# This fix makes baby Jesus cry: We need to test for "node_modules" because npm will do
# a "prepublish" when pulling in a local dep, but doesn't run "install" first...
# It *also* liket to run "prepublish" after "install" which gives us a loop.
test -f "node_modules/.bin/grunt" || npm install
node_modules/.bin/grunt
| #!/bin/bash
set -e
# This fix makes baby Jesus cry: We need to test for "node_modules" because npm will do
# a "prepublish" when pulling in a local dep, but doesn't run "install" first...
# It *also* liket to run "prepublish" after "install" which gives us a loop.
test -d "node_modules" || npm install
npm run grunt
|
Move Jupyter configurations to $XDG_CONFIG_HOME | # Set up the XDG Base Directory Specification, but only if they don't exist
[[ -z $XDG_DATA_HOME ]] && export XDG_DATA_HOME="${HOME}/.local/share"
[[ -z $XDG_CONFIG_HOME ]] && export XDG_CONFIG_HOME="${HOME}/.config"
[[ -z $XDG_DATA_DIRS ]] && export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
[[ -z $XDG_CONFIG_DIRS ]] && export XDG_CONFIG_DIRS="/etc/xdg"
[[ -z $XDG_CACHE_HOME ]] && export XDG_CACHE_HOME="${HOME}/.cache"
# No suggested default is given, so do not set RUNTIME
#[[ -z $XDG_RUNTIME_DIR ]] && export XDG_RUNTIME_DIR=""
# Set up variables for the programs that let us move their configuration files
## Readline
INPUTRC=${XDG_CONFIG_HOME}/readline/inputrc
| # Set up the XDG Base Directory Specification, but only if they don't exist
[[ -z $XDG_DATA_HOME ]] && export XDG_DATA_HOME="${HOME}/.local/share"
[[ -z $XDG_CONFIG_HOME ]] && export XDG_CONFIG_HOME="${HOME}/.config"
[[ -z $XDG_DATA_DIRS ]] && export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
[[ -z $XDG_CONFIG_DIRS ]] && export XDG_CONFIG_DIRS="/etc/xdg"
[[ -z $XDG_CACHE_HOME ]] && export XDG_CACHE_HOME="${HOME}/.cache"
# No suggested default is given, so do not set RUNTIME
#[[ -z $XDG_RUNTIME_DIR ]] && export XDG_RUNTIME_DIR=""
# Set up variables for the programs that let us move their configuration files
## Readline
INPUTRC=${XDG_CONFIG_HOME}/readline/inputrc
## Jupyter/ipython
export IPYTHONDIR="${XDG_CONFIG_HOME}"/jupyter
export JUPYTER_CONFIG_DIR="${XDG_CONFIG_HOME}"/jupyter
mkdir -p ${IPYTHONDIR} ${JUPYTER_CONFIG_DIR}
|
Print only the name and installation state | #!/usr/bin/env bash
set -o errexit
dpkg-query -f '${Package}\t${Status}\n' -W '*'
| #!/usr/bin/env bash
set -o errexit
dpkg-query -f '${Package}\t${Status}\n' -W '*' | awk '{print $1"\t"$4}'
|
Use --exclude option rather than mocking up with coverage files. | #!/bin/sh
set -e
for ext in gcda gcno
do
for dir in external hepconnector libelperiodic
do
find ${dir} -name "*.${ext}" -delete
done
find src -name "*_fin.${ext}" -delete
done
coveralls --gcov gcov --gcov-options '\-lp';
| #!/bin/sh
set -e
for ext in gcda gcno
do
find src -name "*_fin.${ext}" -delete
done
coveralls --exclude external --exclude hepconnector --exclude libelperiodic \
--gcov gcov --gcov-options '\-lp'
|
Remove Stack Results from cfn stack listing | while getopts "a:r:" opt; do
case "$opt" in
a) STACK_SET_ACCOUNT="--stack-instance-account $OPTARG" ;;
r) STACK_SET_REGION="--stack-instance-region $OPTARG" ;;
esac
done
shift $(($OPTIND-1))
split_args "$@"
STACKSET_LISTING=$(awscli cloudformation list-stack-sets --status ACTIVE --output text --query "sort_by(Summaries,&StackSetName)[$(auto_filter StackSetName -- $FIRST_RESOURCE)].[StackSetName]")
select_one StackSet "$STACKSET_LISTING"
awscli cloudformation list-stack-instances --max-results 100 --stack-set-name $SELECTED ${STACK_SET_ACCOUNT:-} ${STACK_SET_REGION:-} --output json --query "sort_by(Summaries,&join('',[@.Account,@.Region]))[$(auto_filter Account Region StackId Status -- $SECOND_RESOURCE)].{
\"1.Account\":Account,
\"2.Region\":Region,
\"3.StackName\":StackId,
\"4.Status\":Status,
\"4.StatusReason\":StatusReason}" | sed "s/arn.*stack\/\(.*\)\/.*\"/\1\"/g" | print_table ListStackInstances
| while getopts "a:r:" opt; do
case "$opt" in
a) STACK_SET_ACCOUNT="--stack-instance-account $OPTARG" ;;
r) STACK_SET_REGION="--stack-instance-region $OPTARG" ;;
esac
done
shift $(($OPTIND-1))
split_args "$@"
STACKSET_LISTING=$(awscli cloudformation list-stack-sets --status ACTIVE --output text --query "sort_by(Summaries,&StackSetName)[$(auto_filter StackSetName -- $FIRST_RESOURCE)].[StackSetName]")
select_one StackSet "$STACKSET_LISTING"
awscli cloudformation list-stack-instances --stack-set-name $SELECTED ${STACK_SET_ACCOUNT:-} ${STACK_SET_REGION:-} --output json --query "sort_by(Summaries,&join('',[@.Account,@.Region]))[$(auto_filter Account Region StackId Status StatusReason -- $SECOND_RESOURCE)].{
\"1.Account\":Account,
\"2.Region\":Region,
\"3.StackName\":StackId,
\"4.Status\":Status,
\"4.StatusReason\":StatusReason}" | sed "s/arn.*stack\/\(.*\)\/.*\"/\1\"/g" | print_table ListStackInstances
|
Append version to codegen JAR | #!/bin/sh
set -e
API_ID="$1"
API_STAGE="latest"
WORKDIR="tmp"
SWAGGER_FILE="${WORKDIR}/swagger.json"
CODEGEN_VERSION="2.2.2"
CODEGEN_URL="http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/\
${CODEGEN_VERSION}/swagger-codegen-cli-${CODEGEN_VERSION}.jar"
CODEGEN_JAR="${WORKDIR}/codegen.jar"
CODEGEN_DEST="src/api"
mkdir -p "${WORKDIR}"
aws apigateway get-export \
--rest-api-id "${API_ID}" \
--stage-name "${API_STAGE}" \
--export-type swagger \
--parameters extensions='integrations' \
"${SWAGGER_FILE}"
if [ ! -f "${CODEGEN_JAR}" ]; then
wget "${CODEGEN_URL}" -O "${CODEGEN_JAR}"
fi
rm -rf "${CODEGEN_DEST}"
java -jar "${CODEGEN_JAR}" generate \
-i "${SWAGGER_FILE}" \
-l typescript-angular2 \
-o ${CODEGEN_DEST} | #!/bin/sh
set -e
API_ID="$1"
API_STAGE="latest"
WORKDIR="tmp"
SWAGGER_FILE="${WORKDIR}/swagger.json"
CODEGEN_VERSION="2.2.2"
CODEGEN_URL="http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/\
${CODEGEN_VERSION}/swagger-codegen-cli-${CODEGEN_VERSION}.jar"
CODEGEN_JAR="${WORKDIR}/codegen-${CODEGEN_VERSION}.jar"
CODEGEN_DEST="src/api"
mkdir -p "${WORKDIR}"
aws apigateway get-export \
--rest-api-id "${API_ID}" \
--stage-name "${API_STAGE}" \
--export-type swagger \
--parameters extensions='integrations' \
"${SWAGGER_FILE}"
if [ ! -f "${CODEGEN_JAR}" ]; then
wget "${CODEGEN_URL}" -O "${CODEGEN_JAR}"
fi
rm -rf "${CODEGEN_DEST}"
java -jar "${CODEGEN_JAR}" generate \
-i "${SWAGGER_FILE}" \
-l typescript-angular2 \
-o ${CODEGEN_DEST} |
Reduce clang-tidy output during linting | #!/usr/bin/env bash
BUILD_PATH="$1"
CLANG_TOOLS_VERSION=7.0.0
check_version() {
if ! $1 --version | grep --quiet $CLANG_TOOLS_VERSION; then
echo "WARNING: Wrong $1 version, expected $CLANG_TOOLS_VERSION."
fi
}
check_version clang-format
check_version clang-tidy
ROOTDIR=$(cd "$(dirname "$0")/.."; pwd)
FILES=$(echo $ROOTDIR/src/**/*.{h,cpp})
if [ "$2" = "--check" ]; then
python "$BUILD_PATH/run-clang-tidy.py" -header-filter="^$ROOTDIR/src/.*" -quiet $FILES \
&& ! (clang-format -output-replacements-xml $FILES | grep "<replacement " >/dev/null)
if [ $? -ne 0 ]; then
echo "Run the 'format' target to format the code."
exit 1
else
exit 0
fi
fi
python "$BUILD_PATH/run-clang-tidy.py" -header-filter="^$ROOTDIR/src/.*" -quiet -fix -format $FILES
| #!/usr/bin/env bash
set -o pipefail
BUILD_PATH="$1"
CLANG_TOOLS_VERSION=7.0.0
check_version() {
if ! $1 --version | grep --quiet $CLANG_TOOLS_VERSION; then
echo "WARNING: Wrong $1 version, expected $CLANG_TOOLS_VERSION."
fi
}
check_version clang-format
check_version clang-tidy
ROOTDIR=$(cd "$(dirname "$0")/.."; pwd)
FILES=$(echo $ROOTDIR/src/**/*.{h,cpp})
if [ "$2" = "--check" ]; then
python "$BUILD_PATH/run-clang-tidy.py" -header-filter="^$ROOTDIR/src/.*" -quiet $FILES 2>&1 \
| sed -E '/^($|clang-tidy|[0-9]+ warnings generated)/d' \
&& ! (clang-format -output-replacements-xml $FILES | grep "<replacement " >/dev/null)
if [ $? -ne 0 ]; then
echo "Run the 'format' target to format the code."
exit 1
else
exit 0
fi
fi
python "$BUILD_PATH/run-clang-tidy.py" -header-filter="^$ROOTDIR/src/.*" -quiet -fix -format $FILES
|
Allow to use custom mirror | #!/bin/bash -xe
# Copyright (C) 2014 Hewlett-Packard Development Company, L.P.
#
# 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.
source /etc/nodepool/provider
cat >/home/jenkins/.pip/pip.conf <<EOF
[global]
index-url = http://pypi.$NODEPOOL_REGION.openstack.org/simple
EOF
cat >/home/jenkins/.pydistutils.cfg <<EOF
[easy_install]
index_url = http://pypi.$NODEPOOL_REGION.openstack.org/simple
EOF
| #!/bin/bash -xe
# Copyright (C) 2014 Hewlett-Packard Development Company, L.P.
#
# 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.
source /etc/nodepool/provider
NODEPOOL_PYPI_MIRROR=${NODEPOOL_PYPI_MIRROR:-http://pypi.$NODEPOOL_REGION.openstack.org/simple}
cat >/home/jenkins/.pip/pip.conf <<EOF
[global]
index-url = $NODEPOOL_PYPI_MIRROR
EOF
cat >/home/jenkins/.pydistutils.cfg <<EOF
[easy_install]
index_url = $NODEPOOL_PYPI_MIRROR
EOF
|
Add an alias for VS Code | # shell/aliases-darwin.sh
#
# @file Mac specific shell aliases.
# Can’t remember the path to the iCloud directory? Me neither …
alias icloud="cd ~/Library/Mobile\ Documents/com~apple~CloudDocs"
# Delete all .DS_Store files recursively
alias rmds="find . -type f -name .DS_Store -delete"
alias ql="qlmanage -p >/dev/null 2>&1" # Open a file in quick look
alias hide="chflags hidden" # Hide a file in Finder
alias show="chflags nohidden" # Show a file in Finder
alias cask="brew cask" # Easily install apps via homebrew
alias services="brew services" # Easily maintain homebrew services
alias reload="source ~/.bash_profile" # Reload bash configuration
alias finder="open -a Finder" # Open a directory in Finder
alias chrome="open -a Google\ Chrome" # Open a website in Google Chrome
alias firefox="open -a Firefox" # Open a website in Firefox
alias safari="open -a Safari" # Open a website in Safari
alias preview="open -a Preview" # Display a preview of any type of file
| # shell/aliases-darwin.sh
#
# @file Mac specific shell aliases.
# Can’t remember the path to the iCloud directory? Me neither …
alias icloud="cd ~/Library/Mobile\ Documents/com~apple~CloudDocs"
# Delete all .DS_Store files recursively
alias rmds="find . -type f -name .DS_Store -delete"
alias ql="qlmanage -p >/dev/null 2>&1" # Open a file in quick look
alias hide="chflags hidden" # Hide a file in Finder
alias show="chflags nohidden" # Show a file in Finder
alias cask="brew cask" # Easily install apps via homebrew
alias services="brew services" # Easily maintain homebrew services
alias reload="source ~/.bash_profile" # Reload bash configuration
alias vscode="code" # Custom alias for VS Code
alias finder="open -a Finder" # Open a directory in Finder
alias chrome="open -a Google\ Chrome" # Open a website in Google Chrome
alias firefox="open -a Firefox" # Open a website in Firefox
alias safari="open -a Safari" # Open a website in Safari
alias preview="open -a Preview" # Display a preview of any type of file
|
Disable SANITIZE_THREAD as boost 1.67 doesn't support it anymore | #!/bin/bash
function quit {
killall GETodac
exit 1
}
cd `dirname $0`
git clean -d -x -f .
git submodule update --init --recursive
git submodule foreach --recursive git clean -d -x -f .
function build_test {
rm -fr build
mkdir build || quit
cd build
cmake -G Ninja $1 .. || quit
ninja all || quit
killall GETodac
ninja test || quit
killall GETodac
cd ..
rm -fr build
}
# "" "-DSANITIZE_ADDRESS=ON -DSANITIZE_UNDEFINED=ON" "-DSANITIZE_THREAD=ON -DSANITIZE_UNDEFINED=ON"
# Disable ADDRESS SANITIZE unlit we find a way to address:
# - https://github.com/boostorg/coroutine2/issues/12
# - https://github.com/google/sanitizers/issues/189#issuecomment-312914329
for cp in "" "-DSANITIZE_THREAD=ON -DSANITIZE_UNDEFINED=ON"
do
build_test "$cp"
done
exit 0
| #!/bin/bash
function quit {
killall GETodac
exit 1
}
cd `dirname $0`
git clean -d -x -f .
git submodule update --init --recursive
git submodule foreach --recursive git clean -d -x -f .
function build_test {
rm -fr build
mkdir build || quit
cd build
cmake -G Ninja $1 .. || quit
ninja all || quit
killall GETodac
ninja test || quit
killall GETodac
cd ..
rm -fr build
}
# "" "-DSANITIZE_ADDRESS=ON -DSANITIZE_UNDEFINED=ON" "-DSANITIZE_THREAD=ON -DSANITIZE_UNDEFINED=ON"
# Disable ADDRESS SANITIZE unlit we find a way to address:
# - https://github.com/boostorg/coroutine2/issues/12
# - https://github.com/google/sanitizers/issues/189#issuecomment-312914329
for cp in "" "-DSANITIZE_UNDEFINED=ON"
do
build_test "$cp"
done
exit 0
|
Refactor to multiple lines to make it more clean | CLIENT_ID="amzn1...."
CLIENT_SECRET="71acc0...."
CODE="CODE FROM auth_code.sh"
GRANT_TYPE="authorization_code"
REDIRECT_URI="https://sakirtemel.github.io/MMM-alexa/"
curl -X POST --data "grant_type=${GRANT_TYPE}&code=${CODE}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&redirect_uri=${REDIRECT_URI}" https://api.amazon.com/auth/o2/token
| CLIENT_ID="amzn1...."
CLIENT_SECRET="71acc0...."
CODE="CODE FROM auth_code.sh"
GRANT_TYPE="authorization_code"
REDIRECT_URI="https://sakirtemel.github.io/MMM-alexa/"
curl \
-X POST \
-d "grant_type=${GRANT_TYPE}&code=${CODE}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&redirect_uri=${REDIRECT_URI}" \
https://api.amazon.com/auth/o2/token
|
Increase max heap size to 8G | #!/bin/bash
set -eu
INSTANCE_ID=$(curl 169.254.169.254/2014-11-05/meta-data/instance-id)
REGISTER_NAME=$(aws ec2 describe-tags --filters Name=resource-id,Values=$INSTANCE_ID Name=key,Values=Name --query 'Tags[0].Value' --output text --region eu-west-1)
ENV=$(aws ec2 describe-tags --filters Name=resource-id,Values=$INSTANCE_ID Name=key,Values=Environment --query 'Tags[0].Value' --output text --region eu-west-1)
CONFIG_BUCKET=openregister.${ENV}.config
aws s3 cp s3://${CONFIG_BUCKET}/${REGISTER_NAME}/presentation/config.yaml /srv/presentation --region eu-west-1
aws s3 cp s3://${CONFIG_BUCKET}/new-registers.yaml /srv/presentation --region eu-west-1
aws s3 cp s3://${CONFIG_BUCKET}/new-fields.yaml /srv/presentation --region eu-west-1
docker run --name=presentationApp -d -p 80:8080 --volume /srv/presentation:/srv/presentation \
jstepien/openjdk8 java -Dfile.encoding=utf-8 -DregistersYaml=/srv/presentation/new-registers.yaml -DfieldsYaml=/srv/presentation/new-fields.yaml \
-jar /srv/presentation/presentation.jar server /srv/presentation/config.yaml
| #!/bin/bash
set -eu
INSTANCE_ID=$(curl 169.254.169.254/2014-11-05/meta-data/instance-id)
REGISTER_NAME=$(aws ec2 describe-tags --filters Name=resource-id,Values=$INSTANCE_ID Name=key,Values=Name --query 'Tags[0].Value' --output text --region eu-west-1)
ENV=$(aws ec2 describe-tags --filters Name=resource-id,Values=$INSTANCE_ID Name=key,Values=Environment --query 'Tags[0].Value' --output text --region eu-west-1)
CONFIG_BUCKET=openregister.${ENV}.config
aws s3 cp s3://${CONFIG_BUCKET}/${REGISTER_NAME}/presentation/config.yaml /srv/presentation --region eu-west-1
aws s3 cp s3://${CONFIG_BUCKET}/new-registers.yaml /srv/presentation --region eu-west-1
aws s3 cp s3://${CONFIG_BUCKET}/new-fields.yaml /srv/presentation --region eu-west-1
docker run --name=presentationApp -d -p 80:8080 --volume /srv/presentation:/srv/presentation \
jstepien/openjdk8 java -Xmx8g -Dfile.encoding=utf-8 -DregistersYaml=/srv/presentation/new-registers.yaml -DfieldsYaml=/srv/presentation/new-fields.yaml \
-jar /srv/presentation/presentation.jar server /srv/presentation/config.yaml
|
Add Gawati site URL to hosts file in case it differs from hostname | #!/bin/bash
function install {
VERSION="${2}"
installer_init "${1}" "" ""
CFGFILES="10-gawati.conf"
CFGSRC="${INSTALLER_HOME}/01"
CFGDST="/etc/httpd/conf.d"
export GAWATI_URL_ROOT="`iniget \"${INSTANCE}\" GAWATI_URL_ROOT`"
export GAWATI_URL_ROOT_="`echo ${GAWATI_URL_ROOT} | tr . _`"
export EXIST_BE_URL="`iniget \"${INSTANCE}\" EXIST_BE_URL`"
for FILE in ${CFGFILES} ; do
cfgwrite "${CFGSRC}/${FILE}" "${CFGDST}"
done
DSTOBJ="/var/www/html/${GAWATI_URL_ROOT}"
[ -e "${DSTOBJ}" ] || {
mkdir -p "${DSTOBJ}"
chown root:apache "${DSTOBJ}"
}
DSTOBJ="/etc/httpd/logs/${GAWATI_URL_ROOT}"
[ -e "${DSTOBJ}" ] || {
mkdir -p "${DSTOBJ}"
chown root:apache "${DSTOBJ}"
chmod 770 "${DSTOBJ}"
}
}
| #!/bin/bash
function install {
VERSION="${2}"
installer_init "${1}" "" ""
CFGFILES="10-gawati.conf"
CFGSRC="${INSTALLER_HOME}/01"
CFGDST="/etc/httpd/conf.d"
export GAWATI_URL_ROOT="`iniget \"${INSTANCE}\" GAWATI_URL_ROOT`"
export GAWATI_URL_ROOT_="`echo ${GAWATI_URL_ROOT} | tr . _`"
export EXIST_BE_URL="`iniget \"${INSTANCE}\" EXIST_BE_URL`"
addtohosts "${MainIP}" "${GAWATI_URL_ROOT}"
for FILE in ${CFGFILES} ; do
cfgwrite "${CFGSRC}/${FILE}" "${CFGDST}"
done
DSTOBJ="/var/www/html/${GAWATI_URL_ROOT}"
[ -e "${DSTOBJ}" ] || {
mkdir -p "${DSTOBJ}"
chown root:apache "${DSTOBJ}"
}
DSTOBJ="/etc/httpd/logs/${GAWATI_URL_ROOT}"
[ -e "${DSTOBJ}" ] || {
mkdir -p "${DSTOBJ}"
chown root:apache "${DSTOBJ}"
chmod 770 "${DSTOBJ}"
}
}
|
Check for file not directory | # Completions for language tools
completions=($GOROOT/share/zsh/site-functions/go $GOROOT/misc/zsh/go)
for completion in ${completions}
do
if [[ -d $completion ]];then
source $completion
fi
done
| # Completions for language tools
completions=($GOROOT/share/zsh/site-functions/go $GOROOT/misc/zsh/go)
for completion in ${completions}
do
if [[ -e $completion ]];then
source $completion
fi
done
|
Set gradle user home within CI tests | #!/bin/bash
set -euo pipefail
if [[ -d .gradle ]]; then
rm -rf .gradle
fi
./gradlew --no-daemon clean test
| #!/bin/bash
set -euo pipefail
if [[ -d .gradle ]]; then
rm -rf .gradle
fi
./gradlew --no-daemon -b /tmp clean test
|
Use dockerctl to restart containers | #!/bin/sh -ex
tmp=/tmp/update.sh.tmp
function copy() {
local src=$1 dst=$2
while true
do
dockerctl copy $dst $tmp
cmp -s $src $tmp && break
dockerctl copy $src $dst
sleep 1
done
}
container=`docker ps | awk '/cobbler/ {print $1}'`
docker restart $container
sleep 10
copy ./pmanager.py cobbler:/usr/lib/python2.6/site-packages/cobbler/pmanager.py
copy ./ubuntu_partition cobbler:/var/lib/cobbler/snippets/ubuntu_partition
copy ./ubuntu_partition_late cobbler:/var/lib/cobbler/snippets/ubuntu_partition_late
| #!/bin/sh -ex
tmp=/tmp/update.sh.tmp
function copy() {
local src=$1 dst=$2
while true
do
dockerctl copy $dst $tmp
cmp -s $src $tmp && break
dockerctl copy $src $dst
sleep 1
done
}
dockerctl restart cobbler
sleep 10
copy ./pmanager.py cobbler:/usr/lib/python2.6/site-packages/cobbler/pmanager.py
copy ./ubuntu_partition cobbler:/var/lib/cobbler/snippets/ubuntu_partition
copy ./ubuntu_partition_late cobbler:/var/lib/cobbler/snippets/ubuntu_partition_late
|
Update Jupyter script to load GRASS 7.2 libraries | #!/bin/sh
#
# Script to start ipython notebook on a custom port
#
if [ -z "$USER_NAME" ] ; then
USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"
export LD_LIBRARY_PATH=/usr/lib/grass70/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/usr/lib/grass70/etc/python:$PYTHONPATH
export GISBASE=/usr/lib/grass70/
export PATH=/usr/lib/grass70/bin/:$GISBASE/bin:$GISBASE/scripts:$PATH
export GIS_LOCK=$$
#mkdir -p /home/$USER/Envs/grass7data
mkdir -p $USER_HOME/.grass7
export GISRC=$USER_HOME/.grass7/rc
export GISDBASE=/home/user/grassdata/
export GRASS_TRANSPARENT=TRUE
export GRASS_TRUECOLOR=TRUE
export GRASS_PNG_COMPRESSION=9
export GRASS_PNG_AUTO_WRITE=TRUE
export OSSIM_PREFS_FILE=/usr/share/ossim/ossim_preference
jupyter notebook --port=8883 --no-browser \
--notebook-dir="$USER_HOME/jupyter/notebooks" \
--ip='*'
| #!/bin/sh
#
# Script to start ipython notebook on a custom port
#
if [ -z "$USER_NAME" ] ; then
USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"
export LD_LIBRARY_PATH=/usr/lib/grass72/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/usr/lib/grass72/etc/python:$PYTHONPATH
export GISBASE=/usr/lib/grass72/
export PATH=/usr/lib/grass72/bin/:$GISBASE/bin:$GISBASE/scripts:$PATH
export GIS_LOCK=$$
#mkdir -p /home/$USER/Envs/grass7data
mkdir -p $USER_HOME/.grass7
export GISRC=$USER_HOME/.grass7/rc
export GISDBASE=/home/user/grassdata/
export GRASS_TRANSPARENT=TRUE
export GRASS_TRUECOLOR=TRUE
export GRASS_PNG_COMPRESSION=9
export GRASS_PNG_AUTO_WRITE=TRUE
export OSSIM_PREFS_FILE=/usr/share/ossim/ossim_preference
jupyter notebook --port=8883 --no-browser \
--notebook-dir="$USER_HOME/jupyter/notebooks" \
--ip='*'
|
Remove goprotobuf install for now since it is not used. | #!/bin/bash
# Verify arcanist is installed.
command -v arc &> /dev/null
if [ $? -eq 1 ]; then
cat <<EOF
Please install Arcanist (part of Phabricator):
http://www.phabricator.com/docs/phabricator/article/Arcanist_User_Guide.html
EOF
exit 1
fi
set -e -x
# Grab binaries required by git hooks.
go get github.com/golang/lint/golint
go get code.google.com/p/go.tools/cmd/vet
go get code.google.com/p/go.tools/cmd/goimports
# Grab protobuf package for protoc-gen-go.
go install code.google.com/p/goprotobuf/proto
# Create symlinks to all git hooks in your own .git dir.
for f in $(ls -d githooks/*); do
rm .git/hooks/$(basename $f)
ln -s ../../$f .git/hooks/$(basename $f)
done && ls -al .git/hooks | grep githooks
| #!/bin/bash
# Verify arcanist is installed.
command -v arc &> /dev/null
if [ $? -eq 1 ]; then
cat <<EOF
Please install Arcanist (part of Phabricator):
http://www.phabricator.com/docs/phabricator/article/Arcanist_User_Guide.html
EOF
exit 1
fi
set -e -x
# Grab binaries required by git hooks.
go get github.com/golang/lint/golint
go get code.google.com/p/go.tools/cmd/vet
go get code.google.com/p/go.tools/cmd/goimports
# Create symlinks to all git hooks in your own .git dir.
for f in $(ls -d githooks/*); do
rm .git/hooks/$(basename $f)
ln -s ../../$f .git/hooks/$(basename $f)
done && ls -al .git/hooks | grep githooks
|
Update testing script to show unit-test output | #! /bin/bash
echo "Call Unit Test"
cd $TRAVIS_BUILD_DIR
cd build
if make test > /dev/null; then
exit 0
fi
exit -1
# Test output are only shown if failure happened | #! /bin/bash
echo "Call Unit Test"
cd $TRAVIS_BUILD_DIR/build
make test |
Fix error in comment (wrong project) | #!/bin/bash -xe
# Build oc_erchef. If building a release tag, create a tarball and upload to
# s3. To customize for another project, you should only need to edit
# PROJ_NAME and the make command.
PROJ_NAME=oc_bifrost
export PATH=$PATH:/usr/local/bin
jenkins/builder_info.rb
source machine_info
ARTIFACT_BASE=opscode-ci/artifacts/$os/$machine/$PROJ_NAME
make distclean rel || exit 1
# If the string is null, then the git command returned false
if git describe --tags --match='[0-9]*.[0-9]*.[0-9]*' --exact-match
then
VERSION=$(git describe --tags --exact-match --match='[0-9]*.[0-9]*.[0-9]*')
PACKAGE=${PROJ_NAME_}${VERSION}.tar.gz
cd rel
tar zcvf $PACKAGE $PROJ_NAME/
s3cmd put --progress $PACKAGE s3://$ARTIFACT_BASE/$PACKAGE
else
REL_VERSION=`cat rel/reltool.config|grep '{rel,.*"oc_bifrost"'|cut -d ',' -f 3|sed 's/"//g'`
GIT_SHA=`git rev-parse --short HEAD`
VERSION=${REL_VERSION}-${GIT_SHA}
PACKAGE=${PROJ_NAME_}${VERSION}.tar.gz
cd rel
tar zcvf $PACKAGE $PROJ_NAME/
s3cmd put --progress $PACKAGE s3://$ARTIFACT_BASE/$PACKAGE
fi
| #!/bin/bash -xe
# Build oc_bifrost. If building a release tag, create a tarball and upload to
# s3. To customize for another project, you should only need to edit
# PROJ_NAME and the make command.
PROJ_NAME=oc_bifrost
export PATH=$PATH:/usr/local/bin
jenkins/builder_info.rb
source machine_info
ARTIFACT_BASE=opscode-ci/artifacts/$os/$machine/$PROJ_NAME
make distclean rel || exit 1
# If the string is null, then the git command returned false
if git describe --tags --match='[0-9]*.[0-9]*.[0-9]*' --exact-match
then
VERSION=$(git describe --tags --exact-match --match='[0-9]*.[0-9]*.[0-9]*')
PACKAGE=${PROJ_NAME_}${VERSION}.tar.gz
cd rel
tar zcvf $PACKAGE $PROJ_NAME/
s3cmd put --progress $PACKAGE s3://$ARTIFACT_BASE/$PACKAGE
else
REL_VERSION=`cat rel/reltool.config|grep '{rel,.*"oc_bifrost"'|cut -d ',' -f 3|sed 's/"//g'`
GIT_SHA=`git rev-parse --short HEAD`
VERSION=${REL_VERSION}-${GIT_SHA}
PACKAGE=${PROJ_NAME_}${VERSION}.tar.gz
cd rel
tar zcvf $PACKAGE $PROJ_NAME/
s3cmd put --progress $PACKAGE s3://$ARTIFACT_BASE/$PACKAGE
fi
|
Use sha256 instead of sha1 to generate tarball hashes. | #!/bin/bash
SHA=$(curl -s http://download.redis.io/releases/redis-${1}.tar.gz | shasum | cut -f 1 -d' ')
ENTRY="hash redis-${1}.tar.gz sha1 $SHA http://download.redis.io/releases/redis-${1}.tar.gz"
echo $ENTRY >> ~/hack/redis-hashes/README
vi ~/hack/redis-hashes/README
echo "Press any key to commit, Ctrl-C to abort)."
read yes
(cd ~/hack/redis-hashes; git commit -a -m "${1} hash."; git push)
| #!/bin/bash
SHA=$(curl -s http://download.redis.io/releases/redis-${1}.tar.gz | shasum -a 256 | cut -f 1 -d' ')
ENTRY="hash redis-${1}.tar.gz sha256 $SHA http://download.redis.io/releases/redis-${1}.tar.gz"
echo $ENTRY >> ~/hack/redis-hashes/README
vi ~/hack/redis-hashes/README
echo "Press any key to commit, Ctrl-C to abort)."
read yes
(cd ~/hack/redis-hashes; git commit -a -m "${1} hash."; git push)
|
Fix travis script for new directory structure. | set -ex
export CHROME_BIN=chromium-browser
export DISPLAY=:99.0
source ~/.nvm/nvm.sh
nvm use "v$TRAVIS_NODE_VERSION"
nvm alias default "v$TRAVIS_NODE_VERSION"
sh -e /etc/init.d/xvfb start
cd packages/base
npm run test:unit:$BROWSER
cd ..
cd packages/controls
npm run test:unit:$BROWSER
cd ..
cd packages/html-manager
npm run test:unit:$BROWSER
cd ..
cd examples/web1
npm run test:firefox
cd ../../
| set -ex
export CHROME_BIN=chromium-browser
export DISPLAY=:99.0
source ~/.nvm/nvm.sh
nvm use "v$TRAVIS_NODE_VERSION"
nvm alias default "v$TRAVIS_NODE_VERSION"
sh -e /etc/init.d/xvfb start
cd packages
cd base
npm run test:unit:$BROWSER
cd ..
cd controls
npm run test:unit:$BROWSER
cd ..
cd html-manager
npm run test:unit:$BROWSER
cd ..
cd ..
cd examples/web1
npm run test:firefox
cd ../..
|
Fix os one hour upgrade window for Linux | #!/bin/bash
#
# This file handles upgrades to the operating system on the Blimp
#
DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "${DIR}/init.bash"
echo "====================================================================="
echo "`date "+%F %T"` Checking on upgrades for operating system ..."
echo "====================================================================="
timestamp="$CF_VAR/last-os-upgrade.timestamp"
upgraded_p=""
function upgrade_and_update {
touch $timestamp
apt-get -y update
apt-get -y upgrade
upgraded_p="t"
}
if [ -r $timestamp ]; then
if [ -z $(find "$timestamp" -mtime -60m) ] ; then
upgrade_and_update
fi
else
upgrade_and_update
fi
if [[ -z "$upgraded_p" ]]; then
echo Upgrading finished.
else
echo Skipped upgrade because previous engineroom OS upgrade occurred less than an hour ago.
fi
echo "==============================================================="
echo "`date "+%F %T"` Finished operating system upgrade check"
echo "==============================================================="
| #!/bin/bash
#
# This file handles upgrades to the operating system on the Blimp
#
DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "${DIR}/init.bash"
echo "====================================================================="
echo "`date "+%F %T"` Checking on upgrades for operating system ..."
echo "====================================================================="
timestamp="$CF_VAR/last-os-upgrade.timestamp"
upgraded_p=""
function upgrade_and_update {
touch $timestamp
apt-get -y update
apt-get -y upgrade
upgraded_p="t"
}
if [ -r $timestamp ]; then
if [ -z $(find "$timestamp" -mtime -1) ] ; then
upgrade_and_update
fi
else
upgrade_and_update
fi
if [[ -z "$upgraded_p" ]]; then
echo Upgrading finished.
else
echo Skipped upgrade because previous engineroom OS upgrade occurred less than an hour ago.
fi
echo "==============================================================="
echo "`date "+%F %T"` Finished operating system upgrade check"
echo "==============================================================="
|
Stop using single user mode, when setting up database | #!/bin/bash
set -e
echo "CREATE USER '$OSM_USER';"
gosu postgres postgres --single -jE <<-EOL
CREATE USER "$OSM_USER";
EOL
echo "CREATE DATABASE '$OSM_DB';"
gosu postgres postgres --single -jE <<-EOL
CREATE DATABASE "$OSM_DB";
EOL
echo "GRANT ALL ON DATABASE '$OSM_DB' TO '$OSM_USER';"
gosu postgres postgres --single -jE <<-EOL
GRANT ALL ON DATABASE "$OSM_DB" TO "$OSM_USER";
EOL
# Postgis extension cannot be created in single user mode.
# So we will do it the kludge way by starting the server,
# updating the DB, then shutting down the server so the
# rest of the docker-postgres init scripts can finish.
echo "Starting postrges ..."
gosu postgres pg_ctl -w start
echo "CREATE EXTENSION postgis, hstore + ALTER TABLEs"
gosu postgres psql "$OSM_DB" <<-EOL
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;
ALTER TABLE geometry_columns OWNER TO "$OSM_USER";
ALTER TABLE spatial_ref_sys OWNER TO "$OSM_USER";
EOL
echo "Stopping postgres ..."
gosu postgres pg_ctl stop
| #!/bin/bash
set -e
echo "CREATE USER '$OSM_USER';"
gosu postgres psql <<-EOL
CREATE USER "$OSM_USER";
EOL
echo "CREATE DATABASE '$OSM_DB';"
gosu postgres psql <<-EOL
CREATE DATABASE "$OSM_DB";
EOL
echo "GRANT ALL ON DATABASE '$OSM_DB' TO '$OSM_USER';"
gosu postgres psql <<-EOL
GRANT ALL ON DATABASE "$OSM_DB" TO "$OSM_USER";
EOL
# Postgis extension cannot be created in single user mode.
# So we will do it the kludge way by starting the server,
# updating the DB, then shutting down the server so the
# rest of the docker-postgres init scripts can finish.
# echo "Starting postrges ..."
# gosu postgres pg_ctl -w start
echo "CREATE EXTENSION postgis, hstore + ALTER TABLEs"
gosu postgres psql "$OSM_DB" <<-EOL
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;
ALTER TABLE geometry_columns OWNER TO "$OSM_USER";
ALTER TABLE spatial_ref_sys OWNER TO "$OSM_USER";
EOL
# echo "Stopping postgres ..."
# gosu postgres pg_ctl stop
|
Fix some copy in bash script | #!/bin/bash
export NODE_ENV=${OVERRIDE_NODE_ENV:-$NODE_ENV}
export AWS_ACCESS_KEY_ID=${OVERRIDE_AWS_ACCESS_KEY_ID:-$AWS_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY=${OVERRIDE_AWS_SECRET_ACCESS_KEY:-$AWS_SECRET_ACCESS_KEY}
export FLOW_TOKEN=${OVERRIDE_FLOW_TOKEN:-$FLOW_TOKEN}
echo "NODE_ENV is $NODE_ENV"
echo "AWS_ACCESS_KEY_ID is ${AWS_ACCESS_KEY_ID:(-4)}"
echo "AWS_SECRET_ACCESS_KEY is ${AWS_SECRET_ACCESS_KEY:(-4)}"
echo "FLOW_TOKEN is ${FLOW_TOKEN:(-4)}"
rm -rf dist
gulp dist
gulp s3-deployandnotify
| #!/bin/bash
export NODE_ENV=${OVERRIDE_NODE_ENV:-$NODE_ENV}
export AWS_ACCESS_KEY_ID=${OVERRIDE_AWS_ACCESS_KEY_ID:-$AWS_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY=${OVERRIDE_AWS_SECRET_ACCESS_KEY:-$AWS_SECRET_ACCESS_KEY}
export FLOW_TOKEN=${OVERRIDE_FLOW_TOKEN:-$FLOW_TOKEN}
echo "NODE_ENV is $NODE_ENV"
echo "AWS_ACCESS_KEY_ID ends ${AWS_ACCESS_KEY_ID:(-4)}"
echo "AWS_SECRET_ACCESS_KEY ends ${AWS_SECRET_ACCESS_KEY:(-4)}"
echo "FLOW_TOKEN ends ${FLOW_TOKEN:(-4)}"
rm -rf dist
gulp dist
gulp s3-deployandnotify
|
Fix snap once and for all | #!/bin/bash
set -e
# tl;dr npm i -g with current src as tarball
. scripts/tarball.sh
#inst="$npm_config_prefix"
#[ -z "$inst" ] && inst="/usr"
#inst="$inst/lib/node_modules"
rm -rf .pkg
mkdir .pkg
for f in package* zeronet.js lib .gitignore LICENSE; do cp -r $f .pkg; done
ver=$(echo $(cat package.json | grep "version" | sed "s|\"||g" | sed "s| ||g" | grep " .*" -o) | sed "s|,||g")
cd .pkg
for f in package*; do sed -r 's|"([a-z-]+)": "file:(.*)"|"\1": "file:../../\2.tar.gz"|g' -i $f; done
ex_re
tar cvfz ../znjs.tar.gz $ex --mode="777" . | sed "s|^|zeronet-js: |g"
mv ../znjs.tar.gz .
npm i ./znjs.tar.gz --production -g
| #!/bin/bash
set -e
# tl;dr npm i -g with current src as tarball
. scripts/tarball.sh
#inst="$npm_config_prefix"
#[ -z "$inst" ] && inst="/usr"
#inst="$inst/lib/node_modules"
rm -rf .pkg
mkdir .pkg
for f in package* zeronet.js lib .gitignore LICENSE; do cp -r $f .pkg; done
ver=$(echo $(cat package.json | grep "version" | sed "s|\"||g" | sed "s| ||g" | grep " .*" -o) | sed "s|,||g")
cd .pkg
for f in package*; do sed -r 's|"([a-z-]+)": "file:(.*)"|"\1": "file:../../\2.tar.gz"|g' -i $f; done
ex_re
tar cvfz ../znjs.tar.gz $ex --mode="777" . | sed "s|^|zeronet-js: |g"
mv ../znjs.tar.gz .
npm i ./znjs.tar.gz --unsafe-perm --production -g
|
Set GOROOT depending on which of the likely two paths exists. | #!/usr/bin/env bash
# Set up Go paths
export GOPATH="$HOME/go"
export GOROOT="/usr/local/opt/go/libexec"
add-path "$GOPATH/bin" "$GOROOT/bin"
| #!/usr/bin/env bash
# Set up Go paths
for goroot in /usr/local/go /usr/local/opt/go/libexec; do
if [ -d "$goroot" ]; then
export GOROOT="$goroot"
add-path "$GOROOT/bin"
break
fi
done
export GOPATH="$HOME/go"
add-path "$GOPATH/bin" "$GOROOT/bin"
|
Add alias for kernel function profiling | # 'du space' Show first 30 folders that use most space.
alias dus='du -h --max-depth=1 2>/dev/null | sort -r -h | head -n 30'
| # 'du space' Show first 30 folders that use most space.
alias dus='du -h --max-depth=1 2>/dev/null | sort -r -h | head -n 30'
# List kernel functions with most CPU time spend.
perf record -g -a sleep 3 && perf report
|
Add cdd cddd cdddd and cddddd | alias fig='find . | grep'
alias ll='ls -alh --group-directories-first'
alias rmf='sudo rm -rf'
alias dfh='df -h'
alias duh='du -sch'
alias psg='ps aux | grep'
alias gi='grep -i'
alias gri='grep -rinI'
alias free='free -h'
alias ssh='ssh -X'
alias wchere='cat $(find .) 2>/dev/null | wc'
alias eg='env | grep -i'
| alias fig='find . | grep'
alias ll='ls -alh --group-directories-first'
alias rmf='sudo rm -rf'
alias dfh='df -h'
alias duh='du -sch'
alias psg='ps aux | grep'
alias gi='grep -i'
alias gri='grep -rinI'
alias free='free -h'
alias ssh='ssh -X'
alias wchere='cat $(find .) 2>/dev/null | wc'
alias eg='env | grep -i'
alias cdd='cd ..'
alias cddd='cd ../..'
alias cdddd='cd ../../..'
alias cddddd='cd ../../../..'
|
Update double-conversion import script to record prior import | #!/usr/bin/env bash
set -e
set -x
shopt -s dotglob
readonly name="DoubleConversion"
readonly ownership="Google double-conversion Maintainers <floitsch@google.com>"
readonly subtree="Modules/ThirdParty/DoubleConversion/src/double-conversion"
readonly repo="https://github.com/google/double-conversion"
readonly tag="master"
readonly paths="
double-conversion/*.h
double-conversion/*.cc
"
extract_source () {
git_archive
pushd "${extractdir}/${name}-reduced"
mv double-conversion/* .
rmdir double-conversion
echo "* -whitespace" >> .gitattributes
popd
}
. "${BASH_SOURCE%/*}/../../../Utilities/Maintenance/update-third-party.bash"
| #!/usr/bin/env bash
set -e
set -x
shopt -s dotglob
readonly name="DoubleConversion"
readonly ownership="Google double-conversion Maintainers <floitsch@google.com>"
readonly subtree="Modules/ThirdParty/DoubleConversion/src/double-conversion"
readonly repo="https://github.com/google/double-conversion"
readonly tag="0d3733a4168dd739f45cef8a55718f8b02ee3073"
readonly paths="
double-conversion/*.h
double-conversion/*.cc
"
extract_source () {
git_archive
pushd "${extractdir}/${name}-reduced"
mv double-conversion/* .
rmdir double-conversion
echo "* -whitespace" >> .gitattributes
popd
}
. "${BASH_SOURCE%/*}/../../../Utilities/Maintenance/update-third-party.bash"
|
Remove cloudsql proxy for now. | #!/bin/bash
source $KOKORO_GFILE_DIR/secrets.sh
sudo apt-get update
sudo apt-get install realpath wget
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64
# Unsure about the following section because of Ruby image
mv cloud_sql_proxy.linux.amd64 $HOME/cloud_sql_proxy
chmod +x $HOME/cloud_sql_proxy
sudo mkdir /cloudsql && sudo chmod 0777 /cloudsql
cd github/ruby-docs-samples/
./spec/kokoro-run-all.sh
| #!/bin/bash
source $KOKORO_GFILE_DIR/secrets.sh
cd github/ruby-docs-samples/
./spec/kokoro-run-all.sh
|
Check OCLint: Check source code of C++ template | @INCLUDE_COMMON@
echo
echo CHECK SOURCE WITH OCLINT
echo
command -v oclint >/dev/null 2>&1 || { echo "Could not locate OCLint" >&2; exit 0; }
test -f "@PROJECT_BINARY_DIR@/compile_commands.json" || { echo "Compilation database not found" >&2; exit 0; }
cd "@CMAKE_SOURCE_DIR@" || exit
oclint -p "@PROJECT_BINARY_DIR@" -enable-global-analysis -enable-clang-static-analyzer \
"src/libs/ease/array.c" \
"src/libs/ease/keyname.c" \
"src/libs/utility/text.c" \
"src/plugins/base64/"*.c \
"src/plugins/camel/camel.c" \
"src/plugins/ccode/"*.cpp \
"src/plugins/directoryvalue/"*.c \
"src/plugins/mini/mini.c" \
"src/plugins/yamlcpp/"*.{c,cpp} \
"src/plugins/yamlsmith/"*.{c,cpp} \
"src/plugins/yanlr/"*.{c,cpp}
exit_if_fail "OCLint found problematic code"
end_script
| @INCLUDE_COMMON@
echo
echo CHECK SOURCE WITH OCLINT
echo
command -v oclint >/dev/null 2>&1 || { echo "Could not locate OCLint" >&2; exit 0; }
test -f "@PROJECT_BINARY_DIR@/compile_commands.json" || { echo "Compilation database not found" >&2; exit 0; }
cd "@CMAKE_SOURCE_DIR@" || exit
oclint -p "@PROJECT_BINARY_DIR@" -enable-global-analysis -enable-clang-static-analyzer \
"src/libs/ease/array.c" \
"src/libs/ease/keyname.c" \
"src/libs/utility/text.c" \
"src/plugins/base64/"*.c \
"src/plugins/camel/camel.c" \
"src/plugins/ccode/"*.cpp \
"src/plugins/cpptemplate/"*.cpp \
"src/plugins/directoryvalue/"*.c \
"src/plugins/mini/mini.c" \
"src/plugins/yamlcpp/"*.{c,cpp} \
"src/plugins/yamlsmith/"*.{c,cpp} \
"src/plugins/yanlr/"*.{c,cpp}
exit_if_fail "OCLint found problematic code"
end_script
|
Add backward compatibility for --no-tex-ligatures | #!/bin/bash -eux
exec pandoc ${@//--latex-engine/--pdf-engine}
| #!/bin/bash -eux
##
## Backward compatibility with Pandoc 1.x command lines
##
## 1. --latex-engine becomes --pdf-engine
## 2. --no-tex-ligatures becomes --from markdown-smart
##
exec pandoc $(sed -e's/--latex-engine/--pdf-engine/; s/--no-tex-ligatures/--from markdown-smart/' <<< $@) |
Remove host limit on post_deploy | #!/usr/bin/env bash
set -o errexit
set -o pipefail
SCRIPT_DIR="$(dirname ${BASH_SOURCE[0]})"
USED_OS="${1}"
WORK_DIR="${SCRIPT_DIR}/../workdir"
. ${SCRIPT_DIR}/install_kargo.sh
tweak_group_vars() {
sed -i "s/bootstrap_os: .*/bootstrap_os: ${USED_OS}/" ./mvp_inventory/group_vars/all.yml
}
pushd ${WORK_DIR}
get_kargo
setup_playbook
tweak_group_vars ${USED_OS}
ansible_verbosity=""
if [ "${DEBUG}" == "true" ]; then
ansible_verbosity="-vv"
fi
echo "============================"
echo "Running Kargo"
echo "============================"
ansible-playbook --connection=ssh --timeout=30 --limit=all --inventory-file=./mvp_inventory/ --sudo ${ansible_verbosity} cluster.yml
echo ""
echo "============================"
echo "Running post deploy"
echo "============================"
ansible-playbook --connection=ssh --timeout=30 --limit=all --inventory-file=./mvp_inventory/ --sudo ${ansible_verbosity} post_deploy.yml
popd
| #!/usr/bin/env bash
set -o errexit
set -o pipefail
SCRIPT_DIR="$(dirname ${BASH_SOURCE[0]})"
USED_OS="${1}"
WORK_DIR="${SCRIPT_DIR}/../workdir"
. ${SCRIPT_DIR}/install_kargo.sh
tweak_group_vars() {
sed -i "s/bootstrap_os: .*/bootstrap_os: ${USED_OS}/" ./mvp_inventory/group_vars/all.yml
}
pushd ${WORK_DIR}
get_kargo
setup_playbook
tweak_group_vars ${USED_OS}
ansible_verbosity=""
if [ "${DEBUG}" == "true" ]; then
ansible_verbosity="-vv"
fi
echo "============================"
echo "Running Kargo"
echo "============================"
ansible-playbook --connection=ssh --timeout=30 --limit=all --inventory-file=./mvp_inventory/ --sudo ${ansible_verbosity} cluster.yml
echo ""
echo "============================"
echo "Running post deploy"
echo "============================"
ansible-playbook --connection=ssh --timeout=30 --inventory-file=./mvp_inventory/ --sudo ${ansible_verbosity} post_deploy.yml
popd
|
Fix APP_PATH space and zip command error | #!/bin/sh
echo "Inside after-script"
read -r -a e < /tmp/tempout
PROVISIONING_TYPE="${e[2]}"
./scripts/remove-key.sh
ls -la /Users/travis/build/fyhao/tns-webform-client/platforms/ios/build/device/
APP_PATH="$APP_NAME.ipa"
if test "$PROVISIONING_TYPE" = '0'; then
APP_PATH="$APP_NAME.app"
fi
## TO_ZIP_FILE: 0 = .ipa file, 1 = .zip file
TO_ZIP_FILE="1"
if test "$TO_ZIP_FILE" = '1'; then
zip -r "$APP_NAME.zip" "$APP_NAME*"
APP_PATH = "$APP_NAME.zip"
fi
echo "APP_PATH=$APP_PATH"
curl -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/$APP_PATH?overwrite=true --data-binary "@/Users/travis/build/fyhao/tns-webform-client/platforms/ios/build/device/$APP_PATH" | #!/bin/sh
echo "Inside after-script"
read -r -a e < /tmp/tempout
PROVISIONING_TYPE="${e[2]}"
./scripts/remove-key.sh
ls -la /Users/travis/build/fyhao/tns-webform-client/platforms/ios/build/device/
APP_PATH="$APP_NAME.ipa"
if test "$PROVISIONING_TYPE" = '0'; then
APP_PATH="$APP_NAME.app"
fi
## TO_ZIP_FILE: 0 = .ipa file, 1 = .zip file
TO_ZIP_FILE="1"
if test "$TO_ZIP_FILE" = '1'; then
zip -r "$APP_NAME.zip" . -i "$APP_NAME*"
APP_PATH="$APP_NAME.zip"
fi
echo "APP_PATH=$APP_PATH"
curl -u $SAUCE_USERNAME:$SAUCE_ACCESS_KEY -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/$SAUCE_USERNAME/$APP_PATH?overwrite=true --data-binary "@/Users/travis/build/fyhao/tns-webform-client/platforms/ios/build/device/$APP_PATH" |
Add docker email to docker deploy script | #!/bin/bash
set -e
docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
docker pull rabblerouser/rabblerouser-core
docker build -t rabblerouser/rabblerouser-core backend
docker push rabblerouser/rabblerouser-core
| #!/bin/bash
set -e
docker login -e "$DOCKER_EMAIL" -u "$DOCKER_USER" -p "$DOCKER_PASSWORD"
docker pull rabblerouser/rabblerouser-core
docker build -t rabblerouser/rabblerouser-core backend
docker push rabblerouser/rabblerouser-core
|
Add notice to docs that only sha1 is currently supported | #! /usr/bin/env sh
# Private key generated with:
openssl genrsa -out key.pem 4096
# Public certificate generated with:
openssl req -nodes -new -x509 -key key.pem -out cert.pem -days 365
# Signature generated with:
openssl dgst -sign key.pem -sha1 server/main.js | xxd -p > server/main.js.sig
# See local/example.html
| #! /usr/bin/env sh
# Private key generated with:
openssl genrsa -out key.pem 4096
# Public certificate generated with:
openssl req -nodes -new -x509 -key key.pem -out cert.pem -days 365
# Signature generated with (currently only sha1 is supported):
openssl dgst -sign key.pem -sha1 server/main.js | xxd -p > server/main.js.sig
# See local/example.html
|
Remove quotes around GUNICORN_DEBUG_ARGS when running gunicorn | #!/usr/bin/env bash
set -eu
function log {
echo "$(date +"%T") - START INFO - $*"
}
_term() {
echo "Caught SIGTERM signal!"
kill -TERM "$child" 2>/dev/null
}
trap _term SIGTERM
log Migrating
if [ ! -f "/var/akvo/rsr/mediaroot/fake-migration-flag" ]; then
log Running fake initial migrations
python manage.py migrate --fake-initial --noinput;
touch "/var/akvo/rsr/mediaroot/fake-migration-flag";
fi
python manage.py migrate --noinput
log Adding to crontab
python manage.py crontab add
log Making all environment vars available to cron jobs
env >> /etc/environment
log Starting cron
/usr/sbin/cron
log Starting gunicorn in background
gunicorn akvo.wsgi "${GUNICORN_DEBUG_ARGS:-}" --max-requests 200 --workers 5 --timeout 300 --bind 0.0.0.0:8000 &
child=$!
wait "$child" | #!/usr/bin/env bash
set -eu
function log {
echo "$(date +"%T") - START INFO - $*"
}
_term() {
echo "Caught SIGTERM signal!"
kill -TERM "$child" 2>/dev/null
}
trap _term SIGTERM
log Migrating
if [ ! -f "/var/akvo/rsr/mediaroot/fake-migration-flag" ]; then
log Running fake initial migrations
python manage.py migrate --fake-initial --noinput;
touch "/var/akvo/rsr/mediaroot/fake-migration-flag";
fi
python manage.py migrate --noinput
log Adding to crontab
python manage.py crontab add
log Making all environment vars available to cron jobs
env >> /etc/environment
log Starting cron
/usr/sbin/cron
log Starting gunicorn in background
gunicorn akvo.wsgi ${GUNICORN_DEBUG_ARGS:-} --max-requests 200 --workers 5 --timeout 300 --bind 0.0.0.0:8000 &
child=$!
wait "$child" |
Make ll alias run 'gls -al' instead of just 'gls -l'. | # grc overides for ls
# Made possible through contributions from generous benefactors like
# `brew install coreutils`
if $(gls &>/dev/null)
then
alias ls="gls -F --color"
alias l="gls -lAh --color"
alias ll="gls -l --color"
alias la='gls -A --color'
fi
alias ..='cd ..'
| # grc overides for ls
# Made possible through contributions from generous benefactors like
# `brew install coreutils`
if $(gls &>/dev/null)
then
alias ls="gls -F --color"
alias l="gls -lAh --color"
alias ll="gls -al --color"
alias la='gls -A --color'
fi
alias ..='cd ..'
|
Disable CircleCI release builds for now | #!/bin/bash
# This script will build the project.
SWITCHES="-s --console=plain"
if [ $CIRCLE_PR_NUMBER ]; then
echo -e "Build Pull Request #$CIRCLE_PR_NUMBER => Branch [$CIRCLE_BRANCH]"
./gradlew clean build $SWITCHES
elif [ -z $CIRCLE_TAG ]; then
echo -e ?'Build Branch with Snapshot => Branch ['$CIRCLE_BRANCH']'
openssl aes-256-cbc -d -in gradle.properties.enc -out gradle.properties -k $KEY
./gradlew clean build $SWITCHES
elif [ $CIRCLE_TAG ]; then
echo -e 'Build Branch for Release => Branch ['$CIRCLE_BRANCH'] Tag ['$CIRCLE_TAG']'
openssl aes-256-cbc -d -in gradle.properties.enc -out gradle.properties -k $KEY
case "$CIRCLE_TAG" in
*-rc\.*)
./gradlew -Prelease.disableGitChecks=true -Prelease.useLastTag=true clean build candidate $SWITCHES
;;
*)
./gradlew -Prelease.disableGitChecks=true -Prelease.useLastTag=true clean build final $SWITCHES
;;
esac
else
echo -e 'WARN: Should not be here => Branch ['$CIRCLE_BRANCH'] Tag ['$CIRCLE_TAG'] Pull Request ['$CIRCLE_PR_NUMBER']'
./gradlew clean build $SWITCHES
fi
EXIT=$?
exit $EXIT | #!/bin/bash
# This script will build the project.
SWITCHES="-s --console=plain"
if [ $CIRCLE_PR_NUMBER ]; then
echo -e "Build Pull Request #$CIRCLE_PR_NUMBER => Branch [$CIRCLE_BRANCH]"
./gradlew clean build $SWITCHES
elif [ -z $CIRCLE_TAG ]; then
echo -e ?'Build Branch with Snapshot => Branch ['$CIRCLE_BRANCH']'
openssl aes-256-cbc -d -in gradle.properties.enc -out gradle.properties -k $KEY
./gradlew clean build $SWITCHES
elif [ $CIRCLE_TAG ]; then
echo "Release builds are disabled until we can work out CircleCI timeouts"
# echo -e 'Build Branch for Release => Branch ['$CIRCLE_BRANCH'] Tag ['$CIRCLE_TAG']'
# openssl aes-256-cbc -d -in gradle.properties.enc -out gradle.properties -k $KEY
# case "$CIRCLE_TAG" in
# *-rc\.*)
# ./gradlew -Prelease.disableGitChecks=true -Prelease.useLastTag=true clean build candidate $SWITCHES
# ;;
# *)
# ./gradlew -Prelease.disableGitChecks=true -Prelease.useLastTag=true clean build final $SWITCHES
# ;;
# esac
else
echo -e 'WARN: Should not be here => Branch ['$CIRCLE_BRANCH'] Tag ['$CIRCLE_TAG'] Pull Request ['$CIRCLE_PR_NUMBER']'
./gradlew clean build $SWITCHES
fi
EXIT=$?
exit $EXIT |
Put rpm --import inside sudo | #!/bin/bash
# Determine package manager
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
if [[ "$YUM_CMD" != "" ]]; then
sudo yum install -y libvirt libvirt-devel libvirt-daemon-kvm syslinux-tftpboot device-mapper-libs qemu-kvm net-tools;
sudo yum upgrade -y "device-mapper-libs";
rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc;
sudo yum install -y --nogpg rabbitmq-server;
elif [[ "$APT_GET_CMD" != "" ]]; then
sudo apt-get -y install libvirt-bin libvirt-dev syslinux pxelinux rabbitmq-server qemu-kvm net-tools;
sudo systemctl stop rabbitmq-server
sudo systemctl disable rabbitmq-server
else
echo "Error: Package manager was not found. Cannot continue with the installation.";
exit 1;
fi
which solvent > /dev/null || (echo "Error: solvent was not found. Please install it first." && exit 1)
./sh/install_inaugurator.sh
| #!/bin/bash
# Determine package manager
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
if [[ "$YUM_CMD" != "" ]]; then
sudo yum install -y libvirt libvirt-devel libvirt-daemon-kvm syslinux-tftpboot device-mapper-libs qemu-kvm net-tools;
sudo yum upgrade -y "device-mapper-libs";
sudo rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc;
sudo yum install -y --nogpg rabbitmq-server;
elif [[ "$APT_GET_CMD" != "" ]]; then
sudo apt-get -y install libvirt-bin libvirt-dev syslinux pxelinux rabbitmq-server qemu-kvm net-tools;
sudo systemctl stop rabbitmq-server
sudo systemctl disable rabbitmq-server
else
echo "Error: Package manager was not found. Cannot continue with the installation.";
exit 1;
fi
which solvent > /dev/null || (echo "Error: solvent was not found. Please install it first." && exit 1)
./sh/install_inaugurator.sh
|
Simplify `if' into oneliner, allow spaces in HISTFILE | ## Command history configuration
if [ -z "$HISTFILE" ]; then
HISTFILE=$HOME/.zsh_history
fi
HISTSIZE=10000
SAVEHIST=10000
## History wrapper
function omz_history {
# Delete the history file if `-c' argument provided.
# This won't affect the `history' command output until the next login.
if [[ "${@[(i)-c]}" -le $# ]]; then
echo -n >| "$HISTFILE"
echo >&2 History file deleted. Reload the session to see its effects.
else
fc $@ -l 1
fi
}
# Timestamp format
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='omz_history' ;;
esac
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history # share command history data
| ## Command history configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000
SAVEHIST=10000
## History wrapper
function omz_history {
# Delete the history file if `-c' argument provided.
# This won't affect the `history' command output until the next login.
if [[ "${@[(i)-c]}" -le $# ]]; then
echo -n >| "$HISTFILE"
echo >&2 History file deleted. Reload the session to see its effects.
else
fc $@ -l 1
fi
}
# Timestamp format
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='omz_history' ;;
esac
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history # share command history data
|
Add comment about im+gs requirements in print-to-pdf | #!/bin/sh
set -e
PDF=$1
TEMP_DIR=$(mktemp -d)
echo $TEMP_DIR
echo "Converting $PDF to JEPGs..."
convert -density 150 -colorspace sRGB "$PDF" +adjoin -background white "$TEMP_DIR/$PDF-%04d.png"
for i in $TEMP_DIR/*.png; do sips -s format jpeg -s formatOptions 70 "${i}" --out "${i%png}jpg"; done
cp $TEMP_DIR/*.jpg .
rm -rf $TEMP_DIR
| #!/bin/sh
set -e
PDF=$1
TEMP_DIR=$(mktemp -d)
echo $TEMP_DIR
echo "Converting $PDF to JEPGs..."
# This requires imagemagick and ghostscript to be installed
convert -density 150 -colorspace sRGB "$PDF" +adjoin -background white "$TEMP_DIR/$PDF-%04d.png"
for i in $TEMP_DIR/*.png; do sips -s format jpeg -s formatOptions 70 "${i}" --out "${i%png}jpg"; done
cp $TEMP_DIR/*.jpg .
rm -rf $TEMP_DIR
|
Reduce Travis slow test timeout by a minute | #! /usr/bin/env bash
# Exit on error
set -e
# Echo each command
set -x
if [[ "${TEST_SPHINX}" == "true" ]]; then
cd doc
make html-errors
make clean
make latex
cd _build/latex
export LATEXOPTIONS="-interaction=nonstopmode"
make all
else
# We change directories to make sure that we test the installed version of
# sympy.
mkdir empty
cd empty
if [[ "${TEST_DOCTESTS}" == "true" ]]; then
cat << EOF | python
import sympy
if not sympy.doctest():
raise Exception('Tests failed')
EOF
cd ..
bin/doctest doc/
elif [[ "${TEST_SLOW}" == "true" ]]; then
cat << EOF | python
import sympy
if not sympy.test(slow=True, timeout=300):
# Travis times out if no activity is seen for 10 minutes. It also times
# out if the whole tests run for more than 50 minutes.
raise Exception('Tests failed')
EOF
elif [[ "${TEST_THEANO}" == "true" ]]; then
cat << EOF | python
import sympy
if not sympy.test('*theano*'):
raise Exception('Tests failed')
EOF
else
cat << EOF | python
import sympy
if not sympy.test():
raise Exception('Tests failed')
EOF
fi
fi
| #! /usr/bin/env bash
# Exit on error
set -e
# Echo each command
set -x
if [[ "${TEST_SPHINX}" == "true" ]]; then
cd doc
make html-errors
make clean
make latex
cd _build/latex
export LATEXOPTIONS="-interaction=nonstopmode"
make all
else
# We change directories to make sure that we test the installed version of
# sympy.
mkdir empty
cd empty
if [[ "${TEST_DOCTESTS}" == "true" ]]; then
cat << EOF | python
import sympy
if not sympy.doctest():
raise Exception('Tests failed')
EOF
cd ..
bin/doctest doc/
elif [[ "${TEST_SLOW}" == "true" ]]; then
cat << EOF | python
import sympy
if not sympy.test(slow=True, timeout=240):
# Travis times out if no activity is seen for 10 minutes. It also times
# out if the whole tests run for more than 50 minutes.
raise Exception('Tests failed')
EOF
elif [[ "${TEST_THEANO}" == "true" ]]; then
cat << EOF | python
import sympy
if not sympy.test('*theano*'):
raise Exception('Tests failed')
EOF
else
cat << EOF | python
import sympy
if not sympy.test():
raise Exception('Tests failed')
EOF
fi
fi
|
Drop Python 2 unittests from test suite runner | #!/usr/bin/env bash
# Run the test suite.
python2 -m unittest discover -v &&
python3 -m unittest discover -v
| #!/usr/bin/env bash
# Run the test suite.
python3 -m unittest discover -v
|
Use environment variables to load the layer under test. | #!/usr/bin/env bash
#
# This script generates sample output for a performance layer. The arguments
# must be the json manifest for the layer, the environment variable name which
# tells the layer where to log, and the desired output file.
#
# NOTE: the layer libraries must be available to the runtime environment (ex.
# via LD_LIBRARY_PATH). Running this script from the build directory usually is
# sufficient.
#
# Usage:
# gen_sample_output.sh path/to/VkLayer_stadia_XXX.json VK_XXX_LOG path/to/output
set -e
JSON="${1?}"
LOGVAR="${2?}"
OUTPUT="${3?}"
ENABLE=$(grep ENABLE "${JSON?}" | sed -e 's/"//g' -e 's/ //g' -e 's/:.*//')
cp "${JSON?}" ~/.local/share/vulkan/implicit_layer.d
printf -v "${ENABLE?}" "1"
printf -v "${LOGVAR?}" "${OUTPUT?}"
export "${ENABLE?}"
export "${LOGVAR?}"
vkcube --c 10
| #!/usr/bin/env bash
#
# This script generates sample output for a performance layer. The arguments
# must be the json manifest for the layer, the environment variable name which
# tells the layer where to log, and the desired output file.
#
# NOTE: the layer libraries must be available to the runtime environment (ex.
# via LD_LIBRARY_PATH). Running this script from the build directory usually is
# sufficient.
#
# Usage:
# gen_sample_output.sh path/to/VkLayer_stadia_XXX.json VK_XXX_LOG path/to/output
set -e
JSON="${1?}"
LOGVAR="${2?}"
OUTPUT="${3?}"
ENABLE=$(jq -r '.layer.enable_environment | keys[0]' "${JSON?}")
NAME=$(jq -r .layer.name "${JSON?}")
export "${ENABLE?}"=1
export "${LOGVAR?}"="${OUTPUT?}"
export VK_LAYER_PATH=$(dirname ${JSON?})
export VK_INSTANCE_LAYERS=${NAME?}
vkcube --c 10
|
Add mactracker and screenflick casks. Reintroduce '--appdir=/Applications' flag. Several apps have been complaining about being in ~/Applications. | #!/bin/sh
apps=(
1password
alfred
applepi-baker
atom
bartender
carbon-copy-cloner
cleanmymac
crashplan
doxie
dropbox
fantastical
firefox
google-chrome
google-drive
hazel
hipchat
istat-menus
iterm2
little-snitch
namebench
silverlight
skype
teamviewer
things
vagrant
virtualbox
vlc
)
brew cask install ${apps[@]}
| #!/bin/sh
apps=(
1password
alfred
applepi-baker
atom
bartender
carbon-copy-cloner
cleanmymac
crashplan
doxie
dropbox
fantastical
firefox
google-chrome
google-drive
hazel
hipchat
istat-menus
iterm2
little-snitch
mactracker
namebench
screenflick
silverlight
skype
teamviewer
things
vagrant
virtualbox
vlc
)
brew cask install ${apps[@]} --appdir=/Applications
|
Fix fetch data error in bench module | #!/usr/bin/env zsh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
mkdir -p data/sources/taxi
(cd data/sources/taxi; wget https://s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2015-11.parquet )
(cd data/sources/taxi; wget https://s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2015-12.parquet )
mkdir -p data/sources/github
(cd data/sources/github; wget http://data.gharchive.org/2015-11-{01..15}-{0..23}.json.gz)
| #!/usr/bin/env zsh
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 -e
mkdir -p data/sources/taxi
(cd data/sources/taxi; wget https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2015-11.parquet )
(cd data/sources/taxi; wget https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2015-12.parquet )
mkdir -p data/sources/github
(cd data/sources/github; wget http://data.gharchive.org/2015-11-{01..15}-{0..23}.json.gz)
|
Add back apt-get update, it's needed. | #!/bin/bash
# Copyright 2016 Marc-Antoine Ruel. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# As part of https://github.com/maruel/dlibox
set -eu
echo "- Installing git"
# Defer apt-get update & upgrade for later. It'll be done via a nightly cron
# job. Doing it now takes several minutes and the user is eagerly waiting for
# the lights to come up!
apt-get install -y git
echo "- Installing as user - setting up GOPATH, GOROOT and PATH"
cat >> /home/pi/.profile <<'EOF'
export GOROOT=$HOME/go
export GOPATH=$HOME
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
EOF
# TODO(maruel): Do not forget to update the Go version as needed.
echo "- Installing as user - Go and dlibox"
sudo -i -u pi /bin/sh <<'EOF'
cd
curl -S https://storage.googleapis.com/golang/go1.6.3.linux-armv6l.tar.gz | tar xz
go get -v github.com/maruel/dlibox/go/cmd/dlibox
EOF
# At this point, defer control to the script in the repository.
/home/pi/src/github.com/maruel/dlibox/go/setup/support/finish_install.sh
| #!/bin/bash
# Copyright 2016 Marc-Antoine Ruel. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# As part of https://github.com/maruel/dlibox
set -eu
echo "- Installing git"
# apt-get update must be done right away, since the old packages are likely not
# on the mirrors anymore.
# Defer apt-get upgrade for later. It'll be done via a nightly cron job. Doing
# it now takes several minutes and the user is eagerly waiting for the lights to
# come up!
apt-get update
apt-get install -y git
echo "- Installing as user - setting up GOPATH, GOROOT and PATH"
cat >> /home/pi/.profile <<'EOF'
export GOROOT=$HOME/go
export GOPATH=$HOME
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
EOF
# TODO(maruel): Do not forget to update the Go version as needed.
echo "- Installing as user - Go and dlibox"
sudo -i -u pi /bin/sh <<'EOF'
cd
curl -S https://storage.googleapis.com/golang/go1.6.3.linux-armv6l.tar.gz | tar xz
go get -v github.com/maruel/dlibox/go/cmd/dlibox
EOF
# At this point, defer control to the script in the repository.
/home/pi/src/github.com/maruel/dlibox/go/setup/support/finish_install.sh
|
Make sure before_script exits with success on 3.6.6 | #!/bin/sh
${RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL:="sudo rabbitmqctl"}
# guest:guest has full access to /
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL add_vhost /
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL add_user guest guest
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL set_permissions -p / guest ".*" ".*" ".*"
# Reduce retention policy for faster publishing of stats
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().'
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().'
| #!/bin/sh
${RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL:="sudo rabbitmqctl"}
# guest:guest has full access to /
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL add_vhost /
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL add_user guest guest
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL set_permissions -p / guest ".*" ".*" ".*"
# Reduce retention policy for faster publishing of stats
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().' | true
$RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().' | true
|
Check if running build in a forked repo. | #!/bin/sh
# Check if service key environment variable is set; exit if not
if [ -z "$GCLOUD_SERVICE_KEY" ]; then
echo "GCLOUD_SERVICE_KEY env variable is empty. Exiting."
exit 1
fi
# Export to secrets file
echo $GCLOUD_SERVICE_KEY | base64 -di > client_secret.json
# Set project ID
gcloud config set project android-devrel-ci
# Auth account
gcloud auth activate-service-account plaid-ftl@android-devrel-ci.iam.gserviceaccount.com --key-file client_secret.json
# Delete secret
rm client_secret.json
| #!/bin/sh
# Check if this script is running on the main, non-forked repository.
# Environment variables are not set in forked repository builds;
# skip Firebase Test Lab steps in this case.
if [ -z "$IS_MAIN_PLAID_REPO" ]; then
echo "Running build on a forked repository - skipping FTL tests."
# exit 0
fi
# Check if service key environment variable is set; exit if not
if [ -z "$GCLOUD_SERVICE_KEY" ]; then
echo "GCLOUD_SERVICE_KEY env variable is empty. Exiting."
exit 1
fi
# Export to secrets file
echo $GCLOUD_SERVICE_KEY | base64 -di > client_secret.json
# Set project ID
gcloud config set project android-devrel-ci
# Auth account
gcloud auth activate-service-account plaid-ftl@android-devrel-ci.iam.gserviceaccount.com --key-file client_secret.json
# Delete secret
rm client_secret.json
|
Revert "faster and non-permanent chnode" | export PATH="$PATH:./node_modules/.bin"
export PATH="$PATH:$HOME/.yarn/bin"
export REACT_DEBUGGER="open -g 'rndebugger://set-debugger-loc?port=8001'"
export REACT_EDITOR_CMD=code
export REACT_EDITOR_PATTERN="-r -g {filename}:{line}:{column}"
function chnode() {
if [ "$(uname -s)" != "Darwin" ]; then
echo "macos only"
return 1
fi
PATH_PREFIX="$(brew --prefix)/Cellar/node"
# clear prior path
# https://stackoverflow.com/a/370192/2178159
export PATH=$(echo "$PATH" | awk -v RS=: -v ORS=: "/${PATH_PREFIX//\//\\/}/ {next} {print}" | sed 's/:*$//')
if [ -n "$1" ]
then
local NODE_PATH=$(eval echo "$PATH_PREFIX*/$1*/bin/")
if [ -d "$NODE_PATH" ]
then
echo "using node $(echo "$NODE_PATH" | rev | cut -d'/' -f3 | rev)"
export PATH="$NODE_PATH:$PATH"
else
echo "no node installation found for '$1'"
return 1
fi
else
echo "using system installation"
fi
}
| export PATH="$PATH:./node_modules/.bin"
export PATH="$PATH:$HOME/.yarn/bin"
export REACT_DEBUGGER="open -g 'rndebugger://set-debugger-loc?port=8001'"
export REACT_EDITOR_CMD=code
export REACT_EDITOR_PATTERN="-r -g {filename}:{line}:{column}"
function chnode() {
local version
if [ -n "$1" ]
then
version="@$1"
fi
brew unlink $(brew list | grep node)
brew link --overwrite --force "node$version"
}
|
Add DBOOST_NO_CXX11_RVALUE_REFERENCES to CFLAGS. [skip appveyor] | #!/usr/bin/env bash
if [[ `uname` == 'Darwin' ]]; then
CXXFLAGS="${CXXFLAGS} -DBOOST_NO_CXX11_RVALUE_REFERENCES"
LDFLAGS="${LDFLAGS} -DBOOST_NO_CXX11_RVALUE_REFERENCES"
$PYTHON -B setup.py install --single-version-externally-managed --record record.txt
else
$PYTHON -B setup.py install --single-version-externally-managed --record record.txt
fi
| #!/usr/bin/env bash
if [[ `uname` == 'Darwin' ]]; then
CFLAGS="${CFLAGS} -DBOOST_NO_CXX11_RVALUE_REFERENCES"
CXXFLAGS="${CXXFLAGS} -DBOOST_NO_CXX11_RVALUE_REFERENCES"
LDFLAGS="${LDFLAGS} -DBOOST_NO_CXX11_RVALUE_REFERENCES"
$PYTHON -B setup.py install --single-version-externally-managed --record record.txt
else
$PYTHON -B setup.py install --single-version-externally-managed --record record.txt
fi
|
Use new release of crosstool. | RELEASE=v2.0_0
for name in runtime headers; do
package=lrtev2-${name}_1.0-0_amd64.deb
wget https://github.com/mzhaom/lrte/releases/download/${RELEASE}/${package}
sudo dpkg -i ${package}
done
GCC=lrtev2-crosstoolv2-gcc-4.9_1.0-8.223995svn_amd64.deb
CLANG=lrtev2-crosstoolv2-clang-3.7_1.0-8.238804svn_amd64.deb
for package in $GCC $CLANG; do
wget https://github.com/mzhaom/lrte/releases/download/${RELEASE}/${package}
sudo dpkg -i ${package}
done
| RELEASE=v2.0_0
for name in runtime headers; do
package=lrtev2-${name}_1.0-0_amd64.deb
wget https://github.com/mzhaom/lrte/releases/download/${RELEASE}/${package}
sudo dpkg -i ${package}
done
GCC=lrtev2-crosstoolv2-gcc-4.9_1.0-8.228158svn_amd64.deb
CLANG=lrtev2-crosstoolv2-clang-3.7_1.0-8.248635svn_amd64.deb
for package in $GCC $CLANG; do
wget https://github.com/mzhaom/lrte/releases/download/${RELEASE}/${package}
sudo dpkg -i ${package}
done
|
Update Node version to 5.10.0 which includes io.js | #!/bin/bash
RETCODE=$(fw_exists ${IROOT}/node.installed)
[ ! "$RETCODE" == 0 ] || { \
source $IROOT/node.installed
return 0; }
VERSION="0.12.12"
fw_get -O http://nodejs.org/dist/v$VERSION/node-v$VERSION-linux-x64.tar.gz
fw_untar node-v$VERSION-linux-x64.tar.gz
NODE_HOME=$IROOT/node-v$VERSION-linux-x64
# Upgrade npm to avoid https://github.com/npm/npm/issues/4984
$NODE_HOME/bin/npm install -g npm
echo "export NODE_ENV=production" > $IROOT/node.installed
echo "export NODE_HOME=${NODE_HOME}" >> $IROOT/node.installed
echo -e "export PATH=\$NODE_HOME/bin:\$PATH" >> $IROOT/node.installed
source $IROOT/node.installed
| #!/bin/bash
RETCODE=$(fw_exists ${IROOT}/node.installed)
[ ! "$RETCODE" == 0 ] || { \
source $IROOT/node.installed
return 0; }
VERSION="5.10.0"
fw_get -O http://nodejs.org/dist/v$VERSION/node-v$VERSION-linux-x64.tar.gz
fw_untar node-v$VERSION-linux-x64.tar.gz
NODE_HOME=$IROOT/node-v$VERSION-linux-x64
# Upgrade npm to avoid https://github.com/npm/npm/issues/4984
$NODE_HOME/bin/npm install -g npm
echo "export NODE_ENV=production" > $IROOT/node.installed
echo "export NODE_HOME=${NODE_HOME}" >> $IROOT/node.installed
echo -e "export PATH=\$NODE_HOME/bin:\$PATH" >> $IROOT/node.installed
source $IROOT/node.installed
|
Fix conditional to get session | #!/bin/bash
if [[ -z $1 ]]
then
SESSION_NAME="default"
else
SESSION_NAME=$1
fi
POUT=$(tmux has-session -t $SESSION_NAME 2>&1)
if [[ -z $POUT ]]
then
tmux attach -t $SESSION_NAME
else
tmux new-session -s $SESSION_NAME
fi
| #!/bin/bash
if [ -z "$1" ]; then
SESSION_NAME="default"
else
SESSION_NAME=$1
fi
POUT=$(tmux has-session -t $SESSION_NAME 2>&1)
if [ -z "$POUT" ]; then
tmux attach -t $SESSION_NAME
else
tmux new-session -s $SESSION_NAME
fi
|
Build MEGAChat dependencies only when using the argument --enable-chat | #!/bin/sh
set -e
# MEGA SDK deps
sh build-cryptopp.sh
sh build-openssl.sh
sh build-cares.sh
sh build-curl.sh
sh build-libuv.sh
sh build-libsodium.sh
# MEGAchat deps
sh build-expat.sh
sh build-libevent2.sh
sh build-libws.sh
sh build-webrtc.sh
sh build-megachat.sh
echo "Done."
| #!/bin/sh
set -e
# MEGA SDK deps
sh build-cryptopp.sh
sh build-openssl.sh
sh build-cares.sh
sh build-curl.sh
sh build-libuv.sh
sh build-libsodium.sh
# MEGAchat deps
if [ "$1" == "--enable-chat"]; then
sh build-expat.sh
sh build-libevent2.sh
sh build-libws.sh
sh build-webrtc.sh
sh build-megachat.sh
fi
echo "Done."
|
Enable benchmarks test is difficult solver problem | . ../common.sh
cabal freeze --enable-benchmarks
grep " criterion ==" cabal.config || die "should have frozen criterion"
| . ../common.sh
# TODO: solver should find solution without extra flags too
cabal freeze --enable-benchmarks --reorder-goals --max-backjumps=-1
grep " criterion ==" cabal.config || die "should have frozen criterion"
|
Clean up stale reference to chanbot. | #!/bin/bash
set -eu -o pipefail
set -x
vgo build ./cmd/rolebot
vgo build ./cmd/chanbot
| #!/bin/bash
set -eu -o pipefail
set -x
vgo build ./cmd/rolebot
|
Fix /tmp/.docker.xauth does not exist | #!/bin/sh
if test $# -lt 1; then
# Get the latest opengl-nvidia build
# and start with an interactive terminal enabled
args="-i -t $(docker images | grep ^opengl-nvidia | head -n 1 | awk '{ print $1":"$2 }')"
else
# Use this script with derived images, and pass your 'docker run' args
args="$@"
fi
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run \
--privileged \
-v $XSOCK:$XSOCK:rw \
-v $XAUTH:$XAUTH:rw \
-v /dev/dri:/dev/dri:rw \
-e DISPLAY=$DISPLAY \
-e XAUTHORITY=$XAUTH \
$args
| #!/bin/sh
if test $# -lt 1; then
# Get the latest opengl-nvidia build
# and start with an interactive terminal enabled
args="-i -t $(docker images | grep ^opengl-nvidia | head -n 1 | awk '{ print $1":"$2 }')"
else
# Use this script with derived images, and pass your 'docker run' args
args="$@"
fi
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run \
--privileged \
-v $XSOCK:$XSOCK:rw \
-v $XAUTH:$XAUTH:rw \
-v /dev/dri:/dev/dri:rw \
-e DISPLAY=$DISPLAY \
-e XAUTHORITY=$XAUTH \
$args
|
Add download script and source code back. | #!/bin/bash
## This script builds a new GitHub release for the Terra CLI.
## Inputs: RELEASE_VERSION (env var, required) determines the git tag to use for creating the release
## Usage: ./publish-release.sh
echo "-- Building the source code archive"
sourceCodeArchiveFilename="terra-cli-${RELEASE_VERSION}.tar.gz"
sourceCodeArchivePath=../$sourceCodeArchiveFilename
tar -czf $sourceCodeArchivePath ./
echo "sourceCodeArchivePath: $sourceCodeArchivePath"
ls -la ..
# TODO: include Docker image build and publish, once Vault secrets have been added to the GH repo
#echo "-- Building the Docker image"
#./tools/build-docker.sh terra-cli/local forRelease
#echo "-- Publishing the Docker image"
#./tools/publish-docker.sh terra-cli/local forRelease "terra-cli/v1$RELEASE_VERSION" stable
echo "-- Building the distribution archive"
./gradlew distTar
distributionArchivePath=$(ls build/distributions/*tar)
echo "distributionArchivePath: $distributionArchivePath"
#mariko
echo "-- Creating a new GitHub release with the install archive and download script"
#gh release create --draft "${GITHUB_REF#refs/tags/}" dist/*.tar tools/download-install.sh
releaseTag="v${RELEASE_VERSION}"
gh release create $releaseTag \
--draft \
--title "v${RELEASE_VERSION}" \
"${distributionArchivePath}#Install package"
# "${distributionArchivePath}#Install package" \
# "tools/download-install.sh#Download & Install script" \
# "${sourceCodeArchivePath}#Source code"
| #!/bin/bash
## This script builds a new GitHub release for the Terra CLI.
## Inputs: RELEASE_VERSION (env var, required) determines the git tag to use for creating the release
## Usage: ./publish-release.sh
echo "-- Building the source code archive"
sourceCodeArchiveFilename="terra-cli-${RELEASE_VERSION}.tar.gz"
sourceCodeArchivePath=../$sourceCodeArchiveFilename
tar -czf $sourceCodeArchivePath ./
echo "sourceCodeArchivePath: $sourceCodeArchivePath"
ls -la ..
# TODO: include Docker image build and publish, once Vault secrets have been added to the GH repo
#echo "-- Building the Docker image"
#./tools/build-docker.sh terra-cli/local forRelease
#echo "-- Publishing the Docker image"
#./tools/publish-docker.sh terra-cli/local forRelease "terra-cli/v1$RELEASE_VERSION" stable
echo "-- Building the distribution archive"
./gradlew distTar
distributionArchivePath=$(ls build/distributions/*tar)
echo "distributionArchivePath: $distributionArchivePath"
#mariko
echo "-- Creating a new GitHub release with the install archive and download script"
#gh release create --draft "${GITHUB_REF#refs/tags/}" dist/*.tar tools/download-install.sh
releaseTag="v${RELEASE_VERSION}"
gh release create $releaseTag \
--draft \
--title "v${RELEASE_VERSION}" \
"${distributionArchivePath}#Install package" \
"tools/download-install.sh#Download & Install script" \
"${sourceCodeArchivePath}#Source code"
|
Increase default hub ready timeout | #!/bin/bash
set -e
# How many browsers are we expecting to connect to the hub.
EXPECTED_BROWSERS=$1
# How many seconds should we wait for the browsers to connect?
WAIT=${2:-10}
# Selenium hub hostname.
HOST=${3:-localhost}
# Selenium hub port number.
PORT=${4:-4444}
nodes_connected() {
set +e
status=$(curl -X GET -s http://${1}:${2}/grid/api/hub/ \
-d '{"configuration":["slotCounts"]}')
if [ $? != 0 ]; then
echo -1
return
fi
set -e
echo ${status} | node -e \
"const fs=require('fs');console.log(JSON.parse(fs.readFileSync(0, 'utf-8')).slotCounts.free)"
}
echo Waiting for ${EXPECTED_BROWSERS} browsers to connect to the Selenium hub...
PINGS=0
while true; do
if [ $(nodes_connected ${HOST} ${PORT}) -ge ${EXPECTED_BROWSERS} ]; then
printf "\n"
echo Hub is now ready.
exit 0
fi
PINGS=$((PINGS + 1))
if [ ${PINGS} -gt ${WAIT} ]; then
printf "\n"
echo Waited ${WAIT} seconds and the hub was still not ready. Exiting.
exit 1
fi
printf "."
sleep 1
done
| #!/bin/bash
set -e
# How many browsers are we expecting to connect to the hub.
EXPECTED_BROWSERS=$1
# How many seconds should we wait for the browsers to connect?
WAIT=${2:-15}
# Selenium hub hostname.
HOST=${3:-localhost}
# Selenium hub port number.
PORT=${4:-4444}
nodes_connected() {
set +e
status=$(curl -X GET -s http://${1}:${2}/grid/api/hub/ \
-d '{"configuration":["slotCounts"]}')
if [ $? != 0 ]; then
echo -1
return
fi
set -e
echo ${status} | node -e \
"const fs=require('fs');console.log(JSON.parse(fs.readFileSync(0, 'utf-8')).slotCounts.free)"
}
echo Waiting for ${EXPECTED_BROWSERS} browsers to connect to the Selenium hub...
PINGS=0
while true; do
if [ $(nodes_connected ${HOST} ${PORT}) -ge ${EXPECTED_BROWSERS} ]; then
printf "\n"
echo Hub is now ready.
exit 0
fi
PINGS=$((PINGS + 1))
if [ ${PINGS} -gt ${WAIT} ]; then
printf "\n"
echo Waited ${WAIT} seconds and the hub was still not ready. Exiting.
exit 1
fi
printf "."
sleep 1
done
|
Update cache-clear script to also work with D8 | #!/bin/bash
#
# Run a 'drush cc all' for a specified site.
# This is a simple wrapper script that can be added to sudo config
# so that the deploy user can run a cache clear as the Apache/web user.
usage() {
echo "usage: $0 [-d @drush_alias]"
echo " -d Specify drush alias (include leading @)"
echo ""
echo "Drush alias is required."
exit 1
}
while getopts "d:" opt; do
case $opt in
d)
DRUSH_ALIAS=$OPTARG
;;
*)
usage
esac
done
if [ -z "${DRUSH_ALIAS}" ]
then
usage
fi
HOSTNAME=$(uname -n)
echo "On host ${HOSTNAME}"
echo "Going to clear all caches on site: $DRUSH_ALIAS"
/usr/bin/drush $DRUSH_ALIAS cc all || { echo "Drush command exited with an error."; exit 1; }
| #!/bin/bash
#
# Run a 'drush cc all' for a specified site.
# This is a simple wrapper script that can be added to sudo config
# so that the deploy user can run a cache clear as the Apache/web user.
# For d8 sites, this will call 'cache-rebuild' if you pass the -r flag.
usage() {
echo "usage: $0 [-d @drush_alias] [-r]"
echo " -d Specify drush alias (include leading @)"
echo " -r Call cache-rebuild instead of cache-clear (use this for D8 sites)"
echo ""
echo "Drush alias is required."
exit 1
}
# Default drush command is 'cc all'. Override if -r is specified.
COMMAND='cc all'
while getopts "d:r" opt; do
case $opt in
d)
DRUSH_ALIAS=$OPTARG
;;
r)
COMMAND=cr
;;
*)
usage
esac
done
if [ -z "${DRUSH_ALIAS}" ]
then
usage
fi
HOSTNAME=$(uname -n)
echo "On host ${HOSTNAME}"
echo "Going to clear all caches on site: $DRUSH_ALIAS"
/usr/bin/drush $DRUSH_ALIAS $COMMAND || { echo "Drush command exited with an error."; exit 1; }
|
Use Python 3.x from now on. | #!/bin/bash -
apt update
apt install --yes python python-pip xfce4 firefox
git clone --depth 1 https://github.com/trustedsec/social-engineer-toolkit.git set/
chown -R vagrant:vagrant set
cd set
pip install -r requirements.txt
| #!/bin/bash -
apt update
apt install --yes python3 python3-pip xfce4 firefox
git clone --depth 1 https://github.com/trustedsec/social-engineer-toolkit.git set/
chown -R vagrant:vagrant set
cd set
pip3 install -r requirements.txt
|
Change Z3 Download URL to S3 | #!/bin/bash
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file 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 -e
usage() {
echo "install_z3.sh download_dir install_dir"
exit 1
}
if [ "$#" -ne "2" ]; then
usage
fi
DOWNLOAD_DIR=$1
INSTALL_DIR=$2
mkdir -p $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
#download z3
curl http://saw.galois.com/builds/z3/z3 > z3
sudo chmod +x z3
mkdir -p $INSTALL_DIR/bin && mv z3 $INSTALL_DIR/bin
| #!/bin/bash
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanying this file. This file 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 -e
usage() {
echo "install_z3.sh download_dir install_dir"
exit 1
}
if [ "$#" -ne "2" ]; then
usage
fi
DOWNLOAD_DIR=$1
INSTALL_DIR=$2
mkdir -p $DOWNLOAD_DIR
cd $DOWNLOAD_DIR
#download z3
curl https://s3-us-west-2.amazonaws.com/s2n-public-test-dependencies/z3-2017-04-04-Ubuntu14.04-64 > z3
sudo chmod +x z3
mkdir -p $INSTALL_DIR/bin && mv z3 $INSTALL_DIR/bin
|
Disable the extra/generate-display-names check on Travis for now | ./autogen.sh &&
./configure $ENABLE_UCS4 --with-yaml &&
make &&
make check &&
# check display names
if [[ -n ${ENABLE_UCS4+x} ]]; then
cd extra/generate-display-names &&
if ! make; then
cat generate.log
false
fi
fi
| ./autogen.sh &&
./configure $ENABLE_UCS4 --with-yaml &&
make &&
make check #&&
# check display names
# FIXME: temporarily disabled because this causes a memory corruption error on Travis
# if [[ -n ${ENABLE_UCS4+x} ]]; then
# cd extra/generate-display-names &&
# if ! make; then
# cat generate.log
# false
# fi
# fi
|
Fix bug in zsh 'jump' alias | # Use colors in coreutils utilities output
alias ls='ls --color=auto'
alias ll='ls -l --color=auto'
alias la='ls -la --color=auto'
export GREP_OPTIONS="--color"
# Use pip without requiring virtualenv
function syspip() {
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
# cd to git root directory
alias cdgr='cd "$(git root)"'
# Jump to directory containing file
function jump() {
cd "(dirname ${1})"
}
# cd replacement for screen to track cwd (like tmux)
function scr_cd()
{
builtin cd $1
screen -X chdir $PWD
}
if [[ "$TERM" == 'screen.rxvt' ]]; then
alias cd=scr_cd
fi
# Go up [n] directories
function up()
{
if [[ "${1}" == "" ]]; then
cd ..
elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then
echo "Error: argument must be a number"
elif ! [[ "${1}" -gt "0" ]]; then
echo "Error: argument must be positive"
else
for i in {1..${1}}; do
cd ..
done
fi
}
# Mirror a website
alias mirrorsite='wget -m -k -K -E -e robots=off'
| # Use colors in coreutils utilities output
alias ls='ls --color=auto'
alias ll='ls -l --color=auto'
alias la='ls -la --color=auto'
export GREP_OPTIONS="--color"
# Use pip without requiring virtualenv
function syspip() {
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
# cd to git root directory
alias cdgr='cd "$(git root)"'
# Jump to directory containing file
function jump() {
cd "$(dirname ${1})"
}
# cd replacement for screen to track cwd (like tmux)
function scr_cd()
{
builtin cd $1
screen -X chdir $PWD
}
if [[ "$TERM" == 'screen.rxvt' ]]; then
alias cd=scr_cd
fi
# Go up [n] directories
function up()
{
if [[ "${1}" == "" ]]; then
cd ..
elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then
echo "Error: argument must be a number"
elif ! [[ "${1}" -gt "0" ]]; then
echo "Error: argument must be positive"
else
for i in {1..${1}}; do
cd ..
done
fi
}
# Mirror a website
alias mirrorsite='wget -m -k -K -E -e robots=off'
|
Use builtins instead of StringValidator functions | source bash-toolbox/init.sh
package props
include logger.Logger
include string.util.StringUtil
include string.validator.StringValidator
main(){
local _log="Logger log"
if [[ ! $(StringValidator isNull ${1}) ]]; then
case ${1} in
read|set|unset) local _cmd=${1} ;;
*) ${_log} error "\"${1}\"_is_not_a_valid_command" && exit ;;
esac
shift
case $(StringUtil returnOption ${1}) in
a) local propsType=AppServer;;
b) local propsType=Build;;
p) local propsType=Portal;;
t) local propsType=Test;;
esac
local cmd=${_cmd}${propsType}Props
shift
local branch=${1}
shift
if [[ $(StringValidator isSubstring _cmd "set") ]]; then
local className=PropsWriter
else
local className=PropsReader
fi
${className} ${cmd} ${branch} $@
fi
}
main $@ | source bash-toolbox/init.sh
package props
include logger.Logger
include string.util.StringUtil
include string.validator.StringValidator
main(){
local _log="Logger log"
if [[ ${1} ]]; then
case ${1} in
read|set|unset) local _cmd=${1} ;;
*) ${_log} error "\"${1}\"_is_not_a_valid_command" && exit ;;
esac
shift
case $(StringUtil returnOption ${1}) in
a) local propsType=AppServer;;
b) local propsType=Build;;
p) local propsType=Portal;;
t) local propsType=Test;;
esac
local cmd=${_cmd}${propsType}Props
shift
local branch=${1}
shift
if [[ ${_cmd} =~ "set") ]]; then
local className=PropsWriter
else
local className=PropsReader
fi
${className} ${cmd} ${branch} $@
fi
}
main $@ |
Allow celery to run as root inside the docker container | #!/usr/bin/env bash
export PATH=$PATH:/makeaplea/
cd /makeaplea && source /makeaplea/docker/celery_defaults && celery worker -A apps.plea.tasks:app
| #!/usr/bin/env bash
export PATH=$PATH:/makeaplea/
export C_FORCE_ROOT=true
cd /makeaplea && source /makeaplea/docker/celery_defaults && celery worker -A apps.plea.tasks:app
|
Add in sublime-text to casks | # OSX-only stuff. Abort if not OSX.
is_osx || return 1
# Exit if Homebrew is not installed.
[[ ! "$(type -P brew)" ]] && e_error "Brew casks need Homebrew to install." && return 1
# Hack to show the first-run brew-cask password prompt immediately.
brew cask info this-is-somewhat-annoying 2>/dev/null
# Homebrew casks
# Update with "brew cask list"
casks=(
# Applications
alfred
bartender
bettertouchtool
charles
clamxav
contextsflux
dash
docker
dropbox
firefox
font-hack-nerd-font
font-menlo-for-powerline
google-drive
istat-menus
iterm2
itsycal
karabiner-elements
livestreamer-twitch-gui
logitech-gaming-software
macvim
ngrok
reggy
sourcetree
spotify
torbrowser
vagrant
virtualbox
virtualbox-extension-pack
vlc
wireshark
xquartz
)
# Install Homebrew casks.
casks=($(setdiff "${casks[*]}" "$(brew cask list 2>/dev/null)"))
if (( ${#casks[@]} > 0 )); then
e_header "Installing Homebrew casks: ${casks[*]}"
for cask in "${casks[@]}"; do
brew cask install $cask
done
brew cask cleanup
fi
| # OSX-only stuff. Abort if not OSX.
is_osx || return 1
# Exit if Homebrew is not installed.
[[ ! "$(type -P brew)" ]] && e_error "Brew casks need Homebrew to install." && return 1
# Hack to show the first-run brew-cask password prompt immediately.
brew cask info this-is-somewhat-annoying 2>/dev/null
# Homebrew casks
# Update with "brew cask list"
casks=(
# Applications
alfred
bartender
bettertouchtool
charles
clamxav
contextsflux
dash
docker
dropbox
firefox
font-hack-nerd-font
font-menlo-for-powerline
google-drive
istat-menus
iterm2
itsycal
karabiner-elements
livestreamer-twitch-gui
logitech-gaming-software
macvim
ngrok
reggy
sourcetree
spotify
sublime-text
torbrowser
vagrant
virtualbox
virtualbox-extension-pack
vlc
wireshark
xquartz
)
# Install Homebrew casks.
casks=($(setdiff "${casks[*]}" "$(brew cask list 2>/dev/null)"))
if (( ${#casks[@]} > 0 )); then
e_header "Installing Homebrew casks: ${casks[*]}"
for cask in "${casks[@]}"; do
brew cask install $cask
done
brew cask cleanup
fi
|
Remove docs each time we generate | #!/bin/sh
set -e
lein doc
echo "*** Docs built ***"
tmpdir=`mktemp -d /tmp/flatland-useful.XXXXXX`
mv doc/** $tmpdir
rmdir doc
git checkout gh-pages
mv $tmpdir/** .
git add -Av .
git commit -m "Updated docs"
echo "*** gh-pages branch updated ***"
rmdir $tmpdir
git checkout -
echo "Run this to complete:"
echo "git push origin gh-pages:gh-pages"
| #!/bin/sh
set -e
lein doc
echo "*** Docs built ***"
tmpdir=`mktemp -d /tmp/flatland-useful.XXXXXX`
mv doc/** $tmpdir
rmdir doc
git checkout gh-pages
git rm -rf .
mv $tmpdir/** .
git add -Av .
git commit -m "Updated docs"
echo "*** gh-pages branch updated ***"
rmdir $tmpdir
git checkout -
echo "Run this to complete:"
echo "git push origin gh-pages:gh-pages"
|
Update branches script to run parallel build | #!/bin/bash -xe
export DISPLAY=:99
export GOVUK_APP_DOMAIN=test.gov.uk
export GOVUK_ASSET_ROOT=http://static.test.gov.uk
export TEST_ENV_NUMBER=1
env
# Generate directories for upload tests
mkdir -p ./incoming-uploads
mkdir -p ./clean-uploads
mkdir -p ./infected-uploads
mkdir -p ./attachment-cache
time bundle install --path "${HOME}/bundles/${JOB_NAME}" --deployment
RAILS_ENV=test time bundle exec rake db:reset db:schema:load --trace
RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:clean --trace
RAILS_ENV=test CUCUMBER_FORMAT=progress time bundle exec rake ci:setup:minitest default test:cleanup --trace
RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:precompile --trace
EXIT_STATUS=$?
echo "EXIT STATUS: $EXIT_STATUS"
exit $EXIT_STATUS
| #!/bin/bash -xe
export DISPLAY=:99
export GOVUK_APP_DOMAIN=test.gov.uk
export GOVUK_ASSET_ROOT=http://static.test.gov.uk
env
# Generate directories for upload tests
mkdir -p ./incoming-uploads
mkdir -p ./clean-uploads
mkdir -p ./infected-uploads
mkdir -p ./attachment-cache
time bundle install --path "${HOME}/bundles/${JOB_NAME}" --deployment
time bundle exec rake db:drop db:create db:schema:load --trace
time bundle exec rake db:test:prepare --trace
RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:clean --trace
RAILS_ENV=test CUCUMBER_FORMAT=progress time bundle exec rake ci:setup:minitest parallel:create parallel:prepare test_queue shared_mustache:compile parallel:features test:javascript test:cleanup --trace
RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:precompile --trace
EXIT_STATUS=$?
echo "EXIT STATUS: $EXIT_STATUS"
exit $EXIT_STATUS
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.