start new:
tmux
start new with session name:
tmux new -s myname
class Person (db.Document): | |
name = db.StringField(required=True) | |
created_date = db.ComplexDateTimeField(default=datetime.datetime.utcnow(), required=True) | |
def to_dict(self): | |
return helper.mongo_to_dict(self,[]) | |
#helper.py | |
def mongo_to_dict(obj, exclude_fields): |
# (C) Mathieu Blondel, November 2013 | |
# License: BSD 3 clause | |
import numpy as np | |
def ranking_precision_score(y_true, y_score, k=10): | |
"""Precision at rank k | |
Parameters |
Cython has two major benefits:
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.
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
calculate a weighted median | |
@author Jack Peterson ([email protected]) | |
""" | |
from __future__ import division | |
import numpy as np | |
def weighted_median(data, weights): |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore
is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules
directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file:
.gitignore
in your home directory and add any filepath patterns you want to ignore.Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute
.config/git/ignore
for.gitignore
in your home directory, if you prefer.
#include <cstddef> /* NULL */ | |
#include <metis.h> | |
#include <iostream> | |
// Install metis from: | |
// http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz | |
// Build with | |
// g++ metis.cc -lmetis |
;; make sure you've set your default project with: | |
;; gcloud config set project <project-name> | |
(require 'tramp) | |
(add-to-list 'tramp-methods | |
'("gcssh" | |
(tramp-login-program "gcloud compute ssh") | |
(tramp-login-args (("%h"))) | |
(tramp-async-args (("-q"))) | |
(tramp-remote-shell "/bin/sh") |