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 / mysql5-restart-macports
Created November 27, 2013 00:20
How to restart MySQL5 and Apache on your Mac when it has been installed with MacPorts requires three separate commands. The command for the MySQL server is different from the one for the web server. See code below. First lines are for MySQL 5 and the other line is for Apache.Reasons this might be necessary is because your box did not close prope…
##MySQL5
sudo launchctl unload -w /Library/LaunchDaemons/org.macports.mysql5.plist
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
Post navigation
##Apache
sudo apachectl -k restart
@jasperf
jasperf / proftpd-macports-restart
Last active December 29, 2015 12:09
Restart MacPorts ProFTPD Server after the server got terminated for whatever reason. Took me a while to figure this out, but with help from so at Serverfault I figured it out. #ftp #macports #proftp
##http://serverfault.com/questions/531685/proftp-on-macports-connection-refused
sudo /opt/local/etc/LaunchDaemons/org.macports.proftpd/proftpd.wrapper start
@jasperf
jasperf / find-word-in-files-inside-directory.sh
Last active February 22, 2020 10:22
Find word (name) inside files inside directory (folder) from the command line #unix #grep #find
# Basic grep example
grep -R "word" directory-of-choice/
# basic find example
find inside-directory-x -name name
#or http://stackoverflow.com/questions/16956810/finding-all-files-containing-a-text-string-on-linux
grep -rnw 'directory' -e "pattern"
# find word inside directory, exclude a direcory while looking for it and then only display files that
# contain that word
grep -nrl "gif;base64" domain.com --exclude-dir=domain.com/wp-content/cache
@jasperf
jasperf / osx-flus-dns
Last active December 31, 2015 14:29
Flush DNS on OSX Mountain Lion #dns #osx
sudo killall -HUP mDNSResponder // https://discussions.apple.com/thread/4829348?tstart=0
dscacheutil -flushcache //cache utility tool for OSX
@jasperf
jasperf / set-permission-wp-site
Last active January 30, 2016 10:41
Make WordPress run properly on local MAMP/Macports setup. It can be adjusted to run on a production server as well. In that case the ROOT path and other variables need to be adjusted. #wordpress #security #bash
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
#Original script https://github.com/shoestrap/shoestrap/wiki/Permissions
#Make sure you name this file whatever.sh and make it chmod 777 before executing it: bash whatever.sh
#
@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 / file-permissions-with-numbers
Last active June 30, 2016 03:21
Show chmod file permissions from the command line with numbers (octals) using stat #chmod #permissions #unix
stat -c "%a %n" *
// -c is for file format, %a is for octal, %n is for file name
//http://geeklog.adamwilson.info/article/58/getting-file-permissions-in-octal-on-OS-X
//OSX Yosemite does not work with -c use:
stat -f '%A %a %N' *