Skip to content

Instantly share code, notes, and snippets.

View dario61081's full-sized avatar
🎯
Focusing

Dario Garcia dario61081

🎯
Focusing
View GitHub Profile
@dario61081
dario61081 / rest-server.py
Created November 26, 2016 11:57 — forked from miguelgrinberg/rest-server.py
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@dario61081
dario61081 / html2pdf.py
Created May 31, 2017 20:22 — forked from philfreo/html2pdf.py
A Flask view that returns HTML or generates a PDF
import mimerender
mimerender.register_mime('pdf', ('application/pdf',))
mimerender = mimerender.FlaskMimeRender(global_charset='UTF-8')
def render_pdf(html):
from xhtml2pdf import pisa
from cStringIO import StringIO
pdf = StringIO()
pisa.CreatePDF(StringIO(html.encode('utf-8')), pdf)
@dario61081
dario61081 / dynamic_blueprints.py
Created July 23, 2017 12:35 — forked from jtratner/dynamic_blueprints.py
Dynamic blueprints flask pseudocode
import os
PATH = path/to/my/blueprints/directory
BLUEPRINT = 'the_blueprint'
def import_file(path, name=None):
""" imports a file with given name and path """
# use the imp module to do actual imports
import imp
name = name or os.path.split(path)[-1].replace(".", "_")
@dario61081
dario61081 / send_sms.py
Created July 16, 2018 03:49 — forked from m0rff/send_sms.py
Sending a SMS with Python and pyserial via an USB 3G Modem on pfSense/FreeBSD
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
# Sending a SMS with Python and pyserial via an USB 3G Modem on pfSense/FreeBSD
# tested with: Huawei Technologies Co., Ltd. E620 USB Modem
# and a Telekom SIM card
import serial
from curses import ascii
import time
@dario61081
dario61081 / numero_letras.py
Last active March 26, 2020 10:28 — forked from efrenfuentes/numero_letras.py
Numero a letras (Python)
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'efrenfuentes'
MONEDA_SINGULAR = 'guarani'
MONEDA_PLURAL = 'guaranies'
CENTIMOS_SINGULAR = 'centimo'

Installation of bind9

apt install bind9

Create a virtual interface (eth0:1)

Note: i have the IP : 192.168.1.109 by DHCP

edit the network settings file

@dario61081
dario61081 / docker-api-port.md
Created September 18, 2020 17:13 — forked from styblope/docker-api-port.md
Enable TCP port 2375 for external connection to Docker

Enable TCP port 2375 for external connection to Docker

See this issue.
Docker best practise to Control and configure Docker with systemd.

  1. Create daemon.json file in /etc/docker:

     {"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}
    
@dario61081
dario61081 / Config PyCharm
Created September 21, 2020 16:04 — forked from Jamp/Config PyCharm
Configure for pycharm auto compile sass
First "gem install sass" on console
Go Menu File > Settings > Tools > File Watch > "+" > "sass"
On New Window > Section Watcher Settings
Program: /<home-directory>/.gem/ruby/2.5.0/bin/sass
Arguments: --no-cache --update --no-cache --update $FileName$:../css/$FileNameWithoutExtension$.css --style compressed
Compile sass file on folder css on file minified
@dario61081
dario61081 / Android.mk
Created December 2, 2020 02:00 — forked from kanru/Android.mk
Android GPS using libhardware
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
gps_test.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils libhardware
LOCAL_MODULE:= test-gps