Skip to content

Instantly share code, notes, and snippets.

View TechplexEngineer's full-sized avatar

Blake Bourque TechplexEngineer

View GitHub Profile
@TechplexEngineer
TechplexEngineer / YupNope-function-in-nope.js
Created December 19, 2011 05:25
Is there a way to make this work?
var q = $.parseQuery();
if(!q.plugin)//If the value isn't set
window.location = "./"; //Go to the index file
yepnope([{
test: q.plugin === 'javascript',
yep: 'plugins/javascript.js',
nope: yepnope([{
test: q.plugin === 'arduino',
yep: 'plugins/arduino.js',
nope: yepnope([{
<script>
var q = $.parseQuery();
if(!q.plugin)//If the value isn't set
window.location = "./"; //Go to the index file
var testRes = ({
"javascript" : "plugins/javascript.js",
"arduino" : "plugins/arduino.js",
"frcjava" : "plugins/frcjava.js"
})[ q.plugin ];
@TechplexEngineer
TechplexEngineer / dabblet.css
Created January 8, 2012 18:48
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background-color:#269;
background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
linear-gradient(0, rgba(255,255,255,.5) 1px, transparent 1px),
linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),
linear-gradient(0, rgba(255,255,255,.3) 1px, transparent 1px);
@TechplexEngineer
TechplexEngineer / gist:4323907
Created December 18, 2012 00:49
nodejitsu troubles when attempting to deploy for the first time Win7 64bit
C:\Users\Techplex.Engineer\Desktop\nodeApp>jitsu deploy
info: Welcome to Nodejitsu techplex.engineer
info: jitsu v0.11.4, node v0.8.1
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Welcome to Nodejitsu techplex.engineer
info: jitsu v0.11.4, node v0.8.1
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
@TechplexEngineer
TechplexEngineer / output
Created December 20, 2012 03:56
sample data
{
"_id": 1,
"avatar": "Techplex Engineer",
"created": "Wed Dec 19 2012 22:12:36 GMT-0500 (Eastern Standard Time)",
"email": "[email protected]",
"lastLogin": "Wed Dec 19 2012 22:49:38 GMT-0500 (Eastern Standard Time)",
"password": "516b9783fca517eecbd1d064da2d165310b19759",
"username": "techplex",
"uuid": "7e6aba77-bf2c-41b5-8736-30f33ea563c7"
}
@TechplexEngineer
TechplexEngineer / gist:4367638
Created December 24, 2012 04:55
Error when installing v8-profiler
C:\Users\Techplex.Engineer\Desktop\nodeApp>npm install v8-profiler
npm http GET https://registry.npmjs.org/v8-profiler
npm http 304 https://registry.npmjs.org/v8-profiler
> [email protected] install C:\Users\Techplex.Engineer\Desktop\nodeApp\node_modules\v8-profiler
> node-gyp rebuild
C:\Users\Techplex.Engineer\Desktop\nodeApp\node_modules\v8-profiler>node "C:\Users\Techplex.Engineer\AppData\Roaming\npm\node_modules\npm\bin\node-gyp
-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
@TechplexEngineer
TechplexEngineer / clz.c
Last active December 15, 2015 15:29
64bit count leading 0's in c rev2: added attribution, fixed comments
//Count Leading Zeros (CLZ)
//Adapted from Wikipedia: http://en.wikipedia.org/wiki/Find_first_set#Algorithms
int clz (uint64_t x) {
uint64_t t;
int r;
if (x == 0)
return 0;
t = 0x8000000000000000; //mask
r = 0; //number of zeros counter
@TechplexEngineer
TechplexEngineer / Makefile
Last active December 15, 2015 15:29
Simple example of how to do unsigned 64bit division in c rev2: If you quit out, it doesn't print the R & Q as they are false. rev3: added some test cases rev4: fixed comment spacing rev5: one can set test cases rev6: fixed case 2. Case 10 remains broken rev7: fixed segvault issue rev8: works for all 10 test cases! rev9: added more debug comments…
OBJS = udiv_64.o
CFLAGS = -Wall -Wformat
TARGET = test
all: $(OBJS)
$(CC) -o $(TARGET) $(OBJS)
run: all
./$(TARGET)
case GPIO_MODE:
ret = copy_from_user(&mdata, (struct gpio_data_mode __user *)arg, sizeof(struct gpio_data_mode));
if (ret != 0) {
printk(KERN_DEBUG "[MODE] Error copying data from userspace\n");
return -EFAULT;
}
//get struct from userspace
pin = mdata.pin;
@TechplexEngineer
TechplexEngineer / i2c_temp.c
Created April 17, 2013 12:10
How to read from a TC74 Temperature sensor on the Raspberry Pi.
float read_temp(int address, char bus) {
unsigned int temp = 0;
unsigned char msb, lsb;
int fd; // File descriptor
char *fileName;
//int address = 0x49; // Address of TP102
unsigned char buf[10]; // Buffer for data being read/ written on the i2c bus
if (bus == 1)