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 / version.pas
Created July 27, 2012 02:10
Inno Setup script sample part 2
function InitializeSetup(): Boolean;
var
oldVersion: String;
uninstaller: String;
ErrorCode: Integer;
begin
if RegKeyExists(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F768F6BA-F164-4599-BC26-DCCFC2F76855}_is1') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE,
@lextm
lextm / innosample.pas
Created July 27, 2012 02:05
Inno Setup script sample for advanced part 3
function Count(What, Where: String): Integer;
begin
Result := 0;
if Length(What) = 0 then
exit;
while Pos(What,Where)>0 do
begin
Where := Copy(Where,Pos(What,Where)+Length(What),Length(Where));
Result := Result + 1;
end;
@lextm
lextm / build.sh
Created May 29, 2019 04:02
MonoDevelop build steps on Ubuntu 18.04
git clone https://github.com/mono/monodevelop.git
cd monodevelop
git checkout release-7.8
git submodule update --init --recursive
sudo apt install autoconf
sudo apt install libglade2.0
sudo apt install libssh2-1-dev
./configure --profile=stable
make
@lextm
lextm / gist:0b1db036d89fd0372028381c6b185714
Created April 8, 2019 18:34
dotnet22 dependency chart
digraph "XXX"
{
nodesep=0; sep=0; ranksep=0
ratio="compress"
packmode="node"; pack=1
pad=0
splines=true
rankdir=TB // top-bottom
concentrate=true;
//K=0
@lextm
lextm / gist:3185774
Created July 27, 2012 02:01
Inno Setup script sample for advanced part 2
[Code]
// function IsModuleLoaded to call at install time
// added also setuponly flag
function IsModuleLoaded(modulename: String ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';
// function IsModuleLoadedU to call at uninstall time
// added also uninstallonly flag
function IsModuleLoadedU(modulename: String ): Boolean;
external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly' ;
@lextm
lextm / cla_vscode_restructuredtext.md
Last active December 23, 2017 18:31
cla_vscode_restructuredtext

Thank you for your interest in LeXtudio projects (the "Organization"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Organization must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Organization and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign.

@lextm
lextm / cla_dockpanelsuite.md
Created December 23, 2017 18:24
CLA_dockpanelsuite

Thank you for your interest in DockPanel Suite Organization (the "Organization"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Organization must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Organization and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign.

@lextm
lextm / gist:6333563
Created August 25, 2013 12:17
DateAndTimeDecoder.cs
using System;
using System.Globalization;
using Lextm.SharpSnmpLib;
namespace Lextm.SharpSnmpPro.Mib.Decoders
{
internal sealed class DateAndTimeDecoder : IDecoder
{
public string Decode(ISnmpData data)
{
@lextm
lextm / gist:6333534
Created August 25, 2013 12:11
DateAndTime test case
// DateAndTime
Assert.IsTrue(registry.Verify("TEST-MIB", "testEntity5", new OctetString(new byte[] { 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9 })));
Assert.IsTrue(registry.Verify("TEST-MIB", "testEntity5", new OctetString(new byte[] { 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9 })));
Assert.Throws<InvalidOperationException>(() => registry.Decode("TEST-MIB", "testEntity5", new OctetString(new byte[] { 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9, 0x9 })));
Assert.AreEqual("8/17/2004 3:48:00 PM (UTC-05:00) Bogota, Lima, Quito", registry.Decode("TEST-MIB", "testEntity5", new OctetString(new byte[] { 0x07, 0xD4, 0x08, 0x11, 0x0F, 0x30, 0x00, 0x00, 0x2D, 0x05, 0x00 })));
Assert.AreEqual("08/17/2004 15:48:00", registry.Decode("TEST-MIB", "testEntity5", new OctetString(new byte[] { 0x07, 0xD4, 0x08, 0x11, 0x0F, 0x30, 0x00, 0x00 })));
Assert.AreEqual("5/26/1992 1:30:15 PM (UTC-04:00) Asuncion", registry.Decode("TEST-MIB", "testEntity5", new OctetString(new byte[] { 0x07, 0xC8, 5, 26, 13, 30, 15, 0x00, 0x2D
@lextm
lextm / gist:6255514
Created August 17, 2013 05:59
Syntax validation test case
[Test]
public void TestTypeValidation()
{
var registry = new SimpleObjectRegistry();
var collector = new ErrorRegistry();
registry.Import(Parser.Compile(new MemoryStream(Resources.SNMPv2_SMI), collector));
registry.Import(Parser.Compile(new MemoryStream(Resources.SNMPv2_CONF), collector));
registry.Import(Parser.Compile(new MemoryStream(Resources.SNMPv2_TC), collector));
registry.Import(Parser.Compile(new MemoryStream(Resources.SNMPv2_MIB), collector));
registry.Import(Parser.Compile(new MemoryStream(Resources.SNMPv2_TM), collector));