Skip to content

Instantly share code, notes, and snippets.

View cpoDesign's full-sized avatar

Pavel cpoDesign

View GitHub Profile
{
"openapi": "3.0.1",
"info": {
"title": "Auction API",
"description": "This ASP.NET Core Web API is used for getting Auction information.",
"contact": {
"name": "ALP Team"
},
"license": {
"name": "Christies"
# GitHub Basic Commands
GitHub is an essential tool for version control and collaboration. In this article, we will cover some basic commands to get you started with GitHub. These include configuring your username and user email, getting data from a repository, and committing changes.
## Configuring Username and User Email
Before you start using Git, you need to configure your username and user email. This information will be associated with your commits.
```bash
# Set your username
DOD (Definition of Done)
- code is ready
- code has unit tests
- code has integration tests
- applied SOLID
Documnetation
- documentation is procudes
@cpoDesign
cpoDesign / searchForIndexByTableAndIndexName.sql
Created February 26, 2019 08:36
Find an index with a specific name
select * from sys.tables as t
inner join sys.columns as c
on t.object_id = c.object_id
inner join sys.index_columns as ic
on c.column_id = ic.column_id and c.object_id = ic.object_id
inner join sys.indexes as i
on ic.index_id = i.index_id and ic.object_id = i.object_id
WHERE t.name = 'table_name' AND i.name = 'index_name'
-- where t.name = 'table_name' and c.name = 'column_name'
public partial class ApiClient
{
private readonly HttpClient _httpClient;
private Uri BaseEndpoint { get; set; }
public ApiClient(Uri baseEndpoint)
{
if (baseEndpoint == null)
{
@cpoDesign
cpoDesign / project.nuspec
Created September 8, 2018 22:14
Project setup for .net core showing how nuspec will get updated as part of a build
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>project</id>
<version>0.0.1</version>
<authors>authors</authors>
<owners>Owners</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>package desciptions</description>
</metadata>
@cpoDesign
cpoDesign / gist:26482f97e2dc8e35625bcd7b08cafb54
Created August 16, 2018 07:39
How to get client list with all auth. keys to be served to a list of services. using token for authentication. This presents how-ever security risk as all active configuration is presented at once.
/// <summary>
/// used to provide definition for gateway service about active keys for clients, to about active client configuration
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet]
public IActionResult GetClientList(string token)
{
if (ValidateToken(token))
{
@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"/>