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
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']
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();
});
}
}
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
var datoaEnviar = "algo";
$.ajax({
type: "POST",
url: "script.php",
data:{ comosellamelavarible: datoaEnviar },
success: function(data){
console.log(data);
}
})
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
)
@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
@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
<!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>
fn main() {
println!("Hola, Mozilleros de EL salvador!!");
}
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-72197478-1', 'auto');
ga('send', 'pageview');
</script>