import javax.validation.Valid;
@RestController
public class MainController
{
@PostMapping("/proxy/add")
public void saveProxy(@Valid @RequestBody ProxyDto dto) {
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
@RestController
@RequestMapping("/proxy")
public class MainController
{
@RequestMapping(value = "add", method = RequestMethod.POST)
public Map<String, Object> addBook(@Validated @RequestBody ProxyDto dto ) {
....
и import javax.validation.constraints.NotNull;
public class ProxyDto {
@NotNull(message = "idbn is missing")
@NotEmpty(message = "idbn is empty")
private String proxy;
{
"timestamp": 1612029070201,
"status": 400,
"error": "Bad Request",
"exception": "org.springframework.web.bind.MethodArgumentNotValidException",
"errors": [
{
"codes": [
"NotNull.book.isbn",
"NotNull.isbn",
"NotNull.java.lang.String",
"NotNull"
],
"arguments": [
{
"codes": [
"book.isbn",
"isbn"
],
"arguments": null,
"defaultMessage": "isbn",
"code": "isbn"
}
],
"defaultMessage": "idbn is missing",
"objectName": "book",
"field": "isbn",
"rejectedValue": null,
"bindingFailure": false,
"code": "NotNull"
},
{
"codes": [
"NotEmpty.book.isbn",
"NotEmpty.isbn",
"NotEmpty.java.lang.String",
"NotEmpty"
],
"arguments": [
{
"codes": [
"book.isbn",
"isbn"
],
"arguments": null,
"defaultMessage": "isbn",
"code": "isbn"
}
],
"defaultMessage": "idbn is empty",
"objectName": "book",
"field": "isbn",
"rejectedValue": null,
"bindingFailure": false,
"code": "NotEmpty"
}
],
"message": "Validation failed for object='book'. Error count: 2",
"path": "/book/add"
}
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
require 'pp'
basedir = ENV.fetch('USERPROFILE', '')
basedir = ENV.fetch('HOME', '') if basedir == ''
basedir = basedir.gsub('\\', '/')
dir = File.expand_path(File.dirname(__FILE__))
box_hostname = ENV.fetch('BOX_HOSTNAME', 'alpine')
box_name = ENV.fetch('BOX_NAME', 'generic/alpine38')
box_version = ENV.fetch('BOX_VERSION', '3.1.20' ) # 3.1.22
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = box_name # box_hostname
config.vm.hostname = box_hostname
config.vm.box_version = box_version # v3.1.20
config.ssh.forward_agent = true
config.vm.boot_timeout = 600
config.vm.synced_folder './', '/vagrant'
if ! Vagrant.has_plugin?('vagrant-alpine')
# TODO: raise an error
end
if Vagrant.has_plugin?('vagrant-vbguest')
config.vbguest.auto_update = false
end
config.vm.provision "shell", inline: <<-SHELL
apk update && apk upgrade
SHELL
end
vagrant up
# default: Downloading: https://vagrantcloud.com/generic/boxes/alpine38/versions/3.1.20/providers/virtualbox.box
export BOX_VERSION=3.1.18
vagrant stop ; vagrant destroy -f ; vagrant up
# default: Downloading: https://vagrantcloud.com/generic/boxes/alpine38/versions/3.1.18/providers/virtualbox.box
export BOX_VERSION=3.1.99
vagrant up
The box you're attempting to add has no available version that
matches the constraints you requested. Please double-check your
settings. Also verify that if you specified version constraints,
that the provider you wish to use is available for these constraints.
Box: generic/alpine38
Address: https://vagrantcloud.com/generic/alpine38
Constraints: 3.1.99
Available versions: 1.6.24, 1.6.26, 1.8.0, 1.8.1, 1.8.2, 1.8.4, 1.8.7, 1.8.8, 1.8.9, 1.8.12, 1.8.13, 1.8.14, 1.8.24, 1.8.26, 1.8.27, 1.8.28, 1.8.32, 1.8.38, 1.8.40, 1.8.48, 1.8.50, 1.8.52, 1.8.54, 1.8.56, 1.8.58, 1.8.60, 1.9.2, 1.9.4, 1.9.6, 1.9.8, 1.9.10, 1.9.12, 1.9.14, 1.9.16, 1.9.18, 1.9.19, 1.9.20, 1.9.22, 1.9.24, 1.9.26, 1.9.28, 1.9.30, 1.9.32, 1.9.34, 1.9.36, 1.9.38, 1.9.40, 2.0.0, 2.0.2, 2.0.4, 2.0.6, 3.0.0, 3.0.1, 3.0.2, 3.0.4, 3.0.6, 3.0.8, 3.0.10, 3.0.12, 3.0.14, 3.0.16, 3.0.18, 3.0.20, 3.0.22, 3.0.24, 3.0.26, 3.0.28, 3.0.30, 3.0.32, 3.0.34, 3.0.36, 3.0.38, 3
vagrant box list
generic/alpine38 (virtualbox, 3.1.18)
generic/alpine38 (virtualbox, 3.1.20)
vagrant box remove generic/alpine38 --box-version 3.1.20
Makefile
для make (так же как build.xml
для ant pom.xml
для maven build.gradle
для gradle и т.д.)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).
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
RUN go build -ldflags "-s -w -X main.Version=$VERSION -X main.CommitHash=$HASH -X 'main.CompileDate=$DATE'" -o hargo ./cmd/hargo
check.cmd
@echo OFF
REM https://qna.habr.com/q/898855
SETLOCAL ENABLEDELAYEDEXPANSION
SET delta=%1
IF "%delta%"=="" SET delta=-3
FOR /f %%. IN ('cscript.exe /nologo add_days.js !delta!') DO SET CHECK_DATE=%%.
ECHO FORFILES /p . /s /m *.* /d !CHECK_DATE! /c "cmd /c echo @FILE"
FORFILES /p . /s /m *.* /d !CHECK_DATE! /c "cmd /c echo @FILE" 2>NUL 1>NUL
IF errorlevel 1 ECHO Skip Purge && GOTO :EOF
echo Call purge
GOTO :EOF
add_date.js
var days=parseInt(WScript.Arguments.Item(0));
Date.prototype.addDays = function(days) { var date = new Date(this.valueOf()); date.setDate(date.getDate() + days); return date; }
var o = (new Date()).addDays(days);
WScript.Echo((1 + o.getMonth()) + '/' + o.getDate() + '/' + o.getFullYear());
%CATALINA_HOME%\conf
C:\java\apache-tomcat-8.5.45\conf\server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
...
bin
есть команды shutdown.bat
и shutdown.sh
Directory of C:\java\apache-tomcat-8.5.45\bin
09/01/2019 01:38 PM 2,020 shutdown.bat
09/01/2019 01:38 PM 1,902 shutdown.sh
dir
Directory of C:\Users\Serguei\AppData\Local\Temp\xxx
11/18/2020 09:46 AM <DIR> .
11/18/2020 09:46 AM <DIR> ..
11/18/2020 09:46 AM 0 BCJ-042102_1.jpg
11/18/2020 09:46 AM 0 BCJ-042102_2.jpg
11/18/2020 09:46 AM 0 BCJ-042102_3.jpg
11/18/2020 09:46 AM 0 BLN-021301_2.jpg
11/18/2020 09:46 AM 0 BLN-021301_3.jpg
11/18/2020 09:46 AM 0 DZPB-049001_1.jpg
11/18/2020 09:46 AM 0 DZPB-049001_2.jpg
11/18/2020 09:46 AM 0 DZPB-049001_4.jpg
8 File(s) 0 bytes
for /F %. in ('dir /b *.*') ; do mkdir %~n. && move /y %. %~n.
dir
Directory of C:\Users\Serguei\AppData\Local\Temp\xxx
1/18/2020 09:47 AM <DIR> .
1/18/2020 09:47 AM <DIR> ..
1/18/2020 09:47 AM <DIR> BCJ-042102_1
1/18/2020 09:47 AM <DIR> BCJ-042102_2
1/18/2020 09:47 AM <DIR> BCJ-042102_3
1/18/2020 09:47 AM <DIR> BLN-021301_2
1/18/2020 09:47 AM <DIR> BLN-021301_3
1/18/2020 09:47 AM <DIR> DZPB-049001_1
1/18/2020 09:47 AM <DIR> DZPB-049001_2
1/18/2020 09:47 AM <DIR> DZPB-049001_4
0 File(s) 0 bytes
C:\Users\Serguei\AppData\Local\Temp\xxx\BCJ-042102_1\BCJ-042102_1.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\BCJ-042102_2\BCJ-042102_2.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\BCJ-042102_3\BCJ-042102_3.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\BLN-021301_2\BLN-021301_2.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\BLN-021301_3\BLN-021301_3.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\DZPB-049001_1\DZPB-049001_1.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\DZPB-049001_2\DZPB-049001_2.jpg
C:\Users\Serguei\AppData\Local\Temp\xxx\DZPB-049001_4\DZPB-049001_4.jpg
#!/bin/bash
FILE="/tmp/file2.txt"
B='var arrIm = ['
L=$(cat $FILE | sed -e "s/\\(..*\\)/'\\1'/g" | sed -e 's|C:\\Users\\SEN\\Desktop\\777\\|https://ohiyo.ru/uploads/posts/|g')
E="
];"
echo "$B$L$E"
cat $FILE
C:\Users\SEN\Desktop\777\XXX.TXT
./a.sh
var arrIm = ['https://ohiyo.ru/uploads/posts/XXX.TXT'
];