Skip to content

Instantly share code, notes, and snippets.

@alepez
alepez / gist:5582882
Created May 15, 2013 09:56
remove Offending key ssh
sed -i -e "$( ssh root@vimageoslive 2>&1 | grep Offending | sed 's/.*:\([0-9]\+\).*/\1/' )d" .ssh/known_hosts
@alepez
alepez / gist:5584415
Created May 15, 2013 14:33
Ogre: background with PT_PLANE entity, camera at (0.0, H, 0.0) looking down
plane_ = createEntity("PLANE");
plane_->getSubEntity(0)->setMaterialName("Background");
plane_->setRenderQueueGroup(RENDER_QUEUE_BACKGROUND);
node_ = rootNode()->createChildSceneNode();
node_->attachObject(plane_);
node_->lookAt(Vector3::UNIT_Y, Ogre::Node::TS_WORLD, Ogre::Vector3::UNIT_Z);
@alepez
alepez / gist:5584901
Created May 15, 2013 15:37
all projects in directory: git pull and male
for i in *; do ( echo "============ $i "; cd $i && git pull && cd Release && make -j8 all ); done
@alepez
alepez / gist:5590393
Created May 16, 2013 09:00
Disable udev2 name scheme for network interfaces
## Disable udev2 name scheme for network interfaces
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
@alepez
alepez / gist:5590505
Created May 16, 2013 09:17
Ogre: copy camera settings (clone camera)
newCamera->synchroniseBaseSettingsWith(oldCamera);
@alepez
alepez / gist:5597748
Created May 17, 2013 08:28
remove ssh known host key
function ssh-known-hosts-rm { sed -i -e "$( ssh $@ -o StrictHostKeyChecking 2>&1 | grep Offending | sed 's/.*:\([0-9]\+\).*/\1/' )d" .ssh/known_hosts }
@alepez
alepez / gist:5748800
Last active December 18, 2015 07:48
parse hex string to bytes. values can be separated by spaces
void parseData(const char* dataStr, unsigned char* data, int* length) {
::memset(data, 0, sizeof(data));
const char* ds = dataStr;
unsigned char* d = data;
char byteStr[3] = { 0 };
while (true) {
if (ds[0] == ' ') {
++ds;
}
if (ds[0] == 0 || ds[1] == 0) {
@alepez
alepez / serialecho.cpp
Last active December 18, 2015 07:49
stupid c++ (almost c) program to write data to serial port. Input string is hex. serialecho /dev/ttyUSB0 9600 "63 69 61 6f"
/*
* main.cpp
*
* Created on: Jun 10, 2013
* Author: pez
*/
#include <termios.h>
#include <string.h>
#include <unistd.h>
@alepez
alepez / gist:5774455
Created June 13, 2013 15:08
add ../lib directory relative to script to RUBYPATH
$: << File.expand_path("../lib", File.dirname(__FILE__))
@alepez
alepez / jquery.js
Created June 14, 2013 06:13
jquery empty
(function($) {
$(document).ready(function() {
});
})(jQuery)