Skip to content

Instantly share code, notes, and snippets.

@excalamus
excalamus / opengl_tutorial.py
Created April 14, 2021 19:58 — forked from markfink/opengl_tutorial.py
PySide2 & OpenGL sample
"""PySide2 & OpenGL sample"""
import sys
from PySide2 import QtCore, QtWidgets, QtOpenGL
try:
from OpenGL.GL import *
except ImportError:
app = QtWidgets.QApplication(sys.argv)
@excalamus
excalamus / Remove Items From Layout | .py
Created April 27, 2021 15:13 — forked from JokerMartini/Remove Items From Layout | .py
Pyside + Python: Remove items from a layout
def clear_layout(self, layout):
while layout.count():
child = layout.takeAt(0)
if child.widget() is not None:
child.widget().deleteLater()
elif child.layout() is not None:
clear_layout(child.layout())
def clear_layout(self, layout):
for x in reversed(range(layout.count())):
@excalamus
excalamus / Instancing + Hierarchy | .py
Created April 27, 2021 15:17 — forked from JokerMartini/Instancing + Hierarchy | .py
PySide + Python: Demonstrates a way to handle a hierarchy of nodes along with instancing.
# Imports
# ------------------------------------------------------------------------------
import sys
import uuid
import json
from random import randint
from PySide import QtCore, QtGui
NODES = []
HIERARCHY = {}
@excalamus
excalamus / docking_dockables.py
Created April 29, 2021 18:16 — forked from justinfx/docking_dockables.py
Playing around with QMainWindow's nested within each other as dock widgets. The main app window has a couple dock widgets added to each of the 4 dock locations around the central widget. These dock widgets are QMainWindows. When enabled, each dock widget will have its own dock widgets populated that can do their own private docking within that c…
#!/usr/bin/env python
"""
Playing around with QMainWindow's nested within each other
as dock widgets.
"""
from random import randint
try:
@excalamus
excalamus / redirect_to_devnull.py
Last active June 18, 2021 16:09 — forked from natedileas/redirect.py
c-level stdout redirection on windows
# Redirect stdout at every level to /dev/null
import os
import io
import sys
import ctypes
from contextlib import contextmanager
@contextmanager
def stdout_redirector(stream):
original_stdout_fd = sys.stdout.fileno()
@excalamus
excalamus / wget.sh
Created November 5, 2021 01:51 — forked from crittermike/wget.sh
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.