Skip to content

Instantly share code, notes, and snippets.

View mwcampbell's full-sized avatar

Matt Campbell mwcampbell

  • Wichita, KS, US
View GitHub Profile
Start: Sun Mar 25 15:40:32 2018
HOST: tinkerboard Loss% Snt Last Avg Best Wrst StDev
1.|-- gateway 0.0% 10 1.4 1.3 1.2 1.5 0.0
2.|-- 96.120.102.233 0.0% 10 10.2 8.8 7.1 15.0 2.4
3.|-- po-117-rur102.bellevue.wa 0.0% 10 10.1 8.9 7.4 12.6 1.4
4.|-- be-103-ar01.seattle.wa.se 0.0% 10 9.2 10.1 8.7 13.1 0.9
5.|-- lag-16.ear2.Seattle1.Leve 30.0% 10 8.4 10.4 8.4 13.4 1.4
6.|-- ae-2-3601.ear3.Newark1.Le 20.0% 10 83.0 85.2 82.9 95.1 4.0
7.|-- 4.30.130.234 0.0% 10 83.4 92.4 83.2 169.1 26.9
8.|-- cs20.cs90.v.ewr.nyinterne 0.0% 10 81.6 134.4 80.5 235.6 65.3

Keybase proof

I hereby claim:

  • I am mwcampbell on github.
  • I am mwcampbell (https://keybase.io/mwcampbell) on keybase.
  • I have a public key ASCGnnePCxIeOTJ1VD2vpghGztlXgLTJ8EwRi_eoyb1G3wo

To claim this, I am signing this object:

server {
listen 80;
server_name www.raddevon.com;
location /
rewrite ^(.*)$ http://raddevon.com$1;
}
}
@mwcampbell
mwcampbell / PrintLoop.java
Created June 11, 2012 12:38
Sample Java program with both JVM and x86 disassembly
public class PrintLoop {
public static void main(String[] args) {
for (int i = 0; i < 10; i++)
System.out.println("iteration " + i);
}
}
type
TExpr = object ## abstract base class for an expression
TLiteral = object of TExpr
x: int
TPlusExpr = object of TExpr
a, b: ref TExpr
method eval(e: ref TExpr): int =
quit "to override!"
#include <iostream>
using namespace std;
class Expr {
public:
virtual ~Expr() { }
virtual int eval() = 0;
};
class Literal : public Expr {
@mwcampbell
mwcampbell / sqlalchemy_traversal.py
Created August 17, 2011 16:47
SQLAlchemy traversal helpers
class DictLike(object):
def __contains__(self, key):
try:
ignored = self[key]
return True
except KeyError:
return False
has_key = __contains__
def get(self, key, default=None):
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
username = Column(String(32))
# ...
users = Collection(DBSession, User, "username")
root = {"users": users}
# or root = users
@mwcampbell
mwcampbell / gist:1111783
Created July 28, 2011 15:42
decorator.py
def get_event(request, event_id):
event = get_object_or_404(Event, pk=event_id)
user = request.user
if not event.is_access_allowed(user):
raise PermissionDenied()
return event
def takes_event(base_argname="event"):
id_argname = "%s_id" % base_argname
# Omitting typical SQLAlchemy setup
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
username = Column(String(32))
# ...
class Users(object):
def __getitem(self, username):