Skip to content

Instantly share code, notes, and snippets.

View henriquegogo's full-sized avatar

Henrique Gogó henriquegogo

View GitHub Profile
@henriquegogo
henriquegogo / load_soundfont_to_midi.sh
Created August 15, 2018 03:59
Load soundfont and plug into midi device
#!/bin/bash
fluidsynth --audio-bufcount=4 --gain=1 -isa alsa "$1" &
while ! aconnect 20 128; do sleep 1; done
@henriquegogo
henriquegogo / 99-midi-keyboard.rules
Created August 15, 2018 03:50
udev - Detect USB device and launch an action
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_MODEL}=="nanoKEY2", TAG+="systemd", ENV{SYSTEMD_WANTS}="midi-keyboard-drums.service"
SUBSYSTEM=="usb", ACTION=="remove", ENV{ID_MODEL}=="nanoKEY2", RUN+="/usr/bin/killall fluidsynth"
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_MODEL}=="UMX_61", TAG+="systemd", ENV{SYSTEMD_WANTS}="midi-keyboard-rhodes.service"
SUBSYSTEM=="usb", ACTION=="remove", ENV{ID_MODEL}=="UMX_61", RUN+="/usr/bin/killall fluidsynth"
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_MODEL}=="nanoKEY2", RUN+="/usr/bin/killall emulationstation"
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_MODEL}=="UMX_61", RUN+="/usr/bin/killall emulationstation"
@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