Skip to content

Instantly share code, notes, and snippets.

View psulek's full-sized avatar

Peter Šulek psulek

View GitHub Profile
@psulek
psulek / msbuild_task_copyifnewer.targets
Last active September 26, 2024 07:33
MSBuild Task CopyIfNewer
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="CopyIfNewer" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
<SourceFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true"/>
<TargetFiles ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true"/>
</ParameterGroup>
<Task>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Using Namespace="Microsoft.Build.Framework"/>
@psulek
psulek / linux-cmds.md
Last active January 5, 2022 15:02
Linux Commands

Services management

Start/Stop/Restart/Status

sudo service service_name [status|stop|start|restart]

alternative 1:

sudo systemctl [status|stop|start|restart] service_name

using System;
using System.Reactive.Linq;
using System.Threading;
/// <summary>
/// Helper methods for using observable <see cref="IProgress{T}"/> implementations. These are hot observables.
/// </summary>
public static class ObservableProgress
{
/// <summary>
var http = require('http');
var path = require('path');
var cluster = require('cluster');
var os = require('os');
var fs = require('fs');
var debug = true;
if (!cluster.isMaster) {
var F = require('total.js');
@psulek
psulek / Object.prototype.enumEqual.js
Last active August 29, 2015 13:56
Enum equal for object prototype usable in Typescript
var States;
(function (States) {
States[States["New"] = 1] = "New";
States[States["Active"] = 2] = "Active";
States[States["Disabled"] = 3] = "Disabled";
})(States || (States = {}));
Object.prototype.enumEqual = function(enumType, enumItem) {
debugger;
var isNum = function(v) { return !isNaN(parseInt(v)); };