Created by Christopher Manning
Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.
The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.
| #!/bin/bash | |
| # Idea and interface taken from https://github.com/macmade/host-manager | |
| path="/etc/hosts" | |
| addusage="Usage: `basename $0` -add host address" | |
| remusage="Usage: `basename $0` -remove host" | |
| case "$1" in | |
| -add) | |
| if [ $# -eq 3 ]; then | |
| if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" ${path}) ]]; then |
| # | |
| # templatetags/kwacros.py - Support for macros in Django templates | |
| # | |
| # Based on snippet by | |
| # Author: Michal Ludvig <[email protected]> | |
| # http://www.logix.cz/michal | |
| # | |
| # modified for args and kwargs by Skylar Saveland http://skyl.org | |
| # |
Created by Christopher Manning
Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.
The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.
| import redis | |
| import threading | |
| class Listener(threading.Thread): | |
| def __init__(self, r, channels): | |
| threading.Thread.__init__(self) | |
| self.redis = r | |
| self.pubsub = self.redis.pubsub() | |
| self.pubsub.subscribe(channels) | |
| //To compile: | |
| //cc vlcsms.c -o vlcsms -lvlc | |
| //This source is by Tim Sheerman-Chase and it is released as public domain. | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <inttypes.h> | |
| #include <vlc/vlc.h> |
| %w{libjpeg-dev libfreetype6-dev}.each do |pkg| | |
| package pkg do | |
| action :install | |
| end | |
| end | |
| bash "Install PIL from source" do | |
| user vagrant | |
| group vagrant | |
| code <<-EOH |
| #include <wheels/concurrency/locker_box.h++> | |
| #include <chrono> | |
| #include <exception> | |
| #include <future> | |
| #include <memory> | |
| #include <mutex> | |
| #include <type_traits> | |
| #include <utility> |
| // Detect autoplay | |
| // --------------- | |
| // This script detects whether the current browser supports the | |
| // autoplay feature for HTML5 Audio elements, and it sets the | |
| // `AUTOPLAY` variable accordingly. | |
| // Used in the Meteor app [PicDinner](http://picdinner.com) |
| from __future__ import print_function | |
| from collections import OrderedDict | |
| from prepareable import Prepareable | |
| from six import with_metaclass, iteritems | |
| class FooMeta(with_metaclass(Prepareable, type)): | |
| def __new__(cls, name, bases, attributes): |
| SQRT_5 = Math.sqrt(5) | |
| GOLDEN_NUMBER = (1+SQRT_5)/2 | |
| def fib(n) | |
| (1/SQRT_5*(GOLDEN_NUMBER**n-(-1/GOLDEN_NUMBER)**n)).to_i | |
| end | |
| puts fib(7) |