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 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# import relevant classes from PyQt | |
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QWidget, QLabel | |
from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QSizePolicy | |
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas | |
class MyMainWindow(QMainWindow): |
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.QtWidgets import QApplication, QMainWindow | |
from PyQt5.QtWidgets import QPushButton, QWidget, QLabel | |
from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout | |
class MyMainWindow(QMainWindow): | |
''' the main window potentially with menus, statusbar, ... ''' | |
def __init__(self): | |
super().__init__() # calls __init__ of the parent class, QMainWindow |
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 re | |
def pad_number(number,length=2,padding="0"): | |
str_number = str(number) | |
if len(str_number) < length: | |
str_number = padding+str_number | |
return str_number | |
def make_cue_tracks(inp,pattern="((\\d{1,2}):)?(\\d{1,2}):(\\d{1,2}) - (.*)", | |
hr=1,m=2,s=3,title=4,artist=None): |
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
#!/usr/bin/env python | |
# Extract .cpio file from a pbzx Payload file. | |
# | |
# Based on https://gist.github.com/pudquick/ac29c8c19432f2d200d4, | |
# this version adds a command-line interface, improves efficiency (1 MiB chunks | |
# instead of a full copy in memory), adds Python 3 compatibility and | |
# automatically decompresses stuff (some blocks may not be compressed). | |
# | |
# Example usage (from Python): | |
# |
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
#!/usr/bin/env python2 | |
import os | |
from docopt import docopt | |
def get_size(start_path = '.'): | |
"""Gets the size of the path in bytes.""" | |
total_size = 0 | |
for dirpath, dirnames, filenames in os.walk(start_path): | |
for f in filenames: | |
fp = os.path.join(dirpath, f) |
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
olmerge = lambda l:l if len(l)==1 else (lambda l1,l2: ( lambda half,l1,l2: half+l1 if not len(l2) else half+l2 if not len(l1) else half+l1+l2 )([[l1.pop,l2.pop][l1[0]>l2[0]](0) for x in range([len(l1),len(l2)][len(l1)>len(l2)]*2) if (len(l1)>0 and len(l2)>0)],l1,l2) )(olmerge(l[:len(l)//2]),olmerge(l[len(l)//2:])) |
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
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match. | |
Instructions: | |
1. Set your Gnome theme as you would like it | |
2. Run with a command like "python wine_colors_from_gtk.py" If made executable you can run it in bash as-is | |
3. Open winecfg, go to Desktop Integration and install the new .theme file created | |
4. Hit apply and restart any apps running in Wine. They should match the Gnome theme colors now. | |
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/ |