Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
from __future__ import with_statement | |
import random | |
def create_chain(file_paths): | |
markov_chain = {} | |
word1 = "\n" | |
word2 = "\n" | |
for path in file_paths: | |
with open(path) as file: | |
for line in file: |
import sublime, sublime_plugin | |
import os, commands | |
import json, re | |
import pprint | |
""" TODO: | |
- have settings file with username/password/additional flags? | |
- options menu, per file/folder commands |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
''' quick example showing how to attach a pdf to multipart messages | |
and then send them from SES via boto | |
''' | |
from email.mime.text import MIMEText | |
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
import boto |
buildings = [ | |
[1, 11, 5], | |
[2, 6, 7], | |
[3, 13, 9], | |
[12, 7, 16], | |
[14, 3, 25], | |
[19, 18, 22], | |
[23, 13, 29], | |
[24, 4, 28], | |
] |
#! /usr/bin/env python | |
"""{escher} -- one-file key-value storage. | |
What? | |
This is a toy application to manage persistent key-value string data. | |
The file {escher} is *both* the application and its data. | |
When you run any of the commands below, the file will be executed and, | |
after data change, it will rewrite itself with updated data. | |
You can copy the file with whatever name to create multiple datasets. |
/* | |
* Copyright (c) 2017 Emil Davtyan | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* "Software"), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to | |
* the following conditions: |
Prerequisites:
Software components used:
# Simple Recommendation Engine in Ruby | |
# Visit: http://otobrglez.opalab.com | |
# Author: Oto Brglez <otobrglez@gmail.com> | |
class Book < Struct.new(:title) | |
def words | |
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort | |
end |