This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django.conf import settings | |
| from django.utils.encoding import force_unicode | |
| import redis | |
| class SessionStore(SessionBase): | |
| """ Redis store for sessions""" | |
| def __init__(self, session_key=None): | |
| self.redis = redis.Redis( |
| #! /usr/bin/env python | |
| import redis | |
| import random | |
| import pylibmc | |
| import sys | |
| r = redis.Redis(host = 'localhost', port = 6389) | |
| mc = pylibmc.Client(['localhost:11222']) |
| from selenium.webdriver import ActionChains | |
| class Select2(object): | |
| def __init__(self, element): | |
| self.browser = element.parent | |
| self.replaced_element = element | |
| self.element = browser.find_element_by_id( | |
| 's2id_{0}'.format(element.get_attribute('id'))) | |
| def click(self): |
| """ | |
| This file contains code that, when run on Python 2.7.5 or earlier, creates | |
| a string that should not exist: u'\Udeadbeef'. That's a single "character" | |
| that's illegal in Python because it's outside the valid Unicode range. | |
| It then uses it to crash various things in the Python standard library and | |
| corrupt a database. | |
| On Python 3... well, this file is full of syntax errors on Python 3. But | |
| if you were to change the print statements and byte literals and stuff: |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| from dateutil.parser import parse | |
| from pytz import utc | |
| datestr = 'Fri, 24 Apr 2015 14:49:32 -0400' | |
| dt = parse(datestr) | |
| utc_dt = dt.astimezone(utc) | |
| final = utc_dt.replace(tzinfo=None) |
| """ | |
| if we list all the natural numbers below 10 that are multiples of 3 or 5, we get | |
| 3, 5, 6 and 9. The sum of these multiples is 23. | |
| """ | |
| cap = 1000 | |
| total = 0 | |
| for i in range(1,cap): |
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.