This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
""" Obtaining all form fields (dynamically) from a POST request. | |
$ curl http://127.0.0.1:8000/post -d "name=Nemo&country=Norway" | |
$ curl http://127.0.0.1:8000/data -d "company=Axos Inc.&business=IT Outsourcing" | |
""" | |
from flask import abort, Flask, jsonify, request | |
__author__ = "@ivanleoncz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Functions for obtaining network information from a system. """ | |
import subprocess as sp | |
__version__ = "v1.0" | |
__author__ = "@ivanleoncz" | |
def get_nic_ipv4(nic): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ivanlmj.myapp; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ req ] | |
default_bits = 2048 | |
distinguished_name = req_distinguished_name | |
attributes = req_attributes | |
prompt = no | |
[ req_distinguished_name ] | |
C = MX | |
ST = VE | |
L = XL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMMIT="d92b4247d671bc55723747a00314344a46e848e1" | |
COMMIT_ROLLBACK="807a95993b80db239bd1c24d3fbeb4bb265430be" | |
echo "[INFO]: listing files from commit $COMMIT and rolling back to $COMMIT_ROLLBACK, in 5 seconds" | |
sleep 5 | |
for file in `git show --pretty="" --name-only $COMMIT` ; do | |
echo " * $file" | |
git checkout $COMMIT_ROLLBACK $file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
global_lock = threading.Lock() | |
def write_to_file(): | |
while global_lock.locked(): | |
# Give 100ms in order to execute a next loop, if locked. | |
time.sleep(0.1) | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import faulthandler | |
faulthandler.enable() | |
# Your code starts here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On local environemnt: loaded via python-dotenv. | |
# On Cloug FUnction: defined on Environment Variables section and automatically loaded for the Cloud Function. | |
DEFAULT_MESSAGE="You haven't provided a message." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, request | |
from jsonschema import Draft7Validator | |
app = Flask(__name__) | |
app.config["JSONIFY_PRETTYPRINT_REGULAR"] = True | |
schema = { | |
"type": "object", | |
"properties": { | |
"hospital": {"type": "string"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/python3 | |
""" Demonstration of logging feature for a Flask App. """ | |
from logging.handlers import RotatingFileHandler | |
from flask import Flask, request, jsonify | |
from time import strftime | |
__author__ = "@ivanleoncz" | |
import logging |