Skip to content

Instantly share code, notes, and snippets.

View marquesghm's full-sized avatar

Guilherme Marques marquesghm

View GitHub Profile
table tr:nth-child(13) td:first-child{
background-color: green;
color: white;
}
@marquesghm
marquesghm / parser.py
Created May 2, 2018 19:54
[Python] Parser File
f1 = open('log.txt','r')
f2 = open('parsedLog.txt','w')
for l in f1:
if 'eduroam' in l:
f2.write(l)
print(l)
f1.close()
f2.close()
@marquesghm
marquesghm / list-copy-example.py
Created April 26, 2018 16:53
Python List - Copy
import copy
print("Copy List Reference:")
a = [1, 2, 3]
b = a
b[0] = 42
print('{}\n{}'.format(a, b))
print("Copy List Elements")
a = [1, 2, 3]
@marquesghm
marquesghm / bridge-mqtt-mysql.py
Created April 13, 2018 18:51
MQTT + MySQL: Bridge message example
#!/usr/bin/python
import paho.mqtt.client as mqttClient
import MySQLdb as mdb
import time
#broker_address= "m11.cloudmqtt.com" #Broker address
broker_address = "localhost"
broker_port = 1883 #Broker broker_port
#broker_user = "yourUser" #Connection username
#broker_password = "yourPassword" #Connection password
@marquesghm
marquesghm / mysqlConnection.py
Created April 11, 2018 20:12
Exemplo conexão com MySQL- Python
#!/usr/bin/python
db_hostname = "localhost" # MySQL host ip address or name
db_database = "mqtt" # MySQL database name
db_username = "mqttuser" # MySQL database user name
db_password = "mqttpass" # MySQL database password
import MySQLdb as mdb
import time
@marquesghm
marquesghm / mqttSubscribeExample.py
Last active April 11, 2018 20:06
Exemplo Cliente Subscribe MQTT - Python
#!/usr/bin/python
import paho.mqtt.client as mqttClient
import time
def on_connect(client, userdata, flags, rc):
if rc == 0:
print("Connected to broker")
global Connected #Use global variable
Connected = True #Signal connection
else:
@marquesghm
marquesghm / open-sublime-text-2.sh
Created April 11, 2018 00:17
Script to open sublime 2 anywhere
wget -nc https://download.sublimetext.com/Sublime%20Text%202.0.2%20x64.tar.bz2 -P ~/Downloads/
mkdir -p ~/Downloads/sublime
tar -xjf ~/Downloads/Sublime\ Text\ 2.0.2\ x64.tar.bz2 --directory ~/Downloads/sublime --strip-components 1
cd ~/Downloads/sublime
ln -sf sublime_text subl
PATH=$PATH:$HOME/Downloads/sublime
nohup ./sublime_text &
import numpy as np
import cv2
import cv2.aruco as aruco
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
#dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_5X5_1000)
#dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_50)
dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_ARUCO_ORIGINAL)
while(True):
# Capture frame-by-frame