Skip to content

Instantly share code, notes, and snippets.

View ChrisNguyenEmbedded's full-sized avatar

ChrisNguyen ChrisNguyenEmbedded

View GitHub Profile
@ChrisNguyenEmbedded
ChrisNguyenEmbedded / test_ChromeDriverService.py
Created March 15, 2018 16:40 — forked from cch5ng/test_ChromeDriverService.py
Python unittest example for ChromeDriver service
from selenium import webdriver
from selenium.webdriver.chrome import service
import time
import unittest
myService = service.Service('/path/to/chromedriver')
capabilities = {'chrome.binary': '/path/to/custom/chrome'}
class test_ChromeDriverService(unittest.TestCase):
@ChrisNguyenEmbedded
ChrisNguyenEmbedded / pyqt_popup_close.py
Created March 12, 2018 11:57 — forked from justinfx/pyqt_popup_close.py
Example of how to use PyQt to popup a dialog at current mouse pos, and close in response to ESC keyc
from PyQt4 import QtCore, QtGui
class Dialog(QtGui.QDialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self.resize(300,200)
def showEvent(self, event):
# Source: https://stackoverflow.com/questions/6783194/background-thread-with-qthread-in-pyqt
import sys
import time
from PyQt5.QtCore import (QCoreApplication, QObject, QRunnable, QThread,
QThreadPool, pyqtSignal)
# Subclassing QThread
# http://qt-project.org/doc/latest/qthread.html
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QWidget
class UIWindow(QWidget):
def __init__(self, parent=None):
super(UIWindow, self).__init__(parent)
# mainwindow.setWindowIcon(QtGui.QIcon('PhotoIcon.png'))
self.ToolsBTN = QPushButton('text', self)
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QApplication,QWidget,QVBoxLayout
from PyQt5.QtCore import QUrl
import sys
app = QApplication(sys.argv)
# And a window
win = QWidget()
win.setWindowTitle('QWebView Interactive Demo')
@ChrisNguyenEmbedded
ChrisNguyenEmbedded / brainyquotes.py
Last active January 23, 2018 05:50 — forked from JKirchartz/brainyquotes.py
Download all quotes from BrainyQuotes by search terms, print in fortune format (note: doesn't seem to work on OSX)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyleft (ↄ) 2016 jkirchartz <jkirchartz@Joels-iMac.local>
# Modified 2017 ChrisNguyen
# Distributed under terms of the NPL (Necessary Public License) license.
# Tested in python 3.6
"""
@ChrisNguyenEmbedded
ChrisNguyenEmbedded / install-android-sdk-ubuntu.sh
Created January 8, 2018 04:31 — forked from klaeufer/install-android-sdk-ubuntu.sh
installation script for Android SDK and JDK 8 on Ubuntu (Cloud9)
#!/bin/sh
# installation script for Android SDK and JDK 8 on Ubuntu
# for Android development with gradlew-based projects
# tested on Cloud9
ANDROID_HOME=$HOME/lib/android-sdk-linux
ANDROID_SDK_VERSION=24.4.1
ANDROID_BUILD_TOOLS_VERSION=23.0.2
ANDROID_API_LEVEL=22
@ChrisNguyenEmbedded
ChrisNguyenEmbedded / TreeView.py
Last active December 31, 2017 14:35
#PyQt5 tree view,checklist,edit text, button
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
@ChrisNguyenEmbedded
ChrisNguyenEmbedded / BatteryActivity.java
Created December 2, 2017 23:17 — forked from gabrielemariotti/BatteryActivity.java
Android Wear: small gist to get data from Battery
public class BatteryActivity extends Activity {
//UI Elements
private TextView mTextViewLevel;
private TextView mTextViewTemperature;
private TextView mTextViewVoltage;
private TextView mTextViewHealth;
//Battery details
private int level;