Skip to content

Instantly share code, notes, and snippets.

View AndreyBespamyatnov's full-sized avatar
🏠
Working from home

Andrei Bespamiatnov AndreyBespamyatnov

🏠
Working from home
View GitHub Profile
@AndreyBespamyatnov
AndreyBespamyatnov / .gitlab-ci.yml
Created October 25, 2018 07:44 — forked from zerda/.gitlab-ci.yml
Gitlab CI for ASP.Net Core project
stages:
- build
- publish
.build: &build_template
stage: build
image: microsoft/dotnet:2.1-sdk-alpine
cache:
key: "$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME"
paths:
@AndreyBespamyatnov
AndreyBespamyatnov / readme.txt
Created April 9, 2018 12:47
Editing Setup ELK Stack on Ubuntu
Elasticsearch is an enterprise level open source search server based on Apache Lucene, offers a real-time distributed search and analytics with a RESTful web interface and schema-free JSON documents. Elasticsearch is developed in java and is released under Apache License. Currently, it is ranked second in most popular enterprise search engine, behind Apache Solr.
This guide will help you to install the Elasticsearch on Ubuntu
== Prerequisites ==
Make sure you have the latest JDK installed on your system. If you don't have setup it:
<syntaxhighlight lang="bash">
sudo apt-get remove --purge openjdk*
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
@AndreyBespamyatnov
AndreyBespamyatnov / app.config
Created April 9, 2018 10:57 — forked from grenade/app.config
Emit log4net entries to logstash over UDP in near-realtime
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
@AndreyBespamyatnov
AndreyBespamyatnov / app.config
Created April 9, 2018 10:57 — forked from grenade/app.config
Emit log4net entries to logstash over UDP in near-realtime
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<log4net>
<appender name="UdpAppender" type="log4net.Appender.UdpAppender">
-- a- list of clients, which have an order with order_sum > 50
select c.client_id, c.client_name from Clients as c
inner join Orders as o on o.client_id = c.client_id
where o.order_sum > 50
-- b- clients, whose total sum of orders exceeds 100
Select * from
(select c.client_id, c.client_name, SUM(o.order_sum) as total from Clients as c
inner join Orders as o on o.client_id = c.client_id
GROUP BY c.client_id) as t
private static bool CompareIterative(BTN n1, BTN n2)
{
// check for nulls
if (n1 == null || n2 == null)
{
return n1 == n2;
}
var q1 = new Queue<BTN>();
var q2 = new Queue<BTN>();
1) we will be create new array, lenght = max floor
2) we will add to index (if exist by number of floow) value of person time
3) read array from right to left
4) in cicle (current index of cicle as "floow")
4.1) if current vlue == 0, then incriminate result and continue
4.2) if it is firs floow, maybe we need to wite, add current value and continue
4.3) if curent value GREAT that result, then add value by formula (result = curent value - result)
4.4) otherwise/else, just incriminate result
that it)
public interface IQueue<T>
{
void Enqueue(T value);
T Dequeue();
}
public class StackQueue<T> : IQueue<T>
{
private readonly Stack<T> _stack1 = new Stack<T>();
// You've got an array of ints 2,2,3,3,4,5,5... Find an element without a pair.
class Program
{
static void Main(string[] args)
{
var array = new int[] {2, 2, 3, 3, 4, 5, 5, 6, 9};
var array2 = new int[array.Length];
for (int index = 0; index < array.Length; index++)
{
// You've got an array of ints 2,2,3,3,4,5,5... Find an element without a pair.
class Program
{
static void Main(string[] args)
{
var array = new int[] {2, 2, 3, 3, 4, 5, 5};
var array2 = new int[array.Length];
foreach (var a in array)
{