Skip to content

Instantly share code, notes, and snippets.

View thomas-mangin's full-sized avatar
🏠
Working from home

Thomas Mangin thomas-mangin

🏠
Working from home
View GitHub Profile
// Another suggestion from watching
// https://www.youtube.com/watch?v=AHc4x1uXBQE&t=336s
// with my (genuine) 1 hour zig coding experience, I naively believe
// that this sould remove the memory issue within the union.
// and therefore is a slight improvement on the presented enum solution
const std = @import("std");
const stdout = std.io.getStdOut().writer();
mkdir openconfig
cd openconfig
pip3 install pyang
git clone https://github.com/openconfig/public
git clone https://github.com/openconfig/oc-pyang
cd public/release/models
$ pyang --plugindir ../../../oc-pyang/openconfig_pyang/plugins/ -p bgp -p rib/ -p routing -p policy -p types/ -p interfaces/ -p segment-routing/ -p mpls/ bgp/openconfig-bgp.yang --dsdl-no-documentation -f jtox | jsonpp
mkdir openconfig
cd openconfig
pip3 install pyang
git clone https://github.com/openconfig/public
git clone https://github.com/openconfig/oc-pyang
cd public/release/models
$ pyang --plugindir ../../../oc-pyang/openconfig_pyang/plugins/ -p bgp -p rib/ -p routing -p policy -p types/ -p interfaces/ -p segment-routing/ -p mpls/ bgp/openconfig-bgp.yang --dsdl-no-documentation -f jtox
mkdir openconfig
cd openconfig
pip3 install pyang
git clone https://github.com/openconfig/public
git clone https://github.com/openconfig/oc-pyang
cd public/release/models
$ pyang --plugindir ../../../oc-pyang/openconfig_pyang/plugins/ -p bgp -p rib/ -p routing -p policy -p types/ -p interfaces/ -p segment-routing/ -p mpls/ bgp/openconfig-bgp.yang --dsdl-no-documentation -f tree

Keybase proof

I hereby claim:

  • I am thomas-mangin on github.
  • I am thomasmangin (https://keybase.io/thomasmangin) on keybase.
  • I have a public key ASCx37XM7CRAO4-mji_fk1cmifDAL92MDZObECdaGX_RUgo

To claim this, I am signing this object:

def benchmark (label, func, count, *args, **kwargs):
s = time.time()
d = None
for _ in range(count):
d = func(*args, **kwargs)
e = time.time()
print('%s: %7d requests in %1.03f seconds' % (label, count, e-s))
@thomas-mangin
thomas-mangin / gist:f3ba31e1bad1a358be73
Created July 9, 2015 16:00
staticmethod vs classmethod
import time
def nop_function ():
pass
def access_function ():
local = Test.scoped_value
class Test (object):
scoped_value = 1
@thomas-mangin
thomas-mangin / gist:1888793
Created February 23, 2012 00:47
pyqt issue
This file has been truncated, but you can view the full file.
thomas on ptr-20 at 12:27:33 in ~
»› brew install pyqt
==> Downloading http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-mac-gpl-4.9.1.tar.gz
File already downloaded in /Users/thomas/Library/Caches/Homebrew
==> python ./configure.py --confirm-license --bindir=/usr/local/Cellar/pyqt/4.9.1/bin --destdir=/usr/local/Cellar/pyq
==> make
g++ -c -pipe -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -fPIC -Wall -W -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Cellar/qt/4.8.0/mkspecs/macx-g++ -I. -I/usr/local/Cellar/qt/4.8.0/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.0/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.0/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.0/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.0/lib/QtOpenGL.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.0/lib/QtOpenGL.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.0/include -I/usr/local/Cella