Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Lex Li lextm

💭
I may be slow to respond.
Block or report user

Report or block lextm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lextm
lextm / build.sh
Created May 29, 2019
MonoDevelop build steps on Ubuntu 18.04
View build.sh
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
View gist:0b1db036d89fd0372028381c6b185714
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 Dec 23, 2017
cla_vscode_restructuredtext
View cla_vscode_restructuredtext.md

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.

View cla_dockpanelsuite.md

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 Oct 3, 2015
Add/Remove shield icon to/from WinForms Button
View shield.cs
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 Oct 2, 2015
HTTP API wrapper with SNI support
View httpapi.cs
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 Aug 25, 2013
DateAndTimeDecoder.cs
View gist:6333563
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 Aug 25, 2013
DateAndTime test case
View gist:6333534
// 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 Aug 17, 2013
Syntax validation test case
View gist:6255514
[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 Oct 14, 2012
Windows Service test sample
View gist:3888301
using System;
using System.ServiceProcess;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
You can’t perform that action at this time.