Skip to content

Instantly share code, notes, and snippets.

flq / HttpFileServer.cs
Created Apr 17, 2010
Smallest file web server
View HttpFileServer.cs
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
public class HttpFileServer : IDisposable
private readonly string rootPath;
private const int bufferSize = 1024*512; //512KB
View A copy op preserving relative folder structure
$a = pwd
ls -r |
? { !$".g.") } |
? { $_.Extension -eq ".cs" -or $_.Extension -eq ".csproj" } |
? { $_.lastwritetime -gt [DateTime]::Now.AddHours(-6) } |
% {
$relative = $_.fullname.Replace($a.Path + "\","")
$Path = [System.IO.Path]::GetDirectoryName($relative)
mkdir c:\temp\$path -erroraction SilentlyContinue
Copy-Item -path $relative -destination c:\temp\$path
flq / RelayCommand
Created Feb 18, 2011
A command that runs on delegates and implements WPF ICommand
View RelayCommand
using System;
using System.Windows.Input;
namespace Something
public class RelayCommand : ICommand
private readonly Func<object, bool> _canExecute;
private readonly Action<object> _execute;
flq / NonTopmostPopup.cs
Created Apr 5, 2011
WPF: Popup that is only topmost with respect to parent window. Taken from the comments at (Joe Gershgorin) which was in not easy to digest state
View NonTopmostPopup.cs
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
/// <summary>
/// Popup with code to not be the topmost control
flq / HelpController.cs
Created May 6, 2011
Current Fubu registry
View HelpController.cs
using FubuMVC.Core;
namespace CharmSim.Controllers
public class HelpController
public HelpViewModel Start()
return new HelpViewModel { Title = "Hello from Controller! " };
flq / tax.cs
Created Sep 22, 2011
the tax thingy
View tax.cs
public decimal GetTaxes(decimal salary)
decimal tax = 0;
var progressiveTaxation = new[] { 0.1m, 0.14m, 0.23m, 0.3m, 0.33m, 0.45m };
var progressionSlices = new[] { 5070 - 0, 8660 - 5070, 14070 - 8660, 21240 - 14070, 40230 - 21240, decimal.MaxValue };
var progression = 0;
while (salary > 0)
flq / zzz.ps1
Created Feb 9, 2012
Powershell function to bring your PC to sleep
View zzz.ps1
function zzz {
$source = @"
public static extern void SetSuspendState(bool hibernate, bool forceCritical, bool disableWakeEvent);
$app = Add-Type -Namespace "Standby" -MemberDefinition $source -Name Sleep -PassThru;
flq / Program.cs
Created Sep 14, 2012
Prog to start a difftool and remap the files as they are deleted by git in order to open all files at once
View Program.cs
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
namespace DifftoolStarter
class Program
static void Main(string[] args)
View git achievements
- Cloned from a remote repository
- Initialized an empty repository
- Pulled from a remote repository
- Made first commit
- Pushed to a remote repository
- Made first local branch
- Pushed a new branch
- Added a second remote
- Merged a branch into another one
- Deleted a local branch
flq /
Last active Jun 18, 2020
Fizzbuzzes in many colours.

A collection of FizzBuzz implementations over many languages. The specification goes something like this...

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

The expected outcome is something like:

You can’t perform that action at this time.