Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / aimesh-reboot.sh
Last active August 26, 2024 22:01
Reboot aimesh nodes one by one, then reboot main router
#!/bin/env bash
# this returns all aimesh routers
# nvram get cfg_device_list
router="192.168.0.1"
user="admin"
port=1024
pwd=password
@oglops
oglops / remove_tags.py
Created January 9, 2023 01:58
remove unwanted tags
import qbittorrentapi
# instantiate a Client using the appropriate WebUI configuration
client = qbittorrentapi.Client(
host='http://192.168.0.x',
port=xxxx,
username='admin',
password='xxxx',
)
@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 / serveit.py
Created October 22, 2022 05:05
simple http server for testing local sphinx site
#!/usr/bin/env python3
# https://stackoverflow.com/questions/12193803/invoke-python-simplehttpserver-from-command-line-with-no-cache-option
# without this, it can not run in bg
import os
import sys
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
import http.server
@oglops
oglops / test_drop_shelf_button.py
Last active March 14, 2023 22:23
drag from qtableview and drop on maya shelf to insert shelf button
from __future__ import division
import maya.OpenMayaUI
import maya.cmds
from pymel.core import melGlobals
from PySide2 import QtCore, QtGui, QtWidgets
import shiboken2
@oglops
oglops / mute_screen_grab_drag.py
Last active March 16, 2022 18:41
Attempt to cheat maya into thinking that my custom drag is from script editor, but it did not work, even if I used pickled "real" data when dragging from script editor
def startDrag(self, supportedActions):
print('start drag')
listsQModelIndex = self.selectedIndexes()
if listsQModelIndex:
# dataQMimeData = self.model().mimeData(listsQModelIndex)
# insert fake x-maya-data
dataQMimeData = QtCore.QMimeData()
encoded = QtCore.QByteArray()
# failed attempt to cheat maya
@oglops
oglops / mimedata_maya_drag_scripteditor_to_shelf.py
Last active March 16, 2022 18:34
drag from script editor to shelf in maya 2020
from PySide2 import QtWidgets, QtGui, QtCore
class Window(QtWidgets.QWidget):
def __init__(self, *args):
QtWidgets.QWidget.__init__(self, *args)
layout = QtWidgets.QVBoxLayout(self)
label= QtWidgets.QLabel('drop here')
label.setAlignment(QtCore.Qt.AlignCenter)
layout.addWidget(label)
self.setLayout(layout)
@oglops
oglops / excel_style_filter.py
Last active March 16, 2024 13:00
filtered qtableview widgets
import sys
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtCore import Qt
# https://www.pythonguis.com/tutorials/qtableview-modelviews-numpy-pandas/
class TableModel(QtCore.QAbstractTableModel):
def __init__(self, data):
super(TableModel, self).__init__()
self._data = data
@oglops
oglops / config.yml
Last active February 10, 2022 07:39
chd experiment
chd:
disable: [ seen, seen_info_hash, retry_failed, history ]
html_rss:
url: xxx
cookie: xxx
params: '&passkey=xxx'
root_element_selector: 'table.torrents > tbody > tr:not(:first-child)'
fields:
title:
@oglops
oglops / docker-compose.yml
Last active January 17, 2022 07:26
media library docker compose
---
version: "3.8"
x-env-vars: &env-vars
PUID: 1000
PGID: 1000
TZ: Asia/Shanghai
UMASK: 002
x-common-settings: &common-settings