add 404 options to mran config, closes RA-Internal/MRAN-site#27

#mran.revolutionanalytics.com
#Chris Mosetick 2014-06-12
#last update    2014-10-07

server {
        #listen on IPv4 and IPv6 addresses at the same time
        listen 80;
        listen [::]:80;

        #directory in the file system to serve web pages and packages from
        #this is a detachable block disk formatted with ZFS that can be easily moved to another server
        #www dir is for landing page stuff
        #root /MRAN/www;
        root /home/mran-user/src/MRAN-site/dist;
        index index.html index.htm;

        # public facing domain name for this vhost
        server_name mran.revolutionanalytics.com;

	access_log /var/log/nginx/mran.revolutionanalytics.com.log;
	error_log /var/log/nginx/error-mran.revolutionanalytics.com.log;

        #define the location of the Nodejs instance running on this system
        #location / {
        #proxy_pass http://localhost:7300/;
        #proxy_set_header Host $host;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #}

	#define error page parameters here
        error_page 404 /404/index.html;
        #prevent loading error pages directly
        location  /404/index.html { internal; }

        location /snapshot {
		#snapshots is directory containing symlinks to various .zfs/snapshot dirs
                try_files $uri $uri/ =404;
                #autoindex is needed since we are not serving up any html or php pages
                autoindex  on;
		autoindex_localtime off;
        }

	location /src/contrib/Archive {
                try_files $uri $uri/ =404;
                #autoindex is needed since we are not serving up any html or php pages
                autoindex  on;
                autoindex_localtime off;
        }

        location /metadata {
                try_files $uri $uri/ =404;
                autoindex on;

        }

        location /diffs {
                try_files $uri $uri/ =404;
                autoindex on;
        }

        location /accounting {
                try_files $uri $uri/ =404;
                autoindex on;
        }

        location /history {
		try_files $uri $uri/ =404;
                autoindex on;
                #history is symlink pointing to snapshots of the /MRAN/www FS itself
                #this URL is hidden right now, not on index.html
        }

        location /exports {
		try_files $uri $uri/ =404;
        	autoindex on;
		#exports is symlink to zpool named exports
	      }

}
#this last bracket is needed to close this vhost

#mran.revolutionanalytics.com
#Chris Mosetick 2014-06-12
#last update    2014-09-25

server {
        #listen on IPv4 and IPv6 addresses at the same time
        listen 80;
        listen [::]:80;

        #directory in the file system to serve web pages and packages from
        #this is a detachable block disk formatted with ZFS that can be easily moved to another server
        #www dir is for landing page stuff
        #root /MRAN/www;
        root /home/mran-user/src/MRAN-site/dist;
        index index.html index.htm;

        # public facing domain name for this vhost
        server_name mran.revolutionanalytics.com;

        access_log /var/log/nginx/mran.revolutionanalytics.com.log;
        error_log /var/log/nginx/error-mran.revolutionanalytics.com.log;

        #define the location of the Nodejs instance running on this system
        #location / {
        #proxy_pass http://localhost:7300/;
        #proxy_set_header Host $host;
        #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #}

        location /snapshot {
                try_files $uri $uri/ =404;
                #autoindex is needed since we are not serving up any html or php pages
                autoindex  on;
                #snapshots is directory containing symlinks to various .zfs/snapshot dirs
        }

        location /metadata {
                try_files $uri $uri/ =404;
                autoindex on;

        }

        location /diffs {
                try_files $uri $uri/ =404;
                autoindex on;
        }

        location /accounting {
                try_files $uri $uri/ =404;
                autoindex on;
        }

        location /history {
                try_files $uri $uri/ =404;
                autoindex on;
                #history is symlink pointing to snapshots of the /MRAN/www FS itself
                #this URL is hidden right now, not on index.html
        }

        location /exports {
                try_files $uri $uri/ =404;
                autoindex on;
                #exports is symlink to zpool named exports
              }

}
#this last bracket is needed to close this vhost


added hidden /history to nginx config, ability to see zfs snapshots of /MRAN/www FS

#mran.revolutionanalytics.com
#Chris Mosetick 2014-06-12
#last update    2014-07-24

server {
        #listen on IPv4 and IPv6 addresses at the same time
        listen 80;
        listen [::]:80;

        #directory in the file system to serve web pages and packages from
        #this is a detachable block disk formatted with ZFS that can be easily moved to another server
	#www dir is for landing page stuff
        root /MRAN/www;
        index index.html index.htm;

        # public facing domain name for this vhost
        server_name marmoset.revolutionanalytics.com;

        location /snapshots {
                try_files $uri $uri/ =404;
                #autoindex is needed since we are not serving up any html or php pages
                autoindex  on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /metadata {
                try_files $uri $uri/ =404;
                autoindex on;
		# Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

        }

	location /diffs {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /accounting {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

	location /history {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

	location /exports {
		try_files $uri $uri/ =404;
        	autoindex on;
        	# Uncomment to enable naxsi on this location
        	# include /etc/nginx/naxsi.rules
	}

}
#this last bracket is needed to close this vhost

#mran.revolutionanalytics.com
#Chris Mosetick 2014-06-12
#last update    2014-07-19

server {
        #listen on IPv4 and IPv6 addresses at the same time
        listen 80;
        listen [::]:80;

        #directory in the file system to serve web pages and packages from
        #this is a detachable block disk formatted with ZFS that can be easily moved to another server
	#www dir is for landing page stuff
        root /MRAN/www;
        index index.html index.htm;

        # public facing domain name for this vhost
        server_name marmoset.revolutionanalytics.com;

        location /snapshots {
                try_files $uri $uri/ =404;
                #autoindex is needed since we are not serving up any html or php pages
                autoindex  on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /metadata {
                try_files $uri $uri/ =404;
                autoindex on;
		# Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

        }

	location /diffs {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /accounting {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

	location /exports {
		try_files $uri $uri/ =404;
        	autoindex on;
        	# Uncomment to enable naxsi on this location
        	# include /etc/nginx/naxsi.rules
	}

}
#this last bracket is needed to close this vhost


05/12/17 changed the orientation of the cube

#!/bin/csh

# This script is for processing hcc(co)nh experiment.
# In this case the bruker sequence hccconhgpwg3d2
# was run with 955, 44, 156 points in each dimension
#
# This script is written up to demonstrate how to use linear prediction
# on multiple dimensions. In the 3D case we do the following:
# 1) process the X dimension
# 2) process the Z dimension in a 'gentle' window function
# 3) then we linear predict in the Y dimension
# 4) importantly now we reverse the the processing carried out in step 2
# 5) then we do the linear prediction in the Z dimension and do 'proper' processing
# 6) so then in the end we want to process the dimension that decays the most first
#
# Note: remember as a rule of thumb you shouldn't have an LP order larger than 1/3 of
# your real points.
#
# Author: Lucas Siemons
#

# since the phases are listed multiple times I have stored them as variables

set phX0=0.0
set phX1=0.0

set phY0=0.0
set phY1=0.0

set phZ0=0.0
set phZ1=0.0

echo 'carrying out processing with LP. I may Take some time'

xyz2pipe -in fid/test%03d.fid -x -verb                        \
# Process the direct dimension (X: HN)                        \
      |   nmrPipe  -fn SOL                                    \
      |   nmrPipe  -fn SP -off 0.4  -end 0.98 -pow 2 -c .5    \
      |   nmrPipe  -fn ZF -auto                               \
      |   nmrPipe  -fn ZF -zf 1                               \
      |   nmrPipe  -fn FT                                     \
      |   nmrPipe  -fn PS -p0 $phX0 -p1 $phX1 -di             \
      |   nmrPipe  -fn EXT  -sw  -xn 5ppm -x1 11ppm           \
#     process the Z dimension (Z: aliphatic H)                \
      |   nmrPipe  -fn ZTP                                    \
      |   nmrPipe  -fn EM -lb 0.5 -c 0.5                      \
      |   nmrPipe  -fn ZF -zf 1                               \
      |   nmrPipe  -fn FT -alt                                \
      |   nmrPipe  -fn PS -p0 $phZ0 -p1 $phZ1 -di             \
      |   nmrPipe  -fn ZTP                                    \
#     now we do the linear prediction on Y (Y: N)             \
      |   nmrPipe  -fn TP                                     \
      |   nmrPipe  -fn LP -ord 8 -fb -verb                    \
      |   nmrPipe  -fn SP -off 0.5  -end 0.98 -pow 2 -c .5    \
      |   nmrPipe  -fn ZF -auto                               \
      |   nmrPipe  -fn FT -alt                                \
      |   nmrPipe  -fn PS -p0 $phY0 -p1 $phY1  -di            \
      |   nmrPipe  -fn TP                                     \
      |   pipe2xyz -out ft/test%03d.ft2 -x -ov                \

#now process the 3D cube                                      \

# now we need to undo the processing that we did in the       \
# third dim so that we can apply LP                           \
# hence we use the hilbert transform to regenerate the        \
# imaginary part                                              \
xyz2pipe -in ft/test%03d.ft2 -verb                            \
 | nmrPipe -fn ZTP                                            \
 | nmrPipe -fn HT -auto                                       \
 | nmrPipe -fn PS -p0 $phZ0 -p1 $phZ1 -inv                    \
 | nmrPipe -fn FT -alt -inv                                   \
 | nmrPipe -fn ZF -zf 1 -inv                                  \
 | nmrPipe -fn EM -lb 0.5 -c 0.5 -inv                         \
 | nmrPipe -fn LP -ord 15 -fb -verb                           \
# Normal processing of Z (Z:  aliphatic H )                   \
 | nmrPipe -fn SP -off 0.5  -end 0.98 -pow 2 -c .5            \
 | nmrPipe -fn ZF -auto                                       \
 | nmrPipe -fn FT -alt                                        \
 | nmrPipe -fn PS -p0 $phZ0 -p1 $phZ1 -di                     \
# next two lines swap dimensions 2 and 3                      \
 | nmrPipe -fn TP                                             \
 | nmrPipe -fn ZTP                                            \
 | pipe2xyz -out ft/test%03d.ft3

# Here we write out the complete cube
xyz2pipe -in ft/test%03d.ft3 | nmrPipe -ov -verb -out test_LP.ft3
# calculate the projections ... useful for phasing!
proj3D.tcl test.ft3

#!/bin/csh

# This script is for processing hcc(co)nh experiment.
# In this case the bruker sequence hccconhgpwg3d2
# was run with 955, 44, 156 points in each dimension
#
# This script is written up to demonstrate how to use linear prediction
# on multiple dimensions. In the 3D case we do the following:
# 1) process the X dimension
# 2) process the Z dimension in a 'gentle' window function
# 3) then we linear predict in the Y dimension
# 4) importantly now we reverse the the processing carried out in step 2
# 5) then we do the linear prediction in the Z dimension and do 'proper' processing
# 6) so then in the end we want to process the dimension that decays the most first
#
# Note: remember as a rule of thumb you shouldn't have an LP order larger than 1/3 of
# your real points.
#
# Author: Lucas Siemons
#

# since the phases are listed multiple times I have stored them as variables

set phX0=0.0
set phX1=0.0

set phY0=0.0
set phY1=0.0

set phZ0=0.0
set phZ1=0.0

echo 'carrying out processing with LP. I may Take some time'

xyz2pipe -in fid/test%03d.fid -x -verb                        \
# Process the direct dimension (X: HN)                        \
      |   nmrPipe  -fn SOL                                    \
      |   nmrPipe  -fn SP -off 0.4  -end 0.98 -pow 2 -c .5    \
      |   nmrPipe  -fn ZF -auto                               \
      |   nmrPipe  -fn ZF -zf 1                               \
      |   nmrPipe  -fn FT                                     \
      |   nmrPipe  -fn PS -p0 $phX0 -p1 $phX1 -di             \
      |   nmrPipe  -fn EXT  -sw  -xn 5ppm -x1 11ppm           \
#     process the Z dimension (Z: aliphatic H)                \
      |   nmrPipe  -fn ZTP                                    \
      |   nmrPipe  -fn EM -lb 0.5 -c 0.5                      \
      |   nmrPipe  -fn ZF -zf 1                               \
      |   nmrPipe  -fn FT -alt                                \
      |   nmrPipe  -fn PS -p0 $phZ0 -p1 $phZ1 -di             \
      |   nmrPipe  -fn ZTP                                    \
#     now we do the linear prediction on Y (Y: N)             \
      |   nmrPipe  -fn TP                                     \
      |   nmrPipe  -fn LP -ord 8 -fb -verb                    \
      |   nmrPipe  -fn SP -off 0.5  -end 0.98 -pow 2 -c .5    \
      |   nmrPipe  -fn ZF -auto                               \
      |   nmrPipe  -fn FT -alt                                \
      |   nmrPipe  -fn PS -p0 $phY0 -p1 $phY1  -di            \
      |   nmrPipe  -fn TP                                     \
      |   pipe2xyz -out ft/test%03d.ft2 -x -ov                \

#now process the 3D cube                                      \

# now we need to undo the processing that we did in the       \
# third dim so that we can apply LP                           \
# hence we use the hilbert transform to regenerate the        \
# imaginary part                                              \
xyz2pipe -in ft/test%03d.ft2 -verb                        \
 | nmrPipe -fn ZTP                                            \
 | nmrPipe -fn HT -auto                                       \
 | nmrPipe -fn PS -p0 $phZ0 -p1 $phZ1 -inv                    \
 | nmrPipe -fn FT -alt -inv                                   \
 | nmrPipe -fn ZF -zf 1 -inv                                  \
 | nmrPipe -fn EM -lb 0.5 -c 0.5 -inv \
 | nmrPipe -fn LP -ord 15 -fb -verb                           \
# Normal processing of Z (Z:  aliphatic H )                   \
 | nmrPipe -fn SP -off 0.5  -end 0.98 -pow 2 -c .5            \
 | nmrPipe -fn ZF -auto                                       \
 | nmrPipe -fn FT -alt                                        \
 | nmrPipe -fn PS -p0 $phZ0 -p1 $phZ1 -di                     \
 | nmrPipe -fn ZTP                                            \
 | pipe2xyz -out ft/test%03d.ft3

# Here we write out the complete cube
xyz2pipe -in ft/test%03d.ft3 | nmrPipe -ov -verb -out test_LP.ft3
# calculate the projections ... useful for phasing!
proj3D.tcl test.ft3


change it

change it

# Redirect all HTTP trafic to HTTPS

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name tapcrate.com www.tapcrate.com api.tapcrate.com www.api.tapcrate.com static.tapcrate.com www.static.tapcrate.com;

    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /tmp/letsencrypt-auto/;
    }

    # location = /.well-known/acme-challenge/ {
    #     return 404;
    # }

    location / {
        return 301 https://$server_name$request_uri;
    }
}

server {

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    server_name tapcrate.com www.tapcrate.com;

    include snippets/ssl-tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/jasper/tapcrate;
    index index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api;

    server_name api.tapcrate.com www.api.tapcrate.com;

    location / {
        include proxy_params;
        proxy_pass http://127.0.0.1:8080;
    }
}

proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=static:10m inactive=60m use_temp_path=off max_size=4g;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api/Public;

    server_name static.tapcrate.com www.static.tapcrate.com;

    location / {
        include h5bp/basic.conf;

        tcp_nodelay on;
        keepalive_timeout 65;
        sendfile on;
        tcp_nopush on;
        sendfile_max_chunk 1m;

        proxy_cache static;
        try_files $uri =404;
    }
}

# Redirect all HTTP trafic to HTTPS

server {
    listen 80;
    listen [::]:80;

    server_name tapcrate.com www.tapcrate.com api.tapcrate.com www.api.tapcrate.com static.tapcrate.com www.static.tapcrate.com;

    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /tmp/letsencrypt-auto/;
    }

    # location = /.well-known/acme-challenge/ {
    #     return 404;
    # }

    # location / {
    #     return 301 https://$server_name$request_uri;
    # }
}

server {

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    server_name tapcrate.com www.tapcrate.com;

    include snippets/ssl-tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/jasper/tapcrate;
    index index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api/;

    server_name api.tapcrate.com www.api.tapcrate.com;

    location / {
        include proxy_params;
        proxy_pass http://127.0.0.1:8080;
    }
}

proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=static:10m inactive=60m use_temp_path=off max_size=4g;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api/Public;

    server_name static.tapcrate.com www.static.tapcrate.com;

    location / {
        include h5bp/basic.conf;

        tcp_nodelay on;
        keepalive_timeout 65;
        sendfile on;
        tcp_nopush on;
        sendfile_max_chunk 1m;

        proxy_cache static;
        try_files $uri =404;
    }
}


openvms: Use DEC C atomic model

openvms: Use DEC C atomic model

$!
$! Copyright 2014, John Malmberg
$! Copyright 2016, Alexander Saprykin
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$!===========================================================================
$! Command-line options:
$!
$!    32            Compile with 32-bit pointers.
$!    BIGENDIAN     Compile for a big endian host.
$!    CCQUAL=x      Add "x" to the C compiler qualifiers.
$!    DEBUG         Build in debug mode.
$!    CLEAN         Only perform clean after the previous build.
$!    TESTS=(x)     Build library tests. Comma separated test names or leave
$!                  empty to build all the tests.
$!                  Example 1 (curtain tests): TESTS=(pmem,puthread)
$!                  Example 2 (all tests): TESTS
$!    RUN_TESTS     Runs all tests.
$!    BOOST_ROOT=x  Boost root directory.
$!                  Example: BOOST_ROOT=/SYS$COMMON/boost_1_43_1
$!    NOLIB         Skip library buidling. Useful when you want to rebuild
$!                  particular tests.
$!===========================================================================
$!
$!
$! Save the original default dev:[dir], and arrange for its restoration
$! at exit.
$!---------------------------------------------------------------------
$ orig_def = f$environment("DEFAULT")
$ on error then goto common_exit
$ on control_y then goto common_exit
$!
$ ctrl_y       = 1556
$ proc         = f$environment("PROCEDURE")
$ proc_fid     = f$file_attributes(proc, "FID")
$ proc_dev     = f$parse(proc, , , "DEVICE")
$ proc_dir     = f$parse(proc, , , "DIRECTORY")
$ proc_name    = f$parse(proc, , , "NAME")
$ proc_type    = f$parse(proc, , , "TYPE")
$ proc_dev_dir = proc_dev + proc_dir
$!
$! Have to manually parse the device for a search list.
$! Can not use the f$parse() as it will return the first name
$! in the search list.
$!
$ orig_def_dev = f$element(0, ":", orig_def) + ":"
$ if orig_def_dev .eqs. "::" then orig_def_dev = "sys$disk:"
$ test_proc = orig_def_dev + proc_dir + proc_name + proc_type
$!
$! If we can find this file using the default directory
$! then we know that we should use the original device from the
$! default directory which could be a search list.
$!
$ test_proc_fid = f$file_attributes(test_proc, "FID")
$!
$ if (test_proc_fid .eq. proc_fid)
$ then
$     proc_dev_dir = orig_def_dev + proc_dir
$ endif
$!
$! Verbose output message stuff. Define symbol to "write sys$output".
$! vo_c - verbose output for compile
$!
$ vo_c := "write sys$output"
$!
$! Determine the main distribution directory ("[--]") in an
$! ODS5-tolerant (case-insensitive) way.  (We do assume that the only
$! "]" or ">" is the one at the end.)
$!
$! Some non-US VMS installations report ">" for the directory delimiter
$! so do not assume that it is "]".
$!
$ orig_def_len = f$length(orig_def)
$ delim = f$extract(orig_def_len - 1, 1, orig_def)
$!
$ set default 'proc_dev_dir'
$ set default [--.src]
$ base_src_dir = f$environment("default")
$ set default 'proc_dev_dir'
$!
$! Define the architecture-specific destination directory name
$! -----------------------------------------------------------
$!
$ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then
$      'vo_c' "%PLIBSYS-F-NOTSUP, VAX platform is not supported, sorry :("
$      goto common_exit
$ else
$      arch_name = ""
$      arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$!
$      if (arch_name .eqs. "") then arch_name = "UNK"
$!
$      node_swvers   = f$getsyi("node_swvers")
$      version_patch = f$extract(1, f$length(node_swvers), node_swvers)
$      maj_ver       = f$element(0, ".", version_patch)
$      min_ver_patch = f$element(1, ".", version_patch)
$      min_ver       = f$element(0, "-", min_ver_patch)
$      patch         = f$element(1, "-", min_ver_patch)
$!
$      if maj_ver .lts. "8" .or. min_ver .lts. "4"
$      then
$          'vo_c' "%PLIBSYS-F-NOTSUP, only OpenVMS 8.4 and above are supported, sorry :("
$          goto common_exit
$      endif
$ endif
$!
$ objdir = proc_dev_dir - delim + ".''arch_name'" + delim
$!
$! Parse input arguments
$! ---------------------
$! Allow arguments to be grouped together with comma or separated by spaces
$! Do no know if we will need more than 8.
$ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
$ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
$!
$! Provide lower case version to simplify parsing.
$ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
$!
$ args_len = f$length(args)
$ args_lower_len = f$length(args_lower)
$!
$ if f$locate(",clean,", args_lower) .lt. args_lower_len
$ then
$     'vo_c' "Cleaning up previous build..."
$     set default 'proc_dev_dir'
$     @deltree.com 'arch_name'
$     goto common_exit
$ endif
$!
$ build_64 = 1
$ if f$locate(",32,", args_lower) .lt. args_lower_len
$ then
$     build_64 = 0
$ endif
$!
$ big_endian = 0
$ if f$locate(",bigendian,", args_lower) .lt. args_lower_len
$ then
$     big_endian = 1
$ endif
$!
$ cc_extra = ""
$ args_loc = f$locate(",ccqual=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     cc_extra = f$element(1, "=", arg_val)
$ endif
$!
$ is_debug = 0
$ if f$locate(",debug,", args_lower) .lt. args_lower_len
$ then
$     is_debug = 1
$ endif
$!
$ is_tests = 0
$ test_list = ""
$ if f$locate(",tests,", args_lower) .lt. args_lower_len
$ then
$     is_tests = 1
$ else
$     args_loc = f$locate(",tests=(", args_lower)
$     if args_loc .lt. args_lower_len
$     then
$         is_tests          = 1
$         arg               = f$extract(args_loc + 1, args_lower_len, args_lower)
$         arg_val           = f$element(0, ")", arg)
$         test_list_val     = f$element(1, "=", arg_val) - "(" - ")"
$         test_list_val     = f$edit(test_list_val, "COLLAPSE")
$         test_list_counter = 0
$
$ test_list_loop:
$         next_test_val = f$element (test_list_counter, ",", test_list_val)
$         if next_test_val .nes. "" .and. next_test_val .nes. ","
$         then
$             test_list         = test_list + next_test_val + " "
$             test_list_counter = test_list_counter + 1
$             goto test_list_loop
$         endif
$     endif
$ endif
$!
$ run_tests = 0
$ if f$locate(",run_tests,", args_lower) .lt. args_lower_len
$ then
$     run_tests = 1
$ endif
$!
$ boost_root = ""
$ args_loc = f$locate(",boost_root=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     boost_root = f$element(1, "=", arg_val)
$ endif
$!
$ if is_tests .eqs. "1" .and. boost_root .eqs. ""
$ then
$     'vo_c' "%PLIBSYS-I-NOTESTS, tests couldn't be built without BOOST_ROOT parameter, disabling."
$     is_tests = 0
$ endif
$!
$ if is_tests .eqs. "0" .and. boost_root .nes. ""
$ then
$     'vo_c' "%PLIBSYS-I-BOOSTIGN, BOOST_ROOT parameter will be ignored without tests enabled."
$ endif
$!
$! Prepare build directory
$! -----------------------
$!
$! When building on a search list, need to do a create to make sure that
$! the output directory exists, since the clean procedure tries to delete
$! it.
$!
$ if f$search("''proc_dev_dir'''arch_name'.DIR") .eqs. ""
$ then
$     create/dir 'objdir'/prot=o:rwed
$ endif
$!
$ set default 'objdir'
$ @[-]deltree CXX_REPOSITORY
$!
$ if f$locate(",nolib,", args_lower) .lt. args_lower_len
$ then
$     goto build_tests
$ endif
$!
$! Generate platform-specific config file
$! --------------------------------------
$!
$ if f$search("plibsysconfig.h") .nes. "" then delete plibsysconfig.h;*
$!
$! Get the version number
$! ----------------------
$!
$ i = 0
$ open/read/error=version_loop_end vhf [---]CMakeLists.txt
$ version_loop:
$     read/end=version_loop_end vhf line_in
$!
$     if line_in .eqs. "" then goto version_loop
$!
$     if f$locate("set (PLIBSYS_VERSION_MAJOR ", line_in) .eq. 0
$     then
$         plibsys_vmajor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_MINOR ", line_in) .eq. 0
$     then
$         plibsys_vminor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_PATCH ", line_in) .eq. 0
$     then
$         plibsys_vpatch = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_NUM ", line_in) .eq. 0
$     then
$         plibsys_vnum = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if i .lt 4 then goto version_loop
$ version_loop_end:
$ close vhf
$!
$! Write config file
$! -----------------
$!
$ open/write/error=config_write_end chf plibsysconfig.h
$ write chf "#ifndef PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf "#define PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf ""
$ write chf "#define PLIBSYS_VERSION_MAJOR ''plibsys_vmajor'"
$ write chf "#define PLIBSYS_VERSION_MINOR ''plibsys_vminor'"
$ write chf "#define PLIBSYS_VERSION_PATCH ''plibsys_vpatch'"
$ write chf "#define PLIBSYS_VERSION_STR ""''plibsys_vmajor'.''plibsys_vminor'.''plibsys_vpatch'"""
$ write chf "#define PLIBSYS_VERSION ''plibsys_vnum'"
$ write chf ""
$ write chf "#define PLIBSYS_SIZEOF_SAFAMILY_T 1"
$ write chf ""
$ write chf "#include <pmacros.h>"
$ write chf ""
$ write chf "#include <float.h>"
$ write chf "#include <limits.h>"
$ write chf ""
$ write chf "P_BEGIN_DECLS"
$ write chf ""
$ write chf "#define P_MINFLOAT    FLT_MIN"
$ write chf "#define P_MAXFLOAT    FLT_MAX"
$ write chf "#define P_MINDOUBLE   DBL_MIN"
$ write chf "#define P_MAXDOUBLE   DBL_MAX"
$ write chf "#define P_MINSHORT    SHRT_MIN"
$ write chf "#define P_MAXSHORT    SHRT_MAX"
$ write chf "#define P_MAXUSHORT   USHRT_MAX"
$ write chf "#define P_MININT      INT_MIN"
$ write chf "#define P_MAXINT      INT_MAX"
$ write chf "#define P_MAXUINT     UINT_MAX"
$ write chf "#define P_MINLONG     LONG_MIN"
$ write chf "#define P_MAXLONG     LONG_MAX"
$ write chf "#define P_MAXULONG    ULONG_MAX"
$ write chf ""
$ write chf "#define PLIBSYS_MMAP_HAS_MAP_ANONYMOUS"
$ write chf "#define PLIBSYS_HAS_NANOSLEEP"
$ write chf "#define PLIBSYS_HAS_GETADDRINFO"
$ write chf "#define PLIBSYS_HAS_POSIX_SCHEDULING"
$ write chf "#define PLIBSYS_HAS_POSIX_STACKSIZE"
$ write chf "#define PLIBSYS_HAS_SOCKADDR_STORAGE"
$ write chf "#define PLIBSYS_SOCKADDR_HAS_SA_LEN"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_SCOPEID"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_FLOWINFO"
$ write chf ""
$!
$ if build_64 .eqs. "1"
$ then
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 8"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 8"
$ else
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 4"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 4"
$ endif
$!
$ write chf "#define PLIBSYS_SIZEOF_LONG 4"
$ write chf ""
$!
$ if big_endian .eqs. "1"
$ then
$     write chf "#define P_BYTE_ORDER P_BIG_ENDIAN"
$ else
$     write chf "#define P_BYTE_ORDER P_LITTLE_ENDIAN"
$ endif
$!
$ write chf ""
$ write chf "P_END_DECLS"
$ write chf ""
$ write chf "#endif /* PLIBSYS_HEADER_PLIBSYSCONFIG_H */"
$ config_write_end:
$     close chf
$!
$! Prepare sources for compilation
$! -------------------------------
$!
$ cc_link_params = ""
$ cc_params = "/NAMES=(AS_IS,SHORTENED)"
$ cc_params = cc_params + "/DEFINE=(PLIBSYS_COMPILATION,_REENTRANT,_POSIX_EXIT)"
$ cc_params = cc_params + "/INCLUDE_DIRECTORY=(''objdir',''base_src_dir')"
$ cc_params = cc_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cc_params = cc_params + "/POINTER_SIZE=64"
$ else
$     cc_params = cc_params + "/POINTER_SIZE=32"
$ endif
$!
$ if cc_extra .nes. ""
$ then
$     cc_params = cc_params + " " + cc_extra
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cc_params = cc_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$     cc_link_params = "/DEBUG/TRACEBACK"
$ else
$     cc_link_params = "/NODEBUG/NOTRACEBACK"
$ endif
$!
$ plibsys_src = "patomic-decc.c pcondvariable-posix.c pcryptohash-gost3411.c pcryptohash-md5.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha1.c pcryptohash-sha2-256.c pcryptohash-sha2-512.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha3.c pcryptohash.c pdir-posix.c pdir.c"
$ plibsys_src = plibsys_src + " perror.c pfile.c phashtable.c pinifile.c pipc.c plibraryloader.c"
$ plibsys_src = plibsys_src + " plist.c pmain.c pmem.c pmutex-posix.c pprocess.c prwlock-posix.c"
$ plibsys_src = plibsys_src + " psemaphore-posix.c pshm-posix.c pshmbuffer.c psocket.c"
$ plibsys_src = plibsys_src + " psocketaddress.c pspinlock-sim.c pstring.c psysclose-unix.c"
$ plibsys_src = plibsys_src + " ptimeprofiler-posix.c ptimeprofiler.c ptree-avl.c ptree-bst.c"
$ plibsys_src = plibsys_src + " ptree-rb.c ptree.c puthread-posix.c puthread.c"
$!
$! Inform about building
$! ---------------------
$!
$ if build_64 .eqs. "1"
$ then
$     'vo_c' "Building for ''arch_name' (64-bit)"
$ else
$     'vo_c' "Building for ''arch_name' (32-bit)"
$ endif
$!
$! Compile library modules
$! -----------------------
$!
$ 'vo_c' "Compiling object modules..."
$ src_counter = 0
$ plibsys_src = f$edit(plibsys_src, "COMPRESS")
$ plibsys_objs = ""
$!
$ src_loop:
$     next_src = f$element (src_counter, " ", plibsys_src)
$     if next_src .nes. "" .and. next_src .nes. " "
$     then
$         'vo_c' "[CC] ''next_src'"
$         cc [---.src]'next_src' 'cc_params'
$!
$         src_counter = src_counter + 1
$!
$         obj_file = f$extract (0, f$length (next_src) - 1, next_src) + "obj"
$         plibsys_objs = plibsys_objs + "''obj_file',"
$         purge 'obj_file'
$!
$         goto src_loop
$     endif
$!
$ plibsys_objs = f$extract (0, f$length (plibsys_objs) - 1, plibsys_objs)
$!
$! Create library
$! --------------
$!
$ 'vo_c' "Creating object library..."
$ library/CREATE/INSERT/REPLACE /LIST=PLIBSYS.LIS PLIBSYS.OLB 'plibsys_objs'
$ library/COMPRESS PLIBSYS.OLB
$ purge PLIBSYS.OLB
$ purge PLIBSYS.LIS
$!
$ 'vo_c' "Creating shared library..."
$ link/SHAREABLE=PLIBSYS.EXE /MAP=PLIBSYS.MAP 'cc_link_params' 'plibsys_objs', [-]plibsys.opt/OPTION
$ purge PLIBSYS.EXE
$ purge PLIBSYS.MAP
$!
$! Testing area
$! ------------
$!
$ build_tests:
$ test_list_full = "patomic pcondvariable pcryptohash pdir"
$ test_list_full = test_list_full + " perror pfile phashtable pinifile plibraryloader plist"
$ test_list_full = test_list_full + " pmacros pmain pmem pmutex pprocess prwlock psemaphore"
$ test_list_full = test_list_full + " pshm pshmbuffer psocket psocketaddress pspinlock pstring"
$ test_list_full = test_list_full + " ptimeprofiler ptree ptypes puthread"
$!
$ if is_tests .eqs. "0"
$ then
$     goto build_done
$ endif
$!
$! Write link options file
$! -----------------------
$!
$ if f$search("plibsys_link.opt") .nes. "" then delete plibsys_link.opt;*
$!
$ open/write/error=link_write_end lhf plibsys_link.opt
$ write lhf "''objdir'PLIBSYS.EXE/SHARE"
$ write lhf ""
$ link_write_end:
$     close lhf
$!
$! Compile tests
$! -------------------------
$!
$ if test_list .nes. ""
$ then
$     plibsys_tests = f$edit(test_list, "TRIM")
$ else
$     plibsys_tests = test_list_full
$ endif
$!
$ 'vo_c' "Compiling test executables..."
$ test_counter = 0
$ plibsys_tests = f$edit(plibsys_tests, "COMPRESS")
$!
$ cxx_params = "/INCLUDE=(''objdir',''base_src_dir',""''boost_root'"")"
$ cxx_params = cxx_params + "/DEFINE=(__USE_STD_IOSTREAM,PLIBSYS_TESTS_STATIC)/NAMES=(AS_IS, SHORTENED)"
$ cxx_params = cxx_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cxx_params = cxx_params + "/POINTER_SIZE=64"
$ else
$     cxx_params = cxx_params + "/POINTER_SIZE=32"
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cxx_params = cxx_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$ endif
$!
$ test_loop:
$     next_test = f$element (test_counter, " ", plibsys_tests)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         next_test = next_test + "_test"
$         'vo_c' "[CXX    ] ''next_test'.cpp"
$         cxx [---.tests]'next_test'.cpp 'cxx_params'
$!
$         'vo_c' "[CXXLINK] ''next_test'.obj"
$          cxxlink 'next_test'.obj,'objdir'plibsys_link.opt/OPTION /THREADS_ENABLE
$!
$         @[-]deltree CXX_REPOSITORY
$         purge 'next_test'.obj
$         purge 'next_test'.exe
$!
$         test_counter = test_counter + 1
$         goto test_loop
$     endif
$!
$ build_done:
$     'vo_c' "Build done."
$!
$! Run unit tests
$! --------------
$!
$ if run_tests .eqs. "0"
$ then
$     goto common_exit
$ endif
$!
$ 'vo_c' "Running tests..."
$ test_counter = 0
$ tests_passed = 0
$!
$ run_loop:
$     next_test = f$element (test_counter, " ", test_list_full)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         if f$search("''next_test'_test.exe") .eqs. ""
$         then
$             'vo_c' "[SKIP] Test not found: ''next_test'"
$             goto run_loop_next
$         endif
$!
$         'vo_c' "[RUN ] ''next_test'"
$!
$         define/user sys$error NL:
$         define/user sys$output NL:
$         define/user plibsys 'objdir'PLIBSYS.EXE
$         define/user test_imgdir 'objdir'
$!
$         xrun := $test_imgdir:'next_test'_test.exe
$         if next_test .eqs. "plibraryloader"
$         then
$             xrun 'objdir'PLIBSYS.EXE
$         else
$             xrun
$         endif
$!
$         if $STATUS .eqs. "%X00000001"
$         then
$             'vo_c' "[PASS] Test passed: ''next_test'"
$             tests_passed = tests_passed + 1
$         else
$             'vo_c' "[FAIL] *** Test failed: ''next_test'"
$         endif
$!
$ run_loop_next:
$         test_counter = test_counter + 1
$         goto run_loop
$     endif
$!
$ 'vo_c' "Tests passed: ''tests_passed'/''test_counter'"
$!
$ common_exit:
$     set default 'orig_def'
$     exit

$!
$! Copyright 2014, John Malmberg
$! Copyright 2016, Alexander Saprykin
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$!===========================================================================
$! Command-line options:
$!
$!    32            Compile with 32-bit pointers.
$!    BIGENDIAN     Compile for a big endian host.
$!    CCQUAL=x      Add "x" to the C compiler qualifiers.
$!    DEBUG         Build in debug mode.
$!    CLEAN         Only perform clean after the previous build.
$!    TESTS=(x)     Build library tests. Comma separated test names or leave
$!                  empty to build all the tests.
$!                  Example 1 (curtain tests): TESTS=(pmem,puthread)
$!                  Example 2 (all tests): TESTS
$!    RUN_TESTS     Runs all tests.
$!    BOOST_ROOT=x  Boost root directory.
$!                  Example: BOOST_ROOT=/SYS$COMMON/boost_1_43_1
$!    NOLIB         Skip library buidling. Useful when you want to rebuild
$!                  particular tests.
$!===========================================================================
$!
$!
$! Save the original default dev:[dir], and arrange for its restoration
$! at exit.
$!---------------------------------------------------------------------
$ orig_def = f$environment("DEFAULT")
$ on error then goto common_exit
$ on control_y then goto common_exit
$!
$ ctrl_y       = 1556
$ proc         = f$environment("PROCEDURE")
$ proc_fid     = f$file_attributes(proc, "FID")
$ proc_dev     = f$parse(proc, , , "DEVICE")
$ proc_dir     = f$parse(proc, , , "DIRECTORY")
$ proc_name    = f$parse(proc, , , "NAME")
$ proc_type    = f$parse(proc, , , "TYPE")
$ proc_dev_dir = proc_dev + proc_dir
$!
$! Have to manually parse the device for a search list.
$! Can not use the f$parse() as it will return the first name
$! in the search list.
$!
$ orig_def_dev = f$element(0, ":", orig_def) + ":"
$ if orig_def_dev .eqs. "::" then orig_def_dev = "sys$disk:"
$ test_proc = orig_def_dev + proc_dir + proc_name + proc_type
$!
$! If we can find this file using the default directory
$! then we know that we should use the original device from the
$! default directory which could be a search list.
$!
$ test_proc_fid = f$file_attributes(test_proc, "FID")
$!
$ if (test_proc_fid .eq. proc_fid)
$ then
$     proc_dev_dir = orig_def_dev + proc_dir
$ endif
$!
$! Verbose output message stuff. Define symbol to "write sys$output".
$! vo_c - verbose output for compile
$!
$ vo_c := "write sys$output"
$!
$! Determine the main distribution directory ("[--]") in an
$! ODS5-tolerant (case-insensitive) way.  (We do assume that the only
$! "]" or ">" is the one at the end.)
$!
$! Some non-US VMS installations report ">" for the directory delimiter
$! so do not assume that it is "]".
$!
$ orig_def_len = f$length(orig_def)
$ delim = f$extract(orig_def_len - 1, 1, orig_def)
$!
$ set default 'proc_dev_dir'
$ set default [--.src]
$ base_src_dir = f$environment("default")
$ set default 'proc_dev_dir'
$!
$! Define the architecture-specific destination directory name
$! -----------------------------------------------------------
$!
$ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then
$      'vo_c' "%PLIBSYS-F-NOTSUP, VAX platform is not supported, sorry :("
$      goto common_exit
$ else
$      arch_name = ""
$      arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$!
$      if (arch_name .eqs. "") then arch_name = "UNK"
$!
$      node_swvers   = f$getsyi("node_swvers")
$      version_patch = f$extract(1, f$length(node_swvers), node_swvers)
$      maj_ver       = f$element(0, ".", version_patch)
$      min_ver_patch = f$element(1, ".", version_patch)
$      min_ver       = f$element(0, "-", min_ver_patch)
$      patch         = f$element(1, "-", min_ver_patch)
$!
$      if maj_ver .lts. "8" .or. min_ver .lts. "4"
$      then
$          'vo_c' "%PLIBSYS-F-NOTSUP, only OpenVMS 8.4 and above are supported, sorry :("
$          goto common_exit
$      endif
$ endif
$!
$ objdir = proc_dev_dir - delim + ".''arch_name'" + delim
$!
$! Parse input arguments
$! ---------------------
$! Allow arguments to be grouped together with comma or separated by spaces
$! Do no know if we will need more than 8.
$ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
$ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
$!
$! Provide lower case version to simplify parsing.
$ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
$!
$ args_len = f$length(args)
$ args_lower_len = f$length(args_lower)
$!
$ if f$locate(",clean,", args_lower) .lt. args_lower_len
$ then
$     'vo_c' "Cleaning up previous build..."
$     set default 'proc_dev_dir'
$     @deltree.com 'arch_name'
$     goto common_exit
$ endif
$!
$ build_64 = 1
$ if f$locate(",32,", args_lower) .lt. args_lower_len
$ then
$     build_64 = 0
$ endif
$!
$ big_endian = 0
$ if f$locate(",bigendian,", args_lower) .lt. args_lower_len
$ then
$     big_endian = 1
$ endif
$!
$ cc_extra = ""
$ args_loc = f$locate(",ccqual=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     cc_extra = f$element(1, "=", arg_val)
$ endif
$!
$ is_debug = 0
$ if f$locate(",debug,", args_lower) .lt. args_lower_len
$ then
$     is_debug = 1
$ endif
$!
$ is_tests = 0
$ test_list = ""
$ if f$locate(",tests,", args_lower) .lt. args_lower_len
$ then
$     is_tests = 1
$ else
$     args_loc = f$locate(",tests=(", args_lower)
$     if args_loc .lt. args_lower_len
$     then
$         is_tests          = 1
$         arg               = f$extract(args_loc + 1, args_lower_len, args_lower)
$         arg_val           = f$element(0, ")", arg)
$         test_list_val     = f$element(1, "=", arg_val) - "(" - ")"
$         test_list_val     = f$edit(test_list_val, "COLLAPSE")
$         test_list_counter = 0
$
$ test_list_loop:
$         next_test_val = f$element (test_list_counter, ",", test_list_val)
$         if next_test_val .nes. "" .and. next_test_val .nes. ","
$         then
$             test_list         = test_list + next_test_val + " "
$             test_list_counter = test_list_counter + 1
$             goto test_list_loop
$         endif
$     endif
$ endif
$!
$ run_tests = 0
$ if f$locate(",run_tests,", args_lower) .lt. args_lower_len
$ then
$     run_tests = 1
$ endif
$!
$ boost_root = ""
$ args_loc = f$locate(",boost_root=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     boost_root = f$element(1, "=", arg_val)
$ endif
$!
$ if is_tests .eqs. "1" .and. boost_root .eqs. ""
$ then
$     'vo_c' "%PLIBSYS-I-NOTESTS, tests couldn't be built without BOOST_ROOT parameter, disabling."
$     is_tests = 0
$ endif
$!
$ if is_tests .eqs. "0" .and. boost_root .nes. ""
$ then
$     'vo_c' "%PLIBSYS-I-BOOSTIGN, BOOST_ROOT parameter will be ignored without tests enabled."
$ endif
$!
$! Prepare build directory
$! -----------------------
$!
$! When building on a search list, need to do a create to make sure that
$! the output directory exists, since the clean procedure tries to delete
$! it.
$!
$ if f$search("''proc_dev_dir'''arch_name'.DIR") .eqs. ""
$ then
$     create/dir 'objdir'/prot=o:rwed
$ endif
$!
$ set default 'objdir'
$ @[-]deltree CXX_REPOSITORY
$!
$ if f$locate(",nolib,", args_lower) .lt. args_lower_len
$ then
$     goto build_tests
$ endif
$!
$! Generate platform-specific config file
$! --------------------------------------
$!
$ if f$search("plibsysconfig.h") .nes. "" then delete plibsysconfig.h;*
$!
$! Get the version number
$! ----------------------
$!
$ i = 0
$ open/read/error=version_loop_end vhf [---]CMakeLists.txt
$ version_loop:
$     read/end=version_loop_end vhf line_in
$!
$     if line_in .eqs. "" then goto version_loop
$!
$     if f$locate("set (PLIBSYS_VERSION_MAJOR ", line_in) .eq. 0
$     then
$         plibsys_vmajor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_MINOR ", line_in) .eq. 0
$     then
$         plibsys_vminor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_PATCH ", line_in) .eq. 0
$     then
$         plibsys_vpatch = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_NUM ", line_in) .eq. 0
$     then
$         plibsys_vnum = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if i .lt 4 then goto version_loop
$ version_loop_end:
$ close vhf
$!
$! Write config file
$! -----------------
$!
$ open/write/error=config_write_end chf plibsysconfig.h
$ write chf "#ifndef PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf "#define PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf ""
$ write chf "#define PLIBSYS_VERSION_MAJOR ''plibsys_vmajor'"
$ write chf "#define PLIBSYS_VERSION_MINOR ''plibsys_vminor'"
$ write chf "#define PLIBSYS_VERSION_PATCH ''plibsys_vpatch'"
$ write chf "#define PLIBSYS_VERSION_STR ""''plibsys_vmajor'.''plibsys_vminor'.''plibsys_vpatch'"""
$ write chf "#define PLIBSYS_VERSION ''plibsys_vnum'"
$ write chf ""
$ write chf "#define PLIBSYS_SIZEOF_SAFAMILY_T 1"
$ write chf ""
$ write chf "#include <pmacros.h>"
$ write chf ""
$ write chf "#include <float.h>"
$ write chf "#include <limits.h>"
$ write chf ""
$ write chf "P_BEGIN_DECLS"
$ write chf ""
$ write chf "#define P_MINFLOAT    FLT_MIN"
$ write chf "#define P_MAXFLOAT    FLT_MAX"
$ write chf "#define P_MINDOUBLE   DBL_MIN"
$ write chf "#define P_MAXDOUBLE   DBL_MAX"
$ write chf "#define P_MINSHORT    SHRT_MIN"
$ write chf "#define P_MAXSHORT    SHRT_MAX"
$ write chf "#define P_MAXUSHORT   USHRT_MAX"
$ write chf "#define P_MININT      INT_MIN"
$ write chf "#define P_MAXINT      INT_MAX"
$ write chf "#define P_MAXUINT     UINT_MAX"
$ write chf "#define P_MINLONG     LONG_MIN"
$ write chf "#define P_MAXLONG     LONG_MAX"
$ write chf "#define P_MAXULONG    ULONG_MAX"
$ write chf ""
$ write chf "#define PLIBSYS_MMAP_HAS_MAP_ANONYMOUS"
$ write chf "#define PLIBSYS_HAS_NANOSLEEP"
$ write chf "#define PLIBSYS_HAS_GETADDRINFO"
$ write chf "#define PLIBSYS_HAS_POSIX_SCHEDULING"
$ write chf "#define PLIBSYS_HAS_POSIX_STACKSIZE"
$ write chf "#define PLIBSYS_HAS_SOCKADDR_STORAGE"
$ write chf "#define PLIBSYS_SOCKADDR_HAS_SA_LEN"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_SCOPEID"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_FLOWINFO"
$ write chf ""
$!
$ if build_64 .eqs. "1"
$ then
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 8"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 8"
$ else
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 4"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 4"
$ endif
$!
$ write chf "#define PLIBSYS_SIZEOF_LONG 4"
$ write chf ""
$!
$ if big_endian .eqs. "1"
$ then
$     write chf "#define P_BYTE_ORDER P_BIG_ENDIAN"
$ else
$     write chf "#define P_BYTE_ORDER P_LITTLE_ENDIAN"
$ endif
$!
$ write chf ""
$ write chf "P_END_DECLS"
$ write chf ""
$ write chf "#endif /* PLIBSYS_HEADER_PLIBSYSCONFIG_H */"
$ config_write_end:
$     close chf
$!
$! Prepare sources for compilation
$! -------------------------------
$!
$ cc_link_params = ""
$ cc_params = "/NAMES=(AS_IS,SHORTENED)"
$ cc_params = cc_params + "/DEFINE=(PLIBSYS_COMPILATION,_REENTRANT,_POSIX_EXIT)"
$ cc_params = cc_params + "/INCLUDE_DIRECTORY=(''objdir',''base_src_dir')"
$ cc_params = cc_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cc_params = cc_params + "/POINTER_SIZE=64"
$ else
$     cc_params = cc_params + "/POINTER_SIZE=32"
$ endif
$!
$ if cc_extra .nes. ""
$ then
$     cc_params = cc_params + " " + cc_extra
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cc_params = cc_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$     cc_link_params = "/DEBUG/TRACEBACK"
$ else
$     cc_link_params = "/NODEBUG/NOTRACEBACK"
$ endif
$!
$ plibsys_src = "patomic-sim.c pcondvariable-posix.c pcryptohash-gost3411.c pcryptohash-md5.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha1.c pcryptohash-sha2-256.c pcryptohash-sha2-512.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha3.c pcryptohash.c pdir-posix.c pdir.c"
$ plibsys_src = plibsys_src + " perror.c pfile.c phashtable.c pinifile.c pipc.c plibraryloader.c"
$ plibsys_src = plibsys_src + " plist.c pmain.c pmem.c pmutex-posix.c pprocess.c prwlock-posix.c"
$ plibsys_src = plibsys_src + " psemaphore-posix.c pshm-posix.c pshmbuffer.c psocket.c"
$ plibsys_src = plibsys_src + " psocketaddress.c pspinlock-sim.c pstring.c psysclose-unix.c"
$ plibsys_src = plibsys_src + " ptimeprofiler-posix.c ptimeprofiler.c ptree-avl.c ptree-bst.c"
$ plibsys_src = plibsys_src + " ptree-rb.c ptree.c puthread-posix.c puthread.c"
$!
$! Inform about building
$! ---------------------
$!
$ if build_64 .eqs. "1"
$ then
$     'vo_c' "Building for ''arch_name' (64-bit)"
$ else
$     'vo_c' "Building for ''arch_name' (32-bit)"
$ endif
$!
$! Compile library modules
$! -----------------------
$!
$ 'vo_c' "Compiling object modules..."
$ src_counter = 0
$ plibsys_src = f$edit(plibsys_src, "COMPRESS")
$ plibsys_objs = ""
$!
$ src_loop:
$     next_src = f$element (src_counter, " ", plibsys_src)
$     if next_src .nes. "" .and. next_src .nes. " "
$     then
$         'vo_c' "[CC] ''next_src'"
$         cc [---.src]'next_src' 'cc_params'
$!
$         src_counter = src_counter + 1
$!
$         obj_file = f$extract (0, f$length (next_src) - 1, next_src) + "obj"
$         plibsys_objs = plibsys_objs + "''obj_file',"
$         purge 'obj_file'
$!
$         goto src_loop
$     endif
$!
$ plibsys_objs = f$extract (0, f$length (plibsys_objs) - 1, plibsys_objs)
$!
$! Create library
$! --------------
$!
$ 'vo_c' "Creating object library..."
$ library/CREATE/INSERT/REPLACE /LIST=PLIBSYS.LIS PLIBSYS.OLB 'plibsys_objs'
$ library/COMPRESS PLIBSYS.OLB
$ purge PLIBSYS.OLB
$ purge PLIBSYS.LIS
$!
$ 'vo_c' "Creating shared library..."
$ link/SHAREABLE=PLIBSYS.EXE /MAP=PLIBSYS.MAP 'cc_link_params' 'plibsys_objs', [-]plibsys.opt/OPTION
$ purge PLIBSYS.EXE
$ purge PLIBSYS.MAP
$!
$! Testing area
$! ------------
$!
$ build_tests:
$ test_list_full = "patomic pcondvariable pcryptohash pdir"
$ test_list_full = test_list_full + " perror pfile phashtable pinifile plibraryloader plist"
$ test_list_full = test_list_full + " pmacros pmain pmem pmutex pprocess prwlock psemaphore"
$ test_list_full = test_list_full + " pshm pshmbuffer psocket psocketaddress pspinlock pstring"
$ test_list_full = test_list_full + " ptimeprofiler ptree ptypes puthread"
$!
$ if is_tests .eqs. "0"
$ then
$     goto build_done
$ endif
$!
$! Write link options file
$! -----------------------
$!
$ if f$search("plibsys_link.opt") .nes. "" then delete plibsys_link.opt;*
$!
$ open/write/error=link_write_end lhf plibsys_link.opt
$ write lhf "''objdir'PLIBSYS.EXE/SHARE"
$ write lhf ""
$ link_write_end:
$     close lhf
$!
$! Compile tests
$! -------------------------
$!
$ if test_list .nes. ""
$ then
$     plibsys_tests = f$edit(test_list, "TRIM")
$ else
$     plibsys_tests = test_list_full
$ endif
$!
$ 'vo_c' "Compiling test executables..."
$ test_counter = 0
$ plibsys_tests = f$edit(plibsys_tests, "COMPRESS")
$!
$ cxx_params = "/INCLUDE=(''objdir',''base_src_dir',""''boost_root'"")"
$ cxx_params = cxx_params + "/DEFINE=(__USE_STD_IOSTREAM,PLIBSYS_TESTS_STATIC)/NAMES=(AS_IS, SHORTENED)"
$ cxx_params = cxx_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cxx_params = cxx_params + "/POINTER_SIZE=64"
$ else
$     cxx_params = cxx_params + "/POINTER_SIZE=32"
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cxx_params = cxx_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$ endif
$!
$ test_loop:
$     next_test = f$element (test_counter, " ", plibsys_tests)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         next_test = next_test + "_test"
$         'vo_c' "[CXX    ] ''next_test'.cpp"
$         cxx [---.tests]'next_test'.cpp 'cxx_params'
$!
$         'vo_c' "[CXXLINK] ''next_test'.obj"
$          cxxlink 'next_test'.obj,'objdir'plibsys_link.opt/OPTION /THREADS_ENABLE
$!
$         @[-]deltree CXX_REPOSITORY
$         purge 'next_test'.obj
$         purge 'next_test'.exe
$!
$         test_counter = test_counter + 1
$         goto test_loop
$     endif
$!
$ build_done:
$     'vo_c' "Build done."
$!
$! Run unit tests
$! --------------
$!
$ if run_tests .eqs. "0"
$ then
$     goto common_exit
$ endif
$!
$ 'vo_c' "Running tests..."
$ test_counter = 0
$ tests_passed = 0
$!
$ run_loop:
$     next_test = f$element (test_counter, " ", test_list_full)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         if f$search("''next_test'_test.exe") .eqs. ""
$         then
$             'vo_c' "[SKIP] Test not found: ''next_test'"
$             goto run_loop_next
$         endif
$!
$         'vo_c' "[RUN ] ''next_test'"
$!
$         define/user sys$error NL:
$         define/user sys$output NL:
$         define/user plibsys 'objdir'PLIBSYS.EXE
$         define/user test_imgdir 'objdir'
$!
$         xrun := $test_imgdir:'next_test'_test.exe
$         if next_test .eqs. "plibraryloader"
$         then
$             xrun 'objdir'PLIBSYS.EXE
$         else
$             xrun
$         endif
$!
$         if $STATUS .eqs. "%X00000001"
$         then
$             'vo_c' "[PASS] Test passed: ''next_test'"
$             tests_passed = tests_passed + 1
$         else
$             'vo_c' "[FAIL] *** Test failed: ''next_test'"
$         endif
$!
$ run_loop_next:
$         test_counter = test_counter + 1
$         goto run_loop
$     endif
$!
$ 'vo_c' "Tests passed: ''tests_passed'/''test_counter'"
$!
$ common_exit:
$     set default 'orig_def'
$     exit


Removed a random file that shouldn't be in the repro.

from flask import Flask
from flask import render_template

app = Flask(__name__)

@app.route('/', methods=['GET'])
def home_page():
    return render_template('base.html')

if __name__ == '__main__':
    app.run()


Correct redirect to about.gitlab.com from http.

# Located in: /etc/nginx/sites-available/www.gitlab.com

# You may add here your
# server {
#	...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
  listen 80;
  server_name localhost www.gitlab.com blue-moon.gitlap.com;
  server_tokens off;
  return 301 https://www.gitlab.com$request_uri;
}

server {
  listen 80;
  server_name about.gitlab.com;
  server_tokens off;
  return 301 https://about.gitlab.com$request_uri;
}

server {
  listen 80;
  server_name gitlab.org gitlabhq.com www.gitlabhq.com;
  server_name_in_redirect off;

  include /etc/nginx/conf.d/org_to_com_rewrite_rules.rules;

  location / {
    rewrite ^/$ https://www.gitlab.com/ permanent;
  }

  if ($http_host != "gitlab.org") {
    rewrite ^ http://gitlab.org$request_uri permanent;
  }
}

server {
  listen 80;
  server_name api.gitlab.org;
  server_name_in_redirect off;

  rewrite ^ http://doc.gitlab.com/ce/api$request_uri permanent;
}

server {
  listen 80;
  server_name blog.gitlabhq.com blog.gitlab.org;
  server_name_in_redirect off;

  if ($http_host != "blog.gitlab.org") {
    rewrite ^ http://blog.gitlab.org$request_uri permanent;
  }

  include /etc/nginx/conf.d/blog_rewrite_rules.rules;

  location / {
    rewrite ^/$ https://www.gitlab.com/blog permanent;
  }
}

server {
  listen 80;
  server_name status.gitlab.com;
  root /home/deploy/status-gitlab-com/_site;
  location / {
    index index.html;
  }
}

# HTTPS server
#
server {
  listen 443;
  root /home/deploy/public;
  index index.html;
  add_header X-Frame-Options DENY;
  server_name localhost www.gitlab.com blue-moon.gitlap.com;
  server_tokens off;

  ssl on;
  ssl_certificate /etc/ssl/www.gitlab.com.bundle;
  ssl_certificate_key /etc/ssl/www.gitlab.com.key;
  ssl_session_timeout 5m;
  # ssl_protocols SSLv3 TLSv1;
  ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4';
  ssl_prefer_server_ciphers on;

  gzip on; # Enable gzip compression
  gzip_comp_level 6; # Compression level
  gzip_vary on; # Proxies can store both compressed and uncompressed version of the content
  gzip_proxied any; # Enable compression for all requests when request is coming from a proxy
  gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  gzip_buffers 16 8k; # Number and the size of the compression buffers
  gzip_disable "MSIE [1-6].(?!.*SV1)"; # Disables gzip compression for browsers not supporting it, < IE 6

  rewrite ^/features/ https://www.gitlab.com/gitlab-ee/ permanent;
  rewrite ^/features https://www.gitlab.com/gitlab-ee/ permanent;
  location / {
  }
  location ~ ^/subscription/(basic|standard|plus|success)$ {
     proxy_pass http://localhost:4567;
     proxy_set_header  X-Real-IP  $remote_addr;
  }
  location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
   expires 365d;
  }
  location ~ ^/webhook$ {
    proxy_pass http://localhost:5555;
    proxy_set_header  X-Real-IP  $remote_addr;
    allow   54.243.197.170;
    deny    all;
  }
}

server {
  listen 443;
  root /home/deploy/public;
  index index.html;
  add_header X-Frame-Options DENY;
  server_name localhost about.gitlab.com;
  server_tokens off;

  ssl on;
  ssl_certificate /etc/ssl/about.gitlab.com.bundle;
  ssl_certificate_key /etc/ssl/about.gitlab.com.key;
  ssl_session_timeout 5m;
  # ssl_protocols SSLv3 TLSv1;
  ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4';
  ssl_prefer_server_ciphers on;

  gzip on; # Enable gzip compression
  gzip_comp_level 6; # Compression level
  gzip_vary on; # Proxies can store both compressed and uncompressed version of the content
  gzip_proxied any; # Enable compression for all requests when request is coming from a proxy
  gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  gzip_buffers 16 8k; # Number and the size of the compression buffers
  gzip_disable "MSIE [1-6].(?!.*SV1)"; # Disables gzip compression for browsers not supporting it, < IE 6

  location / {
  }
  location ~ ^/subscription/(basic|standard|plus|success)$ {
     proxy_pass http://localhost:4567;
     proxy_set_header  X-Real-IP  $remote_addr;
  }
  location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
   expires 365d;
  }
  location ~ ^/webhook$ {
    proxy_pass http://localhost:5555;
    proxy_set_header  X-Real-IP  $remote_addr;
    allow   54.243.197.170;
    deny    all;
  }
}

# Located in: /etc/nginx/sites-available/www.gitlab.com

# You may add here your
# server {
#	...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
  listen 80;
  server_name localhost www.gitlab.com blue-moon.gitlap.com;
  server_tokens off;
  return 301 https://www.gitlab.com$request_uri;
}

server {
  listen 80;
  server_name gitlab.org gitlabhq.com www.gitlabhq.com;
  server_name_in_redirect off;

  include /etc/nginx/conf.d/org_to_com_rewrite_rules.rules;

  location / {
    rewrite ^/$ https://www.gitlab.com/ permanent;
  }

  if ($http_host != "gitlab.org") {
    rewrite ^ http://gitlab.org$request_uri permanent;
  }
}

server {
  listen 80;
  server_name api.gitlab.org;
  server_name_in_redirect off;

  rewrite ^ http://doc.gitlab.com/ce/api$request_uri permanent;
}

server {
  listen 80;
  server_name blog.gitlabhq.com blog.gitlab.org;
  server_name_in_redirect off;

  if ($http_host != "blog.gitlab.org") {
    rewrite ^ http://blog.gitlab.org$request_uri permanent;
  }

  include /etc/nginx/conf.d/blog_rewrite_rules.rules;

  location / {
    rewrite ^/$ https://www.gitlab.com/blog permanent;
  }
}

server {
  listen 80;
  server_name status.gitlab.com;
  root /home/deploy/status-gitlab-com/_site;
  location / {
    index index.html;
  }
}

# HTTPS server
#
server {
  listen 443;
  root /home/deploy/public;
  index index.html;
  add_header X-Frame-Options DENY;
  server_name localhost www.gitlab.com blue-moon.gitlap.com;
  server_tokens off;

  ssl on;
  ssl_certificate /etc/ssl/www.gitlab.com.bundle;
  ssl_certificate_key /etc/ssl/www.gitlab.com.key;
  ssl_session_timeout 5m;
  # ssl_protocols SSLv3 TLSv1;
  ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4';
  ssl_prefer_server_ciphers on;

  gzip on; # Enable gzip compression
  gzip_comp_level 6; # Compression level
  gzip_vary on; # Proxies can store both compressed and uncompressed version of the content
  gzip_proxied any; # Enable compression for all requests when request is coming from a proxy
  gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  gzip_buffers 16 8k; # Number and the size of the compression buffers
  gzip_disable "MSIE [1-6].(?!.*SV1)"; # Disables gzip compression for browsers not supporting it, < IE 6

  rewrite ^/features/ https://www.gitlab.com/gitlab-ee/ permanent;
  rewrite ^/features https://www.gitlab.com/gitlab-ee/ permanent;
  location / {
  }
  location ~ ^/subscription/(basic|standard|plus|success)$ {
     proxy_pass http://localhost:4567;
     proxy_set_header  X-Real-IP  $remote_addr;
  }
  location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
   expires 365d;
  }
  location ~ ^/webhook$ {
    proxy_pass http://localhost:5555;
    proxy_set_header  X-Real-IP  $remote_addr;
    allow   54.243.197.170;
    deny    all;
  }
}

server {
  listen 443;
  root /home/deploy/public;
  index index.html;
  add_header X-Frame-Options DENY;
  server_name localhost about.gitlab.com;
  server_tokens off;

  ssl on;
  ssl_certificate /etc/ssl/about.gitlab.com.bundle;
  ssl_certificate_key /etc/ssl/about.gitlab.com.key;
  ssl_session_timeout 5m;
  # ssl_protocols SSLv3 TLSv1;
  ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4';
  ssl_prefer_server_ciphers on;

  gzip on; # Enable gzip compression
  gzip_comp_level 6; # Compression level
  gzip_vary on; # Proxies can store both compressed and uncompressed version of the content
  gzip_proxied any; # Enable compression for all requests when request is coming from a proxy
  gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  gzip_buffers 16 8k; # Number and the size of the compression buffers
  gzip_disable "MSIE [1-6].(?!.*SV1)"; # Disables gzip compression for browsers not supporting it, < IE 6

  location / {
  }
  location ~ ^/subscription/(basic|standard|plus|success)$ {
     proxy_pass http://localhost:4567;
     proxy_set_header  X-Real-IP  $remote_addr;
  }
  location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
   expires 365d;
  }
  location ~ ^/webhook$ {
    proxy_pass http://localhost:5555;
    proxy_set_header  X-Real-IP  $remote_addr;
    allow   54.243.197.170;
    deny    all;
  }
}


Too many dollars...

Too many dollars...

$! TESTS.COM  --  Performs the necessary tests
$!
$! P1	tests to be performed.  Empty means all.
$
$	__proc = f$element(0,";",f$environment("procedure"))
$	__here = f$parse(f$parse("A.;",__proc) - "A.;","[]A.;") - "A.;"
$	__save_default = f$environment("default")
$	__arch := VAX
$	if f$getsyi("cpu") .ge. 128 then __arch := AXP
$	texe_dir := sys$disk:[-.'__arch'.exe.test]
$	exe_dir := sys$disk:[-.'__arch'.exe.apps]
$
$	set default '__here'
$	on control_y then goto exit
$	on error then goto exit
$
$	if p1 .nes. ""
$	then
$	    tests = p1
$	else
$	    tests := -
	test_des,test_idea,test_sha,test_md4,test_md5,test_hmac,-
	test_md2,test_mdc2,-
	test_rmd,test_rc2,test_rc4,test_rc5,test_bf,test_cast,test_rd,-
	test_rand,test_bn,test_ec,test_enc,test_x509,test_rsa,test_crl,test_sid,-
	test_gen,test_req,test_pkcs7,test_verify,test_dh,test_dsa,-
	test_ss,test_ca,test_engine,test_ssl
$	endif
$	tests = f$edit(tests,"COLLAPSE")
$
$	BNTEST :=	bntest
$	ECTEST :=	ectest
$	EXPTEST :=	exptest
$	IDEATEST :=	ideatest
$	SHATEST :=	shatest
$	SHA1TEST :=	sha1test
$	MDC2TEST :=	mdc2test
$	RMDTEST :=	rmdtest
$	MD2TEST :=	md2test
$	MD4TEST :=	md4test
$	MD5TEST :=	md5test
$	HMACTEST :=	hmactest
$	RC2TEST :=	rc2test
$	RC4TEST :=	rc4test
$	RC5TEST :=	rc5test
$	BFTEST :=	bftest
$	CASTTEST :=	casttest
$	DESTEST :=	destest
$	RANDTEST :=	randtest
$	DHTEST :=	dhtest
$	DSATEST :=	dsatest
$	METHTEST :=	methtest
$	SSLTEST :=	ssltest
$	RSATEST :=	rsa_test
$	ENGINETEST :=	enginetest
$
$	tests_i = 0
$ loop_tests:
$	tests_e = f$element(tests_i,",",tests)
$	tests_i = tests_i + 1
$	if tests_e .eqs. "," then goto exit
$	gosub 'tests_e'
$	goto loop_tests
$
$ test_des:
$	mcr 'texe_dir''destest'
$	return
$ test_idea:
$	mcr 'texe_dir''ideatest'
$	return
$ test_sha:
$	mcr 'texe_dir''shatest'
$	mcr 'texe_dir''sha1test'
$	return
$ test_mdc2:
$	mcr 'texe_dir''mdc2test'
$	return
$ test_md5:
$	mcr 'texe_dir''md5test'
$	return
$ test_md4:
$	mcr 'texe_dir''md4test'
$	return
$ test_hmac:
$	mcr 'texe_dir''hmactest'
$	return
$ test_md2:
$	mcr 'texe_dir''md2test'
$	return
$ test_rmd:
$	mcr 'texe_dir''rmdtest'
$	return
$ test_bf:
$	mcr 'texe_dir''bftest'
$	return
$ test_cast:
$	mcr 'texe_dir''casttest'
$	return
$ test_rc2:
$	mcr 'texe_dir''rc2test'
$	return
$ test_rc4:
$	mcr 'texe_dir''rc4test'
$	return
$ test_rc5:
$	mcr 'texe_dir''rc5test'
$	return
$ test_rand:
$	mcr 'texe_dir''randtest'
$	return
$ test_enc:
$	@testenc.com
$	return
$ test_x509:
$	define sys$error nla0:
$	write sys$output "test normal x509v1 certificate"
$	@tx509.com
$	write sys$output "test first x509v3 certificate"
$	@tx509.com v3-cert1.pem
$	write sys$output "test second x509v3 certificate"
$	@tx509.com v3-cert2.pem
$	deassign sys$error
$	return
$ test_rsa:
$	define sys$error nla0:
$	@trsa.com
$	deassign sys$error
$	mcr 'texe_dir''rsatest'
$	return
$ test_crl:
$	define sys$error nla0:
$	@tcrl.com
$	deassign sys$error
$	return
$ test_sid:
$	define sys$error nla0:
$	@tsid.com
$	deassign sys$error
$	return
$ test_req:
$	define sys$error nla0:
$	@treq.com
$	@treq.com testreq2.pem
$	deassign sys$error
$	return
$ test_pkcs7:
$	define sys$error nla0:
$	@tpkcs7.com
$	@tpkcs7d.com
$	deassign sys$error
$	return
$ test_bn:
$	write sys$output "starting big number library test, could take a while..."
$	create bntest-vms.fdl
FILE
	ORGANIZATION	sequential
RECORD
	FORMAT		stream_lf
$	create/fdl=bntest-vms.fdl bntest-vms.sh
$	open/append foo bntest-vms.sh
$	type/output=foo: sys$input:
<< __FOO__ sh -c "`sh ./bctest`" | perl -e '$i=0; while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $1";} elsif (!/^0$/) {die "\nFailed! bc: $_";} else {print STDERR "."; $i++;}} print STDERR "\n$i tests passed\n"'
$	define/user sys$output bntest-vms.tmp
$	mcr 'texe_dir''bntest'
$	copy bntest-vms.tmp foo:
$	delete bntest-vms.tmp;*
$	type/output=foo: sys$input:
__FOO__
$	close foo
$	write sys$output "-- copy the [.test]bntest-vms.sh and [.test]bctest files to a Unix system and"
$	write sys$output "-- run bntest-vms.sh through sh or bash to verify that the bignum operations"
$	write sys$output "-- went well."
$	write sys$output ""
$	write sys$output "test a^b%c implementations"
$	mcr 'texe_dir''exptest'
$	return
$ test_ec:
$	write sys$output "test elliptic curves"
$	mcr 'texe_dir''ectest'
$	return
$ test_verify:
$	write sys$output "The following command should have some OK's and some failures"
$	write sys$output "There are definitly a few expired certificates"
$	@tverify.com
$	return
$ test_dh:
$	write sys$output "Generate a set of DH parameters"
$	mcr 'texe_dir''dhtest'
$	return
$ test_dsa:
$	write sys$output "Generate a set of DSA parameters"
$	mcr 'texe_dir''dsatest'
$	return
$ test_gen:
$	write sys$output "Generate and verify a certificate request"
$	@testgen.com
$	return
$ maybe_test_ss:
$	testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
$	if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	return
$ test_ss:
$	write sys$output "Generate and certify a test certificate"
$	@testss.com
$	return
$ test_engine:
$	write sys$output "Manipulate the ENGINE structures"
$	mcr 'texe_dir''enginetest'
$	return
$ test_ssl:
$	write sys$output "test SSL protocol"
$	gosub maybe_test_ss
$	@testssl.com keyU.ss certU.ss certCA.ss
$	return
$ test_ca:
$	set noon
$	define/user sys$output nla0:
$	mcr 'exe_dir'openssl no-rsa
$	save_severity=$SEVERITY
$	set on
$	if save_severity
$	then
$	    write sys$output "skipping CA.com test -- requires RSA"
$	else
$	    write sys$output "Generate and certify a test certificate via the 'ca' program"
$	    @testca.com
$	endif
$	return
$ test_rd:
$	write sys$output "test Rijndael"
$	!mcr 'texe_dir''rdtest'
$	return
$
$
$ exit:
$	set default '__save_default'
$	exit

$! TESTS.COM  --  Performs the necessary tests
$!
$! P1	tests to be performed.  Empty means all.
$
$	__proc = f$element(0,";",f$environment("procedure"))
$	__here = f$parse(f$parse("A.;",__proc) - "A.;","[]A.;") - "A.;"
$	__save_default = f$environment("default")
$	__arch := VAX
$	if f$getsyi("cpu") .ge. 128 then __arch := AXP
$	texe_dir := sys$disk:[-.'__arch'.exe.test]
$	exe_dir := sys$disk:[-.'__arch'.exe.apps]
$
$	set default '__here'
$	on control_y then goto exit
$	on error then goto exit
$
$	if p1 .nes. ""
$	then
$	    tests = p1
$	else
$	    tests := -
	test_des,test_idea,test_sha,test_md4,test_md5,test_hmac,-
	test_md2,test_mdc2,-
	test_rmd,test_rc2,test_rc4,test_rc5,test_bf,test_cast,test_rd,-
	test_rand,test_bn,test_ec,test_enc,test_x509,test_rsa,test_crl,test_sid,-
	test_gen,test_req,test_pkcs7,test_verify,test_dh,test_dsa,-
	test_ss,test_ca,test_engine,test_ssl
$	endif
$	tests = f$edit(tests,"COLLAPSE")
$
$	BNTEST :=	bntest
$	ECTEST :=	ectest
$	EXPTEST :=	exptest
$	IDEATEST :=	ideatest
$	SHATEST :=	shatest
$	SHA1TEST :=	sha1test
$	MDC2TEST :=	mdc2test
$	RMDTEST :=	rmdtest
$	MD2TEST :=	md2test
$	MD4TEST :=	md4test
$	MD5TEST :=	md5test
$	HMACTEST :=	hmactest
$	RC2TEST :=	rc2test
$	RC4TEST :=	rc4test
$	RC5TEST :=	rc5test
$	BFTEST :=	bftest
$	CASTTEST :=	casttest
$	DESTEST :=	destest
$	RANDTEST :=	randtest
$	DHTEST :=	dhtest
$	DSATEST :=	dsatest
$	METHTEST :=	methtest
$	SSLTEST :=	ssltest
$	RSATEST :=	rsa_test
$	ENGINETEST :=	enginetest
$
$	tests_i = 0
$ loop_tests:
$	tests_e = f$element(tests_i,",",tests)
$	tests_i = tests_i + 1
$	if tests_e .eqs. "," then goto exit
$	gosub 'tests_e'
$	goto loop_tests
$
$ test_des:
$	mcr 'texe_dir''destest'
$	return
$ test_idea:
$	mcr 'texe_dir''ideatest'
$	return
$ test_sha:
$	mcr 'texe_dir''shatest'
$	mcr 'texe_dir''sha1test'
$	return
$ test_mdc2:
$	mcr 'texe_dir''mdc2test'
$	return
$ test_md5:
$	mcr 'texe_dir''md5test'
$	return
$ test_md4:
$	mcr 'texe_dir''md4test'
$	return
$ test_hmac:
$	mcr 'texe_dir''hmactest'
$	return
$ test_md2:
$	mcr 'texe_dir''md2test'
$	return
$ test_rmd:
$	mcr 'texe_dir''rmdtest'
$	return
$ test_bf:
$	mcr 'texe_dir''bftest'
$	return
$ test_cast:
$	mcr 'texe_dir''casttest'
$	return
$ test_rc2:
$	mcr 'texe_dir''rc2test'
$	return
$ test_rc4:
$	mcr 'texe_dir''rc4test'
$	return
$ test_rc5:
$	mcr 'texe_dir''rc5test'
$	return
$ test_rand:
$	mcr 'texe_dir''randtest'
$	return
$ test_enc:
$	@testenc.com
$	return
$ test_x509:
$	define sys$error nla0:
$	write sys$output "test normal x509v1 certificate"
$	@tx509.com
$	write sys$output "test first x509v3 certificate"
$	@tx509.com v3-cert1.pem
$	write sys$output "test second x509v3 certificate"
$	@tx509.com v3-cert2.pem
$	deassign sys$error
$	return
$ test_rsa:
$	define sys$error nla0:
$	@trsa.com
$	deassign sys$error
$	mcr 'texe_dir''rsatest'
$	return
$ test_crl:
$	define sys$error nla0:
$	@tcrl.com
$	deassign sys$error
$	return
$ test_sid:
$	define sys$error nla0:
$	@tsid.com
$	deassign sys$error
$	return
$ test_req:
$	define sys$error nla0:
$	@treq.com
$	@treq.com testreq2.pem
$	deassign sys$error
$	return
$ test_pkcs7:
$	define sys$error nla0:
$	@tpkcs7.com
$	@tpkcs7d.com
$	deassign sys$error
$	return
$ test_bn:
$	write sys$output "starting big number library test, could take a while..."
$	create bntest-vms.fdl
FILE
	ORGANIZATION	sequential
RECORD
	FORMAT		stream_lf
$	create/fdl=bntest-vms.fdl bntest-vms.sh
$	open/append foo bntest-vms.sh
$	type/output=foo: sys$input:
<< __FOO__ sh -c "`sh ./bctest`" | $(PERL) -e '$$i=0; while (<STDIN>) {if (/^test (.*)/) {print STDERR "\nverify $$1";} elsif (!/^0$$/) {die "\nFailed! bc: $$_";} else {print STDERR "."; $$i++;}} print STDERR "\n$$i tests passed\n"'
$	define/user sys$output bntest-vms.tmp
$	mcr 'texe_dir''bntest'
$	copy bntest-vms.tmp foo:
$	delete bntest-vms.tmp;*
$	type/output=foo: sys$input:
__FOO__
$	close foo
$	write sys$output "-- copy the [.test]bntest-vms.sh file to a Unix system and run it"
$	write sys$output "-- through sh or bash to verify that the bignum operations went well."
$	write sys$output ""
$	write sys$output "test a^b%c implementations"
$	mcr 'texe_dir''exptest'
$	return
$ test_ec:
$	write sys$output "test elliptic curves"
$	mcr 'texe_dir''ectest'
$	return
$ test_verify:
$	write sys$output "The following command should have some OK's and some failures"
$	write sys$output "There are definitly a few expired certificates"
$	@tverify.com
$	return
$ test_dh:
$	write sys$output "Generate a set of DH parameters"
$	mcr 'texe_dir''dhtest'
$	return
$ test_dsa:
$	write sys$output "Generate a set of DSA parameters"
$	mcr 'texe_dir''dsatest'
$	return
$ test_gen:
$	write sys$output "Generate and verify a certificate request"
$	@testgen.com
$	return
$ maybe_test_ss:
$	testss_RDT = f$cvtime(f$file_attributes("testss.com","RDT"))
$	if f$cvtime(f$file_attributes("keyU.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	if f$cvtime(f$file_attributes("certU.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	if f$cvtime(f$file_attributes("certCA.ss","RDT")) .les. testss_RDT then -
		goto test_ss
$	return
$ test_ss:
$	write sys$output "Generate and certify a test certificate"
$	@testss.com
$	return
$ test_engine:
$	write sys$output "Manipulate the ENGINE structures"
$	mcr 'texe_dir''enginetest'
$	return
$ test_ssl:
$	write sys$output "test SSL protocol"
$	gosub maybe_test_ss
$	@testssl.com keyU.ss certU.ss certCA.ss
$	return
$ test_ca:
$	set noon
$	define/user sys$output nla0:
$	mcr 'exe_dir'openssl no-rsa
$	save_severity=$SEVERITY
$	set on
$	if save_severity
$	then
$	    write sys$output "skipping CA.com test -- requires RSA"
$	else
$	    write sys$output "Generate and certify a test certificate via the 'ca' program"
$	    @testca.com
$	endif
$	return
$ test_rd:
$	write sys$output "test Rijndael"
$	!mcr 'texe_dir''rdtest'
$	return
$
$
$ exit:
$	set default '__save_default'
$	exit