Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
__version__ = "0.00001"
import sys
import optparse
try:
import Foundation
import WebKit
@crofty
crofty / index.html
Last active October 22, 2021 08:24
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@jpetazzo
jpetazzo / README.md
Last active October 12, 2023 09:09
Manual custom geocoding using OSM database

Someone asked how to get the latlong from a specific road near a town on OpenStreetMap.

If you need to do it only once (e.g., you're about to go on a trip, and your GPS cannot find your destination city, but allows you to enter GPS coordinates), you can use Nominatim, OpenStreetMap's geocoding interface.

If you need to do it multiple times, in a programmatic manner, there are at least two ways to do that.

Note: I worked with OSM data a couple of years ago, but I don't have an OSM database on my local laptop right now, so some instructions will be a bit fuzzy. I do apologize in advance.

PostGIS queries on a local OSM DB

@crofty
crofty / README.md
Last active November 21, 2019 02:45
Tracking Vehicles

This shows the movement of 330 vehicles travelling round the UK & Ireland over a 24hr period.

More

@codinguncut
codinguncut / gist:c4359d9bc6f36549b625
Last active October 26, 2017 15:29
kaggle collection
  1. feature engineering (most important by far)!!!!!
  2. simple models
  3. overfitting leaderboard
  4. ensembling
  • predict the right thing!
  • build pipeline and put something on the leaderboard
  • allocate time to play with data, explore
  • make heavy use of forums
  • understand subtleties of algos, know what tool to use when
@mrkwjc
mrkwjc / cuspsolve.py
Last active November 28, 2022 09:49
CUDA vs. CPU sparse solver in Python
# ### Interface cuSOLVER PyCUDA
from __future__ import print_function
import pycuda.gpuarray as gpuarray
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
import scipy.sparse as sp
import ctypes
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active September 13, 2023 03:34
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@disarticulate
disarticulate / angularjs_notebook.ipynb
Last active March 31, 2022 07:16
A notebook demonstrating how to use arbitrary frameworks (ie, AngularJS) within Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wassname
wassname / dice_loss_for_keras.py
Created September 26, 2016 08:32
dice_loss_for_keras
"""
Here is a dice loss for keras which is smoothed to approximate a linear (L1) loss.
It ranges from 1 to 0 (no error), and returns results similar to binary crossentropy
"""
# define custom loss and metric functions
from keras import backend as K
def dice_coef(y_true, y_pred, smooth=1):