Skip to content

Instantly share code, notes, and snippets.

View eduardonunesp's full-sized avatar
🐚

Eduardo Pereira eduardonunesp

🐚
View GitHub Profile
//
// libuuid sample program
//
// library install for debian
// $ sudo apt-get install uuid-dev
//
// compile
// $ gcc uuid_test.c -luuid -o uuid_test
//
#include <stdio.h>
@eduardonunesp
eduardonunesp / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@eduardonunesp
eduardonunesp / gist:95c226ec26a9f97f3613
Created March 25, 2015 12:46
Async execute forEach with Q Promise
var Q = require('q');
var f = function(a) {
var defer = Q.defer();
setTimeout(function() {
console.log(a);
defer.resolve(a);
}, a);
return defer.promise;
};
@eduardonunesp
eduardonunesp / gist:acfd6f8d377723a15fdc
Created March 25, 2015 12:48
Accept the first fulfilled value
var Q = require('q');
var f = function(a) {
var defer = Q.defer();
if (a % 2 === 0)
defer.resolve(a);
else
defer.reject(new Error("Rejected, module is odd" + a));
return defer.promise;
};
package main
import (
"encoding/json"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"log"
"net/http"
"strconv"
)
@eduardonunesp
eduardonunesp / nginx.conf
Created September 21, 2015 23:27
nginx domain and subdomain reverse proxy
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@eduardonunesp
eduardonunesp / chat.go
Last active September 22, 2015 15:58 — forked from gmarik/chat.go
package main
import (
"bufio"
"net"
)
type Client struct {
incoming chan string
outgoing chan string
(function() {
'use strict';
new Vue({
el: '#beerApp',
data: {
botecos : [],
openDetails : []
},
@eduardonunesp
eduardonunesp / split_channels.html
Last active October 13, 2015 23:28
Split 7.1 Channels (tested in Safari 9)
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<script>
function checkForEC3Support() {
var video = document.createElement('video');
return (video.canPlayType('audio/mp4;codecs="ec-3"') !== '');
}