Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Remove k command and use dnx instead
#!/bin/bash if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild else if [ -z $XDG_DATA_HOME ]; then cachedir=$HOME/.local/share else cachedir=$XDG_DATA_HOME; fi fi mkdir -p $cachedir url=https://www.nuget.org/nuget.exe if test ! -f $cachedir/nuget.exe; then wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null fi if test ! -e .nuget; then mkdir .nuget cp $cachedir/nuget.exe .nuget/nuget.exe fi if test ! -d packages/KoreBuild; then mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion fi if ! type dnvm > /dev/null 2>&1; then source packages/KoreBuild/build/dnvm.sh fi if ! type k > /dev/null 2>&1; then dnvm upgrade fi mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
#!/bin/bash if test `uname` = Darwin; then cachedir=~/Library/Caches/KBuild else if [ -z $XDG_DATA_HOME ]; then cachedir=$HOME/.local/share else cachedir=$XDG_DATA_HOME; fi fi mkdir -p $cachedir url=https://www.nuget.org/nuget.exe if test ! -f $cachedir/nuget.exe; then wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null fi if test ! -e .nuget; then mkdir .nuget cp $cachedir/nuget.exe .nuget/nuget.exe fi if test ! -d packages/KoreBuild; then mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion fi if ! type dnvm > /dev/null 2>&1; then source packages/KoreBuild/build/dnvm.sh fi if ! type dnx > /dev/null 2>&1; then dnvm upgrade fi mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
Create major version dir if it does not exists
#!/bin/bash set -e set -u set -o pipefail [ $# -ne 1 ] && echo "usage: ./build.sh <version>" && exit 1 VERSION="$1" MAJOR=${VERSION%%??} # clearly. sed 's/%%VERSION%%/'"$VERSION"'/g' Dockerfile.template > "$MAJOR"/Dockerfile pushd "$MAJOR" docker build --no-cache=true -t stefanofontanelli/elasticsearch . docker tag -f stefanofontanelli/elasticsearch:latest stefanofontanelli/elasticsearch:"$VERSION" docker push stefanofontanelli/elasticsearch:latest docker push stefanofontanelli/elasticsearch:"$VERSION"
#!/bin/bash set -e set -u set -o pipefail [ $# -ne 1 ] && echo "usage: ./build.sh <version>" && exit 1 VERSION="$1" MAJOR=${VERSION%%??} # clearly. mkdir -p "$MAJOR" sed 's/%%VERSION%%/'"$VERSION"'/g' Dockerfile.template > "$MAJOR"/Dockerfile pushd "$MAJOR" docker build --no-cache=true -t stefanofontanelli/elasticsearch . docker tag -f stefanofontanelli/elasticsearch:latest stefanofontanelli/elasticsearch:"$VERSION" docker push stefanofontanelli/elasticsearch:latest docker push stefanofontanelli/elasticsearch:"$VERSION"
Allow to pass version in golang script
#!/bin/bash set -e GOLANG_VERSION="latest" while [ $# -gt 0 ]; do case "$1" in -b|--build) BUILD="1" ;; *) path="$1" esac shift done if [ -z "$path" ]; then echo "using pwd $(pwd)" path=$(pwd) fi path=$(realpath "$path") name=$(basename "$path") project=$(echo "$path" | sed -e "s;^$GOPATH/;;") echo "running $name > $project > $path on container golang:$GOLANG_VERSION" if [ ! -z $BUILD ]; then echo "building..." docker run \ --rm \ --name "$name" \ -v "$path":"/go/$project" \ -w "/go/$project" \ -it "golang:$GOLANG_VERSION" \ go build else docker run \ --rm \ --name "$name" \ -v "$path":"/go/$project" \ -w "/go/$project" \ -it "golang:$GOLANG_VERSION" fi
#!/bin/bash set -e GOLANG_VERSION="latest" while [ $# -gt 0 ]; do case "$1" in -b|--build) BUILD="1" ;; -v|--version) shift GOLANG_VERSION="$1" ;; *) path="$1" esac shift done if [ -z "$path" ]; then echo "using pwd $(pwd)" path=$(pwd) fi path=$(realpath "$path") name=$(basename "$path") project=$(echo "$path" | sed -e "s;^$GOPATH/;;") echo "running $name > $project > $path on container golang:$GOLANG_VERSION" if [ ! -z $BUILD ]; then echo "building..." docker run \ --rm \ --name "$name" \ -v "$path":"/go/$project" \ -w "/go/$project" \ -it "golang:$GOLANG_VERSION" \ go build else docker run \ --rm \ --name "$name" \ -v "$path":"/go/$project" \ -w "/go/$project" \ -it "golang:$GOLANG_VERSION" fi
Update package script for tilix
export TERMINIX_ARCHIVE_PATH="/tmp/terminix/archive"; rm -rf ${TERMINIX_ARCHIVE_PATH} CURRENT_DIR=$(pwd) echo "Building application..." cd ../../.. dub build --build=release --compiler=ldc2 strip tilix ./install.sh ${TERMINIX_ARCHIVE_PATH}/usr # Remove compiled schema rm ${TERMINIX_ARCHIVE_PATH}/usr/share/glib-2.0/schemas/gschemas.compiled echo "Creating archive" cd ${TERMINIX_ARCHIVE_PATH} zip -r terminix.zip * cp terminix.zip ${CURRENT_DIR}/terminix.zip cd ${CURRENT_DIR}
export TILIX_ARCHIVE_PATH="/tmp/tilix/archive"; rm -rf ${TILIX_ARCHIVE_PATH} CURRENT_DIR=$(pwd) echo "Building application..." cd ../../.. dub build --build=release --compiler=ldc2 strip tilix ./install.sh ${TILIX_ARCHIVE_PATH}/usr # Remove compiled schema rm ${TILIX_ARCHIVE_PATH}/usr/share/glib-2.0/schemas/gschemas.compiled echo "Creating archive" cd ${TILIX_ARCHIVE_PATH} zip -r tilix.zip * cp tilix.zip ${CURRENT_DIR}/tilix.zip cd ${CURRENT_DIR}
Change file order to process
#!/bin/sh list=" core/Loader.php core/Input.php core/Common.php core/CodeIgniter.php libraries/Upload.php "
#!/bin/sh list=" core/CodeIgniter.php core/Common.php core/Input.php core/Loader.php libraries/Upload.php "
Fix order of source files.
#!/bin/bash # # combine and minify using the closure compiler # cd mapbrowser closure-compiler --js jscoord.js --js config.js --js mapref.js --js mapbrowser.js --js widget.js --js uiSupport.js --js popup.js --js popupmenu.js --js measure.js --js toolbar.js --js areaList.js --js mousepos.js --js layerSwitcher.js --js refSearch.js --js configSupport.js > ../mapbrowser-min.js cd .. cd layeredit closure-compiler --js layerList.js --js layerEdit.js --js wmsLayer.js --js wfsLayer.js > ../layeredit-min.js cd .. cd tracking closure-compiler --js mapupdate.js --js tracking.js --js search.js --js filters.js > ../tracking-min.js
#!/bin/bash # # combine and minify using the closure compiler # cd mapbrowser closure-compiler --js jscoord.js --js config.js --js mapref.js --js mapbrowser.js --js widget.js --js uiSupport.js --js popup.js --js popupmenu.js --js measure.js --js toolbar.js --js areaList.js --js mousepos.js --js layerSwitcher.js --js refSearch.js --js configSupport.js > ../mapbrowser-min.js cd .. cd layeredit closure-compiler --js layerEdit.js --js layerList.js --js wmsLayer.js --js wfsLayer.js > ../layeredit-min.js cd .. cd tracking closure-compiler --js tracking.js --js mapupdate.js --js search.js --js filters.js > ../tracking-min.js
Add in the extra file added
#!/bin/sh cd .. rm -rf AUTHORS Axon COPYING dist/ Docs/ Examples/ Kamaelia MANIFEST Tools/ Axon.CHANGELOG Kamaelia.CHANGELOG setup.py Axon.README Kamaelia.README
#!/bin/sh cd .. rm -rf AUTHORS Axon COPYING dist/ Docs/ Examples/ Kamaelia MANIFEST Tools/ Axon.CHANGELOG Kamaelia.CHANGELOG setup.py Axon.README Kamaelia.README MANIFEST.in
Speed up installing node dependenciess when building docker container
#!/bin/bash # This is the script that is run inside a new container to set it up at first set -exuo pipefail IFS=$'\n\t' DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" cd "$DIR/.." # Set up python curl https://bootstrap.pypa.io/get-pip.py | python3.9 pip3 install -r requirements.txt # Set up node npm install # Set up supervisor cp config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Set up logrotate cp config/logrotate /etc/logrotate.d/uwsgi
#!/bin/bash # This is the script that is run inside a new container to set it up at first set -exuo pipefail IFS=$'\n\t' DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" cd "$DIR/.." # Set up python curl https://bootstrap.pypa.io/get-pip.py | python3.9 pip3 install -r requirements.txt # Set up node npm ci # Set up supervisor cp config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf # Set up logrotate cp config/logrotate /etc/logrotate.d/uwsgi
Fix `flag provided but not defined: -check_version_skew` error
#!/bin/bash set -eu if [ ! -d /kube ]; then echo /kube does not exist. run this docker container like '`docker run -v path-to-kube-assets:/kube image-name`' 1>&2 exit 1 fi DIR=/kube-temp mkdir ${DIR} cp -R /kube/* ${DIR}/ export KUBECONFIG=${DIR}/kubeconfig sed -i -e "s#credentials/#${DIR}/credentials/#g" ${KUBECONFIG} set -vx if [ "$FOCUS" != "" ]; then FOCUS=$(echo $FOCUS | sed -e 's/\[/\\[/' -e 's/\]/\\]/') fi FOCUS=${FOCUS:-\[Conformance\]} go run hack/e2e.go -v --test -check_version_skew=false --test_args="--ginkgo.focus=$FOCUS"
#!/bin/bash set -eu if [ ! -d /kube ]; then echo /kube does not exist. run this docker container like '`docker run -v path-to-kube-assets:/kube image-name`' 1>&2 exit 1 fi DIR=/kube-temp mkdir ${DIR} cp -R /kube/* ${DIR}/ export KUBECONFIG=${DIR}/kubeconfig sed -i -e "s#credentials/#${DIR}/credentials/#g" ${KUBECONFIG} set -vx if [ "$FOCUS" != "" ]; then FOCUS=$(echo $FOCUS | sed -e 's/\[/\\[/' -e 's/\]/\\]/') fi FOCUS=${FOCUS:-\[Conformance\]} go run hack/e2e.go -v --test --check-version-skew=false --test_args="--ginkgo.focus=$FOCUS"
Work around problems with libpng's installation on Windows
./configure --build=$BUILD_TRIPLET \ --host=$HOST_TRIPLET \ --prefix=$PREFIX \ --enable-static \ --enable-shared \ || exit 1 make && make install
./configure --build=$BUILD_TRIPLET \ --host=$HOST_TRIPLET \ --prefix=$PREFIX \ --enable-static \ --enable-shared \ || exit 1 make && make install # Work around libpng/libtool/MinGW-w64/Code::Blocks problem on Windows cp $BUILD_DIR/include/libpng15/* $BUILD_DIR/include/ || exit 1 rm -f $BUILD_DIR/lib/libpng.* || exit 1 cp $BUILD_DIR/lib/libpng15.a $BUILD_DIR/lib/libpng.a || exit 1 cp $BUILD_DIR/lib/libpng15.dll.a $BUILD_DIR/lib/libpng.dll.a || exit 1
Fix Issues Idenfied by "shellcheck"
#!/usr/bin/env bash cd "$(dirname "${BASH_SOURCE}")" export XDG_DATA_HOME="${HOME}/.local/share" export XDG_CONFIG_HOME="${HOME}/.config" export XDG_CACHE_HOME="${HOME}/.cache" # git pull origin ccpcs000536 function doIt() { # rsync contents of HOME to $HOME rsync -av ./HOME/ ~/ # ensure VIM temp directories exist mkdir -p ${XDG_DATA_HOME}/vim/{backups,swaps,undo} # ensure IPython/Jupyter temp directories exist mkdir -p ${XDG_DATA_HOME}/{ipython,jupyter} # install xterm-256color-italic TERM entry tic ./external_configs/xterm-256color-italic.terminfo } if [ "$1" == "--force" -o "$1" == "-f" ]; then doIt else read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 echo if [[ $REPLY =~ ^[Yy]$ ]]; then doIt fi fi unset doIt
#!/usr/bin/env bash cd "$(dirname "${BASH_SOURCE[0]}")" || (echo "Unable to switch to script directory" && exit 1) export XDG_DATA_HOME="${HOME}/.local/share" export XDG_CONFIG_HOME="${HOME}/.config" export XDG_CACHE_HOME="${HOME}/.cache" # git pull origin ccpcs000536 function doIt() { # rsync contents of HOME to $HOME rsync -av ./HOME/ ~/ # ensure VIM temp directories exist mkdir -p "${XDG_DATA_HOME}"/vim/{backups,swaps,undo} # ensure IPython/Jupyter temp directories exist mkdir -p "${XDG_DATA_HOME}"/{ipython,jupyter} # install xterm-256color-italic TERM entry tic ./external_configs/xterm-256color-italic.terminfo } if [ "$1" == "--force" ] || [ "$1" == "-f" ]; then doIt else read -rp "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 echo if [[ $REPLY =~ ^[Yy]$ ]]; then doIt fi fi unset doIt
Customize BOSH agent settings for GCE stemcell
#!/usr/bin/env bash base_dir=$(readlink -nf $(dirname $0)/../..) source $base_dir/lib/prelude_apply.bash cat > $chroot/var/vcap/bosh/agent.json <<JSON { "Platform": { "Linux": { "CreatePartitionIfNoEphemeralDisk": true, "DevicePathResolutionType": "virtio", "VirtioDevicePrefix": "google" } }, "Infrastructure": { "Settings": { "Sources": [ { "Type": "HTTP", "URI": "http://169.254.169.254", "UserDataPath": "/computeMetadata/v1/instance/attributes/user_data", "Headers": { "Metadata-Flavor": "Google" } } ], "UseServerName": true, "UseRegistry": true } } } JSON
#!/usr/bin/env bash base_dir=$(readlink -nf $(dirname $0)/../..) source $base_dir/lib/prelude_apply.bash cat > $chroot/var/vcap/bosh/agent.json <<JSON { "Platform": { "Linux": { "CreatePartitionIfNoEphemeralDisk": true, "DevicePathResolutionType": "virtio", "VirtioDevicePrefix": "google" } }, "Infrastructure": { "Settings": { "Sources": [ { "Type": "InstanceMetadata", "URI": "http://169.254.169.254", "SettingsPath": "/computeMetadata/v1/instance/attributes/bosh_settings", "Headers": { "Metadata-Flavor": "Google" } } ], "UseServerName": true, "UseRegistry": false } } } JSON
Fix error when running in bash
zstyle -s ':prezto:module:git:log:cherry' format '_git_log_cherry_format' \ || _git_log_cherry_format="%m %C(green)%h%C(reset) %s%C(red)%d%C(reset)" # Log (l) alias glp='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"' alias glf='git log --topo-order --name-status --pretty=format:${_git_log_medium_format}' alias gld='git log --left-right --cherry-mark --no-merges --topo-order --pretty=format:${_git_log_cherry_format}' # Tag (t) alias gt='git tag --sort v:refname' alias gtl='git tag --sort -v:refname | head -1' # Submodule (S) alias gSu='git submodule update --recursive' # Branch (b) alias gba='git branch -a' alias gbr='git branch -r' # Index (i) alias giA='git add --all' alias gip='git add --patch' # Worktree (W) alias gWa='git worktree add' alias gWp='git worktree prune'
dcheck zstyle && zstyle -s ':prezto:module:git:log:cherry' format '_git_log_cherry_format' \ || _git_log_cherry_format="%m %C(green)%h%C(reset) %s%C(red)%d%C(reset)" # Log (l) alias glp='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"' alias glf='git log --topo-order --name-status --pretty=format:${_git_log_medium_format}' alias gld='git log --left-right --cherry-mark --no-merges --topo-order --pretty=format:${_git_log_cherry_format}' # Tag (t) alias gt='git tag --sort v:refname' alias gtl='git tag --sort -v:refname | head -1' # Submodule (S) alias gSu='git submodule update --recursive' # Branch (b) alias gba='git branch -a' alias gbr='git branch -r' # Index (i) alias giA='git add --all' alias gip='git add --patch' # Worktree (W) alias gWa='git worktree add' alias gWp='git worktree prune'
Add automatic setting of advertised hostname
#!/bin/bash ZK_CONNECT=$1 BROKER_ID=$2 # ADVERTISED_HOSTNAME=$3 if [ -n "$ZK_CONNECT" ] then echo 'delete.topic.enable = true' >> $KAFKA_HOME/config/server.properties sed -i 's/^zookeeper.connect=.*/zookeeper.connect='$ZK_CONNECT'/' $KAFKA_HOME/config/server.properties sed -i 's/^broker.id=.*/broker.id='$BROKER_ID'/' $KAFKA_HOME/config/server.properties # sed -i 's/^#advertised.host.name=.*/advertised.host.name='$ADVERTISED_HOSTNAME'/' $KAFKA_HOME/config/server.properties trap "$KAFKA_HOME/bin/kafka-server-stop.sh; echo 'Kafka stopped.'; exit" SIGHUP SIGINT SIGTERM $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties > $KAFKA_HOME/kafka.log fi
#!/bin/bash ZK_CONNECT=$1 BROKER_ID=$2 IPADDRESS=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print \$2}' | cut -d / -f 1` if [ -n "$ZK_CONNECT" ] then echo 'delete.topic.enable = true' >> $KAFKA_HOME/config/server.properties sed -i 's/^zookeeper.connect=.*/zookeeper.connect='$ZK_CONNECT'/' $KAFKA_HOME/config/server.properties sed -i 's/^broker.id=.*/broker.id='$BROKER_ID'/' $KAFKA_HOME/config/server.properties sed -i 's/^#advertised.host.name=.*/advertised.host.name='$IPADDRESS'/' $KAFKA_HOME/config/server.properties trap "$KAFKA_HOME/bin/kafka-server-stop.sh; echo 'Kafka stopped.'; exit" SIGHUP SIGINT SIGTERM $KAFKA_HOME/bin/kafka-server-start.sh $KAFKA_HOME/config/server.properties > $KAFKA_HOME/kafka.log fi
Use db:migrate instead of schema
#!/bin/bash set -ex git pull rake db:schema:load rake db:data:load_dir dir="datadump"
#!/bin/bash set -ex git pull rake db:migrate rake db:data:load_dir dir="datadump"
Add function to clear all environment variables set by the script
#!/bin/bash # Foreground (text) colors black="\[$(tput setaf 0)\]" red="\[$(tput setaf 1)\]" green="\[$(tput setaf 2)\]" yellow="\[$(tput setaf 3)\]" blue="\[$(tput setaf 4)\]" magenta="\[$(tput setaf 5)\]" cyan="\[$(tput setaf 6)\]" white="\[$(tput setaf 7)\]" # Background colors bgblack="\[$(tput setab 0)\]" bgred="\[$(tput setab 1)\]" bggreen="\[$(tput setab 2)\]" bgyellow="\[$(tput setab 3)\]" bgblue="\[$(tput setab 4)\]" bgmagenta="\[$(tput setab 5)\]" bgcyan="\[$(tput setab 6)\]" bgwhite="\[$(tput setab 7)\]" # Special stuff bold="\[$(tput bold)\]" hbright="\[$(tput dim)\]" beg_underline="\[$(tput smul)\]" end_underline="\[$(tput rmul)\]" reset="\[$(tput sgr0)\]"
#!/bin/bash function promptreset { unset -v\ black\ red\ green\ yellow\ blue\ magenta\ cyan\ white\ \ bgblack\ bgred\ bggreen\ bgyellow\ bgblue\ bgmagenta\ bgcyan\ bgwhite\ \ bold\ hbright\ beg_underline\ end_underline\ \ reset } # Foreground (text) colors black="\[$(tput setaf 0)\]" red="\[$(tput setaf 1)\]" green="\[$(tput setaf 2)\]" yellow="\[$(tput setaf 3)\]" blue="\[$(tput setaf 4)\]" magenta="\[$(tput setaf 5)\]" cyan="\[$(tput setaf 6)\]" white="\[$(tput setaf 7)\]" # Background colors bgblack="\[$(tput setab 0)\]" bgred="\[$(tput setab 1)\]" bggreen="\[$(tput setab 2)\]" bgyellow="\[$(tput setab 3)\]" bgblue="\[$(tput setab 4)\]" bgmagenta="\[$(tput setab 5)\]" bgcyan="\[$(tput setab 6)\]" bgwhite="\[$(tput setab 7)\]" # Special stuff bold="\[$(tput bold)\]" hbright="\[$(tput dim)\]" beg_underline="\[$(tput smul)\]" end_underline="\[$(tput rmul)\]" reset="\[$(tput sgr0)\]"
Fix type-o, and unpack default on connection down
#!/bin/sh if [ -z "$1" ]; then echo No Interface 1>&2 exit 1 fi PKGHOME=/tmp PKGFILE=$PHGHOME/lxde-cfg.tgz CFGURL="http://www.buttonos.org/load/themes/lxde-cfg.tgz" INSTFILE=/usr/share/lxde/defcfg.tgz case "$2" in up) (cd $PKGHOME ; curl -m 10 -s $CFGURL -O $PKGFILE.tmp && cd / ; tar -xzf $PKGFILE.tmp ) & ;; down) ;; vpn-up|vpn-down) ;; hostname|dhcp4-change|dhcp6-change) ;; esac
#!/bin/sh if [ -z "$1" ]; then echo No Interface 1>&2 exit 1 fi PKGHOME=/tmp PKGFILE=$PKGHOME/lxde-cfg.tgz CFGURL="http://www.buttonos.org/load/themes/lxde-cfg.tgz" INSTFILE=/usr/share/lxde/defcfg.tgz case "$2" in up) (cd $PKGHOME ; curl -m 10 -s $CFGURL -O $PKGFILE.tmp && cd / ; tar -xzf $PKGFILE.tmp ) & ;; down) ( cd / ; tar -xzf $INSTFILE ) & ;; vpn-up|vpn-down) ;; hostname|dhcp4-change|dhcp6-change) ;; esac
Check Bashisms: Use `egrep` regex for GNU find
@INCLUDE_COMMON@ echo echo ELEKTRA SCRIPTS BASHISMS TEST echo command -v checkbashisms >/dev/null 2>&1 || { echo "checkbashisms command needed for this test, aborting" >&2; exit 0; } cd "@CMAKE_SOURCE_DIR@" find -version > /dev/null 2>&1 > /dev/null && FIND=find || FIND='find -E' # this way we also check subdirectories # The script `check-env-dep` uses process substitution which is **not** a standard `sh` feature! # See also: https://unix.stackexchange.com/questions/151925 scripts=$($FIND scripts/ -type f -not -regex \ '.+(check-env-dep|gitignore|kdb_zsh_completion|run_dev_env|sed|(Docker|Jenkins|Vagrant)file.*|\.(cmake|fish|in|md|txt))$' | \ xargs) checkbashisms $scripts ret=$? # 2 means skipped file, e.g. README.md, that is fine # only 1, 3 and 4 are actually bad test $ret -eq 0 || test $ret -eq 2 exit_if_fail "Possible bashisms detected, please check." end_script
@INCLUDE_COMMON@ echo echo ELEKTRA SCRIPTS BASHISMS TEST echo command -v checkbashisms >/dev/null 2>&1 || { echo "checkbashisms command needed for this test, aborting" >&2; exit 0; } cd "@CMAKE_SOURCE_DIR@" # Use (non-emacs) extended regex for GNU find or BSD find find -version > /dev/null 2>&1 > /dev/null && FIND='find scripts -regextype egrep' || FIND='find -E scripts' # this way we also check subdirectories # The script `check-env-dep` uses process substitution which is **not** a standard `sh` feature! # See also: https://unix.stackexchange.com/questions/151925 scripts=$($FIND -type f -not -regex \ '.+(check-env-dep|gitignore|kdb_zsh_completion|run_dev_env|sed|(Docker|Jenkins|Vagrant)file.*|\.(cmake|fish|in|md|txt))$' | \ xargs) checkbashisms $scripts ret=$? # 2 means skipped file, e.g. README.md, that is fine # only 1, 3 and 4 are actually bad test $ret -eq 0 || test $ret -eq 2 exit_if_fail "Possible bashisms detected, please check." end_script
Remove 'exit' hack (CLOUDIFY-915 is resolved)
#!/bin/sh cd /home/ubuntu/cucumber jruby -S cucumber exit 0 #hack - to see the error text, we must exit successfully(CLOUDIFY-915)
#!/bin/sh cd /home/ubuntu/cucumber jruby -S cucumber
Use env for calling bash
#! /usr/local/bin/bash # Bootstrap script for the sibyl # BUILD_DIR=build touch ./NEWS touch ./README touch ./AUTHORS touch ./ChangeLog aclocal autoheader autoconf automake --add-missing if ! test -d $BUILD_DIR; then mkdir $BUILD_DIR fi cd build ../configure make
#! /usr/bin/env bash # Bootstrap script for the sibyl # BUILD_DIR=build touch ./NEWS touch ./README touch ./AUTHORS touch ./ChangeLog aclocal autoheader autoconf automake --add-missing if ! test -d $BUILD_DIR; then mkdir $BUILD_DIR fi cd build ../configure make
Exit run production command on any failure
#!/bin/sh # Need to build in docker run step to take env vars into account for e.g. Google Analytics npm run build npm run serve --port 8080 --host 0.0.0.0
#!/bin/sh # Exit on any failure set -e # Need to build in docker run step to take env vars into account for e.g. Google Analytics npm run build npm run serve --port 8080 --host 0.0.0.0
Fix deb build failed on AWS
#!/bin/bash chmod 600 /root/.ssh/config today=$(date +%Y%m%d) rm -rf /emqx_temp && mkdir /emqx_temp cp -rf /emqx_code/* /emqx_temp/ cd /emqx_temp pkg=emqx-${ostype}-${versionid}-${type}-${today}.zip echo "building $pkg..." cd emqx-rel && make && cd _rel && zip -rq $pkg emqx \ && scp -o StrictHostKeyChecking=no $pkg ${host}:${buildlocation} \ && cd /emqx_temp cd emqx-packages sed -i "/EMQ_VERSION/c\EMQ_VERSION=${versionid}" ./Makefile sed -i "/Version: /c\Version: ${versionid}" ./rpm/emqx.spec sed -i "1c\emqx (${versionid}) unstable; urgency=medium" ./deb/debian/changelog make name=`basename package/*` name2=${name/emqx-${versionid}/emqx-${ostype}-${versionid}-${type}-${today}} name3=${name2/emqx_${versionid}/emqx-${ostype}-${versionid}-${type}-${today}} mv package/${name} package/${name3} scp -o StrictHostKeyChecking=no package/* ${host}:${buildlocation}
#!/bin/bash chmod 600 /root/.ssh/config today=$(date +%Y%m%d) rm -rf /emqx_temp && mkdir /emqx_temp cp -rf /emqx_code/* /emqx_temp/ cd /emqx_temp/emqx-rel versionid=${version##*v} export versionid=${versionid%-*} export type=${version#*-} pkg=emqx-${ostype}-${version}-${type}-${today}.zip echo "building $pkg..." make && cd _rel && zip -rq $pkg emqx scp -o StrictHostKeyChecking=no $pkg ${host}:${buildlocation} cd /emqx_temp/emqx-packages sed -i "/REL_TAG/c\REL_TAG=emqx30" ./Makefile sed -i "/EMQ_VERSION/c\EMQ_VERSION=${versionid}" ./Makefile sed -i "/Version: /c\Version: ${versionid}" ./rpm/emqx.spec sed -i "1c\emqx (${versionid}) unstable; urgency=medium" ./deb/debian/changelog make name=`basename package/*` name2=${name/emqx-${versionid}/emqx-${ostype}-${version}-${today}} name3=${name2/emqx_${versionid}/emqx-${ostype}-${version}-${today}} mv package/${name} package/${name3} scp -o StrictHostKeyChecking=no package/* ${host}:${buildlocation}
Stop removing the unzipped version
#!/usr/bin/env bash set -e # host=s3://dev.mockbrian.com/squiggle # host=s3://mockbrian.com/squiggle host=s3://squiggle-lang.org # host=s3://dev.squiggle-lang.org ./bin/build-js.sh bundle exec jekyll build # Shouldn't need to sleep here, but if jekyll watch/serve is running, there's a # timing issue here where jekyll will delete the _site directory after the file # is gzipped but before it's uploaded. sleep 3 gzip _site/try/bundle.js ls -lh _site/try/bundle.js.gz s3cmd put \ --mime-type="application/javascript" \ --add-header="Content-Encoding: gzip" \ --acl-public \ --no-progress \ "_site/try/bundle.js.gz" \ "$host/try/bundle.js" s3cmd sync \ --no-mime-magic \ --acl-public \ --no-progress \ --exclude="try/bundle.js.gz" \ "_site/" \ "$host/"
#!/usr/bin/env bash set -e # host=s3://dev.mockbrian.com/squiggle # host=s3://mockbrian.com/squiggle host=s3://squiggle-lang.org # host=s3://dev.squiggle-lang.org ./bin/build-js.sh bundle exec jekyll build # Shouldn't need to sleep here, but if jekyll watch/serve is running, there's a # timing issue here where jekyll will delete the _site directory after the file # is gzipped but before it's uploaded. sleep 3 gzip <_site/try/bundle.js >_site/try/bundle.js.gz ls -lh _site/try/bundle.js.gz s3cmd put \ --mime-type="application/javascript" \ --add-header="Content-Encoding: gzip" \ --acl-public \ --no-progress \ "_site/try/bundle.js.gz" \ "$host/try/bundle.js" s3cmd sync \ --no-mime-magic \ --acl-public \ --no-progress \ --exclude="try/bundle.js.gz" \ "_site/" \ "$host/"
Copy package to a separate directory.
#!/bin/bash source .travis/common.sh set -e $SPACER start_section "conda.check" "${GREEN}Checking...${NC}" conda build --check $PACKAGE end_section "conda.check" $SPACER start_section "conda.build" "${GREEN}Building..${NC}" $CONDA_PATH/bin/python ./.travis-output.py output.log conda build $PACKAGE end_section "conda.build" $SPACER start_section "conda.build" "${GREEN}Installing..${NC}" conda install $CONDA_OUT end_section "conda.build" $SPACER start_section "conda.du" "${GREEN}Disk usage..${NC}" du -h $CONDA_OUT end_section "conda.du" $SPACER start_section "conda.clean" "${GREEN}Cleaning up..${NC}" conda clean -s --dry-run end_section "conda.clean" $SPACER
#!/bin/bash source .travis/common.sh set -e $SPACER start_section "conda.copy" "${GREEN}Copying package...${NC}" mkdir -p /tmp/conda cp -avR $PACKAGE /tmp/conda/ cd /tmp/conda/ end_section "conda.copy" $SPACER start_section "conda.check" "${GREEN}Checking...${NC}" conda build --check $PACKAGE end_section "conda.check" $SPACER start_section "conda.build" "${GREEN}Building..${NC}" $CONDA_PATH/bin/python ./.travis-output.py output.log conda build $PACKAGE end_section "conda.build" $SPACER start_section "conda.build" "${GREEN}Installing..${NC}" conda install $CONDA_OUT end_section "conda.build" $SPACER start_section "conda.du" "${GREEN}Disk usage..${NC}" du -h $CONDA_OUT end_section "conda.du" $SPACER start_section "conda.clean" "${GREEN}Cleaning up..${NC}" conda clean -s --dry-run end_section "conda.clean" $SPACER
Create url to push into gh-pages branch
#!/bin/bash #FIXME: GH_TOKEN=1234 set -o pipefail ( set -e set -x mkdir deploy_to_gh_pages git config user.name "Travis-CI" git config user.email "travis@travis" npm run swagger bundle -- --json -o deploy_to_gh_pages/swagger.json npm run swagger bundle -- --yaml -o deploy_to_gh_pages/swagger.json cd deploy_to_gh_pages git add . git commit -m "Deployed to Github Pages" echo '==================================' git config --get remote.origin.url echo '==================================' #git push --force "https://${GH_TOKEN}@${GH_REF}" master:gh-pages 2>&1 ) 2>&1 | sed "s/${GH_TOKEN}/xxPASSxx/"
#!/bin/bash #FIXME: GH_TOKEN=1234 set -o pipefail ( set -e set -x GH_REPO=$(git config --get remote.origin.url) mkdir deploy_to_gh_pages git config user.name "Travis-CI" git config user.email "travis@travis" npm run swagger bundle -- --json -o deploy_to_gh_pages/swagger.json npm run swagger bundle -- --yaml -o deploy_to_gh_pages/swagger.json cd deploy_to_gh_pages git add . git commit -m "Deployed to Github Pages" GH_URL=$(echo "$GH_REPO" | sed "s#://#${GH_TOKEN}@#") git push --force "$GH_URL" master:gh-pages 2>&1 ) 2>&1 | sed "s/${GH_TOKEN}/xxPASSxx/"
Fix DOMAIN_VERSION to be long, even when building on a tag
#!/bin/bash # ensure sdk is installed bin/install-plugin-sdk-linux.sh if [[ "x$DOMAIN_VERSION" == "x" ]]; then export DOMAIN_VERSION=`git describe --dirty="-dirty" --abbrev=12` fi .sdk/bin/atlas-mvn "$@"
#!/bin/bash # ensure sdk is installed bin/install-plugin-sdk-linux.sh if [[ "x$DOMAIN_VERSION" == "x" ]]; then export DOMAIN_VERSION=`git describe --dirty="-dirty" --abbrev=12 --long` fi .sdk/bin/atlas-mvn "$@"
Add comment explaining the -2 option
#!/bin/bash # stop script if encounter errors # prevents script from making changes to previously running session # if one already exists set -e if [[ $# > 0 ]]; then SESSION=$1 else SESSION=Main fi # Create session in detached mode tmux -2 new-session -d -s $SESSION # Select first window tmux -2 select-window -t $SESSION:1 # Rename first window to 'edit' tmux -2 rename-window edit # Attach to session newly-created session tmux -2 attach -t $SESSION
#!/bin/bash # stop script if encounter errors # prevents script from making changes to previously running session # if one already exists set -e if [[ $# > 0 ]]; then SESSION=$1 else SESSION=Main fi # NOTE: I use the option "-2" to force Tmux to accept 256 colors This is # necessary for proper Vim support in the Linux Console. My Vim colorscheme, # PaperColor, does a lot of smart translation for Color values between 256 and # terminal 16 color support, and this translation is lost when Tmux assumes too # much # Create session in detached mode tmux -2 new-session -d -s $SESSION # Select first window tmux -2 select-window -t $SESSION:1 # Rename first window to 'edit' tmux -2 rename-window edit # Attach to session newly-created session tmux -2 attach -t $SESSION
Add timeout to apt-get update
#!/bin/bash # Script to set up building environment for drone.io # We need to add a few repos because drone's builders are precise (12.04) set -e # Use g++4.8 echo 2 | sudo update-alternatives --config gcc # Some deps sudo add-apt-repository -y ppa:fcitx-team/nightly sudo add-apt-repository -y ppa:svn sudo add-apt-repository -y ppa:mapnik/boost-backports-1-54 # Some repos seem to fail quite ofen while ! sudo apt-get update; do true done # Instal deps sudo apt-get install debhelper cmake subversion protobuf-compiler \ libprotobuf-dev libev-dev libgoogle-glog-dev \ libcurl4-openssl-dev libssl-dev libtbb-dev libjsoncpp-dev lcov \ flex bison libboost-filesystem-dev libboost-system-dev python2.7-dev # Drone.io builders are precise wget https://gflags.googlecode.com/files/libgflags0_2.0-1_amd64.deb wget https://gflags.googlecode.com/files/libgflags-dev_2.0-1_amd64.deb sudo dpkg -i libgflags0_2.0-1_amd64.deb libgflags-dev_2.0-1_amd64.deb
#!/bin/bash # Script to set up building environment for drone.io # We need to add a few repos because drone's builders are precise (12.04) set -e # Use g++4.8 echo 2 | sudo update-alternatives --config gcc # Some deps sudo add-apt-repository -y ppa:fcitx-team/nightly sudo add-apt-repository -y ppa:svn sudo add-apt-repository -y ppa:mapnik/boost-backports-1-54 # Some repos seem to fail quite ofen while ! timeout 45 sh -c "sudo apt-get update"; do true done # Instal deps sudo apt-get install debhelper cmake subversion protobuf-compiler \ libprotobuf-dev libev-dev libgoogle-glog-dev \ libcurl4-openssl-dev libssl-dev libtbb-dev libjsoncpp-dev lcov \ flex bison libboost-filesystem-dev libboost-system-dev python2.7-dev # Drone.io builders are precise wget https://gflags.googlecode.com/files/libgflags0_2.0-1_amd64.deb wget https://gflags.googlecode.com/files/libgflags-dev_2.0-1_amd64.deb sudo dpkg -i libgflags0_2.0-1_amd64.deb libgflags-dev_2.0-1_amd64.deb
Remove deprecated command line option.
#!/bin/bash BASEDIR=$(dirname $0) virtualenv --no-site-packages $BASEDIR/venv $BASEDIR/venv/bin/pip install -r $BASEDIR/requirements.txt $BASEDIR/venv/bin/python $BASEDIR/update-database.py $1 rm -rf $BASEDIR/venv
#!/bin/bash BASEDIR=$(dirname $0) virtualenv $BASEDIR/venv $BASEDIR/venv/bin/pip install -r $BASEDIR/requirements.txt $BASEDIR/venv/bin/python $BASEDIR/update-database.py $1 rm -rf $BASEDIR/venv
Switch logs to verbose mode as well
#!/bin/sh set -e # This script is supposed to run inside the AppStream Docker container # on the CI system. # # Read options for the current test run # build_dir="cibuild" if [ "$1" = "sanitize" ]; then build_dir="cibuild-san" echo "Testing sanitized build." # Slow unwind, but we get better backtraces export ASAN_OPTIONS=fast_unwind_on_malloc=0 # no GLib memory pools export G_SLICE=always-malloc # pedantic malloc export MALLOC_CHECK_=3 fi; if [ ! -d "$build_dir" ]; then # Take action if $DIR exists. # echo "Build directory '$build_dir' did not exist. Can not continue." exit 1 fi set -x # # Run tests # cd $build_dir meson test --print-errorlogs
#!/bin/sh set -e # This script is supposed to run inside the AppStream Docker container # on the CI system. # # Read options for the current test run # build_dir="cibuild" if [ "$1" = "sanitize" ]; then build_dir="cibuild-san" echo "Testing sanitized build." # Slow unwind, but we get better backtraces export ASAN_OPTIONS=fast_unwind_on_malloc=0 # no GLib memory pools export G_SLICE=always-malloc # pedantic malloc export MALLOC_CHECK_=3 fi; if [ ! -d "$build_dir" ]; then # Take action if $DIR exists. # echo "Build directory '$build_dir' did not exist. Can not continue." exit 1 fi set -x # # Run tests # cd $build_dir meson test --print-errorlogs --verbose
Add option to force build conan dependencies by passing the -f flag to the build script
#!/bin/sh PREMAKE_DIR="projects/premake/" CONAN_DIR="projects/conan/" PREMAKE_CONAN_FILE="conanpremake.lua" CONAN_FILENAME="conanfile.txt" CONAN_INFO_FILE="conaninfo.txt" conan install --build outdated --file "${CONAN_DIR}${CONAN_FILENAME}" if [ $? -ne 0 ]; then echo "[FAILED] Installing dependancies" return 1 fi mv -f "${PREMAKE_CONAN_FILE}" "${PREMAKE_DIR}" if [ $? -ne 0 ]; then echo "[FAILED] copying premake dependancies" return 1 fi mv -f "${CONAN_INFO_FILE}" "${CONAN_DIR}" if [ $? -ne 0 ]; then echo "[FAILED] Copying conaninfo" return 1 fi echo "[SUCCESS]"
#!/bin/sh PREMAKE_DIR="projects/premake/" CONAN_DIR="projects/conan/" PREMAKE_CONAN_FILE="conanpremake.lua" CONAN_FILENAME="conanfile.txt" CONAN_INFO_FILE="conaninfo.txt" FORCE=0 if [ $# -gt 0 ]; then if [ "$1" == "-f" ]; then FORCE=1 fi fi if [ $FORCE -eq 1 ]; then conan install --build --file "${CONAN_DIR}${CONAN_FILENAME}" else conan install --build=outdated --file "${CONAN_DIR}${CONAN_FILENAME}" fi if [ $? -ne 0 ]; then echo "[FAILED] Installing dependancies" return 1 fi mv -f "${PREMAKE_CONAN_FILE}" "${PREMAKE_DIR}" if [ $? -ne 0 ]; then echo "[FAILED] copying premake dependancies" return 1 fi mv -f "${CONAN_INFO_FILE}" "${CONAN_DIR}" if [ $? -ne 0 ]; then echo "[FAILED] Copying conaninfo" return 1 fi echo "[SUCCESS]"
Change the number of iterations
#!/usr/bin/env bash for predictor in inception-v3 alex vgg resnet-50 do python train_image.py -p ${predictor} -g -1 -b 2 done for predictor in deepspeech2 fc5 do python train_audio.py -p ${predictor} -g -1 -b 2 done for predictor in c3d do python train_movie.py -p ${predictor} -g -1 -b 2 done for predictor in small-lstm big-lstm do python train_text.py -p ${predictor} -g -1 -b 2 done
#!/usr/bin/env bash for predictor in inception-v3 alex vgg resnet-50 do python train_image.py -p ${predictor} -g -1 -b 2 -i 2 done for predictor in deepspeech2 fc5 do python train_audio.py -p ${predictor} -g -1 -b 2 -i 2 done for predictor in c3d do python train_movie.py -p ${predictor} -g -1 -b 2 -i 2 done for predictor in small-lstm big-lstm do python train_text.py -p ${predictor} -g -1 -b 2 -i 2 done
Use power saving for wifi.
#!/bin/bash sleep 10 MY_PATH="`dirname \"$0\"`" MY_PATH="`( cd \"$MY_PATH\" && pwd )`" cd $MY_PATH cd .. rsync ./data/solarpi.csv rsync://192.168.178.36/data/solarpi
#!/bin/bash /sbin/ifup wlan0 MY_PATH="`dirname \"$0\"`" MY_PATH="`( cd \"$MY_PATH\" && pwd )`" cd $MY_PATH cd .. git pull make rsync ./data/solarpi.csv rsync://192.168.178.36/data/solarpi sleep 60 /sbin/ifdown wlan0
Copy script using curl and xclip
#!/bin/bash curl -s --request GET localhost:8080/realclipper/api/v1.0/clipboard | xclip -selection clipboard
#!/bin/bash #GET API request storing the response in the clipboard" curl -s --request GET localhost:8080/realclipper/api/v1.0/clipboard | xclip -selection clipboard
Add wmname command to xinitrc script
source $HOME/.profile $HOME/bin/earthwall/earthwall.sh& pulseaudio --daemonize clipmenud& compton& thunderbird& #slstatus& clipmenud& dunst& $HOME/dotfiles/bin/scripts/status.sh& exec dbus-launch `dwm 2> /tmp/dwm.log`
source $HOME/.profile $HOME/bin/earthwall/earthwall.sh& start-pulseaudio-x11 clipmenud& compton& thunderbird& clipmenud& dunst& wmname LG3D blueman-applet& $HOME/dotfiles/bin/scripts/status.sh& exec dbus-launch `dwm 2> /tmp/dwm.log`
Fix find global options warning
# -*- sh -*- plugin_update_command() { if [ "$#" -lt 1 ]; then display_error "usage: asdf plugin-update {<name> | --all} [git-ref]" exit 1 fi local plugin_name="$1" local gitref="${2:-master}" if [ "$plugin_name" = "--all" ]; then if [ -d "$(asdf_data_dir)"/plugins ]; then while IFS= read -r -d '' dir; do local plugin_name plugin_name=$(basename "$dir") update_plugin "$plugin_name" "$dir" "$gitref" & done < <(find "$(asdf_data_dir)"/plugins -type d -mindepth 1 -maxdepth 1) wait fi else local plugin_path plugin_path="$(get_plugin_path "$plugin_name")" check_if_plugin_exists "$plugin_name" update_plugin "$plugin_name" "$plugin_path" "$gitref" fi } update_plugin() { local plugin_name=$1 local plugin_path=$2 local gitref=$3 logfile=$(mktemp) { printf "Updating %s...\\n" "$plugin_name" (cd "$plugin_path" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref") } >"$logfile" 2>&1 cat "$logfile" rm "$logfile" } plugin_update_command "$@"
# -*- sh -*- plugin_update_command() { if [ "$#" -lt 1 ]; then display_error "usage: asdf plugin-update {<name> | --all} [git-ref]" exit 1 fi local plugin_name="$1" local gitref="${2:-master}" if [ "$plugin_name" = "--all" ]; then if [ -d "$(asdf_data_dir)"/plugins ]; then while IFS= read -r -d '' dir; do local plugin_name plugin_name=$(basename "$dir") update_plugin "$plugin_name" "$dir" "$gitref" & done < <(find "$(asdf_data_dir)"/plugins -mindepth 1 -maxdepth 1 -type d) wait fi else local plugin_path plugin_path="$(get_plugin_path "$plugin_name")" check_if_plugin_exists "$plugin_name" update_plugin "$plugin_name" "$plugin_path" "$gitref" fi } update_plugin() { local plugin_name=$1 local plugin_path=$2 local gitref=$3 logfile=$(mktemp) { printf "Updating %s...\\n" "$plugin_name" (cd "$plugin_path" && git fetch -p -u origin "$gitref:$gitref" && git checkout -f "$gitref") } >"$logfile" 2>&1 cat "$logfile" rm "$logfile" } plugin_update_command "$@"
Make path to build script relative
#!/bin/bash # First lets get Postgis going source ${BASH_SOURCE%/*}/functions.sh docker build -t kartoza/postgis git://github.com/kartoza/docker-postgis restart_postgis_server # Now build the django image cd ../docker-prod ./build.sh cd - # Now collect migrate and collect static manage migrate manage collectstatic --noinput # Now run the service run_django_server # For debugging to see if uwsgi is running nicely before adding nginx #run_django_server --protocol=http
#!/bin/bash # First lets get Postgis going source ${BASH_SOURCE%/*}/functions.sh docker build -t kartoza/postgis git://github.com/kartoza/docker-postgis restart_postgis_server # Now build the django image cd ${BASH_SOURCE%/*}/../docker-prod ./build.sh cd - # Now collect migrate and collect static manage migrate manage collectstatic --noinput # Now run the service run_django_server # For debugging to see if uwsgi is running nicely before adding nginx #run_django_server --protocol=http
Add gitter to install list
#!/bin/sh ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install fish caskroom/cask/brew-cask git python ruby scala sbt giter8 git-extras vim maven wget jq dos2unix p7zip unrar tree brew cask install alfred iterm2 java spectacle sourcetree qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webpquicklook suspicious-package vagrant virtualbox p4merge intellij-idea-ce hipchat lastpass dropbox
#!/bin/sh ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install fish caskroom/cask/brew-cask git python ruby scala sbt giter8 git-extras vim maven wget jq dos2unix p7zip unrar tree brew cask install alfred iterm2 java spectacle sourcetree qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webpquicklook suspicious-package vagrant virtualbox p4merge intellij-idea-ce hipchat lastpass dropbox gitter
Add more comment on warning message
#!/bin/bash lower=`echo $1 | tr '[:upper:]' '[:lower:]'` guard=DART_`echo $1 | tr '[:lower:]' '[:upper:]'`_`echo $1 | tr '[:lower:]' '[:upper:]'`_H_ cat <<END /* * Copyright 2013 Open Source Robotics Foundation * * 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. * */ #ifndef $guard #define $guard // Deprecated header file for case-sensitive filesystems #warning The dart/$lower/$1.h header file is deprecated \\ as of dart 4.3 and will be removed in the next release. #include "dart/$lower/$2.h" #endif END
#!/bin/bash lower=`echo $1 | tr '[:upper:]' '[:lower:]'` guard=DART_`echo $1 | tr '[:lower:]' '[:upper:]'`_`echo $1 | tr '[:lower:]' '[:upper:]'`_H_ cat <<END /* * Copyright 2013 Open Source Robotics Foundation * * 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. * */ #ifndef $guard #define $guard // Deprecated header file for case-sensitive filesystems #warning The dart/$lower/$1.h header file is deprecated \\ as of dart 4.3 and will be removed in the next release. \\ Please include dart/$lower/$2.h instead. #include "dart/$lower/$2.h" #endif END
Add chicken to default hi-linux config
#!/bin/sh jagen_overlays='ast/board/ast2xx sdk/hi-linux toolchain/arm-hisiv200-linux ast/common ast/product/hi-linux' jagen_toolchain_dir='$jagen_base_dir/toolchain/arm-hisiv200-linux' jagen_sdk_dir='$jagen_src_dir/hi-sdk'
#!/bin/sh jagen_overlays='ast/board/ast2xx sdk/hi-linux toolchain/arm-hisiv200-linux \ product/chicken ast/common ast/product/hi-linux' jagen_toolchain_dir='$jagen_base_dir/toolchain/arm-hisiv200-linux' jagen_sdk_dir='$jagen_src_dir/hi-sdk'
Use system-wide ipython as to not need it in every damn virtualenv.
alias pyweb='python -m SimpleHTTPServer' alias mrs='./manage.py runserver' alias ms='./manage.py shell' validatejson() { cat $1 | python -m simplejson.tool } function remote_shell() { environment=$3 || "PRODUCTION" /usr/bin/env ssh $1 "( DEPLOYMENT_TYPE=$environment cd $2 && env/bin/python ./manage.py shell )" }
alias pyweb='python -m SimpleHTTPServer' alias mrs='./manage.py runserver' alias ms='./manage.py shell' alias ipython='python /usr/bin/ipython' validatejson() { cat $1 | python -m simplejson.tool } function remote_shell() { environment=$3 || "PRODUCTION" /usr/bin/env ssh $1 "( DEPLOYMENT_TYPE=$environment cd $2 && env/bin/python ./manage.py shell )" }
Add a few useful bash 4 options.
# Enable appending to the history file instead of replacing it (histappend) and # attempt to save correctly all the lines of a multiple lines command # (cmdhist). shopt -s histappend cmdhist # Checks the window size after each command and, if necessary, update the # values of the variables LINES and COLUMNS. shopt -s checkwinsize
# Enable appending to the history file instead of replacing it (histappend) and # attempt to save correctly all the lines of a multiple lines command # (cmdhist). shopt -s histappend cmdhist # Checks the window size after each command and, if necessary, update the # values of the variables LINES and COLUMNS. shopt -s checkwinsize # Make 'cd **/d' enter './a/b/c/d' (bash 4 only). shopt -s autocd 2> /dev/null # Recursive globbing - ls **/*.txt (bash 4 only). shopt -s globstar 2> /dev/null
Move stuff around in the node example
# Copyright 2019 Francisco Souza. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. set -e ./fake-gcs-server -backend memory -scheme http -port 8080 -data $PWD/examples/data & ( export STORAGE_EMULATOR_HOST=http://localhost:8080 cd examples/node npm ci node index.js )
# Copyright 2019 Francisco Souza. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. set -e export STORAGE_EMULATOR_HOST=http://localhost:8080 ./fake-gcs-server -backend memory -data $PWD/examples/data -scheme http -port 8080 & ( cd examples/node npm ci node index.js )
Use an older SHA algorithm to avoid problems with Vsphere 6.5 VM import
#!/bin/bash # Adapted from http://tylerpower.io/post/packer-build-vmware-appliance-on-linux/ set -e if [ ! -z "${DEBUG}" ]; then set -x fi DEPENDENCIES=("ovftool") for dep in "${DEPENDENCIES[@]}"; do if ! [ -x "$(command -v ${dep})" ]; then echo "${dep} must be available." exit 1 fi done if [[ -z $PACKER_BUILD_NAME ]]; then echo "Environment Variable 'PACKER_BUILD_NAME' must be set." exit 1 fi for vmx in "output-${PACKER_BUILD_NAME}"/*.vmx; do name=$(basename "${vmx}" .vmx).ova ovftool --compress=9 -o "${vmx}" "output-${PACKER_BUILD_NAME}/${name}" done # Cleanup all files that are not the ova find "output-${PACKER_BUILD_NAME}" -type f ! -name '*.ova' -delete
#!/bin/bash # Adapted from http://tylerpower.io/post/packer-build-vmware-appliance-on-linux/ set -e if [ ! -z "${DEBUG}" ]; then set -x fi DEPENDENCIES=("ovftool") for dep in "${DEPENDENCIES[@]}"; do if ! [ -x "$(command -v ${dep})" ]; then echo "${dep} must be available." exit 1 fi done if [[ -z $PACKER_BUILD_NAME ]]; then echo "Environment Variable 'PACKER_BUILD_NAME' must be set." exit 1 fi for vmx in "output-${PACKER_BUILD_NAME}"/*.vmx; do name=$(basename "${vmx}" .vmx).ova ovftool --shaAlgorithm=sha1 --compress=9 -o "${vmx}" "output-${PACKER_BUILD_NAME}/${name}" done # Cleanup all files that are not the ova find "output-${PACKER_BUILD_NAME}" -type f ! -name '*.ova' -delete
Move vi-bind-key to the top and remove emacs binding
bindkey -e bindkey '\ew' kill-region bindkey -s '\el' "ls\n" bindkey '^r' history-incremental-search-backward bindkey "^[[5~" up-line-or-history bindkey "^[[6~" down-line-or-history bindkey '^[[A' up-line-or-search bindkey '^[[B' down-line-or-search bindkey "^[[H" beginning-of-line bindkey "^[[1~" beginning-of-line bindkey "^[OH" beginning-of-line bindkey "^[[F" end-of-line bindkey "^[[4~" end-of-line bindkey "^[OF" end-of-line bindkey ' ' magic-space bindkey "^F" forward-word bindkey "^B" backward-word bindkey '^[[Z' reverse-menu-complete bindkey '^?' backward-delete-char bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char # set vi-mode bindkey -v
bindkey -v bindkey '\ew' kill-region bindkey -s '\el' "ls\n" bindkey '^r' history-incremental-search-backward bindkey "^[[5~" up-line-or-history bindkey "^[[6~" down-line-or-history bindkey '^[[A' up-line-or-search bindkey '^[[B' down-line-or-search bindkey "^[[H" beginning-of-line bindkey "^[[1~" beginning-of-line bindkey "^[OH" beginning-of-line bindkey "^[[F" end-of-line bindkey "^[[4~" end-of-line bindkey "^[OF" end-of-line bindkey ' ' magic-space bindkey "^F" forward-word bindkey "^B" backward-word bindkey '^[[Z' reverse-menu-complete bindkey '^?' backward-delete-char bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char
Use grunt init task for rebuilding Bootstrap
#!/usr/bin/sh # Undo any changes git submodule deinit -f . git submodule update --init cd modules/bootstrap # Fetch updates git checkout master # Still needed? #git pull --rebase # Not needed any longer? git checkout v4.0.0-alpha.6 # Link and import our custom variables echo '@import "customvars";' >> scss/_custom.scss ln -s ../../../sass/customvars.scss scss/ # Rebuild Bootstrap npm install && grunt dist
#!/usr/bin/sh # Undo any changes git submodule deinit -f . git submodule update --init cd modules/bootstrap # Fetch updates git checkout master # Still needed? #git pull --rebase # Not needed any longer? git checkout v4.0.0-alpha.6 cd ../.. # Link and import our custom variables, rebuild Bootstrap grunt init
Make it clear what migration we're talking about
#!/bin/sh tmpdir=tmp/dns_report mkdir -p $tmpdir [ -z "$DNS_SERVER" ] && DNS_SERVER=8.8.8.8 tools/site_hosts.sh | while read host do dig @$DNS_SERVER +trace $host > $tmpdir/$host.txt done cat $tmpdir/*.txt | tools/dns_report.pl $tmpdir/hosts.csv grep $tmpdir/hosts.csv -e "^.*AKAMAI.*$" > $tmpdir/still_to_migrate.csv
#!/bin/sh tmpdir=tmp/dns_report mkdir -p $tmpdir [ -z "$DNS_SERVER" ] && DNS_SERVER=8.8.8.8 tools/site_hosts.sh | while read host do dig @$DNS_SERVER +trace $host > $tmpdir/$host.txt done cat $tmpdir/*.txt | tools/dns_report.pl $tmpdir/hosts.csv grep $tmpdir/hosts.csv -e "^.*AKAMAI.*$" > $tmpdir/still_to_migrate_to_fastly_cdn.csv
Create database users with SQL commands
#!/bin/bash if [ ! -z $(pg_lsclusters | grep -c ' main ') ]; then echo "rebuilding PostgreSQL database cluster" # stop and drop the cluster pg_dropcluster 9.1 main --stop # create a fresh new cluster pg_createcluster 9.1 main --start # create a new user PGPASSWORD=drupaltestbotpw createuser -d -E -l -R -S drupaltestbot # create a new default database for the user createdb -O drupaltestbot drupaltestbot # stop the cluster pg_ctlcluster 9.1 main stop # allow md5-based password auth for IPv4 connections echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.1/main/pg_hba.conf # listen on all addresses, not just localhost echo "listen_addresses='*'" >> /etc/postgresql/9.1/main/postgresql.conf fi /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf echo "pgsql died at $(date)";
#!/bin/bash if [ ! -z $(pg_lsclusters | grep -c ' main ') ]; then echo "rebuilding PostgreSQL database cluster" # stop and drop the cluster pg_dropcluster 9.1 main --stop # create a fresh new cluster pg_createcluster 9.1 main --start # create a new user psql -c "CREATE USER drupaltestbot WITH PASSWORD 'drupaltestbotpw';" # create a new default database for the user psql -c "CREATE DATABASE drupaltestbot OWNER drupaltestbot TEMPLATE DEFAULT;" # stop the cluster pg_ctlcluster 9.1 main stop # allow md5-based password auth for IPv4 connections echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.1/main/pg_hba.conf # listen on all addresses, not just localhost echo "listen_addresses='*'" >> /etc/postgresql/9.1/main/postgresql.conf fi /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf echo "pgsql died at $(date)";
Update to new Torch installation instructions
#/usr/bin/env bash # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. set -e set -x if [ "$#" -ne 1 ]; then echo "Usage: $0 INSTALL_DIR" exit 1 fi INSTALL_DIR=$1 mkdir -p $INSTALL_DIR # install Torch7 # instructions from: http://torch.ch/docs/getting-started.html curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash git clone https://github.com/torch/distro.git $INSTALL_DIR --recursive cd $INSTALL_DIR; ./install.sh -b # install custom packages ${INSTALL_DIR}/install/bin/luarocks install tds ${INSTALL_DIR}/install/bin/luarocks install "https://raw.github.com/deepmind/torch-hdf5/master/hdf5-0-0.rockspec" ${INSTALL_DIR}/install/bin/luarocks install "https://raw.github.com/Sravan2j/lua-pb/master/lua-pb-scm-0.rockspec" ${INSTALL_DIR}/install/bin/luarocks install lightningmdb LMDB_INCDIR=/usr/include LMDB_LIBDIR=/usr/lib/x86_64-linux-gnu
#/usr/bin/env bash # Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. set -e set -x if [ "$#" -ne 1 ]; then echo "Usage: $0 INSTALL_DIR" exit 1 fi INSTALL_DIR=$1 mkdir -p $INSTALL_DIR # install Torch7 # instructions from: http://torch.ch/docs/getting-started.html git clone https://github.com/torch/distro.git $INSTALL_DIR --recursive cd $INSTALL_DIR ./install-deps ./install.sh -b # install custom packages ${INSTALL_DIR}/install/bin/luarocks install tds ${INSTALL_DIR}/install/bin/luarocks install "https://raw.github.com/deepmind/torch-hdf5/master/hdf5-0-0.rockspec" ${INSTALL_DIR}/install/bin/luarocks install "https://raw.github.com/Sravan2j/lua-pb/master/lua-pb-scm-0.rockspec" ${INSTALL_DIR}/install/bin/luarocks install lightningmdb LMDB_INCDIR=/usr/include LMDB_LIBDIR=/usr/lib/x86_64-linux-gnu
Revert "Modify nvidia driver installer script to not skip libglvnd"
#!/bin/sh -e ./nvidia-installer \ --accept-license \ --expert \ --no-distro-scripts \ --no-kernel-module \ --no-kernel-module-source \ --no-nvidia-modprobe \ --no-precompiled-interface \ --no-questions \ --no-x-check \ --ui=none \
#!/bin/sh -e ./nvidia-installer \ --accept-license \ --expert \ --no-distro-scripts \ --no-glvnd-egl-client \ --no-glvnd-glx-client \ --no-install-libglvnd \ --no-kernel-module \ --no-kernel-module-source \ --no-nvidia-modprobe \ --no-precompiled-interface \ --no-questions \ --no-x-check \ --ui=none \
Make a cleaner version of the OS X tab function
function tab() { osascript 2>/dev/null <<EOF tell application "System Events" tell process "Terminal" to keystroke "t" using command down end tell application "Terminal" activate do script with command "cd \"$PWD\"; $*" in window 1 end tell EOF }
function savepath() { pwd > ~/.current_path~ } function tab() { savepath osascript >/dev/null <<EOF on do_submenu(app_name, menu_name, menu_item, submenu_item) -- bring the target application to the front tell application app_name activate end tell tell application "System Events" tell process app_name tell menu bar 1 tell menu bar item menu_name tell menu menu_name tell menu item menu_item tell menu menu_item click menu item submenu_item end tell end tell end tell end tell end tell end tell end tell end do_submenu do_submenu("Terminal", "Shell", "New Tab", 1) EOF }
Fix poratbility bug found on netbsd. Seems like the "export" command cannot handle multi-line variable.
#!/bin/sh # name: $1, domain: $2, Subject: $3, Explanation: $4, diff-file: stdin # test checkin export BK_PATCH_IMPORT=YES export BK_USER="$1" export BK_HOST="$2" export SUBJECT=`echo "$3" | sed 's/\(\[[^]]*\]\)* *\(.*\)/\2/'` export CMITMSG="[PATCH] $SUBJECT $4" REJECTS=../REJECTS cat > /tmp/patch$$ echo bk import -tpatch -CR -y"$SUBJECT" /tmp/patch$$ . bk import -tpatch -CR -y"$SUBJECT" /tmp/patch$$ . > /tmp/out$$ s=$? cat /tmp/out$$ if [ $s -ne 0 ]; then sed -e 's/^/# /' < /tmp/out$$ >> $REJECTS cat >>$REJECTS <<EOF2 applypatch "$1" "$2" "$3" "$4" <<EOF EOF2 cat /tmp/patch$$ >> $REJECTS echo EOF >> $REJECTS rm -f /tmp/patch$$ /tmp/out$$ exit 0 fi rm -f /tmp/patch$$ /tmp/out$$ echo bk commit -y"$CMITMSG" bk commit -y"$CMITMSG" sleep 1 exit 0
#!/bin/sh # name: $1, domain: $2, Subject: $3, Explanation: $4, diff-file: stdin # test checkin export BK_PATCH_IMPORT=YES export BK_USER="$1" export BK_HOST="$2" SUBJECT=`echo "$3" | sed 's/\(\[[^]]*\]\)* *\(.*\)/\2/'` CMITMSG="[PATCH] $SUBJECT $4" REJECTS=../REJECTS cat > /tmp/patch$$ echo bk import -tpatch -CR -y"$SUBJECT" /tmp/patch$$ . bk import -tpatch -CR -y"$SUBJECT" /tmp/patch$$ . > /tmp/out$$ s=$? cat /tmp/out$$ if [ $s -ne 0 ]; then sed -e 's/^/# /' < /tmp/out$$ >> $REJECTS cat >>$REJECTS <<EOF2 applypatch "$1" "$2" "$3" "$4" <<EOF EOF2 cat /tmp/patch$$ >> $REJECTS echo EOF >> $REJECTS rm -f /tmp/patch$$ /tmp/out$$ exit 0 fi rm -f /tmp/patch$$ /tmp/out$$ echo bk commit -y"$CMITMSG" bk commit -y"$CMITMSG" sleep 1 exit 0
Fix bug where we ran Airflow using root's $HOME
#!/usr/bin/env bash # Create Docker group to be able to access /var/run/docker.sock DOCKER_SOCKET=/var/run/docker.sock DOCKER_GROUP=docker if [ -S ${DOCKER_SOCKET} ]; then DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCKET}) groupadd -for -g ${DOCKER_GID} ${DOCKER_GROUP} usermod -aG ${DOCKER_GROUP} ${AIRFLOW_USER} echo "Created group '${DOCKER_GROUP}' (GID ${DOCKER_GID}) and added '${AIRFLOW_USER}' to it." fi # Switch to a non-root user and continue sudo -E -u ${AIRFLOW_USER} -- /usr/bin/env bash $AIRFLOW_HOME/runner.sh ${@}
#!/usr/bin/env bash # Create Docker group to be able to access /var/run/docker.sock DOCKER_SOCKET=/var/run/docker.sock DOCKER_GROUP=docker if [ -S ${DOCKER_SOCKET} ]; then DOCKER_GID=$(stat -c '%g' ${DOCKER_SOCKET}) groupadd -for -g ${DOCKER_GID} ${DOCKER_GROUP} usermod -aG ${DOCKER_GROUP} ${AIRFLOW_USER} echo "Created group '${DOCKER_GROUP}' (GID ${DOCKER_GID}) and added '${AIRFLOW_USER}' to it." fi # Switch to a non-root user and continue sudo -E -H -u ${AIRFLOW_USER} -- /usr/bin/env bash $AIRFLOW_HOME/runner.sh ${@}
Bump version from 1.3.0-INTERNAL to cdh5-1.3.0
#!/usr/bin/env bash # Copyright 2012 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Generates the impala version and build information. # Note: for internal (aka pre-release) versions, the version should have # "-INTERNAL" appended. Parts of the code will look for this to distinguish # between released and internal versions. VERSION=1.3.0-INTERNAL GIT_HASH=$(git rev-parse HEAD) BUILD_TIME=`date` HEADER="# Generated version information from save-version.sh" echo -e \ "${HEADER}\nVERSION: ${VERSION}\nGIT_HASH: ${GIT_HASH}\nBUILD_TIME: ${BUILD_TIME}"\ > $IMPALA_HOME/bin/version.info cat $IMPALA_HOME/bin/version.info
#!/usr/bin/env bash # Copyright 2012 Cloudera Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Generates the impala version and build information. # Note: for internal (aka pre-release) versions, the version should have # "-INTERNAL" appended. Parts of the code will look for this to distinguish # between released and internal versions. VERSION=cdh5-1.3.0 GIT_HASH=$(git rev-parse HEAD) BUILD_TIME=`date` HEADER="# Generated version information from save-version.sh" echo -e \ "${HEADER}\nVERSION: ${VERSION}\nGIT_HASH: ${GIT_HASH}\nBUILD_TIME: ${BUILD_TIME}"\ > $IMPALA_HOME/bin/version.info cat $IMPALA_HOME/bin/version.info
Use a faster deploy script
#!/bin/bash # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" # Change into that directory cd $DIR # Push the subtree (force) git push heroku `git subtree split --prefix website master`:master --force
#!/bin/bash # Set the tmpdir if [ -z "$TMPDIR" ]; then TMPDIR="/tmp" fi # Create a temporary build dir and make sure we clean it up. For # debugging, comment out the trap line. DEPLOY=`mktemp -d $TMPDIR/packer-www-XXXXXX` trap "rm -rf $DEPLOY" INT TERM EXIT # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" # Copy into tmpdir shopt -s dotglob cp -r $DIR/website/* $DEPLOY/ # Change into that directory pushd $DEPLOY &>/dev/null # Ignore some stuff touch .gitignore echo ".sass-cache" >> .gitignore echo "build" >> .gitignore echo "vendor" >> .gitignore # Add everything git init -q . git add . git commit -q -m "Deploy by $USER" git remote add heroku git@heroku.com:packer-www.git git push -f heroku master # Go back to our root popd &>/dev/null
Fix a bug in interval definition for shuf
newFileName='glitch_'$1; cat "$1" > "$newFileName"; function i__gli() { fileSize=$(wc -c "$1"); headerSize=1000; skip=$(shuf -i "$headerSize"-"$fileSize" -n 1); count=$(shuf -i 1-10 -n 1); for i in $(seq 1 $count);do byteStr=$byteStr'\x'$(shuf -i 0-254 -n 1); done; echo $byteStr' @ '$skip; printf $byteStr | dd of="$newFileName" bs=1 seek=$skip count=$count conv=notrunc } steps=$(shuf -i 1-$2 -n 1); for i in $(seq 1 $steps); do byteStr=''; i__gli "$1"; done
newFileName='glitch_'$1; cat "$1" > "$newFileName"; function i__gli() { fileSize=$(wc -c < "$1"); headerSize=1000; skip=$(shuf -i "$headerSize"-"$fileSize" -n 1); count=$(shuf -i 1-10 -n 1); for i in $(seq 1 $count);do byteStr=$byteStr'\x'$(shuf -i 0-254 -n 1); done; echo $byteStr' @ '$skip; printf $byteStr | dd of="$newFileName" bs=1 seek=$skip count=$count conv=notrunc } steps=$(shuf -i 1-$2 -n 1); for i in $(seq 1 $steps); do byteStr=''; i__gli "$1"; done
Select PyQt5 conda builds with QtMultimedia
#!/bin/bash source $HOME/miniconda/etc/profile.d/conda.sh conda activate test if [ "$USE_CONDA" = "Yes" ]; then conda install -q qt=5.* pyqt=5.* conda install -q sip=4.19.8 else # We are getting segfaults in 5.10 pip install -q pyqt5==5.9.2 fi python qtpy/tests/runtests.py # Force quitting if exit status of runtests.py was not 0 if [ $? -ne 0 ]; then exit 1 fi
#!/bin/bash source $HOME/miniconda/etc/profile.d/conda.sh conda activate test # Select build with QtMultimedia if [ "$PYTHON_VERSION" = "2.7" ]; then export BUILD=py27h22d08a2_0 elif [ "$PYTHON_VERSION" = "3.5" ]; then export BUILD=py35h751905a_0 else export BUILD=py36h751905a_0 fi if [ "$USE_CONDA" = "Yes" ]; then conda install -q qt=5.* pyqt=5.9.2=$BUILD conda install -q sip=4.19.8 else # We are getting segfaults in 5.10 pip install -q pyqt5==5.9.2 fi python qtpy/tests/runtests.py # Force quitting if exit status of runtests.py was not 0 if [ $? -ne 0 ]; then exit 1 fi
Improve method of detecting if running in screen
# Use colors in coreutils utilities output alias ls='ls --color=auto' export GREP_OPTIONS="--color" # ls aliases alias ll='ls -la' alias la='ls -A' alias l='ls' # Update dotfiles function dfu() { ( cd ~/.dotfiles && git pullff && ./install -q ) } # 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 } # Execute a command in a specific directory function in() { ( cd ${1} && shift && ${@} ) } # Mirror a website alias mirrorsite='wget -m -k -K -E -e robots=off'
# Use colors in coreutils utilities output alias ls='ls --color=auto' export GREP_OPTIONS="--color" # ls aliases alias ll='ls -la' alias la='ls -A' alias l='ls' # Update dotfiles function dfu() { ( cd ~/.dotfiles && git pullff && ./install -q ) } # 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 [[ -n $STY ]]; 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 } # Execute a command in a specific directory function in() { ( cd ${1} && shift && ${@} ) } # Mirror a website alias mirrorsite='wget -m -k -K -E -e robots=off'
Revert "Forced a tiny change that should cause a failure"
#!/bin/bash set -e BUCKET="${1}" VPATCH=`cut -d. -f1,2,3 VERSION` VMINOR=`cut -d. -f1,2 VERSION` VMAJOR=`cut -d. -f1 VERSION` echo ' /* whatever */ ' >> dist/mapzen.css if aws s3 ls "s3://${BUCKET}/js/${VPATCH}/mapzen.min.js"; then echo "s3://${BUCKET}/js/${VPATCH}/mapzen.min.js already exits, checking diffs..." aws s3 cp --recursive --quiet "s3://static-prod.mapzen.com/js/${VPATCH}" "live-${VPATCH}" for NAME in mapzen.min.js mapzen.js mapzen.css images; do if diff -rq "dist/${NAME}" "live-${VPATCH}/${NAME}"; then echo "No differences between dist/${NAME} and live-${VPATCH}/${NAME}" else echo "Found a difference between dist/${NAME} and live-${VPATCH}/${NAME}" exit 1 fi done fi for DIR in "js/${VPATCH}" "js/${VMINOR}" "js/${VMAJOR}" "js"; do aws s3 cp dist/mapzen.min.js s3://${BUCKET}/${DIR}/mapzen.min.js aws s3 cp dist/mapzen.js s3://${BUCKET}/${DIR}/mapzen.js aws s3 cp dist/mapzen.css s3://${BUCKET}/${DIR}/mapzen.css aws s3 cp --recursive dist/images s3://${BUCKET}/${DIR}/images done
#!/bin/bash set -e BUCKET="${1}" VPATCH=`cut -d. -f1,2,3 VERSION` VMINOR=`cut -d. -f1,2 VERSION` VMAJOR=`cut -d. -f1 VERSION` if aws s3 ls "s3://${BUCKET}/js/${VPATCH}/mapzen.min.js"; then echo "s3://${BUCKET}/js/${VPATCH}/mapzen.min.js already exits, checking diffs..." aws s3 cp --recursive --quiet "s3://static-prod.mapzen.com/js/${VPATCH}" "live-${VPATCH}" for NAME in mapzen.min.js mapzen.js mapzen.css images; do if diff -rq "dist/${NAME}" "live-${VPATCH}/${NAME}"; then echo "No differences between dist/${NAME} and live-${VPATCH}/${NAME}" else echo "Found a difference between dist/${NAME} and live-${VPATCH}/${NAME}" exit 1 fi done fi for DIR in "js/${VPATCH}" "js/${VMINOR}" "js/${VMAJOR}" "js"; do aws s3 cp dist/mapzen.min.js s3://${BUCKET}/${DIR}/mapzen.min.js aws s3 cp dist/mapzen.js s3://${BUCKET}/${DIR}/mapzen.js aws s3 cp dist/mapzen.css s3://${BUCKET}/${DIR}/mapzen.css aws s3 cp --recursive dist/images s3://${BUCKET}/${DIR}/images done
Fix sequence of called functions in devstack plugin
# DevStack extras script to install Manila if is_service_enabled manila; then if [[ "$1" == "source" ]]; then # Initial source source $TOP_DIR/lib/manila elif [[ "$1" == "stack" && "$2" == "install" ]]; then echo_summary "Installing Manila" install_manila elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring Manila" configure_manila echo_summary "Initialing Manila" init_manila elif [[ "$1" == "stack" && "$2" == "extra" ]]; then echo_summary "Starting Manila" start_manila echo_summary "Creating Manila entities for auth service" create_manila_accounts echo_summary "Creating Manila service flavor" create_manila_service_flavor echo_summary "Creating Manila service image" create_manila_service_image fi if [[ "$1" == "unstack" ]]; then cleanup_manila fi if [[ "$1" == "clean" ]]; then cleanup_manila sudo rm -rf /etc/manila fi fi
# DevStack extras script to install Manila if is_service_enabled manila; then if [[ "$1" == "source" ]]; then # Initial source source $TOP_DIR/lib/manila elif [[ "$1" == "stack" && "$2" == "install" ]]; then echo_summary "Installing Manila" install_manila elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring Manila" configure_manila echo_summary "Initialing Manila" init_manila elif [[ "$1" == "stack" && "$2" == "extra" ]]; then echo_summary "Creating Manila entities for auth service" create_manila_accounts echo_summary "Creating Manila service flavor" create_manila_service_flavor echo_summary "Creating Manila service image" create_manila_service_image echo_summary "Starting Manila" start_manila fi if [[ "$1" == "unstack" ]]; then cleanup_manila fi if [[ "$1" == "clean" ]]; then cleanup_manila sudo rm -rf /etc/manila fi fi
Remove .pyc between local and docker travis tests
#!/bin/bash set -e set -u echo "Running setup.py install" python setup.py install echo "Running tests that don't need Clair" pytest tests/ -v -m "not needs_clair" --cov clair_singularity --cov-report term-missing if [[ $TRAVIS_PYTHON_VERSION == "3.5"* ]]; then echo "Python 3.5 - running docker tests with Clair" docker pull arminc/clair-db:2017-08-21 docker run -d --name db arminc/clair-db:2017-08-21 docker pull arminc/clair-local-scan:v2.0.0 docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.0 docker ps docker build -t clair_singularity . docker run -v $TRAVIS_BUILD_DIR:/app --privileged --name clair-singularity --link clair:clair clair_singularity pytest tests/ -v --cov clair_singularity --cov-report term-missing if [ $? -eq 0 ]; then coveralls -b $TRAVIS_BUILD_DIR fi fi
#!/bin/bash set -e set -u echo "Running setup.py install" python setup.py install echo "Running tests that don't need Clair" pytest tests/ -v -m "not needs_clair" --cov clair_singularity --cov-report term-missing if [[ $TRAVIS_PYTHON_VERSION == "3.5"* ]]; then echo "Python 3.5 - running docker tests with Clair" docker pull arminc/clair-db:2017-08-21 docker run -d --name db arminc/clair-db:2017-08-21 docker pull arminc/clair-local-scan:v2.0.0 docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.0 docker ps docker build -t clair_singularity . # Clear out any old .pyc from the local tests find . -name *.pyc -delete docker run -v $TRAVIS_BUILD_DIR:/app --privileged --name clair-singularity --link clair:clair clair_singularity pytest tests/ -v --cov clair_singularity --cov-report term-missing if [ $? -eq 0 ]; then coveralls -b $TRAVIS_BUILD_DIR fi fi
Remove /var/cache/yum to save ~100M
if [ "$PACKER_BUILDER_TYPE" != "docker" ]; then echo 'removing old kernels...' package-cleanup --oldkernels --count 1 -y fi echo echo 'removing unneeded files and cache...' yum -y clean all find / -iname VBoxGuestAdditions.iso -delete rm -rf /tmp/rubygems-* echo echo 'removing persistent net rules from udev...' rm -f /etc/udev/rules.d/70* echo echo 'removing MAC and UUID from network startup script...' sed -i '/^HWADDR=.*$/d' /etc/sysconfig/network-scripts/ifcfg-* sed -i '/^UUID=.*$/d' /etc/sysconfig/network-scripts/ifcfg-* echo echo 'finishing up...' cat /etc/motd sync
if [ "$PACKER_BUILDER_TYPE" != "docker" ]; then echo 'removing old kernels...' package-cleanup --oldkernels --count 1 -y fi echo echo 'removing unneeded files and cache...' yum -y clean all rm -rf /var/cache/yum find / -iname VBoxGuestAdditions.iso -delete rm -rf /tmp/rubygems-* echo echo 'removing persistent net rules from udev...' rm -f /etc/udev/rules.d/70* echo echo 'removing MAC and UUID from network startup script...' sed -i '/^HWADDR=.*$/d' /etc/sysconfig/network-scripts/ifcfg-* sed -i '/^UUID=.*$/d' /etc/sysconfig/network-scripts/ifcfg-* echo echo 'finishing up...' cat /etc/motd sync
Mark dependency updating PRs as obvious fix
#!/bin/bash set -evx branch="expeditor/${GEM_NAME}_${VERSION}" git checkout -b "$branch" bundle install bundle exec rake dependencies:update git add . git commit --message "Bump $GEM_NAME to $VERSION" --message "This pull request was triggered automatically via Expeditor when $GEM_NAME $VERSION was promoted to Rubygems." --message "Signed-off-by: Chef CI <oss@chef.io>" open_pull_request # Get back to master and cleanup the leftovers - any changed files left over at the end of this script will get committed to master. git checkout - git branch -D "$branch"
#!/bin/bash set -evx branch="expeditor/${GEM_NAME}_${VERSION}" git checkout -b "$branch" bundle install bundle exec rake dependencies:update git add . git commit --message "Bump $GEM_NAME to $VERSION" --message "This pull request was triggered automatically via Expeditor when $GEM_NAME $VERSION was promoted to Rubygems." --message "Obvious fix - no DCO required" open_pull_request # Get back to master and cleanup the leftovers - any changed files left over at the end of this script will get committed to master. git checkout - git branch -D "$branch"
Replace mv by cp for the bin
export CFLAGS="-O2 -fopenmp -I$PREFIX/include -I" cd $SRC_DIR/src make cd ../ sed -i.bak "s/jellyfish_dir = quake_dir/jellyfish_dir = $PREFIX\/bin/g" $SRC_DIR/bin/quake.py mkdir -p $PREFIX/bin mv bin/* $PREFIX/bin/
export CFLAGS="-O2 -fopenmp -I$PREFIX/include -I" cd $SRC_DIR/src make cd ../ sed -i.bak "s/jellyfish_dir = quake_dir/jellyfish_dir = $PREFIX\/bin/g" $SRC_DIR/bin/quake.py mkdir -p $PREFIX/bin cp bin/* $PREFIX/bin/
Add BOXEN_PATH to PATH on systems where /opt/boxen exists
#------------------------------------------------------------------------------- # # PATH building # #------------------------------------------------------------------------------- export LC_CTYPE=en_US.UTF-8 # # System path # # echo $PATH # Manually setting the original OS X path so that reloadprofile won't keep growing the PATH # OSX_PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/X11R6/bin if [ -d /opt/boxen ] ; then BOXEN_PATH=/opt/boxen/rbenv/shims:/opt/boxen/rbenv/bin:/opt/boxen/rbenv/plugins/ruby-build/bin:/opt/boxen/bin:/opt/boxen/homebrew/bin:/opt/boxen/homebrew/sbin # TODO add ${BOXEN_PATH} to PATH conditionally fi # Prepend user bin dir to PATH # TODO: Get rbenv to load path in correct order export PATH=~/bin:/usr/local/bin:${PATH}:/usr/bin:/bin:/usr/sbin:/sbin
#------------------------------------------------------------------------------- # # PATH building # #------------------------------------------------------------------------------- export LC_CTYPE=en_US.UTF-8 # # System path # # echo $PATH # Manually setting the original OS X path so that reloadprofile won't keep growing the PATH # OSX_PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/X11R6/bin if [ -d /opt/boxen ] ; then BOXEN_PATH=/opt/boxen/rbenv/shims:/opt/boxen/rbenv/bin:/opt/boxen/rbenv/plugins/ruby-build/bin:/opt/boxen/bin:/opt/boxen/homebrew/bin:/opt/boxen/homebrew/sbin export PATH=${BOXEN_PATH}:${PATH} fi # Prepend user bin dir to PATH # TODO: Get rbenv to load path in correct order export PATH=~/bin:/usr/local/bin:${PATH}:/usr/bin:/bin:/usr/sbin:/sbin
Add date constraint to run report shell script
cd ../repo-tools-data git pull cd ../repo-tools source venv/bin/activate python monthly_pr_stats.py python pull_quarters.py --monthly --start=6/1/2015 python transitions_kpi.py --all --since=30 python pull_orgs.py --since=31 --short
cd ../repo-tools-data git pull cd ../repo-tools source venv/bin/activate python monthly_pr_stats.py --start=6/1/2015 python pull_quarters.py --monthly --start=6/1/2015 python transitions_kpi.py --all --since=30 python pull_orgs.py --since=31 --short
Use shell redirection on patch command
#!/bin/bash # -*-mode: Shell-script; indent-tabs-mode: nil; sh-basic-offset: 2 -*- # This script must be in Bash since we make use of local function variables herein. ApplyPatch () { local patchFile="$1" local toBePatchedFiles=$(sed -n 's%^--- \([^ ]*\)[ ]*.*$%\1%gp' <$patchFile) local toBePatchedFile="" for toBePatchedFile in $toBePatchedFiles do if [ ! -f "$toBePatchedFile" ] then echo "ASSERTION FAILED: toBePatchedFile $toBePatchedFile does not exist as expected (cwd is `pwd`) ." exit 1 fi # Save off the original and apply it each time through, to allow re-execution: if [ ! -f ${toBePatchedFile}.orig ] then cat ${toBePatchedFile} > ${toBePatchedFile}.orig fi done set -x -e cat ${toBePatchedFile}.orig > ${toBePatchedFile} # Patch the files: patch -t -p0 $patchFile }
#!/bin/bash # -*-mode: Shell-script; indent-tabs-mode: nil; sh-basic-offset: 2 -*- # This script must be in Bash since we make use of local function variables herein. ApplyPatch () { local patchFile="$1" local toBePatchedFiles=$(sed -n 's%^--- \([^ ]*\)[ ]*.*$%\1%gp' <$patchFile) local toBePatchedFile="" for toBePatchedFile in $toBePatchedFiles do if [ ! -f "$toBePatchedFile" ] then echo "ASSERTION FAILED: toBePatchedFile $toBePatchedFile does not exist as expected (cwd is `pwd`) ." exit 1 fi # Save off the original and apply it each time through, to allow re-execution: if [ ! -f ${toBePatchedFile}.orig ] then cat ${toBePatchedFile} > ${toBePatchedFile}.orig fi done set -x -e cat ${toBePatchedFile}.orig > ${toBePatchedFile} # Patch the files: patch -t -p0 <$patchFile }
Use paulproteus fork for now
#!/bin/bash set -e # Fail on errors set -x # Verbosity all the way EXTRA_GIT_BUILDPACKAGE_ARGS="--git-ignore-new" SKIP_PBUILDER=true sudo apt-get install git-buildpackage # Get latest alpine packaging git clone https://alioth.debian.org/anonscm/git/collab-maint/alpine.git # Make sure it builds outside a pbuilder cd alpine git-buildpackage $EXTRA_GIT_BUILDPACKAGE_ARGS if [[ "$SKIP_PBUILDER" -eq "true" ]] ; then exit 0 # skip pbuilder for now fi # Create a pbuilder chroot sudo apt-get install ubuntu-dev-tools pbuilder-dist sid create pbuilder-dist sid build ../*.dsc
#!/bin/bash set -e # Fail on errors set -x # Verbosity all the way GIT_IGNORE_NEW="true" # hack for now USE_ALIOTH="false" SKIP_PBUILDER=true ## Pick which one to build -- the Asheesh fork, or the Alioth packaging GIT_URL="https://github.com/paulproteus/alpine-packaging.git" if [[ "$USE_ALIOTH" -eq "true" ]] ; then GIT_URL="https://alioth.debian.org/anonscm/git/collab-maint/alpine.git" fi if [[ "$GIT_IGNORE_NEW" -eq "true" ]] ; then EXTRA_GIT_BUILDPACKAGE_ARGS="--git-ignore-new" else EXTRA_GIT_BUILDPACKAGE_ARGS="" fi sudo apt-get install git-buildpackage # Get latest alpine packaging git clone "$GIT_URL" # Make sure it builds outside a pbuilder cd alpine git-buildpackage $EXTRA_GIT_BUILDPACKAGE_ARGS # intentionally not quoted if [[ "$SKIP_PBUILDER" -eq "true" ]] ; then exit 0 # skip pbuilder for now fi # Create a pbuilder chroot sudo apt-get install ubuntu-dev-tools pbuilder-dist sid create pbuilder-dist sid build ../*.dsc
Add three deps `cmake, autoconf, libgit2`.
# http://brew.sh/ # BREW INSTALL COMMAND {{{ # the following command downloads and install `brew`, the missing package manager: #/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # }}} # About Python, JDK, texlive and the Haskell platform: I choose to install them by the official installers. brew install git tmux chicken clisp rlwrap smlnj ocaml opam cask leiningen pkg-config \ bash-completion gcc freetype vim wget bash brew cask install vlc dropbox pharo # Add the new shell to the list of allowed shells sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' # Change to the new shell (or use the preference pane) chsh -s /usr/local/bin/bash # the following ocaml modules are necessary for HOL Light project opam init opam install camlp5 ocamlfind
# http://brew.sh/ # BREW INSTALL COMMAND {{{ # the following command downloads and install `brew`, the missing package manager: #/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # }}} # About Python, JDK, texlive and the Haskell platform: I choose to install them by the official installers. brew install git tmux chicken clisp rlwrap smlnj ocaml opam cask leiningen pkg-config \ bash-completion gcc freetype vim wget bash cmake automake libgit2 brew cask install vlc dropbox # Add the new shell to the list of allowed shells sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' # Change to the new shell (or use the preference pane) chsh -s /usr/local/bin/bash # the following ocaml modules are necessary for HOL Light project opam init opam install camlp5 ocamlfind
Remove incorrect dependencies that caused segfault
##depends:git, python # ZIFA cd ${TMPDIR_PATH}/ git clone https://github.com/epierson9/ZIFA cd ZIFA # TODO: on commandline this requires sudo ${TOOLS_PATH}/Python-2.7.12/bin/python setup.py install cd .. rm -rf ZIFA
##depends:none # ZIFA cd ${TMPDIR_PATH}/ git clone https://github.com/epierson9/ZIFA cd ZIFA # TODO: on commandline this requires sudo ${TOOLS_PATH}/Python-2.7.12/bin/python setup.py install cd .. rm -rf ZIFA
Clean up so test will run again on same host
#! /bin/bash . ./config.sh start_suite "Test Docker Network plugin with specified subnet" weave_on $HOST1 launch # using ssh rather than docker -H because CircleCI docker client is older $SSH $HOST1 docker network create --driver weavemesh --ipam-driver weavemesh --subnet 10.40.0.0/16 testsubnet $SSH $HOST1 docker run --name=c1 -dt --net=testsubnet --ip 10.40.0.1 $SMALL_IMAGE /bin/sh $SSH $HOST1 docker run --name=c2 -dt --net=testsubnet $SMALL_IMAGE /bin/sh assert "container_ip $HOST1 c1" "10.40.0.1" assert "container_ip $HOST1 c2" "10.40.0.2" # assuming linear allocation strategy assert_raises "exec_on $HOST1 c1 $PING c2" assert_raises "exec_on $HOST1 c2 $PING c1" end_suite
#! /bin/bash . ./config.sh start_suite "Test Docker Network plugin with specified subnet" weave_on $HOST1 launch # using ssh rather than docker -H because CircleCI docker client is older $SSH $HOST1 docker network create --driver weavemesh --ipam-driver weavemesh --subnet 10.40.0.0/16 testsubnet $SSH $HOST1 docker run --name=c1 -dt --net=testsubnet --ip 10.40.0.1 $SMALL_IMAGE /bin/sh $SSH $HOST1 docker run --name=c2 -dt --net=testsubnet $SMALL_IMAGE /bin/sh assert "container_ip $HOST1 c1" "10.40.0.1" assert "container_ip $HOST1 c2" "10.40.0.2" # assuming linear allocation strategy assert_raises "exec_on $HOST1 c1 $PING c2" assert_raises "exec_on $HOST1 c2 $PING c1" $SSH $HOST1 docker rm -f c1 c2 $SSH $HOST1 docker network rm testsubnet end_suite
Add for travis the install of ruby bindings for kyotocabinet
if [[ "$POSTGIS" == "2.0" ]]; then echo "yes" | sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable fi sudo apt-get update sudo apt-get install -qq libgeos-dev libproj-dev postgresql-9.1-postgis liblzo2-dev liblzma-dev zlib1g-dev build-essential wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz tar xzf kyotocabinet-1.2.76.tar.gz cd kyotocabinet-1.2.76 ./configure –enable-zlib –enable-lzo –enable-lzma && make make install if [[ "$POSTGIS" == "2.0" ]]; then sudo apt-get install -qq libgeos++-dev fi
if [[ "$POSTGIS" == "2.0" ]]; then echo "yes" | sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable fi sudo apt-get update sudo apt-get install -qq libgeos-dev libproj-dev postgresql-9.1-postgis liblzo2-dev liblzma-dev zlib1g-dev build-essential # Se placer dans le dossier /tmp cd /tmp # Installer kyotocabinet wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz tar xzf kyotocabinet-1.2.76.tar.gz cd kyotocabinet-1.2.76 ./configure –enable-zlib –enable-lzo –enable-lzma && make make install # Installer les bindings ruby pour kyotocabinet wget http://fallabs.com/kyotocabinet/rubypkg/kyotocabinet-ruby-1.32.tar.gz cd kyotocabinet-ruby-1.32 ruby extconf.rb make ruby test.rb make install if [[ "$POSTGIS" == "2.0" ]]; then sudo apt-get install -qq libgeos++-dev fi
Fix and echo to debug
#!/bin/bash cd /opt/alaveteli rm -rf /opt/alaveteli/lib/acts_as_xapian/xapiandbs/production mkdir -p $XAPIAN_MOUNT_PATH/$RAILS_ENV ln -s /opt/alaveteli/lib/acts_as_xapian/xapiandbs/$RAILS_ENV $XAPIAN_MOUNT_PATH/$RAILS_ENV bundle exec rake db:create bundle exec rake db:migrate bundle exec rake themes:install bundle exec rake assets:precompile cp -rf /opt/alaveteli/public /data/alaveteli/public # Uncomment to rebuild the index on every launch of the container # bundle exec rake xapian:rebuild_index models="PublicBody User InfoRequestEvent" chown -R $(whoami) /data bundle exec unicorn_rails -c ./config/unicorn.rb
#!/bin/bash cd /opt/alaveteli rm -rf /opt/alaveteli/lib/acts_as_xapian/xapiandbs/production echo "making $XAPIAN_MOUNT_PATH/$RAILS_ENV" mkdir -p $XAPIAN_MOUNT_PATH/$RAILS_ENV echo "linkning $XAPIAN_MOUNT_PATH/$RAILS_ENV/ to /opt/alaveteli/lib/acts_as_xapian/xapiandbs/$RAILS_ENV/" ln -s $XAPIAN_MOUNT_PATH/$RAILS_ENV/ /opt/alaveteli/lib/acts_as_xapian/xapiandbs/$RAILS_ENV/ bundle exec rake db:create bundle exec rake db:migrate bundle exec rake themes:install bundle exec rake assets:precompile cp -rf /opt/alaveteli/public /data/alaveteli/public # Uncomment to rebuild the index on every launch of the container # bundle exec rake xapian:rebuild_index models="PublicBody User InfoRequestEvent" chown -R $(whoami) /data bundle exec unicorn_rails -c ./config/unicorn.rb
Fix for murano-agent test across CentOS and Ubuntu
#!/bin/bash . $(dirname $0)/../assert.sh ### murano-agent service is installed and not running (return code 3) assert_raises "service murano-agent status" 3 assert_end "murano-agent is installed and disabled"
#!/bin/bash . $(dirname $0)/../assert.sh ### murano-agent service is installed and not running (return code 3) assert_raises "systemctl status murano-agent" 3 assert_end "murano-agent is installed and disabled"
Fix release pipeline git detached head
#!/bin/bash echo -e "---\n:rubygems_api_key: $GEM_API_KEY" > ~/.gem/credentials chmod 0600 ~/.gem/credentials cd lf-git build_version=$(ruby -r ./lib/license_finder/version.rb -e "puts LicenseFinder::VERSION") built_gem="pkg/license_finder-$build_version.gem" git config --global user.email $GIT_EMAIL git config --global user.name $GIT_USERNAME git config --global push.default simple mkdir ~/.ssh ssh-keyscan github.com >> ~/.ssh/known_hosts eval "$(ssh-agent -s)" echo "$GIT_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-add -k ~/.ssh/id_rsa if [ -z "$(gem fetch license_finder -v $build_version 2>&1 | grep ERROR)" ]; then echo "LicenseFinder-$build_version already exists on Rubygems" else rake release fi export EXIT_STATUS=$? kill $(ps aux | grep ssh-agent | head -n 1 | awk '{print $2}') exit $EXIT_STATUS
#!/bin/bash echo -e "---\n:rubygems_api_key: $GEM_API_KEY" > ~/.gem/credentials chmod 0600 ~/.gem/credentials cd lf-git build_version=$(ruby -r ./lib/license_finder/version.rb -e "puts LicenseFinder::VERSION") built_gem="pkg/license_finder-$build_version.gem" git config --global user.email $GIT_EMAIL git config --global user.name $GIT_USERNAME git config --global push.default simple git chekcout master mkdir ~/.ssh ssh-keyscan github.com >> ~/.ssh/known_hosts eval "$(ssh-agent -s)" echo "$GIT_PRIVATE_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-add -k ~/.ssh/id_rsa if [ -z "$(gem fetch license_finder -v $build_version 2>&1 | grep ERROR)" ]; then echo "LicenseFinder-$build_version already exists on Rubygems" else rake release fi export EXIT_STATUS=$? kill $(ps aux | grep ssh-agent | head -n 1 | awk '{print $2}') exit $EXIT_STATUS
Speed up merge script: Only one network fetch
#!/bin/sh die() { echo Failed - stopping exit 1 } for br in $(git branch --list | grep -v master | sed 's/\*//' ) ; do [ -n "$br" ] && { echo On branch: $br git checkout $br || die git pull git merge master -m "Merge master branch" } done echo Checking out master git checkout master
#!/bin/sh die() { echo Failed - stopping exit 1 } echo Fetching from origin git fetch origin for br in $(git branch --list | grep -v master | sed 's/\*//' ) ; do [ -n "$br" ] && { git checkout $br || die echo -n "Merge origin/$br " ; git merge origin/$br echo -n "Merge master " ; git merge master -m "Merge master branch" } done echo Checking out master git checkout master
Call disease ontology import script
#!/bin/bash # Try to download premade database wget -O $ANNOTATOR_DB_PATH https://s3.amazonaws.com/bsve-integration/annotator.sqlitedb $GRITS_HOME/grits_env/bin/python -m annotator.sqlite_import_geonames && supervisord --nodaemon --config /etc/supervisor/supervisord.conf
#!/bin/bash # Try to download premade database wget -O $ANNOTATOR_DB_PATH https://s3.amazonaws.com/bsve-integration/annotator.sqlitedb ( $GRITS_HOME/grits_env/bin/python -m annotator.sqlite_import_disease_ontology && $GRITS_HOME/grits_env/bin/python -m annotator.sqlite_import_geonames && supervisord --nodaemon --config /etc/supervisor/supervisord.conf )
Build the specific tag instead of the branch head.
#!/bin/sh # This Shell Script will build and use the latest jMonkeyEngine git version, so there might be some undiscovered engine bugs, watch out! # Also if you want to revert to releases and bintray builds, you need to uninstall them from your local maven repo... echo "Downloading the Engine, this may take some time" git clone -b v3.1 --single-branch --depth 1 http://github.com/jMonkeyEngine/jMonkeyEngine/ engine # single-branch requires git > 1.7.10, if you see an error, just leave it out. git checkout v3.1.0-beta2 # tags/v3.1.0-beta2 cd engine #echo "Patching the Engine...." #patch -s -N -p 1 < ../patches/FixHWSkinningSerialization.diff echo "Building the Engine and installing them to your local maven repo...." ./gradlew install # Depends on jarJavadoc, jarSourcecode, assemble, dist etc. cd ../
#!/bin/sh # This Shell Script will build and use the latest jMonkeyEngine git version, so there might be some undiscovered engine bugs, watch out! # Also if you want to revert to releases and bintray builds, you need to uninstall them from your local maven repo... echo "Downloading the Engine, this may take some time" # To have the latest Commit on 3.1 use "-b v3.1". If you want a certain tag, use "-b v3.1.0-beta2" git clone -b v3.1.0-beta2 --single-branch --depth 1 http://github.com/jMonkeyEngine/jMonkeyEngine/ engine # single-branch requires git > 1.7.10, if you see an error, just leave it out. cd engine # git checkout tags/v3.1.0-beta2 # To use this, leave out depth and change -b to a branch. #echo "Patching the Engine...." #patch -s -N -p 1 < ../patches/FixHWSkinningSerialization.diff echo "Building the Engine and installing them to your local maven repo...." ./gradlew install # Depends on jarJavadoc, jarSourcecode, assemble, dist etc. cd ../
Update to 1.14.6 & refactor Plan.
pkg_name=bundler pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>" pkg_version=1.13.7 pkg_origin=core pkg_license=('bundler') pkg_source=nosuchfile.tar.gz pkg_description="The Ruby language dependency manager" pkg_upstream_url=https://bundler.io/ pkg_deps=(core/glibc core/ruby) pkg_build_deps=(core/ruby) pkg_lib_dirs=(lib) pkg_include_dirs=(include) pkg_bin_dirs=(bin vendor/bundle/bin) do_install() { export GEM_HOME=$pkg_prefix export GEM_PATH=$pkg_prefix gem install bundler -v ${pkg_version} --no-ri --no-rdoc } do_download() { return 0 } do_verify() { return 0 } do_unpack() { return 0 } do_prepare() { return 0 } do_build() { return 0 }
pkg_name=bundler pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>" pkg_version=1.14.6 pkg_origin=core pkg_license=('bundler') pkg_description="The Ruby language dependency manager" pkg_upstream_url=https://bundler.io/ pkg_deps=(core/ruby core/busybox-static) pkg_build_deps=() pkg_bin_dirs=(bin) do_prepare() { export GEM_HOME="$pkg_prefix" build_line "Setting GEM_HOME='$GEM_HOME'" export GEM_PATH="$GEM_HOME" build_line "Setting GEM_PATH='$GEM_PATH'" } do_build() { return 0 } do_install() { build_line "Installing from RubyGems" gem install "$pkg_name" -v "$pkg_version" --no-ri --no-rdoc # Note: We are not cleaning the gem cache as this artifact # is reused by other packages for speed. wrap_ruby_bin "$pkg_prefix/bin/bundle" wrap_ruby_bin "$pkg_prefix/bin/bundler" } wrap_ruby_bin() { local bin="$1" build_line "Adding wrapper $bin to ${bin}.real" mv -v "$bin" "${bin}.real" cat <<EOF > "$bin" #!$(pkg_path_for busybox-static)/bin/sh set -e if test -n "$DEBUG"; then set -x; fi export GEM_HOME="$GEM_HOME" export GEM_PATH="$GEM_PATH" unset RUBYOPT GEMRC exec $(pkg_path_for ruby)/bin/ruby ${bin}.real \$@ EOF chmod -v 755 "$bin" }
Fix line .gdbinit modification line
#!/bin/bash -ex if uname | grep -i Linux &>/dev/null; then sudo apt-get update sudo apt-get -y install python-dev python3-dev python-pip python3-pip libglib2.0-dev fi # Update all submodules git submodule update --init --recursive # Find the path to the Python interpreter used by GDB. PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)') # Install Python dependencies sudo $PYTHON -m pip install -Ur requirements.txt # Find the path to the Python2 interpreter needed by the Unicorn install process. export UNICORN_QEMU_FLAGS="--python=$(which python2)" # Install both Unicorn and Capstone for directory in capstone unicorn; do pushd $directory git clean -xdf sudo ./make.sh install cd bindings/python sudo ${PYTHON} setup.py install popd done # Load Pwndbg into GDB on every launch. if ! grep pwndbg ~/.gdbinit &>/dev/null; then echo "source $PWD/pwndbg/gdbinit.py" >> ~/.gdbinit fi
#!/bin/bash -ex if uname | grep -i Linux &>/dev/null; then sudo apt-get update sudo apt-get -y install python-dev python3-dev python-pip python3-pip libglib2.0-dev fi # Update all submodules git submodule update --init --recursive # Find the path to the Python interpreter used by GDB. PYTHON=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)') # Install Python dependencies sudo $PYTHON -m pip install -Ur requirements.txt # Find the path to the Python2 interpreter needed by the Unicorn install process. export UNICORN_QEMU_FLAGS="--python=$(which python2)" # Install both Unicorn and Capstone for directory in capstone unicorn; do pushd $directory git clean -xdf sudo ./make.sh install cd bindings/python sudo ${PYTHON} setup.py install popd done # Load Pwndbg into GDB on every launch. if ! grep pwndbg ~/.gdbinit &>/dev/null; then echo "source $PWD/gdbinit.py" >> ~/.gdbinit fi
Use Cori debug queue by default
# SCHED CORI # Scheduler settings for Swift/Cori # Tell Swift/T to generate and submit a SLURM script MACHINE="-m slurm" export QUEUE=${QUEUE:-regular} # export QUEUE=${QUEUE:-debug} # CANDLE at NERSC: export PROJECT=m2924 # This will be pasted into the SLURM script export TURBINE_DIRECTIVE="#SBATCH -C knl,quad,cache\n#SBATCH --license=SCRATCH" # export TURBINE_DIRECTIVE="#SBATCH --constraint=haswell\n#SBATCH --license=SCRATCH"
# SCHED CORI # Scheduler settings for Swift/Cori # Tell Swift/T to generate and submit a SLURM script MACHINE="-m slurm" # export QUEUE=${QUEUE:-regular} export QUEUE=${QUEUE:-debug} # CANDLE at NERSC: export PROJECT=m2924 # This will be pasted into the SLURM script export TURBINE_DIRECTIVE="#SBATCH -C knl,quad,cache\n#SBATCH --license=SCRATCH" # export TURBINE_DIRECTIVE="#SBATCH --constraint=haswell\n#SBATCH --license=SCRATCH"
Make gnatsd filename even more semver compliant
#!/usr/bin/env bash set -e -x -u export PATH=/usr/local/ruby/bin:/usr/local/go/bin:$PATH export GOPATH=$(pwd)/gopath base=`pwd` cd gopath/src/github.com/nats-io/gnatsd out="${base}/compiled-${GOOS}" semver=`grep "VERSION =" server/const.go | cut -d\" -f2` timestamp=`date -u +"%Y-%m-%dT%H:%M:%SZ"` git_rev=`git rev-parse --short HEAD` version="${semver}-${git_rev}-${timestamp}" filename="gnatsd-${version}-${GOOS}-${GOARCH}" echo "building ${filename} with version ${version}" sed -i "s/VERSION = \".*\"/VERSION = \"${version}\"/" server/const.go go build -o ${out}/${filename} github.com/nats-io/gnatsd
#!/usr/bin/env bash set -e -x -u export PATH=/usr/local/ruby/bin:/usr/local/go/bin:$PATH export GOPATH=$(pwd)/gopath base=`pwd` cd gopath/src/github.com/nats-io/gnatsd out="${base}/compiled-${GOOS}" semver=`grep "VERSION =" server/const.go | cut -d\" -f2` timestamp=`date -u +"%Y-%m-%dT%H_%M_%SZ"` git_rev=`git rev-parse --short HEAD` version="${semver}+${git_rev}-${timestamp}" filename="gnatsd-${version}-${GOOS}-${GOARCH}" echo "building ${filename} with version ${version}" sed -i "s/VERSION = \".*\"/VERSION = \"${version}\"/" server/const.go go build -o ${out}/${filename} github.com/nats-io/gnatsd
Change cursor size on resolution change
#!/bin/sh # Get the host width HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width') # Determine the DPI based on screen width if [ "$HOST_WIDTH" -eq "1920" ]; then X_DPI=96 fi if [ "$HOST_WIDTH" -eq "3840" ]; then X_DPI=192 fi # Reposition the desktop background ~/.fehbg & # If the DPI needs to be changed, change it if [ "$X_DPI" ]; then echo "Xft.dpi:$X_DPI" | xrdb -merge fi # Reload polybar with the new width / DPI ~/.config/polybar/launch.sh main &
#!/bin/sh # Get the host width HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width') CURSOR_THEME=${XCURSOR_THEME:-breeze_cursors} # Determine the DPI based on screen width if [ "$HOST_WIDTH" -eq "1920" ]; then X_DPI=96 fi if [ "$HOST_WIDTH" -eq "3840" ]; then X_DPI=192 fi # Reposition the desktop background ~/.fehbg & # If the DPI needs to be changed, change it if [ "$X_DPI" ]; then echo "Xft.dpi:$X_DPI" | xrdb -merge # Change the X cursor size as well # NOTE: For full effect, this needs to be used in combination with XCURSOR_SIZE. # NOTE: ($X_DPI / 6) here means that 4k will use cursor size 32, so it will appear # about half the size of the 1080p cursor. If this is not what you want, use # cursor size 64 instead. xsetroot -xcf "/usr/share/icons/$CURSOR_THEME/cursors/left_ptr" "$(($X_DPI / 6))" fi # Reload polybar with the new width / DPI ~/.config/polybar/launch.sh main &
Revert "try headless chrome instead of selenium2"
#!/usr/bin/env bash source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../bash/common.lib.sh" code=0 commands=( validate-composer validate-behat-features validate-doctrine-schema test-behat-with-javascript ) # test-phpspec # test-phpunit # test-fixtures # test-behat-without-javascript # # test-behat-with-cli for command in ${commands[@]}; do "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/script/${command}" || code=$? done exit ${code}
#!/usr/bin/env bash source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../../bash/common.lib.sh" code=0 commands=( validate-composer validate-behat-features validate-doctrine-schema test-phpspec test-phpunit test-fixtures test-behat-without-javascript test-behat-with-javascript test-behat-with-cli ) for command in ${commands[@]}; do "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/script/${command}" || code=$? done exit ${code}
Fix a little problem in BSD
#!/bin/sh # Install ZSH sudo pkg install -y zsh sudo chsh -s `which zsh` vagrant # Install git sudo pkg install -y git
#!/bin/sh # Install ZSH sudo pkg install -y zsh sudo chsh -s `which zsh` vagrant sudo ln -s /usr/local/bin/zsh /usr/bin/zsh # Install git sudo pkg install -y git
Deploy work.desktop file along with position script
#!/bin/bash echo "Deploy position to /usr/local/bin" sudo cp -prv position /usr/local/bin sudo chmod a+rx /usr/local/bin/position
#!/bin/bash echo "Deploy position to /usr/local/bin" sudo cp -pr position /usr/local/bin sudo chmod a+rx /usr/local/bin/position echo "Deploy GNOME desktop shortcut to call position" sudo cp -pr work.desktop /usr/share/applications
Add reminder about linking lua libs
set -e # sudo apt-get install libxpm-dev libxt-dev make clean ./configure --with-features=huge \ --enable-fail-if-missing \ --with-x \ --enable-multibyte \ --enable-rubyinterp=yes \ --disable-gui \ --enable-luainterp=yes \ --enable-pythoninterp=no \ --enable-python3interp=yes \ --with-python3-command=python3.6 \ # --enable-gtk2-check \ # --enable-gnome-check \ # --enable-gui=gnome2 \ # --enable-python3interp=yes \ # --with-python-config-dir=/usr/lib/python2.7/config \ # --with-python3-config-dir=/usr/lib/python3.5/config \ # --enable-perlinterp=yes \ # --enable-gui=gtk2 \ # --enable-cscope \ # --prefix=/usr # make VIMRUNTIMEDIR=/usr/share/vim/vim74/ make VIMRUNTIMEDIR=~/workspace/vim/runtime/ set +e
set -e # sudo apt-get install libxpm-dev libxt-dev # sudo ln -s /usr/include/lua5.3 /usr/include/lua # sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/local/lib/liblua.so make clean ./configure --with-features=huge \ --enable-fail-if-missing \ --with-x \ --enable-multibyte \ --enable-rubyinterp=yes \ --disable-gui \ --enable-luainterp=yes \ --enable-pythoninterp=no \ --enable-python3interp=yes \ --with-python3-command=python3.6 \ # --enable-gtk2-check \ # --enable-gnome-check \ # --enable-gui=gnome2 \ # --enable-python3interp=yes \ # --with-python-config-dir=/usr/lib/python2.7/config \ # --with-python3-config-dir=/usr/lib/python3.5/config \ # --enable-perlinterp=yes \ # --enable-gui=gtk2 \ # --enable-cscope \ # --prefix=/usr # make VIMRUNTIMEDIR=/usr/share/vim/vim74/ make VIMRUNTIMEDIR=~/workspace/vim/runtime/ set +e
Change to gc_precompile in tests
#!/bin/bash -xe export DISPLAY=:99 export GOVUK_APP_DOMAIN=test.gov.uk export GOVUK_ASSET_ROOT=http://static.test.gov.uk env # Generate directories for upload tests mkdir -p ./incoming-uploads mkdir -p ./clean-uploads mkdir -p ./attachment-cache time bundle install --path "${HOME}/bundles/${JOB_NAME}" --deployment time bundle exec rake db:create db:migrate db:test:prepare --trace RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:clean --trace RAILS_ENV=test CUCUMBER_FORMAT=progress time bundle exec rake ci:setup:minitest default test:cleanup --trace RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:precompile --trace EXIT_STATUS=$? echo "EXIT STATUS: $EXIT_STATUS" exit $EXIT_STATUS
#!/bin/bash -xe export DISPLAY=:99 export GOVUK_APP_DOMAIN=test.gov.uk export GOVUK_ASSET_ROOT=http://static.test.gov.uk env # Generate directories for upload tests mkdir -p ./incoming-uploads mkdir -p ./clean-uploads mkdir -p ./attachment-cache time bundle install --path "${HOME}/bundles/${JOB_NAME}" --deployment time bundle exec rake db:create db:migrate db:test:prepare --trace RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:clean --trace RAILS_ENV=test CUCUMBER_FORMAT=progress time bundle exec rake ci:setup:minitest default test:cleanup --trace RAILS_ENV=production SKIP_OBSERVERS_FOR_ASSET_TASKS=true time bundle exec rake assets:gc_precompile --trace EXIT_STATUS=$? echo "EXIT STATUS: $EXIT_STATUS" exit $EXIT_STATUS
Add OPAMYES=1 to opam depext
wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-ocaml.sh sh .travis-ocaml.sh eval `opam config env` opam pin add --yes -n $(pwd) opam install --yes depext opam depext libnqsb-tls opam install --deps-only --yes libnqsb-tls opam install --yes --verbose libnqsb-tls
wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-ocaml.sh sh .travis-ocaml.sh eval `opam config env` opam pin add --yes -n $(pwd) opam install --yes depext OPAMYES=1 opam depext libnqsb-tls opam install --deps-only --yes libnqsb-tls opam install --yes --verbose libnqsb-tls
Update the setup script to install tifffile
#!/usr/bin/env bash set -ex sh -e /etc/init.d/xvfb start sudo apt-get update WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/" pip install wheel flake8 coveralls nose pip uninstall -y numpy # on Python 2.7, use the system versions of numpy, scipy, and matplotlib # and the minimum version of cython and networkx if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then sudo apt-get install python-scipy python-matplotlib pip install https://github.com/cython/cython/archive/0.19.2.tar.gz pip install https://github.com/networkx/networkx/archive/networkx-1.8.tar.gz fi pip install -r requirements.txt $WHEELHOUSE python check_bento_build.py tools/header.py "Dependency versions" tools/build_versions.py
#!/usr/bin/env bash set -ex sh -e /etc/init.d/xvfb start sudo apt-get update WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/" pip install wheel flake8 coveralls nose pip uninstall -y numpy # on Python 2.7, use the system versions of numpy, scipy, and matplotlib # and the minimum version of cython and networkx if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then sudo apt-get install python-scipy python-matplotlib pip install https://github.com/cython/cython/archive/0.19.2.tar.gz pip install https://github.com/networkx/networkx/archive/networkx-1.8.tar.gz fi pip install $WHEELHOUSE numpy pip install tifffile pip install -r requirements.txt $WHEELHOUSE python check_bento_build.py tools/header.py "Dependency versions" tools/build_versions.py
Add flynn user and pass to cluster
#!/bin/bash -e REPO_URI="https://git.v6jv.flynnhub.com/ourcities-rebu-client-develop.git" if [[ "$CIRCLE_BRANCH" == "master" ]]; then REPO_URI="dokku@reboo.org:0-client" fi git fetch --unshallow origin git remote add deploy $REPO_URI GIT_SSL_NO_VERIFY=true git push -f deploy $CIRCLE_SHA1:refs/heads/master
#!/bin/bash -e REPO_URI="https://ubuntu:$FLYNN_KEY@git.v6jv.flynnhub.com/ourcities-rebu-client-develop.git" if [[ "$CIRCLE_BRANCH" == "master" ]]; then REPO_URI="dokku@reboo.org:0-client" fi git fetch --unshallow origin git remote add deploy $REPO_URI GIT_SSL_NO_VERIFY=true git push -f deploy $CIRCLE_SHA1:refs/heads/master
Remove env file after containers are stopped on sonar step
#!/bin/bash set +x cleanup() { rm -vf .env docker-compose -f docker-compose.builder.yml down --volumes } trap cleanup EXIT sudo rm -f .env curl -o .env -L https://raw.githubusercontent.com/OpenLMIS/openlmis-ref-distro/master/settings-sample.env sed -i '' -e "s#spring_profiles_active=.*#spring_profiles_active=#" .env 2>/dev/null || true sed -i '' -e "s#^BASE_URL=.*#BASE_URL=http://localhost#" .env 2>/dev/null || true sed -i '' -e "s#^VIRTUAL_HOST=.*#VIRTUAL_HOST=localhost#" .env 2>/dev/null || true SONAR_LOGIN_TEMP=$(echo $SONAR_LOGIN | cut -f2 -d=) SONAR_PASSWORD_TEMP=$(echo $SONAR_PASSWORD | cut -f2 -d=) echo "SONAR_LOGIN=$SONAR_LOGIN_TEMP" >> .env echo "SONAR_PASSWORD=$SONAR_PASSWORD_TEMP" >> .env echo "SONAR_BRANCH=$GIT_BRANCH" >> .env docker-compose -f docker-compose.builder.yml run sonar
#!/bin/bash set +x cleanup() { docker-compose -f docker-compose.builder.yml down --volumes rm -vf .env } trap cleanup EXIT sudo rm -f .env curl -o .env -L https://raw.githubusercontent.com/OpenLMIS/openlmis-ref-distro/master/settings-sample.env sed -i '' -e "s#spring_profiles_active=.*#spring_profiles_active=#" .env 2>/dev/null || true sed -i '' -e "s#^BASE_URL=.*#BASE_URL=http://localhost#" .env 2>/dev/null || true sed -i '' -e "s#^VIRTUAL_HOST=.*#VIRTUAL_HOST=localhost#" .env 2>/dev/null || true SONAR_LOGIN_TEMP=$(echo $SONAR_LOGIN | cut -f2 -d=) SONAR_PASSWORD_TEMP=$(echo $SONAR_PASSWORD | cut -f2 -d=) echo "SONAR_LOGIN=$SONAR_LOGIN_TEMP" >> .env echo "SONAR_PASSWORD=$SONAR_PASSWORD_TEMP" >> .env echo "SONAR_BRANCH=$GIT_BRANCH" >> .env docker-compose -f docker-compose.builder.yml run sonar
Make the travis script runnable locally
#!/bin/bash set -e export DISPLAY=:99.0 sh -e /etc/init.d/xvfb start npm run clean npm run build npm test npm run test:coverage export PATH="$HOME/miniconda/bin:$PATH" npm run build:example npm run docs
#!/bin/bash set -e export DISPLAY=:99.0 sh -e /etc/init.d/xvfb start || true npm run clean npm run build npm test npm run test:coverage export PATH="$HOME/miniconda/bin:$PATH" npm run build:example npm run docs
Set keychain to be the default
#!/usr/bin/env bash echo "Create keychain" security create-keychain -p $CERTIFICATE_PASSWORD electron-app-build.keychain KEYCHAIN=~/Library/Keychains/electron-app-build.keychain echo "Adding distribution key" security import resource/cert.p12 -k $KEYCHAIN -P $KEY_PASSWORD -T /usr/bin/codesign echo "Unlock keychain" security unlock-keychain -p $CERTIFICATE_PASSWORD electron-app-build.keychain echo "Increase keychain unlock timeout" security set-keychain-settings -lut 7200 electron-app-build.keychain echo "Add keychain to keychain-list" security list-keychains -s electron-app-build.keychain
#!/usr/bin/env bash echo "Create keychain" security create-keychain -p $CERTIFICATE_PASSWORD electron-app-build.keychain security default-keychain -s electron-app-build.keychain KEYCHAIN=~/Library/Keychains/electron-app-build.keychain echo "Adding distribution key" security import resource/cert.p12 -k $KEYCHAIN -P $KEY_PASSWORD -T /usr/bin/codesign echo "Unlock keychain" security unlock-keychain -p $CERTIFICATE_PASSWORD electron-app-build.keychain echo "Increase keychain unlock timeout" security set-keychain-settings -lut 3600 electron-app-build.keychain echo "Add keychain to keychain-list" security list-keychains -s electron-app-build.keychain
Use my own alias for ls instead of oh-my-zsh.
# Changing/making/removing directory setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus alias -g ...='../..' alias -g ....='../../..' alias -g .....='../../../..' alias -g ......='../../../../..' alias -- -='cd -' alias 1='cd -' alias 2='cd -2' alias 3='cd -3' alias 4='cd -4' alias 5='cd -5' alias 6='cd -6' alias 7='cd -7' alias 8='cd -8' alias 9='cd -9' alias md='mkdir -p' alias rd=rmdir function d () { if [[ -n $1 ]]; then dirs "$@" else dirs -v | head -10 fi } compdef _dirs d # List directory contents alias lsa='ls -lah' alias l='ls -lah' alias ll='ls -lh' alias la='ls -lAh'
# Changing/making/removing directory setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus alias -g ...='../..' alias -g ....='../../..' alias -g .....='../../../..' alias -g ......='../../../../..' alias -- -='cd -' alias 1='cd -' alias 2='cd -2' alias 3='cd -3' alias 4='cd -4' alias 5='cd -5' alias 6='cd -6' alias 7='cd -7' alias 8='cd -8' alias 9='cd -9' alias md='mkdir -p' alias rd=rmdir function d () { if [[ -n $1 ]]; then dirs "$@" else dirs -v | head -10 fi } compdef _dirs d
Use pane view by default
# 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 pane view by default. Folders can override :( defaults write com.apple.Finder FXPreferredViewStyle clmv # Show the ~/Library folder chflags nohidden ~/Library
Add scrot as arch default package
#!/bin/bash sudo pacman -S git \ py3status \ tmux \ neovim \ python-pynvim \ python \ cmake \ go \ go-tools \ npm \ mono \ alacritty \ fzf \ light # Uncomment this if using regular arch linux #sudo pacman -Sy i3-wm #sudo pacman -Sy dmenu ## install yay #cd /opt #sudo git clone https://aur.archlinux.org/yay-git.git #sudo chown -R $USERNAME:$USERNAME /yay-git #cd yay-git #makepkg -si yay -S autojump
#!/bin/bash sudo pacman -S git \ tmux \ neovim \ python-pynvim \ python \ cmake \ go \ go-tools \ npm \ mono \ alacritty \ fzf \ scrot \ light # Uncomment this if using regular arch linux #sudo pacman -Sy i3-wm #sudo pacman -Sy dmenu ## install yay #cd /opt #sudo git clone https://aur.archlinux.org/yay-git.git #sudo chown -R $USERNAME:$USERNAME /yay-git #cd yay-git #makepkg -si yay -S autojump
Use 'which' to find the path of python
#!/bin/sh SSH_DIR=/etc/ssh RC_TMP_FILE="/tmp/installer.rc.tmp.$$" RC_SCRIPT_FILE='/etc/rc' RC_BACKUP_FILE='/etc/rc.orig' RC_STARTLINE=`cat -n $RC_SCRIPT_FILE | awk '/rc.subr/ { print $1 }'` RC_ENDLINE=`cat -n $RC_SCRIPT_FILE | tail -n 1 | awk '{ print $1 }'` BSDINIT_URL="https://github.com/pellaeon/bsd-cloudinit/archive/master.tar.gz" [ ! -x "/usr/local/bin/python2.7" ] && { echo 'python2.7 Not Found !' exit 1 } PYTHON="/usr/local/bin/python2.7" fetch -o - $BSDINIT_URL | tar -xzvf - -C '/root' rm -vf $SSH_DIR/ssh_host* touch $RC_TMP_FILE cp -pvf $RC_SCRIPT_FILE $RC_BACKUP_FILE head -n $RC_STARTLINE $RC_SCRIPT_FILE > $RC_TMP_FILE echo "(cd /root/bsd-cloudinit-master/ && $PYTHON ./cloudinit && cp -pvf $RC_BACKUP_FILE $RC_SCRIPT_FILE )" >> $RC_TMP_FILE tail -n `expr $RC_ENDLINE - $RC_STARTLINE` $RC_SCRIPT_FILE >> $RC_TMP_FILE cp -pvf $RC_TMP_FILE $RC_SCRIPT_FILE
#!/bin/sh SSH_DIR=/etc/ssh RC_TMP_FILE="/tmp/installer.rc.tmp.$$" RC_SCRIPT_FILE='/etc/rc' RC_BACKUP_FILE='/etc/rc.orig' RC_STARTLINE=`cat -n $RC_SCRIPT_FILE | awk '/rc.subr/ { print $1 }'` RC_ENDLINE=`cat -n $RC_SCRIPT_FILE | tail -n 1 | awk '{ print $1 }'` BSDINIT_URL="https://github.com/pellaeon/bsd-cloudinit/archive/master.tar.gz" [ ! `which python2.7` ] && { echo 'python2.7 Not Found !' exit 1 } PYTHON=`which python2.7` fetch -o - $BSDINIT_URL | tar -xzvf - -C '/root' rm -vf $SSH_DIR/ssh_host* touch $RC_TMP_FILE cp -pvf $RC_SCRIPT_FILE $RC_BACKUP_FILE head -n $RC_STARTLINE $RC_SCRIPT_FILE > $RC_TMP_FILE echo "(cd /root/bsd-cloudinit-master/ && $PYTHON ./cloudinit && cp -pvf $RC_BACKUP_FILE $RC_SCRIPT_FILE )" >> $RC_TMP_FILE tail -n `expr $RC_ENDLINE - $RC_STARTLINE` $RC_SCRIPT_FILE >> $RC_TMP_FILE cp -pvf $RC_TMP_FILE $RC_SCRIPT_FILE
Add section to setup WiFi
#!/usr/bin/env bash # # This script is intended to be used to install and configure an Arch Linux # automatically with minimal user interaction. Certain configurations are # personal preference and may be adapted. # # The contents of this script are derived from the installation guide provided # by https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger #
#!/usr/bin/env bash # # This script is intended to be used to install and configure an Arch Linux # automatically with minimal user interaction. Certain configurations are # personal preference and may be adapted. # # The contents of this script are derived from the installation guide provided # by https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger # ## Use correct keyboard layout for my German laptop in case of user interaction loadskeys /usr/share/kbd/keymaps/i386/qwertz/de-mobii.map.gz ## Setup WiFi ip link echo "Which WiFi interface do you want to use?" echo read WIFI_ADAPTER echo "What is the SSID of the network?" echo read SSID echo "What is the password for the network?" echo read -s WIFI_PASSWORD # Use provided logins to connect to the network with the specified WiFi adapter. # Selected device driver is 'wext' because of wider support. wpa_passphrase ${SSID} ${WIFI_PASSWORD} > /etc/wpa_supplicant/wpa_supplicant.conf wpa_supplicant -i ${WIFI_ADAPTER} -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf -B dhcpcd ${WIFI_ADAPTER} # Alternatively 'wifi-menu' can be used # wifi-menu
Update cert for all services
#!/bin/sh /usr/local/bin/cbsd jstart letsencrypt /usr/local/bin/cbsd jexec jname=letsencrypt /usr/local/bin/letsencrypt_update.sh /usr/local/bin/cbsd jstop letsencrypt /usr/local/bin/cbsd jexec jname=ldap /usr/local/bin/update_certs.sh /usr/local/bin/cbsd jexec jname=jabber /usr/local/bin/update_certs.sh /usr/local/bin/cbsd jexec jname=nginx /usr/sbin/service nginx reload
#!/bin/sh /usr/local/bin/cbsd jstart letsencrypt /usr/local/bin/cbsd jexec jname=letsencrypt /usr/local/bin/letsencrypt_update.sh /usr/local/bin/cbsd jstop letsencrypt /usr/local/bin/cbsd jexec jname=ldap /usr/local/bin/update_certs.sh /usr/local/bin/cbsd jexec jname=jabber /usr/local/bin/update_certs.sh /usr/local/bin/cbsd jexec jname=mail /usr/sbin/service postfix reload /usr/local/bin/cbsd jexec jname=mail /usr/sbin/service dovecot reload /usr/local/bin/cbsd jexec jname=nginx /usr/sbin/service nginx reload