Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@bnerd
bnerd / index.js
Created March 10, 2012 11:54
Serve large files with Node.js
var libpath = require('path');
var http = require('http');
var fs = require('fs');
var url = require('url');
var bind_port = 8001;
var path = "/path/to/your/base_directory/";
http.createServer(function (request, response) {
var uri = url.parse(request.url).pathname;
var filename = libpath.join(path, uri);
@jrobinsonc
jrobinsonc / README.md
Last active October 9, 2015 13:27
jQuery: Disable form #forms #jquery #javascript

Disable Forms

Introduction

Disable the fields of forms. This does not touch the fields that are disabled at the moment of disabling. This script is executed like an event call.

This depends of jQuery.

Usage

@bnerd
bnerd / ffmpeg
Created November 13, 2012 23:18
Encode RTMP input stream into multiple outputs with ffmpeg
ffmpeg -re -i rtmp://localhost/live/input_stream -acodec libfaac -ab 128k -vcodec libx264 -s 640x360 -b:v 500k -preset medium -vprofile baseline -r 25 -f flv rtmp://localhost/live/medium_500k -acodec libfaac -ab 128k -vcodec libx264 -s 480x272 -b:v 300k -preset medium -vprofile baseline -r 25 -f flv rtmp://localhost/live/medium_300k -acodec libfaac -ab 128k -c:v libx264 -s 320x200 -b:v 150k -preset:v fast -profile:v baseline -level 1.2 -r 25 -f flv rtmp://localhost/live/medium_150k -acodec libfaac -vn -ab 48k -f flv rtmp://localhost/live/audio_only
@bnerd
bnerd / enc_h264.sh
Created November 23, 2012 08:44
Simple Encoding with ffmpeg
ffmpeg -i input -r 25 -b:v 1M -bt:v 1.6M -vcodec libx264 -preset medium -acodec -acodec libfaac -ac 2 -ar 44100 -b:a 128k output.mp4
@jrobinsonc
jrobinsonc / README.md
Last active October 5, 2016 19:09
Wordpress: Hide Post Type UI/Menu#wordpress

Wordpress: Hide Post Type UI/Menu

Para eliminar un item del menu se usa la funcion remove_menu_page (Ref: http://codex.wordpress.org/Function_Reference/remove_menu_page)

Eliminar un custom post-type de los usuarios que no son administradores.

function my_remove_menu_items() 
{
    if(!current_user_can('manage_options')):
@jrobinsonc
jrobinsonc / rename-user.sh
Last active December 14, 2015 20:39
Git tip: Renombrar usuario de uno o varios commits.
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "<Old Name>" ];
then
GIT_COMMITTER_NAME="<New Name>";
GIT_AUTHOR_NAME="<New Name>";
GIT_COMMITTER_EMAIL="<New Email>";
GIT_AUTHOR_EMAIL="<New Email>";
git commit-tree "$@";
else
git commit-tree "$@";
@jrobinsonc
jrobinsonc / README.md
Last active December 15, 2015 21:19
Convert from Bytes to KB, MB, GB, TB, PB, EB, ZB, YB. #php #files

Convert from Bytes to other file size units.

Convert from Bytes to KB, MB, GB, TB, PB, EB, ZB, YB.

Usage

require 'byte_convert.php';

// Get file size in bytes.
@jrobinsonc
jrobinsonc / README.md
Last active December 15, 2015 21:19
Get the directory contents recursively. #directories #files #php

Get directory contents

Get the directory contents recursively.

Usage

require 'get_dir.php';

printf('');
@jrobinsonc
jrobinsonc / README.md
Last active December 15, 2015 21:19
Generate random strings. #strings #generator #php

Generate random string

Generate a random string with the specified length. Optionally you can set the chars to use for generate the string.

Usage

require 'generate_string.php';

// Normal usage:
@jrobinsonc
jrobinsonc / appcache.php
Created May 5, 2013 15:52
AppCache generator #php #appcache
<?php
function get_dir($dir)
{
$files = array();
$exclude = array('.', '..', 'appcache.php', '.git', '.gitignore', 'nbproject', 'TODO', 'README.md', 'cache.manifest');
foreach (scandir($dir) as $item)
{
if (in_array($item, $exclude)) continue;