Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| <html> | |
| <head> | |
| <script src="https://raw.github.com/remy/twitterlib/master/twitterlib.min.js"></script> | |
| <script src="https://raw.github.com/timrwood/moment/2.0.0/min/moment.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="tweet" data-username="bountify"></div> | |
| <script> | |
| var tweet = document.getElementById('tweet'); | |
| var username = tweet.getAttribute('data-username'); |
| """Generic linux daemon base class for python 3.x. | |
| Source: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/""" | |
| import sys, os, time, atexit, signal, errno | |
| class daemon: | |
| """A generic daemon class. | |
| Usage: subclass the daemon class and override the run() method.""" |
| namespace :symfony do | |
| namespace :assets do | |
| desc "Updates assets version" | |
| task :update_version do | |
| run "sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/app/config/config.yml" | |
| end | |
| end | |
| end | |
| before "symfony:assetic:dump" do |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| class DeepOpenStruct < OpenStruct | |
| def to_h | |
| convert_to_hash_recursive self.dup | |
| end | |
| def self.load item | |
| raise ArgumentError, "DeepOpenStruct must be passed a Hash or Array" unless(item.is_a?(Hash) || item.is_a?(Array)) | |
| self.convert_from_hash_recursive item | |
| end |
| UNAME := $(shell uname -s) | |
| ifeq ($(UNAME),Darwin) | |
| OSFLAGS=-D_OSX | |
| endif | |
| ifeq ($(UNAME),Linux) | |
| OSFLAGS=-D_LINUX | |
| endif | |
| CC=gcc | |
| CFLAGS=-std=gnu99 -lm -s -x c -O2 -Wall -Wno-unused -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE $(OSFLAGS) | |
| SOURCES=my_strategy.c runner.c remote_process_client.c model/world.c platform/net.c |
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| APPNAME = u"Охуенный блять совет" | |
| URI = 'http://fucking-great-advice.ru/' | |
| API_URI = URI + 'api/random' | |
| SOUND_URI = URI + 'files/sounds' | |
| INTERVAL = 350 | |
| from gi.repository import AppIndicator3 as AI |
| ### | |
| # Read in XML as a stream, write out JSON as a stream. As little information | |
| # is kept in memory as possible. | |
| require 'nokogiri' | |
| require 'psych' | |
| class JSONTranslator < Nokogiri::XML::SAX::Document | |
| attr_reader :emitter | |
| def initialize emitter |
| [Desktop Entry] | |
| Version=9 | |
| Name=Teamviewer 9 | |
| Comment= | |
| Exec=/home/user/.teamviewer9/teamviewer | |
| Icon=/home/user/.teamviewer9/tv_bin/desktop/teamviewer.png | |
| Terminal=false | |
| Type=Application | |
| Categories=Utility;Application; |
| #!/usr/bin/env python | |
| """scrview.py: ZX Spectrum SCREEN$ viewer""" | |
| import sys | |
| import Image | |
| from array import array | |
| class ZXScreen: | |
| WIDTH = 256 |