Skip to content

Instantly share code, notes, and snippets.

View edmon1024's full-sized avatar
💭
hello world!!!

Edmundo Andrade edmon1024

💭
hello world!!!
View GitHub Profile
@edmon1024
edmon1024 / Dockerfile
Created March 29, 2019 09:00
dockerfile php
FROM php:7.3.3-cli-alpine3.9
COPY . /usr/src/hello-world
WORKDIR /usr/src/hello-world
CMD [ "php", "./index.php" ]
@edmon1024
edmon1024 / index.php
Last active March 29, 2019 08:43
hello world php
<html>
<head>
<title>Prueba de PHP</title>
</head>
<body>
<?php echo '<p>Hola Mundo</p>'; ?>
</body>
</html>
@edmon1024
edmon1024 / prometheus.yml
Created March 11, 2019 05:05
Prometheus
# Configuraciones globales
global:
scrape_interval: 15s # El intervalo de tiempo en el que se extraen las métricas. Default 1 minuto.
evaluation_interval: 15s # El intervalo de tiempo en el que se evaluarán las métricas en busca de coincidencias, sólo si se tienen reglas configuradas.
# Alertmanager - configuración de los objetivos a donde se mandan las alertas #cuando coincide una regla
# (En este momento no tenemos ningún objetivo configurado)
alerting:
alertmanagers:
- static_configs:
groups:
- name: datetime
rules:
- record: daily_saving_time_belgium
expr: |
(vector(0) and (month() < 3 or month() > 10))
or
(vector(1) and (month() > 3 and month() < 10))
or
(
@edmon1024
edmon1024 / gist:c96c831a3a6b4042c35bc4bb3690cfd4
Created February 5, 2019 03:11 — forked from thinkphp/gist:5110833
Creating sha-1 on Node.js.
var crypto = require('crypto');
function sha1( data ) {
var generator = crypto.createHash('sha1');
generator.update( data )
return generator.digest('hex')
}
console.log( sha1('adrian') )
@edmon1024
edmon1024 / basic_auth_nodejs_test.js
Created February 5, 2019 03:10 — forked from charlesdaniel/basic_auth_nodejs_test.js
Example of HTTP Basic Auth in NodeJS
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);
@edmon1024
edmon1024 / joins.py
Created January 28, 2019 10:53 — forked from nickretallack/joins.py
How do I do a join without a real foreign key constraint?
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey, Integer, String, ForeignKeyConstraint
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, relationship
Model = declarative_base()
class Parent(Model):
__tablename__ = 'parent'
id = Column(Integer, primary_key=True)
@edmon1024
edmon1024 / M2M_Association_SQLalchemy.py
Created January 28, 2019 10:52 — forked from SuryaSankar/M2M_Association_SQLalchemy.py
An example of a many to many relation via Association Object in SQLAlchemy
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
import uuid
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()
@edmon1024
edmon1024 / main.yaml
Created January 24, 2019 19:50 — forked from kbariotis/main.yaml
Ansible playbook for deploying a Node.js app to DigitalOcean
- name: DO
hosts: localhost
vars:
project_name: "PUT A NAME FOR YOUR PROJECT HERE"
do_token: "PUT YOUR DIGITAL OCEAN API KEY HERE ==> https://cloud.digitalocean.com/settings/api/tokens"
repository: "PUT YOUR REPOSITORY URL HERE"
tasks:
- name: LOCAL | Generate SSH key
shell: ssh-keygen -b 2048 -t rsa -f ~/.ssh/{{project_name}} -q -N ""
@edmon1024
edmon1024 / node-exporter
Last active February 13, 2019 09:24 — forked from wallentx/node-exporter
node-exporter init script for Amazon AMI/RHEL to be used with systemv. Place in /etc/init.d/ and ensure that line 12 matches your path
#!/bin/bash
#
#
#
# Start on runlevels 3, 4 and 5. Start late, kill early.
# chkconfig: 345 95 05
#
#
#!/bin/bash