###SSH into a remote machine###
ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
###SSH into a remote machine###
ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
GIT - Cheat sheet - by Pedro Pinheiro pedrovictor.pinheiro@gmail.com
Instalação e ajuda:
sudo apt-get install git - Instalando o git no Ubuntu
git help - Mostra uma lista de comandos úteis do git e descrições do mesmo
git help command - Mostra detalhes de um comando específico
<?php | |
/** | |
* This code is an improvement over Alex's code that can be found here -> http://stackoverflow.com/a/11376379 | |
* | |
* This funtion creates a thumbnail with size $thumbnail_width x $thumbnail_height. | |
* It supports JPG, PNG and GIF formats. The final thumbnail tries to keep the image proportion. | |
* | |
* It has been pointed out that if the thumbnail already exists it doesn't get overwritten, but the method still returns true. | |
* so keep an eye on that. | |
* |
// The Sieve of Eratosthenes! | |
// This gist was created so I can remember the algorithm cited here: http://qr.ae/RA6nsm | |
function sieve(max) { | |
var D = [], primes = []; | |
for (var q=2; q<max; q++) { | |
if (D[q]) { | |
for (var i=0; i<D[q].length; i++) { | |
var p = D[q][i]; | |
if (D[p+q]) D[p+q].push(p); | |
else D[p+q]=[p]; |
###Getting help npm help
###Updating npm npm install npm -g
###Verifying the account your logged into npm whoami
###Creating a new account
<?php | |
/** Retorna que valida CPF retorna FALSE se errado e TRUE se correto | |
* Fonte: http://www.geradorcpf.com/script-validar-cpf-php.htm | |
*/ | |
static function validaCPF($cpf) { | |
// Verifica se um número foi informado | |
if(empty($cpf)) { | |
return false; | |
} |
/** source: http://stackoverflow.com/a/18608587/1252947 **/ | |
<?php | |
<select id="year"> | |
<? | |
$currentValue = date("Y"); | |
$past = 20; | |
$future = 0; | |
if ($currentValue && ($currentValue < date('Y') - $past || $currentValue > date('Y') + $future)) { | |
echo "<option value=\"$currentValue\" selected=\"selected\">$currentValue</option>\n"; | |
} |
Comandos acessíveis do terminal estão localizados em alguma pasta cadastrada no PATH do sistema. Para descobrir de qual pasta o comando está sendo chamado use o comando which: | |
- which php | |
- which java | |
Apache | |
Ativar o mod_rewrite do apache: | |
- sudo a2enmod rewrite | |
Para fazer o mod_rewrite funcionar completamente talvez seja preciso alterar o AllowOverride None para All: | |
<Directory /> |
<?php | |
$a = 1.01; + | |
$b = '1.1'; | |
echo bcadd($a, $b, 2); | |
echo "</br>"; | |
$first = bcsub('1000', 333.33, 2); | |
echo $first . '</br>'; |
<?php | |
static function dataToString($set, $input, $key_type = 'number') { | |
if($key_type === 'number') { | |
return isset($set[intval($input)]) ? $set[intval($input)] : ''; | |
} else { | |
return isset($set[$input]) ? $set[$input] : ''; | |
} | |
} |