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 / git-submodule
Created December 7, 2015 23:18
git-submodules.sh: add, init, update or list git submodules
#!/bin/sh
#
# git-submodules.sh: add, init, update or list git submodules
#
# Copyright (c) 2007 Lars Hjemli
USAGE="[--quiet] [--cached] \
[add <repo> [-b branch] <path>]|[status|init|update [-i|--init]|summary [-n|--summary-limit <n>] [<commit>]] \
[--] [<path>...]|[foreach <command>]|[sync [--] [<path>...]]"
OPTIONS_SPEC=
@ruisebastiao
ruisebastiao / gist:3e845d0983d1a0fa99c1
Last active January 20, 2016 16:03
Add static ip profile in /etc/dhcpcd.conf
# define static profile
profile static_eth0
static ip_address=192.168.250.5/24
static routers=192.168.250.4
static domain_name_servers=192.168.250.4
# fallback to static profile on eth0
interface eth0
fallback static_eth0
@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');
}