I hereby claim:
- I am edcrypt on github.
- I am edcrypt (https://keybase.io/edcrypt) on keybase.
- I have a public key whose fingerprint is AFBA B812 9AAB 1D6E F8E4 3120 718C 6D87 7DF2 FAD6
To claim this, I am signing this object:
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Simple async crawler/callback queue based on gevent.""" | |
import traceback | |
import logging | |
import httplib2 | |
import gevent |
function fish_prompt --description Based\ on\ \'Simple\ Pythonista\',\ displays\ GIT\ and\ Job\ count\ info\ as\ well. | |
set_color yellow | |
printf '%s' (whoami) | |
set_color normal | |
printf ' at ' | |
set_color magenta | |
printf '%s' (hostname|cut -d . -f 1) | |
set_color normal | |
printf ' in ' |
function fish_greeting --description "Greet the user with the shell's version, and a complementary colorful cow." | |
set_color --bold; fish -v; set_color normal | |
set cows cowsay\ {-b,-d,-g,-p,-s,t,-w,-y} | |
set chosen_cow_index (math (random)%8+1) | |
set chosen_cow $cows[$chosen_cow_index] | |
fortune -a -s | eval $chosen_cow | lolcat | |
end |
;; Fortune on scratch buffer | |
;; Add this to your ~/.emacs.d/init.el | |
(require 'fortune) | |
(setq fortune-dir "/usr/local/Cellar/fortune/9708/share/games/fortunes/") | |
(setq fortune-file "/usr/local/Cellar/fortune/9708/share/games/fortunes/") | |
(setq fortune-program "/usr/local/bin/fortune") | |
;; next two funcs from http://datko.net/2013/07/08/slight-enhancement-to-fortune-el/ | |
(defun fortune-message (&optional file) | |
"Display a fortune cookie to the mini-buffer. |
clear lock | |
clear control | |
clear mod1 | |
clear mod2 | |
clear mod3 | |
clear mod4 | |
clear mod5 | |
keycode 37 = Hyper_L | |
keycode 66 = Control_L | |
add control = Control_L Control_R |
I hereby claim:
To claim this, I am signing this object:
#Sample code | |
#Hello world | |
"Hello world!" print | |
#Factorial | |
factorial := method(n, if(n == 1, 1, n * factorial(n - 1))) | |
99 bottles of beer |
# There are a dozen ways to implement the Prototype/Properties Pattern in Python. | |
# | |
# You could use copy.copy(), or program with classes and classmethods only. | |
# for example. | |
# | |
# But if you want to use an existing library in this style, and don't want to loose | |
# Python's flexibility (multiple inheritance, etc) I believe this solution works best. | |
# | |
# Prototypes, in Pythonic terms, are objects that behave like instances and classes/types, | |
# unifying instantiation and inheritance. So the most obvious solution, even if wasteful, |
import pykka | |
class Prototype(pykka.ThreadingActor): | |
def __init__(self, *args, **kw): | |
import treedict | |
self.properties = treedict.TreeDict() | |
self.properties.pykka_traversable = True | |
super().__init__(*args, **kw) | |
def clone(self): | |
new_obj = Prototype.start().proxy() | |
new_obj.properties.attach(self.properties, copy=False).get() |