Skip to content

Instantly share code, notes, and snippets.

@vadimkantorov
vadimkantorov / csharpfrompython.cs
Last active December 31, 2025 14:59
Run a C# function from Python using Python.NET from https://pythonnet.github.io/pythonnet/python.html Call csharpfrompython.py which first calls the compiler and then calls the functions, feature request of better compiler bindings at https://github.com/pythonnet/pythonnet/issues/2196 ; includes two examples of NumPy -> C# array marshalling
namespace CSharpFromPythonNamespace
{
public class CSharpFromPythonClass
{
public string Hi(string x)
{
return "Hi " + x;
}
public static string Hello(string x)
@overplumbum
overplumbum / netgear_status.py
Created April 10, 2012 11:12
NetGear WiFi Router Monitoring
#!/usr/bin/env python
import urllib2, argparse
parser = argparse.ArgumentParser()
parser.add_argument('-H', required=True)
parser.add_argument('-U', default='admin')
parser.add_argument('-P', default='password')
args = parser.parse_args()
fields = "an_rxbs an_txbs bgn_rxbs bgn_txbs lan_rxbs lan_txbs".split(' ')