Skip to content

Instantly share code, notes, and snippets.

View cpoDesign's full-sized avatar

Pavel cpoDesign

View GitHub Profile
@cpoDesign
cpoDesign / ForceRequestToSpecificIPandPort.cs
Created June 1, 2018 10:07
Force request to specific IP address and port
string sendingIp = "192.168.0.1";
int sendingPort = 5000;
Uri uri = new Uri("http://google.com");
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(uri);
ServicePoint sp = ServicePointManager.FindServicePoint(uri);
sp.BindIPEndPointDelegate =
(servicePoint,remoteEp,retryCount) =>
{
return new IPEndPoint(IPAddress.Parse(sendingIp),sendingPort);
};
@cpoDesign
cpoDesign / PublishBuildArtifacts.yaml
Last active May 30, 2018 11:38
Break apart powershell arguments dynamically
steps:
- task: PublishBuildArtifacts@1
displayName: Publish Artifact: DynamicPowerShellArguments
inputs:
PathtoPublish: test.ps1
ArtifactName: DynamicPowerShellArguments
publishLocation: Container
@cpoDesign
cpoDesign / tester.exe.config
Created April 27, 2018 06:57
Sample for configuration string
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<connectionStrings>
<add name="ConnectionStringUnderTest" connectionString="Data Source=localhost;Initial Catalog=MyDatabaseCatalogToReplace;Integrated Security=True" />
</connectionStrings>
<appSettings>
<add key="CommandTimeOut" value="90"/>
@cpoDesign
cpoDesign / cntlm.ini
Created April 20, 2018 12:13
CNTLM configuration ini file
Username user
Domain domain
# provide actual value if autodetection fails
# Workstation pc-name
Proxy my_proxy_server.com:80
NoProxy 127.0.0.*, 192.168.*
Listen 127.0.0.1:54321
@cpoDesign
cpoDesign / SQL2016DropIFExistsNew.sql
Last active January 23, 2018 17:01
SQL 2016 new way of checking if exists
DROP TABLE IF EXISTS dbo.Product
DROP TRIGGER IF EXISTS trProductInsert
DROP PROCEDURE IF EXISTS [dbo].[InsertData]
@cpoDesign
cpoDesign / SQLDropIFExistsOld.sql
Created January 17, 2018 21:33
Old way of checking if item exists before drop
IF EXISTS(SELECT 1 FROM sys.objects AS O WHERE O.name = 'Product' AND O.[type] = 'U')
BEGIN
    DROP TABLE [SomeTable]
END
 
IF OBJECT_ID('dbo.Product', 'U') IS NOT NULL
BEGIN
DROP TABLE dbo.Product;
END
@cpoDesign
cpoDesign / PSExecution.cs
Last active January 17, 2018 21:46
Example how to run powershell in .net 4.7 from C#
namespace Web.Controllers
{
public class PSExecution
{
public PSCommand PSCommand{get;set;}
public string Output{get; private set;}
public void SetOutput(string output){
this.Output = output;
}
public async Task<IHttpActionResult> MethodB()
{
var customer = new Customer();
var getAllWidgetsTask = _widgetService.GetAllWidgets();
var getAllFoosTask = _fooService.GetAllFos();
Task.WaitAll(new List[] {getAllWidgetsTask, getAllFoosTask});
customer.Widgets = getAllWidgetsTask.Result;
if (_angular_core.ɵglobal['Node']) {
nodeContains = _angular_core.ɵglobal['Node'].prototype.contains || function (node) {
return !!(this.compareDocumentPosition(node) & 16);
};
}
Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Prerendering failed because of error: TypeError: Cannot read property 'Node' of undefined
at module.exports.d.(anonymous function) (netcore2AppPath\ClientApp\dist\vendor.js:26869:26)
at module.exports.Object.setPrototypeOf.__proto__ (netcore2AppPath\ClientApp\dist\vendor.js:25890:10)
at Object.module.exports.d.(anonymous function) (netcore2AppPath\ClientApp\dist\vendor.js:25893:2)
at __webpack_require__ (netcore2AppPath\ClientApp\dist\vendor.js:21:30)
at Object.define.function.define.amd.global.ng (netcore2AppPath\ClientApp\dist\main-server.js:8019:42)
at __webpack_require__ (netcore2AppPath\ClientApp\dist\main-server.js:20:30)
at Object.setPrototypeOf.__proto__ (netcore2AppPath\ClientApp\dist\main-server.js:8031:51)
at Object.define.function.define.amd.global.ng (netcore2AppPath\ClientApp\dist\main-server.js:8034:2)