amazon web services – Terraforming Windows – Can’t Add to PATH

I got a Terraform to deploy a Windows 10 Server,

It does fine to do so, but I can’t seem to get it to finish this <script> part:

Here is the code:

<script>
  @echo off
  echo Deployment Script Started> C:deploy.log
  netsh advfirewall firewall add rule name="Open Node-red port" protocol=TCP dir=in localport=1880 action=allow >> C:deploy.log
  echo netsh advfirewall add rule 1880 complete>> C:deploy.log
  @"%SystemRoot%System32WindowsPowerShellv1.0powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command " (System.Net.ServicePointManager)::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin;%ALLUSERSPROFILE%Python3;" >> C:deploy.log
  echo choco installed>> C:deploy.log
  choco install python3 -y --override --installarguments "'/quiet  InstallAllUsers=1 TargetDir=%ALLUSERSPROFILE%Python3'" >> C:deploy.log
  echo Python 3 install in Python3>> C:deploy.log
  choco install nodejs-lts -y >> C:deploy.log
  echo nodejs installed>> C:deploy.log 
  refreshenv
  npm install -g --unsafe-perm node-red >> C:deploy.log
  echo node-red global>> C:deploy.log
  npm install pm2-windows-startup -g >> C:deploy.log
  echo install pm2 windows-startup>> C:deploy.log
  pm2-startup install >> C:deploy.log
  echo pm2-startup installed>> C:deploy.log
  pm2 save >> C:deploy.log 
  echo pm2 save>> C:deploy.log >> C:deploy.log
  pm2 start C:UsersAdministratorAppDataRoamingnpmnode_modulesnode-redred.js -- --save >> C:deploy.log
  echo pm2 start>> C:deploy.log
  winrm quickconfig -q & winrm set winrm/config @{MaxTimeoutms="1800000"} & winrm set winrm/config/service @{AllowUnencrypted="true"} & winrm set winrm/config/service/auth @{Basic="true"} >> C:deploy.log
  echo winrm configd>> C:deploy.log
  npm install --global --production windows-build-tools >> C:deploy.log
  echo npm install windows-build-tools>> C:deploy.log
</script>
<powershell>
  Invoke-WebRequest `https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe ` -OutFile $env:USERPROFILEDesktopSSMAgent_latest.exe
  Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
  Start-Service sshd
  Get-Service sshd
  Set-Service -Name sshd -StartupType 'Automatic'
  New-ItemProperty -Path "HKLM:SOFTWAREOpenSSH" -Name DefaultShell -Value "C:Program FilesPowerShell7pwsh.exe" -PropertyType String -Force
</powershell>
EOF

I ultimately trying to get it to install node-red and have it auto run when the server deploys.

Been all day with no luck. Can’t populate the PATH with the Python directory, and subsequently it won’t install anything after nodejs.

graph traversal – For a set of points P, connected by weighted edges (distances) I need a path through all points while minimizing the travel on any edge longer than X

Build a graph with one vertex per point. Add an edge of length 0 between a pair of vertices $v,w$ if they are at most $X$ distance apart; otherwise add an edge of length 1. Then, use any existing algorithm for the travelling salesman problem in this graph. Solving the TSP in this graph will solve your problem. There are many algorithms, heuristics, etc., including many software packages you can download that implement them for you. (Note that this TSP instance will be an instance of metric TSP, which may enable some algorithms that take into account that additional structure.)

This could reasonably be called an instance of (0,1)-TSP. I have not been able to find any papers in the literature on (0,1)-TSP, though I have found several on approximation algorithms for (1,2)-TSP.

algorithm – Given a 2D array, how do I generate a random path of fixed length from a random point at length 0 to a random point at max length?

I’m trying to generate a random path on a 2D grid given that:

  • The width and height of the grid are given
  • The length of the path to generate is given
  • The path can’t move “back”
  • The path starts from a random point at height 0 and ends at a random point at max height
  • A path segment cannot “touch” with a path segment that is at its height – 1 that is not the latest generated segment of the previous height

This is what two paths generated from the parameters {Width:11, Length:17, PathLength:30} would look like:

generated path example 1
generated path example 2

and this is an example of a path that should not be generated:

Bad example

The result of the algorithm should be a list of value pairs such as this: (8,6) in any order, which indicates the segments of the path.
I’ve been trying to solve this problem for a while, but I have problems understanding how to make this have a given length. If the given length was not a requirement I could just generate it with a nested for cycle and some rules. Please help!

graphs – Concept of M-augmenting path to find a larger matching than $M$

I’m reading section 16.1 of the book, Combinatorial optimization, Polyhedra and efficiency by Schrijver. Here, he starts with a matching $M$ and describes a path $P$ that is $M$-augmenting if:

  1. The path has odd length (in terms of edges).
  2. Its ends are not covered by $M$.
  3. Its edges are alternately out of and in $M$.

Theorem 16.1 then states that we either have a matching of maximal size or an augmenting path exists.

I don’t understand this statement. See the graph below for example. For now, we have the edge between vertices 2 and 5 in a matching $M$. I can’t find any path that satisfies the three conditions above. Yet, this is obviously not a maximal matching since the edge between vertices 1 and 4 can be added to increase its size. What am I missing and why is my understanding so way off?

Further, if I’d used 1-4 as my initial matching, it would have been impossible to find a path that satisfies condition 2.

enter image description here

Conversely, I take the graph the the author himself provides as an example of an augmenting path. In the simple linear graph below (which is also a linked list), an augmenting path satisfying the three conditions above exists. However, where is the edge that can be added to this graph to increase the size of $M$?

enter image description here

How to pull the complete list of Logon Script (or Script Path) present in your Active Directory?

I am trying to pull a complete list of Logon Script (Script path) available in Active Directory as a part of my project. I was able to pull a list of Script paths that are currently in use, by pulling “All AD users” report with an additional attribute named “Script path” using AD Manager Plus. However, I want a complete list of Logon Scripts where I can check both used and obsolete ones. Any help would be appreciated.

mysql – Obtener el path de un archivo en Java

Hola estoy utilizando LOAD DATA LOCAL INFILE 'F:/angel/Desktop/ejemplo.csv' en Mysql pero desde JAVA con un PreparedStatement para importar archivos a tablas temporales, obviamente tengo que poner la ruta del archivo pero con la barra de esta manera /.

Si pongo la ruta con la barra invertida o sea asΓ­: 'F:angelDesktopejemplo.csv' entonces no me reconoce el archivo.

En JAVA con el mΓ©todo File archivo = fileChooser.getSelectedFile(); y seguido File archivo = archivo.getPath(); nombro una variable string con la ruta del archivo pero con barras /.

Hay algun mΓ©todo que me devuelva la ruta del archivo con las barras invertidas de esta manera?: /.

graph theory – Prove that $G$ has a Hamiltonian path.

Suppose that $G$ is a simple graph and sequence of degrees are $𝑑_n$ $geq$ $d_{n-1}$ $geq$$geq$ $d_2$ $geq$ $d_1$. Also suppose that $π‘š<𝑛+12$ does not exist such that $𝑑_π‘š$ $<π‘š$ and $𝑑_{π‘›βˆ’π‘š+1}$ $<π‘›βˆ’π‘š$ .

Prove that $G$ has a Hamiltonian path.
.

I want to use this theorem so solve it:

Theorem: Suppose that $G$ is a simple graph with $n$ $geq$ $3$ vertices and sequence of degrees are $𝑑_n$ $geq$ $d_{n-1}$ $geq$$geq$ $d_2$ $geq$ $d_1$.

If we have for every $i$ $< n/2$ , $d_i$ $> i$ or $d_{n-i}$ $geq$ $n-i$ then $G$ is Hamiltonian.

linux – How to configure PATH in cron, so that it will be set for all crons?

I have a problem where scripts called by cron have very short, safe, path: /usr/bin:/bin

I know, that I can:

  1. Change scripts to use better path
  2. in user crontab add PATH=… configuration

But I’d like to be able to tell crond that on this system all crons should be called with PATH=…

I tried putting it in /etc/crontab:

=# grep PATH /etc/crontab 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

And then, for tests, I wrote:

=# cat /etc/cron.d/test 
* * * * *  test echo "$( date ) - ${PATH}" >> /tmp/test.cron.log

But logged path is still “/usr/bin:/bin”

I did restart crond, and even rebooted, just in case, but it doesn’t seem to help. What am I missing? Or is it impossible?