use wait in correct folder

use wait in correct folder

#!/bin/bash

pushd /var/www/html/fusio

# wait for external services
php bin/fusio system:wait_for

# install fusio
php bin/fusio migration:up-to-date
exitCode=$?
if [ $exitCode -ne 0 ]; then
    # migrate fusio
    php bin/fusio migration:migrate --no-interaction
fi

# install app
php bin/fusio migration:up-to-date --connection=System
exitCode=$?
if [ $exitCode -ne 0 ]; then
    # migrate app
    php bin/fusio migration:migrate --connection=System --no-interaction
fi

# add initial backend user
php bin/fusio system:check user
exitCode=$?
if [ $exitCode -ne 0 ]; then
    php bin/fusio adduser --role=1 --username="$FUSIO_BACKEND_USER" --email="$FUSIO_BACKEND_EMAIL" --password="$FUSIO_BACKEND_PW"

    # register adapters
    php bin/fusio system:register -y "Fusio\Adapter\Amqp\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Beanstalk\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Elasticsearch\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Memcache\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Mongodb\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Redis\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Smtp\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Soap\Adapter"

    # install backend app
    php bin/fusio marketplace:install fusio
fi

# deploy
php bin/fusio login --username="$FUSIO_BACKEND_USER" --password="$FUSIO_BACKEND_PW"

# create app database
if [ $exitCode -ne 0 ]; then
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="CREATE USER 'app'@'%' IDENTIFIED BY '$FUSIO_DB_PW';"
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="CREATE DATABASE IF NOT EXISTS app;"
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="GRANT ALL PRIVILEGES ON app.* TO 'app'@'%';"
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="FLUSH PRIVILEGES;"
    echo '{"name": "App", "class": "Fusio\\Adapter\\Sql\\Connection\\Sql", "config": {"type": "pdo_mysql", "host": "'$FUSIO_DB_HOST'", "username": "app", "password": "'$FUSIO_DB_PW'", "database": "app"}}' > connection.json
    php bin/fusio connection:create connection.json
    rm connection.json
fi

php bin/fusio deploy
php bin/fusio logout

popd

# remove existing pid
rm -f /var/run/apache2/apache2.pid

# start apache
source /etc/apache2/envvars
exec /usr/sbin/apache2 -D FOREGROUND -D FUSIO_DOMAIN=$FUSIO_DOMAIN

#!/bin/bash

# wait for external services
php bin/fusio system:wait_for

pushd /var/www/html/fusio

# install fusio
php bin/fusio migration:up-to-date
exitCode=$?
if [ $exitCode -ne 0 ]; then
    # migrate fusio
    php bin/fusio migration:migrate --no-interaction
fi

# install app
php bin/fusio migration:up-to-date --connection=System
exitCode=$?
if [ $exitCode -ne 0 ]; then
    # migrate app
    php bin/fusio migration:migrate --connection=System --no-interaction
fi

# add initial backend user
php bin/fusio system:check user
exitCode=$?
if [ $exitCode -ne 0 ]; then
    php bin/fusio adduser --role=1 --username="$FUSIO_BACKEND_USER" --email="$FUSIO_BACKEND_EMAIL" --password="$FUSIO_BACKEND_PW"

    # register adapters
    php bin/fusio system:register -y "Fusio\Adapter\Amqp\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Beanstalk\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Elasticsearch\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Memcache\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Mongodb\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Redis\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Smtp\Adapter"
    php bin/fusio system:register -y "Fusio\Adapter\Soap\Adapter"

    # install backend app
    php bin/fusio marketplace:install fusio
fi

# deploy
php bin/fusio login --username="$FUSIO_BACKEND_USER" --password="$FUSIO_BACKEND_PW"

# create app database
if [ $exitCode -ne 0 ]; then
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="CREATE USER 'app'@'%' IDENTIFIED BY '$FUSIO_DB_PW';"
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="CREATE DATABASE IF NOT EXISTS app;"
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="GRANT ALL PRIVILEGES ON app.* TO 'app'@'%';"
    mysql --host="$FUSIO_DB_HOST" --user=root --password="$FUSIO_DB_PW" --execute="FLUSH PRIVILEGES;"
    echo '{"name": "App", "class": "Fusio\\Adapter\\Sql\\Connection\\Sql", "config": {"type": "pdo_mysql", "host": "'$FUSIO_DB_HOST'", "username": "app", "password": "'$FUSIO_DB_PW'", "database": "app"}}' > connection.json
    php bin/fusio connection:create connection.json
    rm connection.json
fi

php bin/fusio deploy
php bin/fusio logout

popd

# remove existing pid
rm -f /var/run/apache2/apache2.pid

# start apache
source /etc/apache2/envvars
exec /usr/sbin/apache2 -D FOREGROUND -D FUSIO_DOMAIN=$FUSIO_DOMAIN


[freeswitch-core] bugfix

[freeswitch-core] bugfix

#!/bin/bash
set -e
export PATH=$PATH:/usr/local/freeswitch/bin

echo 'Webitel '$VERSION
sed -i 's/WEBITEL_MAJOR/'$WEBITEL_MAJOR'/g' /conf/vars.xml

if [ "$RTP_START_PORT" ]; then
    sed -i 's/RTP_START_PORT/'$RTP_START_PORT'/g' /conf/freeswitch.xml
else
    sed -i 's/RTP_START_PORT/16384/g' /conf/freeswitch.xml
fi

if [ "$RTP_END_PORT" ]; then
    sed -i 's/RTP_END_PORT/'$RTP_END_PORT'/g' /conf/freeswitch.xml
else
    sed -i 's/RTP_END_PORT/32768/g' /conf/freeswitch.xml
fi

if [ "$MAX_SESSIONS" ]; then
    sed -i 's/MAX_SESSIONS/'$MAX_SESSIONS'/g' /conf/freeswitch.xml
else
    sed -i 's/MAX_SESSIONS/1000/g' /conf/freeswitch.xml
fi

if [ "$SESSIONS_PER_SECOND" ]; then
    sed -i 's/SESSIONS_PER_SECOND/'$SESSIONS_PER_SECOND'/g' /conf/freeswitch.xml
else
    sed -i 's/SESSIONS_PER_SECOND/30/g' /conf/freeswitch.xml
fi

if [ "$AMQP_HOST" ]; then
    sed -i 's/AMQP_HOST/'$AMQP_HOST'/g' /conf/vars.xml
else
    sed -i 's/AMQP_HOST/172.17.0.1/g' /conf/vars.xml
fi

if [ "$CDR_SERVER" ]; then
    sed -i 's/CDR_SERVER/'$CDR_SERVER'/g' /conf/vars.xml
else
    sed -i 's/CDR_SERVER/172.17.0.1:10021/g' /conf/vars.xml
fi

if [ "$CONF_SERVER" ]; then
    sed -i 's/CONF_SERVER/'$CONF_SERVER'/g' /conf/vars.xml
else
    sed -i 's/CONF_SERVER/172.17.0.1:10024/g' /conf/vars.xml
fi

if [ "$ACR_SERVER" ]; then
    sed -i 's/ACR_SERVER/'$ACR_SERVER'/g' /conf/vars.xml
else
    sed -i 's/ACR_SERVER/172.17.0.1:10030/g' /conf/vars.xml
fi

if [ "$SIP_NONREG_IP" ]; then
    sed -i 's/nonreg_ip_value/'$SIP_NONREG_IP'/g' /conf/vars.xml
else
    sed -i 's/nonreg_ip_value/$${local_ip_v4}/g' /conf/vars.xml
fi

if [ "$SIP_NONREG_EXT_IP" ]; then
    sed -i 's/nonreg_ext_ip_value/'$SIP_NONREG_EXT_IP'/g' /conf/vars.xml
else
    sed -i 's/nonreg_ext_ip_value/auto-nat/g' /conf/vars.xml
fi

if [ "$SIP_EXTERNAL_IP" ]; then
    sed -i 's/external_ip_value/'$SIP_EXTERNAL_IP'/g' /conf/vars.xml
else
    sed -i 's/external_ip_value/$${local_ip_v4}/g' /conf/vars.xml
fi

if [ "$SIP_EXTERNAL_EXT_IP" ]; then
    sed -i 's/external_ext_ip_value/'$SIP_EXTERNAL_EXT_IP'/g' /conf/vars.xml
else
    sed -i 's/external_ext_ip_value/auto-nat/g' /conf/vars.xml
fi

if [ "$SIP_INTERNAL_IP" ]; then
    sed -i 's/internal_ip_value/'$SIP_INTERNAL_IP'/g' /conf/vars.xml
else
    sed -i 's/internal_ip_value/$${local_ip_v4}/g' /conf/vars.xml
fi

if [ "$SIP_INTERNAL_EXT_IP" ]; then
    sed -i 's/internal_ext_ip_value/'$SIP_INTERNAL_EXT_IP'/g' /conf/vars.xml
else
    sed -i 's/internal_ext_ip_value/$${local_ip_v4}/g' /conf/vars.xml
fi

if [ "$VERTO_IP" ]; then
    sed -i 's/verto_ip_value/'$VERTO_IP'/g' /conf/vars.xml
else
    sed -i 's/verto_ip_value/$${local_ip_v4}/g' /conf/vars.xml
fi

if [ "$VERTO_EXT_IP" ]; then
    sed -i 's/verto_ext_ip_value/'$VERTO_EXT_IP'/g' /conf/vars.xml
else
    sed -i 's/verto_ext_ip_value/$${local_ip_v4}/g' /conf/vars.xml
fi

if [ "$ES_IP" ]; then
    sed -i 's/event_socket_ip_value/'$ES_IP'/g' /conf/vars.xml
else
    sed -i 's/event_socket_ip_value/172.17.0.1/g' /conf/vars.xml
fi

if [ "$LOGLEVEL" ]; then
    sed -i 's/LOGLEVEL/'$LOGLEVEL'/g' /conf/vars.xml
else
    sed -i 's/LOGLEVEL/err/g' /conf/vars.xml
fi

if [ "$CODECS_GLOBAL_PREF" ]; then
    sed -i 's/CODECS_GLOBAL_PREF/'$CODECS_GLOBAL_PREF'/g' /conf/vars.xml
else
    sed -i 's/CODECS_GLOBAL_PREF/OPUS,G722,PCMA,PCMU,GSM,G729,ilbc,VP8,VP9,H264,H263,H263-1998/g' /conf/vars.xml
fi

if [ "$CODECS_OUTBOUND_PREF" ]; then
    sed -i 's/CODECS_OUTBOUND_PREF/'$CODECS_OUTBOUND_PREF'/g' /conf/vars.xml
else
    sed -i 's/CODECS_OUTBOUND_PREF/PCMA,PCMU,G729,GSM/g' /conf/vars.xml
fi

if [ "$SIPDOS" ]; then
    if ! iptables -nL SIPDOS 2>&1 >/dev/null; then
        iptables -N SIPDOS

        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "sundayddr" --algo bm --to 65535 -m comment --comment "deny sundayddr" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "sipsak" --algo bm --to 65535 -m comment --comment "deny sipsak" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "sipvicious" --algo bm --to 65535 -m comment --comment "deny sipvicious" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "friendly-scanner" --algo bm --to 65535 -m comment --comment "deny friendly-scanner" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "User-Agent: sipcli" --algo bm --to 65535 -m comment --comment "deny sipcli" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "iWar" --algo bm --to 65535 -m comment --comment "deny iWar" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "sip-scan" --algo bm --to 65535 -m comment --comment "deny sip-scan" -j SIPDOS
        iptables -A INPUT -p udp -m udp --match multiport --dports 5060,5070,5080 -m string --string "User-Agent: SIP Call" --algo bm --to 65535 -m comment --comment "deny SIP Call" -j SIPDOS

        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "sundayddr" --algo bm --to 65535 -m comment --comment "deny sundayddr" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "sipsak" --algo bm --to 65535 -m comment --comment "deny sipsak" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "sipvicious" --algo bm --to 65535 -m comment --comment "deny sipvicious" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "friendly-scanner" --algo bm --to 65535 -m comment --comment "deny friendly-scanner" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "User-Agent: sipcli" --algo bm --to 65535 -m comment --comment "deny sipcli" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "iWar" --algo bm --to 65535 -m comment --comment "deny iWar" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "sip-scan" --algo bm --to 65535 -m comment --comment "deny sip-scan" -j SIPDOS
        iptables -A INPUT -p tcp -m tcp --match multiport --dports 5060,5070,5080 -m string --string "User-Agent: SIP Call" --algo bm --to 65535 -m comment --comment "deny SIP Call" -j SIPDOS

        iptables -A SIPDOS -j LOG --log-prefix "firewall-sipdos: " --log-level 6
        iptables -A SIPDOS -j DROP
    fi
fi

test -d /logs || mkdir -p /logs /certs /sounds /db /recordings /scripts/lua

chown -R freeswitch:freeswitch /usr/local/freeswitch
chown -R freeswitch:freeswitch /{logs,tmp,db,sounds,conf,certs,scripts,recordings,images}

ln -s /dev/null /dev/raw1394

if [ "$1" = 'freeswitch' ]; then

    if [ -d /docker-entrypoint.d ]; then
        for f in /docker-entrypoint.d/*.sh; do
            [ -f "$f" ] && . "$f"
        done
    fi

    echo 'Starting FreeSWITCH '$FS_VERSION

    ulimit -c unlimited
    ulimit -d unlimited
    ulimit -f unlimited
    ulimit -i unlimited
    ulimit -n 999999
    ulimit -q unlimited
    ulimit -u unlimited
    ulimit -v unlimited
    ulimit -x unlimited
    ulimit -s 240
    ulimit -l unlimited

    exec gosu freeswitch freeswitch -u freeswitch -g freeswitch -c \
        -sounds /sounds -recordings /recordings \
        -certs /certs -conf /conf -db /db \
        -scripts /scripts -log /logs
fi

exec "$@"


drupal7

#!/bin/bash

### BEGIN INIT INFO
# Provides:          provisioner
# Required-Start:    $all
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the container provisioning first time.
# Description:       Start provisioning and get the machine in ready state.
### END INIT INFO

#
# Source the variables the host provisioner gave us.
#
source /etc/lxc-containervars.sh

#
# Helper functions.
#
export DEBIAN_FRONTEND=noninteractive
export STATEFILE='/root/bootstrap-state'
export GIT_AUTHOR_NAME="$LXC_USER"
export GIT_AUTHOR_EMAIL=$LXC_USER@localhost
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"

# Install APT package(s) as given in the first argument.
function addpkg {
  export DEBIAN_FRONTEND=noninteractive
  command="apt-get install --force-yes -y $1"
  eval $command
}

# Remove APT package(s) as given in the first argument.
function delpkg {
  export DEBIAN_FRONTEND=noninteractive
  command="apt-get remove -y $1"
  eval $command
}

# Commit changes to /etc and make a restore point.
function etc-save {
  currentdir=`pwd`
  cd /etc
  git add .
  git commit -a -m "$1"
  cd $currentdir
}

#
# Bootstrapping phases.
#

# Bootstrap phase 1: Install GIT and initialize a repository in /etc.
function bootstrap_1_etc_in_git_repo {
  apt-get update
  addpkg git
  cd /etc
  git init
  etc-save "Initial state of /etc..."
  touch /etc/.gitignore
  echo 'apache2/sites*' >> /etc/.gitignore
  etc-save "Added .gitignore"
}

# Bootstrap phase 2: Setup the user account.
function bootstrap_2_setup_user {
  useradd -U -m -d "$LXC_HOME" -s /bin/bash -u 1000 "$LXC_USER"
  passwd -q -e $LXC_USER
  etc-save "Added user $LXC_USER"
}

# Bootstrap phase 3: install PHP 5.5.
function bootstrap_3_install_apache_php {

  # Install packages.
  addpkg "apache2"
  etc-save "Vanilla Apache with worker MPM"
  addpkg "apache2-mpm-prefork"
  etc-save "Switched to Apache's prefork MPM."
  addpkg "libapache2-mod-php5 php5 php5-curl php5-mysqlnd php5-cli php5-gd php5-xdebug php-apc php5-gmp"
  etc-save "Stock PHP 5.5 and Apache2 packages"
}

# Bootstrap phase 4: tune the server itself.
function bootstrap_4_tune_server {
  HOSTNAME=`hostname`

  # Add important records to /etc/hosts.
  echo "$LXC_IPV4_ADDRESS master" >> /etc/hosts
  echo "127.0.0.1       $HOSTNAME" >> /etc/hosts
  etc-save "Updated /etc/hosts."
}

# Bootstrap phase 5: tune PHP and its extensions.
function bootstrap_5_tune_php {

  # Tune APC.
  echo 'apc.rfc1867 = 1' >> /etc/php5/mods-available/apc.ini
  echo 'apc.shm_size = 128M' >> /etc/php5/mods-available/apc.ini
  etc-save "php: tuned APC"

  # XDEBUG: enable pretty var_dump output.
  echo 'xdebug.var_display_max_depth=20' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.show_local_vars=on' >> /etc/php5/mods-available/xdebug.ini
  etc-save "php: enable xdebug var_dump output"

  # XDEBUG: setup remote debugging.
  echo 'xdebug.remote_enable=1' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_handler=dbgp' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_mode=req' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_port=9000' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_connect_back=1' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.idekey=debugme' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_autostart=0' >> /etc/php5/mods-available/xdebug.ini
  etc-save "php: enable xdebug remote debugging."
}

# Bootstrap phase 6: tune Apache and its modules
function bootstrap_6_tune_apache {

  # Stop apache before all the surgery.
  /etc/init.d/apache2 stop

  # Disable modules we do not want to have around.
  a2dismod status cgi negotiation autoindex reqtimeout
  etc-save "apache2: disabled several unnecessary modules"

  # Enable modules that we do want to have enabled.
  a2enmod rewrite
  etc-save "apache2: enabling several modules that we do need."

  # Tune prefork a bit better.
  echo '' >> /etc/apache2/apache2.conf
  echo '# NIELS: TUNE PREFORK' >> /etc/apache2/apache2.conf
  echo '<IfModule mpm_prefork_module>' >> /etc/apache2/apache2.conf
  echo '  StartServers          5' >> /etc/apache2/apache2.conf
  echo '  MinSpareServers       5' >> /etc/apache2/apache2.conf
  echo '  MaxSpareServers      10' >> /etc/apache2/apache2.conf
  echo '  MaxClients          150' >> /etc/apache2/apache2.conf
  echo '  MaxRequestsPerChild   0' >> /etc/apache2/apache2.conf
  echo '</IfModule>' >> /etc/apache2/apache2.conf
  etc-save "Apache2: tuned prefork"

  # Let Apache run as the $LXC_USER user.
  chown -Rfv $LXC_USER:$LXC_USER /var/lock/apache2
  echo '' >> /etc/apache2/envvars
  echo "# NIELS: FORCE APACHE TO RUN AS $LXC_USER" >> /etc/apache2/envvars
  echo "export APACHE_RUN_USER=$LXC_USER" >> /etc/apache2/envvars
  echo "export APACHE_RUN_GROUP=$LXC_USER" >> /etc/apache2/envvars
  etc-save "apache2: run as $LXC_USER"

  # Start apache2 ordinarily.
  /etc/init.d/apache2 start

  # We are done, shut off the machine so it can reboot with all mounts in place.
  poweroff
}

# Last bootstrap phase and repeated on every boot.
function bootstrap_ordinary_boot_rc {

  # Repeat this process on every boot, bootstrap will never end.
  return 1
}

#
# LSB compliant sysvinit behavior.
#
case "$1" in

  # Upon system start we want to go through all bootstrap stages not done yet.
  start)
    phases="1_etc_in_git_repo 2_setup_user 3_install_apache_php 4_tune_server 5_tune_php 6_tune_apache ordinary_boot_rc"
    state=0
    s=1

    # If the state-file exists, retrieve the current state from there.
    if [ -f $STATEFILE ]; then
      state=`cat $STATEFILE`
    fi

    # Loop all phases and execute the callback for each of the phases.
    for phase in $phases
    do
      if [[ $s > $state ]] ;then
        cmd="bootstrap_$phase"
        echo
        echo " Bootstrapping phase: $phase ($s)"
        echo "====================================================================="
        sleep 5

        # Invoke the callback and collect the exit code.
        eval $cmd # E-codes: 0 (continue), 1 (halt+repeat), 2 (halt now, continue next time)
        exitcode=$?

        # Handle exit strategies and phase storage in the state file.
        if [ $exitcode -ne 0 ]; then
          if [ $exitcode -eq 2 ]; then
            echo "$s" > $STATEFILE
            echo "[EXIT]... exiting (phase advances next time)."
          else
            echo "[EXIT]... exiting (phase repeats next time)."
          fi
          return 0
        else
          sleep 1
          echo "$s" > $STATEFILE
          state=$(($state + 1))
        fi
      fi
      s=$(($s + 1))
    done
    ;;

  restart)
    echo "PROVISIONER RESTART"
    ;;

  force-reload)
    echo "PROVISIONER FORCE-RELOAD"
    ;;

  status)
    echo "PROVISIONER STATUS"
    ;;

  stop)
    echo "PROVISIONER STOP"
    ;;

  *)
    echo "Usage: /etc/init.d/provisioner {start|stop}"
    exit 1
    ;;
esac

exit 0

#!/bin/bash

### BEGIN INIT INFO
# Provides:          provisioner
# Required-Start:    $all
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start the container provisioning first time.
# Description:       Start provisioning and get the machine in ready state.
### END INIT INFO

#
# Source the variables the host provisioner gave us.
#
source /etc/lxc-containervars.sh

#
# Helper functions.
#
export DEBIAN_FRONTEND=noninteractive
export STATEFILE='/root/bootstrap-state'
export GIT_AUTHOR_NAME="$LXC_USER"
export GIT_AUTHOR_EMAIL=$LXC_USER@localhost
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"

# Install APT package(s) as given in the first argument.
function addpkg {
  export DEBIAN_FRONTEND=noninteractive
  command="apt-get install --force-yes -y $1"
  eval $command
}

# Remove APT package(s) as given in the first argument.
function delpkg {
  export DEBIAN_FRONTEND=noninteractive
  command="apt-get remove -y $1"
  eval $command
}

# Commit changes to /etc and make a restore point.
function etc-save {
  currentdir=`pwd`
  cd /etc
  git add .
  git commit -a -m "$1"
  cd $currentdir
}

#
# Bootstrapping phases.
#

# Bootstrap phase 1: Install GIT and initialize a repository in /etc.
function bootstrap_1_etc_in_git_repo {
  apt-get update
  addpkg git
  cd /etc
  git init
  etc-save "Initial state of /etc..."
  touch /etc/.gitignore
  echo 'apache2/sites*' >> /etc/.gitignore
  etc-save "Added .gitignore"
}

# Bootstrap phase 2: Setup the user account.
function bootstrap_2_setup_user {
  useradd -U -m -d "$LXC_HOME" -s /bin/bash -u 1000 "$LXC_USER"
  passwd -q -e $LXC_USER
  etc-save "Added user $LXC_USER"
}

# Bootstrap phase 3: install PHP 5.5.
function bootstrap_3_install_apache_php {

  # Install packages.
  addpkg "apache2"
  etc-save "Vanilla Apache with worker MPM"
  addpkg "apache2-mpm-prefork"
  etc-save "Switched to Apache's prefork MPM."
  addpkg "libapache2-mod-php5 php5 php5-curl php5-mysqlnd php5-cli php5-gd php5-xdebug php-apc php5-gmp"
  etc-save "Stock PHP 5.5 and Apache2 packages"
}

# Bootstrap phase 4: tune the server itself.
function bootstrap_4_tune_server {
  HOSTNAME=`hostname`

  # Add important records to /etc/hosts.
  echo "$LXC_IPV4_ADDRESS master" >> /etc/hosts
  echo "127.0.0.1       $HOSTNAME" >> /etc/hosts
  etc-save "Updated /etc/hosts."
}

# Bootstrap phase 5: tune PHP and its extensions.
function bootstrap_5_tune_php {

  # Tune APC.
  echo 'apc.rfc1867 = 1' >> /etc/php5/mods-available/apc.ini
  echo 'apc.shm_size = 96M' >> /etc/php5/mods-available/apc.ini
  etc-save "php: tuned APC"

  # XDEBUG: enable pretty var_dump output.
  echo 'xdebug.var_display_max_depth=20' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.show_local_vars=on' >> /etc/php5/mods-available/xdebug.ini
  etc-save "php: enable xdebug var_dump output"

  # XDEBUG: setup remote debugging.
  echo 'xdebug.remote_enable=1' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_handler=dbgp' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_mode=req' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_port=9000' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_connect_back=1' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.idekey=debugme' >> /etc/php5/mods-available/xdebug.ini
  echo 'xdebug.remote_autostart=0' >> /etc/php5/mods-available/xdebug.ini
  etc-save "php: enable xdebug remote debugging."
}

# Bootstrap phase 6: tune Apache and its modules
function bootstrap_6_tune_apache {

  # Stop apache before all the surgery.
  /etc/init.d/apache2 stop

  # Disable modules we do not want to have around.
  a2dismod status cgi negotiation autoindex reqtimeout
  etc-save "apache2: disabled several unnecessary modules"

  # Enable modules that we do want to have enabled.
  a2enmod rewrite
  etc-save "apache2: enabling several modules that we do need."

  # Tune prefork a bit better.
  echo '' >> /etc/apache2/apache2.conf
  echo '# NIELS: TUNE PREFORK' >> /etc/apache2/apache2.conf
  echo '<IfModule mpm_prefork_module>' >> /etc/apache2/apache2.conf
  echo '  StartServers          5' >> /etc/apache2/apache2.conf
  echo '  MinSpareServers       5' >> /etc/apache2/apache2.conf
  echo '  MaxSpareServers      10' >> /etc/apache2/apache2.conf
  echo '  MaxClients          150' >> /etc/apache2/apache2.conf
  echo '  MaxRequestsPerChild   0' >> /etc/apache2/apache2.conf
  echo '</IfModule>' >> /etc/apache2/apache2.conf
  etc-save "Apache2: tuned prefork"

  # Let Apache run as the $LXC_USER user.
  chown -Rfv $LXC_USER:$LXC_USER /var/lock/apache2
  echo '' >> /etc/apache2/envvars
  echo "# NIELS: FORCE APACHE TO RUN AS $LXC_USER" >> /etc/apache2/envvars
  echo "export APACHE_RUN_USER=$LXC_USER" >> /etc/apache2/envvars
  echo "export APACHE_RUN_GROUP=$LXC_USER" >> /etc/apache2/envvars
  etc-save "apache2: run as $LXC_USER"

  # Start apache2 ordinarily.
  /etc/init.d/apache2 start

  # We are done, shut off the machine so it can reboot with all mounts in place.
  poweroff
}

# Last bootstrap phase and repeated on every boot.
function bootstrap_ordinary_boot_rc {

  # Repeat this process on every boot, bootstrap will never end.
  return 1
}

#
# LSB compliant sysvinit behavior.
#
case "$1" in

  # Upon system start we want to go through all bootstrap stages not done yet.
  start)
    phases="1_etc_in_git_repo 2_setup_user 3_install_apache_php 4_tune_server 5_tune_php 6_tune_apache ordinary_boot_rc"
    state=0
    s=1

    # If the state-file exists, retrieve the current state from there.
    if [ -f $STATEFILE ]; then
      state=`cat $STATEFILE`
    fi

    # Loop all phases and execute the callback for each of the phases.
    for phase in $phases
    do
      if [[ $s > $state ]] ;then
        cmd="bootstrap_$phase"
        echo
        echo " Bootstrapping phase: $phase ($s)"
        echo "====================================================================="
        sleep 5

        # Invoke the callback and collect the exit code.
        eval $cmd # E-codes: 0 (continue), 1 (halt+repeat), 2 (halt now, continue next time)
        exitcode=$?

        # Handle exit strategies and phase storage in the state file.
        if [ $exitcode -ne 0 ]; then
          if [ $exitcode -eq 2 ]; then
            echo "$s" > $STATEFILE
            echo "[EXIT]... exiting (phase advances next time)."
          else
            echo "[EXIT]... exiting (phase repeats next time)."
          fi
          return 0
        else
          sleep 1
          echo "$s" > $STATEFILE
          state=$(($state + 1))
        fi
      fi
      s=$(($s + 1))
    done
    ;;

  restart)
    echo "PROVISIONER RESTART"
    ;;

  force-reload)
    echo "PROVISIONER FORCE-RELOAD"
    ;;

  status)
    echo "PROVISIONER STATUS"
    ;;

  stop)
    echo "PROVISIONER STOP"
    ;;

  *)
    echo "Usage: /etc/init.d/provisioner {start|stop}"
    exit 1
    ;;
esac

exit 0


Just in case we have a faster and less buggy linear algebra program somewhere.

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/mancoast/cado-nfs.git/'


Add script to build dist package

Add script to build dist package

#!/usr/bin/env bash

set -euo pipefail

# This script is used to build the distribution archives for SolidInvoice.

export SOLIDINVOICE_ENV=prod
export SOLIDINVOICE_DEBUG=0

NODE_ENVIRONMENT=production
REPO=https://github.com/SolidInvoice/SolidInvoice.git
BRANCH=${1:-}
VERSION=${2:-}

if [ -z $BRANCH ]
then
    echo "Enter branch or tag name to checkout: "
    read branch

    BRANCH=${branch}
fi

if [ -z $VERSION ]
then
    echo "Enter version number: "
    read version

    VERSION=${version}
fi

ROOT_DIR=$( dirname $(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd))
BUILD_DIR="$ROOT_DIR/build"
DIST_DIR="$BUILD_DIR/dist/"

function semverParse() {
    local RE='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)'
    #MAJOR
    eval $2=`echo $1 | sed -e "s#$RE#\1#"`
    #MINOR
    eval $3=`echo $1 | sed -e "s#$RE#\2#"`
    #MINOR
    eval $4=`echo $1 | sed -e "s#$RE#\3#"`
    #SPECIAL
    eval $5=`echo $1 | sed -e "s#$RE#\4#"`
}

function generateRelease() {
    rm -Rf ../build/*

    mkdir -p "${BUILD_DIR}"
    mkdir -p "$DIST_DIR"

    cd "${BUILD_DIR}"

    git clone --branch "${BRANCH}" "${REPO}" "./SolidInvoice"
    cd "./SolidInvoice"

    composer config --no-plugins allow-plugins.symfony/flex true
    composer install -o -n --no-dev -vvv
    yarn --pure-lockfile
    php bin/console assets:install
    yarn build
    php bin/console fos:js-routing:dump --callback=define
    php bin/console bazinga:js-translation:dump --merge-domains public
    rm -Rf node_modules
    chmod -R 0777 var
    rm -Rf .env
    echo "SOLIDINVOICE_ENV=$SOLIDINVOICE_ENV" >> .env
    echo "SOLIDINVOICE_DEBUG=$SOLIDINVOICE_DEBUG" >> .env

    zip -r SolidInvoice-$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_SPECIAL.zip ./
    mv SolidInvoice-$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_SPECIAL.zip "${DIST_DIR}"

    tar -zcvf SolidInvoice-$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_SPECIAL.tar.gz ./
    mv SolidInvoice-$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_SPECIAL.tar.gz "${DIST_DIR}"

    cd ../ && rm -Rf "./SolidInvoice"
}

semverParse $VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_SPECIAL

generateRelease

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


Agrego script que muestra todas las submissions 'incompletas' (util para buscar "colgadas")

#!/bin/bash

echo ' (select id from submissions) EXCEPT (select submission_id from submission_results);' | psql -t -U oiajuez -h 127.0.0.1 -d database | sort -n

error: pathspec 'oia-scripts/print-incomplete-submissions.sh' did not match any file(s) known to git


don't debug after-script

don't debug after-script

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/ubi-agni/industrial_ci.git/'


update.sh

update.sh

#!/usr/bin/env bash
set -e
if [ ! -z "$1" ]
  then
    echo "Updating from $1"
    UPDATE_FROM=$1
  else
    echo "Updating from github"
    VERSION=master
    rm -Rf ansible-aws-infra-services-$VERSION
    curl -L https://github.com/simple-machines/ansible-aws-infra-services/archive/$VERSION.tar.gz | tar xz
    UPDATE_FROM="ansible-aws-infra-services-$VERSION"
fi

rsync \
      --include="roles/***" \
      --include="scripts/***" \
      -rav $UPDATE_FROM/* .

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


Updated update script

Updated update script

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/DavidSouthgate/dotfiles.git/'


Create a new installer script

Create a new installer script

Basic script to fix, setup, and prettify Linux Mint on iMacs for Freegeek Chicago

#!/bin/bash
## Basic script to fix, setup, and prettify Linux Mint on iMacs for Freegeek Chicago
## By Grant Garrett-Grossman

# Function that makes a prompt
ask() {
    while true; do

        if [ "${2:-}" = "Y" ]; then
            prompt="Y/n"
            default=Y
        elif [ "${2:-}" = "N" ]; then
            prompt="y/N"
            default=N
        else
            prompt="y/n"
            default=
        fi

        # Ask the question
        read -p "$1 [$prompt] " REPLY

        # Default?
        if [ -z "$REPLY" ]; then
            REPLY=$default
        fi

        # Check if the reply is valid
        case "$REPLY" in
            Y*|y*) return 0 ;;
            N*|n*) return 1 ;;
        esac

    done
}

function pause(){
   read -p "$*"
}

echo "################################################"
echo "#  FreeGeek Chicago iMac Linux Mint Installer  #"
echo "################################################"
echo
echo
echo "Welcome to the wonderful installer script to setup Linux Mint on iMacs!"
echo "Let's get ready to rumble!"
echo

# Check if root
if [[ $EUID -ne 0 ]]; then
	echo "You must be a root user" 2>&1
	exit 1
fi

# Get current user
user=$(who am i | awk '{print $1}')

###########Package Management#######################
# Treat recommended packages as dependencies
echo "Designating all recommended packages as dependencies ..."
sed -i 's/false/true/g' /etc/apt/apt.conf.d/00recommends
sed -i 's/false/true/g' /etc/apt/apt.conf.d/99synaptic
echo "Done!"
echo

# Make all updates visible
echo "Making sure all updates are visible ..."
sed -i -r 's/level1_visible = False/level1_visible = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
sed -i -r 's/level2_visible = False/level1_visible = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
sed -i -r 's/level3_visible = False/level1_visible = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
sed -i -r 's/level4_visible = False/level1_visible = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
sed -i -r 's/level5_visible = False/level1_visible = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
echo "Done!"
echo

# Make all security updates visible and safe
echo "Making sure all security updates are automatically selected ..."
sed -i -r 's/security_visible = False/security_visible = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
sed -i -r 's/security_safe = False/security_safe = True/' "/home/$user/.config/linuxmint/mintUpdate.conf"
echo "Done!"
echo

# Add ppa
echo "Adding Numix ppa ..."
apt-add-repository -y ppa:numix/ppa # for icons
echo "Done!"
echo

# Update
echo "Updating and upgrading ..."
echo
apt-get update
apt-get -y upgrade
echo
echo "Done!"
echo

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

# Enable firewall
echo "Starting and enabling firewall ..."
ufw enable
echo "Done!"
echo

# Make swappiness reasonable
swappiness=$( cat /proc/sys/vm/swappiness) # gets current swappiness
if [ $swappiness -gt 10]
then
	echo "Reducing swappiness to 10 ..."
	echo "# Set swap usage to a more reasonable level" >> /etc/sysctl.conf
	echo "vm.swappiness=10" >> /etc/sysctl.conf
	echo "Done!"
	echo
fi
else
	echo "Swap usage was already set to 10"
	echo "Was this script already run?"
	echo

# Disable the flawed hibernate (suspend-to-disk)
echo "Disabling suspend to disk ..."
mv -v /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla /
echo "Done!"
echo

#############Install stuff###############
echo "Installing a bunch of stuff ..."
echo "Please sit back and relax, the train will be there soon."
echo
# Codecs and important stuff
apt-get -y install ubuntu-restricted-extras
apt-get -y install flashplugin-installer # necessary?
apt-get -y install libdvdcss2

# Add spanish language support
apt-get -y install language-pack-es
apt-get -y install language-pack-gnome-es

# Install nonfree firmware for Broadcom wireless cards and TV capture cards
apt-get -y install linux-firmware-nonfree firmware-b43-installer b43-fwcutter

# Games!!!!!
apt-get -y install aisleriot gnome-cards-data gnomine quadrapassel gnome-sudoku

# Activate mumlock
apt-get -y install numlockx

# Install a better looking icon set (aka: numix)
sudo apt-get install numix-icon-theme numix-icon-theme-circle

# Install and fix docky (bluetooth icon bug)
apt-get -y docky
killall docky
cp /usr/share/applications/cinnamon-settings.desktop /usr/share/applications/cinnamon-settings.desktop.`date +"%m_%d_%Y"`
sed '/Keywords=/a\StartupWMClass=Cinnamon-settings.py' -i /usr/share/applications/cinnamon-settings.desktop
rm ~/.cache/docky/docky.desktop.*.cache

# Other stuff
apt-get -y install inkscape
apt-get -y install gcj-jre
apt-get -y install ca-certificates
apt-get -y install chromium-browser
apt-get -y install hardinfo

echo "Done!"
echo
##############################################

# Ensure installation completed without errors
apt-get -y install sl
echo "Installation complete -- relax, and watch this STEAM LOCOMOTIVE"; sleep 2
/usr/games/sl

#TODO do these automatically
echo "###################################################################"
echo "# 	   Please do the following:       			  #"
echo "###################################################################"
echo "	1) Install Proprietary drivers if available from the driver manager"
echo "	2) Selected the Numix icons from the theme manager"
echo "	3) Downloaded the Mountain lion theme and selected it for Window borders via the theme manager"
echo "	4) Downloaded the Void theme and selected it for Desktop via the theme manager"
echo " 	5) Started Docky amd configured it to: start on login, have a removable drive addon, make it look nice, and include everyday programs (Thunderbird, Firefox/Chromium, LibreOffice, File Manager, Terminal"
echo "	6) Moved panel to top and removed the Window List Applet and launchers"
echo "	7) Upgraded the kernel to the the latest via the Update Manager"
echo " 	8) Downloaded, enabled and configured the desktop cube extension"
echo "	9) Change the effects: make windows fly down when minimized, move when closed, fly up when maximised"
echo

echo "Did you finish all of that?"
pause 'If so please press [Enter]'
echo
echo "Great!"
echo "Please contribute on Github if you are tired of doing all of that stuff manually"
echo
echo "Bye!"
echo
echo "Just kidding :)"
echo

if ask "Do you want to reboot now?" Y; then
	echo "Rebooting now."
	reboot
else
	exit 0
fi

## EOF

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


added preinstall script for heroku

added preinstall script for heroku

#!/usr/bin/env bash

cp ./deploy/production/dotenv .env

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


Create Create_VM.bash

Create Create_VM.bash

#!/bin/bash

echo "Create VM script for Mac/Linux coming soon."

#
#### End of Script  ####

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


Script to sync books file server.

Script to sync books file server.

#!/bin/sh
rsync -avzP /home/sol/Calibre\ Library/ magpie.local:share/book/

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


Create font2mobileconfig.sh

Create font2mobileconfig.sh

This is a script that wraps any file in an Apple mobile provisioning profile as if that file were a font.  If you use the script on a TTF or OTF font file, you'll get a ".mobileconfig" file that can be installed on most versions of iOS or recent versions of OS X to make that font generally available in that environment.

#!/bin/sh -

if [ ! "$#" -eq 1 ] ; then
  /bin/echo "Usage: $0 fontfilename"
  exit 1
fi

fontfile=$1
outfile=$fontfile\.mobileconfig
outeruuid=`uuidgen`
inneruuid=`uuidgen`
/bin/echo -n '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadDisplayName</key><string>' > $outfile
/bin/echo -n $fontfile >> $outfile
/bin/echo -n '</string>
<key>PayloadIdentifier</key>
<string>' >> $outfile
/bin/echo -n `hostname`.$outeruuid >> $outfile
/bin/echo -n '</string>
<key>PayloadType</key><string>Configuration</string>
<key>PayloadUUID</key><string>' >> $outfile
/bin/echo -n $outeruuid >> $outfile
/bin/echo -n '</string>' >> $outfile
/bin/echo -n '<key>PayloadVersion</key><integer>1</integer>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadType</key><string>com.apple.font</string>
<key>Font</key>
<data>' >> $outfile
base64 -b 72 -i $fontfile >> $outfile
/bin/echo -n '</data>
<key>Name</key>
<string>' >> $outfile
/bin/echo -n $fontfile >> $outfile
/bin/echo -n '</string>
<key>PayloadIdentifier</key>
<string>' >> $outfile
/bin/echo -n `hostname`.$outeruuid.com.apple.font.$inneruuid >> $outfile
/bin/echo -n '</string>
<key>PayloadVersion</key><integer>1</integer>
<key>PayloadUUID</key><string>' >> $outfile
/bin/echo -n $inneruuid >> $outfile
/bin/echo '</string>
</dict>
</array>
</dict>
</plist>' >> $outfile

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


Setup kernels

Setup kernels

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/hsiliev/cf-zoo.git/'


add vpn client cli

add vpn client cli

#!/bin/bash
#
read -d '' USAGE << EOF
 Usage:
 1) install
   install -i <profile_id> -f <profile_path> -p <password>
 2) start
   start -i <profile_id>
 3) stop
   stop -i <profile_id>
 4) grant access
   grant -m <mac_address>
 5) revoke access
   revoke -m <mac_address>
EOF

OPT=$1

if [[ "$OPT" != "install" ]] && [[ "$OPT" != "start" ]] && [[ "$OPT" != "stop" ]] && [[ "$OPT" != "grant" ]] && [[ "$OPT" != "revoke" ]]
then
  echo "$USAGE"
  exit 0;
fi

shift 1;

while getopts i:f:p:m: option
do
  case "${option}"
  in
  i) PROFILE_ID=${OPTARG};;
  f) PROFILE_PATH=${OPTARG};;
  p) PASSWORD=${OPTARG};;
  m) DEVICE_MAC=${OPTARG};;
  esac
done

PROFILE_REPO="/home/pi/.firewalla/run/ovpn_profile/"
mkdir -p $PROFILE_REPO

if [[ "$OPT" == "install" ]]
then
  if [[ -z $PROFILE_ID ]]
  then
    echo "Profile id is not specified."
    exit 1
  fi
  if [[ -z $PROFILE_PATH ]]
  then
    echo "Profile path is not specified."
    exit 1
  fi
  if [[ ! -f $PROFILE_PATH ]]
  then
    echo "Specified profile does not exist."
    exit 1
  fi
  if [[ -z $PASSWORD ]]
  then
    echo "Password is not specified."
    exit 1
  fi

  echo "Installing profile $PROFILE_ID..."
  cp "$PROFILE_PATH" "$PROFILE_REPO/$PROFILE_ID.ovpn"
  echo -n "$PASSWORD" > "$PROFILE_REPO/$PROFILE_ID.password"
fi

if [[ "$OPT" == "start" ]]
then
  if [[ -z $PROFILE_ID ]]
  then
    echo "Profile id is not specified."
    exit 1
  fi
  if [[ ! -f "$PROFILE_REPO/$PROFILE_ID.ovpn" ]]
  then
    echo "Profile of specified id does not exist."
    exit 1
  fi

  echo "Starting vpn client of $PROFILE_ID..."
  redis-cli hset policy:system vpnClient "{\"state\":true,\"type\":\"openvpn\",\"openvpn\":{\"profileId\":\"$PROFILE_ID\"}}"
  redis-cli publish DiscoveryEvent '{"type":"SystemPolicy:Changed","ip":"0","msg":{"vpnClient":null}}'
fi

if [[ "$OPT" == "stop" ]]
then
  if [[ -z $PROFILE_ID ]]
  then
    echo "Profile id is not specified."
    exit 1
  fi
  if [[ ! -f "$PROFILE_REPO/$PROFILE_ID.ovpn" ]]
  then
    echo "Profile of specified id does not exist."
    exit 1
  fi

  echo "Stopping vpn client of $PROFILE_ID..."
  redis-cli hset policy:system vpnClient "{\"state\":false,\"type\":\"openvpn\",\"openvpn\":{\"profileId\":\"$PROFILE_ID\"}}"
  redis-cli publish DiscoveryEvent '{"type":"SystemPolicy:Changed","ip":"0","msg":{"vpnClient":null}}'
fi

if [[ "$OPT" == "grant" ]]
then
  if [[ -z "$DEVICE_MAC" ]]
  then
    echo "Device mac is not specified."
    exit 1
  fi
  DEVICE_IP=`redis-cli hget host:mac:$DEVICE_MAC ipv4Addr`
  if [[ -z $DEVICE_IP ]]
  then
    echo "IP address of $DEVICE_MAC is not found"
    exit 1
  fi
  redis-cli hset policy:mac:$DEVICE_MAC vpnClient '{"mode":"dhcp","state":true}'
  redis-cli publish DiscoveryEvent "{\"type\":\"HostPolicy:Changed\",\"ip\":\"$DEVICE_IP\",\"msg\":{\"vpnClient\":null}}"
fi

if [[ "$OPT" == "revoke" ]]
then
  if [[ -z "$DEVICE_MAC" ]]
  then
    echo "Device mac is not specified."
    exit 1
  fi
  DEVICE_IP=`redis-cli hget host:mac:$DEVICE_MAC ipv4Addr`
  if [[ -z $DEVICE_IP ]]
  then
    echo "IP address of $DEVICE_MAC is not found"
    exit 1
  fi
  redis-cli hset policy:mac:$DEVICE_MAC vpnClient '{"mode":"dhcp","state":false}'
  redis-cli publish DiscoveryEvent "{\"type\":\"HostPolicy:Changed\",\"ip\":\"$DEVICE_IP\",\"msg\":{\"vpnClient\":null}}"
fi

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


Mejor nombre para la funcion

Mejor nombre para la funcion

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/jjuarez/mydotfiles.git/'


feat: Upgrade to go1.14.2

feat: Upgrade to go1.14.2

* Upgraded go to version 1.14.2

Related to PKIAL-370

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/jig/myubuntu.git/'


install-protoc: {} expansion requires Bash

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/dasfoo/travis.git/'


ubuntu installer will install memcached

ubuntu installer will install memcached

#!/bin/sh

sudo mkdir /opt/treeio
sudo chown $USER /opt/treeio
cd /opt/treeio

sudo apt-get install python-virtualenv python-pip python-dev unzip nginx libmemcached-dev memcached -y
# libs for pillow
sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk -y
# ubuntu 12.04 see https://github.com/python-pillow/Pillow/blob/master/docs/installation.rst
# sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk -y

virtualenv env
source env/bin/activate
pip install -U setuptools pip
pip install uwsgi pylibmc

wget https://github.com/treeio/treeio/archive/2.0.zip
unzip 2.0.zip
rsync -a treeio-2.0/ treeio
rm -rf treeio-2.0
rm 2.0.zip

pip install -r treeio/requirements.txt

# see http://www.postgresql.org/download/linux/ubuntu/
# this should work for lucid (10.04), precise (12.04), trusty (14.04) and utopic (14.10)
echo "deb http://apt.postgresql.org/pub/repos/apt/ "$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')"-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.4 libpq-dev -y
sudo -u postgres createuser --pwprompt treeio
sudo -u postgres createdb treeio --owner=treeio
pip install psycopg2
cd treeio
python manage.py collectstatic --noinput
python manage.py installdb

#add uwsgi to upstart
sudo ln -s /opt/treeio/treeio/install/upstart.conf  /etc/init/treeio.conf
sudo initctl reload-configuration
sudo start treeio
sudo ln -s /opt/treeio/treeio/install/nginx.conf  /etc/nginx/sites-enabled/treeio
sudo rm  /etc/nginx/sites-enabled/default
sudo nginx -s reload

#!/bin/sh

sudo mkdir /opt/treeio
sudo chown $USER /opt/treeio
cd /opt/treeio

sudo apt-get install python-virtualenv python-pip python-dev unzip nginx -y
# libs for pillow
sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk -y
# ubuntu 12.04 see https://github.com/python-pillow/Pillow/blob/master/docs/installation.rst
# sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk -y

virtualenv env
source env/bin/activate
pip install -U setuptools pip
pip install uwsgi

wget https://github.com/treeio/treeio/archive/2.0.zip
unzip 2.0.zip
rsync -a treeio-2.0/ treeio
rm -rf treeio-2.0
rm 2.0.zip

pip install -r treeio/requirements.txt

# see http://www.postgresql.org/download/linux/ubuntu/
# this should work for lucid (10.04), precise (12.04), trusty (14.04) and utopic (14.10)
echo "deb http://apt.postgresql.org/pub/repos/apt/ "$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')"-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.4 libpq-dev -y
sudo -u postgres createuser --pwprompt treeio
sudo -u postgres createdb treeio --owner=treeio
pip install psycopg2
cd treeio
python manage.py collectstatic --noinput
python manage.py installdb

#add uwsgi to upstart
sudo ln -s /opt/treeio/treeio/install/upstart.conf  /etc/init/treeio.conf
sudo initctl reload-configuration
sudo start treeio
sudo ln -s /opt/treeio/treeio/install/nginx.conf  /etc/nginx/sites-enabled/treeio
sudo rm  /etc/nginx/sites-enabled/default
sudo nginx -s reload


prevent asus from rysncing itself

prevent asus from rysncing itself

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/2vek/dotfiles.git/'


bash script to build all figure 8

bash script to build all figure 8

python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_40a.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_40b.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_40b.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_40c.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_40c.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_80a.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_80a.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_80b.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_80b.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_80c.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_80c.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_120a.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_120a.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_120b.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_120b.h5 ../bigdata/misc/overhand_actions.h5 --C 100

#python build.py mul_s bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_sampledlabel_120c.h5 ../bigdata/misc/overhand_actions.h5 --C 100
python build.py mul_grip bellman ../data/misc/Oct1_landmarks.h5 full ../data/labels/Oct1_fig8_sampledlabel_120c.h5 ../bigdata/misc/overhand_actions.h5 --C 100

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


added gen_tiles.sh

added gen_tiles.sh

#!/usr/bin/env bash
gdalbuildvrt ./merged.vrt $1
#Zoom level 12 is 29.277080383193702 m / pixel near SF
#(Math.cos(40 * Math.PI/180) * 2 * Math.PI * 6378137) / (256 * Math.pow(2, 12))
~/projects/shed/scripts/gdal2tiles.py -w none -n -f tiff -p mercator -z 12 -v tiles

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


Add LCD reset script.

Add LCD reset script.

#!/bin/sh
# Clear and turn off LCD.

if [ -e /dev/serial/matrix_orbital ]
then
	echo -n -e "\xFEX\xFE\x48\xFE\x46" > /dev/serial/matrix_orbital
fi

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


Small script to kill the game every 30 seconds. Used during development.

#!/usr/bin/env bash
while true ; do sleep 30 ; pkill limit ; done

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


Box names were paired up with wrong URLs - fixed that.

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/zatosource/zato-build.git/'


Add script for updating versions

Add script for updating versions

#!/bin/bash

#Execute this script from local checkout of spring cloud stream

./mvnw versions:update-parent -DparentVersion=[0.0.1,$2] -Pspring -DgenerateBackupPoms=false -DallowSnapshots=true
./mvnw versions:set -DnewVersion=$1 -DgenerateBackupPoms=false
./mvnw versions:set -DnewVersion=$1 -DgenerateBackupPoms=false -pl :spring-cloud-stream-tools

lines=$(find . -name 'pom.xml' | xargs egrep "SNAPSHOT|M[0-9]|RC[0-9]" | grep -v regex | wc -l)
if [ $lines -eq 0 ]; then
	echo "No snapshots found"
else
	echo "Snapshots found."
fi

lines=$(find . -name 'pom.xml' | xargs egrep "M[0-9]" | grep -v regex | wc -l)
if [ $lines -eq 0 ]; then
	echo "No milestones found"
else
	echo "Milestones found."
fi

lines=$(find . -name 'pom.xml' | xargs egrep "RC[0-9]" | grep -v regex | wc -l)
if [ $lines -eq 0 ]; then
	echo "No release candidates found"
else
	echo "Release candidates found."
fi

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


feat: update fzd defaults

feat: update fzd defaults

## export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*,!node_modules/*"'
export FZF_DEFAULT_COMMAND='rg --files --follow --hidden'

error: pathspec 'zsh/zsh.after/fzf.zsh' did not match any file(s) known to git


Add logging to email sync script

Add logging to email sync script

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/ascoderu/opwen-webapp.git/'


Added tiler script suitable for crontab.

#!/bin/bash

cd /home/ppawel/src/openstreetmap-watch-list/tiler

set -e

(
  # Try to lock on the lock file (fd 200)
  flock -x -n 200
  ./owl_tiler.rb &>> ~/tiler.log
) 200>/home/ppawel/.tiler.lock

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


Attempting to fix deployment issue with environment variable

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/Clemson-University-Energizer/energizer-app.git/'


Add iOS simulator alias

Add iOS simulator alias

error: pathspec 'xcode/aliases.zsh' did not match any file(s) known to git


don't set iam user for aws stuff because then it tries to destroy my access key...

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/jkais/dotfiles.git/'


Add node modules bin into default path

Add node modules bin into default path

error: pathspec 'zsh/node_path.zsh' did not match any file(s) known to git


Add dummy jenkins script.  Need to fill it in.

#!/bin/bash

echo 'FINISH this Jenkins script!'

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


Added bash script usage display for erroneous usage. Damnit

error: pathspec 'XCAssetGenerator/XCasset' did not match any file(s) known to git
error: pathspec 'Generator.sh' did not match any file(s) known to git


added update notes

added update notes

# these are notes on how to update the repo on pypi

echo 'dont actually run this file'
exit

# update the remote repo
git add .
git commit -m "yourmessage"
git push origin master

# tag the current repo
git tag 0.1 -m "changes to this version"
git push --tags origin master

# send the repo to the test server
python setup.py register -r pypitest
python setup.py sdist upload -r pypitest

# send the repo to the main server
python setup.py register -r pypi
python setup.py sdist upload -r pypi

error: pathspec 'repo-update-notes.sh' did not match any file(s) known to git


Test Kernel

Test Kernel

nvcc --ptx ./test.cu --compiler-bindir ~/bin/nvcc-cc -O3

nvcc --ptx ./test.cu --compiler-bindir ~/devel/vimedix/git/code/tool_src/DopplerSimulation/cc/ -O3


finalized array handling

finalized array handling

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/dagregor/modemstats.git/'


Overlay elpi

Overlay elpi

if [ "$CI_PULL_REQUEST" = "8808" ] || [ "$CI_BRANCH" = "master+support-binder+term-in-abbrev" ]; then

    elpi_CI_REF=master+adapt-coq8808-syndef-same-expressiveness-notation
    elpi_CI_GITURL=https://github.com/herbelin/coq-elpi

fi

error: pathspec 'dev/ci/user-overlays/8808-herbelin-master+support-binder+term-in-abbrev.sh' did not match any file(s) known to git


androidtest.bash: drop noisy adb sync output

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/138070043

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/wesolows/golang-old.git/'


添加复制文件脚本

添加复制文件脚本

#!/bin/sh

# DESTDIR is your target project's dir
DESTDIR=~/github/rt-n56u

ROOTDIR=`pwd`

if [ ! -d "$DESTDIR" ] ; then
	echo "Target project directory not exists! Terminate."
	exit 1
fi

echo "-------------COPY-FILES---------------"

if [ -d "$ROOTDIR/trunk/user/www" ] ; then
	cp -fRv "$ROOTDIR/trunk/user/www" "$DESTDIR/trunk/user"
fi

echo "-------------COPY-END---------------"

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


Update archive build script to remove proj generation

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/brave/browser-ios.git/'


Script to count non-empty LOC

Script to count non-empty LOC

#!/bin/bash

find . -type f |
egrep -v '/(\.git)/' |
egrep '\.(h|c)$' |
egrep -v '(gonzo)\.(c)$' |
while read f
do
    echo -n $f
    cat $f |
    sed -e 's+//.*++g' |
    egrep -v '^[ \t]*$' |
    wc -l
done |
awk '
{
    t += $2;
    printf("%8d %s\n", $2, $1);
}
END {
    printf("%8d %s\n", t, "TOTAL");
}'

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


Add antigen compatible plugin description

# This allows the speedread command to be installed in ZSH using antigen.
# Antigen is a bundle manager. It allows you to enhance the functionality of
# your zsh session by installing bundles and themes easily.

# Antigen documentation:
# http://antigen.sharats.me/
# https://github.com/zsh-users/antigen

# Install speedread:
# antigen bundle matthewfranglen/speedread
# Bundles installed by antigen are available for use immediately.

# Update speedread (and all other antigen bundles):
# antigen update

# The antigen command will download the git repository to a folder and then
# execute an enabling script (this file). The complete process for loading the
# code is documented here:
# https://github.com/zsh-users/antigen#notes-on-writing-plugins

# This specific script just adds the repository folder to the PATH, allowing it
# to be run from any location.
export PATH=${PATH}:$(dirname $0)

error: pathspec 'speedread.plugin.zsh' did not match any file(s) known to git


Adding Script to delete artifacts through artifactory REST API with the command line script

#!/bin/bash
#replace <username> with your artifactory username
#replace <password> with your artifactory password
#replace <repo> with your artifactory domain name

# find all artifacts created in 2013, time are expressed in milliseconds
# grep look for uri attribute in JSON results returned then awk take the corresponding value of the uri attribute. The first 2 sed commands remove the last character and the last sed command remove the first character, ie stripping off the comma and double quotes from the URL in awk
RESULTS=`curl -s -X GET -u <username>:<password> "https://<repo>.artifactoryonline.com/<repo>/api/search/creation?from=$START_TIME&to=$END_TIME&repos=$REPO" | grep uri | awk '{print $3}' | sed s'/.$//' | sed s'/.$//' | sed -r 's/^.{1}//'`
for RESULT in $RESULTS ; do
    echo "fetching path from $RESULT"
    # from the URL we fetch the download uri to remove
    # grep look for downloadUri attribute in JSON results returned then awk take the corresponding value of the downloadUri attribute. The first 2 sed commands remove the last character and the last sed command remove the first character, ie stripping off the comma and double quotes from the URL in awk
    PATH_TO_FILE=`curl -s -X GET -u <username>:<password> $RESULT | grep downloadUri | awk '{print $3}' | sed s'/.$//' | sed s'/.$//' | sed -r 's/^.{1}//'`
    echo "deleting path $PATH_TO_FILE"
    # deleting the corresponding artifact at last
    curl -X DELETE -u <username>:<password> $PATH_TO_FILE
done

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


Update build.sh

Update build.sh

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/codilime/cloudify-agent.git/'


update scripts

update scripts

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/TOTVS/mdmpublic.git/'


images/script: update the example hubble cli Deployment version

Signed-off-by: Alexandre Perrin <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@kaworu.ch>

#!/bin/bash

# Copyright 2017-2021 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

set -o errexit
set -o pipefail
set -o nounset

root_dir="$(git rev-parse --show-toplevel)"
hubble_version_script="${root_dir}/images/cilium/hubble-version.sh"
hubble_cli_example="${root_dir}/examples/hubble/hubble-cli.yaml"

cd "${root_dir}"

if [ "$#" -ne 1 ] ; then
  echo "$0 supports exactly 1 argument - <hubble_version>"
  exit 1
fi

hubble_version="${1}"

# this is a simple array that assumes the order of the loop;
# it's not an associative array because this script needs to
# work on any version of bash, and (most notably) macOS ships
# an old version that doesn't support associative arrays
hubble_sha256=()

for arch in amd64 arm64 ; do
  tmpout="$(mktemp)"
  curl --fail --show-error --silent --location \
    "https://github.com/cilium/hubble/releases/download/${hubble_version}/hubble-linux-${arch}.tar.gz.sha256sum" \
    --output "${tmpout}"
  read -ra sha256 < "${tmpout}"
  rm -f "${tmpout}"
  hubble_sha256+=("${sha256[0]}")
done

cat > "$hubble_version_script" << EOF
# Code generated by images/scripts/update-hubble-version.sh; DO NOT EDIT.
hubble_version="${hubble_version}"
declare -A hubble_sha256
hubble_sha256[amd64]="${hubble_sha256[0]}"
hubble_sha256[arm64]="${hubble_sha256[1]}"
EOF

sed -e "s#\\(image: .*/hubble:\\).*#\1${hubble_version}#" "$hubble_cli_example" > "${hubble_cli_example}.tmp" &&
    mv "${hubble_cli_example}.tmp" "$hubble_cli_example"

#!/bin/bash

# Copyright 2017-2021 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

set -o errexit
set -o pipefail
set -o nounset

root_dir="$(git rev-parse --show-toplevel)"

cd "${root_dir}"

if [ "$#" -ne 1 ] ; then
  echo "$0 supports exactly 1 argument - <hubble_version>"
  exit 1
fi

hubble_version="${1}"

# this is a simple array that assumes the order of the loop;
# it's not an associative array because this script needs to
# work on any version of bash, and (most notably) macOS ships
# an old version that doesn't support associative arrays
hubble_sha256=()

for arch in amd64 arm64 ; do
  tmpout="$(mktemp)"
  curl --fail --show-error --silent --location \
    "https://github.com/cilium/hubble/releases/download/${hubble_version}/hubble-linux-${arch}.tar.gz.sha256sum" \
    --output "${tmpout}"
  read -ra sha256 < "${tmpout}"
  rm -f "${tmpout}"
  hubble_sha256+=("${sha256[0]}")
done

cat > "${root_dir}/images/cilium/hubble-version.sh" << EOF
# Code generated by images/scripts/update-hubble-version.sh; DO NOT EDIT.
hubble_version="${hubble_version}"
declare -A hubble_sha256
hubble_sha256[amd64]="${hubble_sha256[0]}"
hubble_sha256[arm64]="${hubble_sha256[1]}"
EOF


Add rake-fast plugin for fast rake autocompletion

# rake-fast
# Fast rake autocompletion plugin for oh-my-zsh

# This script caches the output for later usage and significantly speeds it up.
# It generates a .rake_tasks file in parallel to the Rakefile.

# You'll want to add `.rake_tasks` to your global .git_ignore file:
# https://help.github.com/articles/ignoring-files#global-gitignore

# You can force .rake_tasks to refresh with:
# $ rake_refresh

# This is entirely based on Ullrich Schäfer's work
# (https://github.com/robb/.dotfiles/pull/10/),
# which is inspired by this Ruby on Rails trick from 2006:
# http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/

# Author: Kevin Bongart
# contact@kevinbongart.net
# http://kevinbongart.net
# https://github.com/KevinBongart

_rake_refresh () {
  if [ -f .rake_tasks ]; then
    rm .rake_tasks
  fi
  echo "Generating .rake_tasks..." > /dev/stderr
  _rake_generate
  cat .rake_tasks
}

_rake_does_task_list_need_generating () {
  if [ ! -f .rake_tasks ]; then return 0;
  else
    accurate=$(stat -f%m .rake_tasks)
    changed=$(stat -f%m Rakefile)
    return $(expr $accurate '>=' $changed)
  fi
}

_rake_generate () {
  rake --silent --tasks | cut -d " " -f 2 > .rake_tasks
}

_rake () {
  if [ -f Rakefile ]; then
    if _rake_does_task_list_need_generating; then
      echo "\nGenerating .rake_tasks..." > /dev/stderr
      _rake_generate
    fi
    compadd `cat .rake_tasks`
  fi
}

compdef _rake rake
alias rake_refresh='_rake_refresh'

error: pathspec 'plugins/rake-fast/rake-fast.plugin.zsh' did not match any file(s) known to git


Change backup health report path

Change backup health report path

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/zbase/zbase-backup-tools.git/'


wait for head node to start before starting compute hosts

#!/usr/bin/env bash
# Head node host, which runs glance, api, keystone
HEAD_HOST=${HEAD_HOST:-192.168.1.52}
COMPUTE_HOSTS=${COMPUTE_HOSTS:-192.168.1.53,192.168.1.54}

# Networking params
NAMESERVER=${NAMESERVER:-192.168.2.1}
GATEWAY=${GATEWAY:-192.168.1.1}

# Variables common amongst all hosts in the cluster
COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0"

# Helper to launch containers
function run_lxc {
    # For some reason container names with periods can cause issues :/
    CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
}

# Launch the head node - headnode uses a non-ip domain name,
# because rabbit won't launch with an ip addr hostname :(
run_lxc STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit"

# Wait till the head node is up
while ! wget -O - http://$HEAD_HOST | grep -q username; do
    echo "Waiting for head node ($HEAD_HOST) to start..."
    sleep 5
done

for compute_host in ${COMPUTE_HOSTS//,/ }; do
    # Launch the compute hosts
    run_lxc $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api"
done

#!/usr/bin/env bash
# Head node host, which runs glance, api, keystone
HEAD_HOST=${HEAD_HOST:-192.168.1.52}
COMPUTE_HOSTS=${COMPUTE_HOSTS:-192.168.1.53,192.168.1.54}

# Networking params
NAMESERVER=${NAMESERVER:-192.168.2.1}
GATEWAY=${GATEWAY:-192.168.1.1}

# Variables common amongst all hosts in the cluster
COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0"

# Helper to launch containers
function run_lxc {
    # For some reason container names with periods can cause issues :/
    CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER STACKSH_PARAMS="$COMMON_VARS $3" ./build_lxc.sh
}

# Launch the head node - headnode uses a non-ip domain name,
# because rabbit won't launch with an ip addr hostname :(
run_lxc STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit"
for compute_host in ${COMPUTE_HOSTS//,/ }; do
    # Launch the compute hosts
    run_lxc $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api"
done


Quit pretending like I haven't been using Atom for over a year

# Only set this if we haven't set $EDITOR up somewhere else previously.
if [[ "$EDITOR" == "" ]] ; then
  # Use sublime for my editor.
  export EDITOR='subl'
fi


Switch to clock_gettime for time read Remove gettimeofday Add clone (WIP) Add mesa (WIP)

#!/bin/bash
source environ.sh

BROKEN

SRC=ftp://ftp.freedesktop.org/pub/mesa/11.0.4/mesa-11.0.4.tar.xz
DIR=mesa-11.0.4

CONFIGURE_ARGS="--host=i386-elf-redox --prefix=$PREFIX"
autoconf_template $*

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


test: create script `run_test.sh`

test: create script `run_test.sh`

#!/bin/sh

help_message=<<EOF

This script runs \`./src/test/efmp_test.ml\` with various arguments

The arguments are passed to the \`start\` command (useful for setting options)
EOF

persist_on=`mktemp`

run_test() {
  local cmd=$1
  shift
  ocaml ./src/test/efmp_test.ml $cmd -P $persist_on $*
}

show_info() {
  echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
  echo "$*"
  echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
  run_test info
  echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
  echo ""
}

run_test init
run_test start test
run_test wake-up
show_info After first wake-up

if [ $# -gt 0 ]; then
  run_test start test $*
  run_test wake-up
  show_info After second wake-up
fi

sleep=2
echo "======================== SLEEP $sleep =========================="
sleep $sleep
run_test wake-up
run_test wake-up

echo "=================================================="
echo "info --all"
echo "=================================================="
run_test info --all

rm -fr $persist_on

error: pathspec 'src/test/run_test.sh' did not match any file(s) known to git


Add bash script to automate "Preparation for GPG" (#6015)

* Add bash script to automate "Preparation for GPG"

#!/bin/bash
#
#    Licensed to the Apache Software Foundation (ASF) under one or more
#    contributor license agreements.  See the NOTICE file distributed with
#    this work for additional information regarding copyright ownership.
#    The ASF licenses this file to You under the Apache License, Version 2.0
#    (the "License"); you may not use this file except in compliance with
#    the License.  You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#

# This script will install and configure GPG key.

set -e

LOCAL_SVN_DIR=local_svn_dir
ROOT_SVN_URL=https://dist.apache.org/repos/dist/
DEV_REPO=dev
RELEASE_REPO=release
BEAM_REPO=beam

cd ~

echo "=================Checking GPG Key===================="
echo "You need a GPG key which reflects your Apache account."
echo "Do you want to generate a new GPG key associated with your Apache account? [y|N]"
read confirmation
if [[ $confirmation = "y" ]]; then
  echo "===============Generating new GPG key================"
  sudo apt-get install rng-tools
  sudo rngd -r /dev/urandom
  gpg --full-generate-key
fi

echo "================Listing all GPG keys================="
gpg --list-keys
echo "Please copy the public key which is associated with your Apache account:"
read pub_key

echo "===========Configuring git signing key==============="
git config --global user.signingkey $pub_key
git config --list

echo "===========Adding your key into KEYS file============"
echo "It's required to append your key into KEYS file in dist.apache.org"
echo "Have you put your key in KEYS? [y|N]"
read confirmation
if [[ $confirmation != "y" ]]; then
  echo "Only PMC member can write into dist.apache.org. Are you a PMC member? [y|N]"
  read pmc_permission
  if [[ $pmc_permission != "y" ]]; then
    echo "Please ask a PMC member to help you add your key in dev@ list."
    echo "Skip adding key into dist.apache.org/KEYS file."
  else
    echo "Please input your name: "
    read name
    echo "======Starting updating KEYS file in dev repo===="
    mkdir ${LOCAL_SVN_DIR}
    cd ${LOCAL_SVN_DIR}
    svn co ${ROOT_SVN_URL}/${DEV_REPO}/${BEAM_REPO}
    cd ${BEAM_REPO}
    (gpg --list-sigs ${name} && gpg --armor --export ${name}) >> KEYS
    svn status
    echo "Please review all changes. Do you confirm to commit? [y|N]"
    read commit_confirmation
    if [[ $commit_confirmation = "y" ]]; then
      svn commit KEYS
    else
      echo "Not commit new changes into ${ROOT_SVN_URL}/${DEV_REPO}/${BEAM_REPO}${DEV_REPO}/KEYS"
    fi

    cd ~/${LOCAL_SVN_DIR}
    echo "===Starting updating KEYS file in release repo==="
    svn co ${ROOT_SVN_URL}/${RELEASE_REPO}/${BEAM_REPO}
    cd ${BEAM_REPO}
    (gpg --list-sigs ${name} && gpg --armor --export ${name}) >> KEYS
    svn status
    echo "Please review all changes. Do you confirm to commit? [y|N]"
    read commit_confirmation
    if [[ $commit_confirmation = "y" ]]; then
      svn commit KEYS
    else
      echo "Not commit new changes into ${ROOT_SVN_URL}/${DEV_REPO}/${BEAM_REPO}${RELEASE_REPO}/KEYS"
    fi

    cd ~
    rm -rf ${LOCAL_SVN_DIR}
  fi
fi

echo "================Setting up gpg agent================="
eval $(gpg-agent --daemon --no-grab --write-env-file $HOME/.gpg-agent-info)
export GPG_TTY=$(tty)
export GPG_AGENT_INFO

error: pathspec 'release/src/main/scripts/preparation_before_release.sh' did not match any file(s) known to git


Extend the default timeout for killing apps and allow it to be controlled via
  an environment variable.

DELTA=8  (6 added, 0 deleted, 2 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/qokelate/google-toolbox-for-mac.git/'


Add ping command by default on docker

Add ping command by default on docker

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/Jumpscale/developer.git/'


add nvim build script

add nvim build script

#!/usr/bin/env bash
echo "Installing neovim from source..."

echo "Installing prerequisites..."
#sudo apt-get install libtool libtool-bin autoconf automake cmake g++ pkg-config unzip
sudo apt-get install ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip

echo "Building..."
cd "$RUNCOM_TMPDIR" || exit 255

git clone https://github.com/neovim/neovim.git

cd neovim

#make CMAKE_BUILD_TYPE=RelWithDebInfo
make CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/.local/neovim"

make install

ln -sf "$HOME/.local/neovim/bin/nvim" "$HOME/bin/nvim"

error: pathspec 'setup/special/install-nvim-from-source.sh' did not match any file(s) known to git


tests/2nodes_test: add `example_st_update_fee.sh`

#!/bin/bash -ue

if [ -z "$1" ] || [ -z "$2" ]; then
	echo invalid parameter [$1] [$2]
	echo [node] [feerate_per_kw]
	exit 128
fi

NODE=node_$1
NODE_PORT=$(( $1 + 1 ))
FEERATE_PER_KW=$2

update_fee() {
	echo "feerate_per_kw $FEERATE_PER_KW"
	echo "port $NODE_PORT"

	./ptarmcli --setfeerate $FEERATE_PER_KW $NODE_PORT
	if [ $? -ne 0 ]; then
		echo fail update_fee
		exit 2
	fi
}

update_fee

error: pathspec 'tests/2nodes_test/example_st_update_fee.sh' did not match any file(s) known to git


add apache-airflow

add apache-airflow

#!/bin/bash
# sudo portion of python package installations

set -v
set +o errexit

echo "Running python installation"
#PYTHON_ARGS=--upgrade
#missing zipline since requirements installation causes issues

if [[ ! -z "$http_proxy" ]] ; then
    git config --global http.proxy $http_proxy
    if [[ ! -z "$GIT_PROXY" ]] ; then
	git config --global url."$GIT_PROXY".insteadOf https://
    fi
    git config --global http.sslVerify false
fi

# Pypi Tensorflow will fail on noavx
if [[ ! -z "$NOAVX" ]] ; then
    export TENSORFLOW=http://github.com/evdcush/TensorFlow-wheels/releases/download/tf-1.13.1-py37-cpu-westmere/tensorflow-1.13.1-cp37-cp37m-linux_x86_64.whl
else
    export TENSORFLOW=tensorflow==2.0.0-beta1
fi

# see http://click.pocoo.org/5/python3/
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export ONNX_ML=1

SUPERSET=git+https://github.com/apache/incubator-superset.git

# Astropy is needed for tushare
# nnabla has dependence on old cython which breaks things
# install eventsourcing for dateutil

echo "pip_index_url=" $PIP_INDEX_URL

pip3 install --upgrade pip --prefix /usr
#remove to avoid attribute error
pip3 uninstall numpy -y
pip3 install --upgrade numpy requests six python-dateutil \
     matplotlib pandas scipy pythreejs --prefix /usr

pip3 install --upgrade $TENSORFLOW --prefix /usr

"""
pip3 install --upgrade torch --prefix /usr

# Fix for eventsourcing
pip3 install --upgrade pycryptodome --prefix /usr
cat <<EOF > /tmp/constraints.es.txt
six
requests
pycrypto
pycryptodome
python-dateutil
EOF

pip3 install --no-deps eventsourcing --prefix /usr
pip3 install --upgrade eventsourcing --prefix /usr -c /tmp/constraints.es.txt
"""

# reinstall to get jupyter executable
# force 4.4.0 to work around ijavascript install issue
# https://github.com/n-riesco/ijavascript/issues/200
pip3 install --upgrade --force-reinstall jupyter-core --prefix /usr
pip3 install --upgrade $PYTHON_ARGS entrypoints --prefix /usr

# get fix for libpacke
pip3 install --upgrade git+https://github.com/joequant/libact.git --prefix /usr

PYCURL_SSL_LIBRARY=openssl pip3 install pycurl --prefix /usr

#Use tf-nightly-gpu instead of tensorflow to get python 3.7

cat <<EOF | xargs --max-args=12 --max-procs=$(nproc) pip3 install --upgrade $PYTHON_ARGS --prefix /usr --no-cache-dir
git+https://github.com/joequant/ethercalc-python.git
git+https://github.com/joequant/spyre.git
git+https://github.com/joequant/cryptoexchange.git
git+https://github.com/joequant/algobroker.git
git+https://github.com/joequant/bitcoin-price-api.git
git+https://github.com/joequant/pythalesians.git
git+https://github.com/quantopian/pyfolio.git
git+https://github.com/ematvey/pybacktest.git
git+https://github.com/bashtage/arch.git
git+https://github.com/joequant/OrderBook.git
git+https://github.com/joequant/bitcoin-etl.git
git+https://github.com/joequant/dynts.git
git+https://github.com/pymc-devs/pymc3
sklearn
Werkzeug
dgl
Flask
pyzmq
ccxt
jupyterlab
numba
ipympl
import-ipynb
astropy
jupyterhub
nbconvert
sudospawner
circuits
dask
xarray
networkx
lightning-python
vispy
pyalgotrade
statsmodels
ipywidgets
ipyvolume
jupyter_declarativewidgets
vega
nbpresent
jupyter_latex_envs
jupyterlab_latex
bqplot
cookiecutter
scikit-image
patsy
beautifulsoup4
pymongo
emcee
ipython_mongo
seaborn
ipysheet
toyplot
ad
arviz
collections-extended
mpmath
multimethods
openpyxl
param
xray
FinDates
html5lib
twilio
plivo
ggplot
pygal
plotly
holoviews
bokeh
fastcluster
ib-api
pandas-datareader
blaze
statsmodels
redis
redis-dump-load
picos
ecos
swiglpk
smcp
optlang
smcp
configproxy
prettyplotlib
mpld3
networkx
qgrid
iminuit
lmfit
redis_kernel
bash_kernel
octave_kernel
jupyter_nbextensions_configurator
pyfolio
VisualPortfolio
empyrical
qfrm
tradingWithPython
trade
chinesestockapi
bizdays
ffn
pulsar
pyspark
cvxopt
pynance
keras
nolearn
theano
nltk
gensim
scrapy
statsmodels
gym
milk
neurolab
pyrenn
jupyterlab_widgets
jhub_remote_user_authenticator
dash
dash_renderer
dash_core_components
dash_html_components
py4j
xgboost
catboost
lightgbm
tensorly
pyro-ppl
torchvision
gpytorch
horovod
skflow
pyomo
jupyter-tensorboard
flake8
vega_datasets
altair
Candela
web3
py-solc
opencv-python
dm-sonnet
tributary
mpld3
itkwidgets
jupyterlab_templates
Jupyter-Video-Widget
pybrain
ipyparallel
astroml
ffn
pyfin
vollib
FRB
folium
pattern
onnx
tzlocal
mypy
sidecar
black
yapf
autopep8
beakerx
jupytext>=1.0.1
jupyterlab_code_formatter
cppyy-cling
modAL
alipy
mglearn
bitcoin-tools
jupyter_dashboards
tributary
jupyter-git
cryptocompare
coinmarketcap
bitfinex-tencars
cryptowatch-client
voila
RISE
lolviz
papermill
ipytree
apache-airflow
EOF

python3 -m bash_kernel.install --sys-prefix

#broken
#TA-Lib
#pylantern
#pytext-nlp
#quandl
#jupyterlab_iframe
#ipyleaflet

# eventsourcing
#git+https://github.com/joequant/quantdsl.git

#not instaled
#pywwt
#nbdime

#jupytext 1.0.1 fixes issue #185
# https://github.com/mwouts/jupytext/issues/185

"""
cat <<EOF > /tmp/constraints.txt
numpy
matplotlib
xarray
pandas
jupyterlab_autoversion
ipyaggrid
EOF

pip3 install --no-deps mxnet nnabla allennlp pyquickhelper ipyleaflet $SUPERSET --prefix /usr
pip3 install --upgrade mxnet allennlp nnabla pyquickhelper ipyleaflet $SUPERSET --prefix /usr -c /tmp/constraints.txt
"""

# Set registry to non-ssl to allow caching
echo "Installing webpack"

npm install -g --unsafe webpack webpack-command

#link staging jupyterlab yarn to system yarn
#pushd $(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/jupyterlab/staging
#ln -s -f ../../../../../lib/node_modules/yarn/lib/cli.js yarn.js
#popd

# There are some compile errors
#jupyter labextension install jupyterlab-spreadsheet
#jupyter labextension install holmantai/xyz-extension

#node-gyp requires that python be linked to python2

if [[ ! -z "$http_proxy" ]] ; then
    pushd $(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/jupyterlab/staging
    cp .yarnrc .yarnrc.dist
    cat >> .yarnrc <<EOF
registry "http://registry.npmjs.org"
EOF
    popd
fi

cat <<EOF | xargs --max-args=12 --max-procs=1 jupyter labextension install --dev-build=False
@jupyterlab/git
jupyterlab_tensorboard
jupyter-matplotlib
jupyterlab_templates
ipysheet
jupyterlab-drawio
jupyterlab-python-file
jupyterlab-spreadsheet
jupyterlab_filetree
@jupyterlab/toc
@jupyterlab/latex
@jupyter-widgets/jupyterlab-manager
bqplot-jupyterlab
@mflevine/jupyterlab_html
@jupyterlab/mathjax3-extension
jupyterlab_autoversion
@oriolmirosa/jupyterlab_materialdarker
@ryantam626/jupyterlab_code_formatter
@jupyterlab/fasta-extension
@jupyterlab/geojson-extension
@jupyterlab/katex-extension
@jupyterlab/vega4-extension
@jupyterlab/celltags
@jupyterlab/git
jupyterlab_bokeh
@jupyter-voila/jupyterlab-preview
ipytree
EOF

:'
@enlznep/jupyterlab_shell_file
@lckr/jupyterlab_variableinspector
@agoose77/jupyterlab-attachments
@jupyterlab/plotly-extension
>>>>>>> 05097627978969f24871b43c65ada2b34cd44f41
jupyter-leaflet
@jupyterlab/google-drive
nbdime-jupyterlab
jupyterlab_voyager
qgrid
jupyterlab-kernelspy
@ijmbarr/jupyterlab_spellchecker
@jupyterlab/hub-extension
@pyviz/jupyterlab_holoviews
@candela/jupyterlab
jupyterlab_iframe
@jupyter-widgets/jupyterlab-sidecar
@krassowski/jupyterlab_go_to_definition
@lean-data-science/jupyterlab_credentialstore
@hkjinlee/jupyterlab_gz
@jupyterlab/vega2-extension
@jupyterlab/vega3-extension
'

# broken packages
# pylantern
#ipyaggrid

#jupyter lab build --dev-build=False
jupyter dashboards quick-setup --sys-prefix
jupyter nbextensions_configurator enable --sys-prefix
#jupyter nbextension install --py --sys-prefix jpy_video --system
#jupyter nbextension enable  --py --sys-prefix jpy_video --system
#jupyter labextension install jupyter-video
jupyter serverextension enable --py jupyterlab --sys-prefix
jupyter serverextension enable --py jupyter_tensorboard --sys-prefix
jupyter serverextension enable --py jupyterlab_code_formatter --sys-prefix
jupyter serverextension enable --py jupyterlab_git --sys-prefix
#jupyter nbextension disable --py --sys-prefix ipysheet.renderer_nbext
#jupyter labextension disable ipysheet:renderer # for jupyter lab
#jupyter serverextension enable --py jupyterlab_templates
#jupyter serverextension enable --py jupyterlab_iframe

:'
fabmanager create-admin --app superset
superset db upgrade
superset init
superset load_examples
'

if [ ! -e /usr/bin/ipython ] ; then
pushd /usr/bin
ln -s ipython3 ipython
popd
fi

#Create rhea user to spawn jupyterhub
useradd -r rhea -s /bin/false -M -G shadow
if [[ ! -z "$http_proxy" ]] ; then
    pushd $(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/jupyterlab/staging
    mv -f .yarnrc.dist .yarnrc
    popd
fi

#!/bin/bash
# sudo portion of python package installations

set -v
set +o errexit

echo "Running python installation"
#PYTHON_ARGS=--upgrade
#missing zipline since requirements installation causes issues

if [[ ! -z "$http_proxy" ]] ; then
    git config --global http.proxy $http_proxy
    if [[ ! -z "$GIT_PROXY" ]] ; then
	git config --global url."$GIT_PROXY".insteadOf https://
    fi
    git config --global http.sslVerify false
fi

# Pypi Tensorflow will fail on noavx
if [[ ! -z "$NOAVX" ]] ; then
    export TENSORFLOW=http://github.com/evdcush/TensorFlow-wheels/releases/download/tf-1.13.1-py37-cpu-westmere/tensorflow-1.13.1-cp37-cp37m-linux_x86_64.whl
else
    export TENSORFLOW=tensorflow==2.0.0-beta1
fi

# see http://click.pocoo.org/5/python3/
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export ONNX_ML=1

SUPERSET=git+https://github.com/apache/incubator-superset.git

# Astropy is needed for tushare
# nnabla has dependence on old cython which breaks things
# install eventsourcing for dateutil

echo "pip_index_url=" $PIP_INDEX_URL

pip3 install --upgrade pip --prefix /usr
#remove to avoid attribute error
pip3 uninstall numpy -y
pip3 install --upgrade numpy requests six python-dateutil \
     matplotlib pandas scipy pythreejs --prefix /usr

pip3 install --upgrade $TENSORFLOW --prefix /usr

"""
pip3 install --upgrade torch --prefix /usr

# Fix for eventsourcing
pip3 install --upgrade pycryptodome --prefix /usr
cat <<EOF > /tmp/constraints.es.txt
six
requests
pycrypto
pycryptodome
python-dateutil
EOF

pip3 install --no-deps eventsourcing --prefix /usr
pip3 install --upgrade eventsourcing --prefix /usr -c /tmp/constraints.es.txt
"""

# reinstall to get jupyter executable
# force 4.4.0 to work around ijavascript install issue
# https://github.com/n-riesco/ijavascript/issues/200
pip3 install --upgrade --force-reinstall jupyter-core --prefix /usr
pip3 install --upgrade $PYTHON_ARGS entrypoints --prefix /usr

# get fix for libpacke
pip3 install --upgrade git+https://github.com/joequant/libact.git --prefix /usr

PYCURL_SSL_LIBRARY=openssl pip3 install pycurl --prefix /usr

#Use tf-nightly-gpu instead of tensorflow to get python 3.7

cat <<EOF | xargs --max-args=12 --max-procs=$(nproc) pip3 install --upgrade $PYTHON_ARGS --prefix /usr --no-cache-dir
git+https://github.com/joequant/ethercalc-python.git
git+https://github.com/joequant/spyre.git
git+https://github.com/joequant/cryptoexchange.git
git+https://github.com/joequant/algobroker.git
git+https://github.com/joequant/bitcoin-price-api.git
git+https://github.com/joequant/pythalesians.git
git+https://github.com/quantopian/pyfolio.git
git+https://github.com/ematvey/pybacktest.git
git+https://github.com/bashtage/arch.git
git+https://github.com/joequant/OrderBook.git
git+https://github.com/joequant/bitcoin-etl.git
git+https://github.com/joequant/dynts.git
git+https://github.com/pymc-devs/pymc3
sklearn
Werkzeug
dgl
Flask
pyzmq
ccxt
jupyterlab
numba
ipympl
import-ipynb
astropy
jupyterhub
nbconvert
sudospawner
circuits
dask
xarray
networkx
lightning-python
vispy
pyalgotrade
statsmodels
ipywidgets
ipyvolume
jupyter_declarativewidgets
vega
nbpresent
jupyter_latex_envs
jupyterlab_latex
bqplot
cookiecutter
scikit-image
patsy
beautifulsoup4
pymongo
emcee
ipython_mongo
seaborn
ipysheet
toyplot
ad
arviz
collections-extended
mpmath
multimethods
openpyxl
param
xray
FinDates
html5lib
twilio
plivo
ggplot
pygal
plotly
holoviews
bokeh
fastcluster
ib-api
pandas-datareader
blaze
statsmodels
redis
redis-dump-load
picos
ecos
swiglpk
smcp
optlang
smcp
configproxy
prettyplotlib
mpld3
networkx
qgrid
iminuit
lmfit
redis_kernel
bash_kernel
octave_kernel
jupyter_nbextensions_configurator
pyfolio
VisualPortfolio
empyrical
qfrm
tradingWithPython
trade
chinesestockapi
bizdays
ffn
pulsar
pyspark
cvxopt
pynance
keras
nolearn
theano
nltk
gensim
scrapy
statsmodels
gym
milk
neurolab
pyrenn
jupyterlab_widgets
jhub_remote_user_authenticator
dash
dash_renderer
dash_core_components
dash_html_components
py4j
xgboost
catboost
lightgbm
tensorly
pyro-ppl
torchvision
gpytorch
horovod
skflow
pyomo
jupyter-tensorboard
flake8
vega_datasets
altair
Candela
web3
py-solc
opencv-python
dm-sonnet
tributary
mpld3
itkwidgets
jupyterlab_templates
Jupyter-Video-Widget
pybrain
ipyparallel
astroml
ffn
pyfin
vollib
FRB
folium
pattern
onnx
tzlocal
mypy
sidecar
black
yapf
autopep8
beakerx
jupytext>=1.0.1
jupyterlab_code_formatter
cppyy-cling
modAL
alipy
mglearn
bitcoin-tools
jupyter_dashboards
tributary
jupyter-git
cryptocompare
coinmarketcap
bitfinex-tencars
cryptowatch-client
voila
RISE
lolviz
papermill
ipytree
EOF

python3 -m bash_kernel.install --sys-prefix

#broken
#TA-Lib
#pylantern
#pytext-nlp
#quandl
#jupyterlab_iframe
#ipyleaflet

# eventsourcing
#git+https://github.com/joequant/quantdsl.git

#not instaled
#pywwt
#nbdime

#jupytext 1.0.1 fixes issue #185
# https://github.com/mwouts/jupytext/issues/185

"""
cat <<EOF > /tmp/constraints.txt
numpy
matplotlib
xarray
pandas
jupyterlab_autoversion
ipyaggrid
EOF

pip3 install --no-deps mxnet nnabla allennlp pyquickhelper ipyleaflet $SUPERSET --prefix /usr
pip3 install --upgrade mxnet allennlp nnabla pyquickhelper ipyleaflet $SUPERSET --prefix /usr -c /tmp/constraints.txt
"""

# Set registry to non-ssl to allow caching
echo "Installing webpack"

npm install -g --unsafe webpack webpack-command

#link staging jupyterlab yarn to system yarn
#pushd $(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/jupyterlab/staging
#ln -s -f ../../../../../lib/node_modules/yarn/lib/cli.js yarn.js
#popd

# There are some compile errors
#jupyter labextension install jupyterlab-spreadsheet
#jupyter labextension install holmantai/xyz-extension

#node-gyp requires that python be linked to python2

if [[ ! -z "$http_proxy" ]] ; then
    pushd $(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/jupyterlab/staging
    cp .yarnrc .yarnrc.dist
    cat >> .yarnrc <<EOF
registry "http://registry.npmjs.org"
EOF
    popd
fi

cat <<EOF | xargs --max-args=12 --max-procs=1 jupyter labextension install --dev-build=False
@jupyterlab/git
jupyterlab_tensorboard
jupyter-matplotlib
jupyterlab_templates
ipysheet
jupyterlab-drawio
jupyterlab-python-file
jupyterlab-spreadsheet
jupyterlab_filetree
@jupyterlab/toc
@jupyterlab/latex
@jupyter-widgets/jupyterlab-manager
bqplot-jupyterlab
@mflevine/jupyterlab_html
@jupyterlab/mathjax3-extension
jupyterlab_autoversion
@oriolmirosa/jupyterlab_materialdarker
@ryantam626/jupyterlab_code_formatter
@jupyterlab/fasta-extension
@jupyterlab/geojson-extension
@jupyterlab/katex-extension
@jupyterlab/vega4-extension
@jupyterlab/celltags
@jupyterlab/git
jupyterlab_bokeh
@jupyter-voila/jupyterlab-preview
ipytree
EOF

:'
@enlznep/jupyterlab_shell_file
@lckr/jupyterlab_variableinspector
@agoose77/jupyterlab-attachments
@jupyterlab/plotly-extension
>>>>>>> 05097627978969f24871b43c65ada2b34cd44f41
jupyter-leaflet
@jupyterlab/google-drive
nbdime-jupyterlab
jupyterlab_voyager
qgrid
jupyterlab-kernelspy
@ijmbarr/jupyterlab_spellchecker
@jupyterlab/hub-extension
@pyviz/jupyterlab_holoviews
@candela/jupyterlab
jupyterlab_iframe
@jupyter-widgets/jupyterlab-sidecar
@krassowski/jupyterlab_go_to_definition
@lean-data-science/jupyterlab_credentialstore
@hkjinlee/jupyterlab_gz
@jupyterlab/vega2-extension
@jupyterlab/vega3-extension
'

# broken packages
# pylantern
#ipyaggrid

#jupyter lab build --dev-build=False
jupyter dashboards quick-setup --sys-prefix
jupyter nbextensions_configurator enable --sys-prefix
#jupyter nbextension install --py --sys-prefix jpy_video --system
#jupyter nbextension enable  --py --sys-prefix jpy_video --system
#jupyter labextension install jupyter-video
jupyter serverextension enable --py jupyterlab --sys-prefix
jupyter serverextension enable --py jupyter_tensorboard --sys-prefix
jupyter serverextension enable --py jupyterlab_code_formatter --sys-prefix
jupyter serverextension enable --py jupyterlab_git --sys-prefix
#jupyter nbextension disable --py --sys-prefix ipysheet.renderer_nbext
#jupyter labextension disable ipysheet:renderer # for jupyter lab
#jupyter serverextension enable --py jupyterlab_templates
#jupyter serverextension enable --py jupyterlab_iframe

:'
fabmanager create-admin --app superset
superset db upgrade
superset init
superset load_examples
'

if [ ! -e /usr/bin/ipython ] ; then
pushd /usr/bin
ln -s ipython3 ipython
popd
fi

#Create rhea user to spawn jupyterhub
useradd -r rhea -s /bin/false -M -G shadow
if [[ ! -z "$http_proxy" ]] ; then
    pushd $(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/jupyterlab/staging
    mv -f .yarnrc.dist .yarnrc
    popd
fi


regression script for csysdig

regression script for csysdig

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/angeloc/sysdig.git/'