Skip to content

Instantly share code, notes, and snippets.

View rodrigoespinozadev's full-sized avatar
🏠
Working from home

Rodrigo Espinoza rodrigoespinozadev

🏠
Working from home
View GitHub Profile
@rodrigoespinozadev
rodrigoespinozadev / wildcard-ssl-cert-for-testing-nginx-conf.md
Created April 22, 2019 16:23 — forked from sr75/wildcard-ssl-cert-for-testing-nginx-conf.md
create a self signed wildcard ssl cert for testing with nginx.conf example

just change out app_name for your purposes

openssl genrsa 2048 > app_name-wildcard.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key app_name-wildcard.key > app_name-wildcard.cert

# Common Name (eg, your name or your server's hostname) []:*.app_name.com

openssl x509 -noout -fingerprint -text < app_name-wildcard.cert > app_name-wildcard.info
import { Permissions, Location, TaskManager, Notifications } from 'expo'
import axios from 'axios'
export const BACKGROUND_LOCATION_UPDATES_TASK = 'background-location-updates'
export const BACKGROUND_GEOFENCING_UPDATES_TASK = 'background-geofencing-updates'
const geofences = [] //I get this from the server, omitted for sake of clarity
const url = 'api.metoo.io'
TaskManager.defineTask(BACKGROUND_LOCATION_UPDATES_TASK, handleLocationUpdate)
TaskManager.defineTask(BACKGROUND_GEOFENCING_UPDATES_TASK, handleGeofencingUpdate)

newmotion api

An charging system in Finagle with Scala

Introduction

Charging System API built using Finagle with Scala.

Libraries:

@rodrigoespinozadev
rodrigoespinozadev / nginx-and-certbot-config.md
Created April 5, 2019 18:42 — forked from rkaramandi/nginx-and-certbot-config.md
Running NGINX and CertBot Containers on the Same Host

Running NGINX and CertBot Containers on the Same Host

The Problem

A lot of people run into the problem of running Let's Encrypt's CertBot Tool and an NGINX on the same container host. A big part of this has to do with CertBot needing either port 80 or 443 open for the tool to work as intended. This tends to conflict with NGINX as most people usually use port 80 (HTTP) or 443 (HTTPS) for their reverse proxy. Section 1 outlines how to configure NGINX to get this to work, and Section 2 is the Docker command to run CertBot.

1. NGINX Configuration

I use Docker Compose (docker-compose) for my NGINX server. My docker-compose.yml file looks something like this:

Inside the docker container, run script /dev/null first. Then you should be able to start screen.
@rodrigoespinozadev
rodrigoespinozadev / docker-image-size.sh
Last active March 22, 2019 16:18 — forked from andyrbell/docker-image-size.sh
Sort docker images by size desc
#!/bin/sh
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t
docker images --format '{{.Size}}\t{{.Repository}}' | sort -r
docker images --format '{{.Size}}\t{{.Repository}}' | sort -h
docker images --format '{{.Size}}\t{{.Repository}}:{{.Tag}}\t{{.ID}}' | sort -h | column -t
@rodrigoespinozadev
rodrigoespinozadev / .gitignore
Created March 9, 2019 08:03 — forked from maxcnunes/.gitignore
Git keep empty folder: 1. Add a .gitkeep file inside the folder you want to keep 2. Then include this configuration in your .gitignore
path_your_folder/*
!path_your_folder/.gitkeep
version: '3'
services:
nginx:
image: awsdemo-nginx:latest
ports:
- "80:80"
volumes:
- static_volume:/usr/src/app/staticfiles
- media_volume:/usr/src/app/mediafiles
@rodrigoespinozadev
rodrigoespinozadev / docker.sh
Created March 6, 2019 20:06 — forked from monkeym4ster/docker.sh
Docker: save/load container using tgz file (tar.gz)
#for not running docker, use save:
docker save <dockernameortag> | gzip > mycontainer.tgz
#for running or paused docker, use export:
docker export <dockernameortag> | gzip > mycontainer.tgz
#load
gunzip -c mycontainer.tgz | docker load
@rodrigoespinozadev
rodrigoespinozadev / preg_match_array.php
Created January 31, 2019 19:30 — forked from mbunge/preg_match_array.php
preg_match over given array with a defined pattern
<?php
/**
* preg_match over given array with a defined pattern
*
* Example:
*
* $names = array(
* 'hans',
* 'dieter',
* 'peter',