Skip to content

Instantly share code, notes, and snippets.

View hcastillaq's full-sized avatar

Hernan Castilla hcastillaq

View GitHub Profile
@hcastillaq
hcastillaq / script.py
Created August 13, 2018 19:28
Resolviendo ejercicio de programacion no linal con una sola restriccion y dos variables - python
from sympy import *
"""
recibe como parámetro un arreglo de soluciones,
las valida y retorna la solución, ignora soluciones con parte imaginaria
"""
def getSolution(data):
sol = None
#recorremos cada solucion del arreglo
for val in data:
@hcastillaq
hcastillaq / is_real.py
Created August 13, 2018 18:16
validar que una solución sea un numero real con sympy
"""
recibe como parámetro un arreglo de soluciones,
las valida y retorna la solución, retorna None para soluciones con parte imaginaria
"""
def getSolution(data):
sol = None
#recorremos cada solucion del arreglo
for val in data:
val = val.evalf() #evaluamos la solucion, nos deja un numero
#validamos que la solucion evaluada sea mayor que 0 y tambien un numero real
@hcastillaq
hcastillaq / txt
Created July 31, 2018 21:14
Restaurar el wifi en ubuntu
instalar sudo apt-get install linux-headers-generic build-essential git
git clone https://github.com/lwfinger/rtlwifi_new.git
cd rtlwifi_new
sudo make install
sudo modprobe -rv rtl8723be
sudo modprobe -v rtl8723be ant_sel=2
echo "options rtl8723be ant_sel=2" | sudo tee /etc/modprobe.d/50-rtl8723be.conf
@hcastillaq
hcastillaq / heart.html
Created December 20, 2017 15:33
heart drawing with p5js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body{
overflow: hidden;
@hcastillaq
hcastillaq / Captura de microfono - Efecto de sonido.html
Created December 15, 2017 15:09
Como capturar el microfono y crear un efecto de sonido utilizando javascript con p5js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
body{
margin: 0px;
@hcastillaq
hcastillaq / webpack.config.js
Created November 22, 2017 21:26
webpack configuration with multiple entries
const webpack = require('webpack');
const config =
{
entry:
{
one: './src/js/app.js',
},
output:{
path: __dirname + '/dist/js/',
filename: '[name].js'
@hcastillaq
hcastillaq / webpack.config.js
Created November 22, 2017 21:06
simple webpack configuration
const webpack = require('webpack');
const config =
{
entry:'./src/js/app.js',
output:{
path: __dirname + '/dist/js/',
filename: 'bundle.js'
}
}
module.exports = config;
@hcastillaq
hcastillaq / Cliente.py
Created December 16, 2016 15:12
Cliente para un chat utilizando sockets en python
import socket
import threading
import sys
import pickle
class Cliente():
"""docstring for Cliente"""
def __init__(self, host="localhost", port=4000):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)