Skip to content

Instantly share code, notes, and snippets.

View WesleyE's full-sized avatar

Wesley Elfring WesleyE

View GitHub Profile
@WesleyE
WesleyE / deleteMultidimensionalColumn
Last active August 29, 2015 14:11
Removes a whole column from a multidimensional resultset.
/**
* Removes a whole column from a multidimensional resultset.
* You could use the array_splice function, this is a bit slower (10.3%) but defragments the empty positions
* in the internal php array. Use this when removing a lot of columns on big (huge) resultsets.
*
* @param $aArray
* @param $sKey
* @return bool
*/
function deleteMultidimensionalColumn(&$aArray, $sKey, $bUseSplice = false) {
@WesleyE
WesleyE / Textures 2 Rat.py
Last active August 29, 2015 14:23
Transcoding your textures to .rat files. Check http://scripts.wesleyelfring.nl/textures-to-rat/
import os
import glob
import subprocess
def we_startConversion():
#Double check overwrite
if hou.pwd().parm("cbOverwrite").eval() == 1:
if hou.ui.displayMessage("Are you sure you want to overwrite RAT files?", buttons=("Yes", "No")) == 1:
hou.pwd().parm("cbOverwrite").set(0)
@WesleyE
WesleyE / Maya_BatchRenderer_V2_0_1.py
Created June 30, 2015 15:02
This script allows you to quickly create a batch render from multiple camera's and multiple ranges in Maya.
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2014 Wesley Elfring
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
@WesleyE
WesleyE / MoveExporter.py
Created June 30, 2015 19:43
Hiero move exporter, moves files between folders instead of coping
"""
The MIT License (MIT)
Copyright (c) 2014 Wesley Elfring
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
@WesleyE
WesleyE / nukeTranscode.py
Created June 30, 2015 19:51
Transcode a folder of images using Nuke
"""
The MIT License (MIT)
Copyright (c) 2014 Wesley Elfring
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
"""Houdini Import Script - Work In Progress
Check http://scripts.wesleyelfring.nl/minecraft-import-script-for-houdini/
"""
import hou,os,sys
# Check for the required modules, we need pyyaml and pymclevel in the $JOB/scripts/ folder.
job = hou.expandString('$JOB')
sys.path.insert(0, os.path.join(job, "scripts", "pymclevel"))
sys.path.insert(0, os.path.join(job, "scripts"))
@WesleyE
WesleyE / extract.bat
Created August 22, 2015 20:15
A good few years ago, this was my quick way of stitching an video with PTGUI and Hugin. Requires Hugin, a project file for one of the frames and FFMPEG.
ffmpeg -i GOPR0011.MP4 -f image2 GOPR0011/GOPR0011_%3d.jpg
ffmpeg -i GOPR0012.MP4 -f image2 GOPR0012/GOPR0012_%3d.jpg
ffmpeg -i GOPR0015.MP4 -f image2 GOPR0015/GOPR0015_%3d.jpg
ffmpeg -i GOPR2943.MP4 -f image2 GOPR2943/GOPR2943_%3d.jpg
ffmpeg -i GOPR8717.MP4 -f image2 GOPR8717/GOPR8717_%3d.jpg
pause
@WesleyE
WesleyE / listen.php
Last active February 2, 2016 12:57
Listen to all queries on a Capsule
$capsule->getDatabaseManager()->connection()->listen(
function ($query) {
// Fix bindings
$sql = $query->sql;
foreach ($query->bindings as $binding) {
//Find first occurence and replace
$sql = preg_replace('/\?+/', $binding, $sql, 1);
}
@WesleyE
WesleyE / ping.py
Created June 13, 2016 12:10 — forked from pklaus/ping.py
A pure python ping implementation using raw socket.
#!/usr/bin/env python2
"""
Other Repositories of python-ping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* https://github.com/l4m3rx/python-ping supports Python2 and Python3
* https://bitbucket.org/delroth/python-ping

Keybase proof

I hereby claim:

  • I am WesleyE on github.
  • I am wesleye (https://keybase.io/wesleye) on keybase.
  • I have a public key whose fingerprint is 2A9B C330 A7C8 D507 FECE 415D F7C0 E5BE E55E 6EBC

To claim this, I am signing this object: