Skip to content

Instantly share code, notes, and snippets.

View lucasmezencio's full-sized avatar
:bowtie:
Neeeeeeeeerd

Lucas Mezêncio lucasmezencio

:bowtie:
Neeeeeeeeerd
View GitHub Profile
@lucasmezencio
lucasmezencio / gist:3479301
Created August 26, 2012 13:28
How to make a time-lapse video with webcam in Ubuntu/Debian
# '-t' is the number of frames we want to capture. '-r' is frames per second. So this should grab one frame every second.
streamer -o 0000.jpeg -s 300x200 -j 100 -t 2000 -r 1
@lucasmezencio
lucasmezencio / gist:3314588
Created August 10, 2012 14:23
Remove all SVN folders recursively from a folder
find . -name ".svn" -exec rm -rf {} \;
@lucasmezencio
lucasmezencio / gist:3152415
Created July 20, 2012 18:24
Split files with tar on shell
tar -czf backup.tar.gz * | split -d -b 5000m - backup.tar.gz.part
@lucasmezencio
lucasmezencio / gist:3144398
Created July 19, 2012 14:41
Dotall Regexp in Java
//You need to use the Pattern.DOTALL flag to say that the dot should match newlines. e.g.
Pattern.compile(regex, Pattern.DOTALL);
//or specify the flag in the pattern using (?s) e.g.
String regex = "(?s)([a-zA-Z0-9]+)";
@lucasmezencio
lucasmezencio / gist:3130948
Last active October 7, 2015 07:57
Execute command only in files in command line
# Files
find ./ -type f -exec COMMAND "{}" \;
# Directories
find . -type d -exec COMMAND "{}" \;
@lucasmezencio
lucasmezencio / gist:3003713
Created June 27, 2012 12:20
Get size/count/length of an object in JavaScript
var obj = {
attr : 'some string',
attr1 : 'some other string'
}
var objSize = Object.keys(obj).length;
@lucasmezencio
lucasmezencio / mail.php
Created June 26, 2012 15:21
Configure Gmail SMTP with Zend Framework
<?php
$config = array(
'ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => '[email protected]',
'password' => 'myPassword'
);
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
@lucasmezencio
lucasmezencio / attachment_from_file.php
Created June 25, 2012 20:25
Creating Attachment From View With Zend Framework
<?php
$mail = new Zend_Mail();
$attach_view = new Zend_view();
$attach_view->setScriptPath('/path/to/views/directory/');
$attach_view->name = 'Lucas';
$attach_view->lastName = 'Mezencio';
$attachment = $attach_view->render('view.phtml');
@lucasmezencio
lucasmezencio / var_dump_netbeans.php
Last active October 5, 2015 21:48
PHP var_dump snippets
// PHP var_dump snippet for NetBeans
echo '<pre>';
die(var_dump(${VARIABLE variableFromPreviousAssignment default="$variable"}));
@lucasmezencio
lucasmezencio / gist:2788630
Created May 25, 2012 15:03
HTML5 Snippet for Sublime Text 2
<snippet>
<content><![CDATA[
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">