Skip to content

Instantly share code, notes, and snippets.

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

Rafael Biriba rafaelbiriba

🏠
Working from home
View GitHub Profile

layout: post title: Curso gratuito de programação em ruby para iniciantes excerpt: "Nunca é tarde para começar a programar! Eu criei um curso gratuito, fácil e didático voltado para iniciantes. Confira mais informações aqui nessa publicação." category: [br, programacao] lang: br tags: [programação, tecnologia, curso, ruby, iniciantes] comments: true share: true ads: true

@rafaelbiriba
rafaelbiriba / tree-report.sh
Last active March 7, 2024 03:19
Generate tree report file on NAS and send it by email (optional)
#!/bin/bash
# Creates DISK0.tree, DISK1.tree, DISKx.tree inside each disk, with the output of tree command.
# After generating the report, it send via email using mail.
# To add more disks, just add DISK[x]=/full/path to the disk. Just make sure that the array index are sequencial.
# Why this?
# With the reports from tree, in case of disk failure, you will know which file got lost and you can recover them, downloading or via backups.
# GIST: https://gist.github.com/rafaelbiriba/0ee7ca2baec1ef80a878c825295f09e1
EMAIL_ADDRESS="" # EMAIL_ADDRESS="email@gmail.com" or leave it blank "" to disable email
DISKS[0]="/srv/dev-disk-by-id-ata-WDC_WD80EMAZ-00WJTA0_ABC123-part1"
@rafaelbiriba
rafaelbiriba / selenium-playground.rb
Last active May 27, 2020 12:56
selenium ruby playground
require 'rubygems'
require 'bundler/setup'
require "selenium-webdriver"
require "faker"
def generate_email
domains = ["example.com", "example2.com"]
Faker::Internet.unique.email(domain: domains.sample, separators: ".")
end
class User < ActiveRecord::Base
DEFAULT_PERMISSION = ["read", "write", "share"]
end
class Hash
def difference(subtrahend)
# create a hash which contains all normalized keys
all_pairs = (self.keys.map{|x| x.downcase} + subtrahend.keys.map{|x| x.downcase}).uniq.inject({}) do |pairs, key|
pairs[key] = []
pairs
end
#=> {"mouse"=>[], "cat"=>[], "snake"=>[], "bird"=>[], "dog"=>[]}
# push original key value pairs into array which is the value of just created hash
puts "hello"
@rafaelbiriba
rafaelbiriba / install_ffmpeg_libfdkaac.sh
Last active January 6, 2024 04:36
Install FFmpeg with libfdk_aac support (For Ubuntu)
# Criando um script .sh para executar todos os comandos:
#root@servidor:~# vi script.sh
#root@servidor:~# chmod +x script.sh
#root@servidor:~# ./script.sh
apt-get update
apt-get -y install autoconf automake build-essential git-core libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev nasm gcc yasm && true
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git