Skip to content

Instantly share code, notes, and snippets.

View breim's full-sized avatar
:shipit:

Henrique Breim breim

:shipit:
  • Barcelona, Spain
View GitHub Profile
@mjbalcueva
mjbalcueva / password-input.tsx
Last active November 14, 2024 22:10
shadcn ui custom password input
'use client'
import * as React from 'react'
import { EyeIcon, EyeOffIcon } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Input, type InputProps } from '@/components/ui/input'
import { cn } from '@/lib/utils'
const PasswordInput = React.forwardRef<HTMLInputElement, InputProps>(({ className, ...props }, ref) => {
@michelmany
michelmany / app.js
Last active April 22, 2023 00:42
Vue.js 2 Vee-validate (pt-br) CPF Validation
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import VeeValidator, { Validator } from 'vee-validate'
import CpfValidator from './components/validators/cpf.validator'
import Dictionary from './components/validators/dictionary'
import Produto from './components/produtos.vue'
Validator.extend('cpf', CpfValidator)
@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
@sergiomaia
sergiomaia / addhashtag.rb
Created October 4, 2016 23:24
Add Hashtag
# para esse exemplo pressupõe-se que você tenha um recurso post com o campo >> content:string
#Primeiro criamos um model Tag
rails g model Tag name:string
# >> crie uma tabela CreatePostsTags com post_id e tag_id (para nosso relacionamento has_and_belongs_to_many)
rails g migration CreatePostsTags post:references tag:references
# >> modifique a migration CreatePostsTags add :id => false, já que não precisaremos de id nesta tabela
class CreatePostsTags < ActiveRecord::Migration[5.0]
@victusfate
victusfate / nginx.conf
Last active September 7, 2018 00:47
transcodes and allows reconnect
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
_ _ _ ____ _ _
| | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
| |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
| _ | (_| | (__| < | |_) | (_| | (__| <|_|
|_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)
Um Guia Faça Você Mesmo
@breim
breim / pir.python
Created August 11, 2015 01:10
Take a photo and Tweet when moviment is detected via raspberry
#!/usr/bin/env python
# Import required Python libraries
import time
import RPi.GPIO as GPIO
import sys
from twython import Twython
import pygame
@deedos
deedos / nginx-rtmp.md
Created July 14, 2015 19:12
Instalação e configuração de nginx-rtmp module e ffmpeg para transcoding

Instalação e Configuração de nginx-rtmp com live transcoding - S.O : Debian SID stable

  • Instalar ffmpeg da fonte: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

  • Instalar nginx com módulo rtmp

      wget http://nginx.org/download/nginx-1.9.3.tar.gz
      git clone https://github.com/arut/nginx-rtmp-module
      wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.bz2
      tar -xvf pcre-8.36.tar.bz2
      tar -xvf nginx-1.9.3.tar.gz
      cd nginx-1.9.3
    
require 'aws-sdk'
require 'base64'
COREOS_AMI="ami-4b1c763c"
ec2 = Aws::EC2::Client.new(region: 'eu-west-1')
ecs = Aws::ECS::Client.new(region: 'eu-west-1')
NUM_INSTANCES=10
@MarkMurphy
MarkMurphy / README.md
Last active October 1, 2024 20:27
Rails resumable uploads

Uploads large files in multiple chunks. Also has the ability to resume if the upload is interrupted.

Typical usage:

  1. Send a POST request to /upload with the first chunk of the file and receive an upload id in return.
  2. Repeatedly PATCH subsequent chunks using the upload id to identify the upload in progress and an offset representing the number of bytes transferred so far.
  3. After each chunk has been uploaded, the server returns a new offset representing the total amount transferred.
  4. After the last chunk commit the upload by passing its id to another endpoint such as POST /upload/commit/:id: