This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mostra o espaço utilizado pela pasta | |
du -sh /var/www/vhosts | |
# Mostra as 20 maiores pastas | |
du -m /usr/share/elasticsearch/ | sort -nr | head -n 20 | |
# Cria um novo usuário sudo | |
adduser demo | |
gpasswd -a demo sudo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh -L 8035:localhost:8035 [email protected] | |
export http_proxy=http://localhost:8035/ https_proxy=http://localhost:8035/ | |
ssh -D 8080 [email protected] | |
export http_proxy=socks5://127.0.0.1:8080 https_proxy=socks5://127.0.0.1:8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* PHP PCRE - How to validate complex passwords using regular expressions | |
*/ | |
function valid_pass($candidate) { | |
if (!preg_match_all('$\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$', $candidate)) | |
return FALSE; | |
return TRUE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an example how to perform multi-select faceting in ElasticSearch. | |
Selecting multiple values from the same facet will result in an OR filter between each of the values: | |
(facet1.value1 OR facet1.value2) | |
Faceting on more than one facet will result in an AND filter between each facet: | |
(facet1.value1 OR facet1.value2) AND (facet2.value1) | |
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# One liner to stop / remove all of Docker containers | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No caso de comentários de uma unica linha uso o seguinte método | |
Colocar simbolo de comentario no Inicio da linha | |
tecla 0 leva-o para o inicio da linha (opcional) | |
teclas ctrl+v (fica em visual block) | |
com as teclas direcionais seleciona as linhas a comentar | |
Shift+i (I maiúsculo) | |
Um cursor de escrita vai aparecer na primeira linha selecionada- escrever o simbolo de comentario, i.e. '#' ou '//' | |
selecionar ESC e as linhas vão ficar todas comentadas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Mockery as m; | |
class ProjectRepositoryTest extends TestCase | |
{ | |
public function testShouldCheckIfIsOwner() | |
{ | |
$mock = m::mock('CodeProject\Repositories\ProjectRepository[findWhere]'); | |
$mock->shouldReceive('findWhere')->once()->andReturn(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elixir = require('laravel-elixir'), | |
clean = require('rimraf'), | |
gulp = require('gulp'); | |
var config = { | |
bower_path: './bower_components', | |
assets_path: './assets', | |
build_path: './public/build' | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
angular | |
.module('app') | |
.config(['$httpProvider', function ($httpProvider) { | |
$httpProvider.interceptors.push('busyInterceptor'); | |
}]) | |
.factory('busyInterceptor', busyInterceptor); |