Skip to content

Instantly share code, notes, and snippets.

View chipolux's full-sized avatar

NaKyle chipolux

View GitHub Profile
@chipolux
chipolux / gist:5981665
Last active December 19, 2015 16:09
Quick and dirty python script to get current prices and discounts from all apps in the steam store. No keys required and multithreaded, change thread_limit to adjust how many living threads you'd like at once.
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 23:06:53 2013
@author: chipolux
"""
import json
import urllib2
import threading
import Queue
@chipolux
chipolux / gist:9d656180b6141175a3e3
Created March 18, 2015 21:13
Efficient List Creation
INSTRUMENTS = filter(lambda x: x, map(str.strip, """
Flow %d (bpd)
Target Flow (bpd)
Intake (psi)
Discharge (psi)
Pressure (psi, ft)
Torque %d (ft lbf)
Power (hp)
Speed (rpm)
Temperature (F)
@chipolux
chipolux / patch-edid.rb
Created October 5, 2015 21:57
Ruby script to generate display override files to force RGB mode on troublesom displays.
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@chipolux
chipolux / qt_kinetic_scroll.py
Created October 19, 2015 22:10
Simple Kinetic Scroll Example Using PyQt (Only Works On Qt5)
import sys
from PyQt5.QtWidgets import (
QApplication,
QFormLayout,
QGridLayout,
QLabel,
QScrollArea,
QScroller,
QWidget,
@chipolux
chipolux / oh_my.py
Created December 1, 2015 22:33
N means number, p means period... Also, lists are evil apparently...
class MdlTestData(SqlSyncTableModel):
TABLE_NAME = "TestData"
def __init__(self, parent=None):
super(MdlTestData, self).__init__(parent)
self.setSort(self.ixPointNo, Qt.AscendingOrder)
self.setHeaderData(self.ixTemperature, Qt.Horizontal, "Temperature")
self.setHeaderData(self.ixTime , Qt.Horizontal, "Time")
self.setHeaderData(self.ixVoltsAB , Qt.Horizontal, "Volts AB")
nakyle at lnakyle-work in ~/Projects/manufacturing-kiosk (time-routing●●)
$ mkvirtualenv test-fdb -p python3
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5
New python executable in test-fdb/bin/python3.5
Also creating executable in test-fdb/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/nakyle/.virtualenvs/test-fdb/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/nakyle/.virtualenvs/test-fdb/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/nakyle/.virtualenvs/test-fdb/bin/preactivate
from PyQt5.QtWidgets import QDialog, QGridLayout, QLabel, QPushButton
from PyQt5.QtNetwork import QNetworkInterface, QAbstractSocket
class NetworkInfoDialog(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle('Network Interface Info')
layout = QGridLayout(self)
for i, interface in enumerate(self.get_interfaces()):
@chipolux
chipolux / test.py
Last active March 2, 2017 18:00
Simple EGLFS ComboBox Example (Works With Raspberry Pi and LeanDog PyQt 5.7)
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
app = QGuiApplication(sys.argv)
view = QQuickView()
view.setSource(QUrl('./test.qml'))
@chipolux
chipolux / debounce.py
Created August 22, 2017 17:09
pyqt debounced text input
# A simple example of using a QTimer to create a debounce on a line edit.
# For things like search fields, etc.
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QWidget, QLineEdit, QApplication, QVBoxLayout
class Widget(QWidget):
def __init__(self, parent=None):
super().__init__(parent)
@chipolux
chipolux / embedded_window.py
Created August 22, 2017 23:27
Embedding A Window In A Widget (PyQt5 and python-xlib)
def get_window_id(name):
import Xlib.display
d = Xlib.display.Display()
r = d.screen().root
window_ids = r.get_full_property(
d.intern_atom('_NET_CLIENT_LIST'), Xlib.X.AnyPropertyType
).value