Skip to content

Instantly share code, notes, and snippets.

View Vimkxi's full-sized avatar
🚀
Roger roll, Endeavour !

Vincent Mazéas Vimkxi

🚀
Roger roll, Endeavour !
  • Ubisoft Montréal
  • Montreal, Canada
  • 16:31 (UTC -04:00)
  • LinkedIn in/vincentmazeas
View GitHub Profile
@BigRoy
BigRoy / usdviewport_qt.py
Last active March 16, 2024 08:47
Example of how to embed a simple USD viewport in Qt application
"""
MIT License
Copyright (c) 2019 Roy Nieterau
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Voronoff
Voronoff / wsl_setup.md
Last active September 29, 2023 16:41
Windows development in 2018: Setting up a coding environment using Windows Subsystems for Linux (WSL), Hyper, and Visual Studio Code (vscode) with Python.

If you're here just for the section on vscode working with Python on WSL, jump here.

Creating a modern development environment in Windows

Windows is now a development environment that can compete with Mac and Linux. Windows Subsystems for Linux lets you have an Ubuntu (or other Linux flavor) installation that works near seemlessly inside of Windows. Hyper Terminal running WSL's Bash and Visual Studio Code feel really nice to code in. These are instructions for getting set up and smoothing out most of the remaining rough edges. I've included a section on getting vscode to work well with Python and WSL, but the general pattern should be usable for any unsupported language (as of now, I believe it's only Node.js that has WSL support in vscode).

Table of Contents

@amirasaran
amirasaran / BaseThreading
Created October 27, 2016 06:36
Python threading with callback function (callback function run after thread is finished)
import time
import threading
class BaseThread(threading.Thread):
def __init__(self, callback=None, callback_args=None, *args, **kwargs):
target = kwargs.pop('target')
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs)
self.callback = callback
self.method = target
@iSplasher
iSplasher / getVisibleIndexes.py
Created December 26, 2015 13:20
Get currently visible QModelIndexes in QListView, QTableView or QTreeView
# Put this in the class
def get_visible_indexes(self, column=0):
"find all galleries in viewport"
# used to find first index
gridW = self.W # width of single items
gridH = self.H # height of single items
region = self.viewport().visibleRegion()
idx_found = []
def idx_is_visible(idx):
@patik
patik / how-to-squash-commits-in-git.md
Last active October 17, 2023 02:19
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@fredrikaverpil
fredrikaverpil / get_set_palette_data.py
Last active May 10, 2023 19:40
Get and set QPalette data
from PySide import QtGui
#from PyQt4 import QtGui
import pickle
STYLE = 'plastique'
GROUPS = ['Disabled', 'Active', 'Inactive', 'Normal']
ROLES = [
'AlternateBase',
'Background',
'Base',
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active April 18, 2024 01:00
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@justinfx
justinfx / docking_dockables.py
Created March 25, 2013 22:24
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:
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@simonw
simonw / is_hard.py
Created November 8, 2009 09:06
Python script for telling if two files are hard links to the same thing
#!/usr/bin/env python
"is_hard.py - tell if two files are hard links to the same thing"
import os, sys, stat
def is_hard_link(filename, other):
s1 = os.stat(filename)
s2 = os.stat(other)
return (s1[stat.ST_INO], s1[stat.ST_DEV]) == \
(s2[stat.ST_INO], s2[stat.ST_DEV])