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:2030094
Created March 13, 2012 17:34
Using screen for background commands
# Create the screen session
screen -dR some_screen_name
# Use ctrl+a, d to detatch the session from screen
# To view the screen session, use:
screen -ls
# To came back the screen session, use:
screen -r some_screen_name
# If you have only one screen session, you can use just:
screen -r
@lucasmezencio
lucasmezencio / gist:2474232
Created April 23, 2012 22:15
Resolução problema C
/**
* Faça este programa imprimir 13 alterando APENAS o corpo da função "function"
* NÃO VALE ALTERAR NADA NA FUNÇÃO main
*/
void function() {
printf("%d\n", 13);
exit(0);
}
@lucasmezencio
lucasmezencio / commands.php
Created April 25, 2012 13:12
Command Interpreter Example
<?php
require_once __DIR__.'/functions.php';
$commands = array(
'hello' => array(
'params' => array('name')
),
'dump' => array(
'params' => array('var')
)
@lucasmezencio
lucasmezencio / problema_c.cpp
Last active May 22, 2019 11:58
Problema C
/**
* Make this program to print 13 making changes ONLY the body of the "function" function
* You are NOT ALLOWED to change NOTHING in the "main" function
*/
void function() {
/* EDIT ONLY HERE */
}
int main() {
@lucasmezencio
lucasmezencio / overthinking.txt
Last active February 25, 2019 13:53
Overthinking
This problem can be solved by pre-school children in
five to ten minutes, by programmers in a hour and by
people with higher education... well, check it yourself!
8809 = 6 5555 = 0
7111 = 0 8193 = 3
2172 = 0 8096 = 5
6666 = 4 1012 = 1
1111 = 0 7777 = 0
3213 = 0 9999 = 4
@lucasmezencio
lucasmezencio / gist:2629006
Created May 7, 2012 17:06
Which Linux Distro?
cat /etc/redhat-release #will show you information for red hat based distros.
cat /etc/SuSE-release #for SUSE based distros.
cat /etc/mandrake-release #for mandrake distros.
cat /etc/debian_version #for debian based distros.
cat /etc/UnitedLinux-release #might also return some more information.
@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">
@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 / 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 / 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);