| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ Small experiment with Python's operator overloading to add support for | |
| composing function with the pipe operator similar to Elixir's pipe operator. | |
| The main use case of such technique I see is to build isolated DSL. | |
| This approach uses decorators to achieve the given result which forces you | |
| to wrap all the functions you want to use this way. The runtime cost should | |
| be minimal however this might be a problem in some context. It also prevents you |
| import numpy as np | |
| from scipy.sparse import linalg, eye, csr_matrix | |
| from sklearn.preprocessing import normalize | |
| from sklearn.metrics.pairwise import pairwise_distances | |
| from collections import defaultdict | |
| class MarkovClustering: | |
| def __init__(self, matrix, metric="cosine", bias=1): |
| sudo apt-get remove \ | |
| aisleriot \ | |
| brltty \ | |
| duplicity \ | |
| empathy \ | |
| empathy-common \ | |
| example-content \ | |
| gnome-accessibility-themes \ | |
| gnome-contacts \ | |
| gnome-mahjongg \ |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:
- preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
- actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location
NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.
Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.
Cython has two major benefits:
- Making python code faster, particularly things that can't be done in scipy/numpy
- Wrapping/interfacing with C/C++ code
Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
| """ | |
| Simple xml serializer. | |
| @author Reimund Trost 2013 | |
| Example: | |
| mydict = { | |
| 'name': 'The Andersson\'s', | |
| 'size': 4, |