Skip to content

Instantly share code, notes, and snippets.

View gpassarelli's full-sized avatar

Gabriel Passarelli gpassarelli

View GitHub Profile
@gpassarelli
gpassarelli / find_php_ini
Last active August 29, 2015 14:13
Find location of the php.ini file in use
php -i | grep 'Configuration File'
@gpassarelli
gpassarelli / jquery
Created January 20, 2015 19:28
Safe jQuery Init
function($) {
// Execute when page is loaded
$(function() {
});
})(jQuery);
@gpassarelli
gpassarelli / remove_ip_fail2ban
Created January 20, 2015 19:30
Remove blocked ip from Fail2Ban
#Get sudo user
sudo -s
#List iptables
iptables -L -n
#Remove the desired ip
iptables -D fail2ban-ssh -s banned_ip -j DROP
@gpassarelli
gpassarelli / delete_lines_vim
Created January 20, 2015 19:31
Delete all lines from a file with VIM
:1,$d
@gpassarelli
gpassarelli / gist:02bfa341918b6df2057b
Created January 20, 2015 19:31
Disable / Enable Mac Dashboard
# Disable
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock
# Enable
defaults write com.apple.dashboard mcx-disabled -boolean NO
killall Dock
@gpassarelli
gpassarelli / mysql_dump
Created January 20, 2015 19:32
MySQL DUMP
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
@gpassarelli
gpassarelli / fix_drupal_permission
Created January 20, 2015 19:34
Fix Drupal Files Permitions
cd /path_to_drupal_installation
chown -R www-data:www-data .
find . -type d -exec chmod u=rwx,g=rx,o=rx {} \;
find . -type f -exec chmod u=rw,g=r,o=r {} \;
@gpassarelli
gpassarelli / git_stash
Created January 20, 2015 19:35
Ignoring “Your local changes to the following files would be overwritten by merge” on pull
#Git - force a pull to overwrite everything, on every pull
git fetch origin master
git reset --hard FETCH_HEAD
git clean -df
@gpassarelli
gpassarelli / dock_spacer
Created January 20, 2015 19:35
Add spacer to Mac Dock
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
@gpassarelli
gpassarelli / user_role_filter
Created January 20, 2015 19:36
Laravel 4 auth role based page access
Route::filter('role', function()
{
if(Auth::user()->role != 'admin') {
return Redirect::to('home');
}
});
Route::get('protectedPage1', array('before'=>'role', function() {
// do your job
}));