Skip to content

Instantly share code, notes, and snippets.

View alimbada's full-sized avatar

Ammaar Limbada alimbada

View GitHub Profile
git clean -xdf -e *.suo -e *.user -e */packages/*
void Main()
{
var ignores = new Regex[]
{
new Regex(@"Approval"),
new Regex(@"Test"),
new Regex(@"Demo")
};
var serviceControl = @"C:\Code\Particular\ServiceControl\src\";
Util.Image("http://yuml.me/diagram/scruffy;scale:150/class/" + String.Join(",", GetDependencies(serviceControl, ignores))).Dump();
<NotepadPlus>
<UserLang name="LogFile" ext="log">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">[(0])0</Keywords>
<Keywords name="Folder+"></Keywords>
@alimbada
alimbada / DeleteVCRedistFiles.bat
Created April 29, 2012 04:03
Dump this in a batch file on whichever drive/partition has the most free space on your Windows machine and run it to remove temporary files spewed out by the Visual C++ Redistributable installer.
del VC_RED.MSI
del VC_RED.cab
del install.res.*.dll
del install.exe
del eula.*.txt
del vcredist.bmp
del install.ini
del globdata.ini
@alimbada
alimbada / gist:2634391
Created May 8, 2012 11:36
Copies one file over another if the two files are different.
@echo off
echo Comparing two files: %1 with %2
if not exist %1 goto File1NotFound
if not exist %2 goto File2NotFound
fc %1 %2
if %ERRORLEVEL%==0 GOTO NoCopy
echo Files are not the same. Copying %1 over %2
@alimbada
alimbada / gist:2975897
Created June 23, 2012 00:08
Recursively nukes bin and obj directories in a source/directory tree.
for /d /r . %%d in (bin,obj) do @if exist "%%d" rd /s/q "%%d"
REM Remove extra %s if you want to run command straight from the command line, i.e.
REM for /d /r . %d in (bin,obj) do @if exist "%d" rd /s/q "%d"
public abstract class CommandBase : ICommand
{
public abstract void Execute();
public virtual bool CanExecute()
{
return true;
}
@alimbada
alimbada / UnlockScreen.cmd
Created May 16, 2015 14:20
Unlocks the screen on a remote Windows machine (so that I can stream games from it with Steam In-Home Streaming)
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$sessionid=((quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; tscon $sessionid /dest:console" 2> UnlockErrors.log
@alimbada
alimbada / ReSharperMemberLayoutRules.xml
Created April 19, 2012 10:45
ReSharper custom type member layout rules for C#
<?xml version="1.0" encoding="utf-8" ?>
<!--
I. Overall
I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used
I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries
I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared
I.4 The contents of each entry is sorted by given keys (First key is primary, next key is secondary, etc). Then the declarations are grouped and en-regioned by given property
@alimbada
alimbada / mkv-subtitle-track.sh
Last active October 11, 2018 15:31
Gets subtitle track number from an MKV file
ffprobe -hide_banner -i $mkvFile 2>&1 | grep -i subtitle | awk '{print $2}' | awk -F':' '{ print substr($2,1,1) }'