This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override.so:override.c | |
gcc -shared -fPIC $^ -o $@ | |
test: | |
LD_PRELOAD=$(PWD)/override.so glxgears | |
clean: | |
rm $(PWD)/override.so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This isn't exactly like having super-methods, especially since there are no | |
// classes or inheritances in C, but this can be useful with things like LD_PRELOAD | |
// where you want to override or proxy an existing function, and want the function | |
// to continue executing as it usually would(vs being a no-op). | |
#define _GNU_SOURCE | |
#include <dlfcn.h> | |
void glVertex3f(float x, float y, float z){ // an OpenGL function | |
static void (*super)(float, float, float) = NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
process.stdin.setEncoding('utf8'); | |
var capturing, frame, melCode, triangles, trimatcher; | |
trimatcher = /<glTri>\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)\s(\-*\d+\.\d+)/ | |
var euclidianizeVertex = function(w, x, y, z){ | |
return { | |
x: x/w, | |
y: y/w, | |
z: z/w |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is how I was able to get an mp3 file to play through my Echo Dot. | |
// | |
// Most audioPlayer examples seem overcomplicated, but this is essentially | |
// all I had to do. I did not test pausing, but you can say "Alexa, stop" | |
// and the audio will quit. | |
// | |
// Thought this would be helpful for those having trouble with this and | |
// will prove useful for those who just want to play audio clips without | |
// a complicated "interface". | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I HATE MY LIFE | |
ccbtitcomb-mbpr:assethostx btitcomb$ docker exec assethost server | |
/root/config/environments/production.rb:79:in `block in <top (required)>': undefined method `[]' for nil:NilClass (NoMethodError) | |
from /usr/local/bundle/gems/railties-5.0.2/lib/rails/railtie.rb:209:in `instance_eval' | |
from /usr/local/bundle/gems/railties-5.0.2/lib/rails/railtie.rb:209:in `configure' | |
from /root/config/environments/production.rb:1:in `<top (required)>' | |
from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require' | |
from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in require' | |
from /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import maya.cmds as cmds | |
sys.stdout = sys.__stdout__ | |
dir(sys.stdout) | |
print cmds.currentTime(query=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
cmds.expression(n='expressionName', s='currentTime -query;') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
from threading import Thread | |
import maya.cmds | |
import maya.utils | |
def server_start(): | |
server_address = '0.0.0.0', 8765 # Usage: server.py <port> | |
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
server.bind(server_address) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds | |
import maya.utils | |
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket | |
from threading import Thread | |
class SimpleEcho(WebSocket): | |
def handleMessage(self): | |
# echo message back to client | |
#self.sendMessage(maya.utils.executeInMainThreadWithResult(self.data)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class Frame { | |
constructor(samples){ | |
// A single frame == 1 second of audio with a 44100 sample rate | |
this.prev = null; | |
this._next = null; | |
// this.samples = samples || new Float32Array(44100); | |
this.samples = samples || []; | |
this.callbacks = []; |