Skip to content

Instantly share code, notes, and snippets.

View luizbafilho's full-sized avatar

Luiz Filho luizbafilho

View GitHub Profile
@luizbafilho
luizbafilho / auth.lua
Created May 17, 2017 01:42 — forked from fur-q/auth.lua
nginx rtmp/hls server setup
-- add users:
-- $ htpasswd -s -c /etc/nginx-rtmp/.htpasswd streamname
-- stream:
-- $ ffmpeg -i foo.mp4 -c copy -f flv rtmp://abc.de/streamname?auth=password
local users = {}
for line in io.lines("/etc/nginx-rtmp/.htpasswd") do
local user, pass = line:match("([^:]+):{SHA}([^\n]+)")
users[user] = pass
end
@luizbafilho
luizbafilho / Makefile
Created February 22, 2017 01:36 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
module Request
[:get, :post, :put, :delete].each do |verb|
define_method verb do |url, payload: {}, headers: {}|
headers = define_headers(headers)
execute(verb, url, payload, headers)
end
end
def define_headers(headers)
default_headers = {
module Request
def get(url, payload: {}, headers: {})
headers = define_headers(headers)
execute(:get, url, payload, headers)
end
def post(url, payload: {}, headers: {})
headers = define_headers(headers)
execute(:post, url, payload, headers)
end
set-option -g default-shell /usr/local/bin/zsh
set -g default-terminal "screen-256color"
set -g repeat-time 125
set -g base-index 1 # count from 1
set-option -g allow-rename off
set -s escape-time 0
#Change prefix key to backtick (`)
unbind C-b
set-option -g prefix `
require 'rspec'
class Stats
def self.mean(array)
array.inject(:+) / array.size.to_f
end
def self.median(array)
mid = array.length / 2
sorted = array.sort
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.send('<h1>Hello world</h1>');
});
io.on('connection', function(socket){
console.log('a user connected');
# encoding: utf-8
site 'http://community.opscode.com/api/v1'
cookbook "apt"
cookbook "nodejs", {:github=>"mdxp/nodejs-cookbook"}
cookbook "mysql", {}
cookbook "vim", {}
cookbook "build-essential", {}
cookbook "rvm", {:github=>"fnichol/chef-rvm", :ref=>"v0.9.0"}
@luizbafilho
luizbafilho / designer.html
Last active August 29, 2015 14:07
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;