Skip to content

Instantly share code, notes, and snippets.

View TechplexEngineer's full-sized avatar

Blake Bourque TechplexEngineer

View GitHub Profile
@TechplexEngineer
TechplexEngineer / num2hex.lua
Created July 13, 2015 22:13
Print a number in its hexadecimal format. Based on http://snipplr.com/view/13086/number-to-hex/
-- convert a number to its hex representation
function num2hex(num, hexdigits)
local hexstr = '0123456789abcdef'
local s = ''
while num > 0 do
local mod = math.fmod(num, 16)
s = string.sub(hexstr, mod+1, mod+1) .. s
num = math.floor(num / 16)
end
if s == '' then s = '0' end
@TechplexEngineer
TechplexEngineer / ms-oxcrpc.cnf
Created July 9, 2015 14:10
MAPI Extensions IDL ms-oxcrpc
# Conformance file for ms-oxcrpc
#Not sure what should go here
alias nows="rename -n 's/\s+/_/g'"
@TechplexEngineer
TechplexEngineer / img400.sh
Created June 26, 2015 03:19
Generate a list of files that are not at least 400x400
#!/bin/bash
#Generate a list of files that are not at least 400x400
#if number of args is greater than 1
if [ $# -gt 1 ];
then
what=$@
else
what='*.png *.jpg'
System.DllNotFoundException: openjpeg-dotnet-x86_64.dll
at (wrapper managed-to-native) OpenMetaverse.Imaging.OpenJPEG:DotNetAllocEncoded64 (OpenMetaverse.Imaging.OpenJPEG/MarshalledImage&)
at OpenMetaverse.Imaging.OpenJPEG.DecodeToImage (System.Byte[] encoded, OpenMetaverse.Imaging.ManagedImage& managedImage) [0x0002d] in /home/techplex/Documents/projects/opensim_web_viewer/viewer/Whitecore-LibOMV/OpenMetaverse/Imaging/OpenJPEG.cs:289
at OpenMetaverse.Assets.AssetTexture.Decode () [0x00020] in /home/techplex/Documents/projects/opensim_web_viewer/viewer/Whitecore-LibOMV/OpenMetaverse/Assets/AssetTypes/AssetTexture.cs:98
at OpenMetaverse.AppearanceManager+<DownloadTextures>c__AnonStorey12.<>m__13 (TextureRequestState state, OpenMetaverse.Assets.AssetTexture assetTexture) [0x00007] in /home/techplex/Documents/projects/opensim_web_viewer/viewer/Whitecore-LibOMV/OpenMetaverse/AppearanceManager.cs:1630
at OpenMetaverse.AssetManager+<HttpRequestTexture>c__AnonStorey1A.<>m__1C (System.Net.HttpWebRequest req
@TechplexEngineer
TechplexEngineer / !mod.py
Last active August 29, 2015 14:22
Working with XML files
#!/usr/bin/python
from xml.dom.minidom import parse
import xml.dom.minidom
# Open XML document using minidom parser
dom = xml.dom.minidom.parse("HAWC300_300_outrigger_s12.xml")
root = dom.documentElement
# get a list of all the tanks
@TechplexEngineer
TechplexEngineer / json_recurse_scandir.php
Created April 29, 2015 05:13
Generate a json string of files in a directory
<?php
header('Content-Type: application/json');
function scandir_folders($d, $blacklist = array('.', '..')) {
return array_filter(scandir($d), function ($f) use($d, $blacklist) {
return is_dir($d . DIRECTORY_SEPARATOR . $f) && !in_array($f, $blacklist);
});
}
function scandir_all($d, $blacklist = array('.', '..')) {
@TechplexEngineer
TechplexEngineer / printTree.php
Created April 29, 2015 04:44
Recursive print directory tree
<?php
function scandir_folders($d, $blacklist = array('.', '..')) {
return array_filter(scandir($d), function ($f) use($d, $blacklist) {
return is_dir($d . DIRECTORY_SEPARATOR . $f) && !in_array($f, $blacklist);
});
}
function scandir_all($d, $blacklist = array('.', '..')) {
return array_filter(scandir($d), function ($f) use($d, $blacklist) {
@TechplexEngineer
TechplexEngineer / FuzzyAdd.coffee
Created April 18, 2015 03:23
Code to add fuzzy numbers
#Input fuzzy number. Possibility distribution
pos = {
156: 0,
157: 0.25,
158: 0.5,
159: 0.75,
160: 1,
161: 1,
162: 1,
@TechplexEngineer
TechplexEngineer / constrain.js
Created February 23, 2015 01:07
constrain a number between an upper and lower bound
/**
* constrain a number between an upper and lower bound
* @param {num} min lower bound
* @param {num} value value to be constrained
* @param {num} max upper bound
* @return {num} the constrained value
*/
function constrain(min, value, max) {
if (value > max)
return max;