Skip to content

Instantly share code, notes, and snippets.

@allanjos
allanjos / ts-header-parsing.c
Last active November 5, 2018 18:00
Transport stream MPEG2-TS
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include "ts.h"
#include "debug.h"
TransportStream::TransportStream() {
@allanjos
allanjos / ffmpeg-build-debian_ubuntu.md
Last active November 5, 2018 18:00
FFMPEG build - Debian/Ubuntu

Install dependencies:

sudo apt-get install build-essential

sudo apt-get install nasm

sudo apt-get install libx265-dev

sudo apt-get install libfdk-aac-dev
@allanjos
allanjos / ffmpeg-transport-stream-utils.md
Last active November 5, 2018 17:53
FFMPEG - Transport Stream Utils

Extract audio and video from TS:

Suppose TS has the following program streams:

Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream #0:1[0x200]: Audio: aac (LC) ([17][0][0][0] / 0x0011), 44100 Hz, stereo, fltp, 143 kb/s

Extract video from TS from stream #0:0:

ffmpeg -i x.ts -map 0:0 -vcodec copy x.mp4

@allanjos
allanjos / angularjs-configuration.md
Last active November 5, 2018 17:51
AngularJS settings
@allanjos
allanjos / python-json-hash-array.py
Last active November 5, 2018 17:50
Python / JSON / Hash / Array
import json
jsonStr = '[{"one" : "1", "two" : "2", "three" : "3"}]';
print "Parsing json " + jsonStr
listData = json.loads(jsonStr)
print "Direct access:"
@allanjos
allanjos / fedora-angularjs.md
Last active November 5, 2018 18:09
Fedora / AngularJS

Install Node and dependencies:

sudo dnf install nodejs

sudo dnf install npm

sudo npm install -g yo grunt-cli bower

sudo npm install -g generator-angular
@allanjos
allanjos / gist:f9750e9fc95104813bcf8aba1e14cc1c
Last active November 5, 2018 17:38
MySQL setup - Windows

Initialize database

<MYSQLDIR>\bin\mysqld --initialize

Change root password

Create file mypassword.ini with the following content (change the passord):

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
@allanjos
allanjos / oracle-php-connection.php
Last active November 5, 2018 18:10
Oracle database connection from PHP language
<?php
echo 'Oracle connection test<br/>';
$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=orcl.olivum.local)))" ;
if ($connection = OCILogon("userweb", "passcode", $db)) {
echo "Successfully connected to Oracle.<br/>";
}
else {
$err = OCIError();
@allanjos
allanjos / oracle-settings-basic-windows.md
Last active November 5, 2018 17:46
Oracle basic configuration (MS Windows)
@allanjos
allanjos / GNUStep_sample_build.md
Last active November 5, 2018 01:10
GNUStep sample build

Install dependencies:

sudo apt-get install gnustep
sudo apt-get install gnustep-make
sudo apt-get install gnustep-devel

Configure environment:

. /usr/share/GNUstep/Makefiles/GNUstep.sh