Skip to content

Instantly share code, notes, and snippets.

View lostmsu's full-sized avatar
💭
–2147483648x developer

Victor lostmsu

💭
–2147483648x developer
View GitHub Profile
@lostmsu
lostmsu / DynDns.csx
Created December 23, 2016 08:06
Simple dynamic DNS client for namecheap. Looks for files in \ProgramData\DynDns in form of <yourdomain>.namecheap, containing dyndns password. Can be used with csi (C# script) and Task Scheduler
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Security.AccessControl;
IPAddress GetMyExternalIpAddress() {
var dnsQuery = new ProcessStartInfo("nslookup", "myip.opendns.com. resolver1.opendns.com")
{
@lostmsu
lostmsu / IAsyncSaveService.cs
Created October 1, 2016 23:31
The problem interface for the Responsive Autosave Problem (lookup the post on blogger)
// Instances of this class are not thread-safe
// E.g. only one thread can safely call Save and DisposeAsync
//
interface IAsyncSaveService {
// this function schedules save operation to be performed
// implementers of this interface must ensure, that only one save operation can run at the same time
// saveOperation is considered completed when the task it returned is completed
void Save(Func<Task> saveOperation);
// after a call to this function no calls to Save are allowed and must throw ObjectDisposedException
// this function can be called any number of times