Skip to content

Instantly share code, notes, and snippets.

@fermuch
fermuch / arduinotest.py
Created August 23, 2011 10:05
Arduino Test
# -*- coding: utf-8 -*-
import sys
import time
from commands import getoutput
from arduino import Arduino
out = getoutput("ls /dev/ | grep -i ttyUSB").split()
try:
out[0]
class MiClase:
a = 0
b = 13
def asd (b):
b = b
self.a = b
return self.a + " y " + self.b
@fermuch
fermuch / main.py
Created August 27, 2011 05:40
Script para obtener resultados de Arduino
# -*- coding: utf-8 -*-
import sys
import time
from commands import getoutput
from arduino import Arduino
# definir dispositivo
out = getoutput("ls /dev/ | grep -i ttyUSB").split()
@fermuch
fermuch / hexconverter.js
Created January 17, 2012 13:58
Library for Hexadecimal working with Javascript. I based this on a lib that I found in a blog, but I don't remember the blog, so I'm sorry.
var HexConverter = {
hexDigits : '0123456789ABCDEF',
dec2hex : function( dec )
{
return( this.hexDigits[ dec >> 4 ] + this.hexDigits[ dec & 15 ] );
},
hex2dec : function( hex )
{
var MIN_CHROME_VER = 24;
if(parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]) >= MIN_CHROME_VER){
// el loco sabe y usa chrome!
$('#alert').hide();
}
@fermuch
fermuch / test.opal.rb
Created February 6, 2013 15:31
Testing Opal with Opal-JQuery :)
class Vehicle
attr_accessor :name, :wheels
end
class Car < Vehicle
def initialize(name)
self.name = name
self.wheels = 4
end
end
@fermuch
fermuch / loop.rb
Created March 10, 2013 03:48
stop loop in ruby
5.times do |i|
puts i
break if i == 3
end
#!/bin/bash
GW=`/sbin/ip route list | grep default | awk '{print $3}'`
if ping -c 2 $GW | grep -o Unreachable; then
echo down;
echo `date`": reconnected to wlan" >> /var/log/wlan0-detail
ifdown wlan0
sleep 5
ifup wlan0
fi
@fermuch
fermuch / javascript.coffee
Created May 18, 2013 15:25
Gist para el evento de Google I/O Extended - CoffeeScript!
class Map
constructor: (map) ->
mapOptions =
center: new google.maps.LatLng(-29.71371, -57.08556),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
@map = new google.maps.Map map.get(0), mapOptions
@markers = []
### Keybase proof
I hereby claim:
* I am fermuch on github.
* I am fermuch (https://keybase.io/fermuch) on keybase.
* I have a public key whose fingerprint is 3A5D 3951 A805 FCCF 6F14 45E3 1510 F5D5 A139 603D
To claim this, I am signing this object: