Skip to content

Instantly share code, notes, and snippets.

View alfg's full-sized avatar

Alfred Gutierrez alfg

  • NBCUniversal / PeacockTV
  • ☀️ Los Angeles, CA
  • 11:47 (UTC -07:00)
View GitHub Profile
@alfg
alfg / golang_job_queue.md
Created July 3, 2017 20:49 — forked from harlow/golang_job_queue.md
Job queues in Golang
@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 / .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 dokku@git.host.com:app
- git config --global push.default simple
@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 / widget-bootstrap.html
Last active November 20, 2019 01:20
Bootstrap files for creating embedded widgets for your site
<html>
<head>
<title>Sample Widget Page</title>
</head>
<body>
<h1>Sample Widget Page</h1>
<script type="text/javascript" src="http://localhost:81/widget-bootstrap.js"></script>
<div id="widget-container"></div>
@alfg
alfg / ranking.py
Created April 24, 2012 23:13
Reddit ranking algorithm
#Rewritten code from /r2/r2/lib/db/_sorts.pyx
from datetime import datetime, timedelta
from math import log
epoch = datetime(1970, 1, 1)
def epoch_seconds(date):
"""Returns the number of seconds from the epoch to date."""
td = date - epoch