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. ssh-keygen - generate public key | |
2. copy it from C:\Users\{user}\.ssh id_rsa.pub and paste to | |
https://scm.2c2p.com/plugins/servlet/ssh/account/keys (or other place) | |
3. ssh-agent (runs ssh agent, Powershell: Set-Service ssh-agent -StartupType Automatic to run it automatically after start) | |
4. ssh-add (or put to C:\Program Files\Git\etc\ssh\ssh_config to the end of the file: IdentityFile C:\Users\zxsanny\.ssh\id_rsa) |
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
TimeSpan PerformanceTest(Action action, int repeats) | |
{ | |
var sw = new Stopwatch(); | |
sw.Start(); | |
for (int i = 0; i < repeats; i++) | |
action(); | |
sw.Stop(); | |
return sw.Elapsed; | |
} | |
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
sudo apt install terminator git -y | |
git clone https://github.com/zxsanny/linux-init-install.git | |
linux-init-install/install.sh |
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
set @token = 'OrderBy'; | |
SELECT * | |
FROM | |
( | |
SELECT replace( substring(settings, position(@token in settings) + length(@token) + 2, | |
locate(',', settings, position(@token in settings) + length(@token) + 2) - (position(@token in settings) + length(@token) + 2)), | |
'"','') as field | |
FROM widgets | |
) t | |
WHERE t.field != 'null'; |
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
function zxdiff(arr, arrDiff, propFn) { | |
var hash = []; | |
for (var x = 0; x < arrDiff.length; x++) { | |
hash[propFn(arrDiff[x])] = true; | |
} | |
var res = []; | |
for (var i = 0; i < arr.length; i++) { | |
if (!hash[ propFn(arr[i]) ]) { | |
res.push(arr[i]); |
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
(New-Object System.Net.WebClient).DownloadFile("http://link.exe", "D:\Downloads\file.exe") |
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
var data = JsonConvert.SerializeObject(message, Formatting.None, new JsonSerializerSettings | |
{ | |
ContractResolver = new ExcludePropertiesContractResolver(new []{"SuccessMessage", "ErrorMessage"}) | |
}); | |
public class ExcludePropertiesContractResolver : DefaultContractResolver | |
{ | |
private readonly List<string> ExcludedProperties; |
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 class EqualityComparerFactory | |
{ | |
private sealed class Impl<T> : IEqualityComparer<T> | |
{ | |
private readonly Func<T, T, bool> Eq; | |
private readonly Func<T, int> HashFunc; | |
public Impl(Func<T, T, bool> eq, Func<T, int> hashFunc) | |
{ | |
Eq = eq; | |
HashFunc = hashFunc; |