Skip to content

Instantly share code, notes, and snippets.

View tombrad's full-sized avatar

Tomas Bradanovic tombrad

View GitHub Profile
@tombrad
tombrad / gist:4942229
Created February 13, 2013 04:18
Prototipos VBA-3-8
Private Sub UserForm_Activate()
ComboBox1.AddItem "Haber"
ComboBox1.AddItem "Debe"
ComboBox1.Text = ComboBox1.List(1)
TextBox1.Text = Date
ComboBox2.SetFocus
If Hoja1.Cells(1, 1) <> "" Then
For z = 1 To 500
ComboBox2.AddItem Hoja1.Cells(z, 1)
Next z
@tombrad
tombrad / gist:4942232
Created February 13, 2013 04:19
Prototipos VBA-3-9
Private Sub CommandButton1_Click()
Rem posicion del indice en la celda 1,1
indice = Hoja1.Cells(1, 1)
Rem si el indice es cero se cambia a uno
If indice = "" Then
indice = 1
Hoja1.Cells(1, 1) = indice
End If
Rem incrementa el indice en 1 lugar que es la fila donde debe grabar
indice = indice + 1
@tombrad
tombrad / gist:4942233
Created February 13, 2013 04:20
Prototipos VBA-3-10
Private Sub ComboBox1_Click()
Hoja3.Activate
ultimo = Hoja2.Cells(1, 1)
linea = 1
For z% = 2 To ultimo
indice = z%
CodCliente = ComboBox1.ListIndex + 1
If CodCliente = Hoja2.Cells(z%, 1) Then
monto = Hoja2.Cells(z%, 4)
If Hoja2.Cells(z%, 5) = "Debe" Then
@tombrad
tombrad / gist:4942238
Created February 13, 2013 04:21
Prototipos VBA-3-11
Private Sub UserForm_Activate()
If Hoja1.Cells(1, 1) <> "" Then
For z = 1 To 500
ComboBox1.AddItem Hoja1.Cells(z, 1)
Next z
Rem deja en blanco el combo
ComboBox1.Text = ""
End If
End Sub
@tombrad
tombrad / gist:4961459
Created February 15, 2013 16:22
Max and min initializing with None
max = None
min= None
while True:
num = raw_input("Enter a number: ")
if num == "done" : break
if len(num)<1 : break
try:
num = float(num)
except :
print "Invalid input"
@tombrad
tombrad / gist:4971574
Created February 17, 2013 13:52
test 3
hrs = raw_input("Enter Hours:")
hors=float(hrs)
rate = raw_input("Enter Rate:")
rate1=float(rate)
total=hors*rate1
print type(hors), type(rate1), type (total)
print total
@tombrad
tombrad / gist:6188444
Last active March 22, 2022 18:33
My public GPG key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYi64TRYJKwYBBAHaRw8BAQdAvxSLwojlecR+pEe8oEd+jnoqLqifnp7TX2Hj
gZDYnk+0JVRvbWFzIEJyYWRhbm92aWMgPHRvbWJyYWQyQGdtYWlsLmNvbT6ImgQT
FgoAQhYhBNhzBG0vkYcgkjjPP+mOQtSh7d8/BQJiLrhNAhsDBQkDwxUzBQsJCAcC
AyICAQYVCgkICwIEFgIDAQIeBwIXgAAKCRDpjkLUoe3fP4wuAP9RGBMSZAWCPQpR
NxqCVadL9GrLytPx9f7i2KE05A0a0wEA33EKlbFaaFN56frpFpRhOl6ltuAiDKBi
+jCwjo2Gsg+4OARiLrhNEgorBgEEAZdVAQUBAQdA5P5bwvxr45+hPLgcRCwLMeTK
+/JE2dsxW2ly3X+ZRCgDAQgHiH4EGBYKACYWIQTYcwRtL5GHIJI4zz/pjkLUoe3f
PwUCYi64TQIbDAUJA8MVMwAKCRDpjkLUoe3fP2ydAP9DqJ8ZnHRoWXoaGqcGk4rC
import serial
arduino = serial.Serial('/dev/ttyACM0',9600)
while True:
comando = raw_input('Introduce un comando: ')
arduino.write(comando)
if comando == 'H':
print('LED ENCENDIDO')
elif comando == 'L':
import serial
arduino = serial.Serial('/dev/ttyACM0',9600)
while True:
comando="H"
arduino.write(comando)
print('LED ENCENDIDO')
arduino.close()#FINALIZA LA COMUNICACION
import serial
arduino = serial.Serial('/dev/ttyACM0',9600)
comando="L"
arduino.write(comando)
print('LED APAGADO')
arduino.close()#FINALIZA LA COMUNICACION