if you are using linux, unix, os x:
pip install -U setuptools
pip install -U pip
pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
# | |
# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS | |
# | |
# For any modifications to this file, see Kannel User Guide | |
# If that does not help, see Kannel web page (http://www.kannel.org) and | |
# various online help and mailing list archives | |
# | |
# Notes on those who base their configuration on this: | |
# 1) check security issues! (allowed IPs, passwords and ports) | |
# 2) groups cannot have empty rows inside them! |
from django.core.exceptions import PermissionDenied | |
from django.http import HttpResponse | |
from pyExcelerator import * | |
def export_as_xls(modeladmin, request, queryset): | |
""" | |
Generic xls export admin action. | |
usage:actions = [export_as_xls] |
""" | |
Two things are wrong with Django's default `SECRET_KEY` system: | |
1. It is not random but pseudo-random | |
2. It saves and displays the SECRET_KEY in `settings.py` | |
This snippet | |
1. uses `SystemRandom()` instead to generate a random key | |
2. saves a local `secret.txt` |
//simple_list_item_1 | |
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@android:id/text1" | |
style="?android:attr/listItemFirstLineStyle" | |
android:paddingTop="2dip" | |
android:paddingBottom="3dip" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content" /> | |
//simple_list_item_2 |
#One of those handy scripts, see:http://djangotricks.blogspot.co.ke/2013/12/how-to-export-data-as-excel.html | |
from .models import * | |
from django.http import * | |
""" | |
# Quick 'how-to' guide | |
# model in question | |
class Duplicate(models.Model): |
import urllib2 | |
""" | |
#Usage: | |
in a python shell | |
>> import get_pepperstone_data | |
>> get_pepperstone_data.run() | |
# Notes: | |
1: Selection of pairs is highly opinionated |
#List unique values in a DataFrame column | |
pd.unique(df.column_name.ravel()) | |
#Convert Series datatype to numeric, getting rid of any non-numeric values | |
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True) | |
#Grab DataFrame rows where column has certain values | |
valuelist = ['value1', 'value2', 'value3'] | |
df = df[df.column.isin(value_list)] |
if you are using linux, unix, os x:
pip install -U setuptools
pip install -U pip
pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
from scipy.spatial import Delaunay
import networkx as nx
points = [ [0,0],[0,50],[50,50],[50,0],[0,400],[0,450],[50,400],[50,450],[700,300],[700,350],[750,300],[750,350],
[900,600],[950,650],[950,600],[900,650]
]
def concave(points,alpha_x=150,alpha_y=250):
points = [(i[0],i[1]) if type(i) <> tuple else i for i in points]
de = Delaunay(points)
"""Information Retrieval metrics | |
Useful Resources: | |
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt | |
http://www.nii.ac.jp/TechReports/05-014E.pdf | |
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf | |
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf | |
Learning to Rank for Information Retrieval (Tie-Yan Liu) | |
""" | |
import numpy as np |