This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")>Out-Null | |
Add-Type -AssemblyName PresentationCore | |
$Clipboard=[Windows.Clipboard]::GetText() | |
$Clipboard = $Clipboard -Replace '"', "" | |
#[System.Windows.Forms.MessageBox]::Show("Clipboard: " + $Clipboard) | |
$Pattern = "^[a-z]:\\[a-z\\_\s0-9\(\)]*\.exe" | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")>Out-Null | |
Add-Type -AssemblyName system.Windows.Forms | |
#Если буфер обмена соответсвует шаблону, то не открываем диалоговое окно | |
If ($Clipboard -imatch $Pattern) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1) Итак сначала читаем с клавиатуры название проекта | |
$ProjectName=Read-Host -Prompt 'Input project name' | |
#... описание проекта | |
$Description=Read-Host -Prompt 'Input project description' | |
#Cоздадим репозиторий | |
$AccessToken = '1' #Generated by github settings! | |
#Сервеная сторона | |
#Когда пользователь хочет отправить the server authentication credentials it may use the Authorization field. | |
# | |
#The Authorization field is constructed as follows: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Перезапустить скрипт/консоль как администартор с параметрами | |
if(-not([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) | |
{ | |
$Arguments = "& '" + $MyInvocation.MyCommand.Definition + "'" | |
Start-Process powershell -Verb RunAs -ArgumentList $Arguments | |
Break | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I am defining website url in a variable | |
$url = "http://checkip.dyndns.com" | |
# Creating a new .Net Object names a System.Net.Webclient | |
$webclient = New-Object System.Net.WebClient | |
# In this new webdownlader object we are telling $webclient to download the | |
# url $url | |
$Ip = $webclient.DownloadString($url) | |
# Just a simple text manuplation to get the ipadress form downloaded URL | |
# If you want to know what it contain try to see the variable $Ip | |
$Ip2 = $Ip.ToString() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main formula Math.floor(Math.random() * (max - min + 1)) + min; | |
function randomInt(min,max) { | |
return Math.floor(Math.random() * (max - min + min)) + min; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The map method is a convenient way to iterate through arrays. Here's an example usage: | |
var timesFour = oldArray.map(function(val){ | |
return val * 4; | |
}); | |
//The map method will iterate through every element of the array, creating a new array with values that have been modified by the callback function, and return it. Note that it does not modify the original array. | |
//In our example the callback only uses the value of the array element (the val argument) but your callback can also include arguments for the index and array being acted on. | |
//Use the map function to add 3 to every value in the variable oldArray, and save the results into variable newArray. oldArray should not change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$apiKey = "" #access key сopy pase from rest api provider | |
$uri = "https://andruxnet-random-famous-quotes.p.mashape.com/?cat=movies" #uri of rest api provider | |
Invoke-RestMethod -Method Get -Uri $uri -Header @{ "X-Mashape-Key" = $apiKey } |
OlderNewer