Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / pyqt_icons.py
Created November 5, 2022 21:38 — forked from ostr00000/pyqt_icons.py
Simple program to display all icons available for pyqt
"""
Create widget with available icons from qt and based on freedesktop.org
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
"""
from PyQt5.QtCore import QSize
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QGridLayout, QStyle, \
QFormLayout, QLabel, QScrollArea, QLineEdit, QTabWidget
@oglops
oglops / gist:7120f0fcd1a9be31959221b4caf048c4
Created July 4, 2017 06:03 — forked from manuelmacha/gist:6cc29ec040734e21a768
QTextEdit extended with a signal 'lineNumbersChanged' which gets triggered when the line-numbers of the visible text change. Such functionality already exists for QPlainTextEdit via firstVisibleBlock().blockNumber() and lastVisibleBlock().blockNumber(). However these methods are not accessible using QTextEdit and PyQt. The signal can be used to …
from PyQt4 import QtGui, QtCore
class TextEdit(QtGui.QTextEdit):
'''
QTextEdit extended with a signal 'lineNumbersChanged' which gets triggered when the line-numbers of the visible text change.
Such functionality already exists for QPlainTextEdit via firstVisibleBlock().blockNumber() and lastVisibleBlock().blockNumber()
However these functions are not accessible using QTextEdit and PyQt.
The signal can be used to update custom widgets that compliment the QTextEdit such as lineNumberWidgets or miniMapWidgets.
'''
@oglops
oglops / mayaWidgetEmbeddingIntoPyQtWidget.py
Created May 16, 2017 18:20 — forked from KelSolaar/mayaWidgetEmbeddingIntoPyQtWidget.py
Maya Widget Embedding Into PyQt Widget
import maya.OpenMayaUI
import maya.cmds as cmds
import sip
from PyQt4.QtGui import *
from PyQt4.QtCore import *
mainWindow = QMainWindow()
centralWidget = QListView()
mainWindow.setCentralWidget(centralWidget)
dockWidget = QDockWidget("DockWidget", mainWindow)
@oglops
oglops / batch_keys.sh
Created April 22, 2017 20:09 — forked from ShadowKyogre/batch_keys.sh
Select multiple windows with slop. Needs slop, xwininfo, and xprop. Edit batch_keys.sh if you want to pass different params to the slop wrapper.
#!/bin/bash
happened=1
for window in $(recsel_windows.py -l -c 0,0.5,1,0.6)
do
happened=0
xdotool windowactivate --sync $window key "$1"
done
if [ $happened -a -n "$2" ];then
@oglops
oglops / mayaCustomMarkers.py
Created April 19, 2017 21:44 — forked from dgovil/mayaCustomMarkers.py
Allows a user to create custom markers in maya.Based off of this pastebin: http://pastebin.com/Uc8S4QPx (which may further be from createive Crash) and further work by https://github.com/achayan and his pasteBin http://pastebin.com/JGJZ5uu1
from PyQt4 import QtGui, QtCore
import maya.cmds as cmds
import maya.OpenMayaUI as mui
import sip
def convertToQT(controlName):
controlPoniter = mui.MQtUtil.findControl(controlName)
if controlPoniter is not None:
return sip.wrapinstance(long(controlPoniter), QtCore.QObject)
@oglops
oglops / tmux.cheat
Created January 23, 2017 17:39 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@oglops
oglops / howto-tomato-install-extras.markdown
Created July 16, 2016 21:03 — forked from dferg/howto-tomato-install-extras.markdown
HOWTO: Install extra kernel modules on Shibby TomatoUSB

Introduction

This howto describes installing the extra kernel modules for the Tomato open-source router firmware. We will install them in the /opt/extras area.

Requirements

  • Router running Shibby's fork of TomatoUSB
  • entware installed to a USB stick mounted at /opt

This Howto Was Tested With

@oglops
oglops / imgur
Created July 9, 2016 16:00 — forked from vivien/imgur
Shell script to upload image(s) to imgur.com
#!/bin/sh
#
# Upload image(s) to imgur.com
# Copyright (C) 2014 Vivien Didelot <[email protected]>
# Licensed under GPL version 3, see http://www.gnu.org/licenses/gpl.txt
#
# Requires "jshon":
# http://kmkeen.com/jshon/
#
# Alternatives, which suck:
@oglops
oglops / README.md
Created July 8, 2016 21:08 — forked from mottosso/README.md
Restore Script Editor focus

Problem

image

On Windows systems using Autodesk Maya, the text input field of the Script Editor doesn't regain focus after having restored focus to the main window. This event handler explicitly restores focus, if it turns out to have been the last active panel at the time of leaving the application.

Usage

Place the full contents of the script below into your userSetup.py and never again lose focus.

@oglops
oglops / notepad.html
Created April 12, 2016 07:35 — forked from jdkanani/notepad.html
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`