Skip to content

Instantly share code, notes, and snippets.

@ruisebastiao
ruisebastiao / OpenCV2WPFConverter
Last active August 29, 2015 14:27 — forked from eklimcz-zz/OpenCV2WPFConverter
OpenCV Image to WPF Image Converter
public static System.Drawing.Bitmap ToBitmap(this BitmapSource bitmapsource)
{
System.Drawing.Bitmap bitmap;
using (var outStream = new MemoryStream())
{
// from System.Media.BitmapImage to System.Drawing.Bitmap
BitmapEncoder enc = new BmpBitmapEncoder();
enc.Frames.Add(BitmapFrame.Create(bitmapsource));
enc.Save(outStream);
bitmap = new System.Drawing.Bitmap(outStream);
@ruisebastiao
ruisebastiao / tl-wn725n.md
Last active August 27, 2015 15:05 — forked from Couto/tl-wn725n.md
Install TL-WN725N on Raspbian

TL-WN725N (8188eu)

This was tested on the Raspbian wheezy (2014-01-07)

Update the system

apt-get update --fix-missing
apt-get upgrade
apt-get dist-upgrade
@ruisebastiao
ruisebastiao / Makefile
Created September 29, 2015 23:13 — forked from llj098/Makefile
a sample tcp server runs in kernel
obj-m += tcp_svr_sample.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea
@ruisebastiao
ruisebastiao / client-side-pseudo-code.js
Created February 24, 2016 20:57 — forked from gpstmp/client-side-pseudo-code.js
AngularJS: combine REST with Socket.IO
'use strict';
angular.module('app.api.entities.task', ['app.api.rest.task'])
.factory('Task', ['$rootScope', '$q', 'TaskApi', 'Socket', function($rootScope, $q, TaskApi, Socket) {
// here we use a simple in memory cache in order to keep actual data
// you can make it in any other way
var cache = {};
var initObject = function(data) {
if (cache[data._id]) {
@ruisebastiao
ruisebastiao / client-side-pseudo-code.js
Created February 24, 2016 20:58 — forked from gpstmp/client-side-pseudo-code.js
AngularJS: combine REST with Socket.IO
'use strict';
angular.module('app.api.entities.task', ['app.api.rest.task'])
.factory('Task', ['$rootScope', '$q', 'TaskApi', 'Socket', function($rootScope, $q, TaskApi, Socket) {
// here we use a simple in memory cache in order to keep actual data
// you can make it in any other way
var cache = {};
var initObject = function(data) {
if (cache[data._id]) {
@ruisebastiao
ruisebastiao / nodejs-tcp-example.js
Created March 12, 2016 22:21 — forked from tedmiston/nodejs-tcp-example.js
Node.js tcp client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@ruisebastiao
ruisebastiao / BigButton.qml
Created November 14, 2016 06:02 — forked from jemc/BigButton.qml
Big Button example in QML using SVG and native layers
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import QtGraphicalEffects 1.0
Item {
height: 200
width: 200
@ruisebastiao
ruisebastiao / controller.js
Created December 15, 2016 12:04 — forked from BobNisco/controller.js
onLongPress AngularJS Directive - Great for mobile!
// Somewhere in your controllers for this given example
// Example functions
$scope.itemOnLongPress = function(id) {
console.log('Long press');
}
$scope.itemOnTouchEnd = function(id) {
console.log('Touch end');
}
@ruisebastiao
ruisebastiao / passport.js
Created July 20, 2017 22:02 — forked from manjeshpv/passport.js
Passport.js using MySQL for Authentication with Express
// config/passport.js
// load all the things we need
var LocalStrategy = require('passport-local').Strategy;
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
@ruisebastiao
ruisebastiao / example-usage.ts
Created January 15, 2018 10:44 — forked from glenngr/example-usage.ts
Fit contents directive for angular2-google-maps (sebm-google-map)
import { Subject } from 'rxjs/Subject';
import { Store } from '@ngrx/store';
import { Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core';
import { AppState } from '../../../root.reducer';
@Component({
selector: 'my-map-example',
template: `
<sebm-google-map