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 / 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 / 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 / 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;
@lextm
lextm / httpapi.cs
Created October 2, 2015 06:50
HTTP API wrapper with SNI support
internal static class NativeMethods
{
private static readonly HTTPAPI_VERSION HttpApiVersion = new HTTPAPI_VERSION(1, 0);
#region DllImport
[DllImport("httpapi.dll", SetLastError = true)]
static extern uint HttpInitialize(
HTTPAPI_VERSION version,
uint flags,
@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));
@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)
{