Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / apache-disable-handlers
Last active August 29, 2015 13:56
Disallow the functioning / executing of PHP scripts in a folder / directory to avoid the adding of malicious files #apache #php #security
// the following filetypes will not be executed
AddHandler cgi-script .php .pl .jsp .asp .sh .cgi
Options -ExecCGI
@jasperf
jasperf / wplogin-ht-auth
Last active August 29, 2015 13:59
.htaccess authentication to protect wp-login.php against brute force attacks without blocking the whole site #wordpress #security #htaccess
#http://tools.dynamicdrive.com/password/
AuthType Basic
AuthName "Graag twee keer login invoeren en daarna standaaard WordPress login"
AuthUserFile /path/to/file/.htpasswd
<Files wp-login.php>
Require valid-user
</Files>
#Dreamhost required this directive above WP directive
@jasperf
jasperf / wordpress-disable-plugins
Last active August 29, 2015 14:01
Disable the WordPress plugins manually from the backend with PHPMyAdmin #wordpress #plugins #phpmyadmin
//Go to databaase > wp options
//find row active_plugins
// remove all serialized data
//save et voila
@jasperf
jasperf / group all files under same group automatically
Created June 3, 2014 13:10
Command to make all new files and directories created under the directory belong to the same group as that directory. #chown #unix
#make all files within a directory belong to a group
chmod g+s
@jasperf
jasperf / .htaccess-seo-tweaks
Last active August 29, 2015 14:02
.htacess snippets to expire headers, add cache control header, gzip #seo Gzip check here http://www.feedthebot.com/tools/gzip/
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
# ExpiresByType text/css "access plus 2592000 seconds"
@jasperf
jasperf / unix-useradd-and-chroot
Last active August 29, 2015 14:02
Add a (ssh) user to unix or linux server, put the user in sudo users group and chroot the ssh/sftp user to a path of choice so it can only work from a certain directory #centos #chroot #unix
//check if port is in use
netstat -ln |grep 8080
//check what is using this port
netstat -tupln |grep 8080
@jasperf
jasperf / remove-pdf-sec-limitations
Created June 27, 2014 04:04
Removing pdf security limitations so you can copy text or edit the pdf document with ghostscript. This is a really easy command line way to (re)gain control over a pdf's content #hacks #pdf http://www.commandlinefu.com/commands/view/4345/remove-security-limitations-from-pdf-documents-using-ghostscript
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=OUTPUT.pdf -c .setpdfwrite -f INPUT.pdf
@jasperf
jasperf / remove-files-current-dir
Last active August 29, 2015 14:03
Remove all files in current directory from the command line #unix #linux #osx
rm -rf .*
@jasperf
jasperf / gist:a38d6d63f7b9c31d7f4a
Last active August 29, 2015 14:03 — forked from ifnull/gist:5055099
Show the permissions of (current) directory in numeric values like 777 or 755 depending on the setup. This is sometimes easier than looking at the rights with alphabets.
stat -c "%a %n" .
@jasperf
jasperf / chmod_files_and_dirs.sh
Created July 7, 2014 11:40 — forked from infolock/chmod_files_and_dirs.sh
# Recursively find all files in the current directory and change to access of 644 and for directories to 755
# Recursively find all files in the current directory and change to access of 644
find ./ -type f -exec chmod 644 {} \;
# Recursively find all directories in the current directory and change to access of 755
find ./ -type d -exec chmod 755 {} \;