Skip to content

Instantly share code, notes, and snippets.

@4rzael
4rzael / main.md
Last active April 25, 2024 04:41
GIS with pySpark.
NOTE : Take a look at the comments below !

GIS with pySpark : A not-so-easy journey

Why would you do that ?

Today, many datas are geolocalised (meaning that they have a position in space). They're named GIS datas.

It's not rare that we need to do operations on those, such as aggregations, and there are many optimisations existing to do that.

function long2tile(lon,zoom) {
return (((lon+180)/360*Math.pow(2,zoom)));
}
function lat2tile(lat,zoom) {
return (((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom)));
}
function tile2long(x,z) {
return (x/Math.pow(2,z)*360-180);
}
function tile2lat(y,z) {
@eritiro
eritiro / Gemfile
Created August 25, 2015 12:37
Working Gemfile for rails 5 app (alpha version)
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.0.alpha', git: "https://github.com/rails/rails"
gem 'rack', '~> 2.x', git: "https://github.com/rack/rack"
gem 'arel', git: "https://github.com/rails/arel"
gem 'rack-test', git: 'https://github.com/brynary/rack-test'
gem 'sprockets', github: 'rails/sprockets', branch: 'master'
@ju2wheels
ju2wheels / docker-compose.yml
Created June 10, 2015 20:11
docker-compose reference YAML file with comments
# https://docs.docker.com/compose/yml/
# Each service defined in docker-compose.yml must specify exactly one of
# image or build. Other keys are optional, and are analogous to their
# docker run command-line counterparts.
#
# As with docker run, options specified in the Dockerfile (e.g., CMD,
# EXPOSE, VOLUME, ENV) are respected by default - you don't need to
# specify them again in docker-compose.yml.
#
service_name:
@UnaNancyOwen
UnaNancyOwen / PCL1.10.0.md
Last active March 28, 2025 12:57
Building PCL with Visual Studio
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@akdetrick
akdetrick / rvm-to-rbenv.md
Last active March 23, 2025 14:51
Guide to switching to rbenv bliss from RVM hell

RVM to rbenv

Why? @sstephenson explains it best here.


1) remove RVM from your system

This should get rid of the rvm dir and any installed rubies:

$ rvm implode
@martijnvermaat
martijnvermaat / gitlab-ipython-notebook.md
Last active February 22, 2025 11:02
View IPython notebooks in GitLab

Viewing IPython notebooks in GitLab

GitLab is open source software to collaborate on code (a GitHub clone to run on your own server). Clicking a blob (a file in a repository) in GitLab shows a nice rendering if GitLab supports the file type (e.g., images, Markdown documents), or its content as plain text otherwise. The patch described here adds support to GitLab for rendering IPython notebooks (.ipynb files).

@chrisyour
chrisyour / development.rb
Created September 9, 2013 21:47
Limit the size of your development.log and test.log files in your Rails 4 and Rails 3 apps.
# Add this to config/environments/development.rb
# Limit your development log file to 5 MB
config.logger = Logger.new(config.paths["log"].first, 1, 5242880) # 5 megabytes
@kinverarity1
kinverarity1 / loaded_modules.py
Last active June 3, 2020 13:05
List loaded Python modules and packages, and show their version numbers and/or Git repository's HEAD commit SHA. Example: http://nbviewer.ipython.org/6038316/zz_example.ipynb
'''List loaded modules and packages, and show their version numbers
and/or Git repository's HEAD commit SHA.
'''
# Standard library modules
import types
# Third-party packages
import git # GitPython