Skip to content

Instantly share code, notes, and snippets.

@edgardo001
edgardo001 / UUID.php
Created April 12, 2019 16:04 — forked from dahnielson/UUID.php
Pure PHP UUID generator
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@edgardo001
edgardo001 / GoogleAuthenticationCurl.sh
Created March 18, 2019 21:36 — forked from LindaLawton/GoogleAuthenticationCurl.sh
Curl bash script for getting a Google Oauth2 Access token
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
curl \
@edgardo001
edgardo001 / RestCrudHttpd.java
Created February 7, 2019 12:13 — forked from downgoon/RestCrudHttpd.java
Simple RESTful API using vertx-web
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServer;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.Router;
public class RestCrudHttpd {
@edgardo001
edgardo001 / create_and_restore_backup.md
Created January 3, 2019 19:55 — forked from johanvergeer/create_and_restore_backup.md
Create and replace database backup in Docker

Create and restore a database backing using Docker

This script is intended to demonstrate how a backup can be created and restored using Docker containers. The image we'll use is SQL Server 2017

The scripts are baed on the official Microsoft documentation

Create a new container and volume

Create a new container from the mssql-server-linux image

@edgardo001
edgardo001 / self-signed-certificate-with-custom-ca.md
Created January 2, 2019 14:25 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@edgardo001
edgardo001 / new_task.py
Created December 21, 2018 17:48 — forked from quiver/new_task.py
rabbitmq : dead letter exchange example with python/pika
#!/usr/bin/env python
# http://www.rabbitmq.com/tutorials/tutorial-two-python.html
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
message = ' '.join(sys.argv[1:]) or "Hello World!"
@edgardo001
edgardo001 / receive.py
Created December 19, 2018 18:14 — forked from tomas-stefano/receive.py
RabbitMQ example in Python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
def callback(ch, method, properties, body):
print "[x] Received: %r" % (body,)
channel.basic_consume(callback, queue='hello', no_ack=True)
@edgardo001
edgardo001 / Python3 HTTP Server.py
Created November 21, 2018 14:37 — forked from Integralist/Python3 HTTP Server.py
Python3 HTTP Server.py
import time
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000
class MyHandler(BaseHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)
@edgardo001
edgardo001 / pointshapefinder.py
Created August 23, 2018 15:51 — forked from sergiolucero/pointshapefinder.py
point in geometry
import geopandas
import pandas as pd
from shapely.geometry import Point
gdf = gp.read_file('http://quant.cl/static/DATA/GEO/comunas13.json')
rand = pd.np.random.randn
points=[Point((-70.7+0.1*rand(),-33.4+0.1*rand())) for _ in range(10)]
for point in points:
for cid,comuna in gdf.iterrows():
@edgardo001
edgardo001 / backup-all-docker-images.sh
Created July 24, 2018 12:47 — forked from jrenggli/backup-all-docker-images.sh
Backup/Save all Docker Images to a compressed file
docker images | tail -n +2 | grep -v "none" | awk '{printf("%s:%s\n", $1, $2)}' | while read IMAGE; do
echo $IMAGE
filename="${IMAGE//\//-}"
filename="${filename//:/-}.docker-image.gz"
docker save ${IMAGE} | pigz --stdout --best > $filename
done