Skip to content

Instantly share code, notes, and snippets.

View thiagosf's full-sized avatar
🏠
Always working at home

Thiago Silva Ferreira thiagosf

🏠
Always working at home
View GitHub Profile
@thiagosf
thiagosf / _downloadImage.php
Created January 25, 2012 19:08
Download de imagem externa
<?php
function _downloadImage ($url, $fullpath = 'local/path/')
{
$pathinfo = pathinfo($url);
$fullpath = $fullpath . $pathinfo['basename'];
$out = $fullpath;
$ch = curl_init($url);
$fp = fopen($fullpath, 'wb');
@thiagosf
thiagosf / linux-iptables
Last active December 20, 2015 17:00
Instrução IPTables para direcionar dominios para IP com porta definida manualmente #notes
$ iptables -t nat -A OUTPUT -p tcp --dport 80 -d test.dev -j DNAT --to-destination 33.33.33.60:7001
@thiagosf
thiagosf / Vagrantfile
Created August 1, 2015 15:30
Configuração simples do vagrant para desenvolvimento web com: apache, php e mysql
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "phpdevbox"
config.vm.network :hostonly, "192.168.33.10"
config.vm.forward_port 80, 8080
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y vim
@thiagosf
thiagosf / remove-ds.sh
Last active December 20, 2015 00:20
Remove arquivos DS_Store recursivamente de um diretório #notes
find . -name '*.DS_Store' -type f -delete
@thiagosf
thiagosf / compact-all.sh
Created December 20, 2015 16:55
Compactar um diretório recursivamente #notes
zip -r name_of_your_directory.zip name_of_your_directory
@thiagosf
thiagosf / Vagrantfile
Created December 20, 2015 16:56
Habilitar ioapic para trabalhar com mais de um núcleo no vagrant #notes
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
@thiagosf
thiagosf / crontab.sh
Created December 20, 2015 16:57
Exibir crontab de todos usuários do sistema #notes
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
@thiagosf
thiagosf / crontab.sh
Created December 20, 2015 16:58
Crontab para acessar uma determinada url de hora em hora #notes
00 00-23 * * * wget -O - http://your-domain.com >/dev/null 2>&1
@thiagosf
thiagosf / script.sh
Created December 20, 2015 16:58
Rodar um script em ruby com crontab #notes
bash -c 'source /etc/profile.d/rvm.sh && cd /folder && ruby script.rb'
@thiagosf
thiagosf / search-replace-vim.sh
Created December 20, 2015 16:59
Search e replace com vim #notes
:%s/foo/bar/g