import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class Eval {
public static void main(String[] args) throws Exception {
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
InputSource doc = new InputSource(new InputStreamReader(
new FileInputStream(new File("file.xml"))));
String expression = "//ROW/COLUMN[@NAME='STOREDATE']";
XPathExpression xPathExpression = xPath.compile(expression);
NodeList elem1List = (NodeList) xPathExpression.evaluate(doc,
XPathConstants.NODESET);
xPathExpression = xPath.compile("text()");
for (int i = 0; i < elem1List.getLength(); i++) {
System.out.println(xPathExpression.evaluate(elem1List.item(i),
XPathConstants.STRING));
}
}
}
javac Eval.java
java Eval
10.10.19
testngxmlfiles\testng-results.xml
make -i -k -n | tee /tmp/a.log
-i, --ignore-errors
Ignore all errors in commands executed to remake files.
-k, --keep-going
Continue as much as possible after an error.
-n, --just-print, --dry-run, --recon
Print the commands that would be executed, but do not execute them
(except in certain circumstances).
sudo -H pip install
source <имя знвайронмента>/bin/activate
Dockerfile
# supervisor docker example
FROM jfloff/alpine-python
RUN apk add --no-cache supervisor && rm -rf /var/lib/apt/lists/*
RUN sed -i 's/^\(\[supervisord\]\)$/\1\nnodaemon=true/' /etc/supervisord.conf
RUN mkdir -p /etc/supervisor.d/
COPY server.py server.py
COPY agent.conf etc/supervisor.d/agent.ini
# for server.py
ARG SERVICE_PORT=8080
ENV SERVICE_PORT=$SERVICE_PORT
EXPOSE $SERVICE_PORT
# NOTE: not ENTRYPOINT
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
agent.conf
[program:server]
autostart = true
autorestart = true
user = root
environment = PYTHONUNBUFFERED=1
directory = /
command = python server.py
stderr_logfile=/var/log/server.err
stdout_logfile=/var/log/server.out
командыdocker build -t example -f Dockerfile .
docker rm example_container
docker run -it --name example_container example
2020-12-19 18:00:54,578 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-12-19 18:00:54,578 INFO Included extra file "/etc/supervisor.d/agent.ini" during parsing
2020-12-19 18:00:54,588 INFO RPC interface 'supervisor' initialized
2020-12-19 18:00:54,588 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-12-19 18:00:54,589 INFO supervisord started with pid 6
2020-12-19 18:00:55,594 INFO spawned: 'server' with pid 8
2020-12-19 18:00:56,597 INFO success: server entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
docker exec -it example_container supervisorctl status server
server RUNNING pid 8, uptime 0:00:14
docker exec -it example_container sh
ls /var/log/
server.err server.out supervisord.log
ps ax | grep pytho[n]
6 root 0:00 {supervisord} /usr/bin/python3 /usr/bin/supervisord -c /etc/supervisord.conf
8 root 0:00 python server.py
BufferedReader stdoutBufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
// к его output прикрепляем наш input
String line = null;
StringBuffer processOutput = new StringBuffer();
while ((line = stdoutBufferedReader.readLine()) != null) {
processOutput.append(line);
}
....
if (processOutput.length() > 0) {
log.info("<OUTPUT>" + processOutput + "</OUTPUT>");
}
hargo.exe run test\golang.org.har
time="2020-12-18T19:08:45-05:00" level=info msg="run .har file: test\\golang.org
.har"
[GET,200] URL: https://golang.org/
[GET,200] URL: https://fonts.googleapis.com/css?family=Work+Sans:600|Roboto:400,
700
[GET,200] URL: https://golang.org/lib/godoc/style.css
[GET,200] URL: https://golang.org/lib/godoc/jquery.js
[GET,200] URL: https://fonts.googleapis.com/css?family=Product+Sans&text=Support
ed%20by%20Google&display=swap
[GET,200] URL: https://golang.org/lib/godoc/images/footer-gopher.jpg
[GET,200] URL: https://golang.org/lib/godoc/playground.js
[GET,200] URL: https://golang.org/lib/godoc/godocs.js
[GET,200] URL: https://golang.org/lib/godoc/images/go-logo-blue.svg
[GET,200] URL: https://golang.org/lib/godoc/images/cloud-download.svg
[GET,200] URL: https://golang.org/lib/godoc/images/home-gopher.png
[GET,200] URL: https://golang.org/lib/godoc/images/play-link.svg
[GET,200] URL: https://www.youtube.com/embed/cQ7STILAS0M
...
$headers =
@{
"accept"="application/json"
"User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
"Sec-Fetch-Site"="same-origin"
"Sec-Fetch-Mode"="cors"
"Sec-Fetch-Dest"="empty"
"Referer"="https://api.wigle.net/swagger"
"Accept-Encoding"="gzip, deflate, br"
"Accept-Language"="fr-FR,fr;q=0.9,ru-RU;q=0.8,ru;q=0.7,en-US;q=0.6,en;q=0.5"
"Cookie"="__ssid=93e6b9ecb065c442db3a58bb80774c7; auth=qwerty%3A730040346%3A1608316483%3ATA84tmYcjHFxRp7uV5RUXQ"
}
Invoke-WebRequest -Uri "https://api.wigle.net/api/v2/network/detail?
netid=80%3ADA%3A13%3A01%3A1D%3AB3" -Headers $headers
Invoke-WebRequest : Not Authorized
sergueik@sergueik71:~/src/springboot_study/hargo$
docker run --rm --name hargo -it -v $(pwd)/tmp/test:/test basic-hargo hargo run /test/golang.org.har
INFO[0000] run .har file: /test/golang.org.har
[GET,200] URL: https://golang.org/
[GET,200] URL: https://fonts.googleapis.com/css?family=Work+Sans:600|Roboto:400,700
[GET,200] URL: https://golang.org/lib/godoc/style.css
[GET,200] URL: https://golang.org/lib/godoc/jquery.js
[GET,200] URL: https://fonts.googleapis.com/css?family=Product+Sans&text=Supported%20by%20Google&display=swap
[GET,200] URL: https://golang.org/lib/godoc/images/footer-gopher.jpg
[GET,200] URL: https://golang.org/lib/godoc/playground.js
[GET,200] URL: https://golang.org/lib/godoc/godocs.js
[GET,200] URL: https://golang.org/lib/godoc/images/go-logo-blue.svg
[GET,200] URL: https://golang.org/lib/godoc/images/cloud-download.svg
[GET,200] URL: https://golang.org/lib/godoc/images/home-gopher.png
[GET,200] URL: https://golang.org/lib/godoc/images/play-link.svg
[GET,200] URL: https://www.youtube.com/embed/cQ7STILAS0M
[GET,200] URL: https://fonts.gstatic.com/s/worksans/v5/QGYpz_wNahGAdqQ43Rh3o4T8mNhNy_r-Kw.woff2
[GET,200] URL: https://ssl.google-analytics.com/ga.js
[GET,200] URL: https://fonts.gstatic.com/l/font?kit=pxiDypQkot1TnFhsFMOfGShlFd2JQEl2pE7v9ZAr7BbFrlEMpMTt&skey=b7d9d887ed217aec&v=v10
[GET,200] URL: https://blog.golang.org/.json?jsonp=feedLoaded&_=1567424947760
[GET,200] URL: https://ssl.google-analytics.com/r/__utm.gif?utmwv=5.7.2&utms=1&utmn=1256598427&utmhn=golang.org&utmcs=UTF-8&utmsr=1920x1080&utmvp=1905x417&utmsc=24-bit&utmul=en-us&utmje=0&utmfl=-&utmdt=The%20Go%20Programming%20Language&utmhid=824022456&utmr=-&utmp=%2F&utmht=1567424948526&utmac=UA-11222381-2&utmcc=__utma%3D110886291.1318786886.1567424948.1567424948.1567424948.1%3B%2B__utmz%3D110886291.1567424948.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmjid=912966273&utmredir=1&utmu=qACAAAAAAAAAAAAAAAAAAAAE~
[GET,200] URL: https://www.youtube.com/yts/cssbin/www-player-webp-vflVj-aXG.css
[GET,200] URL: https://www.youtube.com/yts/jsbin/www-embed-player-vflljwD9V/www-embed-player.js
[GET,200] URL: https://www.youtube.com/yts/jsbin/player_ias-vflt4leIo/en_US/base.js
[GET,200] URL: https://googleads.g.doubleclick.net/pagead/id
[GET,200] URL: https://www.google.com/js/bg/3-hpRAd0_wuB6laQqaJG0uu5agxtfADTbxmN8ntEYS8.js
[GET,200] URL: https://static.doubleclick.net/instream/ad_status.js
[GET,200] URL: https://stats.g.doubleclick.net/r/collect?v=1&aip=1&t=dc&_r=3&tid=UA-11222381-2&cid=1318786886.1567424948&jid=912966273&_v=5.7.2&z=1256598427
[GET,200] URL: https://www.youtube.com/yts/jsbin/player_ias-vflt4leIo/en_US/remote.js
[GET,200] URL: https://googleads.g.doubleclick.net/pagead/id?slf_rd=1
[GET,200] URL: https://yt3.ggpht.com/-8qdO4Xl6jAU/AAAAAAAAAAI/AAAAAAAAAAA/ngjQPxBLXjk/s68-c-k-no-mo-rj-c0xffffff/photo.jpg
[GET,404] URL: https://i.ytimg.com/vi/cQ7STILAS0M/sddefault.jpg
[GET,204] URL: https://www.youtube.com/generate_204?i9yLwg
[GET,200] URL: https://golang.org/favicon.ico