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
[Cmdlet(VerbsData.Export, "AsQrCode")] | |
public class ExportAsQrCode : PSCmdlet, IDynamicParameters | |
{ | |
private static RuntimeDefinedParameterDictionary _staticStroage; | |
public object GetDynamicParameters() | |
{ | |
IEnumerable<string> brushes = typeof (Brushes).GetProperties().Select(x => x.Name); | |
var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary(); |
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
string stderr; | |
string stdout; | |
string url="\"https://api.telegram.org/bot[API_KEY]/sendMessage?chat_id=-[CHATID]&text=HomeMatic: Haustuer wurde geoeffnet!\""; | |
system.Exec("wget --no-check-certificate -q -O - "#url, &stdout, &stderr); |
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
public static byte[] ExtractResource(string filename) | |
{ | |
var assembly = Assembly.GetExecutingAssembly(); | |
var name = assembly.GetManifestResourceNames().Single(s => s.EndsWith(filename)); | |
var stream = assembly.GetManifestResourceStream(name); | |
var ms = new MemoryStream(); | |
stream.CopyTo(ms); |
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
using System; | |
using System.IO; | |
using System.Linq; | |
namespace CreateRandomData | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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
$serverName = "example.org" | |
$url = 'https://raw.githubusercontent.com/rbsec/dnscan/master/subdomains-10000.txt' | |
$subdomains = ((Invoke-WebRequest -Uri $url -UseBasicParsing).Content).Split("`n") | |
$subdomainsCount = $subdomains.Length | |
Write-Host ('Will test {0} entries' -f $subdomainsCount) | |
$count = 1 |
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
<# | |
.SYNOPSIS | |
Test the response of a computer to a specific TCP port | |
.DESCRIPTION | |
Test the response of a computer to a specific TCP port | |
.PARAMETER ComputerName | |
Name of the computer to test the response for |
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
gci C:\inetpub\logs\LogFiles | # Get all sites | |
%{ gci $_.FullName | Sort-Object LastWriteTime | select -Last 1 } | # Get the last log file from each site | |
?{$_.LastWriteTime -gt (Get-Date).Date} | # only files from today | |
Get-Content -Tail 5 | # get the last lines | |
Select-String -Pattern 'POST' | # only method POST | |
Sort-Object # sort ASC |
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
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Security.Cryptography; | |
using System.Text; | |
using NUnit.Framework; | |
using ProtoBuf; | |
namespace EncryptionSample | |
{ |
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
void Main() | |
{ | |
{ // 0. Create a HMAC | |
byte[] keyHmac = new byte[] { 255 }; | |
var hmac = new HMACSHA512(keyHmac); // 1st HMACSHA512 ctor | |
var result = hmac.ComputeHash(new byte[] { 1, 2, 3 }); | |
Console.Out.WriteLine($"0. - {Convert.ToBase64String(result)}"); | |
} | |
Console.Out.WriteLine("\r\nThe following MACs should be all equal!\r\n"); |
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
$pathOld = 'C:\Users\user\Documents\old.ics' | |
$pathNew = 'C:\Users\user\Documents\new.ics' | |
(Get-Content $pathOld -Encoding UTF8) | | |
% {$_ -replace '^UID:.{36}', ("UID:{0}" -f ([System.Guid]::NewGuid().ToString())) } | | |
Out-File $pathNew -Encoding utf8 |
OlderNewer