Skip to content

Instantly share code, notes, and snippets.

View davidejones's full-sized avatar
🤷‍♂️
keep our code running while other packages are changing theirs

David Jones davidejones

🤷‍♂️
keep our code running while other packages are changing theirs
View GitHub Profile
import math, os, time, bpy, random, mathutils, re, ctypes, struct, binascii, zlib, tempfile
from bpy import ops
from bpy.props import *
def GetMaterialTextures(Material):
if Material:
#Create a list of Textures that have type "IMAGE"
ImageTextures = [Material.texture_slots[TextureSlot].texture for TextureSlot in Material.texture_slots.keys() if Material.texture_slots[TextureSlot].texture.type == "IMAGE"]
#Refine a new list with only image textures that have a file source
# Sandy Actionscript Quick import into blender 2.63
# Script by David E Jones, http://davidejones.com
# Purpose to help cogweb & Ricardo Cruz import models
import bpy
global verts,faces,norms,uvs
verts = []
faces = []
norms = []
(function($){
$.fn.imageReveal = function(options) {
var defaults = {
width: 493,
height: 308,
useImageSize: false
};
var options = $.extend(defaults, options);
@davidejones
davidejones / .htaccess
Last active February 14, 2017 19:34
htaccess splash cookie login
RewriteCond %{REQUEST_URI} !=/maintenance.html
RewriteCond %{REQUEST_URI} !=/login.cfm
RewriteCond %{REQUEST_URI} !^/mobile/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|css|js|swf|xml|ttf|eot|woff|svg|pdf)$
RewriteCond %{HTTP_COOKIE} !^.*splash.*$ [NC]
RewriteRule ^(.*)$ /maintenance.html [R=307,NC,L]
@davidejones
davidejones / admin.py
Created August 27, 2015 01:57
partner select on change list
from django.contrib.admin.views.main import ChangeList
# make the partner select pass through without ?e=1
class UserChangeList(ChangeList):
def get_filters_params(self, params=None):
params = super(UserChangeList, self).get_filters_params(params)
if 'userprofile__partners__exact' in params:
del params['userprofile__partners__exact']
return params
@davidejones
davidejones / get_s3_file.sh
Last active July 17, 2024 17:34
curl get file from private s3 with iam role
#!/bin/bash
instance_profile=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/`
aws_access_key_id=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep AccessKeyId | cut -d':' -f2 | sed 's/[^0-9A-Z]*//g'`
aws_secret_access_key=`curl http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | grep SecretAccessKey | cut -d':' -f2 | sed 's/[^0-9A-Za-z/+=]*//g'`
token=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/${instance_profile} | sed -n '/Token/{p;}' | cut -f4 -d'"'`
file="somefile.deb"
bucket="some-bucket-of-mine"
date="`date +'%a, %d %b %Y %H:%M:%S %z'`"
@davidejones
davidejones / 31E90CCA.pnach
Last active September 18, 2015 04:20
Tony Hawk Game PCSX2 pnachs (copy to your Cheats dir)
// Invisible Man.tXo - SLES_504.35 PAL
gametitle=Tony Hawks Pro Skater 3
// toggle on console (bottom right yellow text)
patch=1,EE,0097FFE8,word,00000000
// enable debug menu (in game)
// note this is out of the box so some menus may freeze
patch=1,EE,009B70D0,word,4EAC0516
patch=1,EE,009B70D4,word,00D90291
import urllib
def encoded_dict(in_dict):
out_dict = {}
for k, v in in_dict.iteritems():
if isinstance(v, unicode):
v = v.encode('utf8')
elif isinstance(v, str):
# Must be encoded in UTF-8
v.decode('utf8')
@davidejones
davidejones / UIControlModule.js
Last active November 6, 2015 19:28
basic test angular datatables in vinsuite
var uiControlModule = angular.module('uiControlModule',['memberModule','datatables']);
uiControlModule.controller('testController', ['$rootScope', '$scope', 'DTOptionsBuilder', 'DTColumnDefBuilder', function($rootScope, $scope, DTOptionsBuilder, DTColumnDefBuilder) {
var vm = this;
$scope.persons = [
{id:1, firstName:'David', lastName:'Jones'},
{id:2, firstName:'Michael', lastName:'Whetton'},
{id:3, firstName:'Trevor', lastName:'Veralrud'},
{id:4, firstName:'Jeffrey', lastName:'Barron'},
@davidejones
davidejones / pyglet_triangle.py
Created December 13, 2015 23:45
Pyglet Triangle OpenGL
import pyglet
from pyglet.gl import *
from ctypes import create_string_buffer, cast, sizeof, c_int, c_char, pointer, byref, POINTER
width = 800
height = 600
ratio = float(width) / float(height)
window = pyglet.window.Window(config=Config(major_version=2, minor_version=2), width=width, height=height, vsync=True)
program = glCreateProgram()
vertex_shader = b'''