Skip to content

Instantly share code, notes, and snippets.

View henricavalcante's full-sized avatar
🏠
Working from home

Henri Cavalcante henricavalcante

🏠
Working from home
View GitHub Profile
@henricavalcante
henricavalcante / stream.sh
Created December 19, 2023 21:33
ffmpeg rtsp -> rtmp
ffmpeg -f lavfi -i anullsrc \
-rtsp_transport tcp -i "rtsp://" -tune zerolatency \
-t 12:00:00 -pix_fmt + -vsync 0 \
-c:v libx264 -vcodec libx264 -b:v 13500k -s 2560x1440 \
-c:a aac -b:a 128k \
-strict experimental \
-f flv "rtmp://a.rtmp.youtube.com/live2/{key}" -nostdin -nostats
@henricavalcante
henricavalcante / async.php
Created November 15, 2023 14:39
PHP Async Example
<?php
$counter = 1;
function aJob(bool $async, int $pid) {
sleep(1);
global $counter;
echo "Async:" . ($async ? "true" : "false");
echo " Pid:" . $pid;
@henricavalcante
henricavalcante / travazap.js
Created October 20, 2023 18:06
Paste on console and gg.
async function enviarScript(scriptText){
const lines = scriptText.split(/[\n\t]+/).map(line => line.trim()).filter(line => line);
main = document.querySelector("#main"),
textarea = main.querySelector(`div[contenteditable="true"]`)
if(!textarea) throw new Error("Não há uma conversa aberta")
setInterval(() => {
textarea.focus();
@henricavalcante
henricavalcante / instrucoes.md
Last active May 8, 2019 03:37
Instruções Hackathon Now 2019

Interface para os usuários do sebraelab terem acesso à agenda de disponibilidade do espaço.

Interface para a solicitação de espaço no sebraelab bem como o gerenciamento das informações e liberação de acesso.

Script de automatização de um processo interno onde um script será executado para coletar informações e cadastrar em um calendário.

Segue abaixo credenciais para consumir a api do sistema do sebrae:

window.open(Array.prototype.slice.call(document.getElementsByClassName('_vbtk2')).map((a) => a.href ).sort(() => .5 - Math.random())[0])
@henricavalcante
henricavalcante / package.json
Last active April 26, 2017 04:13
Webpack + AngularJS Boilerplate
{
"name": "repo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --config webpack.build.js --bail -p",
"deploy": "webpack --config webpack.build.js --bail -p && firebase deploy",
"dev": "node_modules/.bin/webpack-dev-server --history-api-fallback --hot --inline --progress"
},
@henricavalcante
henricavalcante / form-validation.js
Last active September 11, 2016 11:10
Old form validation
<!-- Hide the script from old browsers
function containsblanks(s)
{
for(var i = 0; i < s.value.length; i++)
{
var c = s.value.charAt(i);
if ((c == ' ') || (c == '\n') || (c == '\t'))
{
alert('The field must not contain whitespace');
return false;

Keybase proof

I hereby claim:

  • I am henricavalcante on github.
  • I am henricavalcante (https://keybase.io/henricavalcante) on keybase.
  • I have a public key whose fingerprint is 7668 381B E98B 142E 17CC 5489 BECE F255 256A 5AC5

To claim this, I am signing this object:

@henricavalcante
henricavalcante / bmp.erl
Created July 8, 2016 00:23
Bitmap generator in erlang
-module(bmp).
-export([generate/0, header/2, i/2, c/1]).
header(FileSz, Offset) ->
<<
"BM",
FileSz:32/little,
0:32,
Offset:32/little
@henricavalcante
henricavalcante / firebase_relay.js
Last active May 17, 2016 02:25
Relay control over firebase
const five = require('johnny-five');
const board = new five.Board();
const Firebase = require('firebase');
const relays = new Firebase('https://io16natal.firebaseio.com').child('relay');
board.on('ready', () => {
const lamps = {
'01': new five.Relay(8),
'02': new five.Relay(9),
'03': new five.Relay(10),