Skip to content

Instantly share code, notes, and snippets.

@oglops
oglops / .gitconfig
Last active March 27, 2024 00:57
dot files
[user]
name = x
email = x
[push]
default = simple
followTags = true
[diff]
tool = vscode
[merge]
tool = vscode
@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 / aimesh-reboot.sh
Last active September 25, 2023 07:51
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 / withDigits.user.js
Last active April 16, 2023 01:32
给天猫评论加入"有数字"的选项,老婆大人专用
// ==UserScript==
// @name withDigit
// @namespace taobao
// @include https://detail.tmall.com/*
// @version 0.02
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle("table.crap td { padding:0 5px 0 5px; }");
@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 / yaml_OrderedDict.py
Last active January 25, 2023 11:08
write to and load from yaml file with OrderedDict
#!/usr/bin/env python
try:
# for python newer than 2.7
from collections import OrderedDict
except ImportError:
# use backport from pypi
from ordereddict import OrderedDict
import yaml
@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 / enhancedScriptEditor_v2.py
Last active October 17, 2022 22:37
add some hotkeys to maya script editor
# author: oglops@gmail.com The Tree Widget guy
# todo
# ctrl+d remove multiple line
# double click go to line
# ctrl+g go to line
# ctrl+r sublime style
try:
qApp.removeEventFilter(filter)