google console build - add script for building gitian on console unattended

#!/bin/bash
STARTTIMEID=$(date +%s)
ENFORCEDSTOP="180" # in minutes, default is 180 minutes, 3 hours
# gcloud vars
NAME="gitiantmp"
IMAGE="gitian-debian10" # ubuntu-minimal-1804-bionic-v20191217
DISKSIZE="60"   # In GB
IMAGEFAMILY="debian-10"
IMAGEPROJECT="debian-cloud"
ZONE="europe-west1-b"
CUSTOMCPU="6"
CUSTOMMEMORY=$(($CUSTOMCPU*1000+500))
CUSTOMVMTYPE="n2" # n1: Skylake or older (default), n2: VM's with CPU platform Cascade Lake(2-80vCPUs, 1-640GBs)
#MACHINETYPE="n1-highcpu-$CPUS" # please ensure that machine is available
DISKTYPE="ssd" # SCSI SSD
METADATAFILESTARTUP="metadata.startup.meta" # filepath
METADATASSHKEYSFILE="metadata.sshkeys.meta" # filepath

# ssh - will be added to console as default key
MYSSHKEY="id_ecdsa_ionian_official_releases_ecdsa_521b"

# GPG
KEYTYPE="RSA"
KEYLENGTH="4096"
SUBKEYTYPE="RSA"
SUBKEYLENGTH="4096"
YOURNAME="Gitian User"
COMMENT="Automatic build process ID $STARTTIMEID"
EMAIL="gitianuser@i2pmail.org"
EXPIREDATE="0"
USERNAME="gitianuser"

# gitian
SIGNER="RANDOMAUTOCREATION"
PREVIOUSVER="4.0.00"
VERSION="5.0.99"
# optional settings
SERVER="defaultuploadserver"
HASH="256"                    # hash new files
UPLOADFOLDER="ion-binaries"      # folder on UPLOAD server (will be created if not existing)
JOBS="$CUSTOMCPU"                         # number of jobs, default: 2
MEMORY=$(($CUSTOMMEMORY-500))                    # RAM to be used, default: 2000
OS="m"				            # default: lwm
GITURL="git@bitbucket.org/ioncoin/ion.git"
GITIANOPTS="--os $OS --jobs $JOBS --memory $MEMORY --detach-sign --no-commit --build --no-upload --hash $HASH --previousver $PREVIOUSVER"

# gitian SSH/UPLOAD
# ssh upload server (required for .ssh/config creation)
MYSSHUPLOADKEY="$MYSSHKEY"
SSHUPLOADKEYPRIVATE=$(cat < $HOME/.ssh/$MYSSHUPLOADKEY)
SSHUPLOADKEYPUBLIC=$(cat < $HOME/.ssh/$MYSSHUPLOADKEY.pub)
UPLOADHOST="123.123.123.123"
UPLOADHOSTPORT="2222"
UPLOADHOSTUSER="someuser"
UPLOADHOSTIDENTITY="~/.ssh/$MYSSHUPLOADKEY"
UPLOADHOSTRSA=$(ssh-keyscan -t rsa $UPLOADHOST)

# metadata
## metadata - ssh keys
## get upload private and public keys (ensure please that those are without password before using them)
SSHUPLOADKEYPRIVATE=$(cat < $HOME/.ssh/$MYSSHUPLOADKEY)
SSHUPLOADKEYPUBLIC=$(cat < $HOME/.ssh/$MYSSHUPLOADKEY.pub)
## metadata -ssh uploadserver keys
## add additional public keys (if some other ssh key requires access, example build monitoring)
### add new keys in format:  USER:YOURPUBLICKEY      with user you define to which user this key should be assigned
SSHKEYS=$(SSHKEYS=$(cat < $HOME/.ssh/$MYSSHKEY.pub) && echo "gitianuser:$SSHKEYS")
cat <<EOF | tee $METADATASSHKEYSFILE
gitianuser:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDa2RhUaA6nnl25WsY7tF7XZsx8fdUbtOejnL/htTuKEY6EoqDat222sLVyKpaoxssC3P5oPSTegQKlY9mRng4M4xBMIUsTMuwCVyuqglRbIoRTTibFTCMHjGGZUD6vX9iR35+6TF/ZycIzMSoah3WvJ5uIvo1yEVwOsipeJ5+xHAqduku+VQU5A7n4iyYacvu83aVj2VaHuxOZ3tCnmNBqNM058+PR4fK7oP0OPIMzwQVjXtU2dc7gT//oRxUYyGWGCDH2vD926p9BSczyDz2tUOPCSE0IMTedffSIbOZ89NAS10HrAfNOgy+KMtVBigUiFHe4QVpDHoBz8wM860hL fonebonea@cs-6000-devshell-vm-d7157bac-93fd-4e31-b9d5-15f2ce4ecb47
gitianuser:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDs2SGZCHmw/7g3tHnfYaGcgkdN6oGdJyxYE5mVVnmEwaEcVNSqhKLa5Mg+2tak0eumKIv1u0+SgXMUpUE5Ft0En9LBOg1sOUGA5gz5riHVFoI7VQBKFKq2mrUWzKmQFoOKn23Ss4lK6ojVeOAtK/YUyWaTaEfhRNVuOoEmc4DK25tAlfSDpwUG8OK18uBPeSg/VVOffz06ISGhVUnOhTNDrx26bhSUlHQz7aYx93t5h/qf5TdkxkS8YGtCfMBrP2Qy3wwimidkzRs508XGVSA87dGww3Q4ofScy6slSVcZ+bGojn9oBbODpaIyNq/O/aFu2fc/XRk4uGC9aUpGpWel ckti@gitian-clean
$SSHKEYS
EOF

## metadata - startup script
cat <<EOF | tee $METADATAFILESTARTUP
# update system
sudo apt-get update && sudo apt-get upgrade -y

# go to gitianuser's home
cd $(sudo -i -u $USERNAME echo \$HOME)
sudo -i -u $USERNAME git clone --recurse-submodules http://bitbucket.org/ioncoin/ion.git
sudo -i -u $USERNAME cp ion/contrib/gitian-build.py gitian-build.py ./
sudo -i -u $USERNAME cp ion/contrib/gitian-additional-scripts/build-and-upload.sh ./
sudo -i -u $USERNAME cp ion/contrib/gitian-additional-scripts/create-new-gpg-nopassword.sh ./

sudo -i -u $USERNAME sed -i "s/RSA/$KEYTYPE/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/4096/$KEYLENGTH/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/RSA/$SUBKEYTYPE/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/4096/$SUBKEYLENGTH/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/Your Name/$YOURNAME/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/Some comment/$COMMENT/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/your@email.com/$EMAIL/" ./create-new-gpg-nopassword.sh
sudo -i -u $USERNAME sed -i "s/yourusername/$USERNAME/" ./create-new-gpg-nopassword.sh

sudo -i -u $USERNAME ./create-new-gpg-nopassword.sh

# get long and short key-id's
SIGNERLONG=$(sudo -i -u $USERNAME gpg --list-secret-keys --keyid-format LONG | awk 'NR>1{print $2}' | awk -F '[/]' '{print $2}')
SIGNERSHORT=$(sudo -i -u $USERNAME gpg --list-secret-keys --keyid-format SHORT | awk 'NR>1{print $2}' | awk -F '[/]' '{print $2}')

# add ssh upload keys for gitianuser
sudo -i -u $USERNAME echo "$SSHUPLOADKEYPRIVATE" > /home/$USERNAME/.ssh/$MYSSHUPLOADKEY
sudo -i -u $USERNAME echo "$SSHUPLOADKEYPUBLIC" > /home/$USERNAME/.ssh/$MYSSHUPLOADKEY.pub

## allow gitianuser to connect to upload server
echo "$UPLOADHOSTRSA" | sudo -i -u $USERNAME tee -a /home/$USERNAME/.ssh/known_hosts

## ensure that .ssh folder exists
sudo -i -u $USERNAME mkdir -p /home/$USERNAME/.ssh
### create ssh config for gitianuser
sudo -i -u $USERNAME echo "host defaultuploadserver
    Hostname $UPLOADHOST
    port $UPLOADHOSTPORT
    PreferredAuthentications publickey
    IdentityFile $UPLOADHOSTIDENTITY
    User $UPLOADHOSTUSER" > /home/$USERNAME/.ssh/config

## allow current user to connecto to upload server
mkdir -p ~/.ssh
## add ssh upload keys for gitianuser
echo "$SSHUPLOADKEYPRIVATE" > ~/.ssh/$MYSSHUPLOADKEY
echo "$SSHUPLOADKEYPUBLIC" > ~/.ssh/$MYSSHUPLOADKEY.pub
echo "$UPLOADHOSTRSA" | tee -a ~/.ssh/known_hosts

# set gitian build vars
export SIGNER="$SIGNERLONG"            # signer key-id, we use long ID in this script, short ID for filenames
export VERSION="$VERSION"              # ion core version
export PREVIOUSVER="$PREVIOUSVER"      # required for release notes, this can be a commit or a tag
# optional settings
export SERVER="$SERVER"                # server ip/hostname
export HASH="$HASH"                    # hash new files
export UPLOADFOLDER="$UPLOADFOLDER"    # folder on UPLOAD server (will be created if not existing)
export JOBS="$JOBS"                    # number of jobs, default: 2
export MEMORY="$MEMORY"                # RAM to be used, default: 2000
export OS="$OS"				           # default: lwm

sudo -i -u $USERNAME gpg --export-secret-key -a $SIGNERLONG > $SIGNERSHORT-$EMAIL.private.asc
sudo -i -u $USERNAME gpg --export -a $SIGNERLONG > $SIGNERSHORT-$EMAIL.public.asc
sudo -i -u $USERNAME gpg --export-secret-key $SIGNERLONG > $SIGNERSHORT-$EMAIL.private.gpg
sudo -i -u $USERNAME gpg --export $SIGNERLONG > $SIGNERSHORT-$EMAIL.public.gpg

sudo -i -u $USERNAME gpg --export -a $SIGNERLONG > $SIGNERSHORT-$EMAIL.keybundle.asc
sudo -i -u $USERNAME gpg --export-secret-key -a $SIGNERLONG >> $SIGNERSHORT-$EMAIL.keybundle.asc
sudo -i -u $USERNAME gpg --export $SIGNERLONG > $SIGNERSHORT-$EMAIL.keybundle.gpg
sudo -i -u $USERNAME gpg --export-secret-key $SIGNERLONG >> $SIGNERSHORT-$EMAIL.keybundle.gpg

# build ion-core
sudo -i -u $USERNAME ./gitian-build.py "$GITIANOPTS" "$SIGNER" "$VERSION" | sudo -i -u $USERNAME tee ./gitian-build-${STARTTIMEID}.log

# shutdown
shutdown -h now
EOF

consolestopandremove() {
    ssh-keygen -f "$HOME/.ssh/known_hosts" -R "$IPADDRESS"
    ssh gitianuser@$IPADDRESS

    gcloud compute instances stop $NAME --zone $ZONE
    echo DELETING
    echo "Y" | gcloud compute instances delete $NAME --zone $ZONE
    # create image with external ip accessable over ssh
    #gcloud compute instances create $NAME --zone $ZONE --custom-extensions --custom-cpu=$CUSTOMCPU --custom-memory=$CUSTOMMEMORY --custom-vm-type=$CUSTOMVMTYPE --image-family $IMAGEFAMILY --image-project $IMAGEPROJECT --boot-disk-device-name=$NAME --boot-disk-size=${DISKSIZE}GB --metadata-from-file=startup-script=$METADATAFILESTARTUP,ssh-keys=$METADATASSHKEYSFILE --preemptible
}

# create from prepared image
consolecreateandstart () {
    gcloud compute instances create $NAME --zone $ZONE \
        --custom-extensions --custom-cpu=$CUSTOMCPU --custom-memory=$CUSTOMMEMORY --custom-vm-type=$CUSTOMVMTYPE \
        --image $IMAGE \
        --boot-disk-device-name=$NAME --boot-disk-size=${DISKSIZE}GB \
        --metadata-from-file=startup-script=$METADATAFILESTARTUP,ssh-keys=$METADATASSHKEYSFILE \
        --preemptible

    echo "# how to shutdown enforeced (copy and paste):
    gcloud compute instances stop $NAME --zone $ZONE
    echo DELETING
    echo 'Y' | gcloud compute instances delete $NAME --zone $ZONE"
}

## CREATE AND START CONSOLE ##
STARTVMID=$(date +%s)
consolecreateandstart

# if preemptable
IPADDRESS=$(gcloud compute instances list | grep $NAME | awk '{print $6}')
# if not preemptable
#IPADDRESS=$(gcloud compute instances list | grep $NAME | awk '{print $5}')

ssh-keygen -f $HOME/.ssh/known_hosts -R $IPADDRESS
#ssh gitianuser@$IPADDRESS

# if preemptable
VMSTATUS=$(gcloud compute instances list | grep $NAME | awk '{print $7}')
# if not preemptable
#VMSTATUS=$(gcloud compute instances list | grep $NAME | awk '{print $6}')

REFRESHRATE="60"
while [ $VMSTATUS = "RUNNING" ]
do
  VMSTATUS=$(gcloud compute instances list | grep $NAME | awk '{print $7}')
  # if not preemptable
  #VMSTATUS=$(gcloud compute instances list | grep $NAME | awk '{print $6}')
  if [ $VMSTATUS = "TERMINATED" ]; then
    echo "VM $NAME finished, terminating and deleting..."
    consolestopandremove
    break
  fi
  # check if current time is greater than max allowed, stop and delete VM in that case
  CURRENTTIME=$(date +%s)
  ENFORCEDSTOPTIME=$(($STARTVMID + $(($ENFORCEDSTOP*60))))
  if [[ $CURRENTTIME -gt $ENFORCEDSTOPTIME ]]; then
    echo "VM $NAME reaching max runtime, terminating and deleting..."
    consolestopandremove
    break
  fi
  sleep $REFRESHRATE
done

BUILDTIMESINCESCRIPTSTART=$(( $(date +%s) - $STARTTIMEID ))
BUILDTIMESINCEVMCREATION=""
echo "##### RUNTIME SUMMARY #####"
echo "Script started: $STARTTIMEID"
echo "Script runtime: $BUILDTIMESINCESCRIPTSTART)"

error: pathspec 'contrib/gitian-additional-scripts/build-on-console.sh' did not match any file(s) known to git


[master] Use CLOBBER

[master] Use CLOBBER

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hotpxl/colonise.git/'


RawSpeed: fix build. (#997)

RawSpeed: fix build. (#997)

During introduction of more fuzz targets, i did some CMake cleanup,
namely adding of helper library. And unfortunately i did not think
about the LIB_FUZZING_ENGINE env variable, thus the oss-fuzz build
has failed.

So some more cleanup was needed
(darktable-org/rawspeed@986d605935bb5fbf2b83c358f91c557210b28c43),
and as the consequences, this small build.sh change is needed too.

I did check locally, this does fix the build.
Please merge :)

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/robertswiecki/oss-fuzz.git/'


more fuzz targets for libc++

more fuzz targets for libc++


Replace option, easier here

Replace option, easier here

#!/usr/bin/env bash

# script to start from avram when collection selected for syncing collection
# to production couchdb
# queue_sync_couchdb.bash <url-to-collection-registry-api>

if [[ -n "$DEBUG" ]]; then
  set -x
fi

set -o pipefail  # trace ERR through pipes
set -o errtrace  # trace ERR through 'time command' and other functions
set -o nounset   ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit   ## set -e : exit the script if any statement returns a non-true return value

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # http://stackoverflow.com/questions/59895
cd $DIR

. ~/.harvester-env
if [ -f ./bin/activate ]; then
set +u
. ./bin/activate
set -o nounset   ## set -u : exit the script if you try to use an uninitialised variable
elif [ -f ~/workers_local/bin/activate ]; then
set +u
. ~/workers_local/bin/activate
set -o nounset   ## set -u : exit the script if you try to use an uninitialised variable
else
    echo "NO ./bin/activate. You need to run \"virtualenv .\" . ./bin/activate"
    #exit 13;
fi
# 24hr timeout = 86400 secs
python scripts/queue_deep_harvest.py --replace ${@:1}

error: pathspec 'queue_deep_harvest_replace.sh' did not match any file(s) known to git


Work on specific openshift project

Work on specific openshift project

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/stzilli/kapua.git/'


Create install-opencv.sh

Create install-opencv.sh

######################################
# INSTALL OPENCV ON UBUNTU OR DEBIAN #
######################################

# |         THIS SCRIPT IS TESTED CORRECTLY ON         |
# |----------------------------------------------------|
# | OS             | OpenCV       | Test | Last test   |
# |----------------|--------------|------|-------------|
# | Ubuntu 16.04.2 | OpenCV 3.2.0 | OK   | 20 May 2017 |
# | Debian 8.8     | OpenCV 3.2.0 | OK   | 20 May 2017 |
# | Debian 9.0     | OpenCV 3.2.0 | OK   | 25 Jun 2017 |

# 1. KEEP UBUNTU OR DEBIAN UP TO DATE

sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove

# 2. INSTALL THE DEPENDENCIES

# Build tools:
sudo apt-get install -y build-essential cmake

# GUI (if you want to use GTK instead of Qt, replace 'qt5-default' with 'libgtkglext1-dev' and remove '-DWITH_QT=ON' option in CMake):
sudo apt-get install -y qt5-default libvtk6-dev

# Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev

# Video I/O:
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev

# Parallelism and linear algebra libraries:
sudo apt-get install -y libtbb-dev libeigen3-dev

# Python:
sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy

# Java:
sudo apt-get install -y ant default-jdk

# Documentation:
sudo apt-get install -y doxygen

# 3. INSTALL THE LIBRARY (YOU CAN CHANGE '3.2.0' FOR THE LAST STABLE VERSION)

sudo apt-get install -y unzip wget
wget https://github.com/opencv/opencv/archive/3.2.0.zip
unzip 3.2.0.zip
rm 3.2.0.zip
#mv opencv-3.2.0 OpenCV
#cd OpenCV
cd opencv-3.2.0
mkdir build
cd build
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
make -j3
sudo make install
sudo ldconfig

# 4. EXECUTE SOME OPENCV EXAMPLES AND COMPILE A DEMONSTRATION

# To complete this step, please visit 'http://milq.github.io/install-opencv-ubuntu-debian'.

error: pathspec 'learn_stem/machine_learning/opencv/install-opencv.sh' did not match any file(s) known to git


easier copy-paste posts

easier copy-paste posts

#!/bin/bash
# From https://gist.github.com/xapax/1c150ac42fc48f09a67c68e4841ed364

filename=$(basename "$1")
dirname=$(dirname "$1")

extension="${filename##*.}"
filename_without_extension="${filename%.*}"

sed -i -e 's/<p>//g' $1
sed -i -e 's/<\/p>/\n/g' $1

sed -i -e 's/<h1>/# /g' $1
sed -i -e 's/<\/h1>//g' $1

sed -i -e 's/<h2>/## /g' $1
sed -i -e 's/<\/h2>//g' $1

sed -i -e 's/<h3>/### /g' $1
sed -i -e 's/<\/h3>//g' $1

sed -i -e 's/<h4>/#### /g' $1
sed -i -e 's/<\/h4>//g' $1

sed -i -e 's/<strong>/**/g' $1
sed -i -e 's/<\/strong>/**/g' $1
sed -i -e 's/<br \/>//g' $1

sed -i -e 's/<ul>//g' $1
sed -i -e 's/<\/ul>//g' $1

sed -i -e 's/<ol>//g' $1
sed -i -e 's/<\/ol>//g' $1

sed -i -e 's/<li>/- /g' $1
sed -i -e 's/<\/li>//g' $1

sed -i -e 's/<pre>/```\n/g' $1
sed -i -e 's/<\/pre>/```\n/g' $1

sed -i -e 's/<a href="/[](/g' $1
sed -i -e 's/<\/a>//g' $1

sed -i -e 's/&/\&/g' $1
sed -i -e 's/"/"/g' $1
sed -i -e 's/>/>/g' $1
sed -i -e 's/</</g' $1
sed -i -e 's/ //g' $1

sed -i -e 's/\[code\]/```/g' $1
sed -i -e 's/\[\/code\]/```/g' $1
sed -i -e 's/\[code lang="javascript"\]/```javascript/g' $1
sed -i -e 's/\[code lang="bash"\]/```bash/g' $1
sed -i -e 's/\[code lang="php"\]/```php/g' $1
sed -i -e 's/\[code lang="python"\]/```python/g' $1
sed -i -e 's/\[code lang="html"\]/```html/g' $1
sed -i -e 's/\[code lang="js"\]/```javascript/g' $1
sed -i -e 's/\[code lang="c"\]/```c/g' $1
sed -i -e 's/\[code lang="jade"\]/```jade/g' $1
sed -i -e 's/\[code lang="css"\]/```css/g' $1

sed -i -e 's/\[code language="html"\]/```html/g' $1
sed -i -e 's/\[code language="js"\]/```javascript/g' $1
sed -i -e 's/\[code language="php"\]/```php/g' $1
sed -i -e 's/\[code language="css"\]/```css/g' $1
sed -i -e 's/\[code language="bash"\]/```bash/g' $1

sed -i -e 's/<code>/```/g' $1
sed -i -e 's/<\/code>/```/g' $1

error: pathspec 'convert-html-markdown.sh' did not match any file(s) known to git


Update osm_extracts_update.sh

Update osm_extracts_update.sh

#!/bin/bash
#==========##========#
USER=admin
PASS=geoserver
GS='http://localhost:8080/geoserver/'
WS=osm-extracts
AN=hiu
AE='HIU_INFO@state.gov'
TO=360
BIN=/opt/cybergis-scripts.git/lib/rogue
#===================#
DSA=( "monrovia_basic" "monrovia_landuse" "monrovia_medicalcenters" "monrovia_schools" "monrovia_inlandwaters")
for DS in "${DSA[@]}"
do
   python  $BIN/geogig_sync_osm.py true -v -gs $GS -ws $WS -ds $DS --username $USER --password $PASS -an $AN -ae $AE -to $TO
done
#===================#
DSA=( "kenema_basic" "kenema_landuse" "kenema_medicalcenters" "kenema_schools" "kenema_inlandwaters")
for DS in "${DSA[@]}"
do
   python $BIN/geogig_sync_osm.py true -v -gs $GS -ws $WS -ds $DS --username $USER --password $PASS -an $AN -ae $AE -to $TO
done
#===================#
echo "Done updating OSM extracts."

#!/bin/bash
#==========##========#
USER=admin
PASS=geoserver
GS='http://localhost:8080/geoserver/'
WS=hiu
AN=hiu
AE='HIU_INFO@state.gov'
TO=360
BIN=/opt/cybergis-scripts.git/lib/rogue
#===================#
DSA=( "monrovia_basic" "monrovia_landuse" "monrovia_medicalcenters" "monrovia_schools" "monrovia_inlandwaters")
for DS in "${DSA[@]}"
do
   python  $BIN/geogig_sync_osm.py true -v -gs $GS -ws $WS -ds $DS --username $USER --password $PASS -an $AN -ae $AE -to $TO
done
#===================#
DSA=( "kenema_basic" "kenema_landuse" "kenema_medicalcenters" "kenema_schools" "kenema_inlandwaters")
for DS in "${DSA[@]}"
do
   python $BIN/geogig_sync_osm.py true -v -gs $GS -ws $WS -ds $DS --username $USER --password $PASS -an $AN -ae $AE -to $TO
done
#===================#
echo "Done updating OSM extracts."


python: added python_profile.sh

python: added python_profile.sh

#!/bin/sh
##
## Author(s):
##  - Cedric GESTES <gestes@aldebaran-robotics.com>
##
## Copyright (C) 2011 Aldebaran Robotics
##

PYTHONPATH=. python -m cProfile -stime $@

#how to get better profiling:
#python_profile.sh -o mysuperoutput.stats ../bin/qibuild
#python -mpstats mysuperoutput.stats
#sort time
#stats 10

error: pathspec 'python/python_profile.sh' did not match any file(s) known to git


add scrpit to help pull new images for support services

#!/bin/bash
podman pull docker.io/aerisg222/maw-certs
podman pull docker.io/aerisg222/maw-postgres-maintenance
podman pull docker.io/aerisg222/maw-reverse-geocode
podman pull docker.io/aerisg222/maw-solr-reindex

error: pathspec 'podman-update-support-images.sh' did not match any file(s) known to git


tweaks, so we actually get the remote disk value nad not local

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/apache/infrastructure-puppet.git/'


Shell script to dump only data

Shell script to dump only data

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/lpirola/mapasculturais.git/'


Add a script to start a cluster only with docker containers.

#!/bin/bash
NRDBSERVERS=$1
if [ "$NRDBSERVERS" == "" ] ; then
    NRDBSERVERS=2
fi
echo Number of DBServers: $NRDBSERVERS
NRCOORDINATORS=$2
if [ "$NRCOORDINATORS" == "" ] ; then
    NRCOORDINATORS=1
fi
echo Number of Coordinators: $NRCOORDINATORS

rm -rf /tmp/cluster
mkdir /tmp/cluster
mkdir /tmp/cluster/etcd
mkdir /tmp/cluster/discovery

echo Starting agency...
docker run --detach=true -p 4001:4001 --name=etcd -v /tmp/cluster/etcd:/data microbox/etcd:latest etcd -name agency > /tmp/cluster/etcd.id

sleep 1
echo Initializing agency...
docker run -it --link=etcd:agency --rm arangodb_cluster arangosh --javascript.execute /scripts/init_agency.js > /tmp/cluster/init_agency.log
echo Starting discovery...
docker run --detach=true --link=etcd:agency -v /tmp/cluster/discovery:/discovery --name discovery arangodb_cluster arangosh --javascript.execute scripts/discover.js > /tmp/cluster/discovery.id

start() {
    TYPE=$1
    PORT=$2
    mkdir /tmp/cluster/data$PORT
    echo Starting $TYPE on port $PORT
    docker run --detach=true -v /tmp/cluster/data$PORT:/data \
           -v /tmp/cluster:/log --net=host --name=$TYPE$PORT arangodb_cluster \
        arangod --database.directory /data \
                --cluster.agency-endpoint tcp://localhost:4001 \
                --cluster.my-address tcp://localhost:$PORT \
                --server.endpoint tcp://localhost:$PORT \
                --cluster.my-local-info $TYPE:localhost:$PORT \
                --log.file /log/$PORT.log > /tmp/cluster/server$PORT.id
}

PORTTOPDB=`expr 8629 + $NRDBSERVERS - 1`
for p in `seq 8629 $PORTTOPDB` ; do
    start dbserver $p
done
PORTTOPCO=`expr 8530 + $NRCOORDINATORS - 1`
for p in `seq 8530 $PORTTOPCO` ; do
    start coordinator $p
done

echo Waiting for cluster to come up...

testServer() {
    PORT=$1
    while true ; do
        sleep 1
        curl -s -X GET "http://localhost:$PORT/_api/version" > /dev/null 2>&1
        if [ "$?" != "0" ] ; then
            echo Server on port $PORT does not answer yet.
        else
            echo Server on port $PORT is ready for business.
            break
        fi
    done
}

testServer $PORTTOPCO
if [ "8530" != "$PORTTOPCO" ] ; then
    testServer 8530
fi

echo Bootstrapping DBServers...
for p in `seq 8629 $PORTTOPDB` ; do
    curl -s -X POST "http://localhost:$p/_admin/cluster/bootstrapDbServers" \
         -d '{"isRelaunch":false}' >> /tmp/cluster/DBServer.boot.log 2>&1
done

echo Running DB upgrade on cluster...
curl -s -X POST "http://localhost:8530/_admin/cluster/upgradeClusterDatabase" \
     -d '{"isRelaunch":false}' >> /tmp/cluster/DBUpgrade.log 2>&1

echo Bootstrapping Coordinators...
for p in `seq 8530 $PORTTOPCO` ; do
    curl -s -X POST "http://localhost:8530/_admin/cluster/bootstrapCoordinator" \
         -d '{"isRelaunch":false}' >> /tmp/cluster/Coordinator.boot.log 2>&1
done

echo Done, your cluster is ready at
for p in `seq 8530 $PORTTOPCO` ; do
    echo "   docker run -it --rm --net=host arangodb_cluster arangosh --server.endpoint tcp://localhost:$p"
done

error: pathspec 'scripts/startDockerCluster.sh' did not match any file(s) known to git


run tests against instance

run tests against instance

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/VirusTotal/content.git/'


DEV: keep a trace of the old batch_processing in dev/sct_register_graymatter

Former-commit-id: 33ebc0589756862d4962f679a0d840337741a4b7
Former-commit-id: 04487c49b236f30a838bce14772b06f1f06b32d9

#!/bin/bash
#
# Example of commands to process multi-parametric data of the spinal cord
# For information about acquisition parameters, see: https://dl.dropboxusercontent.com/u/20592661/publications/Fonov_NIMG14_MNI-Poly-AMU.pdf
# N.B. The parameters are set for these type of data. With your data, parameters might be slightly different.

# download example data (errsm_30)
git clone https://github.com/neuropoly/sct_example_data.git

# go in folder
cd sct_example_data

# t2
# ===========================================================================================
cd t2
# spinal cord segmentation
sct_propseg -i t2.nii.gz -t t2 -mesh -max-deformation 4 -init 130
# tips: we use "-max-deformation 4" otherwise the segmentation does not cover the whole spinal cord
# tips: we use "-init 130" to start propagation closer to a region which would otherwise give poor segmentation (try it with and without the parameter).
# tips: we use "-mesh" to get the mesh of the segmentation, which can be viewed using MITKWORKBENCH
# check your results:
fslview t2 -b 0,800 t2_seg -l Red -t 0.5 &
# At this point you should make labels. Here we can use the file labels.nii.gz, which contains labels at C3 (value=3) and T4 (value=11).
# register to template
sct_register_to_template -i t2.nii.gz -l labels.nii.gz -s t2_seg.nii.gz -p step=1,type=seg,algo=slicereg:step=2,type=seg,algo=bsplinesyn,iter=5,shrink=2:step=3,type=im,algo=syn,iter=3,shrink=1
# warp template and white matter atlas
sct_warp_template -d t2.nii.gz -w warp_template2anat.nii.gz
# check results
fslview t2.nii.gz -b 0,800 label/template/MNI-Poly-AMU_T2.nii.gz -b 0,4000 label/template/MNI-Poly-AMU_level.nii.gz -l MGH-Cortical -t 0.5 label/template/MNI-Poly-AMU_GM.nii.gz -l Red-Yellow -b 0.5,1 label/template/MNI-Poly-AMU_WM.nii.gz -l Blue-Lightblue -b 0.5,1 &
# compute average cross-sectional area between C2 and C4 levels
sct_process_segmentation -i t2_seg.nii.gz -p csa -t label/template -l 2:4
# go back to root folder
cd ..

#  t1
# ----------
cd t1
# crop data using graphical user interface (put two points)
# >> sct_crop -i t1.nii.gz
# segmentation (used for registration to template)
sct_propseg -i t1.nii.gz -t t1 -max-deformation 3
# check results
fslview t1 -b 0,800 t1_seg -l Red -t 0.5 &
# adjust segmentation (it was not perfect)
# --> t1_seg_modif.nii.gz
# register to template (which was previously registered to the t2).
sct_register_multimodal -i ../t2/label/template/MNI-Poly-AMU_T2.nii.gz -iseg ../t2/label/template/MNI-Poly-AMU_cord.nii.gz -d t1.nii.gz -dseg t1_seg.nii.gz -p step=1,type=seg,algo=slicereg,metric=MeanSquares:step=2,type=im,algo=syn,iter=3,gradStep=0.2
# concatenate transformations
sct_concat_transfo -w ../t2/warp_template2anat.nii.gz,warp_MNI-Poly-AMU_T22t1.nii.gz -d t1.nii.gz -o warp_template2t1.nii.gz
sct_concat_transfo -w warp_t12MNI-Poly-AMU_T2.nii.gz,../t2/warp_anat2template.nii.gz -d $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -o warp_t12template.nii.gz
# warp template
sct_warp_template -d t1.nii.gz -w warp_template2t1.nii.gz -a 0
# check results
fslview t1.nii.gz label/template/MNI-Poly-AMU_T2.nii.gz -b 0,4000 label/template/MNI-Poly-AMU_level.nii.gz -l MGH-Cortical -t 0.5 label/template/MNI-Poly-AMU_GM.nii.gz -l Red-Yellow -b 0.5,1 label/template/MNI-Poly-AMU_WM.nii.gz -l Blue-Lightblue -b 0.5,1 &
# warp T1 to template space
sct_apply_transfo -i t1.nii.gz -d $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -w warp_t12template.nii.gz
# check registration of T1 to template
fslview $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -b 0,4000 t1_reg.nii.gz -b 0,800 &
# go back to root folder
cd ..

# dmri
# ----------
cd dmri
# create mask to help moco
sct_create_mask -i dmri.nii.gz -m coord,110x20 -s 60 -f cylinder
# motion correction
sct_dmri_moco -i dmri.nii.gz -b bvecs.txt -g 3 -m mask_dmri.nii.gz -p 2,2,1,MeanSquares -t 0
# segment mean_dwi
# tips: use flag "-init" to start propagation from another slice, otherwise results are not good.
sct_propseg -i dwi_moco_mean.nii.gz -t t1 -init 3
# check segmentation
fslview dwi_moco_mean dwi_moco_mean_seg -l Red -t 0.5 &
# register to template (template registered to t2).
# tips: here, we register the spinal cord segmentation to the mean DWI image because the contrasts are similar
sct_register_multimodal -i ../t2/label/template/MNI-Poly-AMU_cord.nii.gz -d dwi_moco_mean.nii.gz -iseg ../t2/label/template/MNI-Poly-AMU_cord.nii.gz -dseg dwi_moco_mean_seg.nii.gz -p step=1,type=seg,algo=slicereg,metric=MeanSquares,iter=10,poly=3,smooth=2:step=2,type=im,algo=bsplinesyn,metric=MeanSquares,iter=3,gradStep=0.2 -x nn
# concatenate transfo
sct_concat_transfo -w ../t2/warp_template2anat.nii.gz,warp_MNI-Poly-AMU_cord2dwi_moco_mean.nii.gz -d dwi_moco_mean.nii.gz -o warp_template2dmri.nii.gz
sct_concat_transfo -w warp_dwi_moco_mean2MNI-Poly-AMU_cord.nii.gz,../t2/warp_anat2template.nii.gz -d $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -o warp_dmri2template.nii.gz
# warp template and white matter atlas
sct_warp_template -d dwi_moco_mean.nii.gz -w warp_template2dmri.nii.gz
# visualize white matter template and lateral CST on DWI
fslview dwi_moco_mean label/template/MNI-Poly-AMU_WM.nii.gz -l Blue-Lightblue -b 0.2,1 -t 0.5 label/atlas/WMtract__02.nii.gz -b 0.2,1 -l Red label/atlas/WMtract__17.nii.gz -b 0.2,1 -l Yellow &
# compute tensors (using FSL)
dtifit -k dmri_moco -o dti -m dwi_moco_mean -r bvecs.txt -b bvals.txt
# compute FA within right and left lateral corticospinal tracts from slices 1 to 3 using maximum a posteriori
sct_extract_metric -i dti_FA.nii.gz -f label/atlas/ -l 2,17 -z 1:3 -m map
# go back to root folder
cd ..

# mt
# ----------
cd mt
# create points along the spinal cord mt1 to help segmentation.
sct_label_utils -i mt1.nii.gz -t create -x 100,90,4,1:102,93,2,1:101,91,0,1 -o mt1_init.nii.gz
# segment mt1
sct_propseg -i mt1.nii.gz -t t2 -init-mask mt1_init.nii.gz -radius 4
# check results
fslview mt1 -b 0,800 mt1_seg.nii.gz -l Red -t 0.5 &
# use centerline to create mask encompassing the spinal cord (will be used for improved registration of mt0 on mt1)
sct_create_mask -i mt1.nii.gz -m centerline,mt1_seg.nii.gz -s 60 -f cylinder
# register mt0 on mt1
sct_register_multimodal -i mt0.nii.gz -d mt1.nii.gz -z 3 -m mask_mt1.nii.gz -p step=1,type=im,algo=slicereg,metric=MI:step=2,type=im,algo=bsplinesyn,metric=MeanSquares,iter=3,gradStep=0.2
# compute mtr
sct_compute_mtr -i mt0_reg.nii.gz -j mt1.nii.gz

#---------------------OLD>>>>>>>>>>
# register to template (template registered to t2).
sct_register_multimodal -i ../t2/label/template/MNI-Poly-AMU_T2.nii.gz -d mt1.nii.gz -iseg ../t2/label/template/MNI-Poly-AMU_cord.nii.gz -dseg mt1_seg.nii.gz -p step=1,type=seg,algo=slicereg,metric=MeanSquares,smooth=2:step=2,type=im,algo=bsplinesyn,metric=MI,iter=2,gradStep=0.5
# concatenate transfo
sct_concat_transfo -w ../t2/warp_template2anat.nii.gz,warp_MNI-Poly-AMU_T22mt1.nii.gz -d mt1.nii.gz -o warp_template2mt.nii.gz
sct_concat_transfo -w warp_mt12MNI-Poly-AMU_T2.nii.gz,../t2/warp_anat2template.nii.gz -d $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -o warp_mt2template.nii.gz
# warp template and atlas
sct_warp_template -d mt1.nii.gz -w warp_template2mt.nii.gz
#-------------------OLD^^^^^^^^^
#---------------------NEW>>>>>>>>>>
# register template to MT , taking th internal structure into account
sct_register_graymatter -i mt1.nii.gz -iseg mt1_seg.nii.gz -anat ../t2/template2anat.nii.gz -anat-seg ../t2/label/template/MNI-Poly-AMU_cord.nii.gz -warp ../t2/warp_template2anat.nii.gz
# concatenate transfo
sct_concat_transfo -w ../t2/warp_template2anat.nii.gz,warp_template2anat2mt1_corrected_wm.nii.gz -d mt1.nii.gz -o warp_template2mt1.nii.gz
# warp template
sct_warp_template -d mt1.nii.gz -w warp_template2mt1.nii.gz
#-------------------NEW^^^^^^^^^
# check registration result
fslview mt1.nii.gz label/template/MNI-Poly-AMU_T2.nii.gz -b 0,4000 label/template/MNI-Poly-AMU_level.nii.gz -l MGH-Cortical -t 0.5 label/template/MNI-Poly-AMU_GM.nii.gz -l Red-Yellow -b 0.5,1 label/template/MNI-Poly-AMU_WM.nii.gz -l Blue-Lightblue -b 0.5,1 &
# extract MTR within the white matter
sct_extract_metric -i mtr.nii.gz -f label/atlas/ -l wm -m map
# go back to root folder
cd ..

# fmri
# ----------
cd fmri
# create mask at the center of the FOV (will be used for moco)
sct_create_mask -i fmri.nii.gz -m center -s 30 -f cylinder
# moco
sct_fmri_moco -i fmri.nii.gz -m mask_fmri.nii.gz
# tips: if you have low SNR you can group consecutive images with "-g"
# put T2 segmentation into fmri space
sct_register_multimodal -i ../t2/t2_seg.nii.gz -d fmri_moco_mean.nii.gz -p step=1,iter=0
# extract centerline
sct_process_segmentation -i t2_seg_reg.nii.gz -p centerline
# segment mean fMRI volume
sct_propseg -i fmri_moco_mean.nii.gz -t t2 -init-centerline t2_seg_reg_centerline.nii.gz -radius 5 -max-deformation 4
# tips: we use the T2 segmentation to help with fMRI segmentation
# tips: we use "-radius 5" otherwise the segmentation is too small
# tips: we use "-max-deformation 4" to prevent the propagation from stopping at the edge
# check segmentation
fslview fmri_moco_mean fmri_moco_mean_seg -l Red -t 0.5 &
# here segmentation slightly failed due to the close proximity of susceptibility artifact --> use file "fmri_moco_mean_seg_modif.nii.gz"
#---------------------OLD>>>>>>>>>>
# register to template (template registered to t2). Only uses segmentation (more accurate)
sct_register_multimodal -i ../t2/label/template/MNI-Poly-AMU_T2.nii.gz -d fmri_moco_mean.nii.gz -iseg ../t2/label/template/MNI-Poly-AMU_cord.nii.gz -dseg fmri_moco_mean_seg_modif.nii.gz -p step=1,type=seg,algo=slicereg,metric=MeanSquares,smooth=2:step=2,type=seg,algo=bsplinesyn,metric=MI,iter=5,smooth=3,gradStep=0.5
# concatenate transfo
sct_concat_transfo -w ../t2/warp_template2anat.nii.gz,warp_MNI-Poly-AMU_T22fmri_moco_mean.nii.gz -d fmri_moco_mean.nii.gz -o warp_template2fmri.nii.gz
sct_concat_transfo -w warp_fmri_moco_mean2MNI-Poly-AMU_T2.nii.gz,../t2/warp_anat2template.nii.gz -d $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -o warp_fmri2template.nii.gz
# warp template, atlas and spinal levels
sct_warp_template -d fmri_moco_mean.nii.gz -w warp_template2fmri.nii.gz -a 0 -s 1
#-------------------OLD^^^^^^^^^
#---------------------NEW>>>>>>>>>>
# register to template (template registered to mt1 with correction regarding the internal structure). Only uses segmentation (more accurate)
sct_register_multimodal -i ../mt/mt1.nii.gz -d fmri_moco_mean.nii.gz -iseg ../mt/mt1_seg.nii.gz -dseg fmri_moco_mean_seg_modif.nii.gz -p step=1,type=seg,algo=slicereg,metric=MeanSquares,smooth=2:step=2,type=im,algo=bsplinesyn,metric=MI,iter=5,smooth=3,gradStep=0.5
# concatenate transfo
sct_concat_transfo -w ../mt/warp_template2anat2mt1_corrected_wm.nii.gz,warp_mt12fmri_moco_mean.nii.gz -d fmri_moco_mean.nii.gz -o warp_template2fmri.nii.gz
sct_concat_transfo -w warp_fmri_moco_mean2mt1.nii.gz,../mt/warp_mt12template2anat_corrected_wm.nii.gz -d $SCT_DIR/data/template/MNI-Poly-AMU_T2.nii.gz -o warp_fmri2template.nii.gz
# warp template, atlas and spinal levels
sct_warp_template -d fmri_moco_mean.nii.gz -w warp_template2fmri.nii.gz -a 0 -s 1
#-------------------NEW^^^^^^^^^

# check results
fslview fmri_moco_mean -b 0,1300 label/spinal_levels/spinal_level_C3.nii.gz -l Red -b 0,0.05 label/spinal_levels/spinal_level_C4.nii.gz -l Blue -b 0,0.05 label/spinal_levels/spinal_level_C5.nii.gz -l Green -b 0,0.05 label/spinal_levels/spinal_level_C6.nii.gz -l Yellow -b 0,0.05 label/spinal_levels/spinal_level_C7.nii.gz -l Pink -b 0,0.05 &
# also see: https://dl.dropboxusercontent.com/u/20592661/spinalcordtoolbox/result_batch_processing_fmri.png

error: pathspec 'dev/sct_register_graymatter/batch_processing_with_diff.sh' did not match any file(s) known to git


Changed filename to include all image filename components

fatal: remote error: upload-pack: not our ref bcec10d20cd0534f39de78b82b70da31b58c3a16
fatal: the remote end hung up unexpectedly


initial commit

initial commit

_pebble()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts=" \
    new-project \
    convert-project \
    build \
    clean \
    analyze-size \
    install \
    ping \
    list \
    rm \
    current \
    uuids \
    logs \
    repl \
    screenshot \
    coredump"

    COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
    return 0

}

complete -F _pebble pebble


Added file to ssh to the virtual machine at 1&1

error: pathspec 'ssh.sh' did not match any file(s) known to git


Agrega un script para etiquetar la versión

git tag -a v1.0 -m 'Cerrando el código de esta iteración'

error: pathspec 'tag.sh' did not match any file(s) known to git


Fix fb rotation on the Forma w/ KSM (#4779)

* Enforce Portrait rotation on the Forma *everywhere*, KSM included.
KSM is currently emulating a bogus rotation, which causes issues with
FBInk, but also happens to be insidiously quirky in weird corner-cases.

#!/bin/sh
export LC_ALL="en_US.UTF-8"

# working directory of koreader
KOREADER_DIR="${0%/*}"

# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit

# Attempt to switch to a sensible CPUFreq governor when that's not already the case...
current_cpufreq_gov="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
# NOTE: We're being fairly conservative here, because what's used and what's available varies depending on HW...
if [ "${current_cpufreq_gov}" != "ondemand" ] && [ "${current_cpufreq_gov}" != "interactive" ]; then
    # NOTE: Go with ondemand, because it's likely to be the lowest common denominator.
    #       Plus, interactive is hard to tune right, and only really interesting when it's a recent version,
    #       which I somehow doubt is the case anywhere here...
    if grep -q ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors; then
        ORIG_CPUFREQ_GOV="${current_cpufreq_gov}"
        echo "ondemand" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
    fi
fi
# NOTE: That doesn't actually help us poor userspace plebs, but, short of switching to performance,
#       I don't really have a golden bullet here... (conservative's rubberbanding is terrible, so that's a hard pass).
#       All I can say is that userspace is a terrible idea and behaves *very* strangely (c.f., #4114).

# update to new version from OTA directory
ko_update_check() {
    NEWUPDATE="${KOREADER_DIR}/ota/koreader.updated.tar"
    INSTALLED="${KOREADER_DIR}/ota/koreader.installed.tar"
    if [ -f "${NEWUPDATE}" ]; then
        ./fbink -q -y -7 -pmh "Updating KOReader"
        # NOTE: See frontend/ui/otamanager.lua for a few more details on how we squeeze a percentage out of tar's checkpoint feature
        # NOTE: %B should always be 512 in our case, so let stat do part of the maths for us instead of using %s ;).
        FILESIZE="$(stat -c %b "${NEWUPDATE}")"
        BLOCKS="$((FILESIZE / 20))"
        export CPOINTS="$((BLOCKS / 100))"
        # shellcheck disable=SC2016
        ./tar xf "${NEWUPDATE}" --strip-components=1 --no-same-permissions --no-same-owner --checkpoint="${CPOINTS}" --checkpoint-action=exec='./fbink -q -y -6 -P $(($TAR_CHECKPOINT/$CPOINTS))'
        fail=$?
        # Cleanup behind us...
        if [ "${fail}" -eq 0 ]; then
            mv "${NEWUPDATE}" "${INSTALLED}"
            ./fbink -q -y -6 -pm "Update successful :)"
            ./fbink -q -y -5 -pm "KOReader will start momentarily . . ."
        else
            # Huh ho...
            ./fbink -q -y -6 -pmh "Update failed :("
            ./fbink -q -y -5 -pm "KOReader may fail to function properly!"
        fi
        rm -f "${NEWUPDATE}" # always purge newupdate in all cases to prevent update loop
        unset BLOCKS CPOINTS
    fi
}
# NOTE: Keep doing an initial update check, in addition to one during the restart loop, so we can pickup potential updates of this very script...
ko_update_check
# If an update happened, and was successful, reexec
if [ -n "${fail}" ] && [ "${fail}" -eq 0 ]; then
    # By now, we know we're in the right directory, and our script name is pretty much set in stone, so we can forgo using $0
    exec ./koreader.sh "${@}"
fi

# load our own shared libraries if possible
export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}"

# export trained OCR data directory
export TESSDATA_PREFIX="data"

# export dict directory
export STARDICT_DATA_DIR="data/dict"

# export external font directory
export EXT_FONT_DIR="/mnt/onboard/fonts"

# fast and dirty way of check if we are called from nickel
# through fmon/KFMon, or from another launcher (KSM or advboot)
# Do not delete this line because KSM detects newer versions of KOReader by the presence of the phrase 'from_nickel'.
export FROM_NICKEL="false"
if pkill -0 nickel; then
    FROM_NICKEL="true"
fi

if [ "${FROM_NICKEL}" = "true" ]; then
    # Detect if we were started from KFMon
    FROM_KFMON="false"
    if pkill -0 kfmon; then
        # That's a start, now check if KFMon truly is our parent...
        if [ "$(pidof kfmon)" -eq "${PPID}" ]; then
            FROM_KFMON="true"
        fi
    fi

    # Siphon a few things from nickel's env (namely, stuff exported by rcS *after* on-animator.sh has been launched)...
    eval "$(xargs -n 1 -0 <"/proc/$(pidof nickel)/environ" | grep -e DBUS_SESSION_BUS_ADDRESS -e NICKEL_HOME -e WIFI_MODULE -e LANG -e WIFI_MODULE_PATH -e INTERFACE 2>/dev/null)"
    export DBUS_SESSION_BUS_ADDRESS NICKEL_HOME WIFI_MODULE LANG WIFI_MODULE_PATH INTERFACE

    # flush disks, might help avoid trashing nickel's DB...
    sync
    # stop kobo software because it's running
    # NOTE: We don't need to kill KFMon, it's smart enough not to allow running anything else while we're up
    killall -TERM nickel hindenburg sickel fickel fmon 2>/dev/null
fi

# fallback for old fmon, KFMon and advboot users (-> if no args were passed to the script, start the FM)
if [ "$#" -eq 0 ]; then
    args="/mnt/onboard"
else
    args="$*"
fi

# check whether PLATFORM & PRODUCT have a value assigned by rcS
if [ -z "${PRODUCT}" ]; then
    PRODUCT="$(/bin/kobo_config.sh 2>/dev/null)"
    export PRODUCT
fi

# PLATFORM is used in koreader for the path to the WiFi drivers (as well as when restarting nickel)
if [ -z "${PLATFORM}" ]; then
    PLATFORM="freescale"
    if dd if="/dev/mmcblk0" bs=512 skip=1024 count=1 | grep -q "HW CONFIG"; then
        CPU="$(ntx_hwconfig -s -p /dev/mmcblk0 CPU 2>/dev/null)"
        PLATFORM="${CPU}-ntx"
    fi

    if [ "${PLATFORM}" != "freescale" ] && [ ! -e "/etc/u-boot/${PLATFORM}/u-boot.mmc" ]; then
        PLATFORM="ntx508"
    fi
    export PLATFORM
fi

# Make sure we have a sane-ish INTERFACE env var set...
if [ -z "${INTERFACE}" ]; then
    # That's what we used to hardcode anyway
    INTERFACE="eth0"
    export INTERFACE
fi
# end of value check of PLATFORM

# If we're on a Forma, make sure we start in an orientation we know how to handle (i.e., Portrait, buttons on the Right)
# Because NTX likes mounting panels in weird native rotations, this is actually FB_ROTATE_CCW (3).
# And because shit gets even weirder, we have to echo 1 to get 3 (because the kernel inverts Landscape FB constants, and 3 ^ 2 = 1).
if [ "${PRODUCT}" = "frost" ]; then
    # NOTE: We enforce this *everywhere*, because KSM is currently emulating a bogus pickel rotation (UR (0), instead of CCW (3)),
    #       and current kernels are surreptitiously broken when UR @ 8bpp (especially as far as A2 handling is concerned)...
    ORIG_FB_ROTA="$(cat /sys/class/graphics/fb0/rotate)"
    # Don't do anything if we're already in the right orientation.
    if [ "${ORIG_FB_ROTA}" -ne "3" ]; then
        echo 1 >/sys/class/graphics/fb0/rotate
    fi
fi
# NOTE: We don't have to restore anything on exit, nickel's startup process will take care of everything (pickel -> nickel).

# In the same vein, swap to 8bpp,
# because 16bpp is the worst idea in the history of time, as RGB565 is generally a PITA without hardware blitting,
# and 32bpp usually gains us nothing except a performance hit (we're not Qt5 with its QPainter constraints).
# The reduced size & complexity should hopefully make things snappier,
# (and hopefully prevent the JIT from going crazy on high-density screens...).
# NOTE: Even though both pickel & Nickel appear to restore their preferred fb setup, we'll have to do it ourselves,
#       as they fail to flip the grayscale flag properly. Plus, we get to play nice with every launch method that way.
#       So, remember the current bitdepth, so we can restore it on exit.
ORIG_FB_BPP="$(./fbdepth -g)"
echo "Original fb bitdepth is set @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
# Sanity check...
case "${ORIG_FB_BPP}" in
    16) ;;
    32) ;;
    *)
        # Hu oh? Don't do anything...
        unset ORIG_FB_BPP
        ;;
esac

# The actual swap is done in a function, because we can disable it in the Developer settings, and we want to honor it on restart.
ko_do_fbdepth() {
    # Check if the swap has been disabled...
    if grep -q '\["dev_startup_no_fbdepth"\] = true' 'settings.reader.lua' 2>/dev/null; then
        # Swap back to the original bitdepth (in case this was a restart)
        if [ -n "${ORIG_FB_BPP}" ]; then
            echo "Making sure we're using the original fb bitdepth @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
            ./fbdepth -d "${ORIG_FB_BPP}" >>crash.log 2>&1
        fi
    else
        # Swap to 8bpp if things looke sane
        if [ -n "${ORIG_FB_BPP}" ]; then
            echo "Switching fb bitdepth to 8bpp" >>crash.log 2>&1
            ./fbdepth -d 8 >>crash.log 2>&1
        fi
    fi
}

# Remount the SD card RW if it's inserted and currently RO
if awk '$4~/(^|,)ro($|,)/' /proc/mounts | grep ' /mnt/sd '; then
    mount -o remount,rw /mnt/sd
fi

# we keep at most 500KB worth of crash log
if [ -e crash.log ]; then
    tail -c 500000 crash.log >crash.log.new
    mv -f crash.log.new crash.log
fi

RETURN_VALUE=85
while [ $RETURN_VALUE -eq 85 ]; do
    # Do an update check now, so we can actually update KOReader via the "Restart KOReader" menu entry ;).
    ko_update_check
    # Do the fb depth switch, unless it's been disabled
    ko_do_fbdepth

    ./reader.lua "${args}" >>crash.log 2>&1
    RETURN_VALUE=$?
done

# Restore original fb bitdepth if need be...
if [ -n "${ORIG_FB_BPP}" ]; then
    echo "Restoring original fb bitdepth @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
    ./fbdepth -d "${ORIG_FB_BPP}" >>crash.log 2>&1
fi

# Restore original fb rotation on the Forma, for KSM
if [ "${PRODUCT}" = "frost" ]; then
    # Only needed for KSM, pickel -> Nickel will restore its own rota properly
    if [ "${FROM_NICKEL}" != "true" ]; then
        # The Forma kernel inverts odd rotation constants, counteract that, à la Plato, because one-liner ;p.
        echo "$(((4 - ORIG_FB_ROTA) % 4))" >/sys/class/graphics/fb0/rotate
    fi
fi

# Restore original CPUFreq governor if need be...
if [ -n "${ORIG_CPUFREQ_GOV}" ]; then
    echo "${ORIG_CPUFREQ_GOV}" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
fi

if [ "${FROM_NICKEL}" = "true" ]; then
    if [ "${FROM_KFMON}" != "true" ]; then
        # start kobo software because it was running before koreader
        ./nickel.sh &
    else
        if grep -q "reboot_on_exit=false" "/mnt/onboard/.adds/kfmon/config/koreader.ini" 2>/dev/null; then
            # KFMon asked us to restart nickel on exit (default since KFMon 0.9.5)
            ./nickel.sh &
        else
            # KFMon asked us to restart the device on exit
            /sbin/reboot
        fi
    fi
else
    # if we were called from advboot then we must reboot to go to the menu
    # NOTE: This is actually achieved by checking if KSM or a KSM-related script is running:
    #       This might lead to false-positives if you use neither KSM nor advboot to launch KOReader *without nickel running*.
    if ! pgrep -f kbmenu >/dev/null 2>&1; then
        /sbin/reboot
    fi
fi

exit $RETURN_VALUE

#!/bin/sh
export LC_ALL="en_US.UTF-8"

# working directory of koreader
KOREADER_DIR="${0%/*}"

# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit

# Attempt to switch to a sensible CPUFreq governor when that's not already the case...
current_cpufreq_gov="$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)"
# NOTE: We're being fairly conservative here, because what's used and what's available varies depending on HW...
if [ "${current_cpufreq_gov}" != "ondemand" ] && [ "${current_cpufreq_gov}" != "interactive" ]; then
    # NOTE: Go with ondemand, because it's likely to be the lowest common denominator.
    #       Plus, interactive is hard to tune right, and only really interesting when it's a recent version,
    #       which I somehow doubt is the case anywhere here...
    if grep -q ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors; then
        ORIG_CPUFREQ_GOV="${current_cpufreq_gov}"
        echo "ondemand" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
    fi
fi
# NOTE: That doesn't actually help us poor userspace plebs, but, short of switching to performance,
#       I don't really have a golden bullet here... (conservative's rubberbanding is terrible, so that's a hard pass).
#       All I can say is that userspace is a terrible idea and behaves *very* strangely (c.f., #4114).

# update to new version from OTA directory
ko_update_check() {
    NEWUPDATE="${KOREADER_DIR}/ota/koreader.updated.tar"
    INSTALLED="${KOREADER_DIR}/ota/koreader.installed.tar"
    if [ -f "${NEWUPDATE}" ]; then
        ./fbink -q -y -7 -pmh "Updating KOReader"
        # NOTE: See frontend/ui/otamanager.lua for a few more details on how we squeeze a percentage out of tar's checkpoint feature
        # NOTE: %B should always be 512 in our case, so let stat do part of the maths for us instead of using %s ;).
        FILESIZE="$(stat -c %b "${NEWUPDATE}")"
        BLOCKS="$((FILESIZE / 20))"
        export CPOINTS="$((BLOCKS / 100))"
        # shellcheck disable=SC2016
        ./tar xf "${NEWUPDATE}" --strip-components=1 --no-same-permissions --no-same-owner --checkpoint="${CPOINTS}" --checkpoint-action=exec='./fbink -q -y -6 -P $(($TAR_CHECKPOINT/$CPOINTS))'
        fail=$?
        # Cleanup behind us...
        if [ "${fail}" -eq 0 ]; then
            mv "${NEWUPDATE}" "${INSTALLED}"
            ./fbink -q -y -6 -pm "Update successful :)"
            ./fbink -q -y -5 -pm "KOReader will start momentarily . . ."
        else
            # Huh ho...
            ./fbink -q -y -6 -pmh "Update failed :("
            ./fbink -q -y -5 -pm "KOReader may fail to function properly!"
        fi
        rm -f "${NEWUPDATE}" # always purge newupdate in all cases to prevent update loop
        unset BLOCKS CPOINTS
    fi
}
# NOTE: Keep doing an initial update check, in addition to one during the restart loop, so we can pickup potential updates of this very script...
ko_update_check
# If an update happened, and was successful, reexec
if [ -n "${fail}" ] && [ "${fail}" -eq 0 ]; then
    # By now, we know we're in the right directory, and our script name is pretty much set in stone, so we can forgo using $0
    exec ./koreader.sh "${@}"
fi

# load our own shared libraries if possible
export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}"

# export trained OCR data directory
export TESSDATA_PREFIX="data"

# export dict directory
export STARDICT_DATA_DIR="data/dict"

# export external font directory
export EXT_FONT_DIR="/mnt/onboard/fonts"

# fast and dirty way of check if we are called from nickel
# through fmon/KFMon, or from another launcher (KSM or advboot)
# Do not delete this line because KSM detects newer versions of KOReader by the presence of the phrase 'from_nickel'.
export FROM_NICKEL="false"
if pkill -0 nickel; then
    FROM_NICKEL="true"
fi

if [ "${FROM_NICKEL}" = "true" ]; then
    # Detect if we were started from KFMon
    FROM_KFMON="false"
    if pkill -0 kfmon; then
        # That's a start, now check if KFMon truly is our parent...
        if [ "$(pidof kfmon)" -eq "${PPID}" ]; then
            FROM_KFMON="true"
        fi
    fi

    # Siphon a few things from nickel's env (namely, stuff exported by rcS *after* on-animator.sh has been launched)...
    eval "$(xargs -n 1 -0 <"/proc/$(pidof nickel)/environ" | grep -e DBUS_SESSION_BUS_ADDRESS -e NICKEL_HOME -e WIFI_MODULE -e LANG -e WIFI_MODULE_PATH -e INTERFACE 2>/dev/null)"
    export DBUS_SESSION_BUS_ADDRESS NICKEL_HOME WIFI_MODULE LANG WIFI_MODULE_PATH INTERFACE

    # flush disks, might help avoid trashing nickel's DB...
    sync
    # stop kobo software because it's running
    # NOTE: We don't need to kill KFMon, it's smart enough not to allow running anything else while we're up
    killall -TERM nickel hindenburg sickel fickel fmon 2>/dev/null
fi

# fallback for old fmon, KFMon and advboot users (-> if no args were passed to the script, start the FM)
if [ "$#" -eq 0 ]; then
    args="/mnt/onboard"
else
    args="$*"
fi

# check whether PLATFORM & PRODUCT have a value assigned by rcS
if [ ! -n "${PRODUCT}" ]; then
    PRODUCT="$(/bin/kobo_config.sh 2>/dev/null)"
    export PRODUCT
fi

# PLATFORM is used in koreader for the path to the WiFi drivers (as well as when restarting nickel)
if [ ! -n "${PLATFORM}" ]; then
    PLATFORM="freescale"
    if dd if="/dev/mmcblk0" bs=512 skip=1024 count=1 | grep -q "HW CONFIG"; then
        CPU="$(ntx_hwconfig -s -p /dev/mmcblk0 CPU 2>/dev/null)"
        PLATFORM="${CPU}-ntx"
    fi

    if [ "${PLATFORM}" != "freescale" ] && [ ! -e "/etc/u-boot/${PLATFORM}/u-boot.mmc" ]; then
        PLATFORM="ntx508"
    fi
    export PLATFORM
fi

# Make sure we have a sane-ish INTERFACE env var set...
if [ ! -n "${INTERFACE}" ]; then
    # That's what we used to hardcode anyway
    INTERFACE="eth0"
    export INTERFACE
fi
# end of value check of PLATFORM

# If we're on a Forma, make sure we start in an orientation we know how to handle (i.e., Portrait, buttons on the Right)
# Because NTX likes mounting panels in weird native rotations, this is actually FB_ROTATE_CCW (3).
# And because shit gets even weirder, we have to echo 1 to get 3 (because the kernel inverts Landscape FB constants, and 3 ^ 2 = 1).
if [ "${PRODUCT}" = "frost" ]; then
    # Only mess with this if we were started from Nickel
    if [ "${FROM_NICKEL}" = "true" ]; then
        # Don't do anything if we're already in the right orientation.
        if [ "$(cat /sys/class/graphics/fb0/rotate)" -ne "3" ]; then
            echo 1 >/sys/class/graphics/fb0/rotate
            # Sleep a bit, for good measure
            usleep 250000
        fi
    fi
fi
# NOTE: We don't have to restore anything on exit, nickel's startup process will take care of everything (pickel -> nickel).

# In the same vein, swap to 8bpp,
# because 16bpp is the worst idea in the history of time, as RGB565 is generally a PITA without hardware blitting,
# and 32bpp usually gains us nothing except a performance hit (we're not Qt5 with its QPainter constraints).
# The reduced size & complexity should hopefully make things snappier,
# (and hopefully prevent the JIT for going crazy on high-density screens...).
# NOTE: Even though pickel/Nickel appear to restore their preferred fb setup, we'll have to do it ourselves,
#       because things are a bit wonky otherwise. Plus, we get to play nice with every launch method that way.
#       So, remember the current bitdepth, so we can restore it on exit.
ORIG_FB_BPP="$(./fbdepth -g)"
echo "Original fb bitdepth is set @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
# Sanity check...
case "${ORIG_FB_BPP}" in
    16) ;;
    32) ;;
    *)
        # Hu oh? Don't do anything...
        unset ORIG_FB_BPP
        ;;
esac

# The actual swap is done in a function, because we can disable it in the Developer settings, and we want to honor it on restart.
ko_do_fbdepth() {
    # Check if the swap has been disabled...
    if grep -q '\["dev_startup_no_fbdepth"\] = true' 'settings.reader.lua' 2>/dev/null; then
        # Swap back to the original bitdepth (in case this was a restart)
        if [ -n "${ORIG_FB_BPP}" ]; then
            echo "Making sure we're using the original fb bitdepth @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
            ./fbdepth -d "${ORIG_FB_BPP}" >>crash.log 2>&1
        fi
    else
        # Swap to 8bpp if things looke sane
        if [ -n "${ORIG_FB_BPP}" ]; then
            echo "Switching fb bitdepth to 8bpp" >>crash.log 2>&1
            ./fbdepth -d 8 >>crash.log 2>&1
        fi
    fi
}

# Remount the SD card RW if it's inserted and currently RO
if awk '$4~/(^|,)ro($|,)/' /proc/mounts | grep ' /mnt/sd '; then
    mount -o remount,rw /mnt/sd
fi

# we keep at most 500KB worth of crash log
if [ -e crash.log ]; then
    tail -c 500000 crash.log >crash.log.new
    mv -f crash.log.new crash.log
fi

RETURN_VALUE=85
while [ $RETURN_VALUE -eq 85 ]; do
    # Do an update check now, so we can actually update KOReader via the "Restart KOReader" menu entry ;).
    ko_update_check
    # Do the fb depth switch, unless it's been disabled
    ko_do_fbdepth

    ./reader.lua "${args}" >>crash.log 2>&1
    RETURN_VALUE=$?
done

# Restore original fb bitdepth if need be...
if [ -n "${ORIG_FB_BPP}" ]; then
    echo "Restoring original fb bitdepth @ ${ORIG_FB_BPP}bpp" >>crash.log 2>&1
    ./fbdepth -d "${ORIG_FB_BPP}" >>crash.log 2>&1
fi

# Restore original CPUFreq governor if need be...
if [ -n "${ORIG_CPUFREQ_GOV}" ]; then
    echo "${ORIG_CPUFREQ_GOV}" >"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
fi

if [ "${FROM_NICKEL}" = "true" ]; then
    if [ "${FROM_KFMON}" != "true" ]; then
        # start kobo software because it was running before koreader
        ./nickel.sh &
    else
        if grep -q "reboot_on_exit=false" "/mnt/onboard/.adds/kfmon/config/koreader.ini" 2>/dev/null; then
            # KFMon asked us to restart nickel on exit (default since KFMon 0.9.5)
            ./nickel.sh &
        else
            # KFMon asked us to restart the device on exit
            /sbin/reboot
        fi
    fi
else
    # if we were called from advboot then we must reboot to go to the menu
    # NOTE: This is actually achieved by checking if KSM or a KSM-related script is running:
    #       This might lead to false-positives if you use neither KSM nor advboot to launch KOReader *without nickel running*.
    if ! pgrep -f kbmenu >/dev/null 2>&1; then
        /sbin/reboot
    fi
fi

exit $RETURN_VALUE


First clean, then migrate

First clean, then migrate

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/just-paja/improvanywhere-platform-scripts.git/'


Fixing Quotes (#14314)

Fixing Quotes (#14314)

#!/bin/bash
WD=$(dirname "$0")
WD=$(cd "$WD"; pwd)
ROOT=$(dirname "$WD")

# Exit immediately for non zero status
set -e
# Check unset variables
set -u
# Print commands
set -x
export CMD=""
export DELETE=""
export DNS_DOMAIN="fake-dns.org"

# shellcheck source=prow/lib.sh
source "${ROOT}/prow/lib.sh"

TIME_TO_RUN_PERF_TESTS=${TIME_TO_RUN_PERF_TESTS:-1200}

pushd "${GOPATH}/src/istio.io/tools/perf/load"
  WD="${GOPATH}/src/istio.io/tools/perf/load"
  # shellcheck disable=SC1091
  source common.sh
  # For postsubmit test we use 1 namespace only and use 0 as prefix for namespace.
  start_servicegraphs "1" "0"
popd
# Run the test for some time
echo "Run the test for ${TIME_TO_RUN_PERF_TESTS}"
pod=$(kubectl get pod --namespace istio-system --selector="app=prometheus" --output jsonpath='{.items[0].metadata.name}')
kubectl -n istio-system port-forward "$pod" 8060:9090 > /tmp/forward &

sleep 5s

OUTPUT_PATH=${OUTPUT_PATH:-"/tmp/output"}

mkdir -p "${OUTPUT_PATH}"

perf_metrics="${OUTPUT_PATH}/perf_metrics.txt"
rm "${perf_metrics}" || true

pushd "${GOPATH}/src/istio.io/tools/perf/benchmark/runner"
count="$((TIME_TO_RUN_PERF_TESTS / 60))"
  echo "Get metric $count time(s)."
  for i in $(seq 1 "$count");
  do
    echo "Running for $i min"
    sleep 1m
    python prom.py http://localhost:8060 60 --no-aggregate >> "${perf_metrics}"
  done

  gsutil -q cp "${perf_metrics}" "gs://$CB_GCS_BUILD_PATH/perf_metrics.txt"

popd

echo "Perf test is done."

#!/bin/bash
WD=$(dirname "$0")
WD=$(cd "$WD"; pwd)
ROOT=$(dirname "$WD")

# Exit immediately for non zero status
set -e
# Check unset variables
set -u
# Print commands
set -x
export CMD=""
export DELETE=""
export DNS_DOMAIN="fake-dns.org"

# shellcheck source=prow/lib.sh
source "${ROOT}/prow/lib.sh"

TIME_TO_RUN_PERF_TESTS=${TIME_TO_RUN_PERF_TESTS:-1200}

pushd "${GOPATH}/src/istio.io/tools/perf/load"
  WD="${GOPATH}/src/istio.io/tools/perf/load"
  # shellcheck disable=SC1091
  source common.sh
  # For postsubmit test we use 1 namespace only and use 0 as prefix for namespace.
  start_servicegraphs "1" "0"
popd
# Run the test for some time
echo "Run the test for ${TIME_TO_RUN_PERF_TESTS}"
pod=$(kubectl get pod --namespace istio-system --selector="app=prometheus" --output jsonpath='{.items[0].metadata.name}')
kubectl -n istio-system port-forward "$pod" 8060:9090 > /tmp/forward &

sleep 5s

OUTPUT_PATH=${OUTPUT_PATH:-"/tmp/output"}

mkdir -p "${OUTPUT_PATH}"

perf_metrics="${OUTPUT_PATH}/perf_metrics.txt"
rm "${perf_metrics}" || true

pushd "${GOPATH}/src/istio.io/tools/perf/benchmark/runner"
count=$(("$TIME_TO_RUN_PERF_TESTS" / 60))
  echo "Get metric $count time(s)."
  for i in $(seq 1 "$count");
  do
    echo "Running for $i min"
    sleep 1m
    python prom.py http://localhost:8060 60 --no-aggregate >> "${perf_metrics}"
  done

  gsutil -q cp "${perf_metrics}" "gs://$CB_GCS_BUILD_PATH/perf_metrics.txt"

popd

echo "Perf test is done."


Fix git commit amend alias

Fix git commit amend alias

fatal: remote error: upload-pack: not our ref a0d0bc8df13eeb0f6fdd20fcf94565fa8d3c8669
fatal: the remote end hung up unexpectedly


Fix EDITOR path for nvim linuxbrew

Fix EDITOR path for nvim linuxbrew

fatal: remote error: upload-pack: not our ref ea23d033dacd190e59ae4472d7b04412ba77d31f
fatal: the remote end hung up unexpectedly


Initial revision

Initial revision

#!/bin/sh
#
# cipherscan.sh -- Test an SSL/TLS server for cipher suite acceptance.
#
# $Id$
# $Source$
#
if [ $# -ne 2 ]
then
  echo "Usage: `basename $0` {hostname} {port}"
  exit 65;
fi

hostname=$1;
port=$2;

if echo "" | nc $hostname $port 2&>1 >/dev/null
then
  echo "Testing $hostname, port $port."

  for cipher in `openssl ciphers -v 'ALL:eNULL' | cut -d' ' -f1`; do
    echo -e "\n" | \
      openssl s_client -cipher "-ALL:$cipher" \
                       -connect $hostname:$port \
                          3>&1 1>/dev/null 2>&3 | grep -n error >/dev/null;
    echo -en "$?\t$cipher\n";
  done
else
  echo "Error connecting to $hostname on port $port."
  exit 65;
fi


Initial commit with the basic script

Initial commit with the basic script

#!/bin/bash

#Hardcoded defaults
#SSH_SERVER="avf_approx@129.10.53.97"

function syntax()
{
     echo  "Syntax: $0 <ssh_server> <benchmark_name> <benchmark_dir> <faults_dir> <num_faults>"
}

# Main program
if [ $# -lt 5 ]
then
    syntax
    exit 1
fi

if [ $1 == "-h" ]
then
    syntax
    exit 0
fi

ssh_server=$1
benchmark_name=$2
benchmark_dir=$3
faults_dir=$4
num_faults=$5

scp -r "$faults_dir" "$ssh_server":~/

ssh $ssh_server '
i=1
num_faults='$num_faults'
benchmark_name='$benchmark_name'
benchmark_dir='$benchmark_dir'
while [ $i -le $num_faults ]
do
  srun -N1 -n1 ~/m2s-4.2/bin/m2s --evg-sim detailed --evg-faults ~/"$benchmark_name"/"$i" \
  --evg-debug-faults debug_"$i" "$benchmark_dir"/"$benchmark_name" --load \
  "$benchmark_dir"/"$benchmark_name"_Kernels.bin -q -e -x 512 -y 512 -z 512 &
  ((i++))
done
' || exit 1

echo 'Jobs Sent'


Add dist-upgrade

Add dist-upgrade

fatal: remote error: upload-pack: not our ref 1e74978db1b6435068ba6813626abd216a989579
fatal: the remote end hung up unexpectedly


Update locale test runner

Update locale test runner

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/versioneye/versioneye-core.git/'


match all clang++ versions [publish binary]

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mapbox/node-mapbox-gl-native.git/'


Took out MOTION_EVENT_GAP

Took out MOTION_EVENT_GAP

fatal: remote error: upload-pack: not our ref a63dd1c8766c5835d5cf5e9d256718d208da5694
fatal: the remote end hung up unexpectedly


Add: cd .. aliases for longer depths

Add: cd .. aliases for longer depths

fatal: remote error: upload-pack: not our ref 2bdde62109b00ca95d757c40b76c10fa0b109bc0
fatal: the remote end hung up unexpectedly


update

update

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/coolrc136/hosts.git/'


script to set up selenium grid in a vagrant box

#!/bin/sh

BOX_TITLE="selenium_box"
BOX_URL="http://cloud-images.ubuntu.com/quantal/current/quantal-server-cloudimg-vagrant-amd64-disk1.box"

vagrant box add $BOX_TITLE $BOX_URL
vagrant init $BOX_TITLE
vagrant up

HOST=$(vagrant ssh-config | grep -i hostname | awk '{print $2}')
PORT=$(vagrant ssh-config | grep -i port | awk '{print $2}')

echo 'mkdir ~/selenium' | vagrant ssh
sshpass -p 'vagrant' scp -o StrictHostKeychecking=no -P $PORT ./selenium-setup.sh vagrant@$HOST:~/selenium/
sshpass -p 'vagrant' scp -r -o StrictHostKeychecking=no -P $PORT ./config vagrant@$HOST:~/selenium/
sshpass -p 'vagrant' scp -r -o StrictHostKeychecking=no -P $PORT ./services vagrant@$HOST:~/selenium/
echo 'cd ~/selenium; ./selenium-setup.sh' | vagrant ssh

error: pathspec 'vagrant-selenium-setup.sh' did not match any file(s) known to git


adding bike.sh

adding bike.sh

#! /bin/bash

echo "Hi! We are together going to find the most often used Citi bike station."
#wget http://witestlab.poly.edu/bikes/201601-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201602-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201603-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201604-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201605-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201606-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201607-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201608-citibike-tripdata.zip
#wget http://witestlab.poly.edu/bikes/201609-citibike-tripdata.zip
echo "Zip Files downloaded"
ls
#for file in *zip; do
#	unzip $file
#done
echo "ZIP Files extracted"
#ls
echo "Starting to Process Data"
#for stn in *csv; do
#awk -F "\"*,\"*" '{print $4 "\t" $5}' $stn >> stations.txt
#awk -F "\"*,\"*" '{print $8 "\t" $9}' $stn >> stations.txt
#done
echo "All months data has been processed"
echo "Sorting Data"
#sort -g stations.txt | uniq -c | sort -g -r > sortedstations.txt
echo "Data has been sorted"
echo "Most frequent stations is:"
echo "Frequency Station-ID Station-Name"
head -1 sortedstations.txt
#rm *csv
echo "CSV Files deleted"
#ls
#rm *zip
echo "Zip Files deleted"
#ls
echo "Thank you for using this script! -- Regards, Anurag Marwah"

error: pathspec 'bike.sh' did not match any file(s) known to git


Add video tools

Add video tools

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/t-sullivan/dotfiles.git/'


populate_kv: 'cat file | grep x' is 'grep x file'

cat | grep is just grep. So let's remove a useless command here

#!/bin/bash
set -e

function kv {
  # Note the 'cas' command puts a value in the KV store if it is empty
  KEY="$1"
  shift
  VALUE="$*"
  log "adding key ${KEY} with value ${VALUE} to KV store"
  etcdctl $ETCDCTL_OPT ${KV_TLS} set ${CLUSTER_PATH}"${KEY}" "${VALUE}" || log "value is already set"
}

function populate_kv {
    case "$KV_TYPE" in
       etcd|consul)
          # if ceph.defaults found in /etc/ceph/ use that
          if [[ -e "/etc/ceph/ceph.defaults" ]]; then
            DEFAULTS_PATH="/etc/ceph/ceph.defaults"
          else
          # else use defaults
            DEFAULTS_PATH="/ceph.defaults"
          fi
          # read defaults file, grab line with key<space>value without comment #
          grep '^.* .*' "$DEFAULTS_PATH" | grep -v '#' | while read line; do
            kv `echo $line`
          done
          ;;
       *)
          ;;
    esac
}

#!/bin/bash
set -e

function kv {
  # Note the 'cas' command puts a value in the KV store if it is empty
  KEY="$1"
  shift
  VALUE="$*"
  log "adding key ${KEY} with value ${VALUE} to KV store"
  etcdctl $ETCDCTL_OPT ${KV_TLS} set ${CLUSTER_PATH}"${KEY}" "${VALUE}" || log "value is already set"
}

function populate_kv {
    case "$KV_TYPE" in
       etcd|consul)
          # if ceph.defaults found in /etc/ceph/ use that
          if [[ -e "/etc/ceph/ceph.defaults" ]]; then
            DEFAULTS_PATH="/etc/ceph/ceph.defaults"
          else
          # else use defaults
            DEFAULTS_PATH="/ceph.defaults"
          fi
          # read defaults file, grab line with key<space>value without comment #
          cat "$DEFAULTS_PATH" | grep '^.* .*' | grep -v '#' | while read line; do
            kv `echo $line`
          done
          ;;
       *)
          ;;
    esac
}


new script

new script

#!/bin/bash

# Script to prepare input files for SFrame analysis at ULB cluster. During its run it also checks the accessibility and readability of files and computes the total number of events.
# Prerequisities: 1) valid grid proxy (voms-proxy-init --voms cms:/cms/becms)  2) Set-up ROOT and SFrame environments

# Usage: source MakeSFInputFile.sh <directory with input ntuples> <name of output file with SFrame input>
# e.g.
# source MakeSFInputFile.sh /pnfs/iihe/cms/store/user/jez/ZHTo2TauAna_53x_HToTauTau-140 53x_HToTauTau-140
#
# The result would be 53x_HToTauTau-140_input.xml containit config snippet that can be included to SFrame config file

# Important parameters: names of ntuples (without suffix), server name and name of the tree inside ntuples

touch temp_input.1
rm -f temp_input.*

input_data=`echo $1`
output_name=`echo $2`
num_files=${3}
config_name=${4}

touch Prepare_${output_name}.sh
rm -f Prepare_${output_name}.sh

echo "touch Run_${output_name}.sh "  > Prepare_${output_name}.sh
echo "rm -f Run_${output_name}.sh " >> Prepare_${output_name}.sh
echo "touch Run_${output_name}.sh " >> Prepare_${output_name}.sh

ls ${input_data} | sort > temp_input.1
sed -i 's/\///g' temp_input.1
#more temp_input.1 | tr '/' '' > temp_input.2

more temp_input.1 |while read line
do
  file=`echo $line`
  echo "source PrepareJobs.sh ${input_data}/${file} ${file} ${num_files} ${config_name}" >> Prepare_${output_name}.sh
  echo "echo \"./SubmitAll_${file}.sh\" >> Run_${output_name}.sh" >> Prepare_${output_name}.sh
done
#source PrepareJobs.sh /pnfs/iihe/cms/store/user/jez/ZHttNtuples/53X/MC/ZZJetsTo4L_TuneZ2star_8TeV-madgraph-tauola/ test 50 Analysis_config_T2_MC_53.xml

echo "chmod +x Run_${output_name}.sh " >> Prepare_${output_name}.sh
echo "echo \"To run all execute ./Run_${output_name}.sh\" " >> Prepare_${output_name}.sh

chmod +x Prepare_${output_name}.sh
echo "To prepare jobs do ./Prepare_${output_name}.sh"

rm -f temp_input*

error: pathspec 'config/PrePrepareJobs_directory_name_numFiles_config.sh' did not match any file(s) known to git


Updated alpine healthcheck script

Updated alpine healthcheck script

apk update && apk upgrade && apk add --update nginx

error: pathspec 'resources/healthcheck_alpine.sh' did not match any file(s) known to git


Base image for drush changed

Base image for drush changed

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/DigitizeIt/digitizeitstash-docker-compose.git/'


Added ubuntu build script for jquery.i18n (#1695)

#!/bin/bash -e
#----------------------------------------------------------------------------
#
# Package       : jquery.i18n
# Version       : master, v1.0.7
# Source repo   : https://github.com/wikimedia/jquery.i18n
# Tested on     : ubuntu_18.04 (Docker)
# Language      : Node
# Travis-Check  : True
# Script License: Apache License, Version 2 or later
# Maintainer    : Jotirling Swami <Jotirling.Swami1@ibm.com>
#
# Disclaimer: This script has been tested in root mode on given
# ==========  platform using the mentioned version of the package.
#             It may not work as expected with newer versions of the
#             package and/or distribution. In such case, please
#             contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------------------------------

set -ex

#Variables
PACKAGE_NAME=jquery.i18n
PACKAGE_VERSION=v1.0.7
PACKAGE_URL=https://github.com/wikimedia/jquery.i18n.git

#Extract version from command line
echo "Usage: $0 [-v <PACKAGE_VERSION>]"
echo "PACKAGE_VERSION is an optional paramater whose default value is $PACKAGE_VERSION and building for ${1:-$PACKAGE_VERSION}"

PACKAGE_VERSION="${1:-$PACKAGE_VERSION}"

#Dependencies
apt update -y && apt install -y git sed unzip

# install node
apt install -y curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
nvm install 14.17.5
node -v

#Clone repo
HOME_DIR=`pwd`
OS_NAME=$(cat /etc/os-release | grep ^PRETTY_NAME | cut -d= -f2)

cd $HOME_DIR
if ! git clone $PACKAGE_URL $PACKAGE_NAME; then
    echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------"
    echo "$PACKAGE_URL $PACKAGE_NAME"
    echo "$PACKAGE_NAME  |  $PACKAGE_URL |  $PACKAGE_VERSION | $OS_NAME | GitHub | Fail |  Clone_Fails"
    exit 1
fi

#Build and test
cd $HOME_DIR/$PACKAGE_NAME
git submodule update --init
git checkout $PACKAGE_VERSION

if ! npm install ; then
    echo "------------------$PACKAGE_NAME:install_fails---------------------------------------"
    echo "$PACKAGE_URL $PACKAGE_NAME"
    echo "$PACKAGE_NAME  |  $PACKAGE_URL |  $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_fails"
    exit 1
fi

if ! npm build ; then
	echo "------------------$PACKAGE_NAME:build_fails---------------------"
	echo "$PACKAGE_URL $PACKAGE_NAME"
	echo "$PACKAGE_NAME  |  $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail |  Build_Fails"
	exit 1
else
	echo "------------------$PACKAGE_NAME:build_success-------------------------"
	echo "$PACKAGE_URL $PACKAGE_NAME"
	echo "$PACKAGE_NAME  |  $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub  | Pass |  Build_Success"
	exit 0
fi

error: pathspec 'j/jquery.i18n/jquery.i18n_v1.0.7_ubuntu_18.04.sh' did not match any file(s) known to git


Fixed PUT.sh

Fixed PUT.sh

#!/bin/sh
#
# Script to be able to run on common Linux and *nix-like OSes (eg macOS)
# to build and run the C++ unit tests under the portableUnitTests directory.
#
# Requires a newish g++ (even if a front-end to Clang for example)
# and with gtest includes and libraries in system paths or under
# /usr/local/{lib,include}.
#
# The COMPILER environment variable can be used to specify
# a different compiler, eg g++-4.9.
#
# Intended to be run without arguments from top-level dir of project.
#
# Run as:
#
#     sh ./portableUnitTestsDriver.sh

# Generates a temporary executable at top level.
EXENAME=tmptestexe

# Project source root.
PROJSRCROOT=content/OTRadioLink
# Project source files under test.
PROJSRCS="`find ${PROJSRCROOT} -name '*.cpp' -type f -print`"

# Test source files dir.
TESTSRCDIR=portableUnitTests
# Source files.
TESTSRCS="`find ${TESTSRCDIR} -name '*.cpp' -type f -print`"

# GTest libs (including main()).
GLIBS="-lgtest -lgtest_main -lpthread"
# Other libs.
OTHERLIBS=

# GTest libs (paths).
GLIBDIRS="-L/usr/local/lib"

# Glib includes (paths).
GINCLUDES="-I/usr/local/include"
# Source includes (paths).
INCLUDES="-I${PROJSRCROOT} -I${PROJSRCROOT}/utility -I${PROJSRCROOT}/IportableUnitTests"

#echo "Using test sources: $TESTSRCS"
#echo "Using project sources: $PROJSRCS"

EXTRACPPFLAGS=

# If OTAESGCM code is present, add it to the source path,
# and set the flag to allow the extra tests based on it.
# Try via a the 'unpacked master' path first, then a relative path.
OTAESGCMALTDIR="OTAESGCM-master"
OTAESGCMRELDIR="../OTAESGCM"
if [ -d ${OTAESGCMALTDIR} ]; then
    OTAESGCMDIR="${OTAESGCMALTDIR}"
else
    OTAESGCMDIR="${OTAESGCMRELDIR}"
fi
OTAESGCMSRCDIR="${OTAESGCMDIR}/content/OTAESGCM"
if [ -d ${OTAESGCMSRCDIR} ]; then
    echo "Lib source dir ${OTAESGCMSRCDIR} is present and will be used."
    INCLUDES="${INCLUDES} -I${OTAESGCMSRCDIR} -I${OTAESGCMSRCDIR}/utility -I${OTAESGCMDIR}/portableUnitTests"
    PROJSRCS="${PROJSRCS} `find ${OTAESGCMSRCDIR} -name '*.cpp' -type f -print`"
    EXTRACPPFLAGS="-DEXT_AVAILABLE_ARDUINO_LIB_OTAESGCM"
else
    echo "*** WARNING: no crypto tests in absence of OTAESCGM ***"
fi

rm -f ${EXENAME}
if ${COMPILER:-g++} -o ${EXENAME} -std=c++0x -O0 -Wall -Werror -fstack-check -fstack-protector-strong ${EXTRACPPFLAGS} ${INCLUDES} ${GINCLUDES} ${PROJSRCS} ${TESTSRCS} ${GLIBDIRS} ${GLIBS} ${OTHERLIBS} ; then
    echo Compiled.
else
    echo Failed to compile.
    exit 2
fi

# Run the tests, repeatedly, shuffled (except first run to make diffs easier).
# Run in increasingly large blocks.
./${EXENAME} --gtest_repeat=1 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=10 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=100 \
  && echo OK

#!/bin/sh
#
# Script to be able to run on common Linux and *nix-like OSes (eg macOS)
# to build and run the C++ unit tests under the portableUnitTests directory.
#
# Requires a newish g++ (even if a front-end to Clang for example)
# and with gtest includes and libraries in system paths or under
# /usr/local/{lib,include}.
#
# The COMPILER environment variable can be used to specify
# a different compiler, eg g++-4.9.
#
# Intended to be run without arguments from top-level dir of project.
#
# Run as:
#
#     sh ./portableUnitTestsDriver.sh

# Generates a temporary executable at top level.
EXENAME=tmptestexe

# Project source root.
PROJSRCROOT=content/OTRadioLink
# Project source files under test.
PROJSRCS="`find ${PROJSRCROOT} -name '*.cpp' -type f -print`"

# Test source files dir.
TESTSRCDIR=portableUnitTests
# Source files.
TESTSRCS="`find ${TESTSRCDIR} -name '*.cpp' -type f -print`"

# GTest libs (including main()).
GLIBS="-lgtest -lgtest_main -lpthread"
# Other libs.
OTHERLIBS=

# GTest libs (paths).
GLIBDIRS="-L/usr/local/lib"

# Glib includes (paths).
GINCLUDES="-I/usr/local/include"
# Source includes (paths).
INCLUDES="-I${PROJSRCROOT} -I${PROJSRCROOT}/utility"

#echo "Using test sources: $TESTSRCS"
#echo "Using project sources: $PROJSRCS"

EXTRACPPFLAGS=

# If OTAESGCM code is present, add it to the source path,
# and set the flag to allow the extra tests based on it.
# Try via a the 'unpacked master' path first, then a relative path.
OTAESGCMALTDIR="OTAESGCM-master"
OTAESGCMRELDIR="../OTAESGCM"
if [ -d ${OTAESGCMALTDIR} ]; then
    OTAESGCMDIR="${OTAESGCMALTDIR}"
else
    OTAESGCMDIR="${OTAESGCMRELDIR}"
fi
OTAESGCMSRCDIR="${OTAESGCMDIR}/content/OTAESGCM"
if [ -d ${OTAESGCMSRCDIR} ]; then
    echo "Lib source dir ${OTAESGCMSRCDIR} is present and will be used."
    INCLUDES="${INCLUDES} -I${OTAESGCMSRCDIR} -I${OTAESGCMSRCDIR}/utility"
    PROJSRCS="${PROJSRCS} `find ${OTAESGCMSRCDIR} -name '*.cpp' -type f -print`"
    EXTRACPPFLAGS="-DEXT_AVAILABLE_ARDUINO_LIB_OTAESGCM"
else
    echo "*** WARNING: no crypto tests in absence of OTAESCGM ***"
fi

rm -f ${EXENAME}
if ${COMPILER:-g++} -o ${EXENAME} -std=c++0x -O0 -Wall -Werror -fstack-check -fstack-protector-strong ${EXTRACPPFLAGS} ${INCLUDES} ${GINCLUDES} ${PROJSRCS} ${TESTSRCS} ${GLIBDIRS} ${GLIBS} ${OTHERLIBS} ; then
    echo Compiled.
else
    echo Failed to compile.
    exit 2
fi

# Run the tests, repeatedly, shuffled (except first run to make diffs easier).
# Run in increasingly large blocks.
./${EXENAME} --gtest_repeat=1 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=10 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=100 \
  && echo OK


Minor change

Minor change

#!/bin/sh
#
# Script to be able to run on common Linux and *nix-like OSes (eg macOS)
# to build and run the C++ unit tests under the portableUnitTests directory.
#
# Requires a newish g++ (even if a front-end to Clang for example)
# and with gtest includes and libraries in system paths or under
# /usr/local/{lib,include}.
#
# The COMPILER environment variable can be used to specify
# a different compiler, eg g++-4.9.
#
# Intended to be run without arguments from top-level dir of project.
#
# Run as:
#
#     sh ./portableUnitTestsDriver.sh

# Generates a temporary executable at top level.
EXENAME=tmptestexe

# Project source root.
PROJSRCROOT=content/OTRadioLink
# Project source files under test.
PROJSRCS="`find ${PROJSRCROOT} -name '*.cpp' -type f -print`"

# Test source files dir.
TESTSRCDIR=portableUnitTests
# Source files.
TESTSRCS="`find ${TESTSRCDIR} -name '*.cpp' -type f -print`"

# GTest libs (including main()).
GLIBS="-lgtest -lgtest_main -lpthread"
# Other libs.
OTHERLIBS=

# GTest libs (paths).
GLIBDIRS="-L/usr/local/lib"

# Glib includes (paths).
GINCLUDES="-I/usr/local/include"
# Source includes (paths).
INCLUDES="-I${PROJSRCROOT} -I${PROJSRCROOT}/utility -I${TESTSRCDIR}"

#echo "Using test sources: $TESTSRCS"
#echo "Using project sources: $PROJSRCS"

EXTRACPPFLAGS=

# If OTAESGCM code is present, add it to the source path,
# and set the flag to allow the extra tests based on it.
# Try via a the 'unpacked master' path first, then a relative path.
OTAESGCMALTDIR="OTAESGCM-master"
OTAESGCMRELDIR="../OTAESGCM"
if [ -d ${OTAESGCMALTDIR} ]; then
    OTAESGCMDIR="${OTAESGCMALTDIR}"
else
    OTAESGCMDIR="${OTAESGCMRELDIR}"
fi
OTAESGCMSRCDIR="${OTAESGCMDIR}/content/OTAESGCM"
if [ -d ${OTAESGCMSRCDIR} ]; then
    echo "Lib source dir ${OTAESGCMSRCDIR} is present and will be used."
    INCLUDES="${INCLUDES} -I${OTAESGCMSRCDIR} -I${OTAESGCMSRCDIR}/utility -I${OTAESGCMDIR}/portableUnitTests"
    PROJSRCS="${PROJSRCS} `find ${OTAESGCMSRCDIR} -name '*.cpp' -type f -print`"
    EXTRACPPFLAGS="-DEXT_AVAILABLE_ARDUINO_LIB_OTAESGCM"
else
    echo "*** WARNING: no crypto tests in absence of OTAESCGM ***"
fi

rm -f ${EXENAME}
if ${COMPILER:-g++} -o ${EXENAME} -std=c++0x -O0 -Wall -Werror -fstack-check -fstack-protector-strong ${EXTRACPPFLAGS} ${INCLUDES} ${GINCLUDES} ${PROJSRCS} ${TESTSRCS} ${GLIBDIRS} ${GLIBS} ${OTHERLIBS} ; then
    echo Compiled.
else
    echo Failed to compile.
    exit 2
fi

# Run the tests, repeatedly, shuffled (except first run to make diffs easier).
# Run in increasingly large blocks.
./${EXENAME} --gtest_repeat=1 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=10 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=100 \
  && echo OK

#!/bin/sh
#
# Script to be able to run on common Linux and *nix-like OSes (eg macOS)
# to build and run the C++ unit tests under the portableUnitTests directory.
#
# Requires a newish g++ (even if a front-end to Clang for example)
# and with gtest includes and libraries in system paths or under
# /usr/local/{lib,include}.
#
# The COMPILER environment variable can be used to specify
# a different compiler, eg g++-4.9.
#
# Intended to be run without arguments from top-level dir of project.
#
# Run as:
#
#     sh ./portableUnitTestsDriver.sh

# Generates a temporary executable at top level.
EXENAME=tmptestexe

# Project source root.
PROJSRCROOT=content/OTRadioLink
# Project source files under test.
PROJSRCS="`find ${PROJSRCROOT} -name '*.cpp' -type f -print`"

# Test source files dir.
TESTSRCDIR=portableUnitTests
# Source files.
TESTSRCS="`find ${TESTSRCDIR} -name '*.cpp' -type f -print`"

# GTest libs (including main()).
GLIBS="-lgtest -lgtest_main -lpthread"
# Other libs.
OTHERLIBS=

# GTest libs (paths).
GLIBDIRS="-L/usr/local/lib"

# Glib includes (paths).
GINCLUDES="-I/usr/local/include"
# Source includes (paths).
INCLUDES="-I${PROJSRCROOT} -I${PROJSRCROOT}/utility -IportableUnitTests"

#echo "Using test sources: $TESTSRCS"
#echo "Using project sources: $PROJSRCS"

EXTRACPPFLAGS=

# If OTAESGCM code is present, add it to the source path,
# and set the flag to allow the extra tests based on it.
# Try via a the 'unpacked master' path first, then a relative path.
OTAESGCMALTDIR="OTAESGCM-master"
OTAESGCMRELDIR="../OTAESGCM"
if [ -d ${OTAESGCMALTDIR} ]; then
    OTAESGCMDIR="${OTAESGCMALTDIR}"
else
    OTAESGCMDIR="${OTAESGCMRELDIR}"
fi
OTAESGCMSRCDIR="${OTAESGCMDIR}/content/OTAESGCM"
if [ -d ${OTAESGCMSRCDIR} ]; then
    echo "Lib source dir ${OTAESGCMSRCDIR} is present and will be used."
    INCLUDES="${INCLUDES} -I${OTAESGCMSRCDIR} -I${OTAESGCMSRCDIR}/utility -I${OTAESGCMDIR}/portableUnitTests"
    PROJSRCS="${PROJSRCS} `find ${OTAESGCMSRCDIR} -name '*.cpp' -type f -print`"
    EXTRACPPFLAGS="-DEXT_AVAILABLE_ARDUINO_LIB_OTAESGCM"
else
    echo "*** WARNING: no crypto tests in absence of OTAESCGM ***"
fi

rm -f ${EXENAME}
if ${COMPILER:-g++} -o ${EXENAME} -std=c++0x -O0 -Wall -Werror -fstack-check -fstack-protector-strong ${EXTRACPPFLAGS} ${INCLUDES} ${GINCLUDES} ${PROJSRCS} ${TESTSRCS} ${GLIBDIRS} ${GLIBS} ${OTHERLIBS} ; then
    echo Compiled.
else
    echo Failed to compile.
    exit 2
fi

# Run the tests, repeatedly, shuffled (except first run to make diffs easier).
# Run in increasingly large blocks.
./${EXENAME} --gtest_repeat=1 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=10 \
  && ./${EXENAME} --gtest_shuffle --gtest_repeat=100 \
  && echo OK


Changed version numbers

Changed version numbers

git-svn-id: f9726a030cf96f23c68a92ccd14a73e10c8cadff@21459 a5903396-d722-0410-b921-86c7d4935375

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/techhead/wsf_php.git/'


Uninstall MAMP Pro

Uninstall MAMP Pro

fatal: remote error: upload-pack: not our ref 331e79c2f01f95a0c1296b5d98197512e26bb4c5
fatal: the remote end hung up unexpectedly


add init.sh

add init.sh

cd ./etc/config/ && scp -r ./ root@192.168.1.1:/etc/config/

error: pathspec 'init.sh' did not match any file(s) known to git


Tweaking migration.

Tweaking migration.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ndoit/fenrir.git/'


added init bash script

added init bash script

#!/bin/bash

echo "Start at "$(date +%c)

#scarica i json dalle API
#echo "> Downloading"
#TODO

#lavora sui json scaricati
echo "> Working on events JSON"
nodejs adjustEvents.js

#converte caratteri unicode in HTML
echo "> Converting unicode chars"
cat data/eventi.json | uni2ascii -a H -q > eventi-temp.json
rm data/eventi.json
mv eventi-temp.json data/eventi.json

#lancia il triplificatore
#echo "> Triplifing"
#TODO

#carica gli rdf sull'endpoint
#echo "> Loading data to the endpoint"
#TODO

echo "Finished at "$(date +%c)


script gerador

script gerador

#!/bin/bash
#
# Copyright 2015 Paulo Henrique Cuchi
#
# 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.
#

################## Inclua os dados aqui ###################

data="25 de Abril de 2015"
local="na UDESC - CCT"
cidade="Joinville"
evento="FLISoL"
num_horas="5"

###########################################################

template="template.svg"
temp_aux="template.aux.svg"
lst_part="participantes.txt"
cert_dir="certificados"

[ -e $template ] || exit 1
[ -e $lst_part ] || exit 2
[ -d $cert_dir ] || mkdir $cert_dir || exit 3
[ -e /bin/inkscape ] || exit 4

cp $template $temp_aux

sed -i 's/_DATA_/'"$data"'/g'           $temp_aux
sed -i 's/_LOCAL_/'"$local"'/g'         $temp_aux
sed -i 's/_CIDADE_/'"$cidade"'/g'       $temp_aux
sed -i 's/_EVENTO_/'"$evento"'/g'       $temp_aux
sed -i 's/_NUM_HORAS_/'"$num_horas"'/g' $temp_aux

while read p; do
    printf "Gerando certificado para %s:\n" "$p"
    certsvg="${p// /_}.svg"
    certpdf="${p// /_}.pdf"
    printf "\tCriando svg...\n"
    cp $temp_aux $certsvg
    printf "\tSubstituindo...\n"
    sed -i 's/_NOME_PARTICIPANTE_/'"$p"'/g' $certsvg
    mv $certsvg $cert_dir
    cd $cert_dir
    printf "\tConvertendo para PDF...\n"
    inkscape $certsvg --export-pdf=$certpdf
    rm $certsvg
    cd ..
    printf "Pronto!\n"
done < $lst_part

rm $temp_aux


Reload bash.

Reload bash.

fatal: remote error: upload-pack: not our ref fbb8eed0f05b5aeb6d015065e0ccf118dd4cc8c4
fatal: the remote end hung up unexpectedly


Fix ssh_auth_sock

Fix ssh_auth_sock

fatal: remote error: upload-pack: not our ref 476ab638699e6d9d7ba9bbda480c8c019595302a
fatal: the remote end hung up unexpectedly


tests for find_dir_in_parents

tests for find_dir_in_parents

load begin_and_end
load tmpdir

function setup() {
  begin && run setup_corpus
  PATH="$BATS_TEST_DIRNAME/..:$PATH"
  source detect_virtualenv
}

function teardown() {
  end && run teardown_corpus
  true
}

function setup_corpus() {
  tempdir=$( make_tempdir )
  local found=$( find_dir_in_parents "quux" "$tempdir/foo/bar" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar
  # │   │   └── baz
  # │   └── bie
  # │       └── bletch
  # └── quux
  #     └── quuux
  #
  mkdir --parents "$tempdir"/foo/{bar/baz,bie/bletch}
  mkdir --parents "$tempdir"/quux/quuux
}

function teardown_corpus() {
  rm_tempdir
}

@test "dir to find is starting dir" {
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'baz' "$tempdir/foo/bar/baz" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar
  # │   │   └── baz    # start & found
  # │   └── bie
  # │       └── bletch
  # └── quux
  #     └── quuux
  #
  [ "$found" = "$tempdir/foo/bar/baz" ]
}

@test "dir to find is in starting dir" {
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'baz' "$tempdir/foo/bar" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar        # start
  # │   │   └── baz    # found
  # │   └── bie
  # │       └── bletch
  # └── quux
  #     └── quuux
  #
  [ "$found" = "$tempdir/foo/bar/baz" ]
}

@test "starting dir defaults to cwd" {
  local tempdir=$( get_tempdir_name )
  builtin cd "$tempdir/foo/bar"
  local found=$( find_dir_in_parents 'baz' )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar        # start
  # │   │   └── baz    # found
  # │   └── bie
  # │       └── bletch
  # └── quux
  #     └── quuux
  #
  [ "$found" = "$tempdir/foo/bar/baz" ]
}

@test "dir to find is sibling of starting dir" {
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'bie' "$tempdir/foo/bar" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar        # start
  # │   │   └── baz
  # │   └── bie        # found
  # │       └── bletch
  # └── quux
  #     └── quuux
  #
  [ "$found" = "$tempdir/foo/bie" ]
}

@test "dir to find is parent's sibling" {
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'quux' "$tempdir/foo/bar" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar        # start
  # │   │   └── baz
  # │   └── bie
  # │       └── bletch
  # └── quux           # found
  #     └── quuux
  #
  [ "$found" = "$tempdir/quux" ]
}

@test "dir to find is in sibling (not found)" {
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'bletch' "$tempdir/foo/bar" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar        # start
  # │   │   └── baz
  # │   └── bie
  # │       └── bletch # not found
  # └── quux
  #     └── quuux
  #
  [ -z "$found" ]
}

@test "dir to find is sibling/child" {
  skip "can only find dirs whose dirname is . OR are abs paths"
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'bie/bletch' "$tempdir/foo/bar" )
  #
  # $tempdir
  # ├── foo
  # │   ├── bar        # start
  # │   │   └── baz
  # │   └── bie
  # │       └── bletch # not found
  # └── quux
  #     └── quuux
  #
  [ -z "$found" ]
}

@test "dir to find doesn't exist (not found)" {
  local tempdir=$( get_tempdir_name )
  local found=$( find_dir_in_parents 'xyzzy' "$tempdir/foo/bar" )
  [ -z "$found" ]
}

@test "no dir to find given (nothing found)" {
  local tempdir=$( get_tempdir_name )
  builtin cd "$tempdir/foo/bar"
  local found=$( find_dir_in_parents )
  [ -z "$found" ]
}

# vim: ft=sh

error: pathspec 't/find_dir_in_parents.bats' did not match any file(s) known to git


INFRA-12291 use the real gump workspace instead of test

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/apache/infrastructure-puppet.git/'


install tmux

install tmux

fatal: remote error: upload-pack: not our ref ac2d9492e525729a1bc52d1e28930e88e1b44402
fatal: the remote end hung up unexpectedly


First cut a a script for taring up the fs

#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

BUILD_DATE=`date +%Y%m%d`

# Tars up the required system files and dirctories.
EXCLUDE="-exclude dev --exclude sys --exclude proc --exclude tmp"
cd /
tar czf /tmp/centos-7-${BUILD_DATE}.tar.gz ${EXCLUDE} .


add shared env hook for library path

add shared env hook for library path

# copied from ament_package/template/environment_hook/library_path.sh

# detect if running on Darwin platform
_UNAME=`uname -s`
_IS_DARWIN=0
if [ "$_UNAME" = "Darwin" ]; then
  _IS_DARWIN=1
fi
unset _UNAME

if [ $_IS_DARWIN -eq 0 ]; then
  ament_prepend_unique_value LD_LIBRARY_PATH "$AMENT_CURRENT_PREFIX/lib"
else
  ament_prepend_unique_value DYLD_LIBRARY_PATH "$AMENT_CURRENT_PREFIX/lib"
fi
unset _IS_DARWIN

error: pathspec 'ament_package/template/environment_hook/library_path.sh' did not match any file(s) known to git


Tache de DRM manquante

Tache de DRM manquante

#!/bin/bash

. bin/task.inc

DESCRIPTION="Export de deux bilans DRM sur 12 mois pour identifier les DRM manquantes"

. bin/task_start.inc

mkdir -p $TASK_DIR/tmp 2> /dev/null

PREFIX_EXPORT_FILE=tmp/bilan_drm_$(date +%Y%m%d%H%M%S)

curl -s "http://$COUCHDBDOMAIN:$COUCHDBPORT/$COUCHDBBASE/_design/drm/_view/derniere?reduce=false" | awk -F '"' '{if ( $10 >= "'$( date  --date="14 months ago" +"%Y%m" )'" && $10 <= "'$( date  --date="2 months ago" +"%Y%m" )'" ) print $4; }' | grep -v '\-M' | sed 's/-/ /g'  | awk '{ tab[ $2 ][ $3 ] = 1; mois[$3] = 1 } END{ printf("CVI;"); for (y in mois ) { printf "%s;", y; } print " "; for (i in tab) { printf("%s;", i)  ; for (y in mois ) { printf ( "%s;", tab[i][y] ); }  print " " ;} }'  | sed 's/;;/;øøøøøø;/g' | sed 's/;;/;øøøøøø;/g' > $TASK_DIR/$PREFIX_EXPORT_FILE"_toutes.csv"

head -n $TASK_DIR/$PREFIX_EXPORT_FILE"_toutes.csv" > $TASK_DIR/$PREFIX_EXPORT_FILE"_manquantes.csv"
cat $TASK_DIR/$PREFIX_EXPORT_FILE"_toutes.csv" | grep -v ';1;1;1;1;1;1;1;1;1;1;1;1;1;' >> $TASK_DIR/$PREFIX_EXPORT_FILE"_manquantes.csv"

echo "[Télécharger le fichier des DRM manquantes]($TASK_URL/$PREFIX_EXPORT_FILE"_manquantes.csv"?$(date +%Y%m%d%H%M%S))"
echo "[Télécharger le fichier de toutes les DRM]($TASK_URL/$PREFIX_EXPORT_FILE"_toutes.csv"?$(date +%Y%m%d%H%M%S))"

error: pathspec 'project/bin/task/05-DRM/06-bilan-drm-manquante-12-mois.sh' did not match any file(s) known to git