Skip to content

Instantly share code, notes, and snippets.

View a-stankevich's full-sized avatar

Arthur Stankevich a-stankevich

View GitHub Profile
@gildas
gildas / win-openssh.md
Last active May 28, 2025 16:38
Deploy OpenSSH on Windows 2019 Full and Core

Deploy OpenSSH on Windows Server 2019

Goals

We want to install OpenSSH on a Windows Server 2019, so we can remote access it with ssh myuser@win2019.

We want also to turn on PowerShell Remoting over SSH, so we can create PSSession objects from PowerShell Core on Linux/MacOs/Windows.

Acknowledgments

@nfekete
nfekete / wsl-fix-resolvconf.sh
Created August 8, 2018 03:05
Fix resolv.conf in Windows Subsystem for Linux, when WSL doesn't correctly generate it.
#!/bin/bash
TMP=`mktemp`
trap ctrlC INT
removeTempFiles() {
rm -f $TMP
}
ctrlC() {
@xt0rted
xt0rted / EntityFrameworkExceptionTelemetryInitializer.cs
Last active February 3, 2021 14:41
Entity Framework exception telemetry for Application Insights
using System.Data.Entity.Validation;
using System.Linq;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
public class EntityFrameworkExceptionTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
@bradoyler
bradoyler / child.html
Last active April 14, 2020 19:10
adaptive iframe using postMessage()
<h2> Hello World! </h2>
<script>
function iframeResize() {
var body = document.body, html = document.documentElement;
var height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
var location = document.location.href;
window.parent.postMessage(["setHeight", height, location], "*");
}
iframeResize();
$(window).resize(iframeResize);
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@miguelgonz
miguelgonz / git sync
Created August 28, 2014 14:30
git sync
#!/bin/sh
#To make use of this just copy it to your path, +x it, and do git sync
MAIN_BRANCH="develop"
CURRENT_CHANGES=`git status --porcelain`
CURRENT_BRANCH=`git symbolic-ref -q --short HEAD`
if [ "$CURRENT_CHANGES" != "" ]; then
git stash --include-untracked
fi
@clupasq
clupasq / nlog colored console files
Created March 13, 2012 08:52
nlog configuration for colored console + info&error files
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" >
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
<highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
@Chrisso
Chrisso / App.config
Created January 30, 2012 09:57
Simple NLOG App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog>
<targets>
<target name="console" type="Console" layout="${message}" />
<target name="debugger" type="Debugger" layout="${message}"/>
</targets>
@nolim1t
nolim1t / gist:271018
Created January 7, 2010 05:29
Sample HTTP Request in Powershell
Powershell HTTP Request
$r = [System.Net.WebRequest]::Create("http://url/")
$resp = $r.GetResponse()
$reqstream = $resp.GetResponseStream()
$sr = new-object System.IO.StreamReader $reqstream
$result = $sr.ReadToEnd()
write-host $result
Username and passwords