- cd /var/www
- sudo django-admin startproject mysite
- sudo chown www-data:www-data -R mysite
- sudo chmod g+rw -R mysite
- cd mysite
- sudo pip install uwsgi
- python manage.py startapp polls
sudo xed /etc/nginx/sites-available/mysite
| <?xml version="1.0"?> | |
| <opencv_storage> | |
| <image_Width>1920.0</image_Width> | |
| <image_Height>1090.0</image_Height> | |
| <flagValue>14</flagValue> | |
| <Camera_Matrix type_id="opencv-matrix"> | |
| <rows>3</rows> | |
| <cols>3</cols> | |
| <dt>d</dt> | |
| <data> |
| import numpy as np | |
| if __name__=="__main__": | |
| X = np.ones((4, 4)) | |
| X[:, :2] = [[663, 706], [1303, 74], [2491, 1302], [2935, 747]] | |
| X[:, 2] = X[:, 0] * X[:, 1] | |
| lats = 50.777453115, 50.7856611742, 50.7704862, 50.778133 | |
| coeffLats = np.linalg.lstsq(X, lats)[0] |
| //Compile with: g++ test.cpp -lgeos_c -o test | |
| #include <geos_c.h> | |
| #include <stdio.h> | |
| void noticeFunc(const char *message, ...) | |
| { | |
| printf("notice: %s\n", message); | |
| } | |
| void errorFunc(const char *message, ...) |
sudo xed /etc/nginx/sites-available/mysite
| #Generating zero move nim game outcomes | |
| import copy | |
| def GenGames(piles, passes, turn, stateOptions, stateWins): | |
| options = [] | |
| nonZeroPiles = [] | |
| for i, p in enumerate(piles): | |
| if p > 0: |
| import math | |
| class SieveOfEratosthenes(object): | |
| def __init__(self, limit1, limit2 = None): | |
| if limit2 is None: | |
| self.lowerLimit = 2 | |
| self.upperLimit = limit1 | |
| else: | |
| if limit1 <= 1: | |
| raise RuntimeError("Lower limit must be at least 2") |
| #!/bin/python | |
| #Based on: EERTREE: An Efficient Data Structure for Processing Palindromes in Strings | |
| #by Mikhail Rubinchik and Arseny M. Shur https://arxiv.org/pdf/1506.04862.pdf | |
| #Useful: https://medium.com/@alessiopiergiacomi/eertree-or-palindromic-tree-82453e75025b#.ofgt2r7xn | |
| #Port of https://github.com/zimpha/algorithmic-library/blob/master/string-utility/eertree.cc | |
| #to python by TimSC. zimpha kindly allowed me to release this code under the CC0 license. | |
| from __future__ import print_function |
| #Dead end approach to https://www.hackerrank.com/challenges/stockprediction | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| import scipy.stats as stats | |
| fi = open("sample.txt", "rt") | |
| lis = fi.read().split("\n") | |
| stocks = {} | |
| for li in lis: |
| #By Tim Sheerman-Chase 2016 | |
| #Released under the CC0 license | |
| from __future__ import print_function | |
| import itertools, copy | |
| class RunningAverage(object): | |
| def __init__(self): | |
| self.Val = 0.0 | |
| self.Count = 0 |
| from __future__ import print_function | |
| def calc_board(limit = 9): | |
| board = {} | |
| board[(0,0)] = 0 | |
| posToCheck = set([(0,0)]) | |
| while len(posToCheck) > 0: | |
| posToCheck2 = set() | |
| for pos in posToCheck: |