Skip to content

Instantly share code, notes, and snippets.

View MichaelEstes's full-sized avatar

Michael Estes MichaelEstes

View GitHub Profile
@MichaelEstes
MichaelEstes / Maya Scripts
Last active March 23, 2023 22:53
Random Maya Scripts
import maya.cmds as cmds
selList = cmds.ls(sl=1, ap=1, tr=1)
for sel in selList:
cmds.setAttr(sel + ".tx", k=1, l=0)
cmds.setAttr(sel + ".ty", k=1, l=0)
cmds.setAttr(sel + ".tz", k=1, l=0)
cmds.setAttr(sel + ".rx", k=1, l=0)
public class Blur {
private static final float BITMAP_SCALE = 0.5f;
private static final float BLUR_RADIUS = 7.5f;
public static void blurImageView(ImageView view) {
Bitmap viewBitmap = getViewBackgroundBitmap(view);
Bitmap blurredBitmap = blur(view.getContext(), viewBitmap);
view.setImageBitmap(blurredBitmap);
}
@MichaelEstes
MichaelEstes / epochToTM
Created December 11, 2015 21:15
Epoch Timestamp to TM
tm epochToTM(UINT32 epoch){
tm time;
time.tm_hour = ((epoch * 100) / 360000) % 24;
time.tm_min = ((epoch * 100) / 6000) % 60;
time.tm_sec = (epoch / 100) % 60;
time.tm_yday = ceil(fmod(epoch / 86400.0f, 365.24f));
time.tm_mon = ceil(fmod(epoch / 2629743.0f, 12.0f));
time.tm_year = (epoch / 31536000) + 1970;
return time;
Chop attempt 1:
int chop(int intToFind, int arrayToSearch[], int length){
int index = length / 2;
while (arrayToSearch[index] != intToFind){
if (arrayToSearch[index] > intToFind){
length = index;
index /= 2;
}
else if (arrayToSearch[index] < intToFind){
index = (index + length) / 2;
//25ns if hashSize = words.size()
//26ns if hashSize = words.size() / 2
//40ns if hashSize = words.size() / 4
//46ns if hashSize = words.size() / 10
vector<string> fileToLineVec(char * fileName){
ifstream file(fileName);
vector<string> out;
if (file){
file.seekg(0, file.end);
#include <iostream>
#include <sstream>
#include <fstream>
std::vector<std::string> fileToLineArr(char * fileName){
std::ifstream data(fileName);
if (!data){
std::cout << "Could not find file " << fileName << std::endl;
}
std::string line;
@MichaelEstes
MichaelEstes / Shader Loader
Last active August 29, 2015 14:18
Function for loading shaders in text files
#include <fstream>
#include <sstream>
char* LoadShader(string fileName)
{
char * shader;
stringstream buffer;
ifstream s(fileName);
buffer << s.rdbuf();
shader = new char[buffer.str().size() + 1];
@MichaelEstes
MichaelEstes / Quicksort C++ (unfinished)
Last active August 29, 2015 14:17
Quicksort in C++ for int arrays
void quickSort(int arr[], int left, int right)
{
int leftIndex, rightIndex, temp;
leftIndex = left;
rightIndex = right;
do
{
@MichaelEstes
MichaelEstes / Merge-Sort C++
Last active August 29, 2015 14:17
Merge sort in C++ using int arrays
void copyArray(int arrA[], int arrB[], int lower, int upper)
{
for (int i = lower; i < upper; i++)
{
arrA[i] = arrB[i];
}
}
void merge(int arr[], int lower, int mid, int upper)
{
@MichaelEstes
MichaelEstes / Insertion Sort C++
Last active August 29, 2015 14:17
Int Array Insertion Sort in C++
void insertionSort(int arr[], int size)
{
int temp,j;
for (int i = 1; i < size; i++)
{
j = i;
while (arr[j] < arr[j - 1])
{
temp = arr[j];
arr[j] = arr[j - 1];