Skip to content

Instantly share code, notes, and snippets.

View lextm's full-sized avatar
💭
I may be slow to respond.

Lex Li lextm

💭
I may be slow to respond.
View GitHub Profile
@lextm
lextm / gist:3888301
Created October 14, 2012 11:32
Windows Service test sample
using System;
using System.ServiceProcess;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
@lextm
lextm / gist:3198483
Created July 29, 2012 12:43
ANTLR generated method
private sealed partial class statement_return : AstParserRuleReturnScope<CommonTree, IToken>
{
public MibDocument result = new MibDocument();
public statement_return(SmiParser grammar) {OnCreated(grammar);}
partial void OnCreated(SmiParser grammar);
}
partial void EnterRule_statement();
partial void LeaveRule_statement();
// $ANTLR start "statement"
@lextm
lextm / compare.pas
Created July 27, 2012 02:13
Inno Setup script sample part 3
function GetNumber(var temp: String): Integer;
var
part: String;
pos1: Integer;
begin
if Length(temp) = 0 then
begin
Result := -1;
Exit;
end;
@lextm
lextm / gist:3185804
Created July 27, 2012 02:08
Inno Setup script sample part 1
AppVersion=6.0.0.1004
AppID={{F768F6BA-F164-4599-BC26-DCCFC2F76855}
@lextm
lextm / gist:3185759
Created July 27, 2012 01:54
Inno Setup script sample for advanced part 1
#define MyAppID "{F768F6BA-F164-4599-BC26-DCCFC2F76855}"
#define MyAppCopyright "Copyright (C) 2005-2007 Lex Li and other contributors."
#define MyAppName "Code Beautifier Collection"
#define MyAppVersion GetFileVersion("..\bin\release\Lextm.CodeBeautifierCollection.Framework.dll")
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppName}
AppPublisher=Lex Li (lextm)
AppPublisherURL=http://lextm.com
@lextm
lextm / antlr_csproj_targets.xml
Created July 27, 2012 01:36
Targets fragment for csproj files
<PropertyGroup>
<AntlrBuildTaskPath>$(MSBuildProjectDirectory)\..\lib\ANTLR</AntlrBuildTaskPath>
<AntlrToolPath>$(MSBuildProjectDirectory)\..\lib\antlr\antlr3.exe</AntlrToolPath>
</PropertyGroup>
<Import Project="..\lib\ANTLR\Antlr3.targets" />
@lextm
lextm / antlr_csproj_reference.xml
Created July 27, 2012 01:40
ANTLR reference in csproj files
<Reference Include="Antlr3.Runtime, Version=3.4.1.9004, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Antlr.Unofficial.3.4.1.0\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
@lextm
lextm / antlr_csproj_grammar.xml
Created July 27, 2012 01:39
ANTLR grammar files in csproj files
<Antlr3 Include="Mib\Smi.g" />
<None Include="Mib\Smi_no_action.g" />
@lextm
lextm / antlr_csharp_exception
Created July 27, 2012 01:30
ANTLR simplest exception handling in C#
// Alter code generation so catch-clauses get replace with
// this action.
@rulecatch{
catch (RecognitionException)
{
throw;
}
}
@lextm
lextm / shield.cs
Created October 3, 2015 06:14
Add/Remove shield icon to/from WinForms Button
using System;
// ReSharper disable InconsistentNaming
namespace JexusManager
{
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Windows.Forms;