Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env python | |
# found on <http://files.majorsilence.com/rubbish/pygtk-book/pygtk-notebook-html/pygtk-notebook-latest.html#SECTION00430000000000000000> | |
# simple example of a tray icon application using PyGTK | |
import gtk | |
def message(data=None): | |
"Function to display messages to the user." | |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import pygame, time, random, sys, copy, os | |
from pygame.locals import * | |
t2 = 0 | |
nor = 0 | |
pc = [[[1, 1], [1, 1]], [[1, 0], [1, 0], [1, 1]], [[0, 1], [0, 1], [1, 1]], [[1], [1], [1], [1]], [[0, 1, 1], [1, 1, 0]], [[1, 1, 0], [0, 1, 1]], [[1, 1, 1], [0, 1, 0]]] | |
cols = [(0, 0, 0), (100, 100, 100), (10, 100, 225), (0, 150, 220), (0, 220, 150), (60, 200, 10), (180, 210, 5), (210, 180, 10), (100, 200, 170)] | |
pygame.init() | |
pygame.display.set_mode((320, 240)) | |
sk = pygame.display.get_surface() | |
f = [[1] + [0 for x in range(8)] + [1] for x in range(19)] + [[1 for x in range(10)]] |
def namedlist(typename, field_names): | |
"""Returns a new subclass of list with named fields. | |
>>> Point = namedlist('Point', ('x', 'y')) | |
>>> Point.__doc__ # docstring for the new class | |
'Point(x, y)' | |
>>> p = Point(11, y=22) # instantiate with positional args or keywords | |
>>> p[0] + p[1] # indexable like a plain list | |
33 | |
>>> x, y = p # unpack like a regular list |
How to compile Mesos on your new Raspberry Pi 2 (which is amazing with 4 cores and 6x performance). Follows on from experiments in compiling for OS X
sudo apt-get install maven libsasl2-dev libapr1-dev libsvn-dev libcurl4-openssl-dev python-dev python-boto
export JAVA_HOME="/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt"
export PATH=$JAVA_HOME/bin:$PATH
http://likemagicappears.com/projects/raspberry-pi-cluster/mesos-on-raspbian/
#!/usr/bin/lua | |
-- Metrics web server (0.1) | |
-- Copyright (c) 2015 Kevin Lyda | |
-- Apache 2.0 License | |
socket = require("socket") | |
netsubstat = {"IcmpMsg", "Icmp", "IpExt", "Ip", "TcpExt", "Tcp", "UdpLite", "Udp"} | |
cpu_mode = {"user", "nice", "system", "idle", "iowait", "irq", | |
"softirq", "steal", "guest", "guest_nice"} | |
netdevsubstat = {"receive_bytes", "receive_packets", "receive_errs", |
This gist was essentially created out of my own rant about Netflix being hostile to IPv6 tunnel services since June 2016. You are welcome to read my opinion on the matter, this is the more technical side to the issue and how to combat it within your own network.
Since I wrote this, various GitHub users have contributed their thoughts and ideas which has been incorporated into this gist. Thank you to everyone who have contributed their own methods and implementations.
Netflix now treats IPv6 tunnel brokers (such as Hurricane Electric) as proxy servers. A while ago it became apparent to users and Netflix that somewhat by accident, IPv6 tunnel users were being served content outside of their geolocation because of the way Netflix was identifyi