Skip to content

Instantly share code, notes, and snippets.

View davidas13's full-sized avatar
🎯
Learn for life! 🧬 Don't rely on Magic ✨

David Satrio davidas13

🎯
Learn for life! 🧬 Don't rely on Magic ✨
View GitHub Profile
@davidas13
davidas13 / trail.gd
Created December 10, 2019 11:16 — forked from iRadEntertainment/trail.gd
Godot Engine (GDscript) - 2D adjustable trail by Yellatch Games
#Draw trails with lines
#A NON-PERFECT SCRIPT FOR Godot v2.1.* *NOTE THIS SCRIPT STILL HAVE SOME REF ISSUES, CHECK FOR ERRORS IN THE DEBUGGER
#This script has to be attached to scene with only a Control Node
#This scene can be instanced as child of a moving node
#after that the code can be initialized calling scia_setup() func:
#arguments ( nuovo_oggetto = "the parent node reference goes here"
num_step = "number of steps (50 by default)
nuovo_colore = Color() (Opaque white by default)
nuova_trasp = Initial alpha transparency (adjust the formula for other fading effects)
@davidas13
davidas13 / Dock.py
Created January 31, 2020 07:30 — forked from mottosso/Dock.py
Simple way to dock Qt widgets to Maya 2017+
from maya import cmds, OpenMayaUi as omui
from Qt import QtWidgets, QtCore, QtCompat
def Dock(Widget, width=300, show=True):
"""Dock `Widget` into Maya
Arguments:
Widget (QWidget): Class
show (bool, optional): Whether to show the resulting dock once created
# This is a really old post, in the comments (and stackoverflow too) you'll find better solutions.
def find(key, dictionary):
for k, v in dictionary.iteritems():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
@davidas13
davidas13 / worker-threadpool.py
Created February 13, 2020 06:16 — forked from ksvbka/worker-threadpool.py
Demo worker threadpool and report progress in PyQT.
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QPushButton, QWidget
from PyQt5.QtCore import QObject, QRunnable, QThreadPool,pyqtSlot, pyqtSignal
import time
import traceback, sys
class WorkerSignals(QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
@davidas13
davidas13 / video-player.html
Last active March 3, 2020 00:36 — forked from simonhaenisch/video-player.html
Play local video files in the browser (HTML5 video player) with playlist, speed control and keyboard shortcuts for pause (spacebar) and 5 second jump (left/right arrow). Created to watch Wes Bos tutorials offline. Playback speed defaults to 2x.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Local HTML5 Video Player</title>
</head>
<body>
<style>
* { box-sizing: border-box; }
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],

Render Setup Module:

import maya.app.renderSetup.model.override as override
import maya.app.renderSetup.model.selector as selector
import maya.app.renderSetup.model.collection as collection
import maya.app.renderSetup.model.renderLayer as renderLayer
import maya.app.renderSetup.model.renderSetup as renderSetup

Export & Import Render Setup:

#!/bin/sh
IP_PUBLIC=$(dig ipinfo.io/ip +short)
echo "\n=====:: MY IP PUBLIC ::=====\n"
curl -s ipinfo.io | python -c "exec(\"import sys\nimport json\nfor k, v in json$
echo "\n============================\n"
@davidas13
davidas13 / Selenium Requests download image
Created August 8, 2020 06:29 — forked from spirkaa/Selenium Requests download image
How to download captcha image with Python Selenium and Requests
img = driver.find_element_by_xpath("//div[@id='MailRuConfirm']/div/div[18]/form/div[1]/div[2]/div[2]/div[2]/img")
src = img.get_attribute('src')
img = requests.get(src)
with open('captcha.jpg', 'wb') as f:
f.write(img.content)
@davidas13
davidas13 / testframeless.py
Created September 11, 2020 18:15 — forked from mgrady3/testframeless.py
Test Qt/PyQt Frameless Window resizing with QSizeGrip
"""
Test Qt Frameless Window resizing with QSizeGrip
Maxwell Grady, September 2017.
"""
import sys
from PyQt5 import QtCore, QtWidgets
from qtmodern.styles import dark
from qtmodern.windows import ModernWindow