Skip to content

Instantly share code, notes, and snippets.

<?php
$file = 'myfile.php';
$last_modified_time = filemtime($file);
$etag = md5_file($file);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $last_modified_time)." GMT");
header("Etag: $etag");
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
@Igor-Lopes
Igor-Lopes / api.md
Created June 12, 2017 20:39
Comandos para executar a API em Node
  • Limpar diretório de dependências: rm -rf node_modules
  • Atualizar repositório: git pull
  • Instalar dependências: npm install
  • Executar mongo como admin: sudo mongod
  • Executar app: nodemon app.js ou node app.js
@Igor-Lopes
Igor-Lopes / lamp-util.md
Created May 1, 2017 05:10
Install LAMP on CentOS/RHEL/ 7

Install LAMP Server (Apache, MariaDB, PHP) On CentOS/RHEL/ 7

Install Apache:

yum install httpd -y

Start the Apache service and make it to start automatically on every reboot:

systemctl start httpd

@Igor-Lopes
Igor-Lopes / .htaccess
Last active May 1, 2017 04:32
.htaccess to avoid caching
<filesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
@Igor-Lopes
Igor-Lopes / git-cheat.md
Last active May 1, 2017 04:33
Git cheat sheet

Initializing Repositories

  1. Initialize repository git init

  2. Add content git add *

  3. Commit git commit -m "commit message"

@Igor-Lopes
Igor-Lopes / angular-promise-example.js
Last active May 1, 2017 04:31
Simple Promise example
function getTime(date) {
return $q(function(resolve, reject) {
resolve(date.getTime());
});
}
var promise = getTime(new Date());
promise.then(function(data) {
//Code here
[ng\:cloak], [ng-cloak], .ng-cloak {
display: none !important;
}

MySQL conf file location:

/etc/my.cnf

Change Max connections parameters:

max_connections = 500

Print on terminal value of max_connections:

echo "show variables like 'max_connections';" | mysql -u root -p

SQL query lists database name and sizes

display brief interface - Switch 3COM
display interface brief - Switch HP
display link-aggregation verbose
display mac-address
@Igor-Lopes
Igor-Lopes / 3Com Switch 4200G 48-Port
Created May 3, 2016 19:20
OIDs for 3Com Switch 4200G 48-Port
System Description
3Com Switch 4200G 48-Port Software Version 3Com OS V3.02.00s56
1 Minute CPU Average
.1.3.6.1.4.1.43.45.1.6.1.1.1.3.65536
5 Minute CPU Average
.1.3.6.1.4.1.43.45.1.6.1.1.1.4.65536
Free Memory