The simplest way to start using SQLite is to download a precompiled binary from the
The latest version of SQLite at the time of writing is 3.8.9, but you can check for additional updates on the SQLite download page.
import requests | |
import shutil | |
from bs4 import BeautifulSoup | |
BASE_URL = "http://www.facet.la/wallpapers/" | |
r = requests.get(BASE_URL) | |
soup = BeautifulSoup(r.text) | |
# Loop through all images on the base thumbnail site |
#!/usr/bin/env python | |
import string | |
DICT_FILE = '/usr/share/dict/words' | |
def get_matches(word, guess): | |
word_set = set([c for c in word]) | |
guess_set = set([c for c in guess]) | |
return len(word_set.intersection(guess_set)) |
# !/usr/bin/env python | |
# coding: utf-8 | |
# http://en.wikipedia.org/wiki/Tower_of_Hanoi#Binary_solution | |
def iterative_hanoi(n): | |
# Optimal play will result in (2^n)-1 moves. This is a pretty fun proof! | |
total_moves = pow(2, n) - 1 | |
for i in range(total_moves): | |
start = (i & i+1) % 3 | |
end = ((i | i+1)+1) % 3 |
"""Fixes newline endings created in Windows. Run in Unix.""" | |
for i in range(1, 17): | |
output_path = '../output{}.txt'.format(i) | |
with open(output_path, 'r') as output_file: | |
sequence = output_file.readline().strip() | |
with open(output_path, 'w') as output_file: | |
output_file.write(sequence + '\n') |
Here's the current folder hierarchy: | |
- run.py | |
- util/ | |
- __init__.py | |
- entry.py | |
- winrate.py | |
Let's say winrate.py straight up imports entry: |
def copy(lst): | |
"""Returns a copy of the linked list.""" | |
if lst.rest is Link.empty: | |
return Link(lst.first) | |
else: | |
return Link(lst.first, copy(lst.rest)) | |
def repeat(lst, n): | |
if n == 0: | |
return Link.empty |
from bs4 import BeautifulSoup | |
import json | |
def main(): | |
with open('messages.htm', 'r') as infile: | |
soup = BeautifulSoup(infile) | |
bchus = [] |
The simplest way to start using SQLite is to download a precompiled binary from the
The latest version of SQLite at the time of writing is 3.8.9, but you can check for additional updates on the SQLite download page.
import string | |
def fix(s): | |
return s.strip().lower().translate(string.maketrans('', ''), string.punctuation) | |
print(fix(" He@#@LL%^O WorL@#D@$")) | |
Promise = require 'bluebird' | |
bcrypt = Promise.promisifyAll(require 'bcrypt') | |
bookshelf = require 'app/utils/db' | |
logger = require 'app/utils/logger' | |
User = bookshelf.Model.extend | |
tableName: 'users' | |
hasTimestamps: ['createdAt', 'updatedAt'] |