Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
CMCDragonkai / file-s3-etag
Last active September 14, 2023 07:22
Calculate S3 ETAG including Multipart Uploads #python #aws
#!/usr/bin/env python3
import argparse
import hashlib
# see https://docs.aws.amazon.com/cli/latest/topic/s3-config.html
# for default multipart_threshold and multipart_chunksize
def md5sum(
file_like, multipart_threshold=8 * 1024 * 1024, multipart_chunksize=8 * 1024 * 1024
@mfessenden
mfessenden / applyMayaMaterial.py
Last active August 30, 2024 13:46
Maya command to create a lambert shader & shading group node named for the object
import maya.cmds as mc
def applyMaterial(node):
if mc.objExists(node):
shd = mc.shadingNode('lambert', name="%s_lambert" % node, asShader=True)
shdSG = mc.sets(name='%sSG' % shd, empty=True, renderable=True, noSurfaceShader=True)
mc.connectAttr('%s.outColor' % shd, '%s.surfaceShader' % shdSG)
mc.sets(node, e=True, forceElement=shdSG)
applyMaterial("pSphere1")
@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 22, 2025 14:34
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

import numpy as np
import re
import sys
'''
Load a PFM file into a Numpy array. Note that it will have
a shape of H x W, not W x H. Returns a tuple containing the
loaded image and the scale factor from the file.
'''
def load_pfm(file):
@drakeguan
drakeguan / ConvertEXRToJPG.py
Created August 22, 2013 03:55
Convert OpenEXR to JPEG with gamma encoding (2.4) efficiently through OpenEXR and numpy.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy
import OpenEXR
import Imath
import Image
@shreyansb
shreyansb / smtpexample.py
Created January 16, 2012 19:28
sample code to send a gmail using python
#!/usr/bin/python
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
gmail_user = "[email protected]"