Skip to content

Instantly share code, notes, and snippets.

View cezarypiatek's full-sized avatar
🎹
Coding

Cezary Piątek cezarypiatek

🎹
Coding
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 3, 2024 12:57
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vmarquez
vmarquez / ReaderMonad.cs
Last active February 20, 2020 20:30
This is an example of using the Reader Monad for Dependency Injection using LINQ in C#. I learned about this from Tony Morris and Rúnar Bjarnason's video here: http://www.youtube.com/watch?v=ECPGTUa1WAI To figure out the (slightly weird) SelectMany peculiarities I found http://mikehadlow.blogspot.com/2011/01/monads-in-c-4-linq-loves-monads.html
//Reader Monad and its extension class to give it SelectMany(bind/flatMap) capabilities for use in LINQ queries
public static class ReaderMonadExt
{
public static ReaderMonad<T, C> SelectMany<T, A, B, C>(this ReaderMonad<T, A> rm, Func<A, ReaderMonad<T, B>> bindf, Func<A, B, C> select)
{
return new ReaderMonad<T, C>(t =>
{
var a = rm.Run(t);
return select(a, bindf(a).Run(t));
});
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active May 24, 2024 15:47
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@ccarrasc
ccarrasc / log4net.config.xml
Last active June 19, 2017 11:50
log4net UDP Appender to send signals to Graphite server
<appender name="GraphiteUdpAppender" type="log4net.Appender.UdpAppender">
<remoteAddress value="graphiteserver.somewhere.com"/>
<remotePort value="8125"/>
<layout type="log4net.Layout.PatternLayout">
<IgnoresException value="False"/>
<conversionPattern value="%property{log4net:HostName}.log4net.%level:1|kv\n"/>
</layout>
</appender>
<!-- Remember to add the appender to the root
@pmolchanov
pmolchanov / PoshWebHarness.ps1
Created June 18, 2015 17:13
Simple PowerShell HTTP/HTTPS web server useful for mocking web services
# Use the following commands to bind/unbind SSL cert
# netsh http add sslcert ipport=0.0.0.0:443 certhash=3badca4f8d38a85269085aba598f0a8a51f057ae "appid={00112233-4455-6677-8899-AABBCCDDEEFF}"
# netsh http delete sslcert ipport=0.0.0.0:443
$HttpListener = New-Object System.Net.HttpListener
$HttpListener.Prefixes.Add("http://+:80/")
$HttpListener.Prefixes.Add("https://+:443/")
$HttpListener.Start()
While ($HttpListener.IsListening) {
$HttpContext = $HttpListener.GetContext()
$HttpRequest = $HttpContext.Request
@DraTeots
DraTeots / ComPort over Network.md
Last active June 25, 2024 05:02
ComPort over Network
@Jaykul
Jaykul / Get-MsdnKeys.ps1
Last active August 3, 2022 20:28
PowerShell + Selenium Demo: Getting Started, and reusing cookies with Invoke-Request
# It might work in 4, but I'm not testing there. Lower you'll have to tweak code
#requires -Version 5.0
param(
# Your Live ID for MSDN login
[Parameter(Mandatory)]
[PSCredential]
[System.Management.Automation.CredentialAttribute()]
$Credential,
# Pick a browser to use. Defaults to Firefox (which doesn't seem to require an external Driver file)
@dgoguerra
dgoguerra / git-prune.md
Created September 8, 2016 13:59
Prune branches and tags deleted in the remote
# prune branches deleted in origin
git remote prune origin

# prune tags
# http://stackoverflow.com/questions/1841341/remove-local-tags-that-are-no-longer-on-the-remote-repository
git fetch --prune <remote> '+refs/tags/*:refs/tags/*'
@thomaslevesque
thomaslevesque / CSharpErrorsAndWarnings.md
Last active June 18, 2024 07:18
All C# errors and warnings. NOTE: this list is out of date. See https://github.com/thomaslevesque/GenerateCSharpErrors/blob/master/CSharpErrorsAndWarnings.md for a more recent version

All C# errors and warnings

Parsed from the Roslyn source code using Roslyn.

Code Severity Message
CS0006 Error Metadata file '{0}' could not be found
CS0009 Fatal Metadata file '{0}' could not be opened -- {1}
CS0012 Error The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'.
CS0016 Error Could not write to output file '{0}' -- '{1}'
@eonarheim
eonarheim / AdminRestApi.ps1
Last active August 12, 2022 21:08
PowerShell DSC Configuration for the new Microsoft IIS.Administration Rest API
configuration AdminRestAp {
Import-DscResource -ModuleName xPSDesiredStateConfiguration
Import-DscResource -ModuleName xNetworking
Node "webserver" {
<#
Install windows features
#>
WindowsFeature InstallIIS {