Skip to content

Instantly share code, notes, and snippets.

View ejherran's full-sized avatar

Edison Javier Herran Cortes ejherran

View GitHub Profile
package main
import (
"fmt"
"math/rand"
"time"
)
type Unit struct {
value int32
cantidad = int(input("Cantidad a comprar:\t\t"))
compra = float(input("Precio de compra:\t\t"))
venta = float(input("Precio de venta:\t\t"))
try:
ingreso = float(input("Margend de ganancia (20%):\t")) / 100
except:
ingreso = 0.2
diferencia = venta-compra
import numpy as np
import math
import time
# General data accumulator.
BUFFER = []
# Sets decimal precision to 10 digits, using truncation.
def fix(v):
return np.around(v, decimals=10)
import numpy as np
# Sets decimal precision to 10 digits, using truncation.
def fix(v):
return np.around(v, decimals=10)
def main(args):
# Multiplying a number by this factor is the equivalent of dividing it by 10 ^ 6
FACTOR = 0.000001
TARGETS:
KIC 10338279:
FILE: "./KIC10338279.csv"
#############
### STAR INFO
#############
STAR:
MASS: 0.778
MASS_LOWER_ERROR: 0.052999973
#MASS_UPPER_ERROR:
TARGETS:
KIC 4570326:
FILE: "./KIC4570326.csv"
##############
### STAR INFO
##############
STAR:
MASS: 1.620
MASS_LOWER_ERROR: 0.2210000705719
MASS_UPPER_ERROR: 0.061999921798706
TARGETS: # Targets of the process
KIC 8197761: # Target Star
FILE: "./KIC8197761.csv" # Lightcurve source file
#############
### STAR INFO
#############
STAR:
MASS: 1.384
# MASS_LOWER_ERROR: 0.27
@ejherran
ejherran / client.c
Created October 12, 2017 04:09
Arduino Ethernet Test Web Client
#include <EtherCard.h>
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; // Mac de la tarjeta ether... Debe ser unico en la red local
const static uint8_t ip[] = {10,14,0,56}; // Ip de la tarjeta
const static uint8_t gw[] = {10,14,0,1}; // Ip de la puerta de enlace
const static uint8_t mask[] = {255,255,255,0}; // Mascara de la tarjea
const static uint8_t dns[] = {10,14,0,1}; // Ip del servidor DNS, si existe
const static uint8_t hisip[] = {10,14,0,104}; // Ip de la aplicacion remota
const static int hisport = 8080; // Puerto de la aplicacion remota
@ejherran
ejherran / echo_server.py
Created October 12, 2017 04:08
Get Echo Server
import cherrypy
import json
class HelloWorld(object):
@cherrypy.expose
def index(self, data):
size = len(data)
@ejherran
ejherran / naval.py
Created August 26, 2017 04:51
Astucia naval, con arreglos. Concepto
import random as rnd
class Naval():
def __init__(self):
self.tabM = Naval.createBoard(8, 8, "·") # Tableros
self.tabJ = Naval.createBoard(8, 8, "·")
self.barM = [] # Barcos