Skip to content

Instantly share code, notes, and snippets.

View Rub21's full-sized avatar
🐕

Ruben L. Mendoza Rub21

🐕
View GitHub Profile
@Rub21
Rub21 / gradientvideo.sh
Created December 30, 2020 14:02 — forked from coderofsalvation/gradientvideo.sh
add gradient with angle on top of video or image using ffmpeg
#!/bin/bash
[[ ! -n $5 ]] && echo "Usage: [ROTATE=90] gradientvideo <input.mp4> <r> <g> <b> <output.mp4>" && exit
set -x
[[ -n $ROTATE ]] && ROTATE=",scale=w=1.5*iw:h=1.5*ih,rotate=angle=$ROTATE"
ffmpeg -i "$1" -filter_complex "[0]split[v0][v1];[v0]format=rgba,geq=r=$2:g=$3:b=$4:a=255*(Y/H)$ROTATE[fg];[v1][fg]overlay=(W-w)/2:(H-h)/2:shortest=1" -q:v 2 "$5"
@Rub21
Rub21 / Difference between EPSG 4326 & 3857
Last active January 18, 2023 04:37 — forked from keum/Difference between EPSG 4326 & 3857
EPSG 4326 and EPSG 3857 of Web Mercator
EPSG: 4326 uses a coordinate system on the surface of a sphere or ellipsoid of reference.
WGS 84 - Earth as Geoid. -Mercator
EPSG: 3857 uses a coordinate system PROJECTED from the surface of the
sphere. Earth as perfectly sphere. -Web Mercator
Think of it as this way:
EPSG 4326 uses a coordinate system the same as a GLOBE (curved surface).
EPSG 3857 uses a coordinate system the same as a MAP (flat surface).
@Rub21
Rub21 / docker-cli-tips-and-tricks.md
Created August 21, 2018 15:00 — forked from BretFisher/docker-cli-tips-and-tricks.md
Docker CLI Tips and Tricks
@Rub21
Rub21 / Google protobuf installation on Mac
Last active February 19, 2018 13:58 — forked from rajkrrsingh/Google protobuf installation on Mac
Steps to Install google protobuf on Mac
wget https://github.com/google/protobuf/releases/download/v2.6.0/protobuf-2.6.0.tar.bz2
tar xvf protobuf-2.6.0.tar.bz2
cd protobuf-2.6.0
./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
make -j 4
sudo make install
protoc --version
@Rub21
Rub21 / python_environment_setup.md
Created January 17, 2018 14:37 — forked from wronk/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a manager like Anaconda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant cloud
@Rub21
Rub21 / README.md
Created December 11, 2017 16:18 — forked from danswick/README.md
Mapbox GL JS labels on top of radar raster

A Mapbox GL JS demo that creates a layer from a third-party tiles source and draws it below the Mapbox Style's label layers. Layers in the Mapbox GL Style Spec draw in the order in which they're listed in the layers array.

Look for the following in the style JSON below:

"sources": {
        "mapbox": {
            "url": "mapbox://mapbox.mapbox-streets-v7",
            "type": "vector"
 }, 
@Rub21
Rub21 / slugify.js
Created September 27, 2017 04:50 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Rub21
Rub21 / node-folder-structure-options.md
Created September 18, 2017 02:33 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@Rub21
Rub21 / 01-directory-structure.md
Created September 18, 2017 02:30 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@Rub21
Rub21 / index.html
Last active January 17, 2017 17:10 — forked from tmcw/index.html
tomar imagen del mapa.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Leaflet Image</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }