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
$(document).ready(function() { | |
// convert all a/href to a#href | |
$("body").delegate("a", "click", function(){ | |
var href = $(this).attr("href"); // modify the selector here to change the scope of intercpetion | |
// Push this URL "state" onto the history hash. | |
$.bbq.pushState(href,2); | |
// Prevent the default click behavior. |
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
// g++ main.cpp -o main -lsfml-window -lsfml-graphics -lsfml-system -losg -losgDB -losgGA -losgUtil | |
#include <SFML/Graphics.hpp> | |
#include <osgUtil/SceneView> | |
#include <osg/Node> | |
#include <osg/CameraNode> | |
#include <osg/Group> | |
#include <osgDB/ReadFile> |
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 <errno.h> | |
#include <fcntl.h> | |
#include <linux/videodev2.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/ioctl.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
#include <opencv2/core/core.hpp> |
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
#undef HID_ENABLED | |
// Arduino Due ADC->DMA->USB 1MSPS | |
// by stimmer | |
// from http://forum.arduino.cc/index.php?topic=137635.msg1136315#msg1136315 | |
// Input: Analog in A0 | |
// Output: Raw stream of uint16_t in range 0-4095 on Native USB Serial/ACM | |
// on linux, to stop the OS cooking your data: | |
// stty -F /dev/ttyACM0 raw -iexten -echo -echoe -echok -echoctl -echoke -onlcr |
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 | |
# Step 1: Install LZO dependencies | |
yum -y install lzo lzo-devel lzop | |
# Step 2: Install maven | |
MVN_VERSION=3.2.5 | |
MVN_MD5=b2d88f02bd3a08a9df1f0b0126ebd8dc | |
# wget http://www.apache.org/dyn/closer.cgi/maven/maven-3/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz | |
wget http://apache.claz.org/maven/maven-3/$MVN_VERSION/binaries/apache-maven-$MVN_VERSION-bin.tar.gz |
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 org.apache.spark._ | |
import org.apache.spark.SparkContext._ | |
import org.apache.spark.rdd.RDD | |
import scala.util.Random | |
import java.io._ | |
import java.util.Properties | |
import org.apache.hadoop.fs._; | |
import org.apache.hadoop.conf._; | |
import org.apache.hadoop.io._; |
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 | |
from scipy.ndimage.interpolation import map_coordinates | |
from scipy.ndimage.filters import gaussian_filter | |
def elastic_transform(image, alpha, sigma, random_state=None): | |
"""Elastic deformation of images as described in [Simard2003]_. | |
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for | |
Convolutional Neural Networks applied to Visual Document Analysis", in |
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
// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD | |
osg::ref_ptr<osg::Camera> camera = new osg::Camera(); | |
// set the view matrix | |
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); | |
// use identity view matrix so that children do not get (view) transformed | |
camera->setViewMatrix(osg::Matrix::identity()); | |
// set the projection matrix to be of width and height of 1 | |
camera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1.0f, 0, 1.0f)); | |
// set resize policy to fixed |
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
require 'image' | |
function ElasticTransform(img, alpha, sigma) | |
--[[ | |
Parameters | |
---------- | |
img: Tensor of size KxHxW | |
Image on which elastic transformation have to be applied | |
alpha: number | |
Intensity of the transformation |
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
class AttentionLSTM(LSTM): | |
"""LSTM with attention mechanism | |
This is an LSTM incorporating an attention mechanism into its hidden states. | |
Currently, the context vector calculated from the attended vector is fed | |
into the model's internal states, closely following the model by Xu et al. | |
(2016, Sec. 3.1.2), using a soft attention model following | |
Bahdanau et al. (2014). | |
The layer expects two inputs instead of the usual one: |
OlderNewer