Skip to content

Instantly share code, notes, and snippets.

View alfg's full-sized avatar

Alfred Gutierrez alfg

View GitHub Profile
@alfg
alfg / README.md
Last active February 16, 2024 08:34
MP4 Parser example in Go.

Minimal MP4 Parser Example

  • Download MP4: https://github.com/alfg/mp4/blob/master/test/tears-of-steel.mp4?raw=true
  • Run
go run mp4_example.go tears-of-steel.mp4

go run mp4_example_2.go tears-of-steel.mp4
@alfg
alfg / pkg_cheatsheet.md
Created April 7, 2021 21:36
Working with Apple pkgs

Mac Packaging Cheatsheet

Create a component pkg from a DMG

pkgbuild --component /Volumes/ApplicationName/*.app --install-location \
    /Applications ApplicationName-Version.pkg

Install pkg from command line

@alfg
alfg / aac_parser.py
Created January 29, 2021 08:36 — forked from yohhoy/aac_parser.py
Parse AAC/ADTS header
#!/usr/bin/env python3
import sys
import struct
if len(sys.argv) < 2:
print("Usage: aac_parer.py <target.aac>")
exit()
aacfile = open(sys.argv[1], 'rb')
frame_no = 1
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@alfg
alfg / gist:8bbfc5f7794492b1f007a8d6bd8569cb
Created September 5, 2020 02:18 — forked from tayvano/gist:6e2d456a9897f55025e25035478a3a50
complete list of ffmpeg flags / commands
Originall From: Posted 2015-05-29 http://ubwg.net/b/full-list-of-ffmpeg-flags-and-options
This is the complete list that’s outputted by ffmpeg when running ffmpeg -h full.
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…
Getting help:
-h — print basic options
-h long — print more options
-h full — print all options (including all format and codec specific options, very long)
@alfg
alfg / nulltypes.go
Created November 21, 2019 23:05
Null types golang
// NullString is an alias for sql.NullString data type
type NullString struct {
sql.NullString
}
// MarshalJSON for NullString
func (ns *NullString) MarshalJSON() ([]byte, error) {
if !ns.Valid {
return []byte("null"), nil
@alfg
alfg / .travis.yml
Created January 19, 2019 05:44
Travis Git deployments to Dokku
language: bash
before_install:
- echo $super_secret_password | gpg --passphrase-fd 0 .travis/deploy.key.gpg
- eval "$(ssh-agent -s)"
- chmod 600 .travis/deploy.key
- ssh-add .travis/deploy.key
- ssh-keyscan git.host.com >> ~/.ssh/known_hosts
after_success:
- git remote add deploy [email protected]:app
- git config --global push.default simple
@alfg
alfg / INSTALL.md
Last active May 1, 2019 19:53
Raspberry PI Homebridge Install

Instructions

Download and Install Raspbian Stretch

Get the latest copy of Raspbian Stretch from the official Raspberry Pi website and image this to your SD card.

Raspbian Stretch Lite is prefered as there is no need to run a GUI desktop.
How to install Raspberry Pi Operating System Images
@alfg
alfg / ffmpeg.txt
Created October 30, 2017 00:31 — forked from gildotdev/ffmpeg.txt
ffmpeg cli commands
## extract audio from .avi as .aac (conversion from another audio codec)
ffmpeg -i foo.avi -acodec aac -ab 128k -strict experimental bar.aac
## extract audio from .avi as .mp3 (no conversion, just copy)
ffmpeg -i foo.avi -acodec copy bar.mp3
## convert .mp3 to .aac
ffmpeg -i foo.mp3 -acodec aac -ab 128k -strict experimental bar.aac
## extract single frame as image from .mp4
@alfg
alfg / golang_job_queue.md
Created July 3, 2017 20:49 — forked from harlow/golang_job_queue.md
Job queues in Golang