Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>name</key> | |
| <string>Solarized (dark)</string> | |
| <key>settings</key> | |
| <array> | |
| <dict> | |
| <key>settings</key> |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
NOTE: You don't need to compile Mosh on Cygwin yourself anymore; just install the package with Cygwin's setup.exe.
Download Cygwin.
Run setup.exe and install the following packages in addition to the default ones:
| {% extends 'admin/model/edit.html' %} | |
| {% macro table(columns, items, endpoint) %} | |
| <table class="table table-striped table-bordered model-list"> | |
| <thead> | |
| <tr> | |
| <th></th> | |
| {% for c in columns %} | |
| <th>{{ c }}</th> | |
| {% endfor %} |
| from zope.interface import Interface, Attribute, implements | |
| from zope.component import getGlobalSiteManager, adapts | |
| # here is what our data looks like | |
| class IKey(Interface): | |
| pass | |
| class IEntity(Interface): |
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: btsync | |
| # Required-Start: $local_fs $remote_fs | |
| # Required-Stop: $local_fs $remote_fs | |
| # Should-Start: $network | |
| # Should-Stop: $network | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Multi-user daemonized version of btsync. |
| # Example usage | |
| # $ python dft.py | gnuplot | |
| # 9 | |
| # 0 0 | |
| # 1 1 | |
| # 2 2 | |
| # 0 2 | |
| # 1 1 | |
| # -1 1 | |
| # 0 2 |
| # Notes: | |
| # Python 3 assumed, but shouldn't be hard to backport to Python 2 | |
| # Cobbled together from two slightly different implementations, sorry for any inconsistencies. | |
| # This creates two models, NavigationMenu, and NavigationMenuItem. A site can have many NavigationMenus, which are referenced from | |
| # the template by location. E.g., 'footer', 'left_nav'. You can also create single-item lists for special purpose links/buttons, | |
| # such a privacy_policy or homepage_cta. This helps to reduce hard coding in templates. | |
| # NavigationMenuItem mixes in some different link types (Page, Document, URL) and presents them in a consistent way. It provides | |
| # the ability to override the title of the referenced object. |
| ''' | |
| A python script which starts celery worker and auto reload it when any code change happens. | |
| I did this because Celery worker's "--autoreload" option seems not working for a lot of people. | |
| ''' | |
| import time | |
| from watchdog.observers import Observer ##pip install watchdog | |
| from watchdog.events import PatternMatchingEventHandler | |
| import psutil ##pip install psutil | |
| import os |
| #Download dwebp (WebP decoder tool) https://developers.google.com/speed/webp/download | |
| #Run | |
| for %f in (*.webp) do dwebp.exe "%f" -o "%~nf.png" |