Skip to content

Instantly share code, notes, and snippets.

View cuahutli's full-sized avatar

Cuahutli Miguel Ulloa Robles cuahutli

View GitHub Profile
@cuahutli
cuahutli / app.py
Last active August 29, 2015 14:24 — forked from vgoklani/app.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index(chartID = 'chart_ID', chart_type = 'bar', chart_height = 350):
chart = {"renderTo": chartID, "type": chart_type, "height": chart_height,}
series = [{"name": 'Label1', "data": [1,2,3]}, {"name": 'Label2', "data": [4, 5, 6]}]
title = {"text": 'My Title'}
@cuahutli
cuahutli / flightplan-deploy.md
Created December 3, 2015 22:07 — forked from learncodeacademy/flightplan-deploy.md
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@cuahutli
cuahutli / gunicorn_start.bash
Created July 12, 2016 15:52 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
@cuahutli
cuahutli / weeks_months.py
Last active April 5, 2017 16:06
get week info (number week, first day of week, last day of week) current month and next month
import calendar
from datetime import datetime
def week_of_month(dt):
current_month = (dt.year,dt.month)
next_month = (dt.year +1,1) if dt.month==12 else (dt.year,dt.month + 1)
weeks_month = []
for year,month in [current_month, next_month]:
# -*- coding: utf-8 -*-
import requests
import json
import socket
DDNS_HOST = 'myhost.dyndns.org'
CHEKIP_URL = "http://thisisnt.com/api/getRemoteIp.php"
DDNS_UPDATE_URL = "https://members.dyndns.com/nic/update"
user = "myuser"
@cuahutli
cuahutli / create-vm.sh
Created August 11, 2017 22:33
Script para crear una VM con VirtualBox desde consola y acceso vía RDP activado
#!/bin/sh
VMNAME="virtserver"
ISO="PATH/TO/ISO"
VBOX_PATH="/PATH/TO/VirtualBox VMs/"
DIR_VM="$VBOX_PATH""$VMNAME"
HDD_VM="$DIR_VM/$VMNAME-disk1.vmdk"
echo "Creando directorio que almacenara la VM"
mkdir -p "$DIR_VM"
VBoxManage createvm -name "$VMNAME" --register --ostype Ubuntu_64
@cuahutli
cuahutli / settings.json
Created April 14, 2018 17:46
My Settings.json from visual studio code that allow activate python virtual enviroment automatically
{
"python.pythonPath": "${workspaceFolder}\\venv\\Scripts\\python.exe",
"terminal.integrated.shellArgs.windows": ["/K", "venv\\Scripts\\activate"],
}
@cuahutli
cuahutli / run.bat
Last active May 3, 2018 19:03
Open url in chrome with fullscreen mode
start /B wscript "run.vbs"
@cuahutli
cuahutli / Main.java
Created May 24, 2018 00:33 — forked from sergiougalde/Impresora.java
Imprimir con Java en una impresora de tickets Epson tmu 220 En muchos lugares se habla de como imprimir con Java en una epson tmu 220 , he encontrado mucho sobre y he encontrado muchas recomendaciones de usar epson java pos (http://www.javapos.com/devices.html) sin embargo si lo que se requiere es algo más simple aunque no tan potente es simplem…
impresora tiquete=new impresora();
tiquete.escribir(“ Esto es una linea “);
tiquete.escribir(“Esto es otra linea”);
tiquete.escribir(“Otra linea mas”);
//Esto es para escribir una linea divisoria
tiquete.dividir();
//esto cambia el formato de acuerdo a las especificaciones de epson
import sys
code = """
def f(x):
x = x + 1
print("Montamos la función on the fly")
return x
#print('This is my output.')
"""