Skip to content

Instantly share code, notes, and snippets.

View sdabet's full-sized avatar

Sébastien Dabet sdabet

  • Grenoble, France
View GitHub Profile
@sdabet
sdabet / UsbCecConnection.java
Last active December 5, 2024 22:53
Send simple HDMI-CEC commands from an Android app via Pulse-Eight's USB-CEC adapter
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.util.Log;
import com.felhr.usbserial.UsbSerialDevice;
import com.felhr.usbserial.UsbSerialInterface;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@sdabet
sdabet / CmdService.java
Last active January 20, 2016 15:50
Implementation of Android command interpreter (usable via telnet for instance).
package com.example.sdabet.test;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;
import java.io.IOException;
import java.io.PrintWriter;
@sdabet
sdabet / Install OpenCV via homebrew
Last active August 29, 2015 14:14
Installation of OpenCV on Mac OS Maverick
brew install opencv
@sdabet
sdabet / AspectRatioScript.cs
Created January 21, 2015 12:56
Aspect ratio script for Unity
using UnityEngine;
using System.Collections;
public class AspectRatioScript : MonoBehaviour {
public float targetAspect;
void Start ()
{
float windowAspect = (float)Screen.width / (float)Screen.height;
@sdabet
sdabet / Behaviour.cs
Last active July 19, 2023 17:42
Simulating touch events from mouse events in Unity
void Update () {
// Handle native touch events
foreach (Touch touch in Input.touches) {
HandleTouch(touch.fingerId, Camera.main.ScreenToWorldPoint(touch.position), touch.phase);
}
// Simulate touch events from mouse events
if (Input.touchCount == 0) {
if (Input.GetMouseButtonDown(0) ) {
HandleTouch(10, Camera.main.ScreenToWorldPoint(Input.mousePosition), TouchPhase.Began);
@sdabet
sdabet / production.rb
Created December 1, 2014 16:35
Enable asset precompilation in Rails app
config.assets.compile = true
@sdabet
sdabet / Gemfile
Created December 1, 2014 16:33
Rails DB configuration for Cloud9 and Heroku
# Use postgreSQL on Heroku
group :production, :staging do
gem "pg"
end
# Use SQLite on Cloud9
group :development, :test do
gem "sqlite3"
end
@sdabet
sdabet / bootstrap_config.css.scss
Created December 1, 2014 10:27
Integration of Bootstrap into a Rail project
@import "bootstrap-sprockets";
@import "bootstrap";
@import "bootstrap/theme";
#import "CCSprite.h"
@interface SoftBubble : CCSprite
@end
@sdabet
sdabet / myApp.js
Last active December 26, 2015 06:18
Animation of Renegade sprite with cocos2d-html5 sprite
var MyLayer = cc.Layer.extend({
init:function () {
this._super();
var size = cc.Director.getInstance().getVisibleSize();
this.setMouseEnabled(true);