Skip to content

Instantly share code, notes, and snippets.

View marcelaraujo's full-sized avatar

Marcel Araujo marcelaraujo

  • Lisbon/PT
  • 09:40 (UTC +01:00)
View GitHub Profile
#!/usr/bin/env node
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
* Modified from https://gist.github.com/paolorossi/1993068
*/
var http = require('http')
, fs = require('fs')
, util = require('util')
@marcelaraujo
marcelaraujo / .eslintrc
Last active August 29, 2015 14:23 — forked from cletusw/.eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@marcelaraujo
marcelaraujo / gist:7329c99be2d9183af013
Created July 10, 2015 19:58
Sinon Stub for document.title
var sandbox = sinon.sandbox.create();
var documentTitleStub = sandbox.stub(document, "title", "TITLE");
@marcelaraujo
marcelaraujo / pdf.js
Created July 21, 2015 19:12
PhantomJS /dev/stdin -> /dev/stdout
var page = require('webpage').create(),
system = require('system'),
fs = require('fs');
var input = system.stdin.read();
page.viewportSize = {
width: 1280,
height: 1000
};
@marcelaraujo
marcelaraujo / pdf.php
Created July 21, 2015 19:14
PHP Pipe redirect content to /dev/stdin and caught output from /dev/stdout
<?php
$output = '';
$content = file_get_contents('template.html');
$descr = array(
0 => array(
'pipe',
'r'
@marcelaraujo
marcelaraujo / $logDecorator.js
Last active August 29, 2015 14:27
AngularJS - Disable logging
(function() {
var app = angular.module('myApp', []);
app.config(['$provide', function($provide) {
// decorates the $log instance to disable logging
$provide.decorator('$log', ['$delegate',
function($delegate) {
var $log, enabled = true;
$log = {
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@marcelaraujo
marcelaraujo / osx-10.10-setup.md
Last active September 18, 2015 15:59 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@marcelaraujo
marcelaraujo / gist:9a9fe07c5a4bcaea8c06
Created October 1, 2015 03:22
MacOS disable services
System process daemons that are system-wide provided by mac os x are described by launchd preference files that can be showed with the command:
$ sudo ls -all /System/Library/LaunchDaemons/
Third party process daemons that are system-wide provided by the administrator are described by preference files that can be showed with the command:
$ sudo ls -all /Library/LaunchDaemons/
Launch Agents that are per-user provided by mac os x usually loaded when the user logs in. Those provided by the system can be found with:
$ sudo ls -all /System/Library/LaunchAgents/
Launch Agents that are per-user provided by the administrator and usually loaded when the user logs in. Those provided by the system can be found with: