Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Change ssh duringe suse 15 post
#!/bin/sh # This script runs when install is finished, but while the installer # is still running, with the to-be-booted system mounted in /mnt # carry over deployment configuration and api key for OS install action mgr=$(grep ^deploy_server /etc/confluent/confluent.deploycfg|awk '{print $2}') profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|sed -e 's/^profile: //') nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}') export mgr profile nodename mkdir -p /mnt/etc/confluent chmod 700 /mnt/etc/confluent cp /tmp/functions /mnt/etc/confluent/ . /tmp/functions cp -a /etc/confluent/* /mnt/etc/confluent/ cp -a /tls /mnt/etc/confluent/ cp -a /tls/* /mnt/var/lib/ca-certificates/openssl cp -a /tls/* /mnt/var/lib/ca-certificates/pem cp -a /tls/*.pem /mnt/etc/pki/trust/anchors run_remote setupssh.sh
#!/bin/sh # This script runs when install is finished, but while the installer # is still running, with the to-be-booted system mounted in /mnt # carry over deployment configuration and api key for OS install action mgr=$(grep ^deploy_server /etc/confluent/confluent.deploycfg|awk '{print $2}') profile=$(grep ^profile: /etc/confluent/confluent.deploycfg|sed -e 's/^profile: //') nodename=$(grep ^NODENAME /etc/confluent/confluent.info|awk '{print $2}') export mgr profile nodename mkdir -p /mnt/etc/confluent chmod 700 /mnt/etc/confluent cp /tmp/functions /mnt/etc/confluent/ . /tmp/functions cp -a /etc/confluent/* /mnt/etc/confluent/ cp -a /tls /mnt/etc/confluent/ cp -a /tls/* /mnt/var/lib/ca-certificates/openssl cp -a /tls/* /mnt/var/lib/ca-certificates/pem cp -a /tls/*.pem /mnt/etc/pki/trust/anchors run_remote setupssh.sh echo Port 22 >> /etc/ssh/sshd_config echo Port 2222 >> /etc/ssh/sshd_config echo Match LocalPort 22 >> /etc/ssh/sshd_config echo " ChrootDirectory /mnt" >> /etc/ssh/sshd_config kill -HUP $(cat /run/sshd.pid)
Fix Docker Host for Non WSL1 Machines
if [ -n ${WSLENV} ]; then export DOCKER_HOST=tcp://localhost:2375 fi;
if grep -qE "(Microsoft|WSL)" /proc/version &>/dev/null; then export DOCKER_HOST=tcp://localhost:2375 fi
Remove boot2docker mention, its deprecated and no longer supported
#!/bin/bash # # Integartion testing with dockerized Postgres servers # # Boot2Docker is deprecated and no longer supported. # Requires Docker for Mac to run on OSX. # Install: https://docs.docker.com/engine/installation/mac/ # set -e export PGHOST=${PGHOST:-localhost} export PGUSER="postgres" export PGPASSWORD="" export PGDATABASE="booktown" export PGPORT="15432" # TODO: Enable the 10.x branch when it's supported on Travis. # Local 10.x version is required so that pg_dump can properly work with older versions. # 10.x branch is normally supported. versions="9.1 9.2 9.3 9.4 9.5 9.6" for i in $versions do export PGVERSION="$i" echo "------------------------------- BEGIN TEST -------------------------------" echo "Running tests against PostgreSQL v$PGVERSION" docker rm -f postgres || true docker run -p $PGPORT:5432 --name postgres -e POSTGRES_PASSWORD=$PGPASSWORD -d postgres:$PGVERSION sleep 5 make test echo "-------------------------------- END TEST --------------------------------" done
#!/bin/bash # # Integartion testing with dockerized Postgres servers # # Requires Docker for Mac to run on OSX. # Install: https://docs.docker.com/engine/installation/mac/ # set -e export PGHOST=${PGHOST:-localhost} export PGUSER="postgres" export PGPASSWORD="" export PGDATABASE="booktown" export PGPORT="15432" # TODO: Enable the 10.x branch when it's supported on Travis. # Local 10.x version is required so that pg_dump can properly work with older versions. # 10.x branch is normally supported. versions="9.1 9.2 9.3 9.4 9.5 9.6" for i in $versions do export PGVERSION="$i" echo "------------------------------- BEGIN TEST -------------------------------" echo "Running tests against PostgreSQL v$PGVERSION" docker rm -f postgres || true docker run -p $PGPORT:5432 --name postgres -e POSTGRES_PASSWORD=$PGPASSWORD -d postgres:$PGVERSION sleep 5 make test echo "-------------------------------- END TEST --------------------------------" done
Fix invalid concurrent builds bug
#!/usr/bin/env bash # # Copyright 2017 Alsanium, SAS. or its affiliates. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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. # base=$PWD handler=$1 binary=$2 package=$3 mkdir -p /package/$handler cp $binary /package/$handler.so cp /shim/__init__.pyc /package/$handler/__init__.pyc cp /shim/proxy.pyc /package/$handler/proxy.pyc cp /shim/runtime.so /package/$handler/runtime.so cd /package; find . -exec touch -t 201302210800 {} +; zip -qrX $package *; cd $base mv /package/$package .
#!/usr/bin/env bash # # Copyright 2017 Alsanium, SAS. or its affiliates. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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. # CUR=$PWD HLD=$1 BIN=$2 PKG=$3 TMP=`mktemp -d` mkdir $TMP/$HLD cp $BIN $TMP/$HLD.so cp /shim/__init__.pyc $TMP/$HLD/__init__.pyc cp /shim/proxy.pyc $TMP/$HLD/proxy.pyc cp /shim/runtime.so $TMP/$HLD/runtime.so cd $TMP find . -exec touch -t 201302210800 {} + zip -qrX $PKG * mv $PKG $CUR/. rm -rf $TMP
Update translation template generation script
#!/bin/bash # Extract all translatable messages to update the Arista PO template xgettext -L glade -o locale/templates/arista.pot ui/*.ui xgettext -L python -o - arista-gtk arista-transcode arista/*.py | tail -n +18 >>locale/templates/arista.pot
#!/bin/bash # Extract all translatable messages to update the Arista PO template xgettext -L glade -o - ui/*.ui | tail -n +6 >locale/templates/arista.pot xgettext -L python -o - arista-gtk arista-transcode arista/*.py arista/inputs/*.py | tail -n +18 >>locale/templates/arista.pot
Migrate to the newer homebrew installer
is_osx || return 0 ( # Homebrew packages to install packages=( bat cmake colordiff dos2unix fd fzf gh git htop hub mas nmap node ripgrep ssh-copy-id unrar vim watch watchman xz yarn ) # Install homebrew first if ! hash brew > /dev/null 2>&1 ; then ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor fi # Make sure everything is up-to-date brew update > /dev/null # Upgrade existing packages brew upgrade # Install the packages for package in ${packages[@]} ; do brew ls $package > /dev/null 2>&1 || brew install $package done # Cleanup after install brew prune brew cleanup )
is_osx || return 0 ( # Homebrew packages to install packages=( bat cmake colordiff dos2unix fd fzf gh git htop hub mas nmap node ripgrep ssh-copy-id unrar vim watch watchman xz yarn ) # Install homebrew first if ! hash brew > /dev/null 2>&1 ; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew doctor fi # Make sure everything is up-to-date brew update > /dev/null # Upgrade existing packages brew upgrade # Install the packages for package in ${packages[@]} ; do brew ls $package > /dev/null 2>&1 || brew install $package done # Cleanup after install brew prune brew cleanup )
Create a shell function to format elapsed seconds
# Overwrite our sh function with a simpler one, because zsh is awesome. full-path () { echo "$1:a" }
# Overwrite our sh function with a simpler one, because zsh is awesome. full-path () { echo "$1:a" } # Format argument (of seconds) into separate units (up to days). format-elapsed-time () { local -F sec=$1 local -a elapsed local -i i top local -a units; units=('d' 'h' 'm') local -a amts; amts=(86400 3600 60) for ((i=1; i <= ${#units}; i++)); do if (( $sec >= ${amts[$i]} )); then (( top = $sec / $amts[$i] )) (( sec = $sec - $top * $amts[$i] )) elapsed+="${top}${units[$i]}" fi done # Append remaining seconds to array after stripping trailing zeros. # TODO: Round this to 3 or 6 decimal places? elapsed+="${${sec//%0#/}%.}s" echo "${(j, ,)elapsed}" }
Synchronize the container hostnames with the docker container names
#!/bin/bash tempfile=/tmp/hosts$RANDOM for cid in $(docker ps -q) ; do name=$(docker inspect ${cid} | grep Name | head -n 1 | cut -d\/ -f 2 | cut -d\" -f 1); ip=$(docker inspect ${cid} | grep -v \"\" | grep \"IPAddress\" | cut -d\" -f 4 | head -n 1) ipv6=$(docker inspect ${cid}| grep -v \"\" | grep \"GlobalIPv6Address\" | cut -d\" -f 4 | head -n 1) if [ ! -z "${ip}" ]; then echo ${ip} ${name} >> ${tempfile} else if [ ! -z "${ipv6}" ]; then echo ${ipv6} ${name} >> ${tempfile} fi fi done echo "127.0.0.1 localhost" >> ${tempfile} cp ${tempfile} /etc/hosts rm ${tempfile}
#!/bin/bash # fix the hostnames for name in $(docker ps --format "{{.Names}}") ; do echo $name ; docker exec -u root $name /sbin/sysctl -w kernel.hostname=$name ; done # fix /etc/hosts tempfile=/tmp/hosts$RANDOM for cid in $(docker ps -q) ; do name=$(docker inspect ${cid} | grep Name | head -n 1 | cut -d\/ -f 2 | cut -d\" -f 1); ip=$(docker inspect ${cid} | grep -v \"\" | grep \"IPAddress\" | cut -d\" -f 4 | head -n 1) ipv6=$(docker inspect ${cid}| grep -v \"\" | grep \"GlobalIPv6Address\" | cut -d\" -f 4 | head -n 1) if [ ! -z "${ip}" ]; then echo ${ip} ${name} >> ${tempfile} else if [ ! -z "${ipv6}" ]; then echo ${ipv6} ${name} >> ${tempfile} fi fi done echo "127.0.0.1 localhost" >> ${tempfile} cp ${tempfile} /etc/hosts rm ${tempfile}
Disable dock icons from bouncing
# Sets reasonable OS X defaults. # # Or, in other words, set shit how I like in OS X. # # The original idea (and a couple settings) were grabbed from: # https://github.com/mathiasbynens/dotfiles/blob/master/.osx # # Run ./set-defaults.sh and you'll be good to go. # Disable press-and-hold for keys in favor of key repeat defaults write -g ApplePressAndHoldEnabled -bool false # Use AirDrop over every interface. srsly this should be a default. defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1 # Always open everything in Finder's list view. This is important. defaults write com.apple.Finder FXPreferredViewStyle Nlsv # Show the ~/Library folder chflags nohidden ~/Library
# Sets reasonable OS X defaults. # # Or, in other words, set shit how I like in OS X. # # The original idea (and a couple settings) were grabbed from: # https://github.com/mathiasbynens/dotfiles/blob/master/.osx # # Run ./set-defaults.sh and you'll be good to go. # Disable press-and-hold for keys in favor of key repeat defaults write -g ApplePressAndHoldEnabled -bool false # Use AirDrop over every interface. srsly this should be a default. defaults write com.apple.NetworkBrowser BrowseAllInterfaces 1 # Always open everything in Finder's list view. This is important. defaults write com.apple.Finder FXPreferredViewStyle Nlsv # Show the ~/Library folder chflags nohidden ~/Library # Disable icons bouncing in the Dock defaults write com.apple.dock no-bouncing -bool TRUE killall Dock
Add matplotlib as a dependency.
#!/bin/bash function safe_call { # usage: # safe_call function param1 param2 ... HERE=$(pwd) "$@" cd "$HERE" } function install_theano { pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git } function install_joblib { pip install joblib } function install_pylearn2 { DIR="$1" cd "$DIR" git clone -b parameter_prediction git@bitbucket.org:mdenil/pylearn2.git cd pylearn2 python setup.py install } ENV=pp_env EXTERNAL=external rm -rf $ENV conda create --yes --prefix pp_env accelerate pip nose source activate "$(pwd)/$ENV" safe_call install_theano safe_call install_joblib safe_call install_pylearn2 "$EXTERNAL" cat <<EOF Run: source activate "$(pwd)/$ENV" to activate the environment. When you're done you can run source deactivate to close the environement. EOF
#!/bin/bash function safe_call { # usage: # safe_call function param1 param2 ... HERE=$(pwd) "$@" cd "$HERE" } function install_theano { pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git } function install_joblib { pip install joblib } function install_matplotlib { conda install matplotlib } function install_pylearn2 { DIR="$1" cd "$DIR" git clone -b parameter_prediction git@bitbucket.org:mdenil/pylearn2.git cd pylearn2 python setup.py install } ENV=pp_env EXTERNAL=external rm -rf $ENV conda create --yes --prefix pp_env accelerate pip nose source activate "$(pwd)/$ENV" safe_call install_theano safe_call install_joblib safe_call install matplotlib safe_call install_pylearn2 "$EXTERNAL" cat <<EOF Run: source activate "$(pwd)/$ENV" to activate the environment. When you're done you can run source deactivate to close the environement. EOF
Add a newline when the battery status is printed
#!/bin/sh ## You may need to customize the sysctl command below to use variables that show ## your system's battery state and remaining life. interval=15 # customize this stump_pid="$(pgrep -a -n stumpwm)" # while stumpwm is still running while kill -0 "$stump_pid" > /dev/null 2>&1; do /sbin/sysctl -n hw.acpi.battery.state hw.acpi.battery.life | tr '\n' ' ' sleep "$interval" done
#!/bin/sh ## You may need to customize the sysctl command below to use variables that show ## your system's battery state and remaining life. interval=15 # customize this stump_pid="$(pgrep -a -n stumpwm)" # while stumpwm is still running while kill -0 "$stump_pid" > /dev/null 2>&1; do sysctl -n hw.acpi.battery.state hw.acpi.battery.life | paste -s -d ' ' - sleep "$interval" done
FIX remove space near "=" because bash script dont accept it for variable assigment..
#!/bin/bash if [ ! -f /data/persistent/.root_pw_set ]; then /data/set_root_pw.sh fi # see this bug report for more info https://github.com/cloudbec/nuagebec-docker-ubuntu/issues/1 UPCASED_UPCASED_SSH_SERVER = `echo "$SSH_SERVER" | tr '[a-z]' '[A-Z]'` if [ "$UPCASED_SSH_SERVER" == "FALSE" ] || [ "$UPCASED_SSH_SERVER" == "0" ]; then sed -i 's/autostart=true/autostart=false/g' /etc/supervisor/conf.d/sshd.conf fi exec supervisord -n -c /etc/supervisor/supervisord.conf
#!/bin/bash if [ ! -f /data/persistent/.root_pw_set ]; then /data/set_root_pw.sh fi # see this bug report for more info https://github.com/cloudbec/nuagebec-docker-ubuntu/issues/1 UPCASED_UPCASED_SSH_SERVER=`echo "$SSH_SERVER" | tr '[a-z]' '[A-Z]'` if [ "$UPCASED_SSH_SERVER" == "FALSE" ] || [ "$UPCASED_SSH_SERVER" == "0" ]; then sed -i 's/autostart=true/autostart=false/g' /etc/supervisor/conf.d/sshd.conf fi exec supervisord -n -c /etc/supervisor/supervisord.conf
Make pip installs not quiet so we can see what failed
#!/bin/bash set -vx # print command from file as well as evaluated command set -e # fail and exit on any command erroring : "${TF_VERSION:?}" source ./oss_scripts/utils.sh # Install ffmpeg for Audio FeatureConnector tests if command -v ffmpeg 2>/dev/null then echo "Using installed ffmpeg" else echo "Installing ffmpeg" sudo add-apt-repository -y ppa:mc3man/trusty-media sudo apt-get update -qq sudo apt-get install -qq -y ffmpeg fi install_tf "$TF_VERSION" # Make sure we have the latest version of numpy - avoid problems we were # seeing with Python 3 pip install -q -U numpy # First ensure that the base dependencies are sufficient for a full import and # data load pip install -q -e . python -c "import tensorflow_datasets as tfds" python -c "import tensorflow_datasets as tfds; tfds.load('mnist', split=tfds.Split.TRAIN)" # Then install the test dependencies pip install -q -e .[tests]
#!/bin/bash set -vx # print command from file as well as evaluated command set -e # fail and exit on any command erroring : "${TF_VERSION:?}" source ./oss_scripts/utils.sh # Install ffmpeg for Audio FeatureConnector tests if command -v ffmpeg 2>/dev/null then echo "Using installed ffmpeg" else echo "Installing ffmpeg" sudo add-apt-repository -y ppa:mc3man/trusty-media sudo apt-get update -qq sudo apt-get install -qq -y ffmpeg fi install_tf "$TF_VERSION" # Make sure we have the latest version of numpy - avoid problems we were # seeing with Python 3 pip install -q -U numpy # First ensure that the base dependencies are sufficient for a full import and # data load pip install -e . python -c "import tensorflow_datasets as tfds" python -c "import tensorflow_datasets as tfds; tfds.load('mnist', split=tfds.Split.TRAIN)" # Then install the test dependencies pip install -e .[tests]
Use --with-cuda=CUDA_HOME in project configuration
#!/bin/bash # Script called by Travis to build CUDArrays export PATH=/usr/local/cmake/bin:$PATH set -e set -x MAKE="make --jobs=$NUM_THREADS --keep-going" CONFIGURE="../configure --with-gcc=/usr/bin/g++-4.9" if $BUILD_DEBUG then CONFIGURE="$CONFIGURE --enable-debug" fi mkdir build cd build $CONFIGURE $MAKE tests/unit/UnitTests $MAKE clean cd -
#!/bin/bash # Script called by Travis to build CUDArrays export PATH=/usr/local/cmake/bin:$PATH set -e set -x MAKE="make --jobs=$NUM_THREADS --keep-going" CONFIGURE="../configure --with-gcc=/usr/bin/g++-4.9 --with-cuda=$CUDA_HOME" if $BUILD_DEBUG then CONFIGURE="$CONFIGURE --enable-debug" fi mkdir build cd build $CONFIGURE $MAKE tests/unit/UnitTests $MAKE clean cd -
Disable init_model.py test, which will be replaced with new model creation logic.
#!/bin/bash if [ "${VIA}" == "pypi" ]; then rm -rf * pip install spacy python -m spacy.en.download python -m spacy.de.download fi if [ "${VIA}" == "sdist" ]; then rm -rf * pip uninstall spacy wget https://api.explosion.ai/build/spacy/sdist/$TRAVIS_COMMIT mv $TRAVIS_COMMIT sdist.tgz pip install -U sdist.tgz fi if [ "${VIA}" == "compile" ]; then pip install -r requirements.txt pip install -e . mkdir -p corpora/en cd corpora/en wget --no-check-certificate http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz tar -xzf WordNet-3.0.tar.gz mv WordNet-3.0 wordnet cd ../../ mkdir models/ python bin/init_model.py en lang_data/ corpora/ models/en fi
#!/bin/bash if [ "${VIA}" == "pypi" ]; then rm -rf * pip install spacy python -m spacy.en.download python -m spacy.de.download fi if [ "${VIA}" == "sdist" && "$TRAVIS_PULL_REQUEST" == "false" ]; then rm -rf * pip uninstall spacy wget https://api.explosion.ai/build/spacy/sdist/$TRAVIS_COMMIT mv $TRAVIS_COMMIT sdist.tgz pip install -U sdist.tgz fi #if [ "${VIA}" == "compile" ]; then # pip install -r requirements.txt # pip install -e . # mkdir -p corpora/en # cd corpora/en # wget --no-check-certificate http://wordnetcode.princeton.edu/3.0/WordNet-3.0.tar.gz # tar -xzf WordNet-3.0.tar.gz # mv WordNet-3.0 wordnet # cd ../../ # mkdir models/ # python bin/init_model.py en lang_data/ corpora/ models/en #fi
Fix build-multidigest binary script typo
#!/bin/bash set -e -x -u base=${pwd} export GOPATH=$(pwd)/gopath export PATH=/usr/local/ruby/bin:/usr/local/go/bin:$PATH semver=`cat version-semver/number` timestamp=`date -u +"%Y-%m-%dT%H:%M:%SZ"` filename="verify-multidigest-${semver}-${GOOS}-${GOARCH}" cd gopath/src/github.com/cloudfoundry/bosh-utils bin/require-ci-golang-version git_rev=`git rev-parse --short HEAD` version="${semver}-${git_rev}-${timestamp}" echo "building ${filename} with version ${version}" sed -i 's/\[DEV BUILD\]/'"$version"'/' main/version.go bin/build-linux-amd64 mv out/verify-multidigest $base/compiled-${GOOS}/${filename}
#!/bin/bash set -e -x -u base=$(pwd) export GOPATH=$(pwd)/gopath export PATH=/usr/local/ruby/bin:/usr/local/go/bin:$PATH semver=`cat version-semver/number` timestamp=`date -u +"%Y-%m-%dT%H:%M:%SZ"` filename="verify-multidigest-${semver}-${GOOS}-${GOARCH}" cd gopath/src/github.com/cloudfoundry/bosh-utils bin/require-ci-golang-version git_rev=`git rev-parse --short HEAD` version="${semver}-${git_rev}-${timestamp}" echo "building ${filename} with version ${version}" sed -i 's/\[DEV BUILD\]/'"$version"'/' main/version.go bin/build-linux-amd64 mv out/verify-multidigest $base/compiled-${GOOS}/${filename}
Fix hg tip arguments when building UCS2 pythons, add version
#!/bin/sh REV=$1 . scripts/common/main.sh mkdir -p build/cpython-ucs2 mkdir -p deps/cpython-ucs2 cd build/cpython-ucs2 hg clone http://hg.python.org/cpython -r $REV -u $REV $REV cd $REV ./configure --enable-unicode=ucs2 --prefix=/opt/cpython-ucs2-$REV --enable-shared make sudo make install cd $ROOT/deps tar czvf cpython-ucs2/cpython-ucs2-${REV}.tar.gz -C /opt cpython-ucs2-$REV git add cpython-ucs2/cpython-ucs2-${REV}.tar.gz git commit -m "Add ucs2 cpython build hg tip: $(hg tip -R $ROOT/deps/cpython-ucs2 | sed 's/^/ /')"
#!/bin/sh REV=$1 . scripts/common/main.sh mkdir -p build/cpython-ucs2 mkdir -p deps/cpython-ucs2 cd build/cpython-ucs2 hg clone http://hg.python.org/cpython -r $REV -u $REV $REV cd $REV ./configure --enable-unicode=ucs2 --prefix=/opt/cpython-ucs2-$REV --enable-shared make sudo make install cd $ROOT/deps tar czvf cpython-ucs2/cpython-ucs2-${REV}.tar.gz -C /opt cpython-ucs2-$REV git add cpython-ucs2/cpython-ucs2-${REV}.tar.gz git commit -m "Add ucs2 cpython build python --version: $(env LD_LIBRARY_PATH=/opt/cpython-ucs2-$REV/lib /opt/cpython-ucs2-$REV/bin/python --version) hg tip: $(hg tip -R $ROOT/build/cpython-ucs2/$REV | sed 's/^/ /')"
Include relative to location of dotfiles
#! /usr/bin/env bash DOTFILES_HOME=~/Programming/Other/dotfiles for file in `find ./src -path '*/preload/*.sh'` ; do . $file done for file in `find ./src -path '*.sh' ! -name 'include.sh' ! -path '*/preload/*.sh' ! -path '*/install/*'` do . $file done for bin_dir in `find $DOTFILES_HOME -path '*/bin'` ; do add_to_path $bin_dir done unset file unset bin_dir
#! /usr/bin/env bash for file in `find $DOTFILES_HOME/src -path '*/preload/*.sh'` ; do . $file done for file in `find $DOTFILES_HOME/src -path '*.sh' ! -name 'include.sh' ! -path '*/preload/*.sh' ! -path '*/install/*'` do . $file done for bin_dir in `find $DOTFILES_HOME -path '*/bin'` ; do add_to_path $bin_dir done unset file unset bin_dir
Remove attempt at line escaping.
#!/bin/sh set -e if [ $(uname -s) == 'Darwin' ]; then if [ "$(whoami)" == "root" ]; then TARGET_DIR="/Library/Google/Chrome/NativeMessagingHosts" else TARGET_DIR=\ "$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts" fi else if [ "$(whoami)" == "root" ]; then TARGET_DIR="/etc/opt/chrome/native-messaging-hosts" else TARGET_DIR='$HOME/.config/google-chrome/NativeMessagingHosts' fi fi HOST_NAME=com.jeffreywear.photocopier rm "$TARGET_DIR/$HOST_NAME.json" echo Native messaging host $HOST_NAME has been uninstalled.
#!/bin/sh set -e if [ $(uname -s) == 'Darwin' ]; then if [ "$(whoami)" == "root" ]; then TARGET_DIR="/Library/Google/Chrome/NativeMessagingHosts" else TARGET_DIR="$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts" fi else if [ "$(whoami)" == "root" ]; then TARGET_DIR="/etc/opt/chrome/native-messaging-hosts" else TARGET_DIR='$HOME/.config/google-chrome/NativeMessagingHosts' fi fi HOST_NAME=com.jeffreywear.photocopier rm "$TARGET_DIR/$HOST_NAME.json" echo Native messaging host $HOST_NAME has been uninstalled.
Add nano as the fallback editor
#!/usr/bin/env bash export PATH="$HOME/.dotfiles/bin:$PATH" # Prefer US English and use UTF-8 export LANG="en_US" export LC_ALL="en_US.UTF-8" # Opt out of Homebrew analytics export HOMEBREW_NO_ANALYTICS=1 # Install homebrew cask to local apps dir export HOMEBREW_CASK_OPTS="--appdir=~/Applications" if command -v code >/dev/null 2>&1; then export EDITOR="code" alias dot="code -n ~/.dotfiles" alias hosts="code -n /etc/hosts" else export EDITOR="vim" alias dot="vim ~/.dotfiles" alias hosts="sudo vim /etc/hosts" fi # Enable colors export CLICOLOR=1 if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi
#!/usr/bin/env bash export PATH="$HOME/.dotfiles/bin:$PATH" # Prefer US English and use UTF-8 export LANG="en_US" export LC_ALL="en_US.UTF-8" # Opt out of Homebrew analytics export HOMEBREW_NO_ANALYTICS=1 # Install homebrew cask to local apps dir export HOMEBREW_CASK_OPTS="--appdir=~/Applications" if command -v code >/dev/null 2>&1; then export EDITOR="code" alias dot="code -n ~/.dotfiles" alias hosts="code -n /etc/hosts" elif command -v vim >/dev/null 2>&1; then export EDITOR="vim" alias dot="vim ~/.dotfiles" alias hosts="sudo vim /etc/hosts" else export EDITOR="nano" alias dot="nano ~/.dotfiles" alias hosts="sudo nano /etc/hosts" fi # Enable colors export CLICOLOR=1 if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi
Set local $EDITOR to vim
############################################################################### # Editor ############################################################################### if [[ -n $SSH_CONNECTION ]]; then export EDITOR='vim' else export EDITOR='mvim' fi ############################################################################### # Vim ############################################################################### # Directory containing MacVim.app export VIM_APP_DIR="/Applications"
############################################################################### # Editor ############################################################################### if [[ -n $SSH_CONNECTION ]]; then export EDITOR='vim' else # export EDITOR='mvim' export EDITOR='vim' fi ############################################################################### # Vim ############################################################################### # Directory containing MacVim.app export VIM_APP_DIR="/Applications"
Add argument to exit 1 upon failure
#!/bin/bash set -e bash <(curl -s https://codecov.io/bash) ${other_options}
#!/bin/bash set -e bash <(curl -s https://codecov.io/bash) -Z ${other_options}
Move the server log to a 'logs' directory so as not to add even more clutter to server root.
#!/bin/bash export DJANGO_SETTINGS_MODULE="settings" ## Uncomment whichever python binary you'd like to use to run the game. ## Evennia is developed on 2.5 but should be compatible with 2.4. # PYTHON_BIN="python" # PYTHON_BIN="python2.4" PYTHON_BIN="python2.5" ## The name of your logfile. LOGNAME="evennia.log" ## Where to put the last log file from the game's last running ## on next startup. LOGNAME_OLD="evennia.log.old" mv $LOGNAME $LOGNAME_OLD ## There are several different ways you can run the server, read the ## description for each and uncomment the desired mode. ## Generate profile data for use with cProfile. # $PYTHON_BIN -m cProfile -o profiler.log -s time server.py ## Interactive mode. Good for development and debugging. # $PYTHON_BIN server.py ## Stand-alone mode. Good for running games. nohup $PYTHON_BIN server.py > $LOGNAME &
#!/bin/bash export DJANGO_SETTINGS_MODULE="settings" ## Uncomment whichever python binary you'd like to use to run the game. ## Evennia is developed on 2.5 but should be compatible with 2.4. # PYTHON_BIN="python" # PYTHON_BIN="python2.4" PYTHON_BIN="python2.5" ## The name of your logfile. LOGNAME="logs/evennia.log" ## Where to put the last log file from the game's last running ## on next startup. LOGNAME_OLD="logs/evennia.log.old" mv $LOGNAME $LOGNAME_OLD ## There are several different ways you can run the server, read the ## description for each and uncomment the desired mode. ## Generate profile data for use with cProfile. # $PYTHON_BIN -m cProfile -o profiler.log -s time server.py ## Interactive mode. Good for development and debugging. # $PYTHON_BIN server.py ## Stand-alone mode. Good for running games. nohup $PYTHON_BIN server.py > $LOGNAME &
Use Python 3.4 right now (needs to be fixed later)
#!/bin/bash -ex if [ ! -f /var/run/docker.pid ] then echo "!!! Docker service is probably not running !!!" fi function prepare_venv() { virtualenv -p python3 venv && source venv/bin/activate && python3 `which pip3` install -r requirements.txt } [ "$NOVENV" == "1" ] || prepare_venv || exit 1 PYTHONDONTWRITEBYTECODE=1 python3 `which behave` --tags=-skip -D dump_errors=true @feature_list.txt $@
#!/bin/bash -ex if [ ! -f /var/run/docker.pid ] then echo "!!! Docker service is probably not running !!!" fi function prepare_venv() { virtualenv -p python3 venv && source venv/bin/activate && python3 `which pip3` install -r requirements.txt } [ "$NOVENV" == "1" ] || prepare_venv || exit 1 PYTHONDONTWRITEBYTECODE=1 python3.4 `which behave` --tags=-skip -D dump_errors=true @feature_list.txt $@
Add library version to commit messages and version tags
#!/bin/bash # This script is used by cron to periodically generate # and auto-commit all changes to the skautIS API. # Run api generator python skautis_api_gen.py # Check if there are new changes to the API if ! [[ `git status --porcelain` ]]; then echo "No changes" exit 0 fi # Increment library version perl -pe 's/(version=.\d+\.\d+\.)(\d+)/$1.($2+1)/e;' -i setup.py # Set up git identity git config --global user.name 'Automatic commit' git config --global user.email 'kulikjak@users.noreply.github.com' # Commit changes DATE=`date "+%d %b %Y"` COMMIT_MESSAGE="Auto commit - $DATE" echo "$COMMIT_MESSAGE" # this is needed to include removed and newly introduced files git add --all git commit -m "$COMMIT_MESSAGE" # push changes git push
#!/bin/bash # This script is used by cron to periodically generate # and auto-commit all changes to the skautIS API. # Run api generator python skautis_api_gen.py # Check if there are new changes to the API if ! [[ `git status --porcelain` ]]; then echo "No changes" exit 0 fi # Increment library version perl -pe 's/(version=.\d+\.\d+\.)(\d+)/$1.($2+1)/e;' -i setup.py # Set up git identity git config --global user.name 'Automatic commit' git config --global user.email 'kulikjak@users.noreply.github.com' # Commit changes DATE=`date "+%d %b %Y"` VERSION=`awk -F"'" '/version=/ {print $2}' setup.py` COMMIT_MESSAGE="Auto commit version $VERSION - $DATE" echo "$COMMIT_MESSAGE" # this is needed to include removed and newly introduced files git add --all git commit -m "$COMMIT_MESSAGE" git tag -a "v${NEW_VERSION}" -m "Automatically generated version ${NEW_VERSION}" # push changes git push --follow-tags
Add test for illegal argument.
#!/bin/sh testPrintVersion() { ./napalm -v 2> /dev/null assertEquals 0 $? } testPrintHelp() { ./napalm -h 2> /dev/null assertEquals 10 $? } . ./shunit2
#!/bin/sh testPrintVersion() { ./napalm -v 2> /dev/null assertEquals 0 $? } testPrintHelp() { ./napalm -h 2> /dev/null assertEquals 10 $? } testIllegalArgument() { # -i is not recognized argument ./napalm -i 2> /dev/null assertEquals 10 $? } . ./shunit2
Rename ventriloquist-pg images to ventriloquist-postgres
#!/bin/sh set -e PREFIX='fgrehm/ventriloquist' docker build --rm -t ${PREFIX}-base base docker build --rm -t ${PREFIX}-pg-9.3 postgresql/9.3 docker build --rm -t ${PREFIX}-pg-9.2 postgresql/9.2 docker build --rm -t ${PREFIX}-pg-9.1 postgresql/9.1 docker build -t ${PREFIX}-mysql-5.6 mysql/5.6 docker build -t ${PREFIX}-mysql-5.5 mysql/5.5 docker build -t ${PREFIX}-rethinkdb-1.12 rethinkdb docker build -t ${PREFIX}-openjdk7 openjdk7 docker build -t ${PREFIX}-elasticsearch-1.1 elasticsearch docker build -t ${PREFIX}-memcached-1.4 memcached docker build -t ${PREFIX}-redis-2.8 redis docker build -t ${PREFIX}-mailcatcher-0.5 mailcatcher
#!/bin/sh set -e PREFIX='fgrehm/ventriloquist' docker build --rm -t ${PREFIX}-base base docker build --rm -t ${PREFIX}-postgres-9.3 postgresql/9.3 docker build --rm -t ${PREFIX}-postgres-9.2 postgresql/9.2 docker build --rm -t ${PREFIX}-postgres-9.1 postgresql/9.1 docker build -t ${PREFIX}-mysql-5.6 mysql/5.6 docker build -t ${PREFIX}-mysql-5.5 mysql/5.5 docker build -t ${PREFIX}-rethinkdb-1.12 rethinkdb docker build -t ${PREFIX}-openjdk7 openjdk7 docker build -t ${PREFIX}-elasticsearch-1.1 elasticsearch docker build -t ${PREFIX}-memcached-1.4 memcached docker build -t ${PREFIX}-redis-2.8 redis docker build -t ${PREFIX}-mailcatcher-0.5 mailcatcher
Use Python 3.7 on Mac
rm -rf gyb rm -rf build rm -rf dist rm -rf gyb-$1-macos.tar.xz /Library/Frameworks/Python.framework/Versions/3.6/bin/pyinstaller -F --clean --distpath=gyb macos-gyb.spec cp LICENSE gyb/ tar cJf gyb-$1-macos.tar.xz gyb/
rm -rf gyb rm -rf build rm -rf dist rm -rf gyb-$1-macos.tar.xz /Library/Frameworks/Python.framework/Versions/3.7/bin/pyinstaller -F --clean --distpath=gyb macos-gyb.spec cp LICENSE gyb/ tar cJf gyb-$1-macos.tar.xz gyb/
Comment on try-catch functions added
#!/bin/bash # Last known working good # $helloIn() { echo 'Hello Back!';} FUNC_NAME='helloIn' FUNC_STMT=$(echo 'HelloYourself') FUNC_OUTPUT='HelloYourself' FUNC_DEF=${FUNC_NAME}"() { echo ${FUNC_OUTPUT};}" echo $FUNC_DEF # Generated function definition string failed # $ helloIn() { echo Hello Yourself!;}
#!/bin/bash # Last known working good # $helloIn() { echo 'Hello Back!';} FUNC_NAME='helloIn' FUNC_STMT=$(echo 'HelloYourself') FUNC_OUTPUT='HelloYourself' FUNC_DEF=${FUNC_NAME}"() { echo ${FUNC_OUTPUT};}" echo $FUNC_DEF # Generated function definition string failed # $ helloIn() { echo Hello Yourself!;} # NOTE: Try-catch output would make manual copy-paste unncessary!
Fix build src dir for iotpsutil docker image
#!/bin/bash # If BUILD_DOCKER_IMAGES is defined then build the docker container for the sample and upload it to dockerhub # We only build this on the python 3.7 branch, and we don't build for PRs if [ -n "$BUILD_DOCKER_IMAGES" ]; then echo "Building docker images" IMAGE_NAME=wiotp/iotpsutil docker build -t ${IMAGE_NAME}:$TRAVIS_BRANCH . if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then if [ "$TRAVIS_BRANCH" == "master" ]; then docker tag ${IMAGE_NAME}:$TRAVIS_BRANCH ${IMAGE_NAME}:latest docker push ${IMAGE_NAME}:latest else docker push ${IMAGE_NAME}:$TRAVIS_BRANCH fi fi else echo "Skipped docker image building" fi
#!/bin/bash # If BUILD_DOCKER_IMAGES is defined then build the docker container for the sample and upload it to dockerhub # We only build this on the python 3.7 branch, and we don't build for PRs if [ -n "$BUILD_DOCKER_IMAGES" ]; then echo "Building docker images" IMAGE_NAME=wiotp/iotpsutil IMAGE_SRC=samples/iotpsutil docker build -t ${IMAGE_NAME}:$TRAVIS_BRANCH ${IMAGE_SRC} if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then if [ "$TRAVIS_BRANCH" == "master" ]; then docker tag ${IMAGE_NAME}:$TRAVIS_BRANCH ${IMAGE_NAME}:latest docker push ${IMAGE_NAME}:latest else docker push ${IMAGE_NAME}:$TRAVIS_BRANCH fi fi else echo "Skipped docker image building" fi
Add dockerImages custom zsh function
ogl() {grep $1 *.log(.om[1]) } PTR() {echo $1 > ~/PTR} b() { echo $1 > ~/PTR svn cp ^/trunk ^/ptr/$1 -m "Created branch" } ptr() { if [ $# -eq 0 ]; then PTR=`cat ~/PTR`; else PTR=$1; fi tmp=`sinfo -p "ptr/$PTR"`; svn switch $tmp } trunk() { tmp=`sinfo -p trunk`; svn switch $tmp } db2a() { if [ $# -gt 0 ]; then java -jar /work/brent/docbook2asciidoc/saxon9he.jar -s $1.docbook -o $1.asc /work/brent/docbook2asciidoc/d2a.xsl else echo "Docbook file must be provided" fi } server() { if [ $# -eq 0 ]; then PORT=8000; else PORT=$1; fi open "http://localhost:${PORT}" && python -m SimpleHTTPServer $PORT }
ogl() {grep $1 *.log(.om[1]) } PTR() {echo $1 > ~/PTR} b() { echo $1 > ~/PTR svn cp ^/trunk ^/ptr/$1 -m "Created branch" } ptr() { if [ $# -eq 0 ]; then PTR=`cat ~/PTR`; else PTR=$1; fi tmp=`sinfo -p "ptr/$PTR"`; svn switch $tmp } trunk() { tmp=`sinfo -p trunk`; svn switch $tmp } db2a() { if [ $# -gt 0 ]; then java -jar /work/brent/docbook2asciidoc/saxon9he.jar -s $1.docbook -o $1.asc /work/brent/docbook2asciidoc/d2a.xsl else echo "Docbook file must be provided" fi } server() { if [ $# -eq 0 ]; then PORT=8000; else PORT=$1; fi open "http://localhost:${PORT}" && python -m SimpleHTTPServer $PORT } dockerImages() { if [ $# -eq 1 ]; then docker images | grep "$1" | awk '{print $1 ":" $2}'; else docker images | awk '{print $1 ":" $2}'; fi }
Improve delegate dataset mount option and snapshots
#!/bin/bash UUID=$(mdata-get sdc:uuid) DDS=zones/${UUID}/data if zfs list ${DDS} 1>/dev/null 2>&1; then zfs create ${DDS}/www || true zfs create ${DDS}/mysql || true zfs set mountpoint=/var/www ${DDS}/www zfs set mountpoint=/var/mysql ${DDS}/mysql fi # create trash folder for removed virtual hosts mkdir -p /var/www/.Trash # znapzend for backup znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \ SRC '7day=>8hour,30day=>1day,1year=>1week,10year=>1month' ${DDS}/www znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \ SRC '7day=>8hour,30day=>1day,1year=>1week,10year=>1month' ${DDS}/mysql /usr/sbin/svcadm enable svc:/pkgsrc/znapzend:default
#!/bin/bash UUID=$(mdata-get sdc:uuid) DDS=zones/${UUID}/data if zfs list ${DDS} 1>/dev/null 2>&1; then zfs create ${DDS}/www || true zfs create ${DDS}/mysql || true if ! zfs get -o value -H mountpoint ${DDS}/www | grep -q /var/www; then zfs set mountpoint=/var/www ${DDS}/www fi if ! zfs get -o value -H mountpoint ${DDS}/mysql | grep -q /var/mysql; then zfs set mountpoint=/var/mysql ${DDS}/mysql fi # znapzend for backup znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \ SRC '2day=>8hour,14day=>1day,1year=>1month,10year=>1year' ${DDS}/www znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \ SRC '2day=>8hour,14day=>1day,1year=>1month,10year=>1year' ${DDS}/mysql /usr/sbin/svcadm enable svc:/pkgsrc/znapzend:default fi # create trash folder for removed virtual hosts mkdir -p /var/www/.Trash
Update server timeout to 10s for syncing components
#!/usr/bin/env bash url="http://localhost:8357" total=0 max=3 while sleep 1 do total=$((total+1)) if [ $total -gt $max ]; then echo "Timed out waiting for server to start" break fi if curl --output /dev/null --silent --head --fail "$url"; then npm run sync-components break fi done
#!/usr/bin/env bash url="http://localhost:8357" total=0 max=10 while sleep 1 do total=$((total+1)) if [ $total -gt $max ]; then echo "Timed out waiting for server to start. Run \`killall node\` and try again." break fi if curl --output /dev/null --silent --head --fail "$url"; then npm run sync-components break fi done
Install customization links for wontology.org by default.
# execute this script from the directory containing the wontomedia*.gem file INSTALL_DIR=/home/glenivey/etc/rails_apps/WontoMedia HOSTING_HOME_DIR=/home/glenivey GEMPATH_SED_COMMAND="/^RAILS_GEM_VERSION/aGem.use_paths \"/home/glenivey/ruby/gems\", [ \"/home/glenivey/ruby/gems\", \"/usr/lib/ruby/gems/1.8\" ]" cat $INSTALL_DIR/log/mongrel.log >> $HOSTING_HOME_DIR/WmLogs/mongrel.log cat $INSTALL_DIR/log/production.log >> $HOSTING_HOME_DIR/WmLogs/production.log rm $INSTALL_DIR gem uninstall wontomedia gem install -l wontomedia ln -s $HOSTING_HOME_DIR/ruby/gems/gems/wontomed* $INSTALL_DIR cd $INSTALL_DIR mkdir log mkdir tmp cp $HOSTING_HOME_DIR/wm.database.yml config/database.yml cp $HOSTING_HOME_DIR/wm.wontomedia.rb config/initializers/wontomedia.rb sed --in-place=.backup -e "$GEMPATH_SED_COMMAND" config/environment.rb RAILS_ENV=production rake customize[default-custom]
# execute this script from the directory containing the wontomedia*.gem file INSTALL_DIR=/home/glenivey/etc/rails_apps/WontoMedia HOSTING_HOME_DIR=/home/glenivey GEMPATH_SED_COMMAND="/^RAILS_GEM_VERSION/aGem.use_paths \"/home/glenivey/ruby/gems\", [ \"/home/glenivey/ruby/gems\", \"/usr/lib/ruby/gems/1.8\" ]" cat $INSTALL_DIR/log/mongrel.log >> $HOSTING_HOME_DIR/WmLogs/mongrel.log cat $INSTALL_DIR/log/production.log >> $HOSTING_HOME_DIR/WmLogs/production.log rm $INSTALL_DIR gem uninstall wontomedia gem install -l wontomedia ln -s $HOSTING_HOME_DIR/ruby/gems/gems/wontomed* $INSTALL_DIR cd $INSTALL_DIR mkdir log mkdir tmp cp $HOSTING_HOME_DIR/wm.database.yml config/database.yml cp $HOSTING_HOME_DIR/wm.wontomedia.rb config/initializers/wontomedia.rb sed --in-place=.backup -e "$GEMPATH_SED_COMMAND" config/environment.rb RAILS_ENV=production rake customize[default-custom:~/wontology.org]
Update script to symlink .gitignore
#!/usr/bin/env bash echo -e "Updating miscellaneous configuration files..." if [[ "$OSTYPE" != 'linux-gnu' ]]; then rm -f ~/.hushlogin ln -s ~/dotfiles/.hushlogin ~/.hushlogin fi
#!/usr/bin/env bash echo -e "Updating miscellaneous configuration files..." if [[ "$OSTYPE" != 'linux-gnu' ]]; then rm -f ~/.hushlogin ln -s ~/dotfiles/.hushlogin ~/.hushlogin fi rm -f ~/.gitignore ln -s ~/dotfiles/.gitignore ~/.gitignore
Remove leftover arg from `ln`
#!/bin/sh # # Set up zsh and oh-my-zsh printf "\n› Setting up zsh\n" sudo echo "/usr/local/bin/zsh\n" >> /etc/shells # chsh -s /usr/local/bin/zsh # Install oh-my-zsh curl -L http://install.ohmyz.sh | sh > /tmp/oh-my-zsh-install.log # Copy kristoffer.zsh-theme to $HOME/.oh-my-zsh/themes/ cp -s $(pwd)/kristoffer.zsh-theme $HOME/.oh-my-zsh/themes/kristoffer.zsh-theme # Copy all zsh files to $HOME/.oh-my-zsh/custom typeset -U config_files config_files=($(pwd)/**/*.zsh) for file in ${config_files} do filename=$(basename "$file") cp $file $HOME/.oh-my-zsh/custom/$filename done
#!/bin/sh # # Set up zsh and oh-my-zsh printf "\n› Setting up zsh\n" sudo echo "/usr/local/bin/zsh\n" >> /etc/shells # chsh -s /usr/local/bin/zsh # Install oh-my-zsh curl -L http://install.ohmyz.sh | sh > /tmp/oh-my-zsh-install.log # Copy kristoffer.zsh-theme to $HOME/.oh-my-zsh/themes/ cp $(pwd)/kristoffer.zsh-theme $HOME/.oh-my-zsh/themes/kristoffer.zsh-theme # Copy all zsh files to $HOME/.oh-my-zsh/custom typeset -U config_files config_files=($(pwd)/**/*.zsh) for file in ${config_files} do filename=$(basename "$file") cp $file $HOME/.oh-my-zsh/custom/$filename done
Add alias to show files in git
# Use `hub` as our git wrapper: # http://defunkt.github.com/hub/ hub_path=$(which hub) if (( $+commands[hub] )) then alias git=$hub_path fi # The rest of my fun git aliases alias gl='git pull --prune' alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" alias gp='git push' alias gpf='git push -f' alias gd='git diff' alias gc='git commit' alias gcv='git commit -v' alias gca='git commit --amend' alias gco='git checkout' alias gb='git branch' alias gs='git status -sb' # upgrade your git if -sb breaks for you. it's fun. alias ga='git add' gas() { git rebase -i --autosquash HEAD~"$1"; }
# Use `hub` as our git wrapper: # http://defunkt.github.com/hub/ hub_path=$(which hub) if (( $+commands[hub] )) then alias git=$hub_path fi # The rest of my fun git aliases alias gl='git pull --prune' alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" alias gp='git push' alias gpf='git push -f' alias gd='git diff' alias gc='git commit' alias gcv='git commit -v' alias gca='git commit --amend' alias gco='git checkout' alias gb='git branch' alias gs='git status -sb' # upgrade your git if -sb breaks for you. it's fun. alias ga='git add' alias gsf='git show --pretty="" --name-only ' gas() { git rebase -i --autosquash HEAD~"$1"; }
Add flexibility to the iOS UIExplorer test script
#!/bin/bash set -e SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ROOT=$(dirname $SCRIPTS) export REACT_PACKAGER_LOG="$ROOT/server.log" cd $ROOT function cleanup { EXIT_CODE=$? set +e if [ $EXIT_CODE -ne 0 ]; then WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log [ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS [ -f $REACT_PACKAGER_LOG ] && cat $REACT_PACKAGER_LOG fi } trap cleanup EXIT # TODO: We use xcodebuild because xctool would stall when collecting info about # the tests before running them. Switch back when this issue with xctool has # been resolved. xcodebuild \ -project Examples/UIExplorer/UIExplorer.xcodeproj \ -scheme UIExplorer -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 5,OS=9.3' \ test \ | xcpretty && exit ${PIPESTATUS[0]}
#!/bin/bash set -e SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ROOT=$(dirname $SCRIPTS) cd $ROOT function cleanup { EXIT_CODE=$? set +e if [ $EXIT_CODE -ne 0 ]; then WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log [ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS fi } trap cleanup EXIT if [ -z "$XCODE_DESTINATION" ]; then XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 5,OS=9.3" fi # Support for environments without xcpretty installed set +e OUTPUT_TOOL=$(which xcpretty) set -e if [ -z "$OUTPUT_TOOL" ]; then OUTPUT_TOOL="sed" fi # TODO: We use xcodebuild because xctool would stall when collecting info about # the tests before running them. Switch back when this issue with xctool has # been resolved. xcodebuild \ -project Examples/UIExplorer/UIExplorer.xcodeproj \ -scheme UIExplorer \ -sdk iphonesimulator \ -destination "$XCODE_DESTINATION" \ test \ | $OUTPUT_TOOL && exit ${PIPESTATUS[0]}
Add a sed rule with unserialized {}
#!/bin/bash REGEX=$(echo "$STATIC_FOLDERS_REGEX" | sed -e 's/[\/&]/\\&/g') sed -i "s/STATIC_FOLDERS_REGEX/$REGEX/" /etc/nginx/conf.d/app.conf # Replace environment variables in the build of the frontend PREFIX="EMBER_" ENV_VARIABLES=$(env | grep "${PREFIX}") while IFS= read -r line; do ENV_VARIABLE=$(echo "$line" | sed -e "s/^$PREFIX//" | cut -f1 -d"=") VALUE=$(echo "$line" | cut -d"=" -f2-) sed -i "s/%7B%7B$ENV_VARIABLE%7D%7D/$VALUE/g" /app/index.html done <<< "$ENV_VARIABLES" nginx -g "daemon off;"
#!/bin/bash REGEX=$(echo "$STATIC_FOLDERS_REGEX" | sed -e 's/[\/&]/\\&/g') sed -i "s/STATIC_FOLDERS_REGEX/$REGEX/" /etc/nginx/conf.d/app.conf # Replace environment variables in the build of the frontend PREFIX="EMBER_" ENV_VARIABLES=$(env | grep "${PREFIX}") while IFS= read -r line; do ENV_VARIABLE=$(echo "$line" | sed -e "s/^$PREFIX//" | cut -f1 -d"=") VALUE=$(echo "$line" | cut -d"=" -f2-) sed -i "s/%7B%7B$ENV_VARIABLE%7D%7D/$VALUE/g" /app/index.html sed -i "s/{{$ENV_VARIABLE}}/$VALUE/g" /app/index.html done <<< "$ENV_VARIABLES" nginx -g "daemon off;"
Add check for Rosetta installation in !diagnostic
#!/bin/bash echo '### Workflow version' /usr/libexec/PlistBuddy -c 'Print :version' info.plist echo echo '### Alfred version' /usr/bin/osascript -e 'tell application id "com.runningwithcrayons.Alfred" to return version' echo echo '### Python version' python3 --version | awk '{print $NF}' echo echo '### PyCryptodome version' output=$(python3 -c "import Crypto; print(Crypto.__version__)") if [[ -n $output ]]; then printf "%s\n" "$output" else printf "Not Installed\n" fi echo echo '### macOS version' /usr/bin/sw_vers -productVersion echo echo '### Architecture' /usr/bin/arch echo
#!/bin/bash echo '### Workflow version' /usr/libexec/PlistBuddy -c 'Print :version' info.plist echo echo '### Alfred version' /usr/bin/osascript -e 'tell application id "com.runningwithcrayons.Alfred" to return version' echo echo '### Python version' python3 --version | awk '{print $NF}' echo echo '### PyCryptodome version' output=$(python3 -c "import Crypto; print(Crypto.__version__)") if [[ -n $output ]]; then printf "%s\n" "$output" else printf "Not Installed\n" fi echo echo '### Rosetta installation status' if [[ $(/usr/bin/pgrep oahd) ]]; then printf "Installed\n" else printf "Not Installed\n" fi echo echo '### macOS version' /usr/bin/sw_vers -productVersion echo echo '### Architecture' /usr/bin/arch echo
Fix bower cwd issue solution is UGLY FIXMEEEE
#!/bin/bash VENVPATH=/home/ubuntu/.pyenv/versions/dev_venv; PYPATH=$VENVPATH/bin/python; GULPPATH=$VENVPATH/bin/gulp; source $VENVPATH/bin/activate; cd /opt/dev_genoome/genoome/genoome/ && sudo git checkout -- . && \ git pull origin dev && \ ../node_modules/.bin/bower install --cwd ../. && \ $GULPPATH --gulpfile ../gulpfile.js --cwd ../ dist:css dist:js && \ $PYPATH ./manage.py collectstatic --noinput --settings=genoome.settings.development && \ sudo touch /etc/uwsgi/vassals/dev_genoome.ini && \ sudo chown -R ubuntu:www-data /opt/dev_genoome/genoome/genoome/assets/; echo 'Success';
#!/bin/bash VENVPATH=/home/ubuntu/.pyenv/versions/dev_venv; PYPATH=$VENVPATH/bin/python; GULPPATH=$VENVPATH/bin/gulp; source $VENVPATH/bin/activate; cd /opt/dev_genoome/genoome/genoome/ && sudo git checkout -- . && \ git pull origin dev && \ cd ../ &7 \ ../node_modules/.bin/bower install && \ cd - && \ $GULPPATH --gulpfile ../gulpfile.js --cwd ../ dist:css dist:js && \ $PYPATH ./manage.py collectstatic --noinput --settings=genoome.settings.development && \ sudo touch /etc/uwsgi/vassals/dev_genoome.ini && \ sudo chown -R ubuntu:www-data /opt/dev_genoome/genoome/genoome/assets/; echo 'Success';
Make brew bundle check use the right Brewfile
#! /usr/bin/env bash # updates Dotfiles set -euo pipefail dir="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )" source "$dir/dotfiles-support" pull_master() { cd "$dir" \ && git checkout master \ && git pull origin master } update_submodules() { cd "$dir" \ && git submodule sync \ && git submodule update } has_brew() { which brew > /dev/null 2>&1 } bundle_check() { # the "or true" is necessary to prevent a bundle issue from stopping the rest # of the rest update brew bundle check || true } tmux_plugin_update() { local tpm=~/.tmux/plugins/tpm/bin "$tpm"/clean_plugins "$tpm"/update_plugins all } update() { if pull_master && update_submodules ; then display_message "Updated" has_brew && bundle_check tmux_plugin_update display_message "Type 'reload' to reload updates" display_message "You may need to logout of the terminal and login for changes to take full effect" else display_message "Update failed" fi } update
#! /usr/bin/env bash # updates Dotfiles set -euo pipefail dir="$( cd "$( dirname "${BASH_SOURCE[0]}")" && pwd )" source "$dir/dotfiles-support" if [[ -e ~/.Brewfile ]]; then BREWFILE=~/.Brewfile else BREWFILE="$dir/brew/Brewfile" fi pull_master() { cd "$dir" \ && git checkout master \ && git pull origin master } update_submodules() { cd "$dir" \ && git submodule sync \ && git submodule update } has_brew() { which brew > /dev/null 2>&1 } bundle_check() { # the "or true" is necessary to prevent a bundle issue from stopping the rest # of the rest update brew bundle check --file="$BREWFILE" || true } tmux_plugin_update() { local tpm=~/.tmux/plugins/tpm/bin "$tpm"/clean_plugins "$tpm"/update_plugins all } update() { if pull_master && update_submodules ; then display_message "Updated" has_brew && bundle_check tmux_plugin_update display_message "Type 'reload' to reload updates" display_message "You may need to logout of the terminal and login for changes to take full effect" else display_message "Update failed" fi } update
Fix testing submodules at head
#!/bin/bash # Copyright 2017 gRPC 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. # Build portability tests with an updated submodule set -ex # change to grpc repo root cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc # Update submodule and commit it so changes are passed to Docker (cd third_party/$RUN_TESTS_FLAGS && git pull origin master) tools/buildgen/generate_projects.sh git -c user.name='foo' -c user.email='foo@google.com' commit -a -m 'Update submodule' tools/run_tests/run_tests_matrix.py -f linux --inner_jobs 4 -j 4 --internal_ci --build_only
#!/bin/bash # Copyright 2017 gRPC 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. # Build portability tests with an updated submodule set -ex # change to grpc repo root cd $(dirname $0)/../../.. source tools/internal_ci/helper_scripts/prepare_build_linux_rc # Update submodule and commit it so changes are passed to Docker (cd third_party/$RUN_TESTS_FLAGS && git fetch --all && git checkout origin/master) tools/buildgen/generate_projects.sh git -c user.name='foo' -c user.email='foo@google.com' commit -a -m 'Update submodule' tools/run_tests/run_tests_matrix.py -f linux --inner_jobs 4 -j 4 --internal_ci --build_only
Install libc6-dev on Ubuntu to prevent kernel module failure
#!/bin/sh set -e -x # Add ClusterHQ and recent ZFS and Docker repositories sudo apt-get -y install software-properties-common sudo add-apt-repository -y ppa:zfs-native/stable sudo add-apt-repository -y ppa:james-page/docker sudo add-apt-repository -y 'deb http://build.clusterhq.com/results/omnibus/master/ubuntu-14.04 /' sudo apt-get update # Add ClusterHQ packages # Unauthenticated packages need --force-yes sudo apt-get -y --force-yes install clusterhq-flocker-node # Create ZFS flocker pool sudo mkdir -p /var/opt/flocker sudo truncate --size 10G /var/opt/flocker/pool-vdev sudo zpool create flocker /var/opt/flocker/pool-vdev # Allow Flocker client access to root account sudo mkdir -p ~root/.ssh sudo chmod 700 ~root/.ssh sudo cp ~/.ssh/authorized_keys ~root/.ssh/authorized_keys
#!/bin/sh set -e -x # Add ClusterHQ and recent ZFS and Docker repositories # Ensure add-apt-repository command is available sudo apt-get -y install software-properties-common # ZFS not available in base Ubuntu - add ZFS repo sudo add-apt-repository -y ppa:zfs-native/stable # Add Docker repo for recent Docker versions sudo add-apt-repository -y ppa:james-page/docker # Add ClusterHQ repo for installation of Flocker packages. sudo add-apt-repository -y 'deb http://build.clusterhq.com/results/omnibus/master/ubuntu-14.04 /' # Update to read package info from new repos sudo apt-get update # Package spl-dkms sometimes does not have libc6-dev as a # dependency, add it before ZFS installation requires it. sudo apt-get -y install libc6-dev # Install Flocker node and all dependencies # Unauthenticated packages need --force-yes sudo apt-get -y --force-yes install clusterhq-flocker-node # Create ZFS flocker pool sudo mkdir -p /var/opt/flocker sudo truncate --size 10G /var/opt/flocker/pool-vdev sudo zpool create flocker /var/opt/flocker/pool-vdev # Allow Flocker client access to root account sudo mkdir -p ~root/.ssh sudo chmod 700 ~root/.ssh sudo cp ~/.ssh/authorized_keys ~root/.ssh/authorized_keys
Patch autogen.sh in OS X only
#!/bin/sh set -e export ROOT_HOME=$(cd `dirname "{0}"` && pwd) export SNAPPY_HOME=$(cd `dirname "{0}"` && cd vendor/snappy && pwd) export LEVELDB_HOME=$(cd `dirname "{0}"` && cd vendor/leveldb && pwd) echo -------------------- echo Build Snappy echo -------------------- cd $SNAPPY_HOME git clean -fdx git reset --hard patch -N $SNAPPY_HOME/autogen.sh $ROOT_HOME/patches/autogen.sh.osx.patch patch -N $SNAPPY_HOME/configure.ac $ROOT_HOME/patches/configure.ac.noarch.patch ./autogen.sh ./configure --disable-shared --with-pic --prefix=$SNAPPY_HOME make install echo -------------------- echo Build LevelDB echo -------------------- cd $LEVELDB_HOME export LIBRARY_PATH=$SNAPPY_HOME/lib export C_INCLUDE_PATH=$SNAPPY_HOME/include export CPLUS_INCLUDE_PATH=$SNAPPY_HOME/include git clean -fdx git reset --hard make echo -------------------- echo Copy LevelDB library echo -------------------- cd $LEVELDB_HOME mkdir -p $ROOT_HOME/leveldb-jna-native/src/main/resources/darwin/ cp libleveldb.dylib $ROOT_HOME/leveldb-jna-native/src/main/resources/darwin/
#!/bin/sh set -e export ROOT_HOME=$(cd `dirname "{0}"` && pwd) export SNAPPY_HOME=$(cd `dirname "{0}"` && cd vendor/snappy && pwd) export LEVELDB_HOME=$(cd `dirname "{0}"` && cd vendor/leveldb && pwd) echo -------------------- echo Build Snappy echo -------------------- cd $SNAPPY_HOME git clean -fdx git reset --hard [[ "$OSTYPE" == "darwin"* ]] && patch -N $SNAPPY_HOME/autogen.sh $ROOT_HOME/patches/autogen.sh.osx.patch patch -N $SNAPPY_HOME/configure.ac $ROOT_HOME/patches/configure.ac.noarch.patch ./autogen.sh ./configure --disable-shared --with-pic --prefix=$SNAPPY_HOME make install echo -------------------- echo Build LevelDB echo -------------------- cd $LEVELDB_HOME export LIBRARY_PATH=$SNAPPY_HOME/lib export C_INCLUDE_PATH=$SNAPPY_HOME/include export CPLUS_INCLUDE_PATH=$SNAPPY_HOME/include git clean -fdx git reset --hard make echo -------------------- echo Copy LevelDB library echo -------------------- cd $LEVELDB_HOME mkdir -p $ROOT_HOME/leveldb-jna-native/src/main/resources/darwin/ cp libleveldb.dylib $ROOT_HOME/leveldb-jna-native/src/main/resources/darwin/
Fix newline char in tmux session name
if hash tmux 2>/dev/null; then tmux a -t "$1" || exec tmux new -s "$1" && exit fi
name="$(echo "$1" | tr -d '\n')" if hash tmux 2>/dev/null; then tmux a -t "$name" || exec tmux new -s "$name" && exit fi
Deploy api documents to Github pages instead of file servers.
#! bin/bash declare -a uploadhosts=($DOC_HOST1 $DOC_HOST2) # path TBD basedir="/ext/ebs/references/android/thing-if" version=$(grep -o "version.*" sdk-info.txt | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+') docFolderPath="thingif/build/outputs/javadoc/" updir="$basedir/$version" latestdir="$basedir/latest" echo "" for host in "${uploadhosts[@]}"; do uptarget="$host:$updir" echo "Uploading..." rsync -rlptD --chmod=u+rw,g+r,o+r --chmod=Da+x --delete-after "$docFolderPath" "$uptarget" > /dev/null 2>&1 # check command exit code exitCode=$? if [ $exitCode -ne 0 ]; then echo "Faild when uploading doc" exit $exitCode fi ssh "$host" "rm $latestdir" > /dev/null 2>&1 # check command result exitCode=$? if [ $exitCode -ne 0 ]; then echo "Faild when removing older doc" exit $exitCode fi ssh "$host" "ln -s $updir $latestdir" > /dev/null 2>&1 # check command result exitCode=$? if [ $exitCode -ne 0 ]; then echo "Faild when releasing new doc" exit $exitCode fi done echo "All uploads have completed!"
#! bin/bash git clone https://$GH_TOKEN_FOR_HTTPS@github.com/KiiPlatform/thing-if-AndroidSDK.git cd thing-if-AndroidSDK git checkout gh-pages && git config user.email 'satoshi.kumano@kii.com' && git config user.name 'satoshi kumano' git rm -r --ignore-unmatch api-doc && mkdir -p api-doc cp -r ../thingif/build/outputs/javadoc/ api-doc git add api-doc && git commit -m 'updated doc' && git push origin gh-pages
Correct file exists logic for local docker builds
#!/bin/bash # Used when building inside a Docker image! if [ -f /app/bower.json ]; then echo "You forgot to mount the volume, see README.md" else cd /app npm install grunt build fi
#!/bin/bash # Used when building inside a Docker image! if [ ! -f /app/bower.json ]; then echo "You forgot to mount the volume, see README.md" else cd /app npm install grunt build fi
Install the deps without having to list
#!/bin/bash for i in `go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' |grep "\."`; do echo $i; done
#!/bin/bash for i in `go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' |grep "\."`; do go get -u $i; done
Remove python-keystoneclient downgrade and keep the newer version
MYDIR=$(dirname $(readlink -f "$0")) CLIENT=$(echo python-python-tackerclient_*_all.deb) CLIREPO="tacker-client" # Function checks whether a python egg is available, if not, installs function chkPPkg() { PKG="$1" IPPACK=$(python - <<'____EOF' import pip from os.path import join for package in pip.get_installed_distributions(): print(package.location) print(join(package.location, *package._get_metadata("top_level.txt"))) ____EOF ) echo "$IPPACK" | grep -q "$PKG" if [ $? -ne 0 ];then pip install "$PKG" fi } function envSetup() { apt-get install -y python-all debhelper fakeroot pip install --upgrade python-keystoneclient==1.7.4 chkPPkg stdeb } # Function installs python-tackerclient from github function deployTackerClient() { cd $MYDIR git clone -b 'SFC_refactor' https://github.com/trozet/python-tackerclient.git $CLIREPO cd $CLIREPO python setup.py --command-packages=stdeb.command bdist_deb cd "deb_dist" CLIENT=$(echo python-python-tackerclient_*_all.deb) cp $CLIENT $MYDIR dpkg -i "${MYDIR}/${CLIENT}" apt-get -f -y install dpkg -i "${MYDIR}/${CLIENT}" } envSetup deployTackerClient
MYDIR=$(dirname $(readlink -f "$0")) CLIENT=$(echo python-python-tackerclient_*_all.deb) CLIREPO="tacker-client" # Function checks whether a python egg is available, if not, installs function chkPPkg() { PKG="$1" IPPACK=$(python - <<'____EOF' import pip from os.path import join for package in pip.get_installed_distributions(): print(package.location) print(join(package.location, *package._get_metadata("top_level.txt"))) ____EOF ) echo "$IPPACK" | grep -q "$PKG" if [ $? -ne 0 ];then pip install "$PKG" fi } function envSetup() { apt-get install -y python-all debhelper fakeroot #pip install --upgrade python-keystoneclient==1.7.4 chkPPkg stdeb } # Function installs python-tackerclient from github function deployTackerClient() { cd $MYDIR git clone -b 'SFC_refactor' https://github.com/trozet/python-tackerclient.git $CLIREPO cd $CLIREPO python setup.py --command-packages=stdeb.command bdist_deb cd "deb_dist" CLIENT=$(echo python-python-tackerclient_*_all.deb) cp $CLIENT $MYDIR dpkg -i "${MYDIR}/${CLIENT}" apt-get -f -y install dpkg -i "${MYDIR}/${CLIENT}" } envSetup deployTackerClient
Fix Martus start script to run on Oneric
#!/bin/sh /usr/lib/jvm/java-1.6.0-openjdk/bin/java \ -Xbootclasspath/p:`pwd`/client-release/LibExt/bc-jce.jar -jar client-release/martus.jar
#!/bin/sh # This is how you'd run Martus with a proper class path and files installed # in it: # /usr/lib/jvm/java-1.6.0-openjdk/bin/java \ # -Xbootclasspath/p:`pwd`/client-release/LibExt/bc-jce.jar -jar client-release/martus.jar /usr/lib/jvm/java-1.6.0-openjdk/bin/java -Xbootclasspath/p:`pwd`/../LibExt/bc-jce.jar \ -Xbootclasspath/p:`pwd`/../LibExt/bc-jce.jar \ -Xbootclasspath/p:`pwd`/../LibExt/icu4j_3_2_calendar.jar \ -Xbootclasspath/p:`pwd`/../LibExt/js.jar \ -Xbootclasspath/p:`pwd`/../LibExt/layouts.jar \ -Xbootclasspath/p:`pwd`/../LibExt/velocity-1.4-rc1.jar \ -Xbootclasspath/p:`pwd`/../LibExt/xmlrpc-1.2-b1.jar \ -Xbootclasspath/p:`pwd`/../LibExt/bcprov-jdk14-135.jar \ -Xbootclasspath/p:`pwd`/../LibExt/InfiniteMonkey.jar \ -Xbootclasspath/p:`pwd`/../LibExt/junit.jar \ -Xbootclasspath/p:`pwd`/../LibExt/persiancalendar.jar \ -Xbootclasspath/p:`pwd`/../LibExt/velocity-dep-1.4-rc1.jar \ -jar martus.jar
Use latest boost for deps in travis
#!/usr/bin/env bash sudo apt-get update && sudo apt-get install gettext xorg-dev libx11-xcb-dev libxcb-util0-dev libboost-all-dev libboost-log-dev
#!/usr/bin/env bash sudo add-apt-repository ppa:boost-latest/ppa && sudo apt-get update && sudo apt-get install gettext xorg-dev libx11-xcb-dev libxcb-util0-dev libboost-all-dev
Install files updated to add additional applications.
#!/bin/bash # Install Caskroom brew tap caskroom/cask brew install brew-cask brew tap caskroom/versions # Install packages apps=( 1password gyazo dropbox google-drive spectacle flux dash imagealpha imageoptim evernote iterm2 atom webstorm firefox firefoxnightly google-chrome google-chrome-canary malwarebytes-anti-malware glimmerblocker hammerspoon kaleidoscope macdown opera screenflow spotify skype slack tower transmit elmedia-player utorrent ) brew cask install "${apps[@]}" # Quick Look Plugins (https://github.com/sindresorhus/quick-look-plugins) brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package
#!/bin/bash # Install Caskroom brew tap caskroom/cask brew install brew-cask brew tap caskroom/versions # Install packages apps=( 1password atom dash dropbox elmedia-player evernote firefox firefoxnightly flux glimmerblocker google-chrome google-chrome-canary google-drive gyazo hammerspoon imagealpha imageoptim iterm2 kaleidoscope macdown malwarebytes-anti-malware marked2 opera screenflow skype slack spectacle spotify thunderbird tower transmit utorrent webstorm ) brew cask install "${apps[@]}" # Quick Look Plugins (https://github.com/sindresorhus/quick-look-plugins) brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package
Add shell alias for using pip outside virtualenv
# Use colors in coreutils utilities output alias ls='ls --color=auto' alias ll='ls -l --color=auto' alias la='ls -la --color=auto' if [[ "$(tput colors)" == "256" ]]; then eval $(dircolors ~/.zsh/plugins/dircolors-solarized/dircolors.256dark) fi export GREP_OPTIONS="--color" # cd to git root directory alias cdgr='cd "$(git root)"' # Jump to directory containing file function jump() { cd "(dirname ${1})" } # cd replacement for screen to track cwd (like tmux) function scr_cd() { builtin cd $1 screen -X chdir $PWD } if [[ "$TERM" == 'screen.rxvt' ]]; then alias cd=scr_cd fi # Go up [n] directories function up() { if [[ "${1}" == "" ]]; then cd .. elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then echo "Error: argument must be a number" elif ! [[ "${1}" -gt "0" ]]; then echo "Error: argument must be positive" else for i in {1..${1}}; do cd .. done fi } # Mirror a website alias mirrorsite='wget -m -k -K -E -e robots=off'
# Use colors in coreutils utilities output alias ls='ls --color=auto' alias ll='ls -l --color=auto' alias la='ls -la --color=auto' if [[ "$(tput colors)" == "256" ]]; then eval $(dircolors ~/.zsh/plugins/dircolors-solarized/dircolors.256dark) fi export GREP_OPTIONS="--color" # Use pip without requiring virtualenv function syspip() { PIP_REQUIRE_VIRTUALENV="" pip "$@" } # cd to git root directory alias cdgr='cd "$(git root)"' # Jump to directory containing file function jump() { cd "(dirname ${1})" } # cd replacement for screen to track cwd (like tmux) function scr_cd() { builtin cd $1 screen -X chdir $PWD } if [[ "$TERM" == 'screen.rxvt' ]]; then alias cd=scr_cd fi # Go up [n] directories function up() { if [[ "${1}" == "" ]]; then cd .. elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then echo "Error: argument must be a number" elif ! [[ "${1}" -gt "0" ]]; then echo "Error: argument must be positive" else for i in {1..${1}}; do cd .. done fi } # Mirror a website alias mirrorsite='wget -m -k -K -E -e robots=off'
Change reference to pome to remove incorrect client reference
#!/bin/bash # set DIR=ARCHIVE to build stable release # DIR=CURRENT (or empty) to build the current snapshot DIR=$1 BUILD_HOSTS="fc20-64 fc20 fc19-64 fc19 fc18-64 fc18 centos6-64 centos6 centos5-64 centos5" parallel -j 2 --arg-sep ::: ssh -x {} PATH=/usr/bin:/bin:$PATH graphviz-build/redhat/graphviz-bin-rpm.tcl $DIR ::: $BUILD_HOSTS BUILD_HOSTS="ubuntu12 ubuntu12-64 ubuntu13 ubuntu13-64" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/ubuntu/graphviz-bin-deb.tcl $DIR ::: $BUILD_HOSTS BUILD_HOSTS="snares" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/macosx/graphviz-snowleopard-bin-pkg.sh $DIR ::: $BUILD_HOSTS BUILD_HOSTS="pome.client.research.att.com" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/macosx/graphviz-mountainlion-bin-pkg.sh $DIR ::: $BUILD_HOSTS BUILD_HOSTS="empire" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/macosx/graphviz-lion-bin-pkg.sh $DIR ::: $BUILD_HOSTS
#!/bin/bash # set DIR=ARCHIVE to build stable release # DIR=CURRENT (or empty) to build the current snapshot DIR=$1 BUILD_HOSTS="fc20-64 fc20 fc19-64 fc19 fc18-64 fc18 centos6-64 centos6 centos5-64 centos5" parallel -j 2 --arg-sep ::: ssh -x {} PATH=/usr/bin:/bin:$PATH graphviz-build/redhat/graphviz-bin-rpm.tcl $DIR ::: $BUILD_HOSTS BUILD_HOSTS="ubuntu12 ubuntu12-64 ubuntu13 ubuntu13-64" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/ubuntu/graphviz-bin-deb.tcl $DIR ::: $BUILD_HOSTS BUILD_HOSTS="snares" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/macosx/graphviz-snowleopard-bin-pkg.sh $DIR ::: $BUILD_HOSTS BUILD_HOSTS="pome" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/macosx/graphviz-mountainlion-bin-pkg.sh $DIR ::: $BUILD_HOSTS BUILD_HOSTS="empire" parallel -j 2 --arg-sep ::: ssh -x {} graphviz-build/macosx/graphviz-lion-bin-pkg.sh $DIR ::: $BUILD_HOSTS
Increase the time waiting for a consul leader to be elected
#!/bin/bash token=$1 if [ -n "${token}" ]; then ccargs="--token=${token}" fi # Non-server nodes can be restart immediately with no effect on the quorum # if [ $(consul-cli agent-self ${ccargs} | jq -r .Member.Tags.role) == node ]; then systemctl restart consul exit 0 fi # Try to acquire a lock on 'locks/consul' sessionid=$(consul-cli kv-lock ${ccargs} locks/consul) # Lock acquired. Pause briefly to allow the previous holder to restart # If it takes longer than five seconds run `systemctl restart consul` # after releasing the lock then we might cause a quorum outage sleep 5 # Verify that there is a leader before releasing the lock and restarting /usr/local/bin/consul-wait-for-leader.sh # Release the lock consul-cli kv-unlock ${ccargs} locks/consul --session=${sessionid} # Restart the service systemctl restart consul exit 0
#!/bin/bash token=$1 if [ -n "${token}" ]; then ccargs="--token=${token}" fi # Non-server nodes can be restart immediately with no effect on the quorum # if [ $(consul-cli agent-self ${ccargs} | jq -r .Member.Tags.role) == node ]; then systemctl restart consul exit 0 fi # Try to acquire a lock on 'locks/consul' sessionid=$(consul-cli kv-lock ${ccargs} locks/consul) # Lock acquired. Pause briefly to allow the previous holder to restart # If it takes longer than five seconds run `systemctl restart consul` # after releasing the lock then we might cause a quorum outage sleep 10 # Verify that there is a leader before releasing the lock and restarting /usr/local/bin/consul-wait-for-leader.sh # Release the lock consul-cli kv-unlock ${ccargs} locks/consul --session=${sessionid} # Restart the service systemctl restart consul exit 0
Set permissions on storage dir
#!/bin/bash echo "Hold onto your butts" composer install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress npm install #bower install #bundle install gulp --prod
#!/bin/bash echo "Hold onto your butts" composer install --no-dev --verbose --prefer-dist --optimize-autoloader --no-progress npm install #bower install #bundle install gulp --prod chmod 777 storage chmod 777 storage/logs
Add missing "$" for TRAVIS_PULL_REQUEST
#!/bin/bash set -e ./grailsw refresh-dependencies --non-interactive ./grailsw test-app --non-interactive ./grailsw package-plugin --non-interactive ./grailsw doc --pdf --non-interactive if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_REPO_SLUG == 'candrews/grails-jasper' && TRAVIS_PULL_REQUEST == 'false' ]]; then git config --global user.name "$GIT_NAME" git config --global user.email "$GIT_EMAIL" git config --global credential.helper "store --file=~/.git-credentials" echo "https://$GH_TOKEN:@github.com" > ~/.git-credentials git clone https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG.git -b gh-pages gh-pages --single-branch > /dev/null cd gh-pages git rm -rf . cp -r ../target/docs/. ./ git add * git commit -a -m "Updating docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID" git push origin HEAD cd .. rm -rf gh-pages ./grailsw publish-plugin --no-scm --allow-overwrite --non-interactive else echo "Not on master branch, so not publishing" fi
#!/bin/bash set -e ./grailsw refresh-dependencies --non-interactive ./grailsw test-app --non-interactive ./grailsw package-plugin --non-interactive ./grailsw doc --pdf --non-interactive if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_REPO_SLUG == 'candrews/grails-jasper' && $TRAVIS_PULL_REQUEST == 'false' ]]; then git config --global user.name "$GIT_NAME" git config --global user.email "$GIT_EMAIL" git config --global credential.helper "store --file=~/.git-credentials" echo "https://$GH_TOKEN:@github.com" > ~/.git-credentials git clone https://${GH_TOKEN}@github.com/$TRAVIS_REPO_SLUG.git -b gh-pages gh-pages --single-branch > /dev/null cd gh-pages git rm -rf . cp -r ../target/docs/. ./ git add * git commit -a -m "Updating docs for Travis build: https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID" git push origin HEAD cd .. rm -rf gh-pages ./grailsw publish-plugin --no-scm --allow-overwrite --non-interactive else echo "Not on master branch, so not publishing" echo "TRAVIS_BRANCH: $TRAVIS_BRANCH" echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" fi
Change test pre pull of openshift-spark to 2.4
#!/bin/bash function prepare() { ip addr show eth0 export HOST_IP_ADDRESS="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)" echo "Host IP is $HOST_IP_ADDRESS" IMAGEFOROC="quay.io/openshift/origin-cli:$OPENSHIFT_VERSION" if [ "$OPENSHIFT_VERSION" == "v3.10" ]; then IMAGEFOROC="docker.io/openshift/origin:$OPENSHIFT_VERSION" fi sudo docker cp $(docker create $IMAGEFOROC):/bin/oc /usr/local/bin/oc oc cluster up --public-hostname=$HOST_IP_ADDRESS oc login -u system:admin export REGISTRY_URL=$(oc get svc -n default docker-registry -o jsonpath='{.spec.clusterIP}:{.spec.ports[0].port}') oc login -u developer -p developer docker pull radanalyticsio/openshift-spark:2.3-latest } prepare
#!/bin/bash function prepare() { ip addr show eth0 export HOST_IP_ADDRESS="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)" echo "Host IP is $HOST_IP_ADDRESS" IMAGEFOROC="quay.io/openshift/origin-cli:$OPENSHIFT_VERSION" if [ "$OPENSHIFT_VERSION" == "v3.10" ]; then IMAGEFOROC="docker.io/openshift/origin:$OPENSHIFT_VERSION" fi sudo docker cp $(docker create $IMAGEFOROC):/bin/oc /usr/local/bin/oc oc cluster up --public-hostname=$HOST_IP_ADDRESS oc login -u system:admin export REGISTRY_URL=$(oc get svc -n default docker-registry -o jsonpath='{.spec.clusterIP}:{.spec.ports[0].port}') oc login -u developer -p developer docker pull radanalyticsio/openshift-spark:2.4-latest } prepare
Update test to set number of nodes variable
#!/bin/bash export FLOCKER_ACCEPTANCE_NODES=$(cat control.txt agents.txt | sort | uniq | paste -s -d: -) export FLOCKER_ACCEPTANCE_CONTROL_NODE=$(cat control.txt) export FLOCKER_ACCEPTANCE_AGENT_NODES=$(cat agents.txt | paste -s -d: -) export FLOCKER_ACCEPTANCE_VOLUME_BACKEND=zfs export FLOCKER_ACCEPTANCE_API_CERTIFICATES_PATH=`pwd` trial flocker.acceptance
#!/bin/bash source flocker-client/bin/activate export FLOCKER_ACCEPTANCE_NODES=$(cat control.txt agents.txt | sort | uniq | paste -s -d: -) export FLOCKER_ACCEPTANCE_NUM_AGENT_NODES=$(cat control.txt agents.txt | sort | uniq | wc -l) export FLOCKER_ACCEPTANCE_CONTROL_NODE=$(cat control.txt) export FLOCKER_ACCEPTANCE_AGENT_NODES=$(cat agents.txt | paste -s -d: -) export FLOCKER_ACCEPTANCE_VOLUME_BACKEND=zfs export FLOCKER_ACCEPTANCE_API_CERTIFICATES_PATH=`pwd` trial flocker.acceptance
Remove the code for podman because shakiyam/oci-cli does not work with podman
#!/bin/bash set -eu -o pipefail echo 'Install OCI CLI' readonly IMAGE_NAME='shakiyam/oci-cli' if [[ $(command -v docker) ]]; then sudo docker pull $IMAGE_NAME elif [[ $(command -v podman) ]]; then podman pull $IMAGE_NAME else echo -e "\033[36mdocker or podman not found\033[0m"; exit 1; fi curl -L# https://raw.githubusercontent.com/shakiyam/oci-cli-docker/master/oci \ | sudo tee /usr/local/bin/oci >/dev/null sudo chmod +x /usr/local/bin/oci
#!/bin/bash set -eu -o pipefail echo 'Install OCI CLI' readonly IMAGE_NAME='shakiyam/oci-cli' [[ $(command -v docker) ]] || { echo -e "\033[36mdocker not found\033[0m"; exit 1; } sudo docker pull $IMAGE_NAME curl -L# https://raw.githubusercontent.com/shakiyam/oci-cli-docker/master/oci \ | sudo tee /usr/local/bin/oci >/dev/null sudo chmod +x /usr/local/bin/oci
Comment the rm 'trick' to delete hidden files.
#!/bin/sh if [[ $# -eq 0 ]] ; then echo 'Usage: tidyup <dir1> <dir2> ... <dirN>' echo 'Tidies ~/<dirN> to ~/Backups/<dirN>' exit 0 fi today="$(date +'%d%m%y')" backupdir=~/Backups/ for var in "$@" do source=~/$var # Ignore directories that don't exist. if [ -d "$source" ] ; then destination=$backupdir$var/$today mkdir -p $destination rsync -arq $source/ $destination rm -rf $source/..?* $source/.[!.]* $source/* fi done
#!/bin/sh if [[ $# -eq 0 ]] ; then echo 'Usage: tidyup <dir1> <dir2> ... <dirN>' echo 'Tidies ~/<dirN> to ~/Backups/<dirN>' exit 0 fi today="$(date +'%d%m%y')" backupdir=~/Backups/ for var in "$@" do source=~/$var # Ignore directories that don't exist. if [ -d "$source" ] ; then destination=$backupdir$var/$today mkdir -p $destination rsync -arq $source/ $destination # The following rm command removes: # - all subdirectories (and their contents) # - all hidden files # - all normal files # This requires a 'trick' because normally removing .* results in the # error that rm cannot remove '.' and '..'. # It has three components that use wildcards: # 1/ $source/..?* removes all dot-dot files and subdirs except .. # 2/ $source/.[!.]* removes all dot files and subdirs except . # 3/ $source/* removes all non dot files and subdirs rm -rf $source/..?* $source/.[!.]* $source/* fi done
Remove shake-logger from Vagrant setup script
#!/bin/sh # Add docker key and repository apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list # Install apache and docker apt-get update -q apt-get upgrade -qy apt-get install -qy apache2 docker-engine # Put the relevant files in place cp /tmp/juice-shop/default.conf /etc/apache2/sites-available/000-default.conf # Download and start docker image with Juice Shop docker run --restart=always -d -p 3000:3000 --name juice-shop bkimminich/juice-shop # Enable proxy modules in apache and restart a2enmod proxy_http systemctl restart apache2.service # Run shake.js/logger docker run --restart=always -d -p 8080:80 --name shake-logger -e TARGET_SOCKET=192.168.33.10:8080 wurstbrot/shake-logger
#!/bin/sh # Add docker key and repository apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list # Install apache and docker apt-get update -q apt-get upgrade -qy apt-get install -qy apache2 docker-engine # Put the relevant files in place cp /tmp/juice-shop/default.conf /etc/apache2/sites-available/000-default.conf # Download and start docker image with Juice Shop docker run --restart=always -d -p 3000:3000 --name juice-shop bkimminich/juice-shop # Enable proxy modules in apache and restart a2enmod proxy_http systemctl restart apache2.service
Allow to modify Presto in product tests
#!/bin/bash set -euo pipefail if test $# -gt 0; then echo "$0 does not accept arguments" >&2 exit 32 fi set -x tar xf /docker/presto-server.tar.gz -C /docker exec /docker/presto-server-*/bin/launcher \ -Dpresto-temporarily-allow-java8=true \ -Dnode.id="${HOSTNAME}" \ --etc-dir="/docker/presto-product-tests/conf/presto/etc" \ --data-dir=/var/presto \ run
#!/bin/bash set -euo pipefail if test $# -gt 0; then echo "$0 does not accept arguments" >&2 exit 32 fi set -x tar xf /docker/presto-server.tar.gz -C /docker if test -d /docker/presto-init.d; then for init_script in /docker/presto-init.d/*; do "${init_script}" done fi exec /docker/presto-server-*/bin/launcher \ -Dpresto-temporarily-allow-java8=true \ -Dnode.id="${HOSTNAME}" \ --etc-dir="/docker/presto-product-tests/conf/presto/etc" \ --data-dir=/var/presto \ run
Fix issue with image name starting with docker.io
#!/bin/bash set -eu -o pipefail if [[ "$#" -ne 1 ]]; then echo "Usage: remove_images.sh image_name" exit 1 fi IMAGE_NAME="$1" readonly IMAGE_NAME DOCKER=$(command -v docker || command -v podman) readonly DOCKER LATEST_IMAGE="$($DOCKER image ls -q "$IMAGE_NAME":latest)" readonly LATEST_IMAGE if [[ -n "$LATEST_IMAGE" ]]; then $DOCKER image rm -f "$LATEST_IMAGE" fi
#!/bin/bash set -eu -o pipefail if [[ "$#" -ne 1 ]]; then echo "Usage: remove_images.sh image_name" exit 1 fi IMAGE_NAME="$1" readonly IMAGE_NAME DOCKER=$(command -v docker || command -v podman) readonly DOCKER LATEST_IMAGE="$($DOCKER image inspect -f "{{.Id}}" "$IMAGE_NAME":latest || :)" readonly LATEST_IMAGE if [[ -n "$LATEST_IMAGE" ]]; then $DOCKER image rm -f "$LATEST_IMAGE" fi
Set MAX_GRID_CPU to increase 074 speed.
#!/bin/bash set -e echo echo "========================================" echo "Host Environment" echo "----------------------------------------" export echo "----------------------------------------" echo echo "========================================" echo "Host CPU" echo "----------------------------------------" export CORES=$(nproc --all) echo "Cores: $CORES" echo echo "Memory" echo "----------------------------------------" cat /proc/meminfo echo "----------------------------------------" export MEM_GB=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo)/(1024*1024))) echo "Total Memory (GB): $MEM_GB" # Approx memory per grid process export MEM_PER_RUN=8 export MAX_CPU_PER_GRID=$(($MEM_GB/$MEM_PER_RUN)) export MAX_VIVADO_PROCESS=$(($MEM_GB/$MEM_PER_RUN)) echo echo "========================================" echo "Host files" echo "----------------------------------------" echo $PWD echo "----------------------------------------" find . | sort echo "----------------------------------------"
#!/bin/bash set -e echo echo "========================================" echo "Host Environment" echo "----------------------------------------" export echo "----------------------------------------" echo echo "========================================" echo "Host CPU" echo "----------------------------------------" export CORES=$(nproc --all) echo "Cores: $CORES" echo echo "Memory" echo "----------------------------------------" cat /proc/meminfo echo "----------------------------------------" export MEM_GB=$(($(awk '/MemTotal/ {print $2}' /proc/meminfo)/(1024*1024))) echo "Total Memory (GB): $MEM_GB" # Approx memory per grid process export MEM_PER_RUN=8 export MAX_GRID_CPU=$(($MEM_GB/$MEM_PER_RUN)) export MAX_VIVADO_PROCESS=$(($MEM_GB/$MEM_PER_RUN)) echo echo "========================================" echo "Host files" echo "----------------------------------------" echo $PWD echo "----------------------------------------" find . | sort echo "----------------------------------------"
Use latest jboss eap version
include string.util.StringUtil @class AppServerVersionConstants(){ @deprecated @private _convertMethodToConstant(){ local cmd=${1} if [[ ${cmd} == *Version ]]; then local cmd=$( StringUtil toUpperCase $(StringUtil strip cmd Version)_VERSION) fi ${cmd} } GLASSFISH_VERSION(){ echo "3.1.2.2" } JBOSS_VERSION(){ echo "eap-7.0.0" } JETTY_VERSION(){ echo "8.1.10" } JONAS_VERSION(){ echo "5.2.3" } RESIN_VERSION(){ echo "4.0.44" } TCAT_VERSION(){ echo "7.0.2" } TCSERVER_VERSION(){ echo "3.2.5" } TOMCAT_VERSION(){ echo "9.0.10" } WEBLOGIC_VERSION(){ echo "12.2.1" } WEBSPHERE_VERSION(){ echo "9.0.0.0" } WILDFLY_VERSION(){ echo "11.0.0" } _convertMethodToConstant ${@} }
include string.util.StringUtil @class AppServerVersionConstants(){ @deprecated @private _convertMethodToConstant(){ local cmd=${1} if [[ ${cmd} == *Version ]]; then local cmd=$( StringUtil toUpperCase $(StringUtil strip cmd Version)_VERSION) fi ${cmd} } GLASSFISH_VERSION(){ echo "3.1.2.2" } JBOSS_VERSION(){ echo "eap-7.1.0" } JETTY_VERSION(){ echo "8.1.10" } JONAS_VERSION(){ echo "5.2.3" } RESIN_VERSION(){ echo "4.0.44" } TCAT_VERSION(){ echo "7.0.2" } TCSERVER_VERSION(){ echo "3.2.5" } TOMCAT_VERSION(){ echo "9.0.10" } WEBLOGIC_VERSION(){ echo "12.2.1" } WEBSPHERE_VERSION(){ echo "9.0.0.0" } WILDFLY_VERSION(){ echo "11.0.0" } # _convertMethodToConstant ${@} $@ }
Update Travis build script with correct package name
#!/usr/bin/env sh log_file="travis/travis_build.log" # Run custom commands, such as running your test cases eval "Rscript ./travis/travis_build.R | tee -a '$log_file'" # Search for errors in the output of your custom commands err1="ERROR" err2="WARNING" err3="Failure (at" err4="Failure(@" err5="Error: " if ! grep -q "$err1\|$err2\|$err3\|$err4\|$err5" $log_file; then echo "No errors, warnings, or failures found." else printf "\n" echo "*** grep results **********************" grep -n "$err1" $log_file grep -n "$err2" $log_file grep -n "$err3" $log_file grep -n "$err4" $log_file grep -n "$err5" $log_file echo "ERROR, WARNING, or Failure found. See grep results above." printf "\n" exit 1 fi # Run the same commands Travis runs by default R CMD build --no-build-vignettes --no-manual rpack R CMD check --no-build-vignettes --no-manual --as-cran rpack
#!/usr/bin/env sh log_file="travis/travis_build.log" # Run custom commands, such as running your test cases eval "Rscript ./travis/travis_build.R | tee -a '$log_file'" # Search for errors in the output of your custom commands err1="ERROR" err2="WARNING" err3="Failure (at" err4="Failure(@" err5="Error: " if ! grep -q "$err1\|$err2\|$err3\|$err4\|$err5" $log_file; then echo "No errors, warnings, or failures found." else printf "\n" echo "*** grep results **********************" grep -n "$err1" $log_file grep -n "$err2" $log_file grep -n "$err3" $log_file grep -n "$err4" $log_file grep -n "$err5" $log_file echo "ERROR, WARNING, or Failure found. See grep results above." printf "\n" exit 1 fi # Run the same commands Travis runs by default R CMD build --no-build-vignettes --no-manual receptormarker R CMD check --no-build-vignettes --no-manual --as-cran receptormarker
Make call to grep more specific
#!/bin/bash FFPATH="/home/amblin/dev/fast-forward/" FFPHP="${FFPATH}cli-launch.php" FFTMP="${FFPATH}cli-launch.tmp" # Run fast-forward and capture output in $FFTMP php $FFPHP "$@" | tee $FFTMP # Get returned commands retcmd=$(grep -E "^cmd:.+" $FFTMP | sed 's/^cmd:\(.*\)/\1/') # Execute commands eval $retcmd
#!/bin/bash FFPATH="/home/amblin/dev/fast-forward/" FFPHP="${FFPATH}cli-launch.php" FFTMP="${FFPATH}cli-launch.tmp" # Run fast-forward and capture output in $FFTMP php $FFPHP "$@" | tee $FFTMP # Get returned commands retcmd=$(\grep -E "^cmd:.+" $FFTMP | sed 's/^cmd:\(.*\)/\1/') # Execute commands eval $retcmd
Add full SUD comment block
#!/bin/bash -e ### summarize a particular user's contributions to a repository. if [ $1 ]; then git log --shortstat --author "$1" | grep "files\? changed" | awk '{f+=$1; i+=$4; d+=$6} END {print "files:", f, "green:", i, "red", d}' else echo "Usage: ./this username" exit fi
#!/bin/bash -e # # Summary # gl.sh - summarize a particular user's contributions to a repository. # # Usage # ./gl.sh [user-name] # # Description # Skims the output of an abbreviated git log for contributions by the provided # user's name, then sums the numbers associated with three metrics: # 1) File(s) changed # 2) Line insertions # 3) Lines deletions # Which are finally summarised respectively as `files', `green', and `red'. # if [ $1 ]; then git log --shortstat --author "$1" | grep "files\? changed" | awk '{f+=$1; i+=$4; d+=$6} END {print "files:", f, "green:", i, "red", d}' else echo "Usage: ./this username" exit fi
Create snapshots for data and databases automatically
#!/bin/bash UUID=$(mdata-get sdc:uuid) DDS=zones/${UUID}/data if zfs list ${DDS} 1>/dev/null 2>&1; then zfs create ${DDS}/www || true zfs create ${DDS}/mysql || true zfs set mountpoint=/var/www ${DDS}/www zfs set mountpoint=/var/mysql ${DDS}/mysql fi
#!/bin/bash UUID=$(mdata-get sdc:uuid) DDS=zones/${UUID}/data if zfs list ${DDS} 1>/dev/null 2>&1; then zfs create ${DDS}/www || true zfs create ${DDS}/mysql || true zfs set mountpoint=/var/www ${DDS}/www zfs set mountpoint=/var/mysql ${DDS}/mysql fi # znapzend for backup znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \ SRC '7day=>8hour,30day=>1day,1year=>1week,10year=>1month' ${DDS}/www znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \ SRC '7day=>8hour,30day=>1day,1year=>1week,10year=>1month' ${DDS}/mysql /usr/sbin/svcadm enable svc:/pkgsrc/znapzend:default
Add EOD instead of EOF
#!/bin/bash vmname=${1:-admin} keyname=${2:-class2} #floatingip=${3:-10.1.64.32} cat > data.txt <<EOF #!/bin/bash passwd ubuntu <<EOF ubuntu ubuntu EOF cat > test.htm <<EOF done EOF python -m SimpleHTTPServer 80 EOF floatingip=`nova floating-ip-create sixtyfour | awk '/sixtyfour/ {print $2}'` nova boot ${vmname} --image trusty --flavor m1.small --key-name ${keyname} --nic net-id=47ea0f46-5728-4a22-bab7-1417a21539fd --config-drive True --user-data ./data.txt nova floating-ip-associate ${vmname} ${floatingip} until [[ $(wget -qO - http://${floatingip}/test.htm) =~ done ]] do echo not done sleep 5 done echo "Test is $(wget -qO - http://${floatingip}/test.htm)" nova delete ${vmname} nova floating-ip-delete ${floatingip}
#!/bin/bash vmname=${1:-admin} keyname=${2:-class2} #floatingip=${3:-10.1.64.32} cat > data.txt <<EOD #!/bin/bash passwd ubuntu <<EOF ubuntu ubuntu EOF cat > test.htm <<EOF done EOF python -m SimpleHTTPServer 80 EOD floatingip=`nova floating-ip-create sixtyfour | awk '/sixtyfour/ {print $2}'` nova boot ${vmname} --image trusty --flavor m1.small --key-name ${keyname} --nic net-id=47ea0f46-5728-4a22-bab7-1417a21539fd --config-drive True --user-data ./data.txt nova floating-ip-associate ${vmname} ${floatingip} until [[ $(wget -qO - http://${floatingip}/test.htm) =~ done ]] do echo not done sleep 5 done echo "Test is $(wget -qO - http://${floatingip}/test.htm)" nova delete ${vmname} nova floating-ip-delete ${floatingip}
Install the latest npm to work around bugs
#!/bin/bash set -e npm cache clear npm install -g buster sinon@1.6.0 autolint || (sleep 5 && npm install -g buster sinon@1.6.0 autolint)
#!/bin/bash set -e function setup () { npm install -g npm && npm install -g buster sinon@1.6.0 autolint } setup || (sleep 5 && setup)
Install many quick look plugins for OS X
# Install Brew Cask # https://github.com/caskroom/homebrew-cask brew install caskroom/cask/brew-cask # Install dev tools brew cask install iterm2 brew cask install sourcetree brew cask install gitter brew cask install structurer brew cask install virtualbox # Install other softwares brew cask install cyberduck brew cask install divvy brew cask install vlc brew cask install transmission brew cask install handbrake brew cask install spotify brew cask install sonos brew cask install dropbox brew cask install google-drive brew cask install teamviewer
# Install Brew Cask # https://github.com/caskroom/homebrew-cask brew install caskroom/cask/brew-cask # Install dev tools brew cask install iterm2 brew cask install sourcetree brew cask install gitter brew cask install structurer brew cask install virtualbox # Install other softwares brew cask install cyberduck brew cask install divvy brew cask install vlc brew cask install transmission brew cask install handbrake brew cask install spotify brew cask install sonos brew cask install dropbox brew cask install google-drive brew cask install teamviewer # Install QuickView brew cask install qlmarkdown brew cask install qlcolorcode brew cask install qlstephen brew cask install quicklook-json brew cask install qlprettypatch brew cask install quicklook-csv brew cask install betterzipql brew cask install qlimagesize brew cask install webpquicklook brew cask install suspicious-package
Update check-config script from Docker master
#!/bin/sh set -ex docker version docker info docker ps DOCKER_CONTENT_TRUST=1 docker pull alpine docker run --rm alpine true docker pull armhf/alpine docker run --rm armhf/alpine uname -a docker swarm init docker run mobylinux/check-config@sha256:7f8327e9eeae67a7f1388ad0ac5089454fea0636c175feb4400e5fc76ebc816e
#!/bin/sh set -ex docker version docker info docker ps DOCKER_CONTENT_TRUST=1 docker pull alpine docker run --rm alpine true docker pull armhf/alpine docker run --rm armhf/alpine uname -a docker swarm init docker run mobylinux/check-config@sha256:4282f589d5a72004c3991c0412e45ba0ab6bb8c0c7d97dc40dabc828700e99ab
Change args order to support latest om version
#!/usr/local/bin/dumb-init /bin/bash set -euo pipefail [ 'true' = "${DEBUG:-}" ] && set -x base=$PWD PRODUCT="$(yq r $base/mongodb-on-demand-release/tile/tile.yml name)" om="om -t $PCF_URL -u $PCF_USERNAME -p $PCF_PASSWORD -k" echo "Retrieving current staged version of ${PRODUCT}" product_version=$(${om} -f json deployed-products | jq -r --arg product_name $PRODUCT '.[] | select(.name == $product_name) | .version') echo "Deleting product [${PRODUCT}], version [${product_version}] , from ${PCF_URL}" ${om} unstage-product --product-name "$PRODUCT" ${om} apply-changes --ignore-warnings true
#!/usr/local/bin/dumb-init /bin/bash set -euo pipefail [ 'true' = "${DEBUG:-}" ] && set -x base=$PWD PRODUCT="$(yq r $base/mongodb-on-demand-release/tile/tile.yml name)" om="om -t $PCF_URL -u $PCF_USERNAME -p $PCF_PASSWORD -k" echo "Retrieving current staged version of ${PRODUCT}" product_version=$(${om} deployed-products -f json | jq -r --arg product_name $PRODUCT '.[] | select(.name == $product_name) | .version') echo "Deleting product [${PRODUCT}], version [${product_version}] , from ${PCF_URL}" ${om} unstage-product --product-name "$PRODUCT" ${om} apply-changes --ignore-warnings true
Add blogs.water.gkhs.net alias to wywo config
#!/bin/bash sudo service nginx stop sudo letsencrypt certonly --standalone --domains \ istic.net,\ archipelago.water.gkhs.net,\ aquarionics.blogs.water.gkhs.net,www.aquarionics.com,aquarionics.com,wywo.aquarionics.com,\ factionfiction.net,www.factionfiction.net,factionfiction.blogs.water.gkhs.net,\ cleartextcontent.blogs.water.gkhs.net,www.cleartextcontent.co.uk,cleartextcontent.co.uk,\ idlespeculation.blogs.water.gkhs.net,idlespeculation.foip.me,\ omnyom.blogs.water.gkhs.net,omnyom.com,\ herodiaries.blogs.water.gkhs.net,herodiaries.foip.me,\ istic.blogs.water.gkhs.net,istic.co,istic.systems,istic.network\ monthlymoon.blogs.water.gkhs.net,themonthlymoon.com,\ blogs.water.gkhs.net,\ skute.me,alpha.skute.me,\ forums.profounddecisions.co.uk,\ imperial.istic.net,altru.istic.net,\ live.art.istic.net,imperial.istic.net,material.istic.net,\ warehousebasement.com,www.warehousebasement.com,\ dagon.church sudo service nginx start
#!/bin/bash sudo service nginx stop sudo letsencrypt certonly --standalone --domains \ istic.net,\ archipelago.water.gkhs.net,\ aquarionics.blogs.water.gkhs.net,www.aquarionics.com,aquarionics.com,old.aquarionics.com,\ wywo.blogs.water.gkhs.net,wywo.aquarionics.com,\ factionfiction.net,www.factionfiction.net,factionfiction.blogs.water.gkhs.net,\ cleartextcontent.blogs.water.gkhs.net,www.cleartextcontent.co.uk,cleartextcontent.co.uk,\ idlespeculation.blogs.water.gkhs.net,idlespeculation.foip.me,\ omnyom.blogs.water.gkhs.net,omnyom.com,\ herodiaries.blogs.water.gkhs.net,herodiaries.foip.me,\ istic.blogs.water.gkhs.net,istic.co,istic.systems,istic.network\ monthlymoon.blogs.water.gkhs.net,themonthlymoon.com,\ blogs.water.gkhs.net,\ skute.me,alpha.skute.me,\ forums.profounddecisions.co.uk,\ imperial.istic.net,altru.istic.net,\ live.art.istic.net,imperial.istic.net,material.istic.net,\ warehousebasement.com,www.warehousebasement.com,\ dagon.church sudo service nginx start
Fix incorrect path in atom script
#!/bin/zsh if test "$(which apm)"; then apm upgrade --confirm false apm install --packages-file ~/.dotfiles/atom.symlink/packages.txt || true modules=" metrics exception-reporting " for module in $modules; do apm remove "$module" || true done fi
#!/bin/zsh if test "$(which apm)"; then apm upgrade --confirm false apm install --packages-file ~/.dotfiles/topics/atom.symlink/packages.txt || true modules=" metrics exception-reporting " for module in $modules; do apm remove "$module" || true done fi
Use option '--allow-source-mismatch' by default
#!/bin/bash case "$1" in 'bash') exec bash ;; 'gen-key') if [ "random" = "$PASSPHRASE" ]; then PASSPHRASE=$(pwgen 16 1) fi cat << EOF | gpg --batch --gen-key %echo Generating a key Key-Type: $KEY_TYPE Key-Length: $KEY_LENGTH Subkey-Type: $SUBKEY_TYPE Subkey-Length: $SUBKEY_LENGTH Name-Real: $NAME_REAL Name-Email: $NAME_EMAIL Expire-Date: 0 Passphrase: $PASSPHRASE %commit %echo Created key with passphrase '$PASSPHRASE' EOF exit ;; '/bin/bash') exec cat << EOF This is the duply docker container. Please specify a command: bash Open a command line prompt in the container. gen-key Create a GPG key to be used with duply. usage Show duply's usage help. All other commands will be interpreted as commands to duply. EOF ;; *) exec duply "$@" ;; esac
#!/bin/bash case "$1" in 'bash') exec bash ;; 'gen-key') if [ "random" = "$PASSPHRASE" ]; then PASSPHRASE=$(pwgen 16 1) fi cat << EOF | gpg --batch --gen-key %echo Generating a key Key-Type: $KEY_TYPE Key-Length: $KEY_LENGTH Subkey-Type: $SUBKEY_TYPE Subkey-Length: $SUBKEY_LENGTH Name-Real: $NAME_REAL Name-Email: $NAME_EMAIL Expire-Date: 0 Passphrase: $PASSPHRASE %commit %echo Created key with passphrase '$PASSPHRASE' EOF exit ;; '/bin/bash') exec cat << EOF This is the duply docker container. Please specify a command: bash Open a command line prompt in the container. gen-key Create a GPG key to be used with duply. usage Show duply's usage help. All other commands will be interpreted as commands to duply. EOF ;; *) DUPL_PARAMS="$DUPL_PARAMS --allow-source-mismatch" exec duply "$@" ;; esac
Make sure the Travis build fails when compiling fails
#!/bin/bash # Copyright 2015 The html5ever Project Developers. See the # COPYRIGHT file at the top-level directory of this distribution. # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your # option. This file may not be copied, modified, or distributed # except according to those terms. set -ex mkdir build cd build ../configure make check docs for_c | ../scripts/shrink-test-output.py
#!/bin/bash # Copyright 2015 The html5ever Project Developers. See the # COPYRIGHT file at the top-level directory of this distribution. # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your # option. This file may not be copied, modified, or distributed # except according to those terms. set -ex mkdir build cd build ../configure make check docs for_c | ../scripts/shrink-test-output.py exit ${PIPESTATUS[0]}
Use absolute aws path for syncing backups to work
#!/usr/bin/env bash export AWS_PROFILE=backups currentDate=$(date +%F) echo "Syncing db backups..." aws s3 sync /data/backup/db/automysqlbackup/daily/ "s3://droidwiki-backups/${currentDate}/db/" --no-progress --only-show-errors echo "Syncing droidwiki images..." aws s3 sync /data/shareddata/mediawiki/images/ "s3://droidwiki-backups/${currentDate}/mw_images/" --exclude "temp/" --no-progress --only-show-errors echo "Syncing missionrhode uploads..." aws s3 sync /data/shareddata/www/missionrhode.go2tech.de/public_html/wp-content/uploads/ "s3://droidwiki-backups/${currentDate}/mr_wp/" --no-progress --only-show-errors
#!/usr/bin/env bash export AWS_PROFILE=backups currentDate=$(date +%F) echo "Syncing db backups..." /usr/local/bin/aws s3 sync /data/backup/db/automysqlbackup/daily/ "s3://droidwiki-backups/${currentDate}/db/" --no-progress --only-show-errors echo "Syncing droidwiki images..." /usr/local/bin/aws s3 sync /data/shareddata/mediawiki/images/ "s3://droidwiki-backups/${currentDate}/mw_images/" --exclude "temp/" --no-progress --only-show-errors echo "Syncing missionrhode uploads..." /usr/local/bin/aws s3 sync /data/shareddata/www/missionrhode.go2tech.de/public_html/wp-content/uploads/ "s3://droidwiki-backups/${currentDate}/mr_wp/" --no-progress --only-show-errors
Set PYTHONPATH in qsub submission script
#! /usr/bin/env bash #PBS -N ILAMB #PBS -M mark.piper@colorado.edu #PBS -m e #PBS -l pmem=8gb #PBS -l nodes=1:ppn=2 #PBS -l walltime=12:00:00 cd $PBS_O_WORKDIR source /home/csdms/wmt/_testing/conda/bin/activate python run_bmiilamb.py
#! /usr/bin/env bash #PBS -N ILAMB #PBS -M mark.piper@colorado.edu #PBS -m e #PBS -l pmem=8gb #PBS -l nodes=1:ppn=2 #PBS -l walltime=12:00:00 cd $PBS_O_WORKDIR source /home/csdms/wmt/_testing/conda/bin/activate export PYTHONPATH=$PWD python run_bmiilamb.py MsTMIP.bmi.yaml
Set min heap to 1G - to enforce in docker images
#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$DIR/.." JAR=`ls $DIR/sparkler-app/target/sparkler-app-*-SNAPSHOT.jar` if [ ! -f "$JAR" ] then echo "Cant find Jar. Perhaps the sources are not built to produce a jar?" exit 2 fi # run java -cp $DIR/resources:$JAR \ edu.usc.irds.sparkler.Main $@
#!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$DIR/.." JAR=`ls $DIR/sparkler-app/target/sparkler-app-*-SNAPSHOT.jar` if [ ! -f "$JAR" ] then echo "Cant find Jar. Perhaps the sources are not built to produce a jar?" exit 2 fi # run java -Xms1g -cp $DIR/resources:$JAR \ edu.usc.irds.sparkler.Main $@
Remove deleting .dart_tool when run local tests
#!/bin/bash set -e function run_test() { echo "------------- Running test: $1 -------------" pushd $1 > /dev/null rm -rf .dart_tool dart pub upgrade dart format -o none --set-exit-if-changed . dart analyze --fatal-infos --fatal-warnings if [[ "$2" == 'vm+web' ]]; then dart test dart test -p chrome elif [[ "$2" == 'web-only' ]]; then dart test -p chrome else dart test fi popd > /dev/null } function run_test_flutter() { echo "------------- Running flutter test: $1 -------------" pushd $1 > /dev/null rm -rf .dart_tool flutter pub upgrade flutter clean dart format -o none --set-exit-if-changed . flutter analyze --fatal-infos --fatal-warnings flutter test $2 popd > /dev/null } cd .. run_test 'drift' 'vm+web' run_test 'drift_dev' run_test 'sqlparser' run_test_flutter 'drift_sqflite' 'integration_test' run_test_flutter 'examples/app' run_test 'examples/migrations_example' run_test_flutter 'extras/integration_tests/ffi_on_flutter' 'integration_test/drift_native.dart' run_test 'extras/integration_tests/web' 'web-only' run_test 'extras/drift_postgres'
#!/bin/bash set -e function run_test() { echo "------------- Running test: $1 -------------" pushd $1 > /dev/null dart pub upgrade dart format -o none --set-exit-if-changed . dart analyze --fatal-infos --fatal-warnings if [[ "$2" == 'vm+web' ]]; then dart test dart test -p chrome elif [[ "$2" == 'web-only' ]]; then dart test -p chrome else dart test fi popd > /dev/null } function run_test_flutter() { echo "------------- Running flutter test: $1 -------------" pushd $1 > /dev/null flutter pub upgrade flutter clean dart format -o none --set-exit-if-changed . flutter analyze --fatal-infos --fatal-warnings flutter test $2 popd > /dev/null } cd .. run_test 'drift' 'vm+web' run_test 'drift_dev' run_test 'sqlparser' run_test_flutter 'drift_sqflite' 'integration_test' run_test_flutter 'examples/app' run_test 'examples/migrations_example' run_test_flutter 'extras/integration_tests/ffi_on_flutter' 'integration_test/drift_native.dart' run_test 'extras/integration_tests/web' 'web-only' run_test 'extras/drift_postgres'
Remove existing versions of ansible repos.
echo "Bootstrap Ansible" curl -L https://raw.githubusercontent.com/andrewtchin/ansible-common/master/ubuntu-bootstrap.sh | sh echo "Clone ansible-common" git clone https://github.com/andrewtchin/ansible-common.git echo "Clone ansible-ubuntu" git clone https://github.com/andrewtchin/ansible-ubuntu.git cd ansible-common echo "Run ansible-common" ansible-playbook -vvv playbooks/common.yml --ask-sudo-pass -c local cd ../ansible-ubuntu echo "Run ansible-ubuntu" ansible-playbook -vvv playbooks/ubuntu.yml --ask-sudo-pass -c local --extra-vars=@vars/ubuntu.json echo "Install dotfiles" git clone https://github.com/andrewtchin/dotfiles-local.git ~/.dotfiles-local git clone https://github.com/andrewtchin/dotfiles.git ~/.dotfiles --recursive RCRC="$HOME/.dotfiles/rcrc" rcup echo "Install complete"
cd echo "Bootstrap Ansible" curl -L https://raw.githubusercontent.com/andrewtchin/ansible-common/master/ubuntu-bootstrap.sh | sh echo "Clone ansible-common" ANSIBLE_COMMON_DIR="~/ansible-common" if [ -d "$ANSIBLE_COMMON_DIR" ]; then rm -rf $ANSIBLE_COMMON_DIR fi git clone https://github.com/andrewtchin/ansible-common.git $ANSIBLE_COMMON_DIR echo "Clone ansible-ubuntu" ANSIBLE_UBUNTU_DIR="~/ansible-ubuntu" if [ -d "$ANSIBLE_UBUNTU_DIR" ]; then rm -rf $ANSIBLE_UBUNTU_DIR fi git clone https://github.com/andrewtchin/ansible-ubuntu.git $ANSIBLE_UBUNTU_DIR cd ansible-common echo "Run ansible-common" ansible-playbook -vvv playbooks/common.yml --ask-sudo-pass -c local cd ../ansible-ubuntu echo "Run ansible-ubuntu" ansible-playbook -vvv playbooks/ubuntu.yml --ask-sudo-pass -c local --extra-vars=@vars/ubuntu.json echo "Install dotfiles" git clone https://github.com/andrewtchin/dotfiles-local.git ~/.dotfiles-local git clone https://github.com/andrewtchin/dotfiles.git ~/.dotfiles --recursive RCRC="$HOME/.dotfiles/rcrc" rcup echo "Install complete"
Remove unneeded dependency on the Gemfile
#!/bin/bash # # This shell stub invokes the vm_to_cluster.rb script using the # binary gems pre-installed in vendor/bundle. # # See wait_for_hosts.rb for a detailed description. # export PATH=/opt/chefdk/embedded/bin:/usr/bin:/bin REPO_DIR="`dirname ${BASH_SOURCE[0]}`" cd $REPO_DIR . ./proxy_setup.sh # Iterate over a list of "<dpkg name> <gem name>" necessary for the Gemfile for p in "libaugeas-dev ruby-augeas" "libmysqlclient-dev mysql2" "libmysqld-dev mysql2" "libkrb5-dev rkerberos"; do if [ $(dpkg-query -W -f='${Status}' ${p% *} 2>/dev/null | grep -c 'ok installed') -ne 1 ] && [ "$(uname)" != "Darwin" ]; then echo "#### Need ${p% *} for the ${p#* } Gem" > /dev/stderr sudo apt-get install -y ${p% *} fi done export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig bundle config --local PATH vendor/bundle bundle config --local DISABLE_SHARED_GEMS true bundle package --path vendor/bundle bundle exec --keep-file-descriptors ./vm_to_cluster.rb $*
#!/bin/bash # # This shell stub invokes the vm_to_cluster.rb script using the # binary gems pre-installed in vendor/bundle. # # See wait_for_hosts.rb for a detailed description. # export PATH=/opt/chefdk/embedded/bin:/usr/bin:/bin REPO_DIR="`dirname ${BASH_SOURCE[0]}`" cd $REPO_DIR . ./proxy_setup.sh ./vm_to_cluster.rb $*
Use maven-exec-plugin to get the maven project version for CI jobs
#!/usr/bin/env bash # # vim:et:ft=sh:sts=2:sw=2 # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # function get_bk_version() { bk_version=`mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|Download\w+:)' 2> /dev/null` echo ${bk_version} } export BK_DEV_DIR=`dirname "$0"` export BK_HOME=`cd ${BK_DEV_DIR}/..;pwd` export BK_VERSION=`get_bk_version`
#!/usr/bin/env bash # # vim:et:ft=sh:sts=2:sw=2 # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # function get_bk_version() { bk_version=$(mvn -q \ -Dexec.executable="echo" \ -Dexec.args='${project.version}' \ --non-recursive \ org.codehaus.mojo:exec-maven-plugin:1.3.1:exec) echo ${bk_version} } export BK_DEV_DIR=`dirname "$0"` export BK_HOME=`cd ${BK_DEV_DIR}/..;pwd` export BK_VERSION=`get_bk_version`
Update to new depot API by ensuring there's a SHA256 of the package posted.
set -eu BLDR_REPO=${BLDR_REPO:-"http://52.37.151.35:9632"} if [ -n "${DEBUG:-}" ]; then set -x; fi pkg_file="$1" pkg_ident="$(gpg --decrypt $pkg_file 2>/dev/null \ | tar xOf - --wildcards --no-anchored 'IDENT')" set -x ${WGET:-wget} --post-file=$pkg_file -O- $BLDR_REPO/pkgs/$pkg_ident
set -eu BLDR_REPO=${BLDR_REPO:-"http://52.37.151.35:9632"} if [ -n "${DEBUG:-}" ]; then set -x; fi pkg_file="$1" pkg_ident="$(gpg --decrypt $pkg_file 2>/dev/null \ | tar xOf - --wildcards --no-anchored 'IDENT')" pkg_sha="$(openssl dgst -sha256 $pkg_file | awk '{ print $2 }')" set -x ${WGET:-wget} --post-file=$pkg_file -O- $BLDR_REPO/pkgs/$pkg_ident?checksum=$pkg_sha
Add env variable and volume when building on jenkins
#! /bin/bash -e set -x docker build -t 'son-analyze-deploy' -f utils/docker/deploy.Dockerfile . docker build -t 'son-analyze-test' -f utils/docker/test.Dockerfile . docker run -i --rm=true 'son-analyze-test' scripts/all.py
#! /bin/bash -e set -x docker build -t 'son-analyze-deploy' -f utils/docker/deploy.Dockerfile . docker build -t 'son-analyze-test' -f utils/docker/test.Dockerfile . if [ -n "${JENKINS_URL}" ]; then EXTRA_ENV="JENKINS_URL=${JENKINS_URL}" fi docker run -i --rm=true --env="${EXTRA_ENV}" -v "$(pwd)/outputs:/son-analyze/outputs" 'son-analyze-test' scripts/clean.sh && scripts/all.py
Disable check for Yan LR plugin
@INCLUDE_COMMON@ echo echo CHECK SOURCE WITH OCLINT echo command -v oclint > /dev/null 2>&1 || { echo "Could not locate OCLint" >&2 exit 0 } test -f "@PROJECT_BINARY_DIR@/compile_commands.json" || { echo "Compilation database not found" >&2 exit 0 } cd "@CMAKE_SOURCE_DIR@" || exit oclint -p "@PROJECT_BINARY_DIR@" -enable-global-analysis -enable-clang-static-analyzer \ "src/libs/ease/array.c" \ "src/libs/ease/keyname.c" \ "src/libs/utility/text.c" \ "src/plugins/base64/"*.c \ "src/plugins/ccode/"*.cpp \ "src/plugins/cpptemplate/"*.cpp \ "src/plugins/directoryvalue/"*.cpp \ "src/plugins/mini/mini.c" \ "src/plugins/yamlcpp/"*.cpp \ "src/plugins/yamlsmith/"*.cpp \ "src/plugins/yanlr/"*.cpp exit_if_fail "OCLint found problematic code" end_script
@INCLUDE_COMMON@ echo echo CHECK SOURCE WITH OCLINT echo command -v oclint > /dev/null 2>&1 || { echo "Could not locate OCLint" >&2 exit 0 } test -f "@PROJECT_BINARY_DIR@/compile_commands.json" || { echo "Compilation database not found" >&2 exit 0 } cd "@CMAKE_SOURCE_DIR@" || exit oclint -p "@PROJECT_BINARY_DIR@" -enable-global-analysis -enable-clang-static-analyzer \ "src/libs/ease/array.c" \ "src/libs/ease/keyname.c" \ "src/libs/utility/text.c" \ "src/plugins/base64/"*.c \ "src/plugins/ccode/"*.cpp \ "src/plugins/cpptemplate/"*.cpp \ "src/plugins/directoryvalue/"*.cpp \ "src/plugins/mini/mini.c" \ "src/plugins/yamlcpp/"*.cpp \ "src/plugins/yamlsmith/"*.cpp exit_if_fail "OCLint found problematic code" end_script
Remove syncthing-gtk launch from EXWM startup script
#!/bin/sh # Set XDG_DATA_DIRS because something in Manjaro broke it :/ export XDG_DATA_DIRS="/usr/share:$XDG_DATA_DIRS" # Start authentication daemons /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg) & # Make things look nice compton --config ~/.dotfiles/emacs/compton.conf & nitrogen --restore & # Start Xfce's settings and power managers xfsettingsd & xfce4-power-manager & # Start up Syncthing for file synchronization syncthing-gtk --minimized & # Load system tray apps for sound, bluetooth, and networking blueman-applet & pasystray & nm-applet & # Enable Manjaro update checks pamac-tray & # Enable screen locking on suspend xss-lock -- slock & # We're in Emacs, yo export VISUAL=emacsclient export EDITOR="$VISUAL" # Fire it up emacs --use-exwm
#!/bin/sh # Set XDG_DATA_DIRS because something in Manjaro broke it :/ export XDG_DATA_DIRS="/usr/share:$XDG_DATA_DIRS" # Start authentication daemons /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg) & # Make things look nice compton --config ~/.dotfiles/emacs/compton.conf & nitrogen --restore & # Start Xfce's settings and power managers xfsettingsd & xfce4-power-manager & # Load system tray apps for sound, bluetooth, and networking blueman-applet & pasystray & nm-applet & # Enable Manjaro update checks pamac-tray & # Enable screen locking on suspend xss-lock -- slock & # We're in Emacs, yo export VISUAL=emacsclient export EDITOR="$VISUAL" # Fire it up emacs --use-exwm
Fix test flake by switching to fetch_until
start_test quality of webp output images rm -rf $OUTDIR mkdir $OUTDIR IMG_REWRITE="$TEST_ROOT/webp_rewriting/rewrite_images.html" REWRITE_URL="$IMG_REWRITE?PageSpeedFilters=rewrite_images" URL="$REWRITE_URL,convert_jpeg_to_webp&$IMAGES_QUALITY=75&$WEBP_QUALITY=65" check run_wget_with_args \ --header 'X-PSA-Blocking-Rewrite: psatest' --user-agent=webp $URL check_file_size "$WGET_DIR/*256x192*Puzzle*webp" -le 5140 # resized, webp'd rm -rf $WGET_DIR check run_wget_with_args \ --header 'X-PSA-Blocking-Rewrite: psatest' --header='Accept: image/webp' $URL check_file_size "$WGET_DIR/*256x192*Puzzle*webp" -le 5140 # resized, webp'd
start_test quality of webp output images rm -rf $OUTDIR mkdir $OUTDIR IMG_REWRITE="$TEST_ROOT/webp_rewriting/rewrite_images.html" REWRITE_URL="$IMG_REWRITE?PageSpeedFilters=rewrite_images" URL="$REWRITE_URL,convert_jpeg_to_webp&$IMAGES_QUALITY=75&$WEBP_QUALITY=65" fetch_until -save -recursive $URL \ 'fgrep -c 256x192xPuzzle.jpg.pagespeed.ic' 1 \ --user-agent=webp check_file_size "$WGET_DIR/*256x192*Puzzle*webp" -le 5140 # resized, webp'd rm -rf $WGET_DIR fetch_until -save -recursive $URL \ 'fgrep -c 256x192xPuzzle.jpg.pagespeed.ic' 1 \ --header='Accept:image/webp' check_file_size "$WGET_DIR/*256x192*Puzzle*webp" -le 5140 # resized, webp'd
Use the superiour indentation method
#! /usr/bin/env sh main() { if [ -z "$1" ] then usage exit 1 fi printf "md5 %s\n" "$(md5sum "$1" | cut -f1 -d" ")" printf "sha1 %s\n" "$(sha1sum "$1" | cut -f1 -d" ")" printf "sha224 %s\n" "$(sha224sum "$1" | cut -f1 -d" ")" printf "sha256 %s\n" "$(sha256sum "$1" | cut -f1 -d" ")" printf "sha384 %s\n" "$(sha384sum "$1" | cut -f1 -d" ")" printf "sha512 %s\n" "$(sha512sum "$1" | cut -f1 -d" ")" } usage() { printf "NYI\n" } main "$@"
#! /usr/bin/env sh main() { if [ -z "$1" ] then usage exit 1 fi printf "md5 %s\n" "$(md5sum "$1" | cut -f1 -d" ")" printf "sha1 %s\n" "$(sha1sum "$1" | cut -f1 -d" ")" printf "sha224 %s\n" "$(sha224sum "$1" | cut -f1 -d" ")" printf "sha256 %s\n" "$(sha256sum "$1" | cut -f1 -d" ")" printf "sha384 %s\n" "$(sha384sum "$1" | cut -f1 -d" ")" printf "sha512 %s\n" "$(sha512sum "$1" | cut -f1 -d" ")" } usage() { printf "NYI\n" } main "$@"
Use PGDATA to find pg_hba.conf
#!/bin/bash # reenable password authentication sed -i "s/host all all all trust/host all all all md5/" /var/lib/postgresql/data/pg_hba.conf
#!/bin/bash # reenable password authentication sed -i "s/host all all all trust/host all all all md5/" "${PGDATA}/pg_hba.conf"
Extend test to cover containers restarting automatically
#! /bin/bash . ./config.sh C1=10.2.0.78 C2=10.2.0.34 NAME=seetwo.weave.local start_suite "Proxy restart reattaches networking to containers" weave_on $HOST1 launch proxy_start_container $HOST1 -e WEAVE_CIDR=$C2/24 -dt --name=c2 -h $NAME proxy_start_container_with_dns $HOST1 -e WEAVE_CIDR=$C1/24 -dt --name=c1 proxy docker_on $HOST1 restart c2 assert_raises "proxy exec_on $HOST1 c2 $CHECK_ETHWE_UP" assert_dns_record $HOST1 c1 $NAME $C2 end_suite
#! /bin/bash . ./config.sh C1=10.2.0.78 C2=10.2.0.34 NAME=seetwo.weave.local check_attached() { assert_raises "proxy exec_on $HOST1 c2 $CHECK_ETHWE_UP" assert_dns_record $HOST1 c1 $NAME $C2 } start_suite "Proxy restart reattaches networking to containers" weave_on $HOST1 launch proxy_start_container $HOST1 -e WEAVE_CIDR=$C2/24 -di --name=c2 --restart=always -h $NAME proxy_start_container_with_dns $HOST1 -e WEAVE_CIDR=$C1/24 -di --name=c1 --restart=always proxy docker_on $HOST1 restart -t=1 c2 check_attached # Kill outside of Docker so Docker will restart it run_on $HOST1 sudo kill -KILL $(docker_on $HOST1 inspect --format='{{.State.Pid}}' c2) sleep 1 check_attached # Restart docker itself, using different commands for systemd- and upstart-managed. run_on $HOST1 sh -c "command -v systemctl >/dev/null && sudo systemctl restart docker || sudo service docker restart" sleep 1 weave_on $HOST1 launch check_attached end_suite
Move 'package' to setup() and add start server.
#!/usr/bin/env bats @test "requests from same client are routed to a single server" { pushd ./scala-e2e sbt package popd run bash -c "java -jar ./scala-e2e/target/scala-2.10/smartRouterTest.jar" # TODO pass hostnanme:port for nginx echo "output: "$output echo "status: "$status [ "$status" -eq 0 ] [ "$output" -ne 0 ] }
#!/usr/bin/env bats setup() { pushd ./scala-e2e sbt package popd pushd ../datt-sampleapp sbt "run 8080" popd } @test "requests from same client are routed to a single server" { run bash -c "java -jar ./scala-e2e/target/scala-2.10/smartRouterTest.jar localhost:8080" echo "output: "$output echo "status: "$status [ "$status" -eq 0 ] [ "$output" -ne 0 ] }
Handle Turbine test failure in script without aborting
#!/usr/bin/env bash set -e THISDIR=`dirname $0` BUILDVARS=${THISDIR}/build-vars.sh if [ ! -f ${BUILDVARS} ] ; then echo "Need ${BUILDVARS} to exist" exit 1 fi source ${BUILDVARS} cd ${TURBINE} echo echo "Testing Turbine" echo "================" make test_results cd ${STC} echo echo "Testing STC" echo "================" # Test at multiple optimization levels ../tests/run-tests.zsh -c -O0 -O1 -O2
#!/usr/bin/env bash set -e THISDIR=`dirname $0` BUILDVARS=${THISDIR}/build-vars.sh if [ ! -f ${BUILDVARS} ] ; then echo "Need ${BUILDVARS} to exist" exit 1 fi source ${BUILDVARS} cd ${TURBINE} echo echo "Testing Turbine" echo "================" if make test_results then echo "All Turbine tests passed" else echo "Turbine tests failed" fi cd ${STC} echo echo "Testing STC" echo "================" # Test at multiple optimization levels ../tests/run-tests.zsh -c -O0 -O1 -O2
Fix shwordsplit bug when a basedir contains spaces
alias pjo="pj open" pj () { emulate -L zsh setopt shwordsplit cmd="cd" project=$1 if [[ "open" == "$project" ]]; then shift project=$* cmd=$EDITOR else project=$* fi if [[ -z "$project" ]]; then echo "You have to specify a project name." return fi for basedir ($PROJECT_PATHS); do if [[ -d "$basedir/$project" ]]; then $cmd "$basedir/$project" return fi done echo "No such project '${project}'." } _pj () { emulate -L zsh typeset -a projects for basedir ($PROJECT_PATHS); do projects+=(${basedir}/*(/N)) done compadd ${projects:t} } compdef _pj pj
alias pjo="pj open" pj () { emulate -L zsh cmd="cd" project=$1 if [[ "open" == "$project" ]]; then shift project=$* cmd=${=EDITOR} else project=$* fi if [[ -z "$project" ]]; then echo "You have to specify a project name." return fi for basedir ($PROJECT_PATHS); do if [[ -d "$basedir/$project" ]]; then $cmd "$basedir/$project" return fi done echo "No such project '${project}'." } _pj () { emulate -L zsh typeset -a projects for basedir ($PROJECT_PATHS); do projects+=(${basedir}/*(/N)) done compadd ${projects:t} } compdef _pj pj
Upgrade Java 13 version in CI image
#!/bin/bash set -e case "$1" in java8) echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u222b10.tar.gz" ;; java11) echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz" ;; java12) echo "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_linux_hotspot_12.0.2_10.tar.gz" ;; java13) echo "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk13u-2019-09-03-11-49/OpenJDK13U-jdk_x64_linux_hotspot_2019-09-03-11-49.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/jdk8u222-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u222b10.tar.gz" ;; java11) echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.4%2B11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.4_11.tar.gz" ;; java12) echo "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_linux_hotspot_12.0.2_10.tar.gz" ;; java13) echo "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk13u-2019-09-11-12-35/OpenJDK13U-jdk_x64_linux_hotspot_2019-09-11-12-35.tar.gz" ;; *) echo $"Unknown java version" exit 1 esac
Append output to log file.
#!/bin/bash for DB_NAME in $(/tmp/usfs_local_sids | sed \'s/[0-9]$//\'); do export DB_NAME; echo srvctl stop database -d $DB_NAME -o immediate; srvctl stop database -d $DB_NAME -o immediate; echo srvctl start database -d $DB_NAME; srvctl start database -d $DB_NAME; done
#!/bin/bash set -x for DB_NAME in $(/tmp/usfs_local_sids | sed 's/[0-9]$//'); do export DB_NAME echo srvctl stop database -d $DB_NAME -o immediate srvctl stop database -d $DB_NAME -o immediate echo srvctl start database -d $DB_NAME srvctl start database -d $DB_NAME done 2>&1 | tee -a /home/oracle/system/audit/.audit/install_ora_audit.sh