Skip to content

Instantly share code, notes, and snippets.

View henriquegogo's full-sized avatar

Henrique Gogó henriquegogo

View GitHub Profile
@henriquegogo
henriquegogo / audio-detect-record.sh
Created August 9, 2018 03:46
Record audio when some noise and no silence
sox -t alsa default ./record.flac silence 1 0.1 1% 2 1.0 1%
@henriquegogo
henriquegogo / playaudio.py
Last active July 31, 2018 19:59
How to play a simple audio in python without any dependency
#!/usr/bin/padsp python
import sys
import wave
import ossaudiodev
audiofile = wave.open(sys.argv[1], 'r')
(nchannels, sampwidth, framerate, nframes, comptype, compname) = audiofile.getparams()
audiofile.setpos(0)
@henriquegogo
henriquegogo / retroarch.cfg
Created May 2, 2018 04:10
RetroPie n64 retroarch.cfg config. Using SNES controller on n64 emulator
# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line
input_remapping_directory = "/opt/retropie/configs/n64/"
input_player1_l_x_plus_axis = "+0"
input_player1_l_x_minus_axis = "-0"
input_player1_l_y_plus_axis = "+1"
input_player1_l_y_minus_axis = "-1"
input_player1_l2_btn = "1"
@henriquegogo
henriquegogo / ffmpeg_watermark_fadeout.sh
Last active April 21, 2018 20:04
Fade out and watermark with ffmpeg
ffmpeg -ss 18 -i VID_20180421_134758383.mp4 \
-loop 1 -i thriller.png \
-filter_complex "[0:v]fade=out:st=35:d=2,hflip,vflip[myrecord]; \
[1:v]fade=out:st=3:d=1[watermark]; \
[myrecord][watermark]overlay=(W-w)/2:(H-h)/2[v]; \
[0:a]afade=out:st=35:d=2[a]"
-map "[v]" -map "[a]" -to 37 thriller.mp4
@henriquegogo
henriquegogo / .tern-project
Created October 10, 2017 01:24
Tern project config with react and node
{
"ecmaVersion": 6,
"libs": [
"browser",
"react"
],
"plugins": {
"node": {},
"jsx": {}
}
@henriquegogo
henriquegogo / edit_video_ffmpeg.sh
Created September 11, 2017 03:10
How to edit video (merging into video grid) using ffmpeg command line
ffmpeg \
-ss 00:00:00.537 -i "GUITARRA HUMANA (Na Gaita - Sanfona) - Bruna Scopel.mp4" \
-ss 00:00:14.456 -i "Guitarra Humana vs Contrabaixo no Forró.mp4" \
-ss 00:00:00.164 -i "Guitarra humana - Veja como fica na guitarra de VERDADE kkkkkkkk.mp4" \
-ss 00:00:00.433 -i "TOCA A PISADINHA 'BOKA ESTÚDIO'.mp4" \
\
-filter_complex \
"[0:v][1:v]hstack[t]; \
[2:v][3:v]hstack[b]; \
[t][b]vstack[v]; \
@henriquegogo
henriquegogo / network-finder.sh
Created July 25, 2017 18:07
Find hosts in ip domain
nmap -sn 192.168.1-25.*
@henriquegogo
henriquegogo / format_sd_card_action_camera.sh
Created July 10, 2017 04:22
Format micro sd card for action camera SJ1000
sudo mkdosfs /dev/mmcblk0 -s 128 -F 32 -I
@henriquegogo
henriquegogo / component.js
Last active January 6, 2017 19:48
Generic component for rendering data.
function Component(elementId, data, propTemplate) {
var ctx = this;
var container = document.getElementById(elementId);
var template = propTemplate || container.innerHTML;
this.data = {};
this.setData = this.render = function(option, doRender) {
if (Array.isArray(option)) this.data = [];
for (var key in option) this.data[key] = option[key];
if (doRender != false) render();
@henriquegogo
henriquegogo / app.js
Created May 29, 2016 03:19
Generic node/express application based on routes and static files
var path = require('path');
var fs = require('fs');
var express = require('express');
var app = express();
// Load all route files
var routes_path = path.join(__dirname, 'routes');
fs.readdirSync(routes_path).forEach((route) => {
app.use('/' + route.slice(0,-3), require(routes_path + '/' + route) );