Skip to content

Instantly share code, notes, and snippets.

View mottosso's full-sized avatar

Marcus Ottosson mottosso

View GitHub Profile
@mottosso
mottosso / Dockerfile
Last active July 24, 2018 03:21 — forked from jeetsukumaran/build-gcc.sh
Build and Install GCC from Scratch
FROM ringo/scientific:6.6
MAINTAINER [email protected]
# Prerequisities
RUN yum install -y \
wget \
zlib-devel && \
yum groupinstall -y \
"Development Tools" \
@mottosso
mottosso / add_to_statusbar.py
Last active July 4, 2016 04:10
Add an action to the Maya "Status Bar"
import os
from PySide import QtGui
# Use this to locate your widget; it will return the
# widget currently under your cursor.
# parent = QtGui.qApp.widgetAt(QtGui.QCursor.pos())
# parent.objectName()
# Use this once you know the name of it, in this case "toolBar1"
# We can find it as a child of the main window.
@mottosso
mottosso / quickstart.py
Last active May 17, 2023 05:48
Learn Pyblish By Example - Quickstart 1.4
"""Full Example
From https://pyblish.gitbooks.io/pyblish-by-example/content/chapters/02-quickstart.html
Usage:
Copy and run this entire file in your Maya Script Editor
"""
import os
@mottosso
mottosso / object_under_cursor.py
Last active July 11, 2025 23:33
Get object under cursor - Autodesk Maya
"""Illustration of how to retrieve the shape under the mouse cursor
Usage:
Run `start()` to start listening for when the mouse stops and to display a tooltip
Run `stop()` to stop listening
"""
from maya import cmds
from PySide import QtGui, QtCore
@mottosso
mottosso / pyblish_in_100_lines.py
Last active January 24, 2016 14:30
Pyblish in 100 lines
import types
# Mocked Pyblish module
pyblish = types.ModuleType('pyblish')
pyblish.api = types.ModuleType('api')
pyblish.api.CollectorOrder = 0
pyblish.api.ValidatorOrder = 1
pyblish.plugin = types.ModuleType('plugin')
pyblish.logic = types.ModuleType('logic')
@mottosso
mottosso / getopt.c
Created January 11, 2016 15:37 — forked from ashelly/getopt.c
"Port of GNU getopt() to Win32 for anyone who's tired of dealing with getopt() calls in Unix-to-Windows ports." Ported by Pete Wilson. Recovered from the Internet Archive's snapshot of www.pwilson.net/sample.html.
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@mottosso
mottosso / README.md
Last active December 29, 2015 13:48
Linked Lists in C99

An implementation of a linked list in C99.

Usage

Node* root = (Node *) calloc(1, sizeof(Node));

fill(root, 10);
print(root);
reverse(root);
@mottosso
mottosso / README.md
Last active February 6, 2023 13:56
Minimal QML SceneGraph 2
@mottosso
mottosso / README.md
Last active March 4, 2025 03:19
Minimal QML SceneGraph

untitled

Usage

python main.py --amount 100
  • Panning by left-click + drag
  • Scale by rotating the mouse wheel
@mottosso
mottosso / README.md
Last active December 2, 2024 01:46
QML Reloading in PyQt5

Usage

git clone https://gist.github.com/fa01c80080363df3433d.git qmlreload
cd qmlreload
python main.py

Edit either SceneGraphEditor.qml or Viewport.qml and then hover it and hit F5 to reload.