Skip to content

Instantly share code, notes, and snippets.

View divyang4481's full-sized avatar

Divyang Panchasara divyang4481

View GitHub Profile
<div class='container'>
<h1>SASS - Mixins</h1>
<h2><span>Basic</span> - Getting Started</h2>
<p id='mypara'>Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor <br>
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi</p>
------------------------------
Steps
------------------------------
1. Create new text file named "HYPER-V Package Installer" (or whatever) somwhere in your files.
2. Copy text below:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
@divyang4481
divyang4481 / CandidateCode.cs
Created May 17, 2020 07:20
The Powerpuff Girls
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class CandidateCode {
static void Main(String[] args) {
//Write code here
var ingredientCount = long.Parse(System.Console.ReadLine());
var ingredientFormula =System.Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);
var ingredientStock = System.Console.ReadLine().Split(new char[]{' '},StringSplitOptions.RemoveEmptyEntries);
@divyang4481
divyang4481 / Bounce.cs
Last active March 23, 2020 04:54
Trampolining
public sealed class Bounce<T1, T2, TResult>
{
public T1 Arg1 { get; private set; }
public T2 Arg2 { get; private set; }
public TResult Result { get; private set; }
public bool HasResult { get; private set; }
private Bounce() { }
public static Bounce<T1, T2, TResult> Continue(T1 arg1, T2 arg2)
@divyang4481
divyang4481 / Instructions.md
Created March 18, 2020 23:01 — forked from shreyaskarnik/Instructions.md
Route Docker Logs to ELK Stack
  • With Docker 1.8.0 shipped new log-driver for GELF via UDP, this means that the logs from Docker Container(s) can be shipped directly to the ELK stack for further analysis.
  • This tutorial will illustrate how to use the GELF log-driver with Docker engine.
  • Step 1: Setup ELK Stack:
    • docker run -d --name es elasticsearch
    • docker run -d --name logstash --link es:elasticsearch logstash -v /tmp/logstash.conf:/config-dir/logstash.conf logstash logstash -f /config-dir/logstash.conf
    • Note the config for Logstash can be found at this link
    • docker run --link es:elasticsearch -d kibana
  • Once the ELK stack is up now let's fire up our nginx container which ships its logs to ELK stack.
  • LOGSTASH_ADDRESS=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' logstash)
  • `docker run -d --net=host --log-driver=gelf --log-opt gelf-address=u
@divyang4481
divyang4481 / docker-compose.yml
Created March 18, 2020 13:10 — forked from ajeetraina/docker-compose.yml
Docker Compose for ELK Stack
version: '2'
services:
elasticsearch:
build:
context: elasticsearch/
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
ports:

Windows to UNIX Command Cheat Sheet

Windows PowerShell has several transition aliases that allow UNIX and CMD users to use familiar command names in Windows PowerShell. The most common aliases are shown in the table below, along with the Windows PowerShell command behind the alias and the standard Windows PowerShell alias if one exists.

CMD Command UNIX Command PowerShell Command PowerShell Alias
dir ls Get-ChildItem gci

Windows to UNIX Command Cheat Sheet

Windows PowerShell has several transition aliases that allow UNIX and CMD users to use familiar command names in Windows PowerShell. The most common aliases are shown in the table below, along with the Windows PowerShell command behind the alias and the standard Windows PowerShell alias if one exists.

CMD Command UNIX Command PowerShell Command PowerShell Alias
dir ls Get-ChildItem gci
@divyang4481
divyang4481 / Chan.cs
Last active March 1, 2020 19:10
Go lang channel like feature in C# .NET
public class Chan<T>
{
private BlockingCollection<T> _buffer;
public Chan() : this(1) { }
public Chan(int size)
{
_buffer = new BlockingCollection<T>(new ConcurrentQueue<T>(), size);
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;