View even odd extraction without slicing
This file contains 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
t = model.swizzle(model.swizzle(y)).clone() | |
t[0, :, 0, 0] = torch.arange(0, 16) | |
def even_odd(x, dim=1): | |
evens, odds = x.view(x.size()), x.view(x.size()) | |
odd_offset = np.asscalar(np.prod(x.size()[dim + 1:])) | |
shape, stride = list(x.size()), list(x.stride()) | |
shape[dim] = shape[dim] // 2 | |
stride[dim] *= 2 |
View gist:3bb0d03b1dfc7e602e8ec440ae268ff5
This file contains 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 scipy.io as sio | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from tqdm import tqdm | |
np.seterr(all='raise') | |
matfile = sio.loadmat('state_meas_data.mat') | |
measurements = np.nan_to_num(matfile['z'].T, 150) | |
states = matfile['X'].T |
View renderdoc_create_render_graph
This file contains 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
# RenderDoc Python scripts, powered by IronPython 2.7.4.1000 | |
# The 'pyrenderdoc' object is the Core class instance. | |
# The 'renderdoc' module is available, as the matching namespace in C# | |
from collections import defaultdict | |
lastDraw = pyrenderdoc.CurDrawcalls[len(pyrenderdoc.CurDrawcalls) - 1] | |
draws = [] | |
for eventID in range(0, lastDraw.eventID): # lastDraw.eventID | |
curdraw = pyrenderdoc.GetDrawcall(eventID) | |
if curdraw == None: |
View Convert PFM to FLO
This file contains 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 numpy as np | |
import re | |
import sys | |
from tqdm import tqdm | |
TAG_CHAR = np.array([202021.25], np.float32) | |
''' | |
Load a PFM file into a Numpy array. Note that it will have | |
a shape of H x W, not W x H. Returns a tuple containing the |
View Create List for ChairsSDHom
This file contains 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
#!/bin/bash | |
rm ChairsSDHom_release_TRAIN.list ChairsSDHom_release_TEST.list 2> /dev/null | |
cd ./data/train | |
paste -d ' ' <(awk -v d="${PWD}" '{printf d;printf "/t0/";print;}' <(ls t0 -1)) <(awk -v d="${PWD}" '{printf d;printf "/t1/";print;}' <(ls t1 -1)) <(awk -v d="${PWD}" '{printf d;printf "/";print;}' <(ls flow/*.flo -1)) > ChairsSDHom_release_TRAIN.list | |
mv ChairsSDHom_release_TRAIN.list ../../ | |
cd ../../data/test | |
paste -d ' ' <(awk -v d="${PWD}" '{printf d;printf "/t0/";print;}' <(ls t0 -1)) <(awk -v d="${PWD}" '{printf d;printf "/t1/";print;}' <(ls t1 -1)) <(awk -v d="${PWD}" '{printf d;printf "/";print;}' <(ls flow/*.flo -1)) > ChairsSDHom_release_TEST.list | |
mv ChairsSDHom_release_TEST.list ../../ |
View gist:a6f85e5c3fed8b1a76b8
This file contains 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
// Start the module | |
// Fake a state | |
// Wait for the module to publish it's response | |
// Check to see if that response was expected | |
// Fake a new state and do it again. | |
// End the module | |
State testArray = [ | |
{sensors : {pos, barometer, gps...}, controls : {control1, control2}}, | |
{sensors : {pos, barometer, gps...}, controls : {control1, control2}}] |
View parser
This file contains 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
var html = ""; | |
var links = []; | |
$('url loc').each(function(i, e){ | |
links.push(e.innerHTML); | |
}); | |
links.sort(); | |
$(links).each(function(i, e){ | |
html += "<li><a href='"+e+"'>"+e.replace("http://www.lonestarpercussion.com/", "").replace("/", " / ").replace(/\-/g, " ").replace(/ ?\/ ?$/,"")+"</a></li>"; | |
}); |
View Message Parser
This file contains 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
//SMS | |
var ourMessages = $('sms[address*="2094842514"]') | |
var csvData = ""; | |
for(var i = 0; i < ourMessages.length; i++){ | |
csvData += "" + $(ourMessages[i]).attr('body') + "|" + $(ourMessages[i]).attr('address') + "|" + $(ourMessages[i]).attr('type') + "|" + $(ourMessages[i]).attr('readable_date') + "|" + $(ourMessages[i]).attr('contact_name') + "<br>" | |
} | |
$('smses').html(csvData) |