[TestMethod]
public void Test() => Assert.IsTrue(FindDifference(new[]{ 1, 2, 3 }, new []{2,4,6}) is [[1,3], [4,6]]);
public IList<ILis<int>> FindDifference(int[] nums1, int[] nums2)
{
var s1 = new HashSet<int>();
var s2 = new HashSet<int>();
var set1 = new HashSet<int>(nums1);
var set2 = new HashSet<int>(nums2);
foreach (var n2 in nums2)
if(!set1.Contains(n2)) s2.Add(n2);
foreach (var n1 in nums1)
if(!set2.Contains(n1)) s1.Add(n1);
return new List<IList<int>> { s1.ToList(), s2.ToList() };
}
Kuebiko
More a diary than a blog. Move along nothing to see here.
Wednesday, May 3, 2023
Is expression pattern matching for list of lists
Tuesday, March 28, 2023
Friday, January 13, 2023
Saturday, December 31, 2022
Saturday, September 25, 2021
alias for git commands
To combine add and commit it is easy to create an alias:
now in command line instead of running
you can run
git config --global alias.ac "commit am"
now in command line instead of running
git commit -am "this is my commit"
you can run
git ac "this is my commit"
Monday, July 19, 2021
Generating pfx file with multiple certificates.
One pfx file can have multiple certificates inside it. In order to create such file, the easiest way is to copy paste all the *.crt files into one file so the file content will be similar to this one:
This is just an example, the certificate section for each certificate will be larger. Let's call such file bundle.crt<\i>. In order to sign it we need a key - key is just a file with a content similar to the *.crt file - some people call it pem files. Generally speaking *.crt, *.pem, *.cert are files that have this same content in this same format, the only difference is just a file extension. To create a pfx file we need an openssl application. You can get the windows binaries from here: ssl binaries. I used the openssl-1.0.2r-x64_86-win64.zip.
To generate pfx I run:
You will need to provide a password for this key and retype it.
If you want to see what is inside pfx you can run:
certutil is a tool that is by default installed on Windows machine. If you have openssl installed you can run:
You need the password in order to run these commands.
-----BEGIN CERTIFICATE----- MA0GCSqGSIb3DQEBCwUAA4IBAQAIfmyTEMg4uJapkEv/oV9PBO9sPpyIBslQj6Zz 91cxG7685C/b+LrTW+C05+Z5Yg4MotdqY3MxtfWoSKQ7CC2iXZDXtHwlTxFWMMS2 RJ17LJ3lXubvDGGqv+QqG+6EnriDfcFDzkSnE3ANkR/0yBOtg2DZ2HKocyQetawi DsoXiWJYRBuriSUBAA/NxBti21G00w9RKpv0vHP8ds42pM3Z2Czqrpv1KrKQ0U11 GIo/ikGQI31bS/6kA1ibRrLDYGCD+H1QQc7CoZDDu+8CL9IVVO5EFdkKrqeKM+2x LXY2JtwE65/3YR8V3Idv7kaWKK2hJn0KCacuBKONvPi8BDDD -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- GGGEfTCCA2WgAwIBAgIDG+cVMA0GCSqGSIb3DQEBCwUAMGMxCzAJBgNVBAYTAlVT MSEwHwYDVQQKExhUaGUgR28gRGFkZHkgR3JvdXAsIEluYy4xMTAvBgNVBAsTKEdv IERhZGR5IENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMTAx MDcwMDAwWhcNMzEwNTMwMDcwMDAwWjCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- AAAEfTCCA2WgAwIBAgIDG+cVMA0GCSqGSIb3DQEBCwUAMGMxCzAJBgNVBAYTAlVT MSEwHwYDVQQKExhUaGUgR28gRGFkZHkgR3JvdXAsIEluYy4xMTAvBgNVBAsTKEdv IERhZGR5IENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTQwMTAx MDcwMDAwWhcNMzEwNTMwMDcwMDAwWjCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBZZZ -----END CERTIFICATE-----
This is just an example, the certificate section for each certificate will be larger. Let's call such file bundle.crt<\i>. In order to sign it we need a key - key is just a file with a content similar to the *.crt file - some people call it pem files. Generally speaking *.crt, *.pem, *.cert are files that have this same content in this same format, the only difference is just a file extension. To create a pfx file we need an openssl application. You can get the windows binaries from here: ssl binaries. I used the openssl-1.0.2r-x64_86-win64.zip.
To generate pfx I run:
openssl pkcs12 -export -out Private.pfx -inkey C:\cert.key -in C:\bundle.crt
You will need to provide a password for this key and retype it.
If you want to see what is inside pfx you can run:
certutil -dump Private.pfx
certutil is a tool that is by default installed on Windows machine. If you have openssl installed you can run:
openssl pkcs12 -info -in Private.pfx
You need the password in order to run these commands.
Tuesday, November 17, 2020
Check password policy in AD
You need to install first Active Directory Powershell cmdlets on Windows 10. This cmdlets alloweds a user to check the policy.
With a cmdlets you can call
Get-WindowsCapability -Online | Where-Object {$_.Name -like "*ActiveDirectory.DS-LDS*"} | Add-WindowsCapability -Online
With a cmdlets you can call
get-addomain | get-adobject -properties * | select *pwd*
Subscribe to:
Posts (Atom)