This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
######## | |
# Usage: | |
# tree -a -J | ./map.py | dot -Tpdf > map.pdf | |
######## | |
import json | |
import sys | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
conversions = [ | |
# In Hyrule Lon Lon Milk si 10 rupees and a gallon of milk is 2.53 dollars. | |
{"country": "Hyrule", "rate": 3.9525, "name": "rupees"}, | |
# In Animal Crossing a kettle is 960 bells and 19.48 dollars. | |
{"country": "Animal Crossing", "rate": 49.2813, "name": "bells"}, | |
# In Skyrim a bottle of milk is 6 septims, a pint of milk is 1.29 dollars. | |
{"country": "Skyrim", "rate": 4.6511, "name": "septims"}, | |
] | |
usd = float(input('Please enter amount in US Dollars: ')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tool | |
extends Node | |
export(bool) var reset = false setget onReset | |
export(String, FILE, "*png") var tilesheet | |
export(int) var tilesize | |
func onReset(isTriggered): | |
if (isTriggered): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Xlib.display | |
WINDOW_NAME = 'some window name' | |
d = Xlib.display.Display() | |
r = d.screen().root | |
x = 0 | |
y = 100 | |
width = r.get_geometry().width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sin, pi | |
from PyQt5.QtGui import QPainter, QPainterPath | |
from PyQt5.QtWidgets import QWidget, QApplication, QSlider, QLabel | |
class Widget(QWidget): | |
def __init__(self, parent=None): | |
super().__init__(parent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder