Skip to content

Instantly share code, notes, and snippets.

@rogersguedes
rogersguedes / proto.msg
Last active May 9, 2019 12:51 — forked from alexeypegov/proto.msg
ProtoBuffers debug with CURL. ProtoBuffers should be installed first: "yum install protobuf" or "brew install protobuf".
key:"string value"
int_key:22
@rogersguedes
rogersguedes / vim-cheats.md
Created April 11, 2019 19:31 — forked from Starefossen/vim-cheats.md
My vim cheat sheet for working with tabs and window splits.

Tabs

New Tab

  • :tabnew - new blank tab
  • :tabedit [file] - open file in tab

Cursor Movement

  • gt (:tabn) - next tab
@rogersguedes
rogersguedes / gstreamer.md
Created December 28, 2018 20:38 — forked from nebgnahz/gstreamer.md
Collections of GStreamer usages

Most GStreamer examples found online are either for Linux or for gstreamer 0.10.

This particular release note seems to have covered important changes, such as:

  • ffmpegcolorspace => videoconvert
  • ffmpeg => libav

Applying -v will print out useful information. And most importantly the negotiation results.

@rogersguedes
rogersguedes / camera.c
Created November 29, 2018 16:40 — forked from crouchggj/camera.c
camera v4l2 operation
/*
* =====================================================================================
*
* Filename: camera.c
*
* Description:
*
* Version: 1.0
* Created: 2013年08月23日 15时54分17秒
* Revision: none
@rogersguedes
rogersguedes / capture_raw_frames.c
Last active December 4, 2018 17:04 — forked from maxlapshin/capture_raw_frames.c
v4l2 capture example
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
#!/bin/sh
# udhcpc config script
# $interface is the name of the device udhcpc is using
# $router is the (space_separated) list of gateways
# $broadcast is the broadcast address
# $ip is the ip address that we get from the dhcp server
# $dns is the list of dns servers we get from the dhcp server
# $domain is the domain of the network
@rogersguedes
rogersguedes / write_bmp.c
Last active August 21, 2018 20:53 — forked from binshengliu/write_bmp.c
Writing bmp in C. see http://pastebin.com/qCRHiPEZ
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
//define pixelformat of windows bitmap, notice the unusual ordering of colors
typedef struct {
unsigned char B;
unsigned char G;
unsigned char R;
@rogersguedes
rogersguedes / tmux_local_install.sh
Created August 13, 2018 14:59 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@rogersguedes
rogersguedes / symfony3-rest-api.md
Created July 11, 2018 00:43 — forked from diegonobre/symfony3-rest-api.md
Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authenticationu
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 3 framework. The following SF2 bundles are used :

<?php
$filename = dirname('.') . $_SERVER['PHP_SELF'];
if (isset($_GET['download-source'])) {
header("Content-type: application/force-download");
$file = fopen(__FILE__, 'r');
$content = fread($file, filesize(__FILE__));
print $content;
die();
}