Skip to content

Instantly share code, notes, and snippets.

View mariomartinezsz's full-sized avatar

Mario Martínez Sánchez mariomartinezsz

View GitHub Profile
module ProtobufSerializationTests
open System
open System.IO
open ProtoBuf
open Xunit
module ProtoBufUtils =
[<ProtoContract>]
@mariomartinezsz
mariomartinezsz / postgis_geojson.php
Created June 14, 2019 04:38 — forked from bmcbride/postgis_geojson.php
PHP PostGIS to GeoJSON
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geotable The PostGIS layer name *REQUIRED*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
@mariomartinezsz
mariomartinezsz / install_composer_on_ubuntu.md
Last active July 28, 2018 05:24
Install Composer on Ubuntu
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
php -r "unlink('composer-setup.php');"
composer --version

More info

Composer official download site.

@mariomartinezsz
mariomartinezsz / install-anaconda-ubuntu.md
Last active July 28, 2018 05:18
Install Anaconda on Ubuntu
cd ~
wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
bash Anaconda3-5.1.0-Linux-x86_64.sh -b -p ~/anaconda
rm Anaconda3-5.1.0-Linux-x86_64.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc

# Refresh
source .bashrc 
@mariomartinezsz
mariomartinezsz / add_rust_to_ubuntu_path.md
Last active July 28, 2018 05:19
Add Rust to PATH on Ubuntu
echo 'export PATH=$PATH:$HOME/.cargo/bin' >> ~/.bashrc
@mariomartinezsz
mariomartinezsz / flisolrule_ventana_modal.html
Created April 4, 2018 14:17
Detalle de ventana modal para el website del Flisol El Rule
<div class="col-md-4 col-sm-6">
<div class="schedule-box">
<div class="time">
<time datetime="10:30"></time> - <time datetime="11:00"></time>
</div>
<h3 class="h3-sp">Wordpress, más que Blogs</h3>
<p>Instructor: Rodrigo Patiño</p>
<a class="btn btn-white" href="#" data-toggle="modal" data-target="#modalWordpressMasqueBlogs">Más info</a>
</div>
@mariomartinezsz
mariomartinezsz / venv_on_ubuntu.md
Last active July 16, 2017 21:10
Virtual environments for Python 3 on Ubuntu

Virtual environments for Python 3 on Ubuntu

Install venv:

sudo apt-get install python3-venv

Create a virtual environment:

python3 -m venv env_name
@mariomartinezsz
mariomartinezsz / install_r_rstudio_xenial64.sh
Last active June 20, 2017 17:20
Instalación de R y RStudio en Linux (distribuciones basadas en Ubuntu 16.04 Xenial) 64-bit
#!/bin/sh
# Script para instalar R y RStudio en Ubuntu 16.04 Xenial de 64-bit
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E084DAB9
sudo add-apt-repository 'deb https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
@mariomartinezsz
mariomartinezsz / distance_calculator.ts
Last active June 16, 2017 18:27
Calculate distance between Latitude/Longitude points. This uses the 'haversine' formula to calculate the great-circle distance between two points.
// Calculate distance between Latitude/Longitude points
// This uses the ‘haversine’ formula to calculate the great-circle distance between two points.
// Sources:
// http://www.movable-type.co.uk/scripts/latlong.html
// https://stackoverflow.com/questions/27928/calculate-distance-between-two-latitude-longitude-points-haversine-formula
// Distance in km
function deg2rad(deg): number {
return deg * (Math.PI/180);
@mariomartinezsz
mariomartinezsz / is_prime.rs
Last active June 1, 2017 13:59
Primality Test v1 with Rust (School Method)
// Time complexity of this solution is O(√n)
fn is_prime(n : i32) -> bool {
if n <= 1 {
return false;
}
for i in 2..n-1{
if n%i == 0 {
return false;