Skip to content

Instantly share code, notes, and snippets.

tonioriol /
Created Jun 30, 2021
Convert avi to mkv and set audio lang tags with MKVToolNix
# convert avi to mkv and set audio lang tags
# brew install mkvtoolnix
# loop all avi files in current folder
for file in *.avi; do
# replace original avi ext by mkv ext
# convert avi to mkv
tonioriol /
Last active Sep 22, 2020
copy postgres from one app db to another
# copy postgres from one app db to another
heroku pg:copy sushi::ORANGE GREEN --app sushi-staging
# This would copy data from the ORANGE database of the sushi app to the GREEN database in sushi-staging. This could be used to copy production data into a staging app for testing purposes.
# source:
for FILE in *; do
echo "${FILE}"
duration=$(ffprobe -i "${FILE}" -show_entries format=duration -v quiet -of csv="p=0")
nth_second=$(echo "${duration} - 2.3" | bc)
ffmpeg -i "${FILE}" -ss 0.1 -to "${nth_second}" "fixed-${FILE}"
tonioriol /
Last active Apr 12, 2019 — forked from boneskull/
syntax highlighting for Vagrantfile in non-RubyMine JetBrains IDEs
  1. Add this file to ~/Library/Preferences/RiderXXXX.X/filetypes/Vagranfile.xml
  2. Restart IDE

This page will help you find the correct directory.

tonioriol / rails-docker-pg-template.rb
Created Apr 10, 2018 — forked from cblunt/rails-docker-pg-template.rb
A simple Rails application configured for PostgreSQL and Docker
View rails-docker-pg-template.rb
generate(:scaffold, "post", "title:string", "body:text")
route "root to: 'posts#index'"
file 'config/database.yml', <<-CODE
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: db
View reset-postgres-autoincrement.sql
select setval((select pg_get_serial_sequence('table_name', 'id')), (select max(id) from table_name));
View getSelectedHtml.html
<!DOCTYPE html>
<title>Get selected HTML</title>
function getSelectionHtml () {
var div, range, sel, result;
if (window.getSelection) {
sel = window.getSelection();
} else if (document.selection) {
tonioriol / texteditor.html
Last active Feb 25, 2018
Text editor using contenteditable html attribute
View texteditor.html
<!-- data:text/html, -->
body {
margin: 0;
tonioriol /
Last active Oct 14, 2021 — forked from rap2hpoutre/
Laravel Forge zero downtime deployment script
# stop script on error signal
set -e
# create directory and any intermediate directories if don't exist
mkdir -p ${DEPL}
#disable xdebug on vagrant
sudo php5dismod xdebug
#enable xdebug on vagrant
sudo php5enmod xdebug
# restart apache
sudo service apache2 restart