Skip to content

Instantly share code, notes, and snippets.

View embs's full-sized avatar

Matheus Santana embs

View GitHub Profile
@embs
embs / mp42gif.bash
Last active July 14, 2020 17:10
Mp4 to GIF
mkdir frames
ffmpeg -i screencast.mp4 -r 5 'frames/frame-%03d.jpg'
cd frames
convert -delay 20 -loop 0 -layers Optimize *.jpg myimage.gif
start = Step.create(name: 'Saudações, aventureiro!',
description: 'Cuidado por onde anda. Esta terra
está repleta de abismos e feras perigosas.')
precipice = Step.create(name: 'Você caiu num precipício :(',
description: 'Mais sorte na próxima vez...')
dragon = Step.create(name: 'Um dragão te tostou :(',
description: 'Nem todo dia é dia de caçador.')
@embs
embs / Gemfile
Last active October 19, 2018 14:49
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.3.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
@embs
embs / mnt
Created June 20, 2013 12:57
Mounting Linux partition
Boot your system into a live CD. Mount your system into the live CD:
sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
Log into the mounted system:
sudo chroot /mnt
@embs
embs / rubyWebServer.rb
Created March 21, 2012 02:28
This is a tiny ruby web server.
require 'socket'
webserver = TCPServer.new('127.0.0.1', 7777)
puts "Iniciando servidor."
while (session = webserver.accept)
session.print "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n"
begin
@embs
embs / .aREADME.md
Last active June 24, 2017 00:29
An epic battle CSP specification
@embs
embs / Building images with Docker.md
Created June 23, 2017 14:31
Adventures In Containers Land

Start with Docker

I've started trying stuff within my hosting machine so I'd more confidently build an image later. It didn't pay off. Just type inside the Dockerfile instead of the terminal (shell).

Give apprentice steps

Nevermind the [state of the art][minimize-layers] when you're starting off:

@embs
embs / Tutorial Quince Site.md
Last active May 24, 2017 12:25
Como pegar projeto de repositório no Heroku, realizar modificações e enviá-las novamente ao remoto.
@embs
embs / Rails 3.1 authentication from scratch.markdown
Created June 12, 2012 17:49
Authentication from Scratch with Rails 3.2.5

Authentication from Scratch with Rails 3.2.5

Rails 3.1 gives us a really easy way to authenticate users in our app: http_basic_authenticate_with. Using it, all we need to do is create a model for the user (certainly, User model :P) with an attribute called password_digest and some views feature for login and register users. After all, let's relax and let Rails do the hard work.

What we'll need

Gemfile

gem 'bcrypt-ruby', '~> 3.0.0'

Model

First at all, an User model which we can generate by following: rails g model user email:string password_digest:string and then add the following methodo call to generated class: has_secure_password