Skip to content

Instantly share code, notes, and snippets.

View EnriqueV's full-sized avatar
🏠
Working from home

Eduardo Valencia EnriqueV

🏠
Working from home
View GitHub Profile
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Search con React</title>
<script src="build/react.js"></script>
<script src="build/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
@EnriqueV
EnriqueV / verify.sh
Last active May 5, 2016 02:04
watch gulp task
#! /bin/bash
while true
do
cwd=$(pwd)
FILES=$cwd/src/**/**/* // renplace with your path
current=`date +%s`
for f in $FILES
do
last_modified=`stat -c %Y $f`
if [ $(($current-$last_modified)) -lt 2 ]; then
@EnriqueV
EnriqueV / install.sh
Created August 29, 2016 19:53
bash scripting
#!/bin/bash
echo --- Iniciando script de instalacion ----
apt-get install apache2 php5 mysql-client mysql-server vsftpd perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python lsb-core
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.760_all.deb
wget https://secure.logmein.com/labs/logmein-hamachi_2.1.0.139-1_armhf.deb
git clone https://github.com/UniPiTechnology/evok
echo ---- descargas terminadas----
dpkg -i logmein-hamachi_2.1.0.139-1_armhf.deb
import serial, time
ser = serial.Serial(
port='/dev/ttyUSB0',
baudrate=9600,
parity=serial.PARITY_EVEN,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.SEVENBITS,
timeout=0.5
)
var datoaEnviar = "algo";
$.ajax({
type: "POST",
url: "script.php",
data:{ comosellamelavarible: datoaEnviar },
success: function(data){
console.log(data);
}
})
usalo asi en php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods:GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, x-xsrf-token');
$device=json_decode(file_get_contents('php://input')); //adquiere los datos que vienen como json
app.directive("limitTo", [function() {
return {
restrict: "A",
link: function(scope, elem, attrs) {
var limit = parseInt(attrs.limitTo);
angular.element(elem).on("keydown", function(e) {
if (this.value.length == limit) e.preventDefault();
});
}
}
import websocket
import json
import time
timer = '30000'
url = "ws://172.25.242.118/ws"
def on_message(ws, message):
obj = json.loads(message)
dev = obj['dev']
circuit = obj['circuit']