Skip to content

Instantly share code, notes, and snippets.

View israeljrs's full-sized avatar

Israel Junior israeljrs

View GitHub Profile
@israeljrs
israeljrs / cv2ff.cpp
Created January 4, 2019 16:45 — forked from yohhoy/cv2ff.cpp
Convert from OpenCV image and write movie with FFmpeg
/*
* Convert from OpenCV image and write movie with FFmpeg
*
* Copyright (c) 2016 yohhoy
*/
#include <iostream>
#include <vector>
// FFmpeg
extern "C" {
#include <libavformat/avformat.h>
@israeljrs
israeljrs / rails-jsonb-queries
Created July 3, 2019 12:19 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@israeljrs
israeljrs / 20101004063749_create_photos.rb
Created August 6, 2019 17:18 — forked from macek/20101004063749_create_photos.rb
How to save uploaded files to your database in Rails
# db/migrate/20101004063749_create_photos.rb
class CreatePhotos < ActiveRecord::Migration
def self.up
create_table :photos do |t|
t.string :name, :null => false
t.binary :data, :null => false
t.string :filename
t.string :mime_type
t.timestamps
@israeljrs
israeljrs / git-update-fork.sh
Created August 19, 2019 18:19 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
@israeljrs
israeljrs / dropzone_controller.js
Created August 24, 2019 11:59 — forked from lazaronixon/_form.html.erb
Dropzone.js + Stimulus + Active Storage
import { Controller } from "stimulus"
import { DirectUpload } from "@rails/activestorage"
import { getMetaValue, toArray, findElement, removeElement, insertAfter } from "helpers"
export default class extends Controller {
static targets = [ "input" ]
connect() {
this.dropZone = createDropZone(this)
this.hideFileInput()
@israeljrs
israeljrs / cmaf.sh
Created November 13, 2019 14:14 — forked from GnaphronG/cmaf.sh
HLS and DASH Manifest with CMAF files
#! /bin/sh
file="bbb_sunflower_2160p_30fps_normal.mp4"
timestamp=`date +%s`
ffmpeg="docker run --rm -it --workdir /tmp -v $PWD:/tmp kynothon/moviola:4.0-alpine "
bento4="docker run -it --rm -u $(id -u):$(id -g) -v $PWD:/tmp --workdir /tmp ggoussard/bento4docker "
echo "Getting the file"
curl -LO http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_2160p_30fps_normal.mp4
@israeljrs
israeljrs / heroku_pg_db_reset.md
Created December 4, 2019 13:51 — forked from zulhfreelancer/heroku_pg_db_reset.md
How to reset PG Database on Heroku?

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

heroku restart &amp;&amp; heroku pg:reset DATABASE --confirm APP-NAME &amp;&amp; heroku run bundle exec rails db:migrate

@israeljrs
israeljrs / .vimrc
Created December 5, 2019 01:38 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@israeljrs
israeljrs / ffmpeg_commands.md
Last active May 6, 2025 01:35 — forked from travelhawk/ffmpeg_commands.md
Collection of ffmpeg commands (basic usage, streaming, advanced usage)

ffmpeg

ffmpeg is a fast video and audio converter that can also grab from a live audio/video source.

Standard usage

Getting help and information

  • -h show all options
  • -h(elp) topic show help
  • -version show version
@israeljrs
israeljrs / boost-windows.md
Created May 15, 2020 13:54 — forked from sim642/boost-windows.md
Installing boost libraries for GCC (MinGW) on Windows

Installing boost libraries for GCC (MinGW) on Windows

Folder setup

  1. Extract downloaded boost source, e.g. C:\Program Files\boost_1_59_0.
  2. Create a folder for Boost.Build installation, e.g. C:\Program Files\boost-build.
  3. Create a folder within for building, i.e. C:\Program Files\boost_1_59_0\build.
  4. Create a folder for installation, e.g. C:\Program Files\boost.

GCC setup

  1. Open Command Prompt.