Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Update generate script w/ new base url
#!/usr/bin/env bash mkdir -p content/project cat <<\EOF > ./content/project/important.md +++ date = 2014-09-02T21:07:25Z title = "Important documentation" +++ This is some important documentation >block quote ```bash cat /dev/null echo "hello!" ``` Header ------ Other *stuff* can go in **here**. EOF hugo -d docs/ rm -rf content
#!/usr/bin/env bash mkdir -p content/project cat <<\EOF > ./content/project/important.md +++ date = 2014-09-02T21:07:25Z title = "Important documentation" +++ This is some important documentation >block quote ```bash cat /dev/null echo "hello!" ``` Header ------ Other *stuff* can go in **here**. EOF hugo -d docs/ --baseUrl="http://ciarand.github.io/internal-docs" rm -rf content
Upgrade Java 11 version in CI image
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u275b01.tar.gz" ;; java11) echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11.1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.9_11.tar.gz" ;; java14) echo "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz" ;; java15) echo "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9/OpenJDK15U-jdk_x64_linux_hotspot_15.0.1_9.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u275-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u275b01.tar.gz" ;; java11) echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.9.1_1.tar.gz" ;; java14) echo "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz" ;; java15) echo "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9/OpenJDK15U-jdk_x64_linux_hotspot_15.0.1_9.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
Copy gitconfig to home DIR if it doesn't already exist
path="$HOME/dotfiles" echo "$path" source $path/theme/prompt.sh source $path/completions/ssh.completion.bash export CLICOLOR=1 export EDITOR='vim -f' export HISTFILESIZE=10000 export HISTSIZE=10000 export HISTCONTROL="ignoredups" export HISTCONTROL=erasedups export GIT_PS1_SHOWDIRTYSTATE=1 export AUTOFEATURE=true autotest PROMPT_COMMAND='history -a' export GREP_COLOR='1;33' unset MAILCHECK function load_all() { file_type=$1 [ ! -d "$path/$file_type" ] && mkdir "$path/${file_type}" for src in $path/${file_type}/*; do filename="$(basename ${src})" [ ${filename:0:1} = "_" ] && continue dest="${path}/${file_type}/${filename}" source $dest done } echo "" echo "loading aliases" load_all aliases echo "" echo "loading completions" load_all completions
path="$HOME/dotfiles" echo "$path" source $path/theme/prompt.sh source $path/completions/ssh.completion.bash if [ ! -f "$HOME/.gitconfig" ]; then echo "has no config" ln -s "$path/.gitconfig" $HOME/.gitconfig fi export CLICOLOR=1 export EDITOR='vim -f' export HISTFILESIZE=10000 export HISTSIZE=10000 export HISTCONTROL="ignoredups" export HISTCONTROL=erasedups export GIT_PS1_SHOWDIRTYSTATE=1 export AUTOFEATURE=true autotest PROMPT_COMMAND='history -a' export GREP_COLOR='1;33' unset MAILCHECK function load_all() { file_type=$1 [ ! -d "$path/$file_type" ] && mkdir "$path/${file_type}" for src in $path/${file_type}/*; do filename="$(basename ${src})" [ ${filename:0:1} = "_" ] && continue dest="${path}/${file_type}/${filename}" source $dest done } echo "" echo "loading aliases" load_all aliases echo "" echo "loading completions" load_all completions
Copy scala library as expected in distribution for JVM-only
#!/usr/bin/env bash set -eo pipefail scriptDir=$(dirname 0) mkdir -p $scriptDir/lib/ cd $scriptDir/lib/ scalatest=scalatest-1.6.1 if [ ! -e $scalatest.jar ]; then echo >&2 "Retrieving library $scalatest" scalatestUrl=http://www.scalatest.org/releases/$scalatest.zip tmp=$(mktemp) curl -L $scalatestUrl > $tmp unzip $tmp cp $scalatest/$scalatest.jar . rm -rf $scalatest $tmp fi cd $scriptDir
#!/usr/bin/env bash set -eo pipefail scriptDir=$(dirname 0) mkdir -p $scriptDir/lib/ cd $scriptDir/lib/ scalatest=scalatest-1.6.1 if [ ! -e $scalatest.jar ]; then echo >&2 "Retrieving library $scalatest" scalatestUrl=http://www.scalatest.org/releases/$scalatest.zip tmp=$(mktemp) curl -L $scalatestUrl > $tmp unzip $tmp cp $scalatest/$scalatest.jar . rm -rf $scalatest $tmp fi if [ ! -e scala-library.jar ]; then scalaDir=$(dirname $(which scala))/../ echo >&2 "Scala found at $scalaDir" jar=$scalaDir/lib/scala-library.jar echo >&2 "Copying scala library from $jar for use in packaging" cp $jar . fi
Update npm to the latest compatible version
export NVM_VERSION=0.36.0 export NODE_VERSION=14.7.0 export NPM_VERSION=6.14.7 export RUBY_VERSION=2.6.0 export COCOAPODS_VERSION=1.10.0 export GRADLE_VERSION=6.7 export NVM_DIR="$HOME/.nvm" export RUBY_PATH=$HOME/.gem/ruby/$RUBY_VERSION/bin
export NVM_VERSION=0.36.0 export NODE_VERSION=14.7.0 export NPM_VERSION=6.14.8 export RUBY_VERSION=2.6.0 export COCOAPODS_VERSION=1.10.0 export GRADLE_VERSION=6.7 export NVM_DIR="$HOME/.nvm" export RUBY_PATH=$HOME/.gem/ruby/$RUBY_VERSION/bin
Use only the annotators we need.
CORENLP_OPTIONS="-parse.flags \" -makeCopulaHead\"" CORENLP=stanford-corenlp-full-* python3 -m corenlp --memory 1g -p 8999 & for job in `jobs -p`; do echo $job; wait $job; done
CORENLP_OPTIONS="-annotators tokenize,ssplit,pos,lemma,parse -parse.flags \" -makeCopulaHead\"" CORENLP=stanford-corenlp-full-* python3 -m corenlp --memory 1g -p 8999 & for job in `jobs -p`; do echo $job; wait $job; done
Include python shims in PATH
if [ -x "$HOME/.pyenv/bin/pyenv" ]; then export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$($HOME/.pyenv/bin/pyenv init -)" fi
if [ -x "$HOME/.pyenv/bin/pyenv" ]; then export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" export PATH="$PYENV_ROOT/shims:$PATH" eval "$($HOME/.pyenv/bin/pyenv init -)" fi
Create m4 directory if it doesn't exist
#!/bin/sh -e # Remove dependency cache otherwise file renames confuse autoconf find . -type d -name \.deps | xargs rm -rf autoreconf -v --install ./configure $@
#!/bin/sh -e # Remove dependency cache otherwise file renames confuse autoconf find . -type d -name \.deps | xargs rm -rf [ -d m4 ] || mkdir m4 autoreconf -v --install ./configure $@
Test for both glibtoolize and libtoolize on Mac; the downloaded version of autotools only includes libtoolize.
#!/bin/sh # Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. if test -z "$LIBTOOLIZE" -a "`uname`" = "Darwin"; then LIBTOOLIZE=glibtoolize fi set -ex ${LIBTOOLIZE:-libtoolize} ${ACLOCAL:-aclocal -I m4} ${AUTOCONF:-autoconf} ${AUTOMAKE:-automake} --add-missing
#!/bin/sh # Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. if test -z "$LIBTOOLIZE" -a "`uname`" = "Darwin"; then if command -v "glibtoolize" >/dev/null; then LIBTOOLIZE=glibtoolize elif command -v "libtoolize" >/dev/null; then LIBTOOLIZE=libtoolize else echo "autogen.sh: line $LINENO: command glibtoolize or libtoolize not found" exit 1 fi fi set -ex ${LIBTOOLIZE:-libtoolize} ${ACLOCAL:-aclocal -I m4} ${AUTOCONF:-autoconf} ${AUTOMAKE:-automake} --add-missing
Install vtk for Python 3.7 too
#!/bin/bash set -ex # Install NJOY 2016 ./tools/ci/travis-install-njoy.sh # Install DAGMC if needed if [[ $DAGMC = 'y' ]]; then ./tools/ci/travis-install-dagmc.sh fi # Upgrade pip, pytest, numpy before doing anything else pip install --upgrade pip pip install --upgrade pytest pip install --upgrade numpy # Install mpi4py for MPI configurations if [[ $MPI == 'y' ]]; then pip install --no-binary=mpi4py mpi4py fi # Build and install OpenMC executable python tools/ci/travis-install.py if [[ $TRAVIS_PYTHON_VERSION == "3.7" ]]; then # Install Python API in editable mode pip install -e .[test] else # Conditionally install vtk pip install -e .[test,vtk] fi # For uploading to coveralls pip install coveralls
#!/bin/bash set -ex # Install NJOY 2016 ./tools/ci/travis-install-njoy.sh # Install DAGMC if needed if [[ $DAGMC = 'y' ]]; then ./tools/ci/travis-install-dagmc.sh fi # Upgrade pip, pytest, numpy before doing anything else pip install --upgrade pip pip install --upgrade pytest pip install --upgrade numpy # Install mpi4py for MPI configurations if [[ $MPI == 'y' ]]; then pip install --no-binary=mpi4py mpi4py fi # Build and install OpenMC executable python tools/ci/travis-install.py # Install Python API in editable mode pip install -e .[test,vtk] # For uploading to coveralls pip install coveralls
Use Rust stable for native
set -e TC_X64=beta-x86_64-pc-windows-msvc TC_X32=nightly-i686-pc-windows-msvc ACTIVE_TC=$(rustup show active-toolchain | awk '{print $1}') if [ ! -d "../Release" ]; then echo "../Release not found, are you running this script from the 'Native' directory?" exit 1 fi function copy_to_dest { local dest=$1 if [ ! -d ../Release/$dest ]; then mkdir ../Release/$dest fi if [ -f ../Release/$dest/d3d9.dll ]; then rm -fv ../Release/$dest/d3d9.dll fi cp -a target/release/hook_core.dll ../Release/$dest/d3d9.dll } rustup default $TC_X64 cargo build --release copy_to_dest modelmod_64 rustup default $TC_X32 cargo build --release copy_to_dest modelmod_32 rustup default $ACTIVE_TC echo "=== Toolchain reset to $TC_X64"
set -e TC_X64=stable-x86_64-pc-windows-msvc TC_X32=stable-i686-pc-windows-msvc ACTIVE_TC=$(rustup show active-toolchain | awk '{print $1}') if [ ! -d "../Release" ]; then echo "../Release not found, are you running this script from the 'Native' directory?" exit 1 fi function copy_to_dest { local dest=$1 if [ ! -d ../Release/$dest ]; then mkdir ../Release/$dest fi if [ -f ../Release/$dest/d3d9.dll ]; then rm -fv ../Release/$dest/d3d9.dll fi cp -a target/release/hook_core.dll ../Release/$dest/d3d9.dll } rustup default $TC_X64 cargo clean cargo build --release copy_to_dest modelmod_64 rustup default $TC_X32 cargo clean cargo build --release copy_to_dest modelmod_32 rustup default $ACTIVE_TC cargo clean echo "=== Toolchain reset to $TC_X64"
Update skydev roles + disqus urls during db update
echo "Import latest live db backup" gzip -dc /vagrant/wordpress.sql.gz | mysql --user=root --password=root wordpress-skydreams echo "Truncate domain mapping table" mysql --user=skydev --password=skydev wordpress-skydreams -e 'TRUNCATE wp_domain_mapping;' echo "Replace live domain with dev domain" php /vagrant/scripts/search-replace-db/srdb.cli.php -h localhost -u skydev -n wordpress-skydreams -p skydev -s https://wordpress.skydreams.com -r http://wordpress.skydreams.com php /vagrant/scripts/search-replace-db/srdb.cli.php -h localhost -u skydev -n wordpress-skydreams -p skydev -s wordpress.skydreams.com -r wordpress.skydreams.com.dev cd /vagrant/www/wordpress-skydreams/htdocs/ echo "Add skydev user" wp user create skydev test@skydreams.com --user_pass=skydev --role=administrator wp super-admin add test@skydreams.com
echo "Import latest live db backup" gzip -dc /vagrant/wordpress.sql.gz | mysql --user=root --password=root wordpress-skydreams echo "Truncate domain mapping table" mysql --user=skydev --password=skydev wordpress-skydreams -e 'TRUNCATE wp_domain_mapping;' echo "Replace live domain with dev domain" php /vagrant/scripts/search-replace-db/srdb.cli.php -h localhost -u skydev -n wordpress-skydreams -p skydev -s https://wordpress.skydreams.com -r http://wordpress.skydreams.com php /vagrant/scripts/search-replace-db/srdb.cli.php -h localhost -u skydev -n wordpress-skydreams -p skydev -s wordpress.skydreams.com -r wordpress.skydreams.com.dev cd /vagrant/www/wordpress-skydreams/htdocs/ echo "Add skydev user" wp user create skydev test@skydreams.com --user_pass=skydev --role=administrator wp super-admin add test@skydreams.com for url in $(wp site list --field=url) do wp option update disqus_forum_url skydreams-test --url=$url wp user set-role skydev administrator --url=$url done
Build update for release 0.2.5
#!/bin/bash IMAGE_VERSION='0.2.4' docker rmi -f jorvis/gales-gce docker build --no-cache -t jorvis/gales-gce:latest -t jorvis/gales-gce:${IMAGE_VERSION} . docker images echo "If ready for release, run: " echo " docker push jorvis/gales-gce:latest" echo " docker push jorvis/gales-gce:${IMAGE_VERSION}"
#!/bin/bash IMAGE_VERSION='0.2.5' docker rmi -f jorvis/gales-gce docker build --no-cache -t jorvis/gales-gce:latest -t jorvis/gales-gce:${IMAGE_VERSION} . docker images echo "If ready for release, run: " echo " docker push jorvis/gales-gce:latest" echo " docker push jorvis/gales-gce:${IMAGE_VERSION}"
Update Git submodule on build
#!/usr/bin/env bash DYLIB=libwebsockets.dylib SERVER_EXE=${SERVER_EXE:-mediakeys} LWS_DYNAMIC_LIB_DIR=${LWS_DYNAMIC_LIB_DIR:-/usr/local} SERVER_SOURCE=mediakeys.m LWS_INCLUDE_DIR=$LWS_DYNAMIC_LIB_DIR/include LWS_DYNAMIC_LIB=$LWS_DYNAMIC_LIB_DIR/lib/$DYLIB # Build libwebsockets if it not found if [ ! -f "$LWS_DYNAMIC_LIB" ] then echo "$DYLIB was not found in $LWS_DYNAMIC_LIB" echo "Building libwebsockets" mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX:"PATH=$LWS_DYNAMIC_LIB_DIR" ../lib/libwebsockets make sudo make install cd .. fi clang -framework Cocoa -o "$SERVER_EXE" "$SERVER_SOURCE" -I "$LWS_INCLUDE_DIR" "$LWS_DYNAMIC_LIB" echo "Done"
#!/usr/bin/env bash DYLIB=libwebsockets.dylib SERVER_EXE=${SERVER_EXE:-mediakeys} LWS_DYNAMIC_LIB_DIR=${LWS_DYNAMIC_LIB_DIR:-/usr/local} SERVER_SOURCE=mediakeys.m LWS_INCLUDE_DIR=$LWS_DYNAMIC_LIB_DIR/include LWS_DYNAMIC_LIB=$LWS_DYNAMIC_LIB_DIR/lib/$DYLIB # Build libwebsockets if it not found if [ ! -f "$LWS_DYNAMIC_LIB" ] then echo "$DYLIB was not found in $LWS_DYNAMIC_LIB" echo "Building libwebsockets" git submodule init git submodule foreach git pull origin master mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX:"PATH=$LWS_DYNAMIC_LIB_DIR" ../lib/libwebsockets make sudo make install cd .. fi clang -framework Cocoa -o "$SERVER_EXE" "$SERVER_SOURCE" -I "$LWS_INCLUDE_DIR" "$LWS_DYNAMIC_LIB" echo "Done"
Use set -e for exit instead of || exit
#!/bin/bash # build binary distributions for linux/amd64 and darwin/amd64 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" mkdir -p $DIR/dist mkdir -p $DIR/.godeps export GOPATH=$DIR/.godeps:$GOPATH gpm install os=$(go env GOOS) arch=$(go env GOARCH) version=$(cat $DIR/util/binary_version.go | grep "const BINARY_VERSION" | awk '{print $NF}' | sed 's/"//g') goversion=$(go version | awk '{print $3}') echo "... running tests" ./test.sh || exit 1 for os in linux darwin; do echo "... building v$version for $os/$arch" BUILD=$(mktemp -d -t nsq) TARGET="nsq-$version.$os-$arch.$goversion" GOOS=$os GOARCH=$arch CGO_ENABLED=0 make || exit 1 make DESTDIR=$BUILD/$TARGET PREFIX= install pushd $BUILD tar czvf $TARGET.tar.gz $TARGET mv $TARGET.tar.gz $DIR/dist popd make clean done
#!/bin/bash # Exit on failed commands set -e # build binary distributions for linux/amd64 and darwin/amd64 DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" mkdir -p $DIR/dist mkdir -p $DIR/.godeps export GOPATH=$DIR/.godeps:$GOPATH gpm install os=$(go env GOOS) arch=$(go env GOARCH) version=$(cat $DIR/util/binary_version.go | grep "const BINARY_VERSION" | awk '{print $NF}' | sed 's/"//g') goversion=$(go version | awk '{print $3}') echo "... running tests" ./test.sh for os in linux darwin; do echo "... building v$version for $os/$arch" BUILD=$(mktemp -d -t nsq) TARGET="nsq-$version.$os-$arch.$goversion" GOOS=$os GOARCH=$arch CGO_ENABLED=0 make make DESTDIR=$BUILD/$TARGET PREFIX= install pushd $BUILD tar czvf $TARGET.tar.gz $TARGET mv $TARGET.tar.gz $DIR/dist popd make clean done
Create 'set' and 'next' commands for version function
#------------------------------------------------------------------------------- # # ios/alias.zsh # Command-line aliases for iOS development # #------------------------------------------------------------------------------- # Xcode alias ox='open *.xcodeproj' alias ow='open *.xcworkspace' # agvtool function version() { agvtool_path=$(which agvtool) # "/usr/bin/agvtool" case "$1" in "build" | "-b") agvtool what-version -terse ;; "market" | "-m") agvtool what-marketing-version -terse1 ;; *) # No args, output pretty format build_version=$(agvtool what-version -terse) market_version=$(agvtool what-marketing-version -terse1) echo "$market_version ($build_version)" ;; esac }
#------------------------------------------------------------------------------- # # ios/alias.zsh # Command-line aliases for iOS development # #------------------------------------------------------------------------------- # Xcode alias ox='open *.xcodeproj' alias ow='open *.xcworkspace' # agvtool function version() { agvtool_path=$(which agvtool) # "/usr/bin/agvtool" case "$1" in "build" | "-b") agvtool what-version -terse ;; "market" | "-m") agvtool what-marketing-version -terse1 ;; "set") agvtool new-marketing-version $2 if (($+3)); then agvtool new-version -all $3 fi ;; "next" | "bump") agvtool next-version -all ;; *) # No args, output pretty format build_version=$(agvtool what-version -terse) market_version=$(agvtool what-marketing-version -terse1) echo "$market_version ($build_version)" ;; esac }
Rename binary of sqlite3 fuzzer back to sqlite3_fuzzer.
#!/bin/bash -eu # Copyright 2016 Google Inc. # # 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. # ################################################################################ cd /src/sqlite3 mkdir bld cd bld export ASAN_OPTIONS=detect_leaks=0 # Limit max length of data blobs and sql queries to prevent irrelevant OOMs. export CFLAGS="$CFLAGS -DSQLITE_MAX_LENGTH=128000000 \ -DSQLITE_MAX_SQL_LENGTH=128000000 \ -DSQLITE_PRINTF_PRECISION_LIMIT=128000000" ../configure make -j$(nproc) make sqlite3.c $CC $CFLAGS -I. \ /src/sqlite3/test/ossfuzz.c -o /out/ossfuzz \ -lfuzzer ./sqlite3.o $FUZZER_LDFLAGS cp /src/*.options /src/*.dict /out/
#!/bin/bash -eu # Copyright 2016 Google Inc. # # 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. # ################################################################################ cd /src/sqlite3 mkdir bld cd bld export ASAN_OPTIONS=detect_leaks=0 # Limit max length of data blobs and sql queries to prevent irrelevant OOMs. export CFLAGS="$CFLAGS -DSQLITE_MAX_LENGTH=128000000 \ -DSQLITE_MAX_SQL_LENGTH=128000000 \ -DSQLITE_PRINTF_PRECISION_LIMIT=128000000" ../configure make -j$(nproc) make sqlite3.c $CC $CFLAGS -I. \ /src/sqlite3/test/ossfuzz.c -o /out/sqlite3_fuzzer \ -lfuzzer ./sqlite3.o $FUZZER_LDFLAGS cp /src/*.options /src/*.dict /out/
Adjust MapServer for Travis tests
#!/bin/sh echo "---> Starting MapServer 7.0.0 installation" wget http://download.osgeo.org/mapserver/mapserver-7.0.0.tar.gz tar -zxvf mapserver-7.0.0.tar.gz cd mapserver-7.0.0 mkdir build cd build cmake -DWITH_KML=1 -DWITH_PHP=1 -DWITH_FCGI=0 -DWITH_SVGCAIRO .. make sudo make install cd ../../
#!/bin/sh echo "---> Starting MapServer 7.0.0 installation" wget http://download.osgeo.org/mapserver/mapserver-7.0.0.tar.gz tar -zxvf mapserver-7.0.0.tar.gz cd mapserver-7.0.0 mkdir build cd build cmake -DWITH_KML=1 -DWITH_PHP=1 -DWITH_FCGI=0 -DWITH_SVGCAIRO=1 .. make sudo make install cd ../../
Upgrade JDK versions in CI images
#!/bin/bash set -e case "$1" in java17) echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17%2B35/OpenJDK17-jdk_x64_linux_hotspot_17_35.tar.gz" ;; java18) echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-2021-10-22-05-05-beta/OpenJDK-jdk_x64_linux_hotspot_2021-10-21-23-30.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
#!/bin/bash set -e case "$1" in java17) echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jdk_x64_linux_hotspot_17.0.1_12.tar.gz" ;; java18) echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk-2021-11-17-08-12-beta/OpenJDK-jdk_x64_linux_hotspot_2021-11-16-23-30.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
Correct name for the file converter.
k=(1000 10000 100000 1000000 10000000) for IN_FILE in *.fastq; do fastq_to_fastq -i ${IN_FILE} -o ${IN_FILE//fastq/fna} for i in ${k[@]}; do # Make the directory to store down-sampling results for j in `seq 1 5`; do # An experiment subset_fasta -k ${i} -i ${IN_FILE//fastq/fna} -o ${IN_FILE//.fastq}.i.j.fna done done done
k=(1000 10000 100000 1000000 10000000) for IN_FILE in *.fastq; do fastq_to_fasta -i ${IN_FILE} -o ${IN_FILE//fastq/fna} for i in ${k[@]}; do # Make the directory to store down-sampling results for j in `seq 1 5`; do # An experiment subset_fasta -k ${i} -i ${IN_FILE//fastq/fna} -o ${IN_FILE//.fastq}.i.j.fna done done done
Update docker image used in the onedock tests
# Create test data sudo lxc-attach -n onetest -- bash -c 'cat > ubuntu-docker.tmpl << EOF NAME="ubuntu" PATH=docker://rastasheep/ubuntu-sshd TYPE=OS DESCRIPTION="Ubuntu Trusty with SSHd" EOF' # Create the image sudo lxc-attach -n onetest -- oneimage create -d onedock ubuntu-docker.tmpl sleep 2 # Check the image creation status while sudo lxc-attach -n onetest -- oneimage list | grep ubuntu | awk '{if($9 == "lock"){ exit 0 } else { exit 1 }}' do sleep 2 done # Check that the image is ready (any other state will generate an error) sudo lxc-attach -n onetest -- oneimage list | grep ubuntu | awk '{if($9 == "rdy"){ exit 0 } else { exit 1 }}' # Check that the image exists in the repository sudo lxc-attach -n onetest -- curl -k -X GET https://onetest:5000/v2/_catalog | grep dockerimage sudo lxc-attach -n onetest -- curl -k -X GET https://onetest:5000/v2/dockerimage/tags/list | grep 0
# Create test data sudo lxc-attach -n onetest -- bash -c 'cat > ubuntu-docker.tmpl << EOF NAME="ubuntu" PATH=docker://ubuntu:latest TYPE=OS DESCRIPTION="Ubuntu Trusty with SSHd" EOF' # Create the image sudo lxc-attach -n onetest -- oneimage create -d onedock ubuntu-docker.tmpl sleep 2 # Check the image creation status while sudo lxc-attach -n onetest -- oneimage list | grep ubuntu | awk '{if($9 == "lock"){ exit 0 } else { exit 1 }}' do sleep 2 done # Check that the image is ready (any other state will generate an error) sudo lxc-attach -n onetest -- oneimage list | grep ubuntu | awk '{if($9 == "rdy"){ exit 0 } else { exit 1 }}' # Check that the image exists in the repository sudo lxc-attach -n onetest -- curl -k -X GET https://onetest:5000/v2/_catalog | grep dockerimage sudo lxc-attach -n onetest -- curl -k -X GET https://onetest:5000/v2/dockerimage/tags/list | grep 0
Use latest version of Modeller for runs.
#!/bin/sh #$ -S /bin/sh #$ -cwd #$ -o output.error #$ -e output.error #$ -j y #####$ -l cpu600 #$ -l i386=true #$ -l scratch=1G -l netappsali=1G #$ -r y #$ -N loop #$ -p -4 #$ -t 1-iteration #####node limitation #####$ -l modloop input="loop-@JOBID@.py" output="${SGE_TASK_ID}.log" # Create local scratch directory tmpdir="/scratch/modloop/$JOB_ID/$SGE_TASK_ID" mkdir -p $tmpdir cd $tmpdir # Get input files cp DIR/$input DIR/pdb*AF*pdb . /diva1/home/modeller/mod9v4 - ${SGE_TASK_ID} < $input >& $output # Copy back PDB cp *.B* DIR # Copy back log file (first 5000 lines only, and only for some tasks, in # case a huge log file was produced): if [ "${SGE_TASK_ID}" -lt 6 ]; then head -5000 $output > DIR/$output fi rm -rf $tmpdir
#!/bin/sh #$ -S /bin/sh #$ -cwd #$ -o output.error #$ -e output.error #$ -j y #####$ -l cpu600 #$ -l i386=true #$ -l scratch=1G -l netappsali=1G #$ -r y #$ -N loop #$ -p -4 #$ -t 1-iteration #####node limitation #####$ -l modloop input="loop-@JOBID@.py" output="${SGE_TASK_ID}.log" # Create local scratch directory tmpdir="/scratch/modloop/$JOB_ID/$SGE_TASK_ID" mkdir -p $tmpdir cd $tmpdir # Get input files cp DIR/$input DIR/pdb*AF*pdb . /diva1/home/modeller/mod9v5 - ${SGE_TASK_ID} < $input >& $output # Copy back PDB cp *.B* DIR # Copy back log file (first 5000 lines only, and only for some tasks, in # case a huge log file was produced): if [ "${SGE_TASK_ID}" -lt 6 ]; then head -5000 $output > DIR/$output fi rm -rf $tmpdir
Fix up inconsistencies in prompts.
#!/bin/bash # This script takes as an argument a folder which contains rot47 # encrypted filenames. It reverses the rot47 encryption and copies the # renamed files into a new directory. # This removes the need for any implementation of csv files. # I know my error handling is crap. if [ $# -ne 1 ]; then echo "Please run this script with the anonymized directory as its argument." exit 1 fi ANONDIR="$1" if [ ! -d "$ANONDIR" ]; then echo "Please make sure the only argument is the anonymized directory." exit 2 fi echo "Are you sure you want to deanonymize the files?" read reply if [[ ! "$reply" = "yes" ]]; then echo "Exiting, finish your grading first!." exit 3 fi DEANONDIR="${ANONDIR%-*}"-deanonymized mkdir -p "$DEANONDIR" for i in "$ANONDIR"/*; do OBNAME="$(basename "$i")" # We need some arcane bashisms to make sure the endings persist. UNOBNAME="$(echo "${OBNAME%.*}" | tr '\!-~' 'P-~\!-O')"."${OBNAME##*.}" cp "$i" "$DEANONDIR"/"$UNOBNAME" done echo "The deanonymized files are available in "$DEANONDIR""
#!/bin/bash # This script takes as an argument a folder which contains rot47 # encrypted filenames. It reverses the rot47 encryption and copies the # renamed files into a new directory. # This removes the need for any implementation of csv files. # I know my error handling is crap. if [ $# -ne 1 ]; then echo "Please run this script with the anonymized directory as its argument." exit 1 fi ANONDIR="$1" if [ ! -d "$ANONDIR" ]; then echo "Please make sure the only argument is the anonymized directory." exit 2 fi echo "Are you sure you want to deanonymize the files? 'Yes' to continue." read reply if [[ ! "$reply" = "yes" ]]; then echo "Exiting, finish your grading first!" exit 3 fi DEANONDIR="${ANONDIR%-*}"-deanonymized mkdir -p "$DEANONDIR" for i in "$ANONDIR"/*; do OBNAME="$(basename "$i")" # We need some arcane bashisms to make sure the endings persist. UNOBNAME="$(echo "${OBNAME%.*}" | tr '\!-~' 'P-~\!-O')"."${OBNAME##*.}" cp "$i" "$DEANONDIR"/"$UNOBNAME" done echo "The deanonymized files are available in "$DEANONDIR"."
Switch from cower to auracle
#!/usr/bin/bash set -e echo "==> Setting hostname" echo lisp-in-small-pieces-vm | sudo tee /etc/hostname > /dev/null echo "==> Installing git gambit-c bigloo indent and time" sudo /usr/bin/pacman -S --noconfirm git mit-scheme gambit-c bigloo indent time echo "==> Creating tmpdir" tmpdir=$(/usr/bin/mktemp --directory --tmpdir=${HOME}) pushd ${tmpdir} echo "==> Installing cower" /usr/bin/curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/cower.tar.gz /usr/bin/tar xf cower.tar.gz pushd cower # IPv4 is required for the docker builder. /usr/bin/gpg --keyserver ipv4.pool.sks-keyservers.net --recv-key 487EACC08557AD082088DABA1EB2638FF56C0C53 /usr/bin/makepkg -scri --noconfirm popd echo "==> Installing caml-light" /usr/bin/git clone https://github.com/aur-archive/caml-light.git pushd caml-light /usr/bin/makepkg -scri --noconfirm popd popd # Pop out of tmpdir echo "==> Removing tmpdir" rm -rf ${tmpdir}
#!/usr/bin/bash set -e echo "==> Setting hostname" echo lisp-in-small-pieces-vm | sudo tee /etc/hostname > /dev/null echo "==> Installing git gambit-c bigloo indent and time" sudo /usr/bin/pacman -S --noconfirm git mit-scheme gambit-c bigloo indent time echo "==> Creating tmpdir" tmpdir=$(/usr/bin/mktemp --directory --tmpdir=${HOME}) pushd "$tmpdir" echo "==> Installing auracle" /usr/bin/curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/auracle-git.tar.gz /usr/bin/tar xf auracle-git.tar.gz pushd auracle-git /usr/bin/makepkg -scri --noconfirm popd echo "==> Installing caml-light" /usr/bin/git clone https://github.com/aur-archive/caml-light.git pushd caml-light /usr/bin/makepkg -scri --noconfirm popd popd # Pop out of tmpdir echo "==> Removing tmpdir" rm -rf "$tmpdir"
Fix syntax when generating entities
#!/bin/bash set -ev # generate project cd "$HOME"/app npm link generator-jhipster yo jhipster --force --no-insight # generate entities for f in `ls .jhipster` do yo jhipster:entity ${f%.*} --force ; done for f in `ls *.jh *.jdl` do yo jhipster:import-jdl ${f%.*} --force ; done ls -al "$HOME"/app/ # launch tests ./mvnw clean ./mvnw test gulp test gulp eslint docker-compose -f src/main/docker/mysql.yml up -d sleep 20 ./mvnw clean package -Pprod -DskipTest java -jar target/*.war & sleep 120
#!/bin/bash set -ev # generate project cd "$HOME"/app npm link generator-jhipster yo jhipster --force --no-insight # generate entities for f in `ls .jhipster` ; do yo jhipster:entity ${f%.*} --force ; done for f in `ls *.jh *.jdl` ; do yo jhipster:import-jdl ${f%} --force ; done ls -al "$HOME"/app/ # launch tests ./mvnw clean ./mvnw test gulp test gulp eslint docker-compose -f src/main/docker/mysql.yml up -d sleep 20 ./mvnw clean package -Pprod -DskipTest java -jar target/*.war & sleep 120
Fix linking of Sublime Text preferences
#!/bin/bash set -e TARGET_FILE=$HOME/"Library/Application Support/Sublime Text 3/Packages/User" osascript -e 'quit app "Sublime Text"' rm -rf "$TARGET_FILE" ln -Ffs sublime/ "$TARGET_FILE"
#!/bin/bash set -e SOURCE_FILE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/sublime/" TARGET_FILE=$HOME/"Library/Application Support/Sublime Text 3/Packages/User" osascript -e 'quit app "Sublime Text"' rm -rf "$TARGET_FILE" ln -Ffs "$SOURCE_FILE" "$TARGET_FILE"
Increase linter timeout to 3 minutes
#!/usr/bin/env bash # Copyright 2019 The Tekton Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # 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. # This script runs the presubmit tests; it is started by prow for each PR. # For convenience, it can also be executed manually. # Running the script without parameters, or with the --all-tests # flag, causes all tests to be executed, in the right order. # Use the flags --build-tests, --unit-tests and --integration-tests # to run a specific set of tests. # Markdown linting failures don't show up properly in Gubernator resulting # in a net-negative contributor experience. export DISABLE_MD_LINTING=1 source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh function post_build_tests() { golangci-lint run } # We use the default build, unit and integration test runners. main $@
#!/usr/bin/env bash # Copyright 2019 The Tekton Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # 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. # This script runs the presubmit tests; it is started by prow for each PR. # For convenience, it can also be executed manually. # Running the script without parameters, or with the --all-tests # flag, causes all tests to be executed, in the right order. # Use the flags --build-tests, --unit-tests and --integration-tests # to run a specific set of tests. # Markdown linting failures don't show up properly in Gubernator resulting # in a net-negative contributor experience. export DISABLE_MD_LINTING=1 source $(dirname $0)/../vendor/github.com/tektoncd/plumbing/scripts/presubmit-tests.sh function post_build_tests() { golangci-lint run --deadline 3m } # We use the default build, unit and integration test runners. main $@
Use default port for server
#!/bin/sh # Exit the script if any command fails set -e # Wait for the network being available rc-service networking start # Install some basic tools needed inside the container apk update && apk upgrade apk add tzdata cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime echo "Europe/Berlin" > /etc/timezone apk del tzdata apk add curl wget git mc nano openssh-client shadow # Add zsh / oh-my-zsh and make it the default shell apk add zsh git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh sed -i -e 's/ash/zsh/g' /etc/passwd # Add node.js and angular cli apk add nodejs npm -g install npm @angular/cli # Make the angular server accessible from the host, without port // TODO: needs disable-host-check, too ng set defaults.serve.host 0.0.0.0 -g ng set defaults.serve.port 80 -g # Add a dummy .ssh folder to prevent ssh-agent complaints mkdir ~/.ssh # Cleanup rm -rf /var/cache/apk/* /tmp/*
#!/bin/sh # Exit the script if any command fails set -e # Wait for the network being available rc-service networking start # Install some basic tools needed inside the container apk update && apk upgrade apk add tzdata cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime echo "Europe/Berlin" > /etc/timezone apk del tzdata apk add curl wget git mc nano openssh-client shadow # Add zsh / oh-my-zsh and make it the default shell apk add zsh git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh sed -i -e 's/ash/zsh/g' /etc/passwd # Add node.js and angular cli apk add nodejs npm -g install npm @angular/cli # Make the angular server accessible from the host // TODO: needs disable-host-check, too ng set defaults.serve.host 0.0.0.0 -g # Add a dummy .ssh folder to prevent ssh-agent complaints mkdir ~/.ssh # Cleanup rm -rf /var/cache/apk/* /tmp/*
Refactor away the cd in the start script
#!/bin/bash # Migrations python emission_events/manage.py migrate # Collect static files python emission_events/manage.py collectstatic --noinput # Run app cd emission_events exec gunicorn emission_events.wsgi:application \ --workers 3 \ --bind 0.0.0.0:8000 \ "$@"
#!/bin/bash # Migrations python emission_events/manage.py migrate # Collect static files python emission_events/manage.py collectstatic --noinput # Run app exec gunicorn emission_events.emission_events.wsgi:application \ --workers 3 \ --bind 0.0.0.0:8000 \ "$@"
Allow bot to install npm dependencies
#!/bin/bash # Export env vars for twitter tokens set -a . ./.env set +a # update source git fetch git pull #### DEBUGGING # print out version of node node -v # print out current user echo "$USER" # tweet node --use_strict bot.js
#!/bin/bash # Export env vars for twitter tokens set -a . ./.env set +a # update source git fetch git pull # install dependencies npm install # tweet node --use_strict bot.js
Switch to RE2 default revision 2018-03-01
#!/bin/sh set -e test `basename $PWD` != "c_src" && cd c_src case "$1" in clean) rm -rf re2/obj ;; *) if [ x"$DEBUG" = x"1" ]; then LIBRE2="obj/dbg/libre2.a" else LIBRE2="obj/libre2.a" fi test -f re2/$LIBRE2 && exit 0 RE2_REV=${RE2_REV:-2018-02-01} case $(git config --get remote.origin.url) in git@github.com*|https://github.com*|git://github.com*) RE2_URL=https://github.com/google/re2 ;; *) RE2_URL=https://code.googlesource.com/re2 ;; esac test -d re2 || git clone $RE2_URL (cd re2 && git fetch --all && git checkout $RE2_REV) CXXFLAGS="-Wall -O3 -fPIC -pthread -std=c++11 -m$ERLANG_ARCH" CXX="${CXX:-c++} -m$ERLANG_ARCH" which gmake 1>/dev/null 2>/dev/null && MAKE=gmake MAKE=${MAKE:-make} MAKEFLAGS=${MAKEFLAGS:--j2} export MAKEFLAGS ($MAKE -C re2 $LIBRE2 CXX="$CXX" CXXFLAGS="$CXXFLAGS") ;; esac
#!/bin/sh set -e test `basename $PWD` != "c_src" && cd c_src case "$1" in clean) rm -rf re2/obj ;; *) if [ x"$DEBUG" = x"1" ]; then LIBRE2="obj/dbg/libre2.a" else LIBRE2="obj/libre2.a" fi test -f re2/$LIBRE2 && exit 0 RE2_REV=${RE2_REV:-2018-03-01} case $(git config --get remote.origin.url) in git@github.com*|https://github.com*|git://github.com*) RE2_URL=https://github.com/google/re2 ;; *) RE2_URL=https://code.googlesource.com/re2 ;; esac test -d re2 || git clone $RE2_URL (cd re2 && git fetch --all && git checkout $RE2_REV) CXXFLAGS="-Wall -O3 -fPIC -pthread -std=c++11 -m$ERLANG_ARCH" CXX="${CXX:-c++} -m$ERLANG_ARCH" which gmake 1>/dev/null 2>/dev/null && MAKE=gmake MAKE=${MAKE:-make} MAKEFLAGS=${MAKEFLAGS:--j2} export MAKEFLAGS ($MAKE -C re2 $LIBRE2 CXX="$CXX" CXXFLAGS="$CXXFLAGS") ;; esac
Test on more iOS versions in shell script
#!/bin/bash command_exists () { type "$1" &> /dev/null } # Check whether xcpretty is installed if ! command_exists xcpretty; then echo "xcpretty not found. Please run 'gem install xcpretty'." exit 1 fi DESTINATION='platform=iOS Simulator,name=iPhone 6,OS=10.0' echo "Running 'xcodebuild test' for $DESTINATION. Please wait..." xcodebuild \ -project SwiftyZeroMQ.xcodeproj \ -scheme SwiftyZeroMQ \ -sdk iphonesimulator \ -destination "$DESTINATION" \ -verbose test | xcpretty
#!/bin/bash command_exists () { type "$1" &> /dev/null } run_tests() { echo "Running 'xcodebuild test' for $1. Please wait..." xcodebuild \ -project SwiftyZeroMQ.xcodeproj \ -scheme SwiftyZeroMQ \ -sdk iphonesimulator \ -destination "$1" \ -verbose test | xcpretty } # Check whether xcpretty is installed if ! command_exists xcpretty; then echo "xcpretty not found. Please run 'gem install xcpretty'." exit 1 fi # Test on iPhone 5 (multiple iOS versions) run_tests 'platform=iOS Simulator,name=iPhone 5,OS=8.1' run_tests 'platform=iOS Simulator,name=iPhone 5,OS=9.0' run_tests 'platform=iOS Simulator,name=iPhone 5,OS=10.0'
Revert "Set default browser to chrome"
# # Env Variables # export ANDROID_HOME=/opt/android-sdk # # OS Specific Env Variables # # Ensure languages are set export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 # Ensure editor is set export EDITOR=nvim export VISUAL=nvim # Set browser export BROWSER=google-chrome-stable
# # Env Variables # export ANDROID_HOME=/opt/android-sdk # # OS Specific Env Variables # # Ensure languages are set export LANG=en_US.UTF-8 export LANGUAGE=en_US.UTF-8 export LC_ALL=en_US.UTF-8 # Ensure editor is set export EDITOR=nvim export VISUAL=nvim # Set browser export BROWSER=firefox
Increase statefulfs_size to accomadate larger stateful partitions.
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Common constants for vm scripts. # Default values for creating VM's. DEFAULT_MEM="1024" DEFAULT_VMDK="ide.vmdk" DEFAULT_VMX="chromiumos.vmx" DEFAULT_VBOX_DISK="os.vdi" DEFAULT_QEMU_IMAGE="chromiumos_qemu_image.bin" # Minimum sizes for full size vm images -- needed for update. MIN_VDISK_SIZE_FULL=6072 MIN_STATEFUL_FS_SIZE_FULL=2048
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Common constants for vm scripts. # Default values for creating VM's. DEFAULT_MEM="1024" DEFAULT_VMDK="ide.vmdk" DEFAULT_VMX="chromiumos.vmx" DEFAULT_VBOX_DISK="os.vdi" DEFAULT_QEMU_IMAGE="chromiumos_qemu_image.bin" # Minimum sizes for full size vm images -- needed for update. MIN_VDISK_SIZE_FULL=6072 MIN_STATEFUL_FS_SIZE_FULL=3072
Make gunicorn script runnable in Docker
#!/bin/bash NAME="lutris" PORT=8080 DJANGODIR=/srv/lutris/lutris.net SOCKFILE=/srv/lutris/run/gunicorn.sock USER=django GROUP=django NUM_WORKERS=9 DJANGO_SETTINGS_MODULE=lutrisweb.settings.production DJANGO_WSGI_MODULE=lutrisweb.wsgi echo "Starting $NAME as `whoami`" cd $DJANGODIR source ../bin/activate export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE export PYTHONPATH=$DJANGODIR:$PYTHONPATH source ../bin/envvars RUNDIR=$(dirname $SOCKFILE) test -d $RUNDIR || mkdir -p $RUNDIR exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \ --name $NAME \ --workers $NUM_WORKERS \ --user=$USER --group=$GROUP \ --log-level=debug \ --bind=127.0.0.1:$PORT
#!/bin/bash NAME="lutris" PORT=8080 DJANGODIR=/app USER=django GROUP=django NUM_WORKERS=9 DJANGO_WSGI_MODULE=lutrisweb.wsgi echo "Starting $NAME as `whoami`" cd $DJANGODIR export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE export PYTHONPATH=$DJANGODIR:$PYTHONPATH exec gunicorn ${DJANGO_WSGI_MODULE}:application \ --name $NAME \ --workers $NUM_WORKERS \ --user=$USER --group=$GROUP \ --log-level=debug \ --bind=127.0.0.1:$PORT
Define [root.attachments.ts] as double in connector
#!/bin/bash mongo mongo:27017 <<< "rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'mongo:27017'}], protocolVersion: 1}, {force: true})" curl -XPUT 'http://elasticsearch:9200/slack_logger' -d '{ "settings": { "analysis": { "analyzer": { "kuromoji_analyzer": { "type": "custom", "tokenizer": "kuromoji_tokenizer", "filter": [ "cjk_width", "lowercase" ] } } } } }' -v curl -XPUT 'http://elasticsearch:9200/slack_logger/_mapping/messages' -d '{ "properties": { "text": { "type": "text", "analyzer": "kuromoji_analyzer" }, "ts": { "type": "double" }, "attachments": { "properties": { "ts": { "type": "double" } } } } }' -v mongo-connector -m mongo:27017 -t elasticsearch:9200 -d elastic2_doc_manager --stdout --continue-on-error
#!/bin/bash mongo mongo:27017 <<< "rs.initiate({_id: 'rs0', members: [{_id: 0, host: 'mongo:27017'}], protocolVersion: 1}, {force: true})" curl -XPUT 'http://elasticsearch:9200/slack_logger' -d '{ "settings": { "analysis": { "analyzer": { "kuromoji_analyzer": { "type": "custom", "tokenizer": "kuromoji_tokenizer", "filter": [ "cjk_width", "lowercase" ] } } } } }' -v curl -XPUT 'http://elasticsearch:9200/slack_logger/_mapping/messages' -d '{ "properties": { "text": { "type": "text", "analyzer": "kuromoji_analyzer" }, "ts": { "type": "double" }, "attachments": { "properties": { "ts": { "type": "double" } } }, "root": { "properties": { "attachments": { "properties": { "ts": { "type": "double" } } } } } } }' -v mongo-connector -m mongo:27017 -t elasticsearch:9200 -d elastic2_doc_manager --stdout --continue-on-error
Support for building raring machines
#!/bin/bash set -e source common/ui.sh # If container exists, check if want to continue if $(lxc-ls | grep -q ${CONTAINER}); then if ! $(confirm "The '${CONTAINER}' container already exists, do you want to continue building the box?" 'y'); then log 'Aborting...' exit 1 fi fi # If container exists and wants to continue building the box if $(lxc-ls | grep -q ${CONTAINER}); then if $(confirm "Do you want to rebuild the '${CONTAINER}' container?" 'n'); then log "Destroying container ${CONTAINER}..." lxc-stop -n ${CONTAINER} &>/dev/null || true lxc-destroy -n ${CONTAINER} else log "Reusing existing container..." exit 0 fi fi # If we got to this point, we need to create the container log "Creating container..." lxc-create -n ${CONTAINER} -t download -- \ --dist ${DISTRIBUTION} \ --release ${RELEASE} \ --arch ${ARCH} # TODO: Nicely handle boxes that don't have an image associated log "Container created!" # Fixes some networking issues # See https://github.com/fgrehm/vagrant-lxc/issues/91 for more info if ! $(grep -q 'ip6-allhosts' ${ROOTFS}/etc/hosts); then log "Adding ipv6 allhosts entry to container's /etc/hosts" echo 'ff02::3 ip6-allhosts' >> ${ROOTFS}/etc/hosts fi
#!/bin/bash set -e source common/ui.sh # If container exists, check if want to continue if $(lxc-ls | grep -q ${CONTAINER}); then if ! $(confirm "The '${CONTAINER}' container already exists, do you want to continue building the box?" 'y'); then log 'Aborting...' exit 1 fi fi # If container exists and wants to continue building the box if $(lxc-ls | grep -q ${CONTAINER}); then if $(confirm "Do you want to rebuild the '${CONTAINER}' container?" 'n'); then log "Destroying container ${CONTAINER}..." lxc-stop -n ${CONTAINER} &>/dev/null || true lxc-destroy -n ${CONTAINER} else log "Reusing existing container..." exit 0 fi fi # If we got to this point, we need to create the container log "Creating container..." if [ $RELEASE = 'raring' ]; then lxc-create -n ${CONTAINER} -t ubuntu -- \ --release ${RELEASE} \ --arch ${ARCH} else lxc-create -n ${CONTAINER} -t download -- \ --dist ${DISTRIBUTION} \ --release ${RELEASE} \ --arch ${ARCH} fi log "Container created!" # Fixes some networking issues # See https://github.com/fgrehm/vagrant-lxc/issues/91 for more info if ! $(grep -q 'ip6-allhosts' ${ROOTFS}/etc/hosts); then log "Adding ipv6 allhosts entry to container's /etc/hosts" echo 'ff02::3 ip6-allhosts' >> ${ROOTFS}/etc/hosts fi
Upgrade Java 18 version in CI image
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz" ;; java11) echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz" ;; java17) echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz" ;; java18) echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk18-2022-03-10-06-10-beta/OpenJDK18-jdk_x64_linux_hotspot_2022-03-10-06-10.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz" ;; java11) echo "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz" ;; java17) echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz" ;; java18) echo "https://github.com/adoptium/temurin18-binaries/releases/download/jdk18-2022-03-17-09-00-beta/OpenJDK18-jdk_x64_linux_hotspot_2022-03-17-09-00.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
Fix issue with example 8
#!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$DIR/example_08" . "$DIR/init-settings.sh" PS4='$ ' set -x # Disable parallel make in subcalls to the bug minimizer because it screws with things . "$DIR/disable-parallel-make.sh" rm -f *.vo *.glob *.d .*.d ${PYTHON} ../../find-bug.py example_08.v bug_08_3.v --coqc-is-coqtop "$@" || exit $? LINES="$(cat bug_08_3.v | grep -v '^$' | wc -l)" if [ "$LINES" -ne 10 ] then echo "Expected 10 lines" cat bug_08_3.v exit 1 fi exit 0
#!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$DIR/example_08" . "$DIR/init-settings.sh" PS4='$ ' set -x # Disable parallel make in subcalls to the bug minimizer because it screws with things . "$DIR/disable-parallel-make.sh" rm -f *.vo *.glob *.d .*.d ${PYTHON} ../../find-bug.py example_08.v bug_08_3.v --coqc-is-coqtop "$@" || exit $? LINES="$(cat bug_08_3.v | grep -v '^$' | wc -l)" if [ "$LINES" -ne 11 ] then echo "Expected 11 lines" cat bug_08_3.v exit 1 fi exit 0
Fix permissions + exit on error
chmod 755 /usr/lib/ipfs-station/resources/app/node_modules/go-ipfs-dep/go-ipfs/ipfs
#! /usr/bin/env bash set -e chmod 755 /usr/lib/ipfs-station/resources/app/node_modules/go-ipfs-dep/go-ipfs/ipfs echo "Changed permissions correctly"
Deploy assembly jar to snapshot repository if version ends with "-SNAPSHOT"
#!/bin/sh . ./env.sh cd ../ ./sbt.sh clean assembly cd release mvn deploy:deploy-file \ -DgroupId=gitbucket\ -DartifactId=gitbucket-assembly\ -Dversion=$GITBUCKET_VERSION\ -Dpackaging=jar\ -Dfile=../target/scala-2.11/gitbucket-assembly-$GITBUCKET_VERSION.jar\ -DrepositoryId=sourceforge.jp\ -Durl=scp://shell.sourceforge.jp/home/groups/a/am/amateras/htdocs/mvn/
#!/bin/sh . ./env.sh cd ../ ./sbt.sh clean assembly cd release if [[ "$GITBUCKET_VERSION" =~ -SNAPSHOT$ ]]; then MVN_DEPLOY_PATH=mvn-snapshot else MVN_DEPLOY_PATH=mvn fi echo $MVN_DEPLOY_PATH mvn deploy:deploy-file \ -DgroupId=gitbucket\ -DartifactId=gitbucket-assembly\ -Dversion=$GITBUCKET_VERSION\ -Dpackaging=jar\ -Dfile=../target/scala-2.11/gitbucket-assembly-$GITBUCKET_VERSION.jar\ -DrepositoryId=sourceforge.jp\ -Durl=scp://shell.sourceforge.jp/home/groups/a/am/amateras/htdocs/$MVN_DEPLOY_PATH/
Support caching of Maven resources
#!/usr/bin/env bash cd resource-music-repo mvn package mv target/spring-music.war ../output/spring-music.war
#!/usr/bin/env bash M2_HOME=${HOME}/.m2 mkdir -p ${M2_HOME} M2_LOCAL_REPO="${ROOT_FOLDER}/.m2" mkdir -p "${M2_LOCAL_REPO}/repository" cat > ${M2_HOME}/settings.xml <<EOF <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>${M2_LOCAL_REPO}/repository</localRepository> </settings> EOF cd resource-music-repo mvn package mv target/spring-music.war ../output/spring-music.war
Remove extended attirbutes from GitHub's templates
#!/bin/bash git clone --depth 1 https://github.com/github/gitignore ../temp-github-gitignore find ../temp-github-gitignore -name '*.gitignore' | xargs sed -i 's/ *$//g;$a\'
#!/bin/bash git clone --depth 1 https://github.com/github/gitignore ../temp-github-gitignore find ../temp-github-gitignore -type f -print0 | xargs -0 xattr -c find ../temp-github-gitignore -name '*.gitignore' | xargs sed -i 's/ *$//g;$a\'
Print current directory on server for right now
#! /bin/bash # If on master and not a pull request, deploy to production if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud compute ssh $GCLOUD_INSTANCE --zone $GCLOUD_ZONE --command "./deploy-prod.sh" fi # If on dev and not a pull request, deploy to dev if [ "$TRAVIS_BRANCH" = "dev" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud compute ssh $GCLOUD_INSTANCE --zone $GCLOUD_ZONE --command "./deploy-dev.sh" fi
#! /bin/bash # If on master and not a pull request, deploy to production if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud compute ssh $GCLOUD_INSTANCE --zone $GCLOUD_ZONE --command "./deploy-prod.sh" fi # If on dev and not a pull request, deploy to dev if [ "$TRAVIS_BRANCH" = "dev" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then gcloud compute ssh $GCLOUD_INSTANCE --zone $GCLOUD_ZONE --command "pwd" fi
Set PYTHONPATH to make sure we test the current version.
#!/bin/sh # # Run all tests. # mydir=`dirname $0` set -e : ${PYTHON:="python"} if [ "x$1" = "x--cover" ]; then cd $mydir/../Lib exclude="" if [ "x$YHSM_ZAP" = "x" ]; then exclude="--exclude=test_configure" fi nosetests --with-coverage $exclude . ../Tests/ else $PYTHON $mydir/../setup.py test $* fi
#!/bin/sh # # Run all tests. # mydir=`dirname $0` set -e : ${PYTHON:="python"} if [ "x$1" = "x--cover" ]; then cd $mydir/../Lib exclude="" if [ "x$YHSM_ZAP" = "x" ]; then exclude="--exclude=test_configure" fi nosetests --with-coverage $exclude . ../Tests/ else PYTHONPATH="Lib" $PYTHON $mydir/../setup.py test $* fi
Comment out for installing in US
#!/bin/sh # XCcode命令行组件 xcode-select --install # Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # Rails必需系统组件 brew install libxml2 libxslt libiconv # RVM curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm sed -i .bak -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db # 安装Ruby rvm install 2.2.4 rvm 2.2.4 --default # RubyGems设置和安装bundler gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/ gem install bundler
#!/bin/sh # XCcode命令行组件 xcode-select --install # Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # Rails必需系统组件 brew install libxml2 libxslt libiconv # RVM curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm # sed -i .bak -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db # 安装Ruby rvm install 2.2.4 rvm 2.2.4 --default # RubyGems设置和安装bundler # gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/ gem install bundler
Update Closure Compiler url and parameters
#!/bin/bash PATH=./node_modules/.bin/:$PATH # Clean previous distribution build. rm -rf dist/* # Test if online compilation should be used. if [ "${ONLINE:-true}" == "true" ]; then echo "Compiling using Google Closure Service..." curl --silent \ --request POST \ --data-ascii output_format=text \ --data-ascii output_info=compiled_code \ --data-ascii use_closure_library=true \ --data-ascii compilation_level=SIMPLE_OPTIMIZATIONS \ --data-ascii formatting=PRETTY_PRINT \ --data-urlencode js_code@src/index.js \ --data-urlencode js_code@src/asyoutypeformatter.js \ --data-urlencode js_code@src/phonenumberutil.js \ --data-urlencode js_code@src/phonemetadata.pb.js \ --data-urlencode js_code@src/metadata.js \ --data-urlencode js_code@src/phonenumber.pb.js \ --output dist/libphonenumber.original.js \ http://closure-compiler.appspot.com/compile else echo "Compiling locally..." ant build fi if [ "${BROWSERIFY:-true}" == "true" ]; then echo "Browserifying..." browserify dist/libphonenumber.original.js --standalone libphonenumber --no-browser-field --outfile dist/libphonenumber.js rm dist/libphonenumber.original.js fi echo "Build completed!"
#!/bin/bash PATH=./node_modules/.bin/:$PATH # Clean previous distribution build. rm -rf dist/* # Test if online compilation should be used. if [ "${ONLINE:-true}" == "true" ]; then echo "Compiling using Google Closure Service..." curl --silent \ --data output_format=text \ --data output_info=compiled_code \ --data use_closure_library=true \ --data compilation_level=SIMPLE_OPTIMIZATIONS \ --data formatting=PRETTY_PRINT \ --data-urlencode js_code@src/index.js \ --data-urlencode js_code@src/asyoutypeformatter.js \ --data-urlencode js_code@src/phonenumberutil.js \ --data-urlencode js_code@src/phonemetadata.pb.js \ --data-urlencode js_code@src/metadata.js \ --data-urlencode js_code@src/phonenumber.pb.js \ --output dist/libphonenumber.original.js \ https://closure-compiler.appspot.com/compile else echo "Compiling locally..." ant build fi if [ "${BROWSERIFY:-true}" == "true" ]; then echo "Browserifying..." browserify dist/libphonenumber.original.js --standalone libphonenumber --no-browser-field --outfile dist/libphonenumber.js rm dist/libphonenumber.original.js fi echo "Build completed!"
Set RTS -N2 to zephyr to make circleci happy
set -e rm -rf ../backend/dist/*.{css,js} spago build -u "-g corefn +RTS -N2 -RTS" zephyr -f Home.main Talk.main Search.main NODE_ENV=production webpack -p --progress
set -e rm -rf ../backend/dist/*.{css,js} spago build -u "-g corefn +RTS -N2 -RTS" zephyr -f Home.main Talk.main Search.main +RTS -N2 -RTS NODE_ENV=production webpack -p --progress
Set git core.editor to 'vim'
#!/bin/sh # added missing symlink `test ! -x /usr/bin/ruby && ln -s /opt/vagrant_ruby/bin/ruby /usr/bin/ruby` # install ctags if [ -x /usr/bin/apt-get ]; then # update packages apt-get update # ctags apt-get install exuberant-ctags # python3 apt-get install python3.2 python3.2-minimal fi # install ctags if [ -x /usr/local/bin/pip ]; then # tox pip install tox # coverage pip install coverage fi # configure environment su vagrant -c 'test ! -d ~/.termrc && git clone git://github.com/michalbachowski/termrc.git ~/.termrc && cd ~/.termrc && /bin/bash init.sh' # configure vim su vagrant -c 'test ! -d ~/.vimper && git clone git://github.com/michalbachowski/vimper.git ~/.vimper && cd ~/.vimper && python bootstrap.py' # git config su vagrant -c 'git config --global color.ui true' ## Node.js modules # Yeoman npm install -g yo grunt-cli bower # underscore npm install -g underscore exit 0
#!/bin/sh # added missing symlink `test ! -x /usr/bin/ruby && ln -s /opt/vagrant_ruby/bin/ruby /usr/bin/ruby` # install ctags if [ -x /usr/bin/apt-get ]; then # update packages apt-get update # ctags apt-get install exuberant-ctags # python3 apt-get install python3.2 python3.2-minimal fi # install ctags if [ -x /usr/local/bin/pip ]; then # tox pip install tox # coverage pip install coverage fi # configure environment su vagrant -c 'test ! -d ~/.termrc && git clone git://github.com/michalbachowski/termrc.git ~/.termrc && cd ~/.termrc && /bin/bash init.sh' # configure vim su vagrant -c 'test ! -d ~/.vimper && git clone git://github.com/michalbachowski/vimper.git ~/.vimper && cd ~/.vimper && python bootstrap.py' # git config su vagrant -c 'git config --global color.ui true' su vagrant -c 'git config --global core.editor vim' ## Node.js modules # Yeoman npm install -g yo grunt-cli bower # underscore npm install -g underscore exit 0
Fix config script ansible hosts file
#!/bin/bash # Usage: [OPTIONS] ./16.04.sh # - ansible_version: the ansible version to be installed # Exit on any individual command failure. set -e ansible_version=${ansible_version:-"latest"} apt-get -q update apt-get install -q -y --no-install-recommends python-software-properties\ software-properties-common rsyslog systemd systemd-cron sudo\ python-setuptools build-essential libssl-dev libffi-dev \ python-dev python-pip wget rm -Rf /var/lib/apt/lists/* rm -Rf /usr/share/doc rm -Rf /usr/share/man apt-get -q clean sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf pip -q install --upgrade pip if [ $ansible_version = "latest" ]; then pip install ansible else pip install ansible==$ansible_version fi wget -O initctl_faker https://raw.githubusercontent.com/briandbecker/ansible-role-test-shims/master/config/ubuntu/initctl_faker chmod +x initctl_faker rm -fr /sbin/initctl ln -s /initctl_faker /sbin/initctl #Install inventory file echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
#!/bin/bash # Usage: [OPTIONS] ./16.04.sh # - ansible_version: the ansible version to be installed # Exit on any individual command failure. set -e ansible_version=${ansible_version:-"latest"} apt-get -q update apt-get install -q -y --no-install-recommends python-software-properties\ software-properties-common rsyslog systemd systemd-cron sudo\ python-setuptools build-essential libssl-dev libffi-dev \ python-dev python-pip wget rm -Rf /var/lib/apt/lists/* rm -Rf /usr/share/doc rm -Rf /usr/share/man apt-get -q clean sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf pip -q install --upgrade pip if [ $ansible_version = "latest" ]; then pip install ansible else pip install ansible==$ansible_version fi wget -O initctl_faker https://raw.githubusercontent.com/briandbecker/ansible-role-test-shims/master/config/ubuntu/initctl_faker chmod +x initctl_faker rm -fr /sbin/initctl ln -s /initctl_faker /sbin/initctl #Install inventory file echo "[local]" > /etc/ansible/hosts echo "localhost ansible_connection=local" >> /etc/ansible/hosts
Add a check to see if the tag for a version exists
echo "Check if VERSION.txt has been updated" if git diff --exit-code --quiet packages/govuk-elements-sass/VERSION.txt; then echo "VERSION.txt is unchanged, no need to create release." exit 1 else echo "Proceed to create release..." fi
echo "Check to see if a tag for this version exists" # Get the version from the version file VERSION_TAG="v`cat packages/govuk-elements-sass/VERSION.txt`" # Create a new tag - if the version file has been updated and a tag for that # version doesn't already exist # Check to make sure the tag doesn't already exist if ! git rev-parse $VERSION_TAG >/dev/null 2>&1; then echo "A tag for this version doesn't already exist" echo "Proceed to create release..." else echo "A tag for this version exists, no need to create release." exit 1 fi
Add switch to swallow errors on restore and exit 0 via setting SWALLOW_ERRORS_ON_RESTORE=1
#!/bin/bash # Usage: ./import-db.sh { ARCHIVE_NAME } { PG_RESTORE_ARGS } set -e if test -z "$1" then echo "You must supply an archive name as an argument" exit 1 fi ARCHIVE_NAME=$1 if test -z "$2" then PG_RESTORE_ARGS="--clean --no-owner --no-privileges --schema=public -v" else PG_RESTORE_ARGS=$2 fi if test -z "$DATABASE_URL" then echo "This script restores an archive from DATABASE_URL so it must be set!" exit 1 fi if test -z "$APP_NAME" then echo "This script restores an archive for APP_NAME so it must be set!" exit 1 fi if test -z "$AWS_ACCESS_KEY_ID" || test -z "$AWS_SECRET_ACCESS_KEY" then echo "AWS credentials must be set!" exit 1 fi start_datetime=$(date -u +"%D %T %Z") echo "[data import] Starting at $start_datetime" aws s3 cp s3://artsy-data/$APP_NAME/$ARCHIVE_NAME.pgdump archive.pgdump pg_restore archive.pgdump -d $DATABASE_URL $PG_RESTORE_ARGS end_datetime=$(date -u +"%D %T %Z") echo "[data import] Ended at $end_datetime"
#!/bin/bash # Usage: ./import-db.sh { ARCHIVE_NAME } { PG_RESTORE_ARGS } if test -z "$1" then echo "You must supply an archive name as an argument" exit 1 fi ARCHIVE_NAME=$1 if test -z "$2" then PG_RESTORE_ARGS="--clean --no-owner --no-privileges --schema=public -v" else PG_RESTORE_ARGS=$2 fi if test -z "$DATABASE_URL" then echo "This script restores an archive from DATABASE_URL so it must be set!" exit 1 fi if test -z "$APP_NAME" then echo "This script restores an archive for APP_NAME so it must be set!" exit 1 fi if test -z "$AWS_ACCESS_KEY_ID" || test -z "$AWS_SECRET_ACCESS_KEY" then echo "AWS credentials must be set!" exit 1 fi start_datetime=$(date -u +"%D %T %Z") echo "[data import] Starting at $start_datetime" aws s3 cp s3://artsy-data/$APP_NAME/$ARCHIVE_NAME.pgdump archive.pgdump pg_restore archive.pgdump -d $DATABASE_URL $PG_RESTORE_ARGS end_datetime=$(date -u +"%D %T %Z") echo "[data import] Ended at $end_datetime" if [ "$SWALLOW_ERRORS_ON_RESTORE" = "1" ]; then exit 0 else exit $? fi
Update the proper path for the Vidalia data directory.
#!/bin/sh # # Gnu/Linux does not really require something like RelativeLink.c # However, we do want to have the same look and feel with similiar features. # In the future, we may want this to be a C binary with a custom icon but at the moment # it's quite simple to just use a shell script # echo "Attemping to properly configure HOME..." export HOME=$PWD echo $HOME export LDPATH=$HOME/Lib/ echo "Attemping to properly configure LDPATH..." echo $LDPATH export LD_LIBRARY_PATH=$HOME/Lib/ echo "Attemping to properly configure LD_LIBRARY_PATH..." echo $LD_LIBRARY_PATH export DYLD_PRINT_LIBRARIES=1 echo "Attemping to properly configure DYLD_PRINT_LIBRARIES..." echo $DYLD_PRINT_LIBRARIES # You may want to try this for debugging: # exec $HOME/bin/vidalia --loglevel debug --logfile vidalia-log \ # --datadir .config/ echo "Now attempting to launch the TBB for Linux..." exec $HOME/bin/vidalia --datadir Data/ echo "Everything should be gone!"
#!/bin/sh # # Gnu/Linux does not really require something like RelativeLink.c # However, we do want to have the same look and feel with similiar features. # In the future, we may want this to be a C binary with a custom icon but at the moment # it's quite simple to just use a shell script # echo "Attemping to properly configure HOME..." export HOME=$PWD echo $HOME export LDPATH=$HOME/Lib/ echo "Attemping to properly configure LDPATH..." echo $LDPATH export LD_LIBRARY_PATH=$HOME/Lib/ echo "Attemping to properly configure LD_LIBRARY_PATH..." echo $LD_LIBRARY_PATH export DYLD_PRINT_LIBRARIES=1 echo "Attemping to properly configure DYLD_PRINT_LIBRARIES..." echo $DYLD_PRINT_LIBRARIES # You may want to try this for debugging: # exec $HOME/bin/vidalia --loglevel debug --logfile vidalia-log \ # --datadir .config/ echo "Now attempting to launch the TBB for Linux..." exec $HOME/bin/vidalia --datadir Data/Vidalia/ echo "Everything should be gone!"
Add a useful zsh_directory_name handler
# ================================= # FASD - all kinds of teleportation # ================================= function { emulate -LR zsh local fasd_cache=$ZDOTDIR/fasd-init-cache local fasd_path=$ZDOTDIR/fasd/fasd source $fasd_path if [[ ! -w $fasd_cache ]]; then touch $fasd_cache $fasd_path --init \ zsh-hook \ zsh-wcomp \ zsh-wcomp-install \ > $fasd_cache fi source $fasd_cache } # interactive directory selection # interactive file selection alias sd='fasd -sid' alias sf='fasd -sif' # cd, same functionality as j in autojump alias j='fasd -e cd -d'
# ================================= # FASD - all kinds of teleportation # ================================= function { emulate -LR zsh local fasd_cache=$ZDOTDIR/fasd-init-cache local fasd_path=$ZDOTDIR/fasd/fasd source $fasd_path if [[ ! -w $fasd_cache ]]; then touch $fasd_cache $fasd_path --init \ zsh-hook \ zsh-wcomp \ zsh-wcomp-install \ > $fasd_cache fi source $fasd_cache } # interactive directory selection # interactive file selection alias sd='fasd -sid' alias sf='fasd -sif' # cd, same functionality as j in autojump alias j='fasd -e cd -d' _mydirstack() { local -a lines list for d in $dirstack; do lines+="$(($#lines+1)) -- $d" list+="$#lines" done _wanted -V directory-stack expl 'directory stack' \ compadd "$@" -ld lines -S']/' -Q -a list } zsh_directory_name() { case $1 in (c) _mydirstack;; (n) case $2 in (<0-9>) reply=($dirstack[$2]);; (*) reply=($dirstack[(r)*$2*]);; esac;; (d) false;; esac }
Change and comment out initial user
#!/bin/bash dropdb helios createdb helios python manage.py syncdb python manage.py migrate echo "from helios_auth.models import User; User.objects.create(user_type='google',user_id='ben@adida.net', info={'name':'Ben Adida'})" | python manage.py shell
#!/bin/bash dropdb helios createdb helios python manage.py syncdb python manage.py migrate #echo "from helios_auth.models import User; User.objects.create(user_type='google',user_id='shirlei@gmail.com', info={'name':'Shirlei Chaves'})" | python manage.py shell
Add comment for test linting
#!/bin/sh set -e echo "Linting with Jshint …" jshint js/jquery.imadaem.js jshint test/*.js
#!/bin/sh set -e echo "Linting source …" jshint js/jquery.imadaem.js echo "Linting tests …" jshint test/*.js
Add rubex directory to PKG_CONFIG_PATH search directory.
#!/usr/bin/env bash # Colors. RED="\e[31m" GREEN="\e[32m" YELLOW="\e[33m" RESET="\e[0m" function fold_start { if [ "$TRAVIS" == "true" ]; then echo -en "travis_fold:start:$1\r" echo "\$ $1" fi } function fold_end { if [ "$TRAVIS" == "true" ]; then echo -en "travis_fold:end:$1\r" fi } function do_test { go test ./$1/... build_result=$? echo -ne "${YELLOW}=>${RESET} test $1 - " if [ "$build_result" == "0" ]; then echo -e "${GREEN}SUCCEEDED${RESET}" else echo -e "${RED}FAILED${RESET}" fi } fold_start "termbox" go get github.com/limetext/lime/frontend/termbox fold_end "termbox" # Installing qml dependencies fails atm. # fold_start "qml" # go get github.com/limetext/lime/frontend/qml # fold_end "qml" do_test "backend" fail1=$build_result do_test "frontend/termbox" fail2=$build_result let ex=$fail1+$fail2 exit $ex
#!/usr/bin/env bash # Just so that our oniguruma.pc is found if # the user doesn't have an oniguruma.pc. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PWD/../rubex # Colors. RED="\e[31m" GREEN="\e[32m" YELLOW="\e[33m" RESET="\e[0m" function fold_start { if [ "$TRAVIS" == "true" ]; then echo -en "travis_fold:start:$1\r" echo "\$ $1" fi } function fold_end { if [ "$TRAVIS" == "true" ]; then echo -en "travis_fold:end:$1\r" fi } function do_test { go test ./$1/... build_result=$? echo -ne "${YELLOW}=>${RESET} test $1 - " if [ "$build_result" == "0" ]; then echo -e "${GREEN}SUCCEEDED${RESET}" else echo -e "${RED}FAILED${RESET}" fi } fold_start "termbox" go get github.com/limetext/lime/frontend/termbox fold_end "termbox" # Installing qml dependencies fails atm. # fold_start "qml" # go get github.com/limetext/lime/frontend/qml # fold_end "qml" do_test "backend" fail1=$build_result do_test "frontend/termbox" fail2=$build_result let ex=$fail1+$fail2 exit $ex
Use virtualenv isolation when building wheels
#!/bin/bash -xe # Working variables WHEELHOUSE_DIR=$1 PROJECT=openstack/requirements WORKING_DIR=`pwd`/$PROJECT # Extract and iterate over all the branch names. BRANCHES=`git --git-dir=$WORKING_DIR/.git branch -r | grep '^ origin/[^H]'` for BRANCH in $BRANCHES; do git --git-dir=$WORKING_DIR/.git show $BRANCH:upper-constraints.txt \ 2>/dev/null > /tmp/upper-constraints.txt || true python -m pip --verbose wheel -r /tmp/upper-constraints.txt -w $WHEELHOUSE_DIR || true python3 -m pip --verbose wheel -r /tmp/upper-constraints.txt -w $WHEELHOUSE_DIR || true done
#!/bin/bash -xe # Working variables WHEELHOUSE_DIR=$1 PROJECT=openstack/requirements WORKING_DIR=`pwd`/$PROJECT # Extract and iterate over all the branch names. BRANCHES=`git --git-dir=$WORKING_DIR/.git branch -r | grep '^ origin/[^H]'` for BRANCH in $BRANCHES; do git --git-dir=$WORKING_DIR/.git show $BRANCH:upper-constraints.txt \ 2>/dev/null > /tmp/upper-constraints.txt || true rm -rf build_env virtualenv build_env build_env/bin/pip --verbose wheel -r /tmp/upper-constraints.txt -w $WHEELHOUSE_DIR || true rm -rf build_env virtualenv -p python3 build_env build_env/bin/pip --verbose wheel -r /tmp/upper-constraints.txt -w $WHEELHOUSE_DIR || true done
Enable Docker nosetests for newly-built wheel
#!/bin/bash set -e -x PYBINS=( # "/opt/python/cp27-cp27m/bin" "/opt/python/cp27-cp27mu/bin" # "/opt/python/cp33-cp33m/bin" # "/opt/python/cp34-cp34m/bin" # "/opt/python/cp35-cp35m/bin" ) mkdir -p /io/wheelhouse ls -la /io ls -la /io/convertbng echo $LD_LIBRARY_PATH mkdir -p /usr/local/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib export DOCKER_BUILD=true cp /io/convertbng/liblonlat_bng.so /usr/local/lib # Compile wheels for PYBIN in ${PYBINS[@]}; do ${PYBIN}/pip install -r /io/dev-requirements.txt ${PYBIN}/pip wheel /io/ -w wheelhouse/ done # Bundle external shared libraries into the wheels for whl in wheelhouse/*.whl; do auditwheel repair $whl -w /io/wheelhouse/ done # Install packages and test # for PYBIN in /opt/python/*/bin/; do # ${PYBIN}/pip install convertbng --no-index -f /io/wheelhouse # (cd $HOME; ${PYBIN}/nosetests convertbng) # done
#!/bin/bash set -e -x PYBINS=( # "/opt/python/cp27-cp27m/bin" "/opt/python/cp27-cp27mu/bin" # "/opt/python/cp33-cp33m/bin" # "/opt/python/cp34-cp34m/bin" # "/opt/python/cp35-cp35m/bin" ) mkdir -p /io/wheelhouse # ls -la /io # ls -la /io/convertbng echo $LD_LIBRARY_PATH mkdir -p /usr/local/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib export DOCKER_BUILD=true cp /io/convertbng/liblonlat_bng.so /usr/local/lib # Compile wheels for PYBIN in ${PYBINS[@]}; do ${PYBIN}/pip install -r /io/dev-requirements.txt ${PYBIN}/pip wheel /io/ -w wheelhouse/ done # Bundle external shared libraries into the wheels for whl in wheelhouse/*.whl; do auditwheel repair $whl -w /io/wheelhouse/ done # Install packages and test for PYBIN in /opt/python/*/bin/; do ${PYBIN}/pip install convertbng --no-index -f /io/wheelhouse (cd $HOME; ${PYBIN}/nosetests convertbng) # done
Add step to install rosetta
#! /usr/bin/env sh DIR=$(dirname "$0") cd "$DIR" . scripts/functions.sh info "Prompting for sudo password..." if sudo -v; then # Keep-alive: update existing `sudo` time stamp until `setup.sh` has finished while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & success "Sudo credentials updated." else error "Failed to obtain sudo credentials." fi info "Installing XCode command line tools..." if xcode-select --print-path &>/dev/null; then success "XCode command line tools already installed." elif xcode-select --install &>/dev/null; then success "Finished installing XCode command line tools." else error "Failed to install XCode command line tools." fi # Package control must be executed first in order for the rest to work ./packages/setup.sh find * -name "setup.sh" -not -wholename "packages*" | while read setup; do ./$setup done success "Finished installing Dotfiles"
#! /usr/bin/env sh DIR=$(dirname "$0") cd "$DIR" . scripts/functions.sh info "Prompting for sudo password..." if sudo -v; then # Keep-alive: update existing `sudo` time stamp until `setup.sh` has finished while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & success "Sudo credentials updated." else error "Failed to obtain sudo credentials." fi info "Installing XCode command line tools..." if xcode-select --print-path &>/dev/null; then success "XCode command line tools already installed." elif xcode-select --install &>/dev/null; then success "Finished installing XCode command line tools." else error "Failed to install XCode command line tools." fi info "Installing Rosetta..." sudo softwareupdate --install-rosetta # Package control must be executed first in order for the rest to work ./packages/setup.sh find * -name "setup.sh" -not -wholename "packages*" | while read setup; do ./$setup done success "Finished installing Dotfiles"
Put dbname in the path section of postgresql URL
#!/bin/bash -x # Start PostgreSQL process for tests PGSQL_DATA=`mktemp -d /tmp/gnocchi-psql-XXXXX` PGSQL_PATH=`pg_config --bindir` PGSQL_PORT=9823 ${PGSQL_PATH}/initdb ${PGSQL_DATA} LANGUAGE=C ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-k ${PGSQL_DATA} -p ${PGSQL_PORT}" start > /dev/null export GNOCCHI_TEST_PGSQL_URL="postgresql:///?host=${PGSQL_DATA}&port=${PGSQL_PORT}&dbname=template1" mkdir $PGSQL_DATA/tooz export GNOCCHI_COORDINATION_URL="file:///$PGSQL_DATA/tooz" $* ret=$? ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-p $PGSQL_PORT" stop rm -rf ${PGSQL_DATA} exit $ret
#!/bin/bash -x # Start PostgreSQL process for tests PGSQL_DATA=`mktemp -d /tmp/gnocchi-psql-XXXXX` PGSQL_PATH=`pg_config --bindir` PGSQL_PORT=9823 ${PGSQL_PATH}/initdb ${PGSQL_DATA} LANGUAGE=C ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-k ${PGSQL_DATA} -p ${PGSQL_PORT}" start > /dev/null export GNOCCHI_TEST_PGSQL_URL="postgresql:///template1?host=${PGSQL_DATA}&port=${PGSQL_PORT}" mkdir $PGSQL_DATA/tooz export GNOCCHI_COORDINATION_URL="file:///$PGSQL_DATA/tooz" $* ret=$? ${PGSQL_PATH}/pg_ctl -w -D ${PGSQL_DATA} -o "-p $PGSQL_PORT" stop rm -rf ${PGSQL_DATA} exit $ret
Update sort to generate a log of files
#!/bin/sh DIR=$1 NAMES="$(find ${DIR} -name '[a-z\-]*[0-9]*.*.txt' -exec basename {} \; | grep --only-matching '^[a-z\-]*' | sort -u)" for NAME in $NAMES do OUT_DIR="${DIR}${NAME}" mkdir -p $OUT_DIR find ${DIR} -name "${NAME}[0-9]*.*.txt" -exec mv {} $OUT_DIR \; done
#!/bin/sh DIR=$1 log="${DIR}paperstats.log" NAMES="$(find ${DIR} -name '[a-z\-]*[0-9]*.*.txt' -maxdepth 1 -exec basename {} \; | grep --only-matching '^[a-z\-]*' | sort -u)" for NAME in $NAMES do OUT_DIR="${DIR}${NAME}" mkdir -p $OUT_DIR find ${DIR} -name "${NAME}[0-9]*.*.txt" -exec mv {} $OUT_DIR \; count="$(find ${OUT_DIR} -name '*.txt' -maxdepth 1 | wc -l)" echo "${NAME}\t${count}" >> $log done
Uninstall confirmation no longer reads a 1 character input
#!/bin/bash echo "Before removing git-hooks from your system make syre to run: 'git-hooks --uninstall' on all your repos" echo "This can also be done manually. The backup hooks folder is called hooks.old and can be found in the .git folder in your repos" read -p "Do you really wish to remove git-hooks: " -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then rm -rf ~/.git_hooks echo "Git-hooks was removed from your system" echo "Please proceed to remove the ~/.git_hooks folder from the PATH by editing the ~/.bahs_profile file" else echo "Uninstall aborted!" fi
#!/bin/bash echo "Before removing git-hooks from your system make syre to run: 'git-hooks --uninstall' on all your repos" echo "This can also be done manually. The backup hooks folder is called hooks.old and can be found in the .git folder in your repos" read -p "Do you really wish to remove git-hooks: " -r if [[ $REPLY =~ ^[Yy]$ ]] then rm -rf ~/.git_hooks echo "Git-hooks was removed from your system" echo "Please proceed to remove the ~/.git_hooks folder from the PATH by editing the ~/.bahs_profile file" else echo "Uninstall aborted!" fi
Create nvim config directory before copying
#!/bin/bash echo "Installing vim plugins" vim +PlugInstall +qall echo "Creating backup dir" mkdir backupdir -p cp nvim.conf ~/.config/nvim/init.vim
#!/bin/bash echo "Installing vim plugins" vim +PlugInstall +qall echo "Creating backup dir" mkdir backupdir -p mkdir ~/.config/nvim/ -p 2>/dev/null cp nvim.conf ~/.config/nvim/init.vim
Add search history of commands and key bindings
# Set locale variables to prevent possible encoding issues export LANG='en_US' export LC_ALL='en_US.UTF-8' export LC_TIME="en_GB.UTF-8" # Set the default editor export EDITOR='vim -c startinsert' # Don’t clear the screen after quitting a manual page export MANPAGER='less -X' # LS colors, made with https://geoff.greer.fm/lscolors/ # Difference explained here: https://geoff.greer.fm/2008/06/27/lscolorsls_colors-now-with-linux-support/ # For BSD/macOS export LSCOLORS="eafxcxdxbxegedabagacad" # For Linux export LS_COLORS="di=34;40:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43" export CLICOLOR=1 # Turn on cheat colors export CHEATCOLORS=true bindkey -v bindkey "^R" history-incremental-pattern-search-backward bindkey '^?' backward-delete-char bindkey '^h' backward-delete-char
# Set locale variables to prevent possible encoding issues export LANG='en_US' export LC_ALL='en_US.UTF-8' export LC_TIME="en_GB.UTF-8" # Set the default editor export EDITOR='vim -c startinsert' # Don’t clear the screen after quitting a manual page export MANPAGER='less -X' # LS colors, made with https://geoff.greer.fm/lscolors/ # Difference explained here: https://geoff.greer.fm/2008/06/27/lscolorsls_colors-now-with-linux-support/ # For BSD/macOS export LSCOLORS="eafxcxdxbxegedabagacad" # For Linux export LS_COLORS="di=34;40:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43" export CLICOLOR=1 # Turn on cheat colors export CHEATCOLORS=true bindkey -v bindkey "^R" history-incremental-pattern-search-backward bindkey '^?' backward-delete-char bindkey '^h' backward-delete-char # Search history of commands by arrow up/down autoload -U up-line-or-beginning-search autoload -U down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey '^[[A' up-line-or-beginning-search bindkey '^[[B' down-line-or-beginning-search
Reduce default for parrallel jobs to 10
#!/usr/bin/env bash # Defaults JOBS_DEFAULT=50 NUM_DEFAULT=10 # Parameters NUM=$1 if [ -z $NUM ]; then echo "Number of domains not specified with argument \$1. Using default: $NUM_DEFAULT" NUM=$NUM_DEFAULT fi if [ -z $jobs ]; then echo "Number of parallel jobs for curl to restMQ not specified with environment \$jobs. Using default: $JOBS_DEFAULT" jobs=$JOBS_DEFAULT fi # Constants INPUT_FILE="tmp/alexa.csv" INTERMEDIATE_FILE="tmp/current.csv" DOMAIN_FILE="tmp/domains.txt" # Run head -n "$NUM" "$INPUT_FILE" > "$INTERMEDIATE_FILE" rm -f $DOMAIN_FILE 2> /dev/null while read entry; do values=(${entry//,/ }) rank=${values[0]} domain=${values[1]} echo $domain >> $DOMAIN_FILE done < "$INTERMEDIATE_FILE" cat $DOMAIN_FILE
#!/usr/bin/env bash # Defaults JOBS_DEFAULT=10 NUM_DEFAULT=10 # Parameters NUM=$1 if [ -z $NUM ]; then echo "Number of domains not specified with argument \$1. Using default: $NUM_DEFAULT" NUM=$NUM_DEFAULT fi if [ -z $jobs ]; then echo "Number of parallel jobs for curl to restMQ not specified with environment \$jobs. Using default: $JOBS_DEFAULT" jobs=$JOBS_DEFAULT fi # Constants INPUT_FILE="tmp/alexa.csv" INTERMEDIATE_FILE="tmp/current.csv" DOMAIN_FILE="tmp/domains.txt" # Run head -n "$NUM" "$INPUT_FILE" > "$INTERMEDIATE_FILE" rm -f $DOMAIN_FILE 2> /dev/null while read entry; do values=(${entry//,/ }) rank=${values[0]} domain=${values[1]} echo $domain >> $DOMAIN_FILE done < "$INTERMEDIATE_FILE" cat $DOMAIN_FILE
Fix doc git remote syntax
#!/bin/bash set -ev [ ! -z "${RUSTDOC_VERSION}" ] && [ "${TRAVIS_RUST_VERSION}" != "${RUSTDOC_VERSION}" ] && exit [ -z "${RUSTDOC_VERSION}" ] && [ "${TRAVIS_RUST_VERSION}" != "nightly" ] && exit [ "${TRAVIS_BRANCH}" != "master" ] && exit git config user.name "Travis CI" git config user.email "" if [ -z "${CRATE_NAME}" ]; then CRATE_NAME=$(echo ${TRAVIS_REPO_SLUG} | cut -d '/' -f 2 | sed 's/-/_/g') fi URL="${CRATE_NAME}/index.html" HTML="<!DOCTYPE html> <link rel='canonical' href='${URL}'> <meta http-equiv='refresh' content='0; url=${URL}'> <script>window.location='${URL}'</script>" cargo doc --features tensorflow_unstable ${CARGO_FLAGS} echo "${HTML}" > target/doc/index.html export PYTHONUSERBASE="${HOME}/.local" pip install ghp-import --user ${USER} ${PYTHONUSERBASE}/bin/ghp-import -m 'Update the documentation' -n target/doc git push -qf git@github.com/${TRAVIS_REPO_SLUG}.git gh-pages
#!/bin/bash set -ev [ ! -z "${RUSTDOC_VERSION}" ] && [ "${TRAVIS_RUST_VERSION}" != "${RUSTDOC_VERSION}" ] && exit [ -z "${RUSTDOC_VERSION}" ] && [ "${TRAVIS_RUST_VERSION}" != "nightly" ] && exit [ "${TRAVIS_BRANCH}" != "master" ] && exit git config user.name "Travis CI" git config user.email "" if [ -z "${CRATE_NAME}" ]; then CRATE_NAME=$(echo ${TRAVIS_REPO_SLUG} | cut -d '/' -f 2 | sed 's/-/_/g') fi URL="${CRATE_NAME}/index.html" HTML="<!DOCTYPE html> <link rel='canonical' href='${URL}'> <meta http-equiv='refresh' content='0; url=${URL}'> <script>window.location='${URL}'</script>" cargo doc --features tensorflow_unstable ${CARGO_FLAGS} echo "${HTML}" > target/doc/index.html export PYTHONUSERBASE="${HOME}/.local" pip install ghp-import --user ${USER} ${PYTHONUSERBASE}/bin/ghp-import -m 'Update the documentation' -n target/doc git push -qf git@github.com:${TRAVIS_REPO_SLUG}.git gh-pages
Fix download shell proxy problem.
#!/bin/bash if [[ ! -n $1 ]] ; then echo "Useage : ./autoGetAndroidSource <branch>" exit -1 ; fi ./readConfig.sh if [[ $? -ne 0 ]] ; then exit -1; fi set -v on if [[ ! -d $1 ]] ; then echo "mkdir $1"; mkdir $1; fi cd $1; echo "current dir : `pwd`"; if [[ ! -d .repo ]]; then echo "repo init -u https://android.googlesource.com/platform/manifest -b $1"; repo init -u https://android.googlesource.com/platform/manifest -b $1; fi export http_proxy=192.168.137.1:8087 export https_proxy=192.168.137.1:8087 export GIT_SSL_NO_VERIFY=1 repo sync
#!/bin/bash if [[ ! -n $1 ]] ; then echo "Useage : ./autoGetAndroidSource <branch>" exit -1 ; fi ./readConfig.sh if [[ $? -ne 0 ]] ; then exit -1; fi set -v on if [[ ! -d $1 ]] ; then echo "mkdir $1"; mkdir $1; fi cd $1; echo "current dir : `pwd`"; if [[ ! -d .repo ]]; then echo "repo init -u https://android.googlesource.com/platform/manifest -b $1"; repo init -u https://android.googlesource.com/platform/manifest -b $1; fi export http_proxy=$proxy_host:$proxy_port export https_proxy=$proxy_host:$proxy_port export GIT_SSL_NO_VERIFY=1 repo sync
Print output only when a fail happens
#!/bin/bash if [[ $# -ne 1 ]]; then exit 1 fi BASE_DIR=$(readlink -f $1) FAILS=() for dir in $BASE_DIR/*; do cd $dir if [[ ! -f "./Makefile" ]]; then continue fi EXAMPLE_NAME=$(basename $dir) echo "*** Building app $EXAMPLE_NAME ***" make -j5 if [[ $? -ne 0 ]]; then echo "Build of $EXAMPLE_NAME failed" FAILS+=($EXAMPLE_NAME) continue fi ls *.hex 1>/dev/null 2>&1 if [[ $? -ne 0 ]]; then echo "No output hex file found for $EXAMPLE_NAME" FAILS+=($EXAMPLE_NAME) fi done if [[ ${#FAILS[@]} > 0 ]]; then echo "Apps that failed to build: ${FAILS[@]}" exit 1 fi
#!/bin/bash if [[ $# -ne 1 ]]; then exit 1 fi BASE_DIR=$(readlink -f $1) FAILS=() for dir in $BASE_DIR/*; do cd $dir if [[ ! -f "./Makefile" ]]; then continue fi EXAMPLE_NAME=$(basename $dir) echo "*** Building app $EXAMPLE_NAME ***" make -j5 2>&1 1>build.log if [[ $? -ne 0 ]]; then echo "Build of $EXAMPLE_NAME failed" FAILS+=($EXAMPLE_NAME) tail -n 100 build.log continue fi ls *.hex 1>/dev/null 2>&1 if [[ $? -ne 0 ]]; then echo "No output hex file found for $EXAMPLE_NAME" FAILS+=($EXAMPLE_NAME) fi echo "$EXAMPLE_NAME built properly" done if [[ ${#FAILS[@]} > 0 ]]; then echo "Apps that failed to build: ${FAILS[@]}" exit 1 fi
Improve script exit code handling
#!/usr/bin/env sh echo "########################################################################" echo "# Travix Linux Script" echo "########################################################################" cd build cmake .. make # Run unit tests with verbose output make test ARGS='-V'
#!/usr/bin/env sh script_exit_code=0 step_count=1 check_result(){ desc=$1 shift "$@" exit_code=$? if [ $exit_code -ne 0 ];then echo "[TravisScript] Step $step_count: Error running step \"$desc\" command \"$@\"" script_exit_code=$step_count else echo "[TravisScript] Step $step_count: Success running \"$desc\"" fi step_count=$(($step_count+1)) } echo "########################################################################" echo "# Travix Linux Script" echo "########################################################################" check_result "Enter Build directory" "cd" "build" check_result "Generate Makefiles" "cmake" ".." check_result "Build engine" "make" "engine" # Run unit tests with verbose output check_result "Execute tests" "make" "test" "ARGS='-V'" if [ $exit_code -eq 0 ];then echo "########################################################################" echo "# Success! " echo "########################################################################" else echo "########################################################################" echo "# Error: Failed running step $script_exit_code." echo "########################################################################" fi # Exit with the number of the last step that failed exit $script_exit_code
Print the full OS release from /etc/os-release
# This script gets a container ready to run our various tests in BuildKite echo "--- Container Config..." echo "ruby version:" ruby -v echo "bundler version:" bundler -v echo "--- Preparing Container..." export FORCE_FFI_YAJL="ext" export CHEF_LICENSE="accept-no-persist" export BUNDLE_GEMFILE="/workdir/Gemfile" # make sure we have the network tools in place for various network specs if [ -f /etc/debian_version ]; then touch /etc/network/interfaces fi # remove default bundler config if there is one rm -f .bundle/config echo "+++ Run tests"
# This script gets a container ready to run our various tests in BuildKite echo "--- Container Config..." source /etc/os-release echo $PRETTY_NAME echo "ruby version:" ruby -v echo "bundler version:" bundler -v echo "--- Preparing Container..." export FORCE_FFI_YAJL="ext" export CHEF_LICENSE="accept-no-persist" export BUNDLE_GEMFILE="/workdir/Gemfile" # make sure we have the network tools in place for various network specs if [ -f /etc/debian_version ]; then touch /etc/network/interfaces fi # remove default bundler config if there is one rm -f .bundle/config echo "+++ Run tests"
Correct the regexp for finding unix signal names. For example, earlier, the regexp would accept SIGQUEUE_MAX as a unix signal with name SIGQUEUE. Now it is ignored.
#!/usr/bin/env bash # Copyright 2010 The Go Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. echo '// ./mkunix.sh' "$1" echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT' echo cat <<EOH package signal import ( "syscall" ) var _ = syscall.Syscall // in case there are zero signals const ( EOH sed -n 's/^[ ]*\(SIG[A-Z0-9][A-Z0-9]*\).*/ \1 = UnixSignal(syscall.\1)/p' "$1" echo ")"
#!/usr/bin/env bash # Copyright 2010 The Go Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. echo '// ./mkunix.sh' "$1" echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT' echo cat <<EOH package signal import ( "syscall" ) var _ = syscall.Syscall // in case there are zero signals const ( EOH sed -n 's/^[ ]*\(SIG[A-Z0-9][A-Z0-9]*\)[ ].*/ \1 = UnixSignal(syscall.\1)/p' "$1" echo ")"
Improve gradlew console output for CI
#!/bin/bash echo ">> Building..."; DIRECTORY=$(basename ${PWD}); CUSTOM_SETTINGS_GRADLE_FILE="../settings.gradle.all"; if [ -f $CUSTOM_SETTINGS_GRADLE_FILE ]; then ../gradlew -c $CUSTOM_SETTINGS_GRADLE_FILE :$DIRECTORY:clean :$DIRECTORY:assembleRelease :$DIRECTORY:copyReleaseApkToOutputDirs; RESULT=$?; else ../gradlew :$DIRECTORY:clean :$DIRECTORY:assembleRelease :$DIRECTORY:copyReleaseApkToOutputDirs; RESULT=$?; fi echo ">> Building... DONE"; exit $RESULT;
#!/bin/bash echo ">> Building..."; IS_CI=false; if [[ ! -z "${CI}" ]]; then IS_CI=true; fi echo "app-android/build.sh: IS_CI '${IS_CI}'"; GRADLE_ARGS=""; if [ $IS_CI = true ]; then GRADLE_ARGS=" --console=plain"; fi DIRECTORY=$(basename ${PWD}); CUSTOM_SETTINGS_GRADLE_FILE="../settings.gradle.all"; if [ -f $CUSTOM_SETTINGS_GRADLE_FILE ]; then ../gradlew -c $CUSTOM_SETTINGS_GRADLE_FILE :$DIRECTORY:clean :$DIRECTORY:assembleRelease :$DIRECTORY:copyReleaseApkToOutputDirs $GRADLE_ARGS; RESULT=$?; else ../gradlew :$DIRECTORY:clean :$DIRECTORY:assembleRelease :$DIRECTORY:copyReleaseApkToOutputDirs $GRADLE_ARGS; RESULT=$?; fi echo ">> Building... DONE"; exit $RESULT;
Remove unused modules beets and haxor-news
#!/bin/sh # # Description: installs python and python packages if [ ! $CONFIGS_DIR ]; then echo ERROR: CONFIGS_DIR environment variable is not defined exit 1 fi if [ ! -x /usr/local/bin/brew ]; then echo "ERROR: Homebrew must be installed to run the python.sh installer script" exit 1 fi if [ ! -x /usr/local/bin/python ]; then echo "Installing python..." brew install python --framework --with-brewed-openssl fi echo "Current python: `which python`" echo "Installing python packages..." pip2 install --user neovim pip install beets pip install haxor-news if [ -x $CONFIGS_DIR/python_local.sh ]; then $CONFIGS_DIR/python_local.sh fi exit 0
#!/bin/sh # # Description: installs python and python packages if [ ! $CONFIGS_DIR ]; then echo ERROR: CONFIGS_DIR environment variable is not defined exit 1 fi if [ ! -x /usr/local/bin/brew ]; then echo "ERROR: Homebrew must be installed to run the python.sh installer script" exit 1 fi if [ ! -x /usr/local/bin/python ]; then echo "Installing python..." brew install python --framework --with-brewed-openssl fi echo "Current python: `which python`" echo "Installing python packages..." pip2 install --user neovim if [ -x $CONFIGS_DIR/python_local.sh ]; then $CONFIGS_DIR/python_local.sh fi exit 0
Rename lattice.tfvars to terraform.tfvars in Terraform deployment task
#!/bin/bash set -e unzip lattice-bundle-ci/lattice-bundle-v*.zip terraform_dir=$(echo $PWD/lattice-bundle-v*/terraform/aws) echo "$AWS_SSH_PRIVATE_KEY" > $terraform_dir/key.pem cat > $terraform_dir/lattice.tfvars <<EOF username = "user" password = "pass" aws_access_key_id = "$AWS_ACCESS_KEY_ID" aws_secret_access_key = "$AWS_SECRET_ACCESS_KEY" aws_ssh_private_key_name = "$AWS_SSH_PRIVATE_KEY_NAME" aws_ssh_private_key_path = "${terraform_dir}/key.pem" aws_region = "us-east-1" cell_count = "2" EOF set -x pushd $terraform_dir >/dev/null terraform apply || terraform apply popd >/dev/null
#!/bin/bash set -e unzip lattice-bundle-ci/lattice-bundle-v*.zip terraform_dir=$(echo $PWD/lattice-bundle-v*/terraform/aws) echo "$AWS_SSH_PRIVATE_KEY" > $terraform_dir/key.pem cat > $terraform_dir/terraform.tfvars <<EOF username = "user" password = "pass" aws_access_key_id = "$AWS_ACCESS_KEY_ID" aws_secret_access_key = "$AWS_SECRET_ACCESS_KEY" aws_ssh_private_key_name = "$AWS_SSH_PRIVATE_KEY_NAME" aws_ssh_private_key_path = "${terraform_dir}/key.pem" aws_region = "us-east-1" cell_count = "2" EOF set -x pushd $terraform_dir >/dev/null terraform apply || terraform apply popd >/dev/null
Update install script to use sdkmanager
#!/usr/bin/env bash # # Install required dependencies # $ANDROID_HOME must be set to be cached on CI setup # DEPS_FILE="$ANDROID_HOME/android-dependencies-installed" if [ ! -e $DEPS_FILE ]; then for I in android-25 \ build-tools-25.0.2 \ tool \ extra-android-m2repository \ extra-android-support \ extra-google-google_play_services \ extra-google-m2repository; do echo y | android update sdk --no-ui --all --filter $I ; done touch DEPS_FILE; fi
#!/usr/bin/env bash # # Install required dependencies # sdkmanager can be found in $ANDROID_HOME/tools/bin/sdkmanager # # Accept licences # src http://vgaidarji.me/blog/2017/05/31/automatically-accept-android-sdkmanager-licenses/ /usr/bin/expect -c ' set timeout -1; spawn '"${ANDROID_HOME}"'/tools/bin/sdkmanager --licenses; expect { "y/N" { exp_send "y\r" ; exp_continue } eof } ' for I in "platforms;android-25" \ "platforms;android-23" \ "platforms;android-21" \ "buildDate-tools;25.0.6" \ "extras;google;m2repository" \ "extras;android;m2repository" \ "extras;google;google_play_services"; do echo "Trying to update with tools/bin/sdkmanager: " $I sdkmanager $I done sdkmanager --update
Install openjdk-8 before anything else on Ubuntu 15.10 slaves to prevent openjdk-7 from being pulled in and becoming the default JDK.
# Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Setup scripts for Ubuntu 15.10 apt-get update apt-get install -y zip g++ zlib1g-dev wget git unzip python python3 curl \ openjdk-8-jdk openjdk-8-source ca-certificates-java xvfb # Android SDK requires 32-bits libraries dpkg --add-architecture i386 apt-get -qqy update apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386 apt-get -y install expect # Needed to 'yes' the SDK licenses. # Dependencies for TensorFlow apt-get -y install python-numpy swig python-dev python-pip libcurl3-dev pip install mock
# Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Setup scripts for Ubuntu 15.10 # Android SDK requires 32-bits libraries. dpkg --add-architecture i386 apt-get -y update apt-get -y dist-upgrade # Explicitly install the OpenJDK 8 before anything else to prevent # Ubuntu from pulling in OpenJDK 9. apt-get -y install \ openjdk-8-jdk \ openjdk-8-source packages=( # Bazel dependencies. build-essential curl git python python3 unzip wget xvfb zip zlib1g-dev # Dependencies for Android SDK. # https://developer.android.com/studio/troubleshoot.html#linux-libraries # https://code.google.com/p/android/issues/detail?id=207212 expect libbz2-1.0:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 # Dependencies for TensorFlow. libcurl3-dev python-dev python-numpy python-pip python-wheel swig ) apt-get -y install "${packages[@]}" pip install mock
Reduce verbosity in the self-contained preloaded
#!/bin/bash export TMPDIR=`mktemp -d /tmp/cvmfs_preload_selfextracted.XXXXXX` ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0` tail -n+"$ARCHIVE" "$0" | tar xzv -C "$TMPDIR" || echo "Couldn't extract the tar file" CDIR=$(pwd) cd "$TMPDIR" # execute the command LD_PRELOAD="$TMPDIR/libtbb_cvmfs.so.2 $TMPDIR/libtbbmalloc_cvmfs.so.2 $TMPDIR/libssl.so $TMPDIR/libcrypto.so $TMPDIR/libgssapi_krb5.so $TMPDIR/libkrb5.so $TMPDIR/libk5crypto.so $TMPDIR/libkrb5support.so $TMPDIR/libkeyutils.so" $TMPDIR/cvmfs_preload $@ || echo "Failed to execute cvmfs_preload" cd "$CDIR" rm -rf "$TMPDIR" exit 0 __ARCHIVE_BELOW__
#!/bin/bash export TMPDIR=`mktemp -d /tmp/cvmfs_preload_selfextracted.XXXXXX` ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0` tail -n+"$ARCHIVE" "$0" | tar xz -C "$TMPDIR" || echo "Couldn't extract the tar file" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TMPDIR" # execute the command $TMPDIR/cvmfs_preload $@ || echo "Failed to execute cvmfs_preload" rm -rf "$TMPDIR" exit 0 __ARCHIVE_BELOW__
Add sleep to shell script to be sure bundle file for testing has been created
#!/bin/sh mkdir -p dist node src/server dist/bundle.js & ./node_modules/.bin/watchify example/*.js -o dist/bundle.js & ./node_modules/.bin/http-server example & open http://localhost:8080 wait
#!/bin/sh mkdir -p dist ./node_modules/.bin/watchify example/*.js -o dist/bundle.js & ./node_modules/.bin/http-server example & node src/server dist/bundle.js & sleep 3 open http://localhost:8080 wait
Switch environment build to mamba instead of conda
# Build conda environment. conda env create -f environment.yml source activate nams python -m ipykernel install --user --name nams pip install . conda install conda-pack conda pack -n nams -o nams.tar.gz
# Build conda environment. conda install -c conda-forge mamba mamba env create -f environment.yml source activate nams python -m ipykernel install --user --name nams pip install . conda install conda-pack conda pack -n nams -o nams.tar.gz
Clean the build tree after create debian packages
#!/bin/sh rm -rfv build ./autogen.sh && \ ./configure && \ make && \ dpkg-buildpackage -rfakeroot GEN_STATUS=$? if test $GEN_STATUS -eq 0 then echo "Packages generated" else echo "Error genetating packages" fi exit $GEN_STATUS
#!/bin/sh rm -rfv build ./autogen.sh && \ ./configure && \ make && \ dpkg-buildpackage -rfakeroot -tc GEN_STATUS=$? if test $GEN_STATUS -eq 0 then echo "Packages generated" else echo "Error genetating packages" fi exit $GEN_STATUS
Reset author when applying commit message from a SHA
# git helpers function git-stash-recent-commits { for i in {0..$1} do export git_last_stash_name = git log --format=%B -n 1 HEAD | head -1 | sed -e 's/ /_/g'; git revert HEAD~1 git stash save $git_last_stash_name done } function gitdiff { fact; git diff | vim -R -; } function rebasei { fact; git rebase --interactive "$@"; } function rebaseroot { git rebase --interactive --root $tip } function git-cherry-pick-from-branch { SHA=$(git rev-list --ancestry-path $(git merge-base master $1)...$1 | tail -1) git co master git cherry-pick $SHA git reset HEAD~ git add . git ci -C $SHA git co $1 git rebase master git co - } # random facts alias fact="/usr/local/Cellar/elinks/0.11.7/bin/elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|" alias fact="/usr/local/Cellar/elinks/0.11.7/bin/elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|" PROMPT_COMMAND='git status 2>&1 | grep "On branch" | grep -v master'
# git helpers function git-stash-recent-commits { for i in {0..$1} do export git_last_stash_name = git log --format=%B -n 1 HEAD | head -1 | sed -e 's/ /_/g'; git revert HEAD~1 git stash save $git_last_stash_name done } function gitdiff { fact; git diff | vim -R -; } function rebasei { fact; git rebase --interactive "$@"; } function rebaseroot { git rebase --interactive --root $tip } function git-cherry-pick-from-branch { SHA=$(git rev-list --ancestry-path $(git merge-base master $1)...$1 | tail -1) git co master git cherry-pick $SHA git reset HEAD~ git add . git ci -C $SHA --reset-author git co $1 git rebase master git co - } # random facts alias fact="/usr/local/Cellar/elinks/0.11.7/bin/elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|" alias fact="/usr/local/Cellar/elinks/0.11.7/bin/elinks -dump randomfunfacts.com | sed -n '/^| /p' | tr -d \|" PROMPT_COMMAND='git status 2>&1 | grep "On branch" | grep -v master'
Remove invalid sway option for sgtk-grid
if hash sgtk-grid 2>/dev/null; then sgtk-grid -t 60 -b 28 -o 0.8 -f -d 0 elif hash kitty 2>/dev/null; then TERMINAL_COMMAND="kitty" kitty --class app-menu -e ~/.config/sway/sway-launcher-desktop.sh elif hash termite 2>/dev/null; then TERMINAL_COMMAND="termite -e" termite --name app-menu -e ~/.config/sway/sway-launcher-desktop.sh elif hash mako 2>/dev/null; then notify-send 'No application to display menu' 'Please, install sgtk-menu, kitty or termite' elif hash swaynag 2>/dev/null; then swaynag -m 'No application to display menu. Please, install sgtk-menu, kitty or termite' fi
if hash sgtk-grid 2>/dev/null; then sgtk-grid -t 60 -b 28 -o 0.8 -f elif hash kitty 2>/dev/null; then TERMINAL_COMMAND="kitty" kitty --class app-menu -e ~/.config/sway/sway-launcher-desktop.sh elif hash termite 2>/dev/null; then TERMINAL_COMMAND="termite -e" termite --name app-menu -e ~/.config/sway/sway-launcher-desktop.sh elif hash mako 2>/dev/null; then notify-send 'No application to display menu' 'Please, install sgtk-menu, kitty or termite' elif hash swaynag 2>/dev/null; then swaynag -m 'No application to display menu. Please, install sgtk-menu, kitty or termite' fi
Install fira code as well as hack
#!/bin/bash cd ~/repos/dotfiles printf "\nHomebrew-Cask Fonts\n" echo "------------------------------" echo "Installing homebrew cask fonts" if [ ! "$(brew cask ls | grep font-hack)" ]; then echo "Installing font-hack" brew cask install caskroom/fonts/font-hack fi
#!/bin/bash cd ~/repos/dotfiles printf "\nHomebrew-Cask Fonts\n" echo "------------------------------" echo "Installing homebrew cask fonts" if [ ! "$(brew cask ls | grep font-hack)" ]; then echo "Installing font-hack" brew cask install caskroom/fonts/font-hack fi if [ ! "$(brew cask ls | grep font-fira-code)" ]; then echo "Installing font-hack" brew cask install caskroom/fonts/font-fira-code fi
Add decorations and also ability to destroy persistent containers.
#!/bin/bash echo "Destroying ChRIS containerized development environment from ./docker-compose.yml" echo " " echo "1: Stopping services..." docker-compose stop echo " " echo "2: Removing all containers..." docker-compose rm -vf echo "3: Stopping the swarm..." docker swarm leave --force
#!/bin/bash source ./decorate.sh title -d 1 "Destroying ChRIS containerized development environment" "from ./docker-compose.yml" windowBottom title -d 1 "Stopping services..." docker-compose stop windowBottom title -d 1 "Removing all containers..." docker-compose rm -vf windowBottom title -d 1 "Stopping the swarm..." docker swarm leave --force windowBottom title -d 1 "Destroying persistent volumes..." a_PVOLS=( "chrisultronbackend_chris_dev_data_files" "chrisultronbackend_chris_dev_db_data" "chrisultronbackend_chris_dev_users" ) for VOL in ${a_PVOLS[@]} ; do read -p "Do you want to remove persistent volume $VOL? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] ; then docker volume rm $VOL fi done windowBottom
Fix if condition to test for var==true
#!/bin/sh step="enable-cert-api-manager" printf "Starting to run ${step}\n" . /etc/sysconfig/heat-params if [ "$(echo $CERT_MANAGER_API | tr '[:upper:]' '[:lower:]')" != "false" ]; then cert_dir=/etc/kubernetes/certs echo -e "$CA_KEY" > ${cert_dir}/ca.key chown kube.kube ${cert_dir}/ca.key chmod 400 ${cert_dir}/ca.key fi printf "Finished running ${step}\n"
#!/bin/sh step="enable-cert-api-manager" printf "Starting to run ${step}\n" . /etc/sysconfig/heat-params if [ "$(echo "${CERT_MANAGER_API}" | tr '[:upper:]' '[:lower:]')" = "true" ]; then cert_dir=/etc/kubernetes/certs echo -e "${CA_KEY}" > ${cert_dir}/ca.key chown kube.kube ${cert_dir}/ca.key chmod 400 ${cert_dir}/ca.key fi printf "Finished running ${step}\n"
Add language-c support for atom
#!/bin/sh apm install \ editorconfig \ atom-beautify \ pdf-view zen markdown-preview-plus markdown-writer wordcount \ minimap highlight-selected minimap-highlight-selected \ atom-material-ui atom-material-syntax atom-material-syntax-dark file-icons \ tool-bar tool-bar-main \ docblockr linter \ autocomplete-clang linter-clang switch-header-source \ swift-debugger language-swift \ language-cmake \ linter-jshint \ file-header \ save-session || true
#!/bin/sh apm install \ editorconfig \ atom-beautify \ pdf-view zen markdown-preview-plus markdown-writer wordcount \ minimap highlight-selected minimap-highlight-selected \ atom-material-ui atom-material-syntax atom-material-syntax-dark file-icons \ tool-bar tool-bar-main \ docblockr linter \ autocomplete-clang linter-clang switch-header-source language-c \ swift-debugger language-swift \ language-cmake \ linter-jshint \ file-header \ save-session || true
Make this fail more obviously
#!/bin/bash # TODO: Figure out they want for a real shell REAL_SHELL=/bin/ash # Must use a conistent naming scheme, docker will only let one of these run # at a time. DOCKER_NAME="$USER_shell" # TODO: Figure out what they want from config DOCKER_CONTAINER=busybox PID=$(docker inspect --format {{.State.Pid}} "$DOCKER_NAME") # If we got here, then the docker is not running. if [ -z "$PID" ] || [ "$PID" == 0 ]; then # If the docker is stopped, we must remove it and start a new one docker rm --name="$DOCKER_NAME" # TODO: Configur the bind mounts docker run -t -i --name="$DOCKER_NAME" -v "$HOME":/root/:rw -d "$DOCKER_CONTAINER" PID=$(docker inspect --format {{.State.Pid}} "$DOCKER_NAME") fi sudo nsenter --target $PID --mount --uts --ipc --net --pid -- $REAL_SHELL
#!/bin/bash # TODO: Figure out they want for a real shell REAL_SHELL=/bin/ash # Must use a conistent naming scheme, docker will only let one of these run # at a time. DOCKER_NAME="$USER_shell" # TODO: Figure out what they want from config DOCKER_CONTAINER=busybox PID=$(docker inspect --format {{.State.Pid}} "$DOCKER_NAME") # If we got here, then the docker is not running. if [ -z "$PID" ] || [ "$PID" == 0 ]; then # If the docker is stopped, we must remove it and start a new one docker rm --name="$DOCKER_NAME" # TODO: Configur the bind mounts docker run -t -i --name="$DOCKER_NAME" -v "$HOME":/root/:rw -d "$DOCKER_CONTAINER" PID=$(docker inspect --format {{.State.Pid}} "$DOCKER_NAME") fi sudo nsenter --target "$PID" --mount --uts --ipc --net --pid -- "$REAL_SHELL"
Update the usage notes to be correct
#!/bin/sh ### USAGE # curl https://raw.githubusercontent.com/jenkins-infra/azure/master/scripts/init-ubuntu1404.sh && sudo ./init-ubuntu1404.sh ### # This script is designed to be used via the "Init Script" facility in the Azure cloud plugin for Jenkins. # It assumes that the user executing this script is with sudo! # # It sets up the Ubuntu 14.04 LTS VM for running Jenkins project workloads which are typically going to be # Docker-based ### Prepare to install Docker # Grab the necessary dependencies to add our Docker apt repository apt-get update -qy --fix-missing && apt-get install -qy apt-transport-https ca-certificates # Create the docker.list file echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list # Grab the Docker project's key for apt package signing apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D # Update our local caches with our new repository apt-get update -qy ### apt-get install -qy default-jdk git docker-engine linux-image-extra-$(uname -r) usermod --groups docker --append ${SUDO_USER}
#!/bin/sh ### USAGE # curl -O https://raw.githubusercontent.com/jenkins-infra/azure/master/scripts/init-ubuntu1404.sh && sudo bash ./init-ubuntu1404.sh && newgrp docker ### # This script is designed to be used via the "Init Script" facility in the Azure cloud plugin for Jenkins. # It assumes that the user executing this script is with sudo! # # It sets up the Ubuntu 14.04 LTS VM for running Jenkins project workloads which are typically going to be # Docker-based ### Prepare to install Docker # Grab the necessary dependencies to add our Docker apt repository apt-get update -qy --fix-missing && apt-get install -qy apt-transport-https ca-certificates # Create the docker.list file echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list # Grab the Docker project's key for apt package signing apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D # Update our local caches with our new repository apt-get update -qy ### apt-get install -qy default-jdk git docker-engine linux-image-extra-$(uname -r) usermod --groups docker --append ${SUDO_USER}
Add the correct shutdown command
#!/bin/sh I3LOCK='/usr/bin/i3lock --color 333333' lock() { ~/.i3/i3lock.sh } case "$1" in lock) lock ;; logout) i3-msg exit ;; suspend) ${I3LOCK} && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true ;; hibernate) ${I3LOCK} && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Hibernate" boolean:true ;; reboot) dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true ;; shutdown) dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop ;; *) echo "Usage: $0 <lock|logout|suspend|hibernate|reboot|shutdown>" exit 2 esac exit 0
#!/bin/sh I3LOCK='/usr/bin/i3lock --color 333333' lock() { ~/.i3/i3lock.sh } case "$1" in lock) lock ;; logout) i3-msg exit ;; suspend) ${I3LOCK} && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true ;; hibernate) ${I3LOCK} && dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Hibernate" boolean:true ;; reboot) dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true ;; shutdown) dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true ;; *) echo "Usage: $0 <lock|logout|suspend|hibernate|reboot|shutdown>" exit 2 esac exit 0
Put variables for image promotion in the hash file
export NEW_HASH=`curl $DELOREAN_URL | grep baseurl | awk -F '/' '{ print $5"/"$6"/"$7 }'` export OLD_HASH=`curl $LAST_PROMOTED_URL | grep baseurl | awk -F '/' '{ print $5"/"$6"/"$7 }'` # No need to run the whole promote pipeline if there is nothing new to promote if [ $OLD_HASH == $NEW_HASH ]; then exit 23 fi echo "delorean_current_hash = $NEW_HASH" > $HASH_FILE # Set the $LOCATION where quickstart will expect the images while testing in the pipeline # This is used by the ansible-role-tripleo-image build (atrib) role and oooq/ci-scripts/image.sh echo "LOCATION = $LOCATION" >> $HASH_FILE
export NEW_HASH=`curl $DELOREAN_URL | grep baseurl | awk -F '/' '{ print $5"/"$6"/"$7 }'` export OLD_HASH=`curl $LAST_PROMOTED_URL | grep baseurl | awk -F '/' '{ print $5"/"$6"/"$7 }'` # No need to run the whole promote pipeline if there is nothing new to promote if [ $OLD_HASH == $NEW_HASH ]; then exit 23 fi echo "delorean_current_hash = $NEW_HASH" > $HASH_FILE # These variables are used for the tripleo-quickstart-publish-testing-images # script to put images in the correct location. echo "LOCATION = $LOCATION" >> $HASH_FILE echo "BUILD_SYS = $BUILD_SYS" >> $HASH_FILE echo "RDO_VERSION_DIR = $RDO_VERSION_DIR" >> $HASH_FILE
Add remote monitor to script
#!/bin/bash # from http://unix.stackexchange.com/questions/9804/how-to-comment-multi-line-commands-in-shell-scripts cmd=( qemu-system-x86_64 -machine q35 -cpu core2duo -curses -kernel ./boot.bin -s -net nic,model=e1000 -smp 2 -m 256 # -drive id=disk,file=bmfs.image,if=none,format=raw # -device ahci,id=ahci # -device ide-drive,drive=disk,bus=ahci.0 # -net dump,file=net.pcap # -serial file:serial.log ) #execute the cmd string "${cmd[@]}"
#!/bin/bash # from http://unix.stackexchange.com/questions/9804/how-to-comment-multi-line-commands-in-shell-scripts cmd=( qemu-system-x86_64 -machine q35 -cpu core2duo -curses -kernel ./boot.bin -s -net nic,model=e1000 -smp 2 -m 256 # -drive id=disk,file=bmfs.image,if=none,format=raw # -device ahci,id=ahci # -device ide-drive,drive=disk,bus=ahci.0 # -net dump,file=net.pcap # -serial file:serial.log # -monitor telnet:localhost:1234,server,nowait ) #execute the cmd string "${cmd[@]}"
Fix for django nc listen logic
#!/bin/bash # Container entrypoint script for Django applications. set -e wait_for_node() { if [ "${DEPLOY_ENV}" == "dev" ]; then echo "Waiting for node to start..." until -f .node_complete do sleep 2 done rm -v .node_complete fi } wait_for_postgres() { echo "Waiting for postgres to start..." until nc -z "${DJANGO_DB_HOST}" -p "${DJANGO_DB_PORT}" do sleep 2 done } django_start() { ./manage.py migrate if [ "${DEPLOY_ENV}" == "dev" ]; then ./manage.py runserver 0.0.0.0:8000 else ./manage.py collectstatic -c --noinput gunicorn -c /etc/gunicorn/gunicorn.py securethenews.wsgi fi } wait_for_postgres wait_for_node django_start
#!/bin/bash # Container entrypoint script for Django applications. set -e wait_for_node() { if [ "${DEPLOY_ENV}" == "dev" ]; then echo "Waiting for node to start..." until -f .node_complete do sleep 2 done rm -v .node_complete fi } wait_for_postgres() { echo "Waiting for postgres to start..." until nc -z "${DJANGO_DB_HOST}" "${DJANGO_DB_PORT}" do sleep 2 done } django_start() { ./manage.py migrate if [ "${DEPLOY_ENV}" == "dev" ]; then ./manage.py runserver 0.0.0.0:8000 else ./manage.py collectstatic -c --noinput gunicorn -c /etc/gunicorn/gunicorn.py securethenews.wsgi fi } wait_for_postgres wait_for_node django_start
Handle TMPDIR without trailing slash
#!/usr/bin/env bash set -euo pipefail logfile="q" logpath=$TMPDIR$logfile if [[ -z "$TMPDIR" ]]; then if [[ -e "/system/bin/adb" ]]; then # android logpath="/data/local/tmp/$logfile" else logpath="/tmp/$logfile" fi fi if [[ ! -f "$logpath" ]]; then touch $logpath fi tail -100f $logpath
#!/usr/bin/env bash set -euo pipefail logfile="q" logpath=$TMPDIR/$logfile if [[ -z "$TMPDIR" ]]; then if [[ -e "/system/bin/adb" ]]; then # android logpath="/data/local/tmp/$logfile" else logpath="/tmp/$logfile" fi fi if [[ ! -f "$logpath" ]]; then touch $logpath fi tail -100f $logpath
Use 4 jobs for `make` and add `make all` if install is successfull
#!/bin/bash -ev # Install git of course sudo apt-get install -y git # Prompt user to add ssh-key to github account. This is needed for code-base cloning if [ ! -f ~/.ssh/id_rsa.pub ]; then cat /dev/zero | ssh-keygen -q -N "" echo "Add this ssh key to your github account!" cat ~/.ssh/id_rsa.pub echo "Press [Enter] to continue..." && read fi git clone git@github.com:rranelli/linuxsetup.git cd linuxsetup make
#!/bin/bash -ev # Install git of course sudo apt-get install -y git # Prompt user to add ssh-key to github account. This is needed for code-base cloning if [ ! -f ~/.ssh/id_rsa.pub ]; then cat /dev/zero | ssh-keygen -q -N "" echo "Add this ssh key to your github account!" cat ~/.ssh/id_rsa.pub echo "Press [Enter] to continue..." && read fi git clone git@github.com:rranelli/linuxsetup.git cd linuxsetup make -j 4 make all -j 4
Fix handling of rc.local on RHEL7.
#!/bin/bash # # 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. # # Copyright Clairvoyant 2015 echo never >/sys/kernel/mm/transparent_hugepage/defrag sed -i '/transparent_hugepage/d' /etc/rc.local echo 'echo never >/sys/kernel/mm/transparent_hugepage/defrag' >>/etc/rc.local
#!/bin/bash # # 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. # # Copyright Clairvoyant 2015 if rpm -q redhat-lsb-core; then OSREL=`lsb_release -rs | awk -F. '{print $1}'` else OSREL=`rpm -qf /etc/redhat-release --qf="%{VERSION}\n"` fi if [ $OSREL == 6 ]; then echo never >/sys/kernel/mm/transparent_hugepage/defrag sed -i '/transparent_hugepage/d' /etc/rc.local echo 'echo never >/sys/kernel/mm/transparent_hugepage/defrag' >>/etc/rc.local else # http://www.certdepot.net/rhel7-rc-local-service/ sed -i '/transparent_hugepage/d' /etc/rc.d/rc.local echo 'echo never >/sys/kernel/mm/transparent_hugepage/defrag' >>/etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local systemctl start rc-local fi
Revert "formula is fully reset before a specific revision/branch is checked out"
#!/bin/bash # updates a formula on a masterless or master server set -e # everything must pass set -x # output interpolated set -u # no unbound variables pname=$1 formula=$2 revision=${3:-""} formula_root="/opt/formulas" if [ "$pname" = "builder-private" ]; then formula_root="/opt" fi formula_path="$formula_root/$pname" mkdir -p "$formula_root" if [ -d "$formula_path" ]; then # formula exists, bring it back into a known state cd "$formula_path" git reset --hard # undo any changes git clean -d --force # wipe any unknown files git checkout master # switch to master branch # pull down any changes git pull --rebase else cd "$formula_root" git clone "$formula" "$pname" fi cd "$formula_path" if [ "$revision" != "" ]; then # switch to a specific revision or branch git checkout "$revision" fi
#!/bin/bash # updates a formula on a masterless or master server set -e # everything must pass set -u # no unbound variables pname=$1 formula=$2 revision=${3:-""} formula_root="/opt/formulas" if [ "$pname" == "builder-private" ]; then formula_root="/opt" fi formula_path="$formula_root/$pname" mkdir -p "$formula_root" if [ -d "$formula_path" ]; then cd "$formula_path" git reset --hard git clean -d --force git pull --rebase else cd "$formula_root" git clone "$formula" "$pname" fi cd "$formula_path" if [ "$revision" != "" ]; then git checkout "$revision" fi
Change build script for new directory structure
#!/bin/bash java -jar compiler.jar \ --js_output_file=../js/jquery.presentr.min.js \ --compilation_level=SIMPLE_OPTIMIZATIONS \ --js=../js/jquery.presentr.js
#!/bin/bash java -jar compiler.jar \ --js_output_file=../jquery.presentr.min.js \ --compilation_level=SIMPLE_OPTIMIZATIONS \ --js=../jquery.presentr.js
Fix example rebuild post qa hook
#!/usr/bin/env bash if [[ -z "${TRAVIS+x}" ]] then if [[ "$(git branch | grep '* master')" != "" ]] then echo " Pushing Changes (required to build example) ------------------------------------------- " git push sleep 2; echo " Rebuilding the example code --------------------------- " cd ${projectRoot}/example; bash build.bash; fi fi
#!/usr/bin/env bash if [[ -z "${TRAVIS+x}" ]] then if [[ "$(git branch | grep '* master')" != "" ]] then echo " Pushing Changes (required to build example) ------------------------------------------- " git push sleep 2; echo " Rebuilding the example code --------------------------- " cd ${projectRoot}/example/build_script; bash build.bash; fi fi
Fix Sublime not waiting for commit messages
#!/bin/sh # Editing if [[ ! "$SSH_TTY" ]] && is_osx; then export EDITOR='subl' else export EDITOR='vim' fi export VISUAL="$EDITOR" alias q="$EDITOR" alias qs="q $DOTFILES"
#!/bin/sh # Editing if [[ ! "$SSH_TTY" ]] && is_osx; then export EDITOR='subl -n -w' else export EDITOR='vim' fi export VISUAL="$EDITOR" alias q="$EDITOR" alias qs="q $DOTFILES"