This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def EqualizeHistogram(a, bins): | |
| a = np.array(a) | |
| hist, bins2 = np.histogram(a, bins=bins) | |
| #Compute CDF from histogram | |
| cdf = np.cumsum(hist, dtype=np.float64) | |
| cdf = np.hstack(([0], cdf)) | |
| cdf = cdf / cdf[-1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| # Filtering file https://data.gov.uk/dataset/7ec10db7-c8f4-4a40-8d82-8921935b4865/national-statistics-postcode-lookup-uk | |
| if __name__=="__main__": | |
| reader = csv.DictReader(open("/home/tim/Downloads/National_Statistics_Postcode_Lookup_UK.csv")) | |
| out = csv.DictWriter(open("natstats-po-postcodes.csv", "wt"), reader.fieldnames) | |
| out.writeheader() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #OS Codepoint file reader, by Tim Sheerman-Chase 2018 | |
| #Released under the CC0 license. | |
| import zipfile | |
| import csv | |
| import os | |
| import io | |
| #Get Code point open from https://www.ordnancesurvey.co.uk/business-and-government/products/code-point-open.html | |
| def ReadCodePoint(fi, callback): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #To write: curl http://localhost:8000/ --upload-file test.xml | |
| #and to read: curl http://localhost:8000/ | |
| from __future__ import print_function | |
| from __future__ import unicode_literals | |
| import sys | |
| if sys.version_info[0] >= 3: | |
| import http.server as httpserver | |
| import socketserver | |
| else: | |
| import BaseHTTPServer as httpserver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $fiLi = glob("/home/tim/Desktop/test/*.pdf"); | |
| while(true) | |
| { | |
| $i = array_rand($fiLi); | |
| if(!file_exists($fiLi[$i])) | |
| throw RuntimeError("File said not to exist"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Funky seamless texture generator | |
| #By Tim Sheerman-Chase (c) 2018 | |
| #Released under CC0 license | |
| from __future__ import print_function | |
| from PIL import Image | |
| import argparse | |
| if __name__=="__main__": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //simple msgpack-rpc server, based on Boost ASIO | |
| //Based on http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/tutorial/tutdaytime3/src.html | |
| //msgpack-rpc based on https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md | |
| //Build with: g++ -std=c++11 server.cpp -lboost_system -o server | |
| #include <iostream> | |
| #include <string> | |
| #include <boost/bind.hpp> | |
| #include <boost/shared_ptr.hpp> | |
| #include <boost/enable_shared_from_this.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| import os | |
| from scipy.misc import imread, imsave | |
| import numpy as np | |
| if __name__=="__main__": | |
| total = None | |
| fiLi = os.listdir(".") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // User API usage in OpenCart 3.0.2.0 | |
| // http://sv2109.com/en/article/opencart-api-system | |
| // Patches from https://forum.opencart.com/viewtopic.php?t=186063 need to be applied to 3.0.2.0 | |
| $apiKey = "foobar34y3yl34myl3erwhyl34yl3k4ynpwgen"; //Whatever you put in System -> Users -> API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import print_function | |
| import sys | |
| import requests | |
| from requests.auth import HTTPBasicAuth | |
| import xml.etree.ElementTree as ET | |
| PY3 = sys.version_info > (3, 0) | |
| if PY3: | |
| raw_input = input | |
| def GetChangesetBbox(cid): |