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
function P_project = projectPointsOntoPlane(uv, pointOnPlane, points) | |
% related: http://www.mathworks.com/matlabcentral/newsreader/view_thread/293244 | |
% uv is a unit vector of the normal to the plane | |
% pointOnPlane is a point of the plane | |
% points is a point cloud that is to be projected (flattened) onto | |
% the plane | |
if(size(uv,1) == 3) | |
% one xyz point per column | |
Q = pointOnPlane'; | |
m = size(points,2); |
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
// Generating a CLUT of the Microsoft Safety Pallete | |
// https://www.gidforums.com/t-21296.html | |
// Microsoft Safety Pallete | |
// https://msdn.microsoft.com/en-us/library/bb250466(VS.85).aspx | |
// Convert to indexed color | |
int index = (color.red()/51)*36 | |
+ (color.green()/51)*6 | |
+ color.blue()/51 | |
+ 20; |
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
# Handles lots of cases but only for certain kinds of c++ coding | |
# Example conversion: | |
# int count = 0; | |
# for(int i = 0; i < 5; i++) | |
# count++; | |
# | |
# changes to | |
# | |
# count = 0; |
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
% This uses http://www.mathworks.com/matlabcentral/fileexchange/29276-dragzoom-drag-and-zoom-tool | |
% and makes the last zoom of an open figure window persistent for the next run. | |
% These axis settings could get pushed to an external file to make them always happen, too. | |
% Place the following at the top of your .m file | |
% Store the position of figure 1 | |
myfig = 0; |
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
// https://learn.adafruit.com/adafruit-arduino-lesson-3-rgb-leds/breadboard-layout | |
// http://www.arduino.cc/en/Tutorial/Button | |
/* | |
Adafruit Arduino - Lesson 3. RGB LED | |
*/ | |
int redPin = 11; | |
int greenPin = 10; |
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
// http://www.slideshare.net/emayssat/qt-quick-qml-and-canvas-tutorial | |
import QtQuick 2.0 | |
Item { | |
Rectangle { | |
id: root | |
width: 640 | |
height: 360 | |
color: "#3C3C3C" | |
ListModel { |
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
Sub Main() | |
Call explode_rows("Sheet1", "Sheet2", 2, ",") | |
End Sub | |
Function explode_rows(sheet_src As String, sheet_dest As String, col As Integer, sep As String) | |
Dim wb As Workbook | |
Dim r_src As Integer | |
Dim r_dest As Integer |
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
# Prints the stack trace and some context lines for where the stack trace happened | |
# rotate the log | |
unlink /var/rotating_log.log | |
datetime=$(date +%m%d%Y_%H%M%S); | |
logfile="rotating_log_$datetime.log" | |
echo "Started on $datetime" > $logfile | |
#chfile mygroup 664 $logfile | |
ln -s $logfile rotating_log.log |
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
{ | |
"game_setups": [ | |
{ | |
"name": "setup_template", | |
"players": [ | |
{ | |
"name": "Player 1" | |
}, | |
{ | |
"name": "Player 2" |
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
#include "readonlydelegate.h" | |
ReadOnlyDelegate::ReadOnlyDelegate(QObject *parent) : | |
QItemDelegate(parent) | |
{ | |
} | |
bool ReadOnlyDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) | |
{ | |
return false; |
OlderNewer